summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2022-12-22 18:25:29 +0100
committerLaurenz <laurmaedje@gmail.com>2022-12-22 18:25:29 +0100
commit8527517258cf62a2f229796cc3f118d8bf0494b6 (patch)
tree7662e90bcb9d610e63f4b1a9f1f12f84cb1f742a /src
parent947522b71aa6220ce8f006bfab4700d6e3cb04f1 (diff)
Rename `desc` to `terms`
Diffstat (limited to 'src')
-rw-r--r--src/ide/complete.rs10
-rw-r--r--src/ide/highlight.rs10
-rw-r--r--src/model/eval.rs6
-rw-r--r--src/model/library.rs10
-rw-r--r--src/syntax/ast.rs28
-rw-r--r--src/syntax/kind.rs19
-rw-r--r--src/syntax/parsing.rs6
7 files changed, 43 insertions, 46 deletions
diff --git a/src/ide/complete.rs b/src/ide/complete.rs
index 27b81fb2..e069391f 100644
--- a/src/ide/complete.rs
+++ b/src/ide/complete.rs
@@ -712,25 +712,25 @@ impl<'a> CompletionContext<'a> {
self.snippet_completion(
"list item",
"- ${item}",
- "Inserts an item of an unordered list.",
+ "Inserts an item of a bullet list.",
);
self.snippet_completion(
"enumeration item",
"+ ${item}",
- "Inserts an item of an ordered list.",
+ "Inserts an item of a numbered list.",
);
self.snippet_completion(
"enumeration item (numbered)",
"${number}. ${item}",
- "Inserts an explicitly numbered item of an ordered list.",
+ "Inserts an explicitly numbered list item.",
);
self.snippet_completion(
- "description list item",
+ "term list item",
"/ ${term}: ${description}",
- "Inserts an item of a description list.",
+ "Inserts an item of a term list.",
);
self.snippet_completion(
diff --git a/src/ide/highlight.rs b/src/ide/highlight.rs
index ff9b8450..1f52ae95 100644
--- a/src/ide/highlight.rs
+++ b/src/ide/highlight.rs
@@ -23,9 +23,9 @@ pub enum Category {
Ref,
/// A section heading.
Heading,
- /// A marker of a list, enumeration, or description list.
+ /// A marker of a list, enumeration, or term list.
ListMarker,
- /// A term in a description list.
+ /// A term in a term list.
ListTerm,
/// The delimiters of a math formula.
MathDelimiter,
@@ -114,7 +114,7 @@ pub fn highlight(node: &LinkedNode) -> Option<Category> {
_ => Category::Operator,
}),
SyntaxKind::Slash => Some(match node.parent_kind() {
- Some(SyntaxKind::DescItem) => Category::ListMarker,
+ Some(SyntaxKind::TermItem) => Category::ListMarker,
Some(SyntaxKind::Frac) => Category::MathOperator,
_ => Category::Operator,
}),
@@ -159,7 +159,7 @@ pub fn highlight(node: &LinkedNode) -> Option<Category> {
SyntaxKind::From => Some(Category::Keyword),
SyntaxKind::Markup { .. }
- if node.parent_kind() == Some(&SyntaxKind::DescItem)
+ if node.parent_kind() == Some(&SyntaxKind::TermItem)
&& node.next_sibling().as_ref().map(|v| v.kind())
== Some(&SyntaxKind::Colon) =>
{
@@ -183,7 +183,7 @@ pub fn highlight(node: &LinkedNode) -> Option<Category> {
SyntaxKind::ListItem => None,
SyntaxKind::EnumItem => None,
SyntaxKind::EnumNumbering(_) => Some(Category::ListMarker),
- SyntaxKind::DescItem => None,
+ SyntaxKind::TermItem => None,
SyntaxKind::Math => None,
SyntaxKind::Atom(_) => None,
SyntaxKind::Script => None,
diff --git a/src/model/eval.rs b/src/model/eval.rs
index 6ad27d6e..ce1739ed 100644
--- a/src/model/eval.rs
+++ b/src/model/eval.rs
@@ -274,7 +274,7 @@ impl Eval for ast::MarkupNode {
Self::Heading(v) => v.eval(vm)?,
Self::List(v) => v.eval(vm)?,
Self::Enum(v) => v.eval(vm)?,
- Self::Desc(v) => v.eval(vm)?,
+ Self::Term(v) => v.eval(vm)?,
Self::Ref(v) => v.eval(vm)?,
Self::Expr(_) => unimplemented!("handled above"),
}
@@ -393,13 +393,13 @@ impl Eval for ast::EnumItem {
}
}
-impl Eval for ast::DescItem {
+impl Eval for ast::TermItem {
type Output = Content;
fn eval(&self, vm: &mut Vm) -> SourceResult<Self::Output> {
let term = self.term().eval(vm)?;
let description = self.description().eval(vm)?;
- Ok((vm.items.desc_item)(term, description))
+ Ok((vm.items.term_item)(term, description))
}
}
diff --git a/src/model/library.rs b/src/model/library.rs
index 41a5e8d4..c6449e27 100644
--- a/src/model/library.rs
+++ b/src/model/library.rs
@@ -59,12 +59,12 @@ pub struct LangItems {
pub ref_: fn(target: EcoString) -> Content,
/// A section heading: `= Introduction`.
pub heading: fn(level: NonZeroUsize, body: Content) -> Content,
- /// An item in an unordered list: `- ...`.
+ /// An item in a bullet list: `- ...`.
pub list_item: fn(body: Content) -> Content,
- /// An item in an enumeration (ordered list): `+ ...` or `1. ...`.
+ /// An item in an enumeration (numbered list): `+ ...` or `1. ...`.
pub enum_item: fn(number: Option<NonZeroUsize>, body: Content) -> Content,
- /// An item in a description list: `/ Term: Details`.
- pub desc_item: fn(term: Content, description: Content) -> Content,
+ /// An item in a term list: `/ Term: Details`.
+ pub term_item: fn(term: Content, description: Content) -> Content,
/// A mathematical formula: `$x$`, `$ x^2 $`.
pub math: fn(children: Vec<Content>, block: bool) -> Content,
/// An atom in a formula: `x`, `+`, `12`.
@@ -102,7 +102,7 @@ impl Hash for LangItems {
self.heading.hash(state);
self.list_item.hash(state);
self.enum_item.hash(state);
- self.desc_item.hash(state);
+ self.term_item.hash(state);
self.math.hash(state);
self.math_atom.hash(state);
self.math_script.hash(state);
diff --git a/src/syntax/ast.rs b/src/syntax/ast.rs
index 5847e816..d2b19ee3 100644
--- a/src/syntax/ast.rs
+++ b/src/syntax/ast.rs
@@ -101,12 +101,12 @@ pub enum MarkupNode {
Ref(Ref),
/// A section heading: `= Introduction`.
Heading(Heading),
- /// An item in an unordered list: `- ...`.
+ /// An item in a bullet list: `- ...`.
List(ListItem),
- /// An item in an enumeration (ordered list): `+ ...` or `1. ...`.
+ /// An item in an enumeration (numbered list): `+ ...` or `1. ...`.
Enum(EnumItem),
- /// An item in a description list: `/ Term: Details`.
- Desc(DescItem),
+ /// An item in a term list: `/ Term: Details`.
+ Term(TermItem),
/// An expression.
Expr(Expr),
}
@@ -129,7 +129,7 @@ impl AstNode for MarkupNode {
SyntaxKind::Heading => node.cast().map(Self::Heading),
SyntaxKind::ListItem => node.cast().map(Self::List),
SyntaxKind::EnumItem => node.cast().map(Self::Enum),
- SyntaxKind::DescItem => node.cast().map(Self::Desc),
+ SyntaxKind::TermItem => node.cast().map(Self::Term),
_ => node.cast().map(Self::Expr),
}
}
@@ -151,7 +151,7 @@ impl AstNode for MarkupNode {
Self::Heading(v) => v.as_untyped(),
Self::List(v) => v.as_untyped(),
Self::Enum(v) => v.as_untyped(),
- Self::Desc(v) => v.as_untyped(),
+ Self::Term(v) => v.as_untyped(),
Self::Expr(v) => v.as_untyped(),
}
}
@@ -362,7 +362,7 @@ impl Heading {
}
node! {
- /// An item in an unordered list: `- ...`.
+ /// An item in a bullet list: `- ...`.
ListItem
}
@@ -374,7 +374,7 @@ impl ListItem {
}
node! {
- /// An item in an enumeration (ordered list): `+ ...` or `1. ...`.
+ /// An item in an enumeration (numbered list): `+ ...` or `1. ...`.
EnumItem
}
@@ -394,23 +394,21 @@ impl EnumItem {
}
node! {
- /// An item in a description list: `/ Term: Details`.
- DescItem
+ /// An item in a term list: `/ Term: Details`.
+ TermItem
}
-impl DescItem {
+impl TermItem {
/// The term described by the item.
pub fn term(&self) -> Markup {
- self.0
- .cast_first_child()
- .expect("description list item is missing term")
+ self.0.cast_first_child().expect("term list item is missing term")
}
/// The description of the term.
pub fn description(&self) -> Markup {
self.0
.cast_last_child()
- .expect("description list item is missing description")
+ .expect("term list item is missing description")
}
}
diff --git a/src/syntax/kind.rs b/src/syntax/kind.rs
index 02e972c4..27a8da0f 100644
--- a/src/syntax/kind.rs
+++ b/src/syntax/kind.rs
@@ -39,8 +39,7 @@ pub enum SyntaxKind {
/// A semicolon terminating an expression: `;`.
Semicolon,
/// A colon between name/key and value in a dictionary, argument or
- /// parameter list, or between the term and body of a description list
- /// term: `:`.
+ /// parameter list, or between the term and body of a term list term: `:`.
Colon,
/// The strong text toggle, multiplication operator, and wildcard import
/// symbol: `*`.
@@ -54,8 +53,8 @@ pub enum SyntaxKind {
/// The unary negation, binary subtraction operator, and start of list
/// items: `-`.
Minus,
- /// The division operator, start of description list items, and fraction
- /// operator in a formula: `/`.
+ /// The division operator, start of term list items, and fraction operator
+ /// in a formula: `/`.
Slash,
/// The superscript operator in a formula: `^`.
Hat,
@@ -163,14 +162,14 @@ pub enum SyntaxKind {
Ref(EcoString),
/// A section heading: `= Introduction`.
Heading,
- /// An item in an unordered list: `- ...`.
+ /// An item in a bullet list: `- ...`.
ListItem,
- /// An item in an enumeration (ordered list): `+ ...` or `1. ...`.
+ /// An item in an enumeration (numbered list): `+ ...` or `1. ...`.
EnumItem,
/// An explicit enumeration numbering: `23.`.
EnumNumbering(NonZeroUsize),
- /// An item in a description list: `/ Term: Details`.
- DescItem,
+ /// An item in a term list: `/ Term: Details`.
+ TermItem,
/// A mathematical formula: `$x$`, `$ x^2 $`.
Math,
/// An atom in a formula: `x`, `+`, `12`.
@@ -405,7 +404,7 @@ impl SyntaxKind {
Self::ListItem => "list item",
Self::EnumItem => "enumeration item",
Self::EnumNumbering(_) => "enumeration item numbering",
- Self::DescItem => "description list item",
+ Self::TermItem => "term list item",
Self::Math => "math formula",
Self::Atom(s) => match s.as_str() {
"(" => "opening paren",
@@ -533,7 +532,7 @@ impl Hash for SyntaxKind {
Self::ListItem => {}
Self::EnumItem => {}
Self::EnumNumbering(num) => num.hash(state),
- Self::DescItem => {}
+ Self::TermItem => {}
Self::Math => {}
Self::Atom(c) => c.hash(state),
Self::Script => {}
diff --git a/src/syntax/parsing.rs b/src/syntax/parsing.rs
index d751b6aa..e0405407 100644
--- a/src/syntax/parsing.rs
+++ b/src/syntax/parsing.rs
@@ -247,7 +247,7 @@ fn markup_node(p: &mut Parser, at_start: &mut bool) {
SyntaxKind::Minus => list_item(p, *at_start),
SyntaxKind::Plus | SyntaxKind::EnumNumbering(_) => enum_item(p, *at_start),
SyntaxKind::Slash => {
- desc_item(p, *at_start).ok();
+ term_item(p, *at_start).ok();
}
SyntaxKind::Colon => {
let marker = p.marker();
@@ -341,7 +341,7 @@ fn enum_item(p: &mut Parser, at_start: bool) {
}
}
-fn desc_item(p: &mut Parser, at_start: bool) -> ParseResult {
+fn term_item(p: &mut Parser, at_start: bool) -> ParseResult {
let marker = p.marker();
let text: EcoString = p.peek_src().into();
p.eat();
@@ -351,7 +351,7 @@ fn desc_item(p: &mut Parser, at_start: bool) -> ParseResult {
markup_line(p, |node| matches!(node, SyntaxKind::Colon));
p.expect(SyntaxKind::Colon)?;
markup_indented(p, min_indent);
- marker.end(p, SyntaxKind::DescItem);
+ marker.end(p, SyntaxKind::TermItem);
} else {
marker.convert(p, SyntaxKind::Text(text));
}