-
Notifications
You must be signed in to change notification settings - Fork 0
/
make_diff.sh
executable file
·74 lines (69 loc) · 1.55 KB
/
make_diff.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#! /bin/sh
OUT="$HOME/Web/diff.html"
cat >| "$OUT" <<EOF
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8"/>
<style type="text/css">
.diff-lineno {
font-weight: bold
}
td.diff-marker {
text-align: right;
font-weight: bold;
font-size: 1.25em;
line-height: 1.2;
}
.diff-addedline, .diff-deletedline, .diff-context {
font-size: 150%; /* TODO make this configurable by the user */
line-height: 1.6;
vertical-align: top;
white-space: -moz-pre-wrap;
white-space: pre-wrap;
border-style: solid;
border-width: 1px 1px 1px 4px;
border-radius: 0.33em;
}
.diff-addedline {
/*border-color: #a3d3ff;*/ /* TODO this and below: propose themes: GitHub, MediaWiki and others */
border-color: #bef5cb;
}
.diff-deletedline {
/*border-color: #ffe49c;*/
border-color: #fdaeb7;
}
.diff-context {
background: #f8f9fa;
border-color: #eaecf0;
color: #222;
}
.diffchange {
font-weight: bold;
text-decoration: none;
}
.diff-addedline .diffchange, .diff-deletedline .diffchange {
border-radius: 0.33em;
padding: 0.25em 0;
}
.diff-addedline .diffchange {
/*background: #d8ecff;*/
background: #bef5cb;
}
.diff-deletedline .diffchange {
/*background: #feeec8;*/
background: #fdaeb7;
}
</style>
</head>
<body>
<table>
EOF
curl 'https://en.wikipedia.org/w/api.php?action=compare&torelative=prev&fromrev=844603014&format=json' |
jq -r '.compare["*"]' >> "$OUT"
cat >> "$OUT" <<EOF
</table>
</body>
</html>
EOF
firefox "$OUT"