Skip to content

Commit 20a33d2

Browse files
committed
feat: page/history and page/blame make better use of space. Improved blame display.
1 parent 1a88ab8 commit 20a33d2

File tree

4 files changed

+14
-12
lines changed

4 files changed

+14
-12
lines changed

otterwiki/static/css/partials/history.css

+8-8
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ tr.added {
4343

4444
table .min {
4545
width: 1%;
46+
padding-right: 0.4rem;
4647
}
4748
table .linenumber {
4849
text-align: right;
@@ -53,24 +54,23 @@ table.blame {
5354
overflow-x: auto;
5455
width: 100%;
5556
}
57+
5658
table.blame td {
57-
padding: 0.1rem 0.5rem;
58-
/*border: 1px solid black;*/
59+
vertical-align: top;
5960
}
61+
6062
table.blame .tt {
6163
font-family: SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;
62-
}
63-
64-
table.blame tr.odd {
65-
background-color: rgba(0, 0, 0, 0.1);
64+
white-space: pre-wrap;
65+
padding-left: 1rem;
6666
}
6767

6868
table.compact td {
6969
padding: 0.5rem 0.2rem;
7070
}
7171

72-
.dark-mode table.blame tr.odd {
73-
background-color: rgba(0, 0, 0, 0.3);
72+
table.blame tr.chunk-start > td {
73+
padding-top: 0.2rem;
7474
}
7575

7676
.text-match {

otterwiki/templates/blame.html

+3-2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
{{ super() }}
55
<meta name="robots" content="noindex, nofollow">
66
{% endblock %}
7+
{% block extra_nav %}{% endblock %}
78
{% block content %}
89
<div class="w-full mw-full p-0 m-0 clearfix">
910
<h2>Blame {#{pagename}#}</h2>
@@ -14,8 +15,8 @@ <h2>Blame {#{pagename}#}</h2>
1415
<td class="min">{% if line[0] %}<a href="{{ url_for("show_commit", revision=line[0]) }}" class="btn revision-small">{{line[0]}}</a>{% endif %}</td>
1516
<td class="min" style="white-space:nowrap">{{line[1]}}</td>
1617
<td class="min" style="white-space:nowrap">{% if line[2] %}<a href="{{ url_for("pageview", path=pagepath, revision=line[0]) }}">{{line[2]|format_datetime}}</a>{% endif %}</td>
17-
<td class="tt min linenumber">{{line[3]}}</td>
18-
<td class="tt"><div class="highlight">{{line[4]|safe}}</div></td>
18+
<td class="tt min linenumber" style="border-left: 2px solid #{{line[6]}};">{{line[3]}}</td>
19+
<td class="tt" style="border-right: 2px solid #{{line[6]}}; border-left: 2px solid #{{line[6]}};"><div class="highlight">{{line[4]|safe}}</div></td>
1920
</tr>
2021
{%- endfor %}{# l in lines #}
2122
</table>

otterwiki/templates/history.html

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
{{ super() }}
55
<meta name="robots" content="noindex, nofollow">
66
{% endblock %}
7+
{% block extra_nav %}{% endblock %}
78
{% block content %}
89
<div class="w-full mw-full p-0 clearfix">
910
<h2>History {#{pagename}#}</h2>

otterwiki/wiki.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -740,11 +740,11 @@ def blame(self):
740740
if row[0] != last:
741741
oddeven = "odd" if oddeven == "even" else "even"
742742
fdata.append(
743-
(row[0], row[1], row[2], int(row[3]), line, oddeven)
743+
(row[0], row[1], row[2], int(row[3]), line, f"chunk-start chunk-start-{oddeven}", row[0])
744744
)
745745
last = row[0]
746746
else:
747-
fdata.append(("", "", "", int(row[3]), line, oddeven))
747+
fdata.append(("", "", "", int(row[3]), line, oddeven, row[0]))
748748
menutree = SidebarPageIndex(get_page_directoryname(self.pagepath))
749749
return render_template(
750750
"blame.html",

0 commit comments

Comments
 (0)