Compare commits
3 Commits
f141a4e186
...
175ff1e6c4
Author | SHA1 | Date | |
---|---|---|---|
![]() |
175ff1e6c4 | ||
![]() |
0b42139393 | ||
![]() |
67a9103b07 |
@ -39,7 +39,7 @@ pub(crate) fn export_snippet<'b, 'g, 'r, 's>(
|
||||
parser_with_context!(contents)(&parser_context),
|
||||
)))(remaining)?;
|
||||
let (remaining, _) = tag("@@")(remaining)?;
|
||||
let (remaining, _trailing_whitespace) =
|
||||
let (remaining, post_blank) =
|
||||
maybe_consume_object_trailing_whitespace_if_not_exiting(context, remaining)?;
|
||||
let source = get_consumed(input, remaining);
|
||||
Ok((
|
||||
@ -48,6 +48,7 @@ pub(crate) fn export_snippet<'b, 'g, 'r, 's>(
|
||||
source: source.into(),
|
||||
backend: backend_name.into(),
|
||||
contents: backend_contents.map(|(_colon, backend_contents)| backend_contents.into()),
|
||||
post_blank: post_blank.map(Into::<&str>::into),
|
||||
},
|
||||
))
|
||||
}
|
||||
|
@ -38,7 +38,7 @@ pub(crate) fn inline_babel_call<'b, 'g, 'r, 's>(
|
||||
let (remaining, arguments) = argument(context, remaining)?;
|
||||
let (remaining, end_header) = opt(parser_with_context!(header)(context))(remaining)?;
|
||||
let value = get_consumed(input, remaining);
|
||||
let (remaining, _trailing_whitespace) =
|
||||
let (remaining, post_blank) =
|
||||
maybe_consume_object_trailing_whitespace_if_not_exiting(context, remaining)?;
|
||||
let source = get_consumed(input, remaining);
|
||||
Ok((
|
||||
@ -54,6 +54,7 @@ pub(crate) fn inline_babel_call<'b, 'g, 'r, 's>(
|
||||
None
|
||||
},
|
||||
end_header: end_header.map(Into::<&str>::into),
|
||||
post_blank: post_blank.map(Into::<&str>::into),
|
||||
},
|
||||
))
|
||||
}
|
||||
|
@ -38,7 +38,7 @@ pub(crate) fn inline_source_block<'b, 'g, 'r, 's>(
|
||||
let (remaining, language) = lang(context, remaining)?;
|
||||
let (remaining, parameters) = opt(parser_with_context!(header)(context))(remaining)?;
|
||||
let (remaining, value) = body(context, remaining)?;
|
||||
let (remaining, _trailing_whitespace) =
|
||||
let (remaining, post_blank) =
|
||||
maybe_consume_object_trailing_whitespace_if_not_exiting(context, remaining)?;
|
||||
let source = get_consumed(input, remaining);
|
||||
Ok((
|
||||
@ -48,6 +48,7 @@ pub(crate) fn inline_source_block<'b, 'g, 'r, 's>(
|
||||
language: language.into(),
|
||||
parameters: parameters.map(Into::<&str>::into),
|
||||
value: value.into(),
|
||||
post_blank: post_blank.map(Into::<&str>::into),
|
||||
},
|
||||
))
|
||||
}
|
||||
|
@ -57,7 +57,7 @@ where
|
||||
let (remaining, _end) = latex_environment_end_specialized(&parser_context, remaining)?;
|
||||
let value_end = remaining;
|
||||
|
||||
let (remaining, _trailing_ws) =
|
||||
let (remaining, post_blank) =
|
||||
maybe_consume_trailing_whitespace_if_not_exiting(context, remaining)?;
|
||||
let source = get_consumed(input, remaining);
|
||||
let value = get_consumed(value_start, value_end);
|
||||
@ -70,6 +70,7 @@ where
|
||||
affiliated_keywords,
|
||||
),
|
||||
value: value.into(),
|
||||
post_blank: post_blank.map(Into::<&str>::into),
|
||||
},
|
||||
))
|
||||
}
|
||||
|
@ -173,6 +173,7 @@ pub struct LatexEnvironment<'s> {
|
||||
pub source: &'s str,
|
||||
pub affiliated_keywords: AffiliatedKeywords<'s>,
|
||||
pub value: &'s str,
|
||||
pub post_blank: Option<&'s str>,
|
||||
}
|
||||
|
||||
/// A line number used in switches to lesser blocks.
|
||||
@ -425,11 +426,15 @@ impl<'s> StandardProperties<'s> for LatexEnvironment<'s> {
|
||||
}
|
||||
|
||||
fn get_contents<'b>(&'b self) -> Option<&'s str> {
|
||||
todo!()
|
||||
None
|
||||
}
|
||||
|
||||
fn get_post_blank(&self) -> PostBlank {
|
||||
todo!()
|
||||
self.post_blank
|
||||
.map(|text| text.lines().count())
|
||||
.unwrap_or(0)
|
||||
.try_into()
|
||||
.expect("Too much post-blank to fit into a PostBlank.")
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -206,6 +206,7 @@ pub struct ExportSnippet<'s> {
|
||||
pub source: &'s str,
|
||||
pub backend: &'s str,
|
||||
pub contents: Option<&'s str>,
|
||||
pub post_blank: Option<&'s str>,
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
@ -244,6 +245,7 @@ pub struct InlineBabelCall<'s> {
|
||||
pub inside_header: Option<&'s str>,
|
||||
pub arguments: Option<&'s str>,
|
||||
pub end_header: Option<&'s str>,
|
||||
pub post_blank: Option<&'s str>,
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
@ -252,6 +254,7 @@ pub struct InlineSourceBlock<'s> {
|
||||
pub language: &'s str,
|
||||
pub parameters: Option<&'s str>,
|
||||
pub value: &'s str,
|
||||
pub post_blank: Option<&'s str>,
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
@ -802,11 +805,15 @@ impl<'s> StandardProperties<'s> for ExportSnippet<'s> {
|
||||
}
|
||||
|
||||
fn get_contents<'b>(&'b self) -> Option<&'s str> {
|
||||
todo!()
|
||||
None
|
||||
}
|
||||
|
||||
fn get_post_blank(&self) -> PostBlank {
|
||||
todo!()
|
||||
self.post_blank
|
||||
.map(|text| text.chars().count())
|
||||
.unwrap_or(0)
|
||||
.try_into()
|
||||
.expect("Too much post-blank to fit into a PostBlank.")
|
||||
}
|
||||
}
|
||||
|
||||
@ -866,11 +873,15 @@ impl<'s> StandardProperties<'s> for InlineBabelCall<'s> {
|
||||
}
|
||||
|
||||
fn get_contents<'b>(&'b self) -> Option<&'s str> {
|
||||
todo!()
|
||||
None
|
||||
}
|
||||
|
||||
fn get_post_blank(&self) -> PostBlank {
|
||||
todo!()
|
||||
self.post_blank
|
||||
.map(|text| text.chars().count())
|
||||
.unwrap_or(0)
|
||||
.try_into()
|
||||
.expect("Too much post-blank to fit into a PostBlank.")
|
||||
}
|
||||
}
|
||||
|
||||
@ -880,11 +891,15 @@ impl<'s> StandardProperties<'s> for InlineSourceBlock<'s> {
|
||||
}
|
||||
|
||||
fn get_contents<'b>(&'b self) -> Option<&'s str> {
|
||||
todo!()
|
||||
None
|
||||
}
|
||||
|
||||
fn get_post_blank(&self) -> PostBlank {
|
||||
todo!()
|
||||
self.post_blank
|
||||
.map(|text| text.chars().count())
|
||||
.unwrap_or(0)
|
||||
.try_into()
|
||||
.expect("Too much post-blank to fit into a PostBlank.")
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user