[PATCH 1 of 3 RFC V4] hgweb: code selection without line numbers in file source view
Alexander Plavin
me at aplavin.ru
Thu Jul 4 05:36:28 CDT 2013
# HG changeset patch
# User Alexander Plavin <me at aplavin.ru>
# Date 1372933124 -14400
# Thu Jul 04 14:18:44 2013 +0400
# Node ID a1de30293d0e140b14e9d8ed5f2e7540907a81b1
# Parent d7b4aa1049d3fbbc2b8d24114afad82586c49db3
hgweb: code selection without line numbers in file source view
diff -r d7b4aa1049d3 -r a1de30293d0e mercurial/templates/paper/filerevision.tmpl
--- a/mercurial/templates/paper/filerevision.tmpl Sat Jun 29 14:36:51 2013 +0400
+++ b/mercurial/templates/paper/filerevision.tmpl Thu Jul 04 14:18:44 2013 +0400
@@ -68,7 +68,7 @@
<div class="overflow">
<div class="sourcefirst"> line source</div>
-{text%fileline}
+<pre class="sourcelines">{text%fileline}</pre>
<div class="sourcelast"></div>
</div>
</div>
diff -r d7b4aa1049d3 -r a1de30293d0e mercurial/templates/paper/map
--- a/mercurial/templates/paper/map Sat Jun 29 14:36:51 2013 +0400
+++ b/mercurial/templates/paper/map Thu Jul 04 14:18:44 2013 +0400
@@ -72,7 +72,7 @@
filecomparison = filecomparison.tmpl
filelog = filelog.tmpl
fileline = '
- <div class="parity{parity} source"><a href="#{lineid}" id="{lineid}">{linenumber}</a> {line|escape}</div>'
+ <span id="{lineid}">{strip(line|escape, '\r\n')}</span><a href="#{lineid}"></a>'
filelogentry = filelogentry.tmpl
annotateline = '
diff -r d7b4aa1049d3 -r a1de30293d0e mercurial/templates/static/style-paper.css
--- a/mercurial/templates/static/style-paper.css Sat Jun 29 14:36:51 2013 +0400
+++ b/mercurial/templates/static/style-paper.css Thu Jul 04 14:18:44 2013 +0400
@@ -209,6 +209,44 @@
.source a { color: #999; font-size: smaller; font-family: monospace;}
.bottomline { border-bottom: 1px solid #999; }
+.sourcelines {
+ font-size: 90%;
+ position: relative;
+}
+
+.sourcelines > span {
+ display: inline-block;
+ width: 100%;
+ padding: 1px 0px;
+ counter-increment: lineno;
+}
+
+.sourcelines > span:before {
+ -moz-user-select: -moz-none;
+ -khtml-user-select: none;
+ -webkit-user-select: none;
+ -ms-user-select: none;
+ user-select: none;
+ display: inline-block;
+ width: 4em;
+ margin-right: 1em;
+ font-size: smaller;
+ color: #999;
+ text-align: right;
+ content: counter(lineno);
+}
+
+.sourcelines > span:nth-child(4n+1) { background-color: #f0f0f0; }
+.sourcelines > span:nth-child(4n+3) { background-color: white; }
+
+.sourcelines > a {
+ display: inline-block;
+ position: absolute;
+ left: 0px;
+ width: 4em;
+ height: 1em;
+}
+
.fileline { font-family: monospace; }
.fileline img { border: 0; }
More information about the Mercurial-devel
mailing list