]> git.lizzy.rs Git - rust.git/commitdiff
rustdoc: Fix and improve line break hints with the <wbr> tag
authorPiotr Czarnecki <pioczarn@gmail.com>
Sun, 17 Aug 2014 18:28:20 +0000 (19:28 +0100)
committerPiotr Czarnecki <pioczarn@gmail.com>
Sun, 17 Aug 2014 18:28:20 +0000 (19:28 +0100)
Prevents zero-width spaces from appearing in copy-pasted paths.

Puts line breaks after `::`.

Fixes #16555

src/librustdoc/html/render.rs

index bb68c6536a00d3ab676b3c506de65b87be9ad5df..be62b1cc36f409dfbda0c52f1b124e582cfba9fc 100644 (file)
@@ -1316,7 +1316,7 @@ fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
             let cur = self.cx.current.as_slice();
             let amt = if self.ismodule() { cur.len() - 1 } else { cur.len() };
             for (i, component) in cur.iter().enumerate().take(amt) {
-                try!(write!(fmt, "<a href='{}index.html'>{}</a>&#8203;::",
+                try!(write!(fmt, "<a href='{}index.html'>{}</a>::<wbr>",
                             "../".repeat(cur.len() - i - 1),
                             component.as_slice()));
             }
@@ -1325,7 +1325,7 @@ fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
                     shortty(self.item), self.item.name.get_ref().as_slice()));
 
         // Write stability level
-        try!(write!(fmt, "&#8203;{}", Stability(&self.item.stability)));
+        try!(write!(fmt, "<wbr>{}", Stability(&self.item.stability)));
 
         // Links to out-of-band information, i.e. src and stability dashboard
         try!(write!(fmt, "</div><div class='out-of-band'>"));
@@ -2078,7 +2078,7 @@ fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
         let len = cx.current.len() - if it.is_mod() {1} else {0};
         for (i, name) in cx.current.iter().take(len).enumerate() {
             if i > 0 {
-                try!(write!(fmt, "&#8203;::"));
+                try!(write!(fmt, "::<wbr>"));
             }
             try!(write!(fmt, "<a href='{}index.html'>{}</a>",
                           cx.root_path