Make source links highlight the entire definition and not just the first line

This commit is contained in:
Jordi Boggiano 2013-10-02 19:35:30 +02:00 committed by Alex Crichton
parent 49e6db7f35
commit f00d72b78b

View file

@ -714,13 +714,18 @@ impl<'self> fmt::Default for Item<'self> {
do clean_srcpath(it.item.source.filename) |component| {
path.push(component.to_owned());
}
let href = if it.item.source.loline == it.item.source.hiline {
format!("{}", it.item.source.loline)
} else {
format!("{}-{}", it.item.source.loline, it.item.source.hiline)
};
write!(fmt.buf,
"<a class='source'
href='{root}src/{crate}/{path}.html\\#{line}'>[src]</a>",
href='{root}src/{crate}/{path}.html\\#{href}'>[src]</a>",
root = it.cx.root_path,
crate = it.cx.layout.crate,
path = path.connect("/"),
line = it.item.source.loline);
href = href);
}
// Write the breadcrumb trail header for the top