Merge branch 'standard_ast_node'
This commit is contained in:
commit
10d03fd432
File diff suppressed because it is too large
Load Diff
@ -1,5 +1,6 @@
|
|||||||
use std::borrow::Cow;
|
use std::borrow::Cow;
|
||||||
|
|
||||||
|
use crate::types::AstNode;
|
||||||
use crate::types::AngleLink;
|
use crate::types::AngleLink;
|
||||||
use crate::types::BabelCall;
|
use crate::types::BabelCall;
|
||||||
use crate::types::Bold;
|
use crate::types::Bold;
|
||||||
@ -60,21 +61,84 @@ use crate::types::Verbatim;
|
|||||||
use crate::types::VerseBlock;
|
use crate::types::VerseBlock;
|
||||||
|
|
||||||
pub(crate) trait ElispFact<'s> {
|
pub(crate) trait ElispFact<'s> {
|
||||||
fn get_elisp_name(&'s self) -> Cow<'s, str>;
|
fn get_elisp_name<'b>(&'b self) -> Cow<'s, str>;
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) trait GetElispFact<'s> {
|
pub(crate) trait GetElispFact<'s> {
|
||||||
fn get_elisp_fact(&'s self) -> &'s dyn ElispFact<'s>;
|
fn get_elisp_fact<'b>(&'b self) -> &'b dyn ElispFact<'s>;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'s, I: ElispFact<'s>> GetElispFact<'s> for I {
|
impl<'s, I: ElispFact<'s>> GetElispFact<'s> for I {
|
||||||
fn get_elisp_fact(&'s self) -> &'s dyn ElispFact<'s> {
|
fn get_elisp_fact<'b>(&'b self) -> &'b dyn ElispFact<'s> {
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl<'r, 's> GetElispFact<'s> for AstNode<'r, 's> {
|
||||||
|
fn get_elisp_fact<'b>(&'b self) -> &'b dyn ElispFact<'s> {
|
||||||
|
match self {
|
||||||
|
AstNode::Document(inner) => *inner,
|
||||||
|
AstNode::Heading(inner) => *inner,
|
||||||
|
AstNode::Section(inner) => *inner,
|
||||||
|
AstNode::Paragraph(inner) => *inner,
|
||||||
|
AstNode::PlainList(inner) => *inner,
|
||||||
|
AstNode::PlainListItem(inner) => *inner,
|
||||||
|
AstNode::GreaterBlock(inner) => *inner,
|
||||||
|
AstNode::DynamicBlock(inner) => *inner,
|
||||||
|
AstNode::FootnoteDefinition(inner) => *inner,
|
||||||
|
AstNode::Comment(inner) => *inner,
|
||||||
|
AstNode::Drawer(inner) => *inner,
|
||||||
|
AstNode::PropertyDrawer(inner) => *inner,
|
||||||
|
AstNode::NodeProperty(inner) => *inner,
|
||||||
|
AstNode::Table(inner) => *inner,
|
||||||
|
AstNode::TableRow(inner) => *inner,
|
||||||
|
AstNode::VerseBlock(inner) => *inner,
|
||||||
|
AstNode::CommentBlock(inner) => *inner,
|
||||||
|
AstNode::ExampleBlock(inner) => *inner,
|
||||||
|
AstNode::ExportBlock(inner) => *inner,
|
||||||
|
AstNode::SrcBlock(inner) => *inner,
|
||||||
|
AstNode::Clock(inner) => *inner,
|
||||||
|
AstNode::DiarySexp(inner) => *inner,
|
||||||
|
AstNode::Planning(inner) => *inner,
|
||||||
|
AstNode::FixedWidthArea(inner) => *inner,
|
||||||
|
AstNode::HorizontalRule(inner) => *inner,
|
||||||
|
AstNode::Keyword(inner) => *inner,
|
||||||
|
AstNode::BabelCall(inner) => *inner,
|
||||||
|
AstNode::LatexEnvironment(inner) => *inner,
|
||||||
|
AstNode::Bold(inner) => *inner,
|
||||||
|
AstNode::Italic(inner) => *inner,
|
||||||
|
AstNode::Underline(inner) => *inner,
|
||||||
|
AstNode::StrikeThrough(inner) => *inner,
|
||||||
|
AstNode::Code(inner) => *inner,
|
||||||
|
AstNode::Verbatim(inner) => *inner,
|
||||||
|
AstNode::PlainText(inner) => *inner,
|
||||||
|
AstNode::RegularLink(inner) => *inner,
|
||||||
|
AstNode::RadioLink(inner) => *inner,
|
||||||
|
AstNode::RadioTarget(inner) => *inner,
|
||||||
|
AstNode::PlainLink(inner) => *inner,
|
||||||
|
AstNode::AngleLink(inner) => *inner,
|
||||||
|
AstNode::OrgMacro(inner) => *inner,
|
||||||
|
AstNode::Entity(inner) => *inner,
|
||||||
|
AstNode::LatexFragment(inner) => *inner,
|
||||||
|
AstNode::ExportSnippet(inner) => *inner,
|
||||||
|
AstNode::FootnoteReference(inner) => *inner,
|
||||||
|
AstNode::Citation(inner) => *inner,
|
||||||
|
AstNode::CitationReference(inner) => *inner,
|
||||||
|
AstNode::InlineBabelCall(inner) => *inner,
|
||||||
|
AstNode::InlineSourceBlock(inner) => *inner,
|
||||||
|
AstNode::LineBreak(inner) => *inner,
|
||||||
|
AstNode::Target(inner) => *inner,
|
||||||
|
AstNode::StatisticsCookie(inner) => *inner,
|
||||||
|
AstNode::Subscript(inner) => *inner,
|
||||||
|
AstNode::Superscript(inner) => *inner,
|
||||||
|
AstNode::TableCell(inner) => *inner,
|
||||||
|
AstNode::Timestamp(inner) => *inner,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl<'s> GetElispFact<'s> for Element<'s> {
|
impl<'s> GetElispFact<'s> for Element<'s> {
|
||||||
fn get_elisp_fact(&'s self) -> &'s dyn ElispFact<'s> {
|
fn get_elisp_fact<'b>(&'b self) -> &'b dyn ElispFact<'s> {
|
||||||
match self {
|
match self {
|
||||||
Element::Paragraph(inner) => inner,
|
Element::Paragraph(inner) => inner,
|
||||||
Element::PlainList(inner) => inner,
|
Element::PlainList(inner) => inner,
|
||||||
@ -103,7 +167,7 @@ impl<'s> GetElispFact<'s> for Element<'s> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl<'s> GetElispFact<'s> for Object<'s> {
|
impl<'s> GetElispFact<'s> for Object<'s> {
|
||||||
fn get_elisp_fact(&'s self) -> &'s dyn ElispFact<'s> {
|
fn get_elisp_fact<'b>(&'b self) -> &'b dyn ElispFact<'s> {
|
||||||
match self {
|
match self {
|
||||||
Object::Bold(inner) => inner,
|
Object::Bold(inner) => inner,
|
||||||
Object::Italic(inner) => inner,
|
Object::Italic(inner) => inner,
|
||||||
@ -137,37 +201,37 @@ impl<'s> GetElispFact<'s> for Object<'s> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl<'s> ElispFact<'s> for Document<'s> {
|
impl<'s> ElispFact<'s> for Document<'s> {
|
||||||
fn get_elisp_name(&'s self) -> Cow<'s, str> {
|
fn get_elisp_name<'b>(&'b self) -> Cow<'s, str> {
|
||||||
"org-data".into()
|
"org-data".into()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'s> ElispFact<'s> for Section<'s> {
|
impl<'s> ElispFact<'s> for Section<'s> {
|
||||||
fn get_elisp_name(&'s self) -> Cow<'s, str> {
|
fn get_elisp_name<'b>(&'b self) -> Cow<'s, str> {
|
||||||
"section".into()
|
"section".into()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'s> ElispFact<'s> for Heading<'s> {
|
impl<'s> ElispFact<'s> for Heading<'s> {
|
||||||
fn get_elisp_name(&'s self) -> Cow<'s, str> {
|
fn get_elisp_name<'b>(&'b self) -> Cow<'s, str> {
|
||||||
"headline".into()
|
"headline".into()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'s> ElispFact<'s> for PlainList<'s> {
|
impl<'s> ElispFact<'s> for PlainList<'s> {
|
||||||
fn get_elisp_name(&'s self) -> Cow<'s, str> {
|
fn get_elisp_name<'b>(&'b self) -> Cow<'s, str> {
|
||||||
"plain-list".into()
|
"plain-list".into()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'s> ElispFact<'s> for PlainListItem<'s> {
|
impl<'s> ElispFact<'s> for PlainListItem<'s> {
|
||||||
fn get_elisp_name(&'s self) -> Cow<'s, str> {
|
fn get_elisp_name<'b>(&'b self) -> Cow<'s, str> {
|
||||||
"item".into()
|
"item".into()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'s> ElispFact<'s> for GreaterBlock<'s> {
|
impl<'s> ElispFact<'s> for GreaterBlock<'s> {
|
||||||
fn get_elisp_name(&'s self) -> Cow<'s, str> {
|
fn get_elisp_name<'b>(&'b self) -> Cow<'s, str> {
|
||||||
match self.name.to_lowercase().as_str() {
|
match self.name.to_lowercase().as_str() {
|
||||||
"center" => "center-block".into(),
|
"center" => "center-block".into(),
|
||||||
"quote" => "quote-block".into(),
|
"quote" => "quote-block".into(),
|
||||||
@ -177,297 +241,297 @@ impl<'s> ElispFact<'s> for GreaterBlock<'s> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl<'s> ElispFact<'s> for DynamicBlock<'s> {
|
impl<'s> ElispFact<'s> for DynamicBlock<'s> {
|
||||||
fn get_elisp_name(&'s self) -> Cow<'s, str> {
|
fn get_elisp_name<'b>(&'b self) -> Cow<'s, str> {
|
||||||
"dynamic-block".into()
|
"dynamic-block".into()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'s> ElispFact<'s> for FootnoteDefinition<'s> {
|
impl<'s> ElispFact<'s> for FootnoteDefinition<'s> {
|
||||||
fn get_elisp_name(&'s self) -> Cow<'s, str> {
|
fn get_elisp_name<'b>(&'b self) -> Cow<'s, str> {
|
||||||
"footnote-definition".into()
|
"footnote-definition".into()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'s> ElispFact<'s> for Drawer<'s> {
|
impl<'s> ElispFact<'s> for Drawer<'s> {
|
||||||
fn get_elisp_name(&'s self) -> Cow<'s, str> {
|
fn get_elisp_name<'b>(&'b self) -> Cow<'s, str> {
|
||||||
"drawer".into()
|
"drawer".into()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'s> ElispFact<'s> for PropertyDrawer<'s> {
|
impl<'s> ElispFact<'s> for PropertyDrawer<'s> {
|
||||||
fn get_elisp_name(&'s self) -> Cow<'s, str> {
|
fn get_elisp_name<'b>(&'b self) -> Cow<'s, str> {
|
||||||
"property-drawer".into()
|
"property-drawer".into()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'s> ElispFact<'s> for NodeProperty<'s> {
|
impl<'s> ElispFact<'s> for NodeProperty<'s> {
|
||||||
fn get_elisp_name(&'s self) -> Cow<'s, str> {
|
fn get_elisp_name<'b>(&'b self) -> Cow<'s, str> {
|
||||||
"node-property".into()
|
"node-property".into()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'s> ElispFact<'s> for Table<'s> {
|
impl<'s> ElispFact<'s> for Table<'s> {
|
||||||
fn get_elisp_name(&'s self) -> Cow<'s, str> {
|
fn get_elisp_name<'b>(&'b self) -> Cow<'s, str> {
|
||||||
"table".into()
|
"table".into()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'s> ElispFact<'s> for TableRow<'s> {
|
impl<'s> ElispFact<'s> for TableRow<'s> {
|
||||||
fn get_elisp_name(&'s self) -> Cow<'s, str> {
|
fn get_elisp_name<'b>(&'b self) -> Cow<'s, str> {
|
||||||
"table-row".into()
|
"table-row".into()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'s> ElispFact<'s> for Paragraph<'s> {
|
impl<'s> ElispFact<'s> for Paragraph<'s> {
|
||||||
fn get_elisp_name(&'s self) -> Cow<'s, str> {
|
fn get_elisp_name<'b>(&'b self) -> Cow<'s, str> {
|
||||||
"paragraph".into()
|
"paragraph".into()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'s> ElispFact<'s> for TableCell<'s> {
|
impl<'s> ElispFact<'s> for TableCell<'s> {
|
||||||
fn get_elisp_name(&'s self) -> Cow<'s, str> {
|
fn get_elisp_name<'b>(&'b self) -> Cow<'s, str> {
|
||||||
"table-cell".into()
|
"table-cell".into()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'s> ElispFact<'s> for Comment<'s> {
|
impl<'s> ElispFact<'s> for Comment<'s> {
|
||||||
fn get_elisp_name(&'s self) -> Cow<'s, str> {
|
fn get_elisp_name<'b>(&'b self) -> Cow<'s, str> {
|
||||||
"comment".into()
|
"comment".into()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'s> ElispFact<'s> for VerseBlock<'s> {
|
impl<'s> ElispFact<'s> for VerseBlock<'s> {
|
||||||
fn get_elisp_name(&'s self) -> Cow<'s, str> {
|
fn get_elisp_name<'b>(&'b self) -> Cow<'s, str> {
|
||||||
"verse-block".into()
|
"verse-block".into()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
impl<'s> ElispFact<'s> for CommentBlock<'s> {
|
impl<'s> ElispFact<'s> for CommentBlock<'s> {
|
||||||
fn get_elisp_name(&'s self) -> Cow<'s, str> {
|
fn get_elisp_name<'b>(&'b self) -> Cow<'s, str> {
|
||||||
"comment-block".into()
|
"comment-block".into()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
impl<'s> ElispFact<'s> for ExampleBlock<'s> {
|
impl<'s> ElispFact<'s> for ExampleBlock<'s> {
|
||||||
fn get_elisp_name(&'s self) -> Cow<'s, str> {
|
fn get_elisp_name<'b>(&'b self) -> Cow<'s, str> {
|
||||||
"example-block".into()
|
"example-block".into()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
impl<'s> ElispFact<'s> for ExportBlock<'s> {
|
impl<'s> ElispFact<'s> for ExportBlock<'s> {
|
||||||
fn get_elisp_name(&'s self) -> Cow<'s, str> {
|
fn get_elisp_name<'b>(&'b self) -> Cow<'s, str> {
|
||||||
"export-block".into()
|
"export-block".into()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
impl<'s> ElispFact<'s> for SrcBlock<'s> {
|
impl<'s> ElispFact<'s> for SrcBlock<'s> {
|
||||||
fn get_elisp_name(&'s self) -> Cow<'s, str> {
|
fn get_elisp_name<'b>(&'b self) -> Cow<'s, str> {
|
||||||
"src-block".into()
|
"src-block".into()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'s> ElispFact<'s> for Clock<'s> {
|
impl<'s> ElispFact<'s> for Clock<'s> {
|
||||||
fn get_elisp_name(&'s self) -> Cow<'s, str> {
|
fn get_elisp_name<'b>(&'b self) -> Cow<'s, str> {
|
||||||
"clock".into()
|
"clock".into()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'s> ElispFact<'s> for DiarySexp<'s> {
|
impl<'s> ElispFact<'s> for DiarySexp<'s> {
|
||||||
fn get_elisp_name(&'s self) -> Cow<'s, str> {
|
fn get_elisp_name<'b>(&'b self) -> Cow<'s, str> {
|
||||||
"diary-sexp".into()
|
"diary-sexp".into()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'s> ElispFact<'s> for Planning<'s> {
|
impl<'s> ElispFact<'s> for Planning<'s> {
|
||||||
fn get_elisp_name(&'s self) -> Cow<'s, str> {
|
fn get_elisp_name<'b>(&'b self) -> Cow<'s, str> {
|
||||||
"planning".into()
|
"planning".into()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'s> ElispFact<'s> for FixedWidthArea<'s> {
|
impl<'s> ElispFact<'s> for FixedWidthArea<'s> {
|
||||||
fn get_elisp_name(&'s self) -> Cow<'s, str> {
|
fn get_elisp_name<'b>(&'b self) -> Cow<'s, str> {
|
||||||
"fixed-width".into()
|
"fixed-width".into()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'s> ElispFact<'s> for HorizontalRule<'s> {
|
impl<'s> ElispFact<'s> for HorizontalRule<'s> {
|
||||||
fn get_elisp_name(&'s self) -> Cow<'s, str> {
|
fn get_elisp_name<'b>(&'b self) -> Cow<'s, str> {
|
||||||
"horizontal-rule".into()
|
"horizontal-rule".into()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'s> ElispFact<'s> for Keyword<'s> {
|
impl<'s> ElispFact<'s> for Keyword<'s> {
|
||||||
fn get_elisp_name(&'s self) -> Cow<'s, str> {
|
fn get_elisp_name<'b>(&'b self) -> Cow<'s, str> {
|
||||||
"keyword".into()
|
"keyword".into()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'s> ElispFact<'s> for BabelCall<'s> {
|
impl<'s> ElispFact<'s> for BabelCall<'s> {
|
||||||
fn get_elisp_name(&'s self) -> Cow<'s, str> {
|
fn get_elisp_name<'b>(&'b self) -> Cow<'s, str> {
|
||||||
"babel-call".into()
|
"babel-call".into()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'s> ElispFact<'s> for LatexEnvironment<'s> {
|
impl<'s> ElispFact<'s> for LatexEnvironment<'s> {
|
||||||
fn get_elisp_name(&'s self) -> Cow<'s, str> {
|
fn get_elisp_name<'b>(&'b self) -> Cow<'s, str> {
|
||||||
"latex-environment".into()
|
"latex-environment".into()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'s> ElispFact<'s> for Bold<'s> {
|
impl<'s> ElispFact<'s> for Bold<'s> {
|
||||||
fn get_elisp_name(&'s self) -> Cow<'s, str> {
|
fn get_elisp_name<'b>(&'b self) -> Cow<'s, str> {
|
||||||
"bold".into()
|
"bold".into()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'s> ElispFact<'s> for Italic<'s> {
|
impl<'s> ElispFact<'s> for Italic<'s> {
|
||||||
fn get_elisp_name(&'s self) -> Cow<'s, str> {
|
fn get_elisp_name<'b>(&'b self) -> Cow<'s, str> {
|
||||||
"italic".into()
|
"italic".into()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'s> ElispFact<'s> for Underline<'s> {
|
impl<'s> ElispFact<'s> for Underline<'s> {
|
||||||
fn get_elisp_name(&'s self) -> Cow<'s, str> {
|
fn get_elisp_name<'b>(&'b self) -> Cow<'s, str> {
|
||||||
"underline".into()
|
"underline".into()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'s> ElispFact<'s> for StrikeThrough<'s> {
|
impl<'s> ElispFact<'s> for StrikeThrough<'s> {
|
||||||
fn get_elisp_name(&'s self) -> Cow<'s, str> {
|
fn get_elisp_name<'b>(&'b self) -> Cow<'s, str> {
|
||||||
"strike-through".into()
|
"strike-through".into()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'s> ElispFact<'s> for Code<'s> {
|
impl<'s> ElispFact<'s> for Code<'s> {
|
||||||
fn get_elisp_name(&'s self) -> Cow<'s, str> {
|
fn get_elisp_name<'b>(&'b self) -> Cow<'s, str> {
|
||||||
"code".into()
|
"code".into()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'s> ElispFact<'s> for Verbatim<'s> {
|
impl<'s> ElispFact<'s> for Verbatim<'s> {
|
||||||
fn get_elisp_name(&'s self) -> Cow<'s, str> {
|
fn get_elisp_name<'b>(&'b self) -> Cow<'s, str> {
|
||||||
"verbatim".into()
|
"verbatim".into()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'s> ElispFact<'s> for RegularLink<'s> {
|
impl<'s> ElispFact<'s> for RegularLink<'s> {
|
||||||
fn get_elisp_name(&'s self) -> Cow<'s, str> {
|
fn get_elisp_name<'b>(&'b self) -> Cow<'s, str> {
|
||||||
"link".into()
|
"link".into()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'s> ElispFact<'s> for RadioLink<'s> {
|
impl<'s> ElispFact<'s> for RadioLink<'s> {
|
||||||
fn get_elisp_name(&'s self) -> Cow<'s, str> {
|
fn get_elisp_name<'b>(&'b self) -> Cow<'s, str> {
|
||||||
"link".into()
|
"link".into()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'s> ElispFact<'s> for RadioTarget<'s> {
|
impl<'s> ElispFact<'s> for RadioTarget<'s> {
|
||||||
fn get_elisp_name(&'s self) -> Cow<'s, str> {
|
fn get_elisp_name<'b>(&'b self) -> Cow<'s, str> {
|
||||||
"radio-target".into()
|
"radio-target".into()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'s> ElispFact<'s> for PlainLink<'s> {
|
impl<'s> ElispFact<'s> for PlainLink<'s> {
|
||||||
fn get_elisp_name(&'s self) -> Cow<'s, str> {
|
fn get_elisp_name<'b>(&'b self) -> Cow<'s, str> {
|
||||||
"link".into()
|
"link".into()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'s> ElispFact<'s> for AngleLink<'s> {
|
impl<'s> ElispFact<'s> for AngleLink<'s> {
|
||||||
fn get_elisp_name(&'s self) -> Cow<'s, str> {
|
fn get_elisp_name<'b>(&'b self) -> Cow<'s, str> {
|
||||||
"link".into()
|
"link".into()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'s> ElispFact<'s> for OrgMacro<'s> {
|
impl<'s> ElispFact<'s> for OrgMacro<'s> {
|
||||||
fn get_elisp_name(&'s self) -> Cow<'s, str> {
|
fn get_elisp_name<'b>(&'b self) -> Cow<'s, str> {
|
||||||
"macro".into()
|
"macro".into()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'s> ElispFact<'s> for Entity<'s> {
|
impl<'s> ElispFact<'s> for Entity<'s> {
|
||||||
fn get_elisp_name(&'s self) -> Cow<'s, str> {
|
fn get_elisp_name<'b>(&'b self) -> Cow<'s, str> {
|
||||||
"entity".into()
|
"entity".into()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'s> ElispFact<'s> for LatexFragment<'s> {
|
impl<'s> ElispFact<'s> for LatexFragment<'s> {
|
||||||
fn get_elisp_name(&'s self) -> Cow<'s, str> {
|
fn get_elisp_name<'b>(&'b self) -> Cow<'s, str> {
|
||||||
"latex-fragment".into()
|
"latex-fragment".into()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'s> ElispFact<'s> for ExportSnippet<'s> {
|
impl<'s> ElispFact<'s> for ExportSnippet<'s> {
|
||||||
fn get_elisp_name(&'s self) -> Cow<'s, str> {
|
fn get_elisp_name<'b>(&'b self) -> Cow<'s, str> {
|
||||||
"export-snippet".into()
|
"export-snippet".into()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'s> ElispFact<'s> for FootnoteReference<'s> {
|
impl<'s> ElispFact<'s> for FootnoteReference<'s> {
|
||||||
fn get_elisp_name(&'s self) -> Cow<'s, str> {
|
fn get_elisp_name<'b>(&'b self) -> Cow<'s, str> {
|
||||||
"footnote-reference".into()
|
"footnote-reference".into()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'s> ElispFact<'s> for Citation<'s> {
|
impl<'s> ElispFact<'s> for Citation<'s> {
|
||||||
fn get_elisp_name(&'s self) -> Cow<'s, str> {
|
fn get_elisp_name<'b>(&'b self) -> Cow<'s, str> {
|
||||||
"citation".into()
|
"citation".into()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'s> ElispFact<'s> for CitationReference<'s> {
|
impl<'s> ElispFact<'s> for CitationReference<'s> {
|
||||||
fn get_elisp_name(&'s self) -> Cow<'s, str> {
|
fn get_elisp_name<'b>(&'b self) -> Cow<'s, str> {
|
||||||
"citation-reference".into()
|
"citation-reference".into()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'s> ElispFact<'s> for InlineBabelCall<'s> {
|
impl<'s> ElispFact<'s> for InlineBabelCall<'s> {
|
||||||
fn get_elisp_name(&'s self) -> Cow<'s, str> {
|
fn get_elisp_name<'b>(&'b self) -> Cow<'s, str> {
|
||||||
"inline-babel-call".into()
|
"inline-babel-call".into()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'s> ElispFact<'s> for InlineSourceBlock<'s> {
|
impl<'s> ElispFact<'s> for InlineSourceBlock<'s> {
|
||||||
fn get_elisp_name(&'s self) -> Cow<'s, str> {
|
fn get_elisp_name<'b>(&'b self) -> Cow<'s, str> {
|
||||||
"inline-src-block".into()
|
"inline-src-block".into()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'s> ElispFact<'s> for LineBreak<'s> {
|
impl<'s> ElispFact<'s> for LineBreak<'s> {
|
||||||
fn get_elisp_name(&'s self) -> Cow<'s, str> {
|
fn get_elisp_name<'b>(&'b self) -> Cow<'s, str> {
|
||||||
"line-break".into()
|
"line-break".into()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'s> ElispFact<'s> for Target<'s> {
|
impl<'s> ElispFact<'s> for Target<'s> {
|
||||||
fn get_elisp_name(&'s self) -> Cow<'s, str> {
|
fn get_elisp_name<'b>(&'b self) -> Cow<'s, str> {
|
||||||
"target".into()
|
"target".into()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'s> ElispFact<'s> for StatisticsCookie<'s> {
|
impl<'s> ElispFact<'s> for StatisticsCookie<'s> {
|
||||||
fn get_elisp_name(&'s self) -> Cow<'s, str> {
|
fn get_elisp_name<'b>(&'b self) -> Cow<'s, str> {
|
||||||
"statistics-cookie".into()
|
"statistics-cookie".into()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'s> ElispFact<'s> for Subscript<'s> {
|
impl<'s> ElispFact<'s> for Subscript<'s> {
|
||||||
fn get_elisp_name(&'s self) -> Cow<'s, str> {
|
fn get_elisp_name<'b>(&'b self) -> Cow<'s, str> {
|
||||||
"subscript".into()
|
"subscript".into()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'s> ElispFact<'s> for Superscript<'s> {
|
impl<'s> ElispFact<'s> for Superscript<'s> {
|
||||||
fn get_elisp_name(&'s self) -> Cow<'s, str> {
|
fn get_elisp_name<'b>(&'b self) -> Cow<'s, str> {
|
||||||
"superscript".into()
|
"superscript".into()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'s> ElispFact<'s> for Timestamp<'s> {
|
impl<'s> ElispFact<'s> for Timestamp<'s> {
|
||||||
fn get_elisp_name(&'s self) -> Cow<'s, str> {
|
fn get_elisp_name<'b>(&'b self) -> Cow<'s, str> {
|
||||||
"timestamp".into()
|
"timestamp".into()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'s> ElispFact<'s> for PlainText<'s> {
|
impl<'s> ElispFact<'s> for PlainText<'s> {
|
||||||
fn get_elisp_name(&'s self) -> Cow<'s, str> {
|
fn get_elisp_name<'b>(&'b self) -> Cow<'s, str> {
|
||||||
// plain text from upstream emacs does not actually have a name but this is included here to make rendering the status diff easier.
|
// plain text from upstream emacs does not actually have a name but this is included here to make rendering the status diff easier.
|
||||||
"plain-text".into()
|
"plain-text".into()
|
||||||
}
|
}
|
||||||
|
@ -16,9 +16,9 @@ fn is_slice_of(parent: &str, child: &str) -> bool {
|
|||||||
/// Get the byte offset into source that the rust object exists at.
|
/// Get the byte offset into source that the rust object exists at.
|
||||||
///
|
///
|
||||||
/// These offsets are zero-based unlike the elisp ones.
|
/// These offsets are zero-based unlike the elisp ones.
|
||||||
fn get_rust_byte_offsets<'s, S: StandardProperties<'s> + ?Sized>(
|
fn get_rust_byte_offsets<'b, 's, S: StandardProperties<'s> + ?Sized>(
|
||||||
original_document: &'s str,
|
original_document: &'s str,
|
||||||
rust_ast_node: &'s S,
|
rust_ast_node: &'b S,
|
||||||
) -> (usize, usize) {
|
) -> (usize, usize) {
|
||||||
let rust_object_source = rust_ast_node.get_source();
|
let rust_object_source = rust_ast_node.get_source();
|
||||||
debug_assert!(is_slice_of(original_document, rust_object_source));
|
debug_assert!(is_slice_of(original_document, rust_object_source));
|
||||||
@ -28,20 +28,21 @@ fn get_rust_byte_offsets<'s, S: StandardProperties<'s> + ?Sized>(
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn compare_standard_properties<
|
pub(crate) fn compare_standard_properties<
|
||||||
|
'b,
|
||||||
's,
|
's,
|
||||||
S: GetStandardProperties<'s> + GetElispFact<'s> + ?Sized,
|
S: GetStandardProperties<'s> + GetElispFact<'s> + ?Sized,
|
||||||
>(
|
>(
|
||||||
original_document: &'s str,
|
original_document: &'s str,
|
||||||
emacs: &'s Token<'s>,
|
emacs: &'b Token<'s>,
|
||||||
rust: &'s S,
|
rust: &'b S,
|
||||||
) -> Result<(), Box<dyn std::error::Error>> {
|
) -> Result<(), Box<dyn std::error::Error>> {
|
||||||
assert_name(emacs, rust.get_elisp_fact().get_elisp_name())?;
|
assert_name(emacs, rust.get_elisp_fact().get_elisp_name())?;
|
||||||
assert_bounds(original_document, emacs, rust.get_standard_properties())?;
|
assert_bounds(original_document, emacs, rust.get_standard_properties())?;
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn assert_name<'s, S: AsRef<str>>(
|
pub(crate) fn assert_name<'b, 's, S: AsRef<str>>(
|
||||||
emacs: &'s Token<'s>,
|
emacs: &'b Token<'s>,
|
||||||
name: S,
|
name: S,
|
||||||
) -> Result<(), Box<dyn std::error::Error>> {
|
) -> Result<(), Box<dyn std::error::Error>> {
|
||||||
let name = name.as_ref();
|
let name = name.as_ref();
|
||||||
@ -63,10 +64,10 @@ pub(crate) fn assert_name<'s, S: AsRef<str>>(
|
|||||||
/// Assert that the character ranges defined by upstream org-mode's :standard-properties match the slices in Organic's StandardProperties.
|
/// Assert that the character ranges defined by upstream org-mode's :standard-properties match the slices in Organic's StandardProperties.
|
||||||
///
|
///
|
||||||
/// This does **not** handle plain text because plain text is a special case.
|
/// This does **not** handle plain text because plain text is a special case.
|
||||||
pub(crate) fn assert_bounds<'s, S: StandardProperties<'s> + ?Sized>(
|
pub(crate) fn assert_bounds<'b, 's, S: StandardProperties<'s> + ?Sized>(
|
||||||
original_document: &'s str,
|
original_document: &'s str,
|
||||||
emacs: &'s Token<'s>,
|
emacs: &'b Token<'s>,
|
||||||
rust: &'s S,
|
rust: &'b S,
|
||||||
) -> Result<(), Box<dyn std::error::Error>> {
|
) -> Result<(), Box<dyn std::error::Error>> {
|
||||||
let standard_properties = get_emacs_standard_properties(emacs)?; // 1-based
|
let standard_properties = get_emacs_standard_properties(emacs)?; // 1-based
|
||||||
let (begin, end) = (
|
let (begin, end) = (
|
||||||
@ -99,8 +100,8 @@ struct EmacsStandardProperties {
|
|||||||
post_blank: Option<usize>,
|
post_blank: Option<usize>,
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_emacs_standard_properties<'s>(
|
fn get_emacs_standard_properties<'b, 's>(
|
||||||
emacs: &'s Token<'s>,
|
emacs: &'b Token<'s>,
|
||||||
) -> Result<EmacsStandardProperties, Box<dyn std::error::Error>> {
|
) -> Result<EmacsStandardProperties, Box<dyn std::error::Error>> {
|
||||||
let children = emacs.as_list()?;
|
let children = emacs.as_list()?;
|
||||||
let attributes_child = children
|
let attributes_child = children
|
||||||
@ -172,10 +173,10 @@ fn maybe_token_to_usize(
|
|||||||
/// Returns Ok(None) if value is nil.
|
/// Returns Ok(None) if value is nil.
|
||||||
///
|
///
|
||||||
/// Returns error if the attribute is not specified on the token at all.
|
/// Returns error if the attribute is not specified on the token at all.
|
||||||
pub(crate) fn get_property<'s, 'x>(
|
pub(crate) fn get_property<'b, 's, 'x>(
|
||||||
emacs: &'s Token<'s>,
|
emacs: &'b Token<'s>,
|
||||||
key: &'x str,
|
key: &'x str,
|
||||||
) -> Result<Option<&'s Token<'s>>, Box<dyn std::error::Error>> {
|
) -> Result<Option<&'b Token<'s>>, Box<dyn std::error::Error>> {
|
||||||
let children = emacs.as_list()?;
|
let children = emacs.as_list()?;
|
||||||
let attributes_child = children
|
let attributes_child = children
|
||||||
.iter()
|
.iter()
|
||||||
@ -195,8 +196,8 @@ pub(crate) fn get_property<'s, 'x>(
|
|||||||
/// Get a named property containing an unquoted atom from the emacs token.
|
/// Get a named property containing an unquoted atom from the emacs token.
|
||||||
///
|
///
|
||||||
/// Returns None if key is not found.
|
/// Returns None if key is not found.
|
||||||
pub(crate) fn get_property_unquoted_atom<'s, 'x>(
|
pub(crate) fn get_property_unquoted_atom<'b, 's, 'x>(
|
||||||
emacs: &'s Token<'s>,
|
emacs: &'b Token<'s>,
|
||||||
key: &'x str,
|
key: &'x str,
|
||||||
) -> Result<Option<&'s str>, Box<dyn std::error::Error>> {
|
) -> Result<Option<&'s str>, Box<dyn std::error::Error>> {
|
||||||
Ok(get_property(emacs, key)?
|
Ok(get_property(emacs, key)?
|
||||||
@ -207,8 +208,8 @@ pub(crate) fn get_property_unquoted_atom<'s, 'x>(
|
|||||||
/// Get a named property containing an quoted string from the emacs token.
|
/// Get a named property containing an quoted string from the emacs token.
|
||||||
///
|
///
|
||||||
/// Returns None if key is not found.
|
/// Returns None if key is not found.
|
||||||
pub(crate) fn get_property_quoted_string<'s, 'x>(
|
pub(crate) fn get_property_quoted_string<'b, 's, 'x>(
|
||||||
emacs: &'s Token<'s>,
|
emacs: &'b Token<'s>,
|
||||||
key: &'x str,
|
key: &'x str,
|
||||||
) -> Result<Option<String>, Box<dyn std::error::Error>> {
|
) -> Result<Option<String>, Box<dyn std::error::Error>> {
|
||||||
Ok(get_property(emacs, key)?
|
Ok(get_property(emacs, key)?
|
||||||
@ -223,8 +224,8 @@ pub(crate) fn get_property_quoted_string<'s, 'x>(
|
|||||||
/// This uses the elisp convention of nil == false, non-nil == true.
|
/// This uses the elisp convention of nil == false, non-nil == true.
|
||||||
///
|
///
|
||||||
/// Returns false if key is not found.
|
/// Returns false if key is not found.
|
||||||
pub(crate) fn get_property_boolean<'s, 'x>(
|
pub(crate) fn get_property_boolean<'b, 's, 'x>(
|
||||||
emacs: &'s Token<'s>,
|
emacs: &'b Token<'s>,
|
||||||
key: &'x str,
|
key: &'x str,
|
||||||
) -> Result<bool, Box<dyn std::error::Error>> {
|
) -> Result<bool, Box<dyn std::error::Error>> {
|
||||||
Ok(get_property(emacs, key)?
|
Ok(get_property(emacs, key)?
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
use std::collections::VecDeque;
|
use std::collections::VecDeque;
|
||||||
|
|
||||||
use super::ast_node::AstNode;
|
|
||||||
use super::ast_node_iter::AstNodeIter;
|
use super::ast_node_iter::AstNodeIter;
|
||||||
|
use crate::types::AstNode;
|
||||||
|
|
||||||
pub struct AllAstNodeIter<'r, 's> {
|
pub struct AllAstNodeIter<'r, 's> {
|
||||||
root: Option<AstNode<'r, 's>>,
|
root: Option<AstNode<'r, 's>>,
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
use std::marker::PhantomData;
|
use std::marker::PhantomData;
|
||||||
|
|
||||||
use super::ast_node::AstNode;
|
|
||||||
use super::macros::children_iter;
|
use super::macros::children_iter;
|
||||||
use super::macros::empty_iter;
|
use super::macros::empty_iter;
|
||||||
use super::macros::multi_field_iter;
|
use super::macros::multi_field_iter;
|
||||||
use crate::types::AngleLink;
|
use crate::types::AngleLink;
|
||||||
|
use crate::types::AstNode;
|
||||||
use crate::types::BabelCall;
|
use crate::types::BabelCall;
|
||||||
use crate::types::Bold;
|
use crate::types::Bold;
|
||||||
use crate::types::Citation;
|
use crate::types::Citation;
|
||||||
|
@ -1,16 +1,3 @@
|
|||||||
/// Write the implementation of From<> to convert a borrow of the type to an AstNode
|
|
||||||
macro_rules! to_ast_node {
|
|
||||||
($inp:ty, $enum:expr) => {
|
|
||||||
impl<'r, 's> From<$inp> for AstNode<'r, 's> {
|
|
||||||
fn from(value: $inp) -> Self {
|
|
||||||
$enum(value)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
pub(crate) use to_ast_node;
|
|
||||||
|
|
||||||
/// Create iterators for ast nodes where it only has to iterate over children
|
/// Create iterators for ast nodes where it only has to iterate over children
|
||||||
macro_rules! children_iter {
|
macro_rules! children_iter {
|
||||||
($astnodetype:ty, $itertype:ident, $innertype:ty) => {
|
($astnodetype:ty, $itertype:ident, $innertype:ty) => {
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
mod all_ast_node_iter;
|
mod all_ast_node_iter;
|
||||||
mod ast_node;
|
|
||||||
mod ast_node_iter;
|
mod ast_node_iter;
|
||||||
mod macros;
|
mod macros;
|
||||||
pub(crate) use ast_node::AstNode;
|
|
||||||
|
@ -20,7 +20,7 @@ use crate::context::RefContext;
|
|||||||
use crate::error::CustomError;
|
use crate::error::CustomError;
|
||||||
use crate::error::MyError;
|
use crate::error::MyError;
|
||||||
use crate::error::Res;
|
use crate::error::Res;
|
||||||
use crate::iter::AstNode;
|
use crate::types::AstNode;
|
||||||
use crate::parser::org_source::convert_error;
|
use crate::parser::org_source::convert_error;
|
||||||
use crate::parser::util::blank_line;
|
use crate::parser::util::blank_line;
|
||||||
use crate::types::Document;
|
use crate::types::Document;
|
||||||
|
@ -11,7 +11,7 @@ use super::OrgSource;
|
|||||||
use crate::context::HeadlineLevelFilter;
|
use crate::context::HeadlineLevelFilter;
|
||||||
use crate::error::CustomError;
|
use crate::error::CustomError;
|
||||||
use crate::error::Res;
|
use crate::error::Res;
|
||||||
use crate::iter::AstNode;
|
use crate::types::AstNode;
|
||||||
use crate::settings::GlobalSettings;
|
use crate::settings::GlobalSettings;
|
||||||
use crate::types::Document;
|
use crate::types::Document;
|
||||||
use crate::types::Keyword;
|
use crate::types::Keyword;
|
||||||
|
@ -21,6 +21,7 @@ use crate::types::ExportSnippet;
|
|||||||
use crate::types::FixedWidthArea;
|
use crate::types::FixedWidthArea;
|
||||||
use crate::types::FootnoteDefinition;
|
use crate::types::FootnoteDefinition;
|
||||||
use crate::types::FootnoteReference;
|
use crate::types::FootnoteReference;
|
||||||
|
use crate::types::GetStandardProperties;
|
||||||
use crate::types::GreaterBlock;
|
use crate::types::GreaterBlock;
|
||||||
use crate::types::Heading;
|
use crate::types::Heading;
|
||||||
use crate::types::HorizontalRule;
|
use crate::types::HorizontalRule;
|
||||||
@ -249,3 +250,66 @@ to_ast_node!(&'r Subscript<'s>, AstNode::Subscript);
|
|||||||
to_ast_node!(&'r Superscript<'s>, AstNode::Superscript);
|
to_ast_node!(&'r Superscript<'s>, AstNode::Superscript);
|
||||||
to_ast_node!(&'r TableCell<'s>, AstNode::TableCell);
|
to_ast_node!(&'r TableCell<'s>, AstNode::TableCell);
|
||||||
to_ast_node!(&'r Timestamp<'s>, AstNode::Timestamp);
|
to_ast_node!(&'r Timestamp<'s>, AstNode::Timestamp);
|
||||||
|
|
||||||
|
impl<'r, 's> GetStandardProperties<'s> for AstNode<'r, 's> {
|
||||||
|
fn get_standard_properties<'b>(&'b self) -> &'b dyn crate::types::StandardProperties<'s> {
|
||||||
|
match self {
|
||||||
|
AstNode::Document(inner) => *inner,
|
||||||
|
AstNode::Heading(inner) => *inner,
|
||||||
|
AstNode::Section(inner) => *inner,
|
||||||
|
AstNode::Paragraph(inner) => *inner,
|
||||||
|
AstNode::PlainList(inner) => *inner,
|
||||||
|
AstNode::PlainListItem(inner) => *inner,
|
||||||
|
AstNode::GreaterBlock(inner) => *inner,
|
||||||
|
AstNode::DynamicBlock(inner) => *inner,
|
||||||
|
AstNode::FootnoteDefinition(inner) => *inner,
|
||||||
|
AstNode::Comment(inner) => *inner,
|
||||||
|
AstNode::Drawer(inner) => *inner,
|
||||||
|
AstNode::PropertyDrawer(inner) => *inner,
|
||||||
|
AstNode::NodeProperty(inner) => *inner,
|
||||||
|
AstNode::Table(inner) => *inner,
|
||||||
|
AstNode::TableRow(inner) => *inner,
|
||||||
|
AstNode::VerseBlock(inner) => *inner,
|
||||||
|
AstNode::CommentBlock(inner) => *inner,
|
||||||
|
AstNode::ExampleBlock(inner) => *inner,
|
||||||
|
AstNode::ExportBlock(inner) => *inner,
|
||||||
|
AstNode::SrcBlock(inner) => *inner,
|
||||||
|
AstNode::Clock(inner) => *inner,
|
||||||
|
AstNode::DiarySexp(inner) => *inner,
|
||||||
|
AstNode::Planning(inner) => *inner,
|
||||||
|
AstNode::FixedWidthArea(inner) => *inner,
|
||||||
|
AstNode::HorizontalRule(inner) => *inner,
|
||||||
|
AstNode::Keyword(inner) => *inner,
|
||||||
|
AstNode::BabelCall(inner) => *inner,
|
||||||
|
AstNode::LatexEnvironment(inner) => *inner,
|
||||||
|
AstNode::Bold(inner) => *inner,
|
||||||
|
AstNode::Italic(inner) => *inner,
|
||||||
|
AstNode::Underline(inner) => *inner,
|
||||||
|
AstNode::StrikeThrough(inner) => *inner,
|
||||||
|
AstNode::Code(inner) => *inner,
|
||||||
|
AstNode::Verbatim(inner) => *inner,
|
||||||
|
AstNode::PlainText(inner) => *inner,
|
||||||
|
AstNode::RegularLink(inner) => *inner,
|
||||||
|
AstNode::RadioLink(inner) => *inner,
|
||||||
|
AstNode::RadioTarget(inner) => *inner,
|
||||||
|
AstNode::PlainLink(inner) => *inner,
|
||||||
|
AstNode::AngleLink(inner) => *inner,
|
||||||
|
AstNode::OrgMacro(inner) => *inner,
|
||||||
|
AstNode::Entity(inner) => *inner,
|
||||||
|
AstNode::LatexFragment(inner) => *inner,
|
||||||
|
AstNode::ExportSnippet(inner) => *inner,
|
||||||
|
AstNode::FootnoteReference(inner) => *inner,
|
||||||
|
AstNode::Citation(inner) => *inner,
|
||||||
|
AstNode::CitationReference(inner) => *inner,
|
||||||
|
AstNode::InlineBabelCall(inner) => *inner,
|
||||||
|
AstNode::InlineSourceBlock(inner) => *inner,
|
||||||
|
AstNode::LineBreak(inner) => *inner,
|
||||||
|
AstNode::Target(inner) => *inner,
|
||||||
|
AstNode::StatisticsCookie(inner) => *inner,
|
||||||
|
AstNode::Subscript(inner) => *inner,
|
||||||
|
AstNode::Superscript(inner) => *inner,
|
||||||
|
AstNode::TableCell(inner) => *inner,
|
||||||
|
AstNode::Timestamp(inner) => *inner,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -50,7 +50,7 @@ pub enum TodoKeywordType {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl<'s> GetStandardProperties<'s> for DocumentElement<'s> {
|
impl<'s> GetStandardProperties<'s> for DocumentElement<'s> {
|
||||||
fn get_standard_properties(&'s self) -> &'s dyn StandardProperties {
|
fn get_standard_properties<'b>(&'b self) -> &'b dyn StandardProperties<'s> {
|
||||||
match self {
|
match self {
|
||||||
DocumentElement::Heading(inner) => inner,
|
DocumentElement::Heading(inner) => inner,
|
||||||
DocumentElement::Section(inner) => inner,
|
DocumentElement::Section(inner) => inner,
|
||||||
@ -59,19 +59,19 @@ impl<'s> GetStandardProperties<'s> for DocumentElement<'s> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl<'s> StandardProperties<'s> for Document<'s> {
|
impl<'s> StandardProperties<'s> for Document<'s> {
|
||||||
fn get_source(&'s self) -> &'s str {
|
fn get_source<'b>(&'b self) -> &'s str {
|
||||||
self.source
|
self.source
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'s> StandardProperties<'s> for Section<'s> {
|
impl<'s> StandardProperties<'s> for Section<'s> {
|
||||||
fn get_source(&'s self) -> &'s str {
|
fn get_source<'b>(&'b self) -> &'s str {
|
||||||
self.source
|
self.source
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'s> StandardProperties<'s> for Heading<'s> {
|
impl<'s> StandardProperties<'s> for Heading<'s> {
|
||||||
fn get_source(&'s self) -> &'s str {
|
fn get_source<'b>(&'b self) -> &'s str {
|
||||||
self.source
|
self.source
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -81,7 +81,7 @@ impl<'s> SetSource<'s> for Element<'s> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl<'s> GetStandardProperties<'s> for Element<'s> {
|
impl<'s> GetStandardProperties<'s> for Element<'s> {
|
||||||
fn get_standard_properties(&'s self) -> &'s dyn StandardProperties {
|
fn get_standard_properties<'b>(&'b self) -> &'b dyn StandardProperties<'s> {
|
||||||
match self {
|
match self {
|
||||||
Element::Paragraph(inner) => inner,
|
Element::Paragraph(inner) => inner,
|
||||||
Element::PlainList(inner) => inner,
|
Element::PlainList(inner) => inner,
|
||||||
|
@ -2,11 +2,11 @@ use super::StandardProperties;
|
|||||||
|
|
||||||
pub trait GetStandardProperties<'s> {
|
pub trait GetStandardProperties<'s> {
|
||||||
// TODO: Can I eliminate this dynamic dispatch, perhaps using nominal generic structs? Low prioritiy since this is not used during parsing.
|
// TODO: Can I eliminate this dynamic dispatch, perhaps using nominal generic structs? Low prioritiy since this is not used during parsing.
|
||||||
fn get_standard_properties(&'s self) -> &'s dyn StandardProperties;
|
fn get_standard_properties<'b>(&'b self) -> &'b dyn StandardProperties<'s>;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'s, I: StandardProperties<'s>> GetStandardProperties<'s> for I {
|
impl<'s, I: StandardProperties<'s>> GetStandardProperties<'s> for I {
|
||||||
fn get_standard_properties(&'s self) -> &'s dyn StandardProperties {
|
fn get_standard_properties<'b>(&'b self) -> &'b dyn StandardProperties<'s> {
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -99,61 +99,61 @@ pub struct TableRow<'s> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl<'s> StandardProperties<'s> for PlainList<'s> {
|
impl<'s> StandardProperties<'s> for PlainList<'s> {
|
||||||
fn get_source(&'s self) -> &'s str {
|
fn get_source<'b>(&'b self) -> &'s str {
|
||||||
self.source
|
self.source
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'s> StandardProperties<'s> for PlainListItem<'s> {
|
impl<'s> StandardProperties<'s> for PlainListItem<'s> {
|
||||||
fn get_source(&'s self) -> &'s str {
|
fn get_source<'b>(&'b self) -> &'s str {
|
||||||
self.source
|
self.source
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'s> StandardProperties<'s> for GreaterBlock<'s> {
|
impl<'s> StandardProperties<'s> for GreaterBlock<'s> {
|
||||||
fn get_source(&'s self) -> &'s str {
|
fn get_source<'b>(&'b self) -> &'s str {
|
||||||
self.source
|
self.source
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'s> StandardProperties<'s> for DynamicBlock<'s> {
|
impl<'s> StandardProperties<'s> for DynamicBlock<'s> {
|
||||||
fn get_source(&'s self) -> &'s str {
|
fn get_source<'b>(&'b self) -> &'s str {
|
||||||
self.source
|
self.source
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'s> StandardProperties<'s> for FootnoteDefinition<'s> {
|
impl<'s> StandardProperties<'s> for FootnoteDefinition<'s> {
|
||||||
fn get_source(&'s self) -> &'s str {
|
fn get_source<'b>(&'b self) -> &'s str {
|
||||||
self.source
|
self.source
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'s> StandardProperties<'s> for Drawer<'s> {
|
impl<'s> StandardProperties<'s> for Drawer<'s> {
|
||||||
fn get_source(&'s self) -> &'s str {
|
fn get_source<'b>(&'b self) -> &'s str {
|
||||||
self.source
|
self.source
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'s> StandardProperties<'s> for PropertyDrawer<'s> {
|
impl<'s> StandardProperties<'s> for PropertyDrawer<'s> {
|
||||||
fn get_source(&'s self) -> &'s str {
|
fn get_source<'b>(&'b self) -> &'s str {
|
||||||
self.source
|
self.source
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'s> StandardProperties<'s> for NodeProperty<'s> {
|
impl<'s> StandardProperties<'s> for NodeProperty<'s> {
|
||||||
fn get_source(&'s self) -> &'s str {
|
fn get_source<'b>(&'b self) -> &'s str {
|
||||||
self.source
|
self.source
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'s> StandardProperties<'s> for Table<'s> {
|
impl<'s> StandardProperties<'s> for Table<'s> {
|
||||||
fn get_source(&'s self) -> &'s str {
|
fn get_source<'b>(&'b self) -> &'s str {
|
||||||
self.source
|
self.source
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'s> StandardProperties<'s> for TableRow<'s> {
|
impl<'s> StandardProperties<'s> for TableRow<'s> {
|
||||||
fn get_source(&'s self) -> &'s str {
|
fn get_source<'b>(&'b self) -> &'s str {
|
||||||
self.source
|
self.source
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -115,93 +115,93 @@ impl<'s> Paragraph<'s> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl<'s> StandardProperties<'s> for Paragraph<'s> {
|
impl<'s> StandardProperties<'s> for Paragraph<'s> {
|
||||||
fn get_source(&'s self) -> &'s str {
|
fn get_source<'b>(&'b self) -> &'s str {
|
||||||
self.source
|
self.source
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'s> StandardProperties<'s> for TableCell<'s> {
|
impl<'s> StandardProperties<'s> for TableCell<'s> {
|
||||||
fn get_source(&'s self) -> &'s str {
|
fn get_source<'b>(&'b self) -> &'s str {
|
||||||
self.source
|
self.source
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'s> StandardProperties<'s> for Comment<'s> {
|
impl<'s> StandardProperties<'s> for Comment<'s> {
|
||||||
fn get_source(&'s self) -> &'s str {
|
fn get_source<'b>(&'b self) -> &'s str {
|
||||||
self.source
|
self.source
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'s> StandardProperties<'s> for VerseBlock<'s> {
|
impl<'s> StandardProperties<'s> for VerseBlock<'s> {
|
||||||
fn get_source(&'s self) -> &'s str {
|
fn get_source<'b>(&'b self) -> &'s str {
|
||||||
self.source
|
self.source
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
impl<'s> StandardProperties<'s> for CommentBlock<'s> {
|
impl<'s> StandardProperties<'s> for CommentBlock<'s> {
|
||||||
fn get_source(&'s self) -> &'s str {
|
fn get_source<'b>(&'b self) -> &'s str {
|
||||||
self.source
|
self.source
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
impl<'s> StandardProperties<'s> for ExampleBlock<'s> {
|
impl<'s> StandardProperties<'s> for ExampleBlock<'s> {
|
||||||
fn get_source(&'s self) -> &'s str {
|
fn get_source<'b>(&'b self) -> &'s str {
|
||||||
self.source
|
self.source
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
impl<'s> StandardProperties<'s> for ExportBlock<'s> {
|
impl<'s> StandardProperties<'s> for ExportBlock<'s> {
|
||||||
fn get_source(&'s self) -> &'s str {
|
fn get_source<'b>(&'b self) -> &'s str {
|
||||||
self.source
|
self.source
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
impl<'s> StandardProperties<'s> for SrcBlock<'s> {
|
impl<'s> StandardProperties<'s> for SrcBlock<'s> {
|
||||||
fn get_source(&'s self) -> &'s str {
|
fn get_source<'b>(&'b self) -> &'s str {
|
||||||
self.source
|
self.source
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'s> StandardProperties<'s> for Clock<'s> {
|
impl<'s> StandardProperties<'s> for Clock<'s> {
|
||||||
fn get_source(&'s self) -> &'s str {
|
fn get_source<'b>(&'b self) -> &'s str {
|
||||||
self.source
|
self.source
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'s> StandardProperties<'s> for DiarySexp<'s> {
|
impl<'s> StandardProperties<'s> for DiarySexp<'s> {
|
||||||
fn get_source(&'s self) -> &'s str {
|
fn get_source<'b>(&'b self) -> &'s str {
|
||||||
self.source
|
self.source
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'s> StandardProperties<'s> for Planning<'s> {
|
impl<'s> StandardProperties<'s> for Planning<'s> {
|
||||||
fn get_source(&'s self) -> &'s str {
|
fn get_source<'b>(&'b self) -> &'s str {
|
||||||
self.source
|
self.source
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'s> StandardProperties<'s> for FixedWidthArea<'s> {
|
impl<'s> StandardProperties<'s> for FixedWidthArea<'s> {
|
||||||
fn get_source(&'s self) -> &'s str {
|
fn get_source<'b>(&'b self) -> &'s str {
|
||||||
self.source
|
self.source
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'s> StandardProperties<'s> for HorizontalRule<'s> {
|
impl<'s> StandardProperties<'s> for HorizontalRule<'s> {
|
||||||
fn get_source(&'s self) -> &'s str {
|
fn get_source<'b>(&'b self) -> &'s str {
|
||||||
self.source
|
self.source
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'s> StandardProperties<'s> for Keyword<'s> {
|
impl<'s> StandardProperties<'s> for Keyword<'s> {
|
||||||
fn get_source(&'s self) -> &'s str {
|
fn get_source<'b>(&'b self) -> &'s str {
|
||||||
self.source
|
self.source
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'s> StandardProperties<'s> for BabelCall<'s> {
|
impl<'s> StandardProperties<'s> for BabelCall<'s> {
|
||||||
fn get_source(&'s self) -> &'s str {
|
fn get_source<'b>(&'b self) -> &'s str {
|
||||||
self.source
|
self.source
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'s> StandardProperties<'s> for LatexEnvironment<'s> {
|
impl<'s> StandardProperties<'s> for LatexEnvironment<'s> {
|
||||||
fn get_source(&'s self) -> &'s str {
|
fn get_source<'b>(&'b self) -> &'s str {
|
||||||
self.source
|
self.source
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
12
src/types/macros.rs
Normal file
12
src/types/macros.rs
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
/// Write the implementation of From<> to convert a borrow of the type to an AstNode
|
||||||
|
macro_rules! to_ast_node {
|
||||||
|
($inp:ty, $enum:expr) => {
|
||||||
|
impl<'r, 's> From<$inp> for AstNode<'r, 's> {
|
||||||
|
fn from(value: $inp) -> Self {
|
||||||
|
$enum(value)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
pub(crate) use to_ast_node;
|
@ -1,11 +1,14 @@
|
|||||||
|
mod ast_node;
|
||||||
mod document;
|
mod document;
|
||||||
mod element;
|
mod element;
|
||||||
mod get_standard_properties;
|
mod get_standard_properties;
|
||||||
mod greater_element;
|
mod greater_element;
|
||||||
mod lesser_element;
|
mod lesser_element;
|
||||||
|
mod macros;
|
||||||
mod object;
|
mod object;
|
||||||
mod source;
|
mod source;
|
||||||
mod standard_properties;
|
mod standard_properties;
|
||||||
|
pub(crate) use ast_node::AstNode;
|
||||||
pub use document::Document;
|
pub use document::Document;
|
||||||
pub use document::DocumentElement;
|
pub use document::DocumentElement;
|
||||||
pub use document::Heading;
|
pub use document::Heading;
|
||||||
|
@ -187,7 +187,7 @@ pub struct Timestamp<'s> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl<'s> GetStandardProperties<'s> for Object<'s> {
|
impl<'s> GetStandardProperties<'s> for Object<'s> {
|
||||||
fn get_standard_properties(&'s self) -> &'s dyn StandardProperties {
|
fn get_standard_properties<'b>(&'b self) -> &'b dyn StandardProperties<'s> {
|
||||||
match self {
|
match self {
|
||||||
Object::Bold(inner) => inner,
|
Object::Bold(inner) => inner,
|
||||||
Object::Italic(inner) => inner,
|
Object::Italic(inner) => inner,
|
||||||
@ -221,163 +221,163 @@ impl<'s> GetStandardProperties<'s> for Object<'s> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl<'s> StandardProperties<'s> for Bold<'s> {
|
impl<'s> StandardProperties<'s> for Bold<'s> {
|
||||||
fn get_source(&'s self) -> &'s str {
|
fn get_source<'b>(&'b self) -> &'s str {
|
||||||
self.source
|
self.source
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'s> StandardProperties<'s> for Italic<'s> {
|
impl<'s> StandardProperties<'s> for Italic<'s> {
|
||||||
fn get_source(&'s self) -> &'s str {
|
fn get_source<'b>(&'b self) -> &'s str {
|
||||||
self.source
|
self.source
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'s> StandardProperties<'s> for Underline<'s> {
|
impl<'s> StandardProperties<'s> for Underline<'s> {
|
||||||
fn get_source(&'s self) -> &'s str {
|
fn get_source<'b>(&'b self) -> &'s str {
|
||||||
self.source
|
self.source
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'s> StandardProperties<'s> for StrikeThrough<'s> {
|
impl<'s> StandardProperties<'s> for StrikeThrough<'s> {
|
||||||
fn get_source(&'s self) -> &'s str {
|
fn get_source<'b>(&'b self) -> &'s str {
|
||||||
self.source
|
self.source
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'s> StandardProperties<'s> for Code<'s> {
|
impl<'s> StandardProperties<'s> for Code<'s> {
|
||||||
fn get_source(&'s self) -> &'s str {
|
fn get_source<'b>(&'b self) -> &'s str {
|
||||||
self.source
|
self.source
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'s> StandardProperties<'s> for Verbatim<'s> {
|
impl<'s> StandardProperties<'s> for Verbatim<'s> {
|
||||||
fn get_source(&'s self) -> &'s str {
|
fn get_source<'b>(&'b self) -> &'s str {
|
||||||
self.source
|
self.source
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'s> StandardProperties<'s> for RegularLink<'s> {
|
impl<'s> StandardProperties<'s> for RegularLink<'s> {
|
||||||
fn get_source(&'s self) -> &'s str {
|
fn get_source<'b>(&'b self) -> &'s str {
|
||||||
self.source
|
self.source
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'s> StandardProperties<'s> for RadioLink<'s> {
|
impl<'s> StandardProperties<'s> for RadioLink<'s> {
|
||||||
fn get_source(&'s self) -> &'s str {
|
fn get_source<'b>(&'b self) -> &'s str {
|
||||||
self.source
|
self.source
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'s> StandardProperties<'s> for RadioTarget<'s> {
|
impl<'s> StandardProperties<'s> for RadioTarget<'s> {
|
||||||
fn get_source(&'s self) -> &'s str {
|
fn get_source<'b>(&'b self) -> &'s str {
|
||||||
self.source
|
self.source
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'s> StandardProperties<'s> for PlainLink<'s> {
|
impl<'s> StandardProperties<'s> for PlainLink<'s> {
|
||||||
fn get_source(&'s self) -> &'s str {
|
fn get_source<'b>(&'b self) -> &'s str {
|
||||||
self.source
|
self.source
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'s> StandardProperties<'s> for AngleLink<'s> {
|
impl<'s> StandardProperties<'s> for AngleLink<'s> {
|
||||||
fn get_source(&'s self) -> &'s str {
|
fn get_source<'b>(&'b self) -> &'s str {
|
||||||
self.source
|
self.source
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'s> StandardProperties<'s> for OrgMacro<'s> {
|
impl<'s> StandardProperties<'s> for OrgMacro<'s> {
|
||||||
fn get_source(&'s self) -> &'s str {
|
fn get_source<'b>(&'b self) -> &'s str {
|
||||||
self.source
|
self.source
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'s> StandardProperties<'s> for Entity<'s> {
|
impl<'s> StandardProperties<'s> for Entity<'s> {
|
||||||
fn get_source(&'s self) -> &'s str {
|
fn get_source<'b>(&'b self) -> &'s str {
|
||||||
self.source
|
self.source
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'s> StandardProperties<'s> for LatexFragment<'s> {
|
impl<'s> StandardProperties<'s> for LatexFragment<'s> {
|
||||||
fn get_source(&'s self) -> &'s str {
|
fn get_source<'b>(&'b self) -> &'s str {
|
||||||
self.source
|
self.source
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'s> StandardProperties<'s> for ExportSnippet<'s> {
|
impl<'s> StandardProperties<'s> for ExportSnippet<'s> {
|
||||||
fn get_source(&'s self) -> &'s str {
|
fn get_source<'b>(&'b self) -> &'s str {
|
||||||
self.source
|
self.source
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'s> StandardProperties<'s> for FootnoteReference<'s> {
|
impl<'s> StandardProperties<'s> for FootnoteReference<'s> {
|
||||||
fn get_source(&'s self) -> &'s str {
|
fn get_source<'b>(&'b self) -> &'s str {
|
||||||
self.source
|
self.source
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'s> StandardProperties<'s> for Citation<'s> {
|
impl<'s> StandardProperties<'s> for Citation<'s> {
|
||||||
fn get_source(&'s self) -> &'s str {
|
fn get_source<'b>(&'b self) -> &'s str {
|
||||||
self.source
|
self.source
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'s> StandardProperties<'s> for CitationReference<'s> {
|
impl<'s> StandardProperties<'s> for CitationReference<'s> {
|
||||||
fn get_source(&'s self) -> &'s str {
|
fn get_source<'b>(&'b self) -> &'s str {
|
||||||
self.source
|
self.source
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'s> StandardProperties<'s> for InlineBabelCall<'s> {
|
impl<'s> StandardProperties<'s> for InlineBabelCall<'s> {
|
||||||
fn get_source(&'s self) -> &'s str {
|
fn get_source<'b>(&'b self) -> &'s str {
|
||||||
self.source
|
self.source
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'s> StandardProperties<'s> for InlineSourceBlock<'s> {
|
impl<'s> StandardProperties<'s> for InlineSourceBlock<'s> {
|
||||||
fn get_source(&'s self) -> &'s str {
|
fn get_source<'b>(&'b self) -> &'s str {
|
||||||
self.source
|
self.source
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'s> StandardProperties<'s> for LineBreak<'s> {
|
impl<'s> StandardProperties<'s> for LineBreak<'s> {
|
||||||
fn get_source(&'s self) -> &'s str {
|
fn get_source<'b>(&'b self) -> &'s str {
|
||||||
self.source
|
self.source
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'s> StandardProperties<'s> for Target<'s> {
|
impl<'s> StandardProperties<'s> for Target<'s> {
|
||||||
fn get_source(&'s self) -> &'s str {
|
fn get_source<'b>(&'b self) -> &'s str {
|
||||||
self.source
|
self.source
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'s> StandardProperties<'s> for StatisticsCookie<'s> {
|
impl<'s> StandardProperties<'s> for StatisticsCookie<'s> {
|
||||||
fn get_source(&'s self) -> &'s str {
|
fn get_source<'b>(&'b self) -> &'s str {
|
||||||
self.source
|
self.source
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'s> StandardProperties<'s> for Subscript<'s> {
|
impl<'s> StandardProperties<'s> for Subscript<'s> {
|
||||||
fn get_source(&'s self) -> &'s str {
|
fn get_source<'b>(&'b self) -> &'s str {
|
||||||
self.source
|
self.source
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'s> StandardProperties<'s> for Superscript<'s> {
|
impl<'s> StandardProperties<'s> for Superscript<'s> {
|
||||||
fn get_source(&'s self) -> &'s str {
|
fn get_source<'b>(&'b self) -> &'s str {
|
||||||
self.source
|
self.source
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'s> StandardProperties<'s> for Timestamp<'s> {
|
impl<'s> StandardProperties<'s> for Timestamp<'s> {
|
||||||
fn get_source(&'s self) -> &'s str {
|
fn get_source<'b>(&'b self) -> &'s str {
|
||||||
self.source
|
self.source
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'s> StandardProperties<'s> for PlainText<'s> {
|
impl<'s> StandardProperties<'s> for PlainText<'s> {
|
||||||
fn get_source(&'s self) -> &'s str {
|
fn get_source<'b>(&'b self) -> &'s str {
|
||||||
self.source
|
self.source
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,7 @@ pub trait StandardProperties<'s> {
|
|||||||
/// Get the slice of the entire AST node.
|
/// Get the slice of the entire AST node.
|
||||||
///
|
///
|
||||||
/// This corresponds to :begin to :end in upstream org-mode's standard properties.
|
/// This corresponds to :begin to :end in upstream org-mode's standard properties.
|
||||||
fn get_source(&'s self) -> &'s str;
|
fn get_source<'b>(&'b self) -> &'s str;
|
||||||
|
|
||||||
// Get the slice of the AST node's contents.
|
// Get the slice of the AST node's contents.
|
||||||
//
|
//
|
||||||
|
Loading…
x
Reference in New Issue
Block a user