You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by ho...@apache.org on 2017/05/09 23:58:35 UTC

lucene-solr:jira/solr-10290: SOLR-10640: move the page.shortname based id to so there is no jitter/scroll when clicking links in HTML, and update CheckLinksAndAnchors to account for it there

Repository: lucene-solr
Updated Branches:
  refs/heads/jira/solr-10290 ccebeecd1 -> f6182d851


SOLR-10640: move the page.shortname based id to <body> so there is no jitter/scroll when clicking links in HTML, and update CheckLinksAndAnchors to account for it there


Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/f6182d85
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/f6182d85
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/f6182d85

Branch: refs/heads/jira/solr-10290
Commit: f6182d8519a5b6204985833e53d41c9530a4b251
Parents: ccebeec
Author: Chris Hostetter <ho...@apache.org>
Authored: Tue May 9 16:58:29 2017 -0700
Committer: Chris Hostetter <ho...@apache.org>
Committed: Tue May 9 16:58:29 2017 -0700

----------------------------------------------------------------------
 solr/solr-ref-guide/src/_layouts/default.html       | 2 +-
 solr/solr-ref-guide/src/_layouts/page.html          | 2 +-
 solr/solr-ref-guide/tools/CheckLinksAndAnchors.java | 6 +++++-
 3 files changed, 7 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/f6182d85/solr/solr-ref-guide/src/_layouts/default.html
----------------------------------------------------------------------
diff --git a/solr/solr-ref-guide/src/_layouts/default.html b/solr/solr-ref-guide/src/_layouts/default.html
index f1ec079..e84af38 100755
--- a/solr/solr-ref-guide/src/_layouts/default.html
+++ b/solr/solr-ref-guide/src/_layouts/default.html
@@ -31,7 +31,7 @@
 
     </script>
 </head>
-<body>
+<body id="{{ page.shortname }}">
 {% include topnav.html %}
 <!-- Page Content -->
 <div class="container">

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/f6182d85/solr/solr-ref-guide/src/_layouts/page.html
----------------------------------------------------------------------
diff --git a/solr/solr-ref-guide/src/_layouts/page.html b/solr/solr-ref-guide/src/_layouts/page.html
index 5818cdb..502eeab 100755
--- a/solr/solr-ref-guide/src/_layouts/page.html
+++ b/solr/solr-ref-guide/src/_layouts/page.html
@@ -38,7 +38,7 @@ layout: default
     {% include toc.html %}
     {% endunless %}
 
-<div id="{{ page.shortname }}" class="main-content">
+<div class="main-content">
   {{content}}
 </div>
 

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/f6182d85/solr/solr-ref-guide/tools/CheckLinksAndAnchors.java
----------------------------------------------------------------------
diff --git a/solr/solr-ref-guide/tools/CheckLinksAndAnchors.java b/solr/solr-ref-guide/tools/CheckLinksAndAnchors.java
index 6bdf218..f1b5f2d 100644
--- a/solr/solr-ref-guide/tools/CheckLinksAndAnchors.java
+++ b/solr/solr-ref-guide/tools/CheckLinksAndAnchors.java
@@ -83,13 +83,17 @@ public class CheckLinksAndAnchors {
       
       final String fileContents = readFile(file.getPath());
       final Document doc = Jsoup.parse(fileContents);
+      // we only care about class='main-content' -- we don't want to worry
+      // about ids/links duplicated in the header/footer of every page,
       final Element mainContent = doc.select(".main-content").first();
       if (mainContent == null) {
         throw new RuntimeException(file.getName() + " has no main-content div");
       }
 
-      // Add all of the IDs in this doc to idsToFiles (and idsInMultiFiles if needed)
+      // Add all of the IDs in (the main-content of) this doc to idsToFiles (and idsInMultiFiles if needed)
       final Elements nodesWithIds = mainContent.select("[id]");
+      // NOTE: add <body> to the nodesWithIds so we check the main section anchor as well
+      nodesWithIds.addAll(doc.select("body[id]"));
       for (Element node : nodesWithIds) {
         final String id = node.id();
         assert null != id;