rustdoc: Implement more rules for generating internal pandoc links
This commit is contained in:
parent
e30611110a
commit
a9bd76b3c1
@ -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, " ", "-")
|
||||
}
|
||||
@ -92,6 +96,11 @@ fn remove_up_to_first_letter(s: str) -> str { s }
|
||||
fn maybe_use_section_id(s: str) -> str { s }
|
||||
}
|
||||
|
||||
#[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(
|
||||
|
Loading…
Reference in New Issue
Block a user