Skip to content

Commit

Permalink
rustdoc: Print feature flag and issue link if present in short_stability
Browse files Browse the repository at this point in the history
  • Loading branch information
m4rw3r committed Aug 16, 2015
1 parent b310387 commit 9698e8f
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 4 deletions.
17 changes: 16 additions & 1 deletion src/librustdoc/html/render.rs
Expand Up @@ -1709,7 +1709,22 @@ fn short_stability(item: &clean::Item, cx: &Context, show_reason: bool) -> Optio
};
format!("Deprecated{}{}", since, Markdown(&reason))
} else if stab.level == attr::Unstable {
format!("Unstable{}", Markdown(&reason))
let unstable_extra = if show_reason {
match (!stab.feature.is_empty(), &cx.issue_tracker_base_url, stab.issue) {
(true, &Some(ref tracker_url), Some(issue_no)) =>
format!(" (<code>{}</code> <a href=\"{}{}\">#{}</a>)", Escape(&stab.feature),
tracker_url, issue_no, issue_no),
(false, &Some(ref tracker_url), Some(issue_no)) =>
format!(" (<a href=\"{}{}\">#{}</a>)", Escape(&tracker_url), issue_no,
issue_no),
(true, _, _) =>
format!(" (<code>{}</code>)", Escape(&stab.feature)),
_ => String::new(),
}
} else {
String::new()
};
format!("Unstable{}{}", unstable_extra, Markdown(&reason))
} else {
return None
};
Expand Down
6 changes: 3 additions & 3 deletions src/librustdoc/html/static/main.css
Expand Up @@ -123,7 +123,7 @@ code, pre {
font-family: "Source Code Pro", Menlo, Monaco, Consolas, "DejaVu Sans Mono", Inconsolata, monospace;
white-space: pre-wrap;
}
.docblock code {
.docblock code, .stability code {
background-color: #F5F5F5;
border-radius: 3px;
padding: 0 0.2em;
Expand Down Expand Up @@ -387,11 +387,11 @@ a {
background: transparent;
}

.docblock a {
.docblock a, .stability a {
color: #4e8bca;
}

.docblock a:hover {
.docblock a:hover, .stability a {
text-decoration: underline;
}

Expand Down

0 comments on commit 9698e8f

Please sign in to comment.