grim/hgkeeper-theme
Clone
Update the diff and file templates to use css counters for line numbers instead of injecting html elements. Also change the color for added lines to blue to help those with red-green colorblindness.
--- a/templates/hgkeeper/diff/block.tmpl Tue May 05 00:30:06 2020 -0500
+++ b/templates/hgkeeper/diff/block.tmpl Tue May 05 00:43:14 2020 -0500
@@ -1,1 +1,1 @@
-<div class="card mt-2 diff"><div class="card-header diff-header" data-changetype="{ifeq(changetype, 'added', 'added {fileb}', ifeq(changetype, 'removed', 'removed {filea}', ifeq(changetype, 'renamed', 'renamed {filea} to {fileb}', 'modified {filea}')))}"></div><div class="d-inline-block" style="min-width: 100%">{lines}</div></div>
\ No newline at end of file
+<div class="card mt-2 hgk-diff"><div class="card-header diff-header" data-changetype="{ifeq(changetype, 'added', 'added {fileb}', ifeq(changetype, 'removed', 'removed {filea}', ifeq(changetype, 'renamed', 'renamed {filea} to {fileb}', 'modified {filea}')))}"></div>{lines}</div> \ No newline at end of file
--- a/templates/hgkeeper/diff/lineat.tmpl Tue May 05 00:30:06 2020 -0500
+++ b/templates/hgkeeper/diff/lineat.tmpl Tue May 05 00:43:14 2020 -0500
@@ -1,1 +1,1 @@
-<div class="d-flex">{difflineanchors}<div class="offset">{strip(line|escape, '\r\n')}</div></div>
\ No newline at end of file
+<div class="offset" style="counter-reset: linea {linea - 1} lineb {lineb - 1}"><span class="hgk-linenumber"></span><span class="hgk-linenumber"></span>{strip(line|escape, '\r\n')}</div> \ No newline at end of file
--- a/templates/hgkeeper/diff/lineminus.tmpl Tue May 05 00:30:06 2020 -0500
+++ b/templates/hgkeeper/diff/lineminus.tmpl Tue May 05 00:43:14 2020 -0500
@@ -1,4 +1,1 @@
- <del id="{lineid}">{strip(line|escape, '\r\n')}</del>
\ No newline at end of file
+<div class="a">{ifeq(linea, 0, '<span class="hgk-linenumber"></span>', '<a class="a" href="#"></a>')}<span class="hgk-linenumber"></span><del id="{lineid}">{strip(line|escape, '\r\n')}</del></div> --- a/templates/hgkeeper/diff/lineplus.tmpl Tue May 05 00:30:06 2020 -0500
+++ b/templates/hgkeeper/diff/lineplus.tmpl Tue May 05 00:43:14 2020 -0500
@@ -1,4 +1,1 @@
- <ins id="{lineid}">{strip(line|escape, '\r\n')}</ins>
\ No newline at end of file
+<div class="b"><span class="hgk-linenumber"></span>{ifeq(lineb, 0, '<span class="hgk-linenumber"></span>', '<a class="b" href="#"></a>')}<ins id="{lineid}">{strip(line|escape, '\r\n')}</ins></div> \ No newline at end of file
--- a/templates/hgkeeper/file/revision.tmpl Tue May 05 00:30:06 2020 -0500
+++ b/templates/hgkeeper/file/revision.tmpl Tue May 05 00:43:14 2020 -0500
@@ -6,8 +6,8 @@
-<div class="card mt-2 file">
- <div class="d-inline-block" style="min-width: 100%">
+ <div class="hgk-file" style="min-width: 100%"> --- a/templates/hgkeeper/map Tue May 05 00:30:06 2020 -0500
+++ b/templates/hgkeeper/map Tue May 05 00:43:14 2020 -0500
@@ -48,7 +48,7 @@
changesetnodeentry = changeset/nodeentry.tmpl
diffblock = diff/block.tmpl
-diffline = diff/line.tmpl
+diffline = '<div class="unchanged"><a class="a" href="#"></a><a class="b" href="#"></a>{strip(line|escape, '\r\n')}</div>' difflineanchors = diff/lineanchors.tmpl
difflineat = diff/lineat.tmpl
difflineminus = diff/lineminus.tmpl
@@ -56,6 +56,6 @@
diffstatlink = diff/stat.tmpl
diffstatnolink = diff/stat.tmpl
-fileline = '<div class="d-flex"><a href="#{lineid}" class="line-number" data-line-number="{linenumber}"></a><div id="{lineid}" class="line">{strip(line|escape, '\r\n')}</div></div>'
+fileline = '<div id="{lineid}"><a href="#{lineid}"></a>{strip(line|escape, '\r\n')}</div>' filerevision = file/revision.tmpl
--- a/templates/static/hgk/css/hgkeeper.css Tue May 05 00:30:06 2020 -0500
+++ b/templates/static/hgk/css/hgkeeper.css Tue May 05 00:43:14 2020 -0500
@@ -9,29 +9,119 @@
- content: attr(data-changetype);
+/****************************************************************************** + *****************************************************************************/ + font-family: monospace; + counter-increment: lineno; + content: counter(lineno); + background-color: #686860;
- background-color: #7dff7d;
+/****************************************************************************** + *****************************************************************************/ + font-family: monospace; + counter-reset: linea 0 lineb 0; +.hgk-diff div.unchanged { + counter-increment: linea lineb; + counter-increment: linea; + background-color: #ff8d8d; + counter-increment: lineb; + background-color: #4fc0d1; flex: 1 1 auto; /* bootstrap flex-fill */
+.hgk-diff div span.hgk-linenumber, - flex-shrink: 0; /* bootstrap flex-shrink */
+.hgk-diff div span.hgk-linenumber { +.hgk-diff div a.a::before { + content: counter(linea);
- content: attr(data-line-number);
+.hgk-diff div a.b::before { + content: counter(lineb); +/****************************************************************************** + *****************************************************************************/ + content: attr(data-changetype); @@ -40,48 +130,6 @@
flex: 1 1 auto; /* boostrap flex-fill */
- background-color: #686860;
- background-color: #7dff7d;
- border-color: #235d23 !important;
- background-color: #ff8d8d;
- flex: 1 1 auto; /* bootstrap flex-fill */
- background-color: #ff8d8d;
- border-color: #8d2323 !important;
- flex: 1 1 auto; /* bootstrap flex-fill */