From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-4.0 required=3.0 tests=ALL_TRUSTED,BAYES_00 shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id 2FF1520377 for ; Fri, 5 Apr 2019 20:04:31 +0000 (UTC) From: Eric Wong To: meta@public-inbox.org Subject: [PATCH 5/5] viewdiff: document constants Date: Fri, 5 Apr 2019 20:04:29 +0000 Message-Id: <20190405200429.16973-6-e@80x24.org> In-Reply-To: <20190405200429.16973-1-e@80x24.org> References: <20190405200429.16973-1-e@80x24.org> List-Id: 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