Give object structs their own file separate from the parsers.
This commit is contained in:
35
src/parser/object_parser.rs
Normal file
35
src/parser/object_parser.rs
Normal file
@@ -0,0 +1,35 @@
|
||||
use nom::combinator::map;
|
||||
use nom::combinator::not;
|
||||
|
||||
use crate::parser::object::Object;
|
||||
|
||||
use super::error::Res;
|
||||
use super::parser_with_context::parser_with_context;
|
||||
use super::plain_text::plain_text;
|
||||
use super::Context;
|
||||
|
||||
#[tracing::instrument(ret, level = "debug")]
|
||||
pub fn standard_set_object<'r, 's>(
|
||||
context: Context<'r, 's>,
|
||||
input: &'s str,
|
||||
) -> Res<&'s str, Object<'s>> {
|
||||
// TODO: add entities, LaTeX fragments, export snippets, footnote references, citations (NOT citation references), inline babel calls, inline source blocks, line breaks, links, macros, targets and radio targets, statistics cookies, subscript and superscript, timestamps, and text markup.
|
||||
not(|i| context.check_exit_matcher(i))(input)?;
|
||||
|
||||
let plain_text_matcher = parser_with_context!(plain_text)(context);
|
||||
|
||||
map(plain_text_matcher, Object::PlainText)(input)
|
||||
}
|
||||
|
||||
#[tracing::instrument(ret, level = "debug")]
|
||||
pub fn minimal_set_object<'r, 's>(
|
||||
context: Context<'r, 's>,
|
||||
input: &'s str,
|
||||
) -> Res<&'s str, Object<'s>> {
|
||||
// TODO: add text markup, entities, LaTeX fragments, superscripts and subscripts
|
||||
not(|i| context.check_exit_matcher(i))(input)?;
|
||||
|
||||
let plain_text_matcher = parser_with_context!(plain_text)(context);
|
||||
|
||||
map(plain_text_matcher, Object::PlainText)(input)
|
||||
}
|
||||
Reference in New Issue
Block a user