# HG changeset patch # User Anton Shestakov # Date 1442149294 -28800 # Node ID 399e970e35c8853a864442f6a93709ea91bb1635 # Parent 836291420d535cae069acb3b671b980ac97bcce4 coal: copy newer things from paper Basically, coal style in hgweb is intended to be functionally equivalent (just different in style) to paper, and does this by reusing almost all templates from paper (except header.tmpl, where it specifies a different css file). Looks like everybody forgot this and so many improvements to paper templates, that should've also made it into coal, were often only half-done there (usually thanks to template reuse). Let's fix this by bulk-copying missing things from paper/map and style-paper.css to coal/map and style-coal.css. There were many improvements to paper that didn't touch coal, and that makes it hard to untangle the code and split this patch into many, but here are some of the changes (paper-only), that now get into coal: 41c4bdd1d585 - hgweb: color line which is linked to in file source view f3393d458bf5 - hgweb: highlight line which is linked to at annotate view f2e4fdb3dd27 - hgweb: code selection without line numbers in file source view 5ec5097b4c0f - hgweb: add line wrapping switch to file source view bf661a03fddc - hgweb: use css margin instead of empty

before diffstat table It also fixes line anchor in annotateline template (#42 vs #l42). diff -r 836291420d53 -r 399e970e35c8 mercurial/templates/coal/map --- a/mercurial/templates/coal/map Sat Sep 12 16:11:17 2015 -0700 +++ b/mercurial/templates/coal/map Sun Sep 13 21:01:34 2015 +0800 @@ -73,32 +73,36 @@ filecomparison = ../paper/filecomparison.tmpl filelog = ../paper/filelog.tmpl fileline = ' -

{linenumber} {line|escape}
' + {strip(line|escape, '\r\n')}' filelogentry = ../paper/filelogentry.tmpl annotateline = ' - + - {author|user}@{rev} - {linenumber} {line|escape} + {linenumber} {line|escape} ' -diffblock = '
{lines}
' -difflineplus = '{linenumber} {line|escape}' -difflineminus = '{linenumber} {line|escape}' -difflineat = '{linenumber} {line|escape}' -diffline = '{linenumber} {line|escape}' +diffblock = '
{lines}
' +difflineplus = ' + {strip(line|escape, '\r\n')}' +difflineminus = ' + {strip(line|escape, '\r\n')}' +difflineat = ' + {strip(line|escape, '\r\n')}' +diffline = ' + {strip(line|escape, '\r\n')}' comparisonblock =' {lines} ' comparisonline = ' - - {leftlinenumber} {leftline|escape} - {rightlinenumber} {rightline|escape} + + {leftlinenumber} {leftline|escape} + {rightlinenumber} {rightline|escape} ' changelogparent = ' diff -r 836291420d53 -r 399e970e35c8 mercurial/templates/static/style-coal.css --- a/mercurial/templates/static/style-coal.css Sat Sep 12 16:11:17 2015 -0700 +++ b/mercurial/templates/static/style-coal.css Sun Sep 13 21:01:34 2015 +0800 @@ -107,6 +107,9 @@ .minusline { color: #dc143c; } /* crimson */ .atline { color: purple; } +.diffstat-table { + margin-top: 1em; +} .diffstat-file { white-space: nowrap; font-size: 90%; @@ -199,8 +202,6 @@ .bigtable .description { } .bigtable .description .base { font-size: 70%; float: right; line-height: 1.66; } .bigtable .node { width: 5em; font-family: monospace;} -.bigtable .lineno { width: 2em; text-align: right;} -.bigtable .lineno a { color: #999; font-size: smaller; font-family: monospace;} .bigtable .permissions { width: 8em; text-align: left;} .bigtable .size { width: 5em; text-align: right; } .bigtable .annotate { text-align: right; } @@ -218,13 +219,59 @@ .source a { color: #999; font-size: smaller; font-family: monospace;} .bottomline { border-bottom: 1px solid #999; } -.sourcelines > div { +.sourcelines { + font-size: 90%; + position: relative; + counter-reset: lineno; +} + +.wrap > span { + white-space: pre-wrap; +} + +.linewraptoggle { + float: right; +} + +.diffblocks { counter-reset: lineno; } +.diffblocks > div { counter-increment: lineno; } + +.sourcelines > span { display: inline-block; + box-sizing: border-box; width: 100%; - padding: 1px 0px; + padding: 1px 0px 1px 5em; 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; + margin-left: -5em; + width: 4em; + font-size: smaller; + color: #999; + text-align: right; + content: counters(lineno, "."); + float: left; +} + +.sourcelines > span:target, tr:target td { + background-color: #bfdfff; +} + +.sourcelines > a { + display: inline-block; + position: absolute; + left: 0px; + width: 4em; + height: 1em; +} + .fileline { font-family: monospace; } .fileline img { border: 0; } diff -r 836291420d53 -r 399e970e35c8 tests/test-hgweb-symrev.t --- a/tests/test-hgweb-symrev.t Sat Sep 12 16:11:17 2015 -0700 +++ b/tests/test-hgweb-symrev.t Sun Sep 13 21:01:34 2015 +0800 @@ -376,8 +376,8 @@ annotate foo @ 1:a7c1559b7bba 43c799df6e75 9d8c40cba617 - log