about summary refs log tree commit diff
path: root/src/librustdoc/html/static
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2013-09-27 10:40:41 -0700
committerAlex Crichton <alex@alexcrichton.com>2013-09-27 10:40:41 -0700
commitc5e03bec4d1e7655fc0fd13922fbebb3001f6bac (patch)
tree9f86089aa268315fc1b8ce6aae820e465808678b /src/librustdoc/html/static
parent10e7f12dafc2e24c9f072d68ff6c4929a28b5c8c (diff)
downloadrust-c5e03bec4d1e7655fc0fd13922fbebb3001f6bac.tar.gz
rust-c5e03bec4d1e7655fc0fd13922fbebb3001f6bac.zip
rustdoc: Don't emit redirect pages for variants/fields
It's just a waste of disk space and it can be done just as well in JS.
Diffstat (limited to 'src/librustdoc/html/static')
-rw-r--r--src/librustdoc/html/static/main.js41
1 files changed, 34 insertions, 7 deletions
diff --git a/src/librustdoc/html/static/main.js b/src/librustdoc/html/static/main.js
index b5ae3dadd77..881149b0dd2 100644
--- a/src/librustdoc/html/static/main.js
+++ b/src/librustdoc/html/static/main.js
@@ -265,25 +265,52 @@
                     output += '<tr class="' + type + ' result"><td>';
 
                     if (type === 'mod') {
-                        output += item.path + '::<a href="' + rootPath + item.path.replace(/::/g, '/') + '/' + name + '/index.html" class="' + type + '">' + name + '</a>';
+                        output += item.path +
+                            '::<a href="' + rootPath +
+                                            item.path.replace(/::/g, '/') + '/' +
+                                            name + '/index.html" class="' +
+                                            type + '">' + name + '</a>';
                     } else if (type === 'static' || type === 'reexport') {
-                        output += item.path + '::<a href="' + rootPath + item.path.replace(/::/g, '/') + '/index.html" class="' + type + '">' + name + '</a>';
+                        output += item.path +
+                            '::<a href="' + rootPath +
+                                            item.path.replace(/::/g, '/') +
+                                            '/index.html" class="' + type +
+                                            '">' + name + '</a>';
                     } else if (item.parent !== undefined) {
+                        console.log(item);
                         var myparent = allPaths[item.parent];
-                        output += item.path + '::' + myparent.name + '::<a href="' + rootPath + item.path.replace(/::/g, '/') + '/' + myparent.type + '.' + myparent.name + '.html" class="' + type + '">' + name + '</a>';
+                        var anchor = '#' + type + '.' + name;
+                        output += item.path + '::' + myparent.name +
+                            '::<a href="' + rootPath +
+                                            item.path.replace(/::/g, '/') +
+                                            '/' + myparent.type +
+                                            '.' + myparent.name +
+                                            '.html' + anchor +
+                                            '" class="' + type +
+                                            '">' + name + '</a>';
                     } else {
-                        output += item.path + '::<a href="' + rootPath + item.path.replace(/::/g, '/') + '/' + type + '.' + name + '.html" class="' + type + '">' + name + '</a>';
+                        output += item.path +
+                            '::<a href="' + rootPath +
+                                            item.path.replace(/::/g, '/') +
+                                            '/' + type +
+                                            '.' + name +
+                                            '.html" class="' + type +
+                                            '">' + name + '</a>';
                     }
 
-                    output += '</td><td><span class="desc">' + item.desc + '</span></td></tr>';
+                    output += '</td><td><span class="desc">' + item.desc +
+                                    '</span></td></tr>';
                 });
             } else {
-                output += 'No results :( <a href="https://duckduckgo.com/?q=' + encodeURIComponent('rust ' + query.query) + '">Try on DuckDuckGo?</a>';
+                output += 'No results :( <a href="https://duckduckgo.com/?q=' +
+                            encodeURIComponent('rust ' + query.query) +
+                            '">Try on DuckDuckGo?</a>';
             }
 
             output += "</p>";
             $('.content').html(output);
-            $('.search-results .desc').width($('.content').width() - 40 - $('.content td:first-child').first().width());
+            $('.search-results .desc').width($('.content').width() - 40 -
+                    $('.content td:first-child').first().width());
             initSearchNav();
         }