Skip to content

Commit

Permalink
Fix block code headers parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
GuillaumeGomez committed Apr 9, 2017
1 parent 666e714 commit d4aecf5
Showing 1 changed file with 15 additions and 8 deletions.
23 changes: 15 additions & 8 deletions src/librustdoc/html/markdown.rs
Original file line number Diff line number Diff line change
Expand Up @@ -471,20 +471,26 @@ impl LangString {
for token in tokens {
match token {
"" => {},
"should_panic" => { data.should_panic = true; seen_rust_tags = true; },
"no_run" => { data.no_run = true; seen_rust_tags = true; },
"ignore" => { data.ignore = true; seen_rust_tags = true; },
"rust" => { data.rust = true; seen_rust_tags = true; },
"test_harness" => { data.test_harness = true; seen_rust_tags = true; },
"should_panic" => {
data.should_panic = true;
seen_rust_tags = seen_other_tags == false;
}
"no_run" => { data.no_run = true; seen_rust_tags = seen_other_tags == false; }
"ignore" => { data.ignore = true; seen_rust_tags = seen_other_tags == false; }
"rust" => { data.rust = true; seen_rust_tags = true; }
"test_harness" => {
data.test_harness = true;
seen_rust_tags = seen_other_tags == false || seen_rust_tags == true;
}
"compile_fail" if allow_compile_fail => {
data.compile_fail = true;
seen_rust_tags = true;
seen_rust_tags = seen_other_tags == false || seen_rust_tags == true;
data.no_run = true;
}
x if allow_error_code_check && x.starts_with("E") && x.len() == 5 => {
if let Ok(_) = x[1..].parse::<u32>() {
data.error_codes.push(x.to_owned());
seen_rust_tags = true;
seen_rust_tags = seen_other_tags == false || seen_rust_tags == true;
} else {
seen_other_tags = true;
}
Expand Down Expand Up @@ -670,9 +676,10 @@ mod tests {
t("test_harness", false, false, false, true, true, false, Vec::new());
t("compile_fail", false, true, false, true, false, true, Vec::new());
t("{.no_run .example}", false, true, false, true, false, false, Vec::new());
t("{.sh .should_panic}", true, false, false, true, false, false, Vec::new());
t("{.sh .should_panic}", true, false, false, false, false, false, Vec::new());
t("{.example .rust}", false, false, false, true, false, false, Vec::new());
t("{.test_harness .rust}", false, false, false, true, true, false, Vec::new());
t("text, no_run", false, true, false, false, false, false, Vec::new());
}

#[test]
Expand Down

0 comments on commit d4aecf5

Please sign in to comment.