Skip to content

Commit

Permalink
rustdoc: Fix generation of impl links. Closes #1953
Browse files Browse the repository at this point in the history
  • Loading branch information
brson committed Mar 10, 2012
1 parent 57af1e9 commit d54d9b1
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/rustdoc/markdown_index_pass.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,12 @@ fn pandoc_header_id(header: str) -> str {
fn remove_punctuation(s: str) -> str {
let s = str::replace(s, "<", "");
let s = str::replace(s, ">", "");
let s = str::replace(s, "[", "");
let s = str::replace(s, "]", "");
let s = str::replace(s, "(", "");
let s = str::replace(s, ")", "");
let s = str::replace(s, "@", "");
let s = str::replace(s, "~", "");
ret s;
}
fn replace_with_hyphens(s: str) -> str {
Expand All @@ -97,8 +103,9 @@ fn pandoc_header_id(header: str) -> str {
}

#[test]
fn should_remove_brackets_from_headers() {
fn should_remove_punctuation_from_headers() {
assert pandoc_header_id("impl foo of bar<A>") == "impl-foo-of-bara";
assert pandoc_header_id("fn@([~A])") == "fna";
}

#[test]
Expand Down

0 comments on commit d54d9b1

Please sign in to comment.