提交 440c0f07 编写于 作者: M Martin Wernstål

rustdoc: Added issue tracker option and issue data to clean::Stability

上级 e822a18a
......@@ -2688,7 +2688,8 @@ pub struct Stability {
pub feature: String,
pub since: String,
pub deprecated_since: String,
pub reason: String
pub reason: String,
pub issue: Option<u32>
}
impl Clean<Stability> for attr::Stability {
......@@ -2702,6 +2703,7 @@ fn clean(&self, _: &DocContext) -> Stability {
|istr| istr.to_string()),
reason: self.reason.as_ref().map_or("".to_string(),
|interned| interned.to_string()),
issue: self.issue,
}
}
}
......@@ -2717,6 +2719,7 @@ fn clean(&self, _: &DocContext) -> Stability {
|istr| istr.to_string()),
reason: self.reason.as_ref().map_or("".to_string(),
|interned| interned.to_string()),
issue: self.issue,
}
}
}
......
......@@ -103,6 +103,9 @@ pub struct Context {
pub render_redirect_pages: bool,
/// All the passes that were run on this crate.
pub passes: HashSet<String>,
/// The base-URL of the issue tracker for when an item has been tagged with
/// an issue number.
pub issue_tracker_base_url: Option<String>,
}
/// Indicates where an external crate can be found.
......@@ -303,7 +306,8 @@ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
pub fn run(mut krate: clean::Crate,
external_html: &ExternalHtml,
dst: PathBuf,
passes: HashSet<String>) -> io::Result<()> {
passes: HashSet<String>,
issue_tracker_base_url: Option<String>) -> io::Result<()> {
let src_root = match krate.src.parent() {
Some(p) => p.to_path_buf(),
None => PathBuf::new(),
......@@ -323,6 +327,7 @@ pub fn run(mut krate: clean::Crate,
},
include_sources: true,
render_redirect_pages: false,
issue_tracker_base_url: issue_tracker_base_url,
};
try!(mkdir(&cx.dst));
......@@ -352,6 +357,10 @@ pub fn run(mut krate: clean::Crate,
}
});
}
clean::NameValue(ref x, ref s)
if "issue_tracker_base_url" == *x => {
cx.issue_tracker_base_url = Some(s.to_string());
}
clean::Word(ref x)
if "html_no_source" == *x => {
cx.include_sources = false;
......
......@@ -178,6 +178,8 @@ pub fn opts() -> Vec<getopts::OptGroup> {
"FILES"),
optopt("", "markdown-playground-url",
"URL to send code snippets to", "URL"),
optopt("", "issue-tracker-base-url",
"base URL for issue tracker", "URL"),
optflag("", "markdown-no-toc", "don't include table of contents")
)
}
......@@ -284,7 +286,8 @@ pub fn main_args(args: &[String]) -> isize {
Some("html") | None => {
match html::render::run(krate, &external_html,
output.unwrap_or(PathBuf::from("doc")),
passes.into_iter().collect()) {
passes.into_iter().collect(),
matches.opt_str("issue-tracker-base-url")) {
Ok(()) => {}
Err(e) => panic!("failed to generate documentation: {}", e),
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册