Switches are not stored for comment blocks, but they are allowed to appear.
This commit is contained in:
parent
2eaef82fdb
commit
4cdf88a632
@ -0,0 +1,3 @@
|
|||||||
|
#+begin_comment -n 20
|
||||||
|
foo
|
||||||
|
#+end_comment
|
@ -0,0 +1,7 @@
|
|||||||
|
#+begin_example -n 5
|
||||||
|
foo
|
||||||
|
#+end_example
|
||||||
|
|
||||||
|
#+begin_example +n 10
|
||||||
|
foo
|
||||||
|
#+end_example
|
@ -1542,10 +1542,20 @@ fn compare_example_block<'b, 's>(
|
|||||||
emacs: &'b Token<'s>,
|
emacs: &'b Token<'s>,
|
||||||
rust: &'b ExampleBlock<'s>,
|
rust: &'b ExampleBlock<'s>,
|
||||||
) -> Result<DiffEntry<'b, 's>, Box<dyn std::error::Error>> {
|
) -> Result<DiffEntry<'b, 's>, Box<dyn std::error::Error>> {
|
||||||
let this_status = DiffStatus::Good;
|
let mut this_status = DiffStatus::Good;
|
||||||
let message = None;
|
let mut message = None;
|
||||||
|
|
||||||
// TODO: Compare :value :switches :number-lines :preserve-indent :retain-labels :use-labels :label-fmt
|
// TODO: Compare :switches :number-lines :preserve-indent :retain-labels :use-labels :label-fmt
|
||||||
|
|
||||||
|
// Compare value
|
||||||
|
let contents = get_property_quoted_string(emacs, ":value")?.unwrap_or(String::new());
|
||||||
|
if contents != rust.contents {
|
||||||
|
this_status = DiffStatus::Bad;
|
||||||
|
message = Some(format!(
|
||||||
|
"Value mismatch (emacs != rust) {:?} != {:?}",
|
||||||
|
contents, rust.contents
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
Ok(DiffResult {
|
Ok(DiffResult {
|
||||||
status: this_status,
|
status: this_status,
|
||||||
|
@ -95,7 +95,7 @@ pub(crate) fn comment_block<'b, 'g, 'r, 's>(
|
|||||||
input: OrgSource<'s>,
|
input: OrgSource<'s>,
|
||||||
) -> Res<OrgSource<'s>, CommentBlock<'s>> {
|
) -> Res<OrgSource<'s>, CommentBlock<'s>> {
|
||||||
let (remaining, name) = lesser_block_begin("comment")(context, input)?;
|
let (remaining, name) = lesser_block_begin("comment")(context, input)?;
|
||||||
let (remaining, parameters) = opt(tuple((space1, data)))(remaining)?;
|
let (remaining, _parameters) = opt(tuple((space1, data)))(remaining)?;
|
||||||
let (remaining, _nl) = recognize(tuple((space0, line_ending)))(remaining)?;
|
let (remaining, _nl) = recognize(tuple((space0, line_ending)))(remaining)?;
|
||||||
let lesser_block_end_specialized = lesser_block_end("comment");
|
let lesser_block_end_specialized = lesser_block_end("comment");
|
||||||
let contexts = [
|
let contexts = [
|
||||||
@ -109,10 +109,6 @@ pub(crate) fn comment_block<'b, 'g, 'r, 's>(
|
|||||||
let parser_context = context.with_additional_node(&contexts[0]);
|
let parser_context = context.with_additional_node(&contexts[0]);
|
||||||
let parser_context = parser_context.with_additional_node(&contexts[1]);
|
let parser_context = parser_context.with_additional_node(&contexts[1]);
|
||||||
let parser_context = parser_context.with_additional_node(&contexts[2]);
|
let parser_context = parser_context.with_additional_node(&contexts[2]);
|
||||||
let parameters = match parameters {
|
|
||||||
Some((_ws, parameters)) => Some(parameters),
|
|
||||||
None => None,
|
|
||||||
};
|
|
||||||
|
|
||||||
let (remaining, contents) = parser_with_context!(text_until_exit)(&parser_context)(remaining)?;
|
let (remaining, contents) = parser_with_context!(text_until_exit)(&parser_context)(remaining)?;
|
||||||
let (remaining, _end) = lesser_block_end_specialized(&parser_context, remaining)?;
|
let (remaining, _end) = lesser_block_end_specialized(&parser_context, remaining)?;
|
||||||
@ -123,7 +119,6 @@ pub(crate) fn comment_block<'b, 'g, 'r, 's>(
|
|||||||
CommentBlock {
|
CommentBlock {
|
||||||
source: source.into(),
|
source: source.into(),
|
||||||
name: name.into(),
|
name: name.into(),
|
||||||
data: parameters.map(|parameters| Into::<&str>::into(parameters)),
|
|
||||||
contents: contents.into(),
|
contents: contents.into(),
|
||||||
},
|
},
|
||||||
))
|
))
|
||||||
|
@ -33,7 +33,6 @@ pub struct VerseBlock<'s> {
|
|||||||
pub struct CommentBlock<'s> {
|
pub struct CommentBlock<'s> {
|
||||||
pub source: &'s str,
|
pub source: &'s str,
|
||||||
pub name: &'s str,
|
pub name: &'s str,
|
||||||
pub data: Option<&'s str>,
|
|
||||||
pub contents: &'s str,
|
pub contents: &'s str,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user