From d54d9b1cab0555140608852164b69c936ada63ce Mon Sep 17 00:00:00 2001 From: Brian Anderson Date: Sat, 10 Mar 2012 15:38:52 -0800 Subject: [PATCH] rustdoc: Fix generation of impl links. Closes #1953 --- src/rustdoc/markdown_index_pass.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/rustdoc/markdown_index_pass.rs b/src/rustdoc/markdown_index_pass.rs index 28b9c015af069..c97c8f7a57590 100644 --- a/src/rustdoc/markdown_index_pass.rs +++ b/src/rustdoc/markdown_index_pass.rs @@ -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 { @@ -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") == "impl-foo-of-bara"; + assert pandoc_header_id("fn@([~A])") == "fna"; } #[test]