Skip to content

fix rustdoc metadata parsing #27410

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 31, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions src/librustdoc/markdown.rs
Original file line number Diff line number Diff line change
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