From: Eric Wong <e@80x24.org>
To: meta@public-inbox.org
Subject: [PATCH 5/5] viewdiff: document constants
Date: Fri, 5 Apr 2019 20:04:29 +0000 [thread overview]
Message-ID: <20190405200429.16973-6-e@80x24.org> (raw)
In-Reply-To: <20190405200429.16973-1-e@80x24.org>
We'll be building off of this for showing diffs in
the coderepo views.
---
lib/PublicInbox/ViewDiff.pm | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/lib/PublicInbox/ViewDiff.pm b/lib/PublicInbox/ViewDiff.pm
index a773e38..0cce952 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
--
EW
prev parent reply other threads:[~2019-04-05 20:04 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-05 20:04 [PATCH 0/5] a few more cgit compatibility updates Eric Wong
2019-04-05 20:04 ` [PATCH 1/5] config: support cgit scan-path and scan-hidden-path Eric Wong
2019-04-05 20:04 ` [PATCH 2/5] cgit: serve static css, logo, favicon directly Eric Wong
2019-04-05 20:04 ` [PATCH 3/5] config: support more cgit directives for project lists Eric Wong
2019-04-15 6:53 ` [PATCH 6/5] config: fix regression in repo.path => coderepo.dir mapping Eric Wong
2019-04-05 20:04 ` [PATCH 4/5] doc/config: update cgit.cgi scan location Eric Wong
2019-04-05 20:04 ` Eric Wong [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: http://public-inbox.org/README
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190405200429.16973-6-e@80x24.org \
--to=e@80x24.org \
--cc=meta@public-inbox.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/public-inbox.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).