rustdoc: Added issue tracker option and issue data to clean::Stability
This commit is contained in:
parent
e822a18ae7
commit
440c0f07c3
3 changed files with 18 additions and 3 deletions
|
@ -2688,7 +2688,8 @@ pub struct Stability {
|
||||||
pub feature: String,
|
pub feature: String,
|
||||||
pub since: String,
|
pub since: String,
|
||||||
pub deprecated_since: String,
|
pub deprecated_since: String,
|
||||||
pub reason: String
|
pub reason: String,
|
||||||
|
pub issue: Option<u32>
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Clean<Stability> for attr::Stability {
|
impl Clean<Stability> for attr::Stability {
|
||||||
|
@ -2702,6 +2703,7 @@ impl Clean<Stability> for attr::Stability {
|
||||||
|istr| istr.to_string()),
|
|istr| istr.to_string()),
|
||||||
reason: self.reason.as_ref().map_or("".to_string(),
|
reason: self.reason.as_ref().map_or("".to_string(),
|
||||||
|interned| interned.to_string()),
|
|interned| interned.to_string()),
|
||||||
|
issue: self.issue,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2717,6 +2719,7 @@ impl<'a> Clean<Stability> for &'a attr::Stability {
|
||||||
|istr| istr.to_string()),
|
|istr| istr.to_string()),
|
||||||
reason: self.reason.as_ref().map_or("".to_string(),
|
reason: self.reason.as_ref().map_or("".to_string(),
|
||||||
|interned| interned.to_string()),
|
|interned| interned.to_string()),
|
||||||
|
issue: self.issue,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -103,6 +103,9 @@ pub struct Context {
|
||||||
pub render_redirect_pages: bool,
|
pub render_redirect_pages: bool,
|
||||||
/// All the passes that were run on this crate.
|
/// All the passes that were run on this crate.
|
||||||
pub passes: HashSet<String>,
|
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.
|
/// Indicates where an external crate can be found.
|
||||||
|
@ -303,7 +306,8 @@ thread_local!(pub static CURRENT_LOCATION_KEY: RefCell<Vec<String>> =
|
||||||
pub fn run(mut krate: clean::Crate,
|
pub fn run(mut krate: clean::Crate,
|
||||||
external_html: &ExternalHtml,
|
external_html: &ExternalHtml,
|
||||||
dst: PathBuf,
|
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() {
|
let src_root = match krate.src.parent() {
|
||||||
Some(p) => p.to_path_buf(),
|
Some(p) => p.to_path_buf(),
|
||||||
None => PathBuf::new(),
|
None => PathBuf::new(),
|
||||||
|
@ -323,6 +327,7 @@ pub fn run(mut krate: clean::Crate,
|
||||||
},
|
},
|
||||||
include_sources: true,
|
include_sources: true,
|
||||||
render_redirect_pages: false,
|
render_redirect_pages: false,
|
||||||
|
issue_tracker_base_url: issue_tracker_base_url,
|
||||||
};
|
};
|
||||||
|
|
||||||
try!(mkdir(&cx.dst));
|
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)
|
clean::Word(ref x)
|
||||||
if "html_no_source" == *x => {
|
if "html_no_source" == *x => {
|
||||||
cx.include_sources = false;
|
cx.include_sources = false;
|
||||||
|
|
|
@ -178,6 +178,8 @@ pub fn opts() -> Vec<getopts::OptGroup> {
|
||||||
"FILES"),
|
"FILES"),
|
||||||
optopt("", "markdown-playground-url",
|
optopt("", "markdown-playground-url",
|
||||||
"URL to send code snippets to", "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")
|
optflag("", "markdown-no-toc", "don't include table of contents")
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -284,7 +286,8 @@ pub fn main_args(args: &[String]) -> isize {
|
||||||
Some("html") | None => {
|
Some("html") | None => {
|
||||||
match html::render::run(krate, &external_html,
|
match html::render::run(krate, &external_html,
|
||||||
output.unwrap_or(PathBuf::from("doc")),
|
output.unwrap_or(PathBuf::from("doc")),
|
||||||
passes.into_iter().collect()) {
|
passes.into_iter().collect(),
|
||||||
|
matches.opt_str("issue-tracker-base-url")) {
|
||||||
Ok(()) => {}
|
Ok(()) => {}
|
||||||
Err(e) => panic!("failed to generate documentation: {}", e),
|
Err(e) => panic!("failed to generate documentation: {}", e),
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue