Compare value for export block.
This commit is contained in:
		
							parent
							
								
									386ad5091d
								
							
						
					
					
						commit
						1da521b08a
					
				@ -0,0 +1,10 @@
 | 
			
		||||
#+begin_comment
 | 
			
		||||
,* foo
 | 
			
		||||
,,,** bar
 | 
			
		||||
   ,*** baz
 | 
			
		||||
    lorem
 | 
			
		||||
    , ipsum
 | 
			
		||||
,#+begin_src dolar
 | 
			
		||||
 | 
			
		||||
,#+end_src
 | 
			
		||||
#+end_comment
 | 
			
		||||
@ -0,0 +1,10 @@
 | 
			
		||||
#+begin_export html
 | 
			
		||||
,* foo
 | 
			
		||||
,,,** bar
 | 
			
		||||
   ,*** baz
 | 
			
		||||
    lorem
 | 
			
		||||
    , ipsum
 | 
			
		||||
,#+begin_src dolar
 | 
			
		||||
 | 
			
		||||
,#+end_src
 | 
			
		||||
#+end_export
 | 
			
		||||
@ -0,0 +1,3 @@
 | 
			
		||||
#+begin_export latex
 | 
			
		||||
This would be LaTeX code.
 | 
			
		||||
#+end_export
 | 
			
		||||
@ -1845,9 +1845,19 @@ fn compare_export_block<'b, 's>(
 | 
			
		||||
    let mut this_status = DiffStatus::Good;
 | 
			
		||||
    let mut message = None;
 | 
			
		||||
 | 
			
		||||
    // TODO: Compare :type :value
 | 
			
		||||
 | 
			
		||||
    // TODO: Compare :type
 | 
			
		||||
    // TODO: Compare :caption
 | 
			
		||||
 | 
			
		||||
    // 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
 | 
			
		||||
        ));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    // Compare name
 | 
			
		||||
    let name = get_property_quoted_string(emacs, ":name")?;
 | 
			
		||||
    if name.as_ref().map(String::as_str) != rust.name {
 | 
			
		||||
 | 
			
		||||
@ -227,7 +227,7 @@ pub(crate) fn export_block<'b, 'g, 'r, 's>(
 | 
			
		||||
        None => None,
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
    let (remaining, contents) = parser_with_context!(text_until_exit)(&parser_context)(remaining)?;
 | 
			
		||||
    let (remaining, contents) = content(&parser_context, remaining)?;
 | 
			
		||||
    let (remaining, _end) = lesser_block_end_specialized(&parser_context, remaining)?;
 | 
			
		||||
 | 
			
		||||
    let source = get_consumed(input, remaining);
 | 
			
		||||
@ -237,7 +237,7 @@ pub(crate) fn export_block<'b, 'g, 'r, 's>(
 | 
			
		||||
            source: source.into(),
 | 
			
		||||
            name: get_name(&affiliated_keywords),
 | 
			
		||||
            data: parameters.map(|parameters| Into::<&str>::into(parameters)),
 | 
			
		||||
            contents: contents.into(),
 | 
			
		||||
            contents,
 | 
			
		||||
        },
 | 
			
		||||
    ))
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -65,7 +65,7 @@ pub struct ExportBlock<'s> {
 | 
			
		||||
    pub source: &'s str,
 | 
			
		||||
    pub name: Option<&'s str>,
 | 
			
		||||
    pub data: Option<&'s str>,
 | 
			
		||||
    pub contents: &'s str,
 | 
			
		||||
    pub contents: String,
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#[derive(Debug)]
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user