Skip to content

Commit

Permalink
fix rustdoc metadata parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
Gankra committed Jul 30, 2015
1 parent 6edc994 commit 5b0721d
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/librustdoc/markdown.rs
Expand Up @@ -29,13 +29,14 @@ use test::{TestOptions, Collector};
/// Separate any lines at the start of the file that begin with `%`.
fn extract_leading_metadata<'a>(s: &'a str) -> (Vec<&'a str>, &'a str) {
let mut metadata = Vec::new();
let mut count = 0;
for line in s.lines() {
if line.starts_with("%") {
// remove %<whitespace>
metadata.push(line[1..].trim_left())
metadata.push(line[1..].trim_left());
count += line.len() + 1;
} else {
let line_start_byte = s.find(line).unwrap();
return (metadata, &s[line_start_byte..]);
return (metadata, &s[count..]);
}
}
// if we're here, then all lines were metadata % lines.
Expand Down

0 comments on commit 5b0721d

Please sign in to comment.