about summary refs log tree commit diff
diff options
context:
space:
mode:
authorHuon Wilson <dbau.pp+github@gmail.com>2014-03-12 23:09:03 +1100
committerAlex Crichton <alex@alexcrichton.com>2014-03-12 15:01:25 -0700
commite1e4816e16125e27d8bcb0723423b2a8ff21c91c (patch)
tree038cfa648e9ef814a269ab16e7f9ab7fe45fb1d9
parent0bfb61ed9d3c32989cea49c11e838229ddfb855e (diff)
downloadrust-e1e4816e16125e27d8bcb0723423b2a8ff21c91c.tar.gz
rust-e1e4816e16125e27d8bcb0723423b2a8ff21c91c.zip
rustdoc: whitelist the headers that get a § on hover.
Previously the :hover rules were making the links to the traits/types in
something like

    impl<K: Hash + Eq, V> ... { ... }

be displayed with a trailing `§` when hovered over. This commit
restricts that behaviour to specific headers, i.e. those that are known
to be section headers (like those rendered in markdown doc-comments, and
the "Modules", "Functions" etc. headings).
-rw-r--r--src/librustdoc/html/markdown.rs2
-rw-r--r--src/librustdoc/html/render.rs4
-rw-r--r--src/librustdoc/html/static/main.css17
3 files changed, 10 insertions, 13 deletions
diff --git a/src/librustdoc/html/markdown.rs b/src/librustdoc/html/markdown.rs
index 61c1cd734a3..8780b16918b 100644
--- a/src/librustdoc/html/markdown.rs
+++ b/src/librustdoc/html/markdown.rs
@@ -209,7 +209,7 @@ pub fn render(w: &mut io::Writer, s: &str, print_toc: bool) -> fmt::Result {
         };
 
         // Render the HTML
-        let text = format!(r#"<h{lvl} id="{id}"><a
+        let text = format!(r#"<h{lvl} id="{id}" class='section-link'><a
                            href="\#{id}">{sec_len,plural,=0{}other{{sec} }}{}</a></h{lvl}>"#,
                            s, lvl = level, id = id,
                            sec_len = sec.len(), sec = sec);
diff --git a/src/librustdoc/html/render.rs b/src/librustdoc/html/render.rs
index b705e976e46..32f83f217c5 100644
--- a/src/librustdoc/html/render.rs
+++ b/src/librustdoc/html/render.rs
@@ -1064,7 +1064,9 @@ fn item_module(w: &mut Writer, cx: &Context,
                 clean::ForeignStaticItem(..)   => ("ffi-statics", "Foreign Statics"),
                 clean::MacroItem(..)           => ("macros", "Macros"),
             };
-            try!(write!(w, "<h2 id='{id}'><a href=\"\\#{id}\">{name}</a></h2>\n<table>",
+            try!(write!(w,
+                        "<h2 id='{id}' class='section-link'>\
+                        <a href=\"\\#{id}\">{name}</a></h2>\n<table>",
                         id = short, name = name));
         }
 
diff --git a/src/librustdoc/html/static/main.css b/src/librustdoc/html/static/main.css
index f2c10f053c2..2c7e5f0f675 100644
--- a/src/librustdoc/html/static/main.css
+++ b/src/librustdoc/html/static/main.css
@@ -317,16 +317,11 @@ pre.rust .doccomment { color: #4D4D4C; }
 pre.rust .macro, pre.rust .macro-nonterminal { color: #3E999F; }
 pre.rust .lifetime { color: #B76514; }
 
-h1:hover a:after,
-h2:hover a:after,
-h3:hover a:after,
-h4:hover a:after,
-h5:hover a:after,
-h6:hover a:after {
+h1.section-link:hover a:after,
+h2.section-link:hover a:after,
+h3.section-link:hover a:after,
+h4.section-link:hover a:after,
+h5.section-link:hover a:after,
+h6.section-link:hover a:after {
   content: ' § ';
 }
-
-h1.fqn:hover a:after,
-:hover a.fnname:after {
-  content: none;
-}