Don't take into account hashtag prepended lines if not in rust code block

This commit is contained in:
Guillaume Gomez 2022-12-10 21:01:48 +01:00
parent a161a7b654
commit e81ad69331

View File

@ -246,8 +246,6 @@ fn next(&mut self) -> Option<Self::Item> {
_ => {} _ => {}
} }
} }
let lines = origtext.lines().filter_map(|l| map_line(l).for_html());
let text = lines.intersperse("\n".into()).collect::<String>();
let parse_result = match kind { let parse_result = match kind {
CodeBlockKind::Fenced(ref lang) => { CodeBlockKind::Fenced(ref lang) => {
@ -260,7 +258,7 @@ fn next(&mut self) -> Option<Self::Item> {
<pre class=\"language-{}\"><code>{}</code></pre>\ <pre class=\"language-{}\"><code>{}</code></pre>\
</div>", </div>",
lang, lang,
Escape(&text), Escape(&origtext),
) )
.into(), .into(),
)); ));
@ -270,6 +268,9 @@ fn next(&mut self) -> Option<Self::Item> {
CodeBlockKind::Indented => Default::default(), CodeBlockKind::Indented => Default::default(),
}; };
let lines = origtext.lines().filter_map(|l| map_line(l).for_html());
let text = lines.intersperse("\n".into()).collect::<String>();
compile_fail = parse_result.compile_fail; compile_fail = parse_result.compile_fail;
should_panic = parse_result.should_panic; should_panic = parse_result.should_panic;
ignore = parse_result.ignore; ignore = parse_result.ignore;