Skip to content

Commit

Permalink
Remove strings fulfilled with whitespaces in code block headers
Browse files Browse the repository at this point in the history
  • Loading branch information
GuillaumeGomez committed Apr 11, 2017
1 parent d4aecf5 commit 143f7be
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/librustdoc/html/markdown.rs
Original file line number Diff line number Diff line change
Expand Up @@ -469,28 +469,28 @@ impl LangString {
);

for token in tokens {
match token {
match token.trim() {
"" => {},
"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; }
"no_run" => { data.no_run = true; seen_rust_tags = !seen_other_tags; }
"ignore" => { data.ignore = true; seen_rust_tags = !seen_other_tags; }
"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;
seen_rust_tags = !seen_other_tags || seen_rust_tags;
}
"compile_fail" if allow_compile_fail => {
data.compile_fail = true;
seen_rust_tags = seen_other_tags == false || seen_rust_tags == true;
seen_rust_tags = !seen_other_tags || seen_rust_tags;
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 = seen_other_tags == false || seen_rust_tags == true;
seen_rust_tags = !seen_other_tags || seen_rust_tags;
} else {
seen_other_tags = true;
}
Expand Down Expand Up @@ -680,6 +680,7 @@ mod tests {
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());
t("text,no_run", false, true, false, false, false, false, Vec::new());
}

#[test]
Expand Down

0 comments on commit 143f7be

Please sign in to comment.