]> Sergey Matveev's repositories - public-inbox.git/commitdiff
viewdiff: document constants
authorEric Wong <e@80x24.org>
Fri, 5 Apr 2019 20:04:29 +0000 (20:04 +0000)
committerEric Wong <e@80x24.org>
Mon, 15 Apr 2019 06:20:41 +0000 (06:20 +0000)
We'll be building off of this for showing diffs in
the coderepo views.

lib/PublicInbox/ViewDiff.pm

index a773e385a33b8e9fcdc351e1a10cb460026e95de..0cce952d99011800e94904c80728f8911bc1278c 100644 (file)
@@ -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