changeset 26363:f29ee23bf361

gitweb, monoblue: port highlighting linked lines from paper This is adapted from 41c4bdd1d585, fbfe5748ef3e and f3393d458bf5.
author Anton Shestakov <av6@dwimlabs.net>
date Fri, 25 Sep 2015 12:38:20 +0800
parents 3bfc473f4d33
children 6e9c2aab9925
files mercurial/templates/gitweb/map mercurial/templates/monoblue/map mercurial/templates/static/style-gitweb.css mercurial/templates/static/style-monoblue.css tests/test-hgweb.t
diffstat 5 files changed, 26 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/templates/gitweb/map	Fri Sep 25 03:02:38 2015 +0800
+++ b/mercurial/templates/gitweb/map	Fri Sep 25 12:38:20 2015 +0800
@@ -95,12 +95,12 @@
 fileline = '
   <span id="{lineid}">{strip(line|escape, '\r\n')}</span><a href="#{lineid}"></a>'
 annotateline = '
-  <tr style="font-family:monospace" class="parity{parity}">
+  <tr id="{lineid}" style="font-family:monospace" class="parity{parity}">
     <td class="linenr" style="text-align: right;">
       <a href="{url|urlescape}annotate/{node|short}/{file|urlescape}{sessionvars%urlparameter}#l{targetline}"
          title="{node|short}: {desc|escape|firstline}">{author|user}@{rev}</a>
     </td>
-    <td><pre><a class="linenr" href="#{lineid}" id="{lineid}">{linenumber}</a></pre></td>
+    <td><pre><a class="linenr" href="#{lineid}">{linenumber}</a></pre></td>
     <td><pre>{line|escape}</pre></td>
   </tr>'
 difflineplus = '
@@ -117,9 +117,9 @@
   {lines}
   </tbody>'
 comparisonline = '
-  <tr style="font-family:monospace">
-    <td class="{type}"><pre><a class="linenr" href="#{lineid}" id="{lineid}">{leftlinenumber}</a> {leftline|escape}</pre></td>
-    <td class="{type}"><pre><a class="linenr" href="#{lineid}" id="{lineid}">{rightlinenumber}</a> {rightline|escape}</pre></td>
+  <tr id="{lineid}" style="font-family:monospace">
+    <td class="{type}"><pre><a class="linenr" href="#{lineid}">{leftlinenumber}</a> {leftline|escape}</pre></td>
+    <td class="{type}"><pre><a class="linenr" href="#{lineid}">{rightlinenumber}</a> {rightline|escape}</pre></td>
   </tr>'
 
 changelogparent = '
--- a/mercurial/templates/monoblue/map	Fri Sep 25 03:02:38 2015 +0800
+++ b/mercurial/templates/monoblue/map	Fri Sep 25 12:38:20 2015 +0800
@@ -91,13 +91,13 @@
 fileline = '
   <span id="{lineid}">{strip(line|escape, '\r\n')}</span><a href="#{lineid}"></a>'
 annotateline = '
-  <tr class="parity{parity}">
+  <tr id="{lineid}" class="parity{parity}">
     <td class="linenr">
       <a href="{url|urlescape}annotate/{node|short}/{file|urlescape}{sessionvars%urlparameter}#l{targetline}"
          title="{node|short}: {desc|escape|firstline}">{author|user}@{rev}</a>
     </td>
     <td class="lineno">
-      <a href="#{lineid}" id="{lineid}">{linenumber}</a>
+      <a href="#{lineid}">{linenumber}</a>
     </td>
     <td class="source">{line|escape}</td>
   </tr>'
@@ -115,9 +115,9 @@
   {lines}
   </tbody>'
 comparisonline = '
-  <tr>
-    <td class="source {type}"><a class="linenr" href="#{lineid}" id="{lineid}">{leftlinenumber}</a> {leftline|escape}</td>
-    <td class="source {type}"><a class="linenr" href="#{lineid}" id="{lineid}">{rightlinenumber}</a> {rightline|escape}</td>
+  <tr id="{lineid}">
+    <td class="source {type}"><a class="linenr" href="#{lineid}">{leftlinenumber}</a> {leftline|escape}</td>
+    <td class="source {type}"><a class="linenr" href="#{lineid}">{rightlinenumber}</a> {rightline|escape}</td>
   </tr>'
 
 changesetlink = '<a href="{url|urlescape}rev/{node|short}{sessionvars%urlparameter}">{node|short}</a>'
--- a/mercurial/templates/static/style-gitweb.css	Fri Sep 25 03:02:38 2015 +0800
+++ b/mercurial/templates/static/style-gitweb.css	Fri Sep 25 12:38:20 2015 +0800
@@ -119,6 +119,11 @@
 	width: 4em;
 	height: 1em;
 }
+tr:target td,
+pre.sourcelines > span:target,
+pre.sourcelines.stripes > span:target {
+	background-color: #bfdfff;
+}
 
 /* Graph */
 div#wrapper {
--- a/mercurial/templates/static/style-monoblue.css	Fri Sep 25 03:02:38 2015 +0800
+++ b/mercurial/templates/static/style-monoblue.css	Fri Sep 25 12:38:20 2015 +0800
@@ -300,6 +300,11 @@
 pre.sourcelines.stripes > :nth-child(4n+3) { background-color: #FFFFFF; }
 pre.sourcelines.stripes > :nth-child(4n+1):hover,
 pre.sourcelines.stripes > :nth-child(4n+3):hover { background-color: #D5E1E6; }
+tr:target td,
+pre.sourcelines > span:target,
+pre.sourcelines.stripes > span:target {
+    background-color: #bfdfff;
+}
 
 td.source {
   white-space: pre;
--- a/tests/test-hgweb.t	Fri Sep 25 03:02:38 2015 +0800
+++ b/tests/test-hgweb.t	Fri Sep 25 12:38:20 2015 +0800
@@ -340,7 +340,7 @@
 
   $ get-with-headers.py --twice localhost:$HGPORT 'static/style-gitweb.css' - date etag server
   200 Script output follows
-  content-length: 6264
+  content-length: 6379
   content-type: text/css
   
   body { font-family: sans-serif; font-size: 12px; border:solid #d9d8d1; border-width:1px; margin:10px; }
@@ -464,6 +464,11 @@
   	width: 4em;
   	height: 1em;
   }
+  tr:target td,
+  pre.sourcelines > span:target,
+  pre.sourcelines.stripes > span:target {
+  	background-color: #bfdfff;
+  }
   
   /* Graph */
   div#wrapper {