mirror of
https://github.com/mfontanini/presenterm.git
synced 2026-09-01 23:33:21 -06:00
Ignore multi-line comments
This commit is contained in:
parent
a1015733a7
commit
b08468fe20
@ -216,6 +216,10 @@ impl<'a> PresentationBuilder<'a> {
|
||||
}
|
||||
|
||||
fn process_comment(&mut self, comment: String) -> Result<(), BuildError> {
|
||||
// Ignore any multi line comment; those are assumed to be user comments
|
||||
if comment.contains('\n') {
|
||||
return Ok(());
|
||||
}
|
||||
let comment = comment.parse::<CommentCommand>()?;
|
||||
match comment {
|
||||
CommentCommand::Pause => self.process_pause(),
|
||||
@ -838,6 +842,7 @@ mod test {
|
||||
|
||||
#[rstest]
|
||||
#[case::pause("pause", CommentCommand::Pause)]
|
||||
#[case::pause(" pause ", CommentCommand::Pause)]
|
||||
#[case::end_slide("end_slide", CommentCommand::EndSlide)]
|
||||
#[case::column_layout("column_layout: [1, 2]", CommentCommand::InitColumnLayout(vec![1, 2]))]
|
||||
#[case::column("column: 1", CommentCommand::Column(1))]
|
||||
|
||||
@ -97,7 +97,6 @@ impl<'a> MarkdownParser<'a> {
|
||||
}
|
||||
let block = &block[start_tag.len()..];
|
||||
let block = &block[0..block.len() - end_tag.len()];
|
||||
let block = block.trim();
|
||||
Ok(MarkdownElement::Comment(block.into()))
|
||||
}
|
||||
|
||||
@ -674,7 +673,7 @@ let q = 42;
|
||||
",
|
||||
);
|
||||
let MarkdownElement::Comment(text) = parsed else { panic!("not a comment: {parsed:?}") };
|
||||
assert_eq!(text, "foo");
|
||||
assert_eq!(text, " foo ");
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user