about summary refs log tree commit homepage
path: root/lib/PublicInbox
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2019-04-05 20:04:29 +0000
committerEric Wong <e@80x24.org>2019-04-15 06:20:41 +0000
commit33f5e614291025447dced2aca7258f64bb589d0b (patch)
treedc48a969d9cd5067bc9273226bb0fb080742fa7f /lib/PublicInbox
parent569a56e294dca7b0eacc8ff0c685944430ea6ba9 (diff)
downloadpublic-inbox-33f5e614291025447dced2aca7258f64bb589d0b.tar.gz
We'll be building off of this for showing diffs in
the coderepo views.
Diffstat (limited to 'lib/PublicInbox')
-rw-r--r--lib/PublicInbox/ViewDiff.pm4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/PublicInbox/ViewDiff.pm b/lib/PublicInbox/ViewDiff.pm
index a773e385..0cce952d 100644
--- a/lib/PublicInbox/ViewDiff.pm
+++ b/lib/PublicInbox/ViewDiff.pm
@@ -15,12 +15,16 @@ use URI::Escape qw(uri_escape_utf8);
 use PublicInbox::Hval qw(ascii_html to_attr from_attr);
 use PublicInbox::Git qw(git_unquote);
 
+# keep track of state so we can avoid redundant HTML tags for
+# identically-classed lines
 sub DSTATE_INIT () { 0 }
 sub DSTATE_STAT () { 1 }
 sub DSTATE_HEAD () { 2 } # /^diff --git /, /^index /, /^--- /, /^\+\+\+ /
 sub DSTATE_CTX () { 3 } # /^ /
 sub DSTATE_ADD () { 4 } # /^\+/
 sub DSTATE_DEL () { 5 } # /^\-/
+
+# maps the DSTATE_* to CSS class names compatible with what cgit uses:
 my @state2class = (
         '', # init
         '', # stat