diff options
| author | Brian Anderson <banderson@mozilla.com> | 2012-03-07 15:45:16 -0800 | 
|---|---|---|
| committer | Brian Anderson <banderson@mozilla.com> | 2012-03-07 15:45:16 -0800 | 
| commit | a9bd76b3c11ee0ad706abc3779a337fee3550424 (patch) | |
| tree | 5a29ce4c40b546c81701b48fe8d1acd1f2003022 /src/rustdoc/markdown_index_pass.rs | |
| parent | e30611110a8f871bf14616f16139e1fda1817534 (diff) | |
| download | rust-a9bd76b3c11ee0ad706abc3779a337fee3550424.tar.gz rust-a9bd76b3c11ee0ad706abc3779a337fee3550424.zip  | |
rustdoc: Implement more rules for generating internal pandoc links
Diffstat (limited to 'src/rustdoc/markdown_index_pass.rs')
| -rw-r--r-- | src/rustdoc/markdown_index_pass.rs | 13 | 
1 files changed, 11 insertions, 2 deletions
diff --git a/src/rustdoc/markdown_index_pass.rs b/src/rustdoc/markdown_index_pass.rs index f7481da3c0b..bad6f932d70 100644 --- a/src/rustdoc/markdown_index_pass.rs +++ b/src/rustdoc/markdown_index_pass.rs @@ -80,10 +80,14 @@ fn pandoc_header_id(header: str) -> str { let header = maybe_use_section_id(header); ret header; - fn remove_formatting(s: str) -> str { s } - fn remove_punctuation(s: str) -> str { + fn remove_formatting(s: str) -> str { str::replace(s, "`", "") } + fn remove_punctuation(s: str) -> str { + let s = str::replace(s, "<", ""); + let s = str::replace(s, ">", ""); + ret s; + } fn replace_with_hyphens(s: str) -> str { str::replace(s, " ", "-") } @@ -93,6 +97,11 @@ fn pandoc_header_id(header: str) -> str { } #[test] +fn should_remove_brackets_from_headers() { + assert pandoc_header_id("impl foo of bar<A>") == "impl-foo-of-bara"; +} + +#[test] fn should_index_mod_contents() { let doc = test::mk_doc( config::doc_per_crate,  | 
