]> git.lizzy.rs Git - rust.git/commitdiff
rustdoc: Added issue tracker option and issue data to clean::Stability
authorMartin Wernstål <m4rw3r@gmail.com>
Sun, 16 Aug 2015 13:53:18 +0000 (15:53 +0200)
committerMartin Wernstål <m4rw3r@gmail.com>
Sun, 16 Aug 2015 20:15:26 +0000 (22:15 +0200)
src/librustdoc/clean/mod.rs
src/librustdoc/html/render.rs
src/librustdoc/lib.rs

index 04b1f8ee1b1d39f94c0031e425236db6450ce336..05be445820d10b668b63345d5a171e0f458c5daa 100644 (file)
@@ -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,
         }
     }
 }
index 83e77a5c038655533628773d4d194f99e9f22cc1..53869e042a812cc7f33c31cf91e409edb47168c2 100644 (file)
@@ -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;
index 33902363e0a258a1bb89dfc3ba7f7c8407cd5c2a..73b7de45c4a2c90fdc3949a5cb8bfe4d11c3cdc7 100644 (file)
@@ -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),
             }