Re: [RFC/PATCH] gitweb: Add committags support
From: Junio C Hamano <hidden>
Date: 2016-06-15 22:42:41
Jakub Narebski [off-list ref] writes:
Yet another question is how to deal with commit message specific "syntax highlighting". Currently, parsing commit message line by line, we treat specially signoff lines (syntax highlighting, and removing trailing empty lines after signoff), empty lines (we collapse consecutive empty lines); the rest goes through format_log_line_html... and committags.
Actually I was hoping that my bright idea(tm) of passing the
whole message to a chain of tag markers would solve that
automatically. You define a std marker whose purpose is _not_
to add anchor elements leading to other URLs but mark up
sign-off lines and stuff. Put that at the beginning or at the
end of the chain as you see fit and it would do its work just
like other real tag markers would do.
For example, one of the things it would do is to unhighlight
the Signed-off-by: lines. It would match and split with
/(.*?)^(Signed-off-by: .*?)$(.*)/ms
then add:
( $1, # pass as literal we did not touch
\'<span class="signoff">', # unhighlight
$2, # give chance to muck with e-mail address to downstream
# markers
\'</span>'
)
to its output buffer and process the rest ($3). A downstream
tag maker may match e-mail address the above left and might mark
it up with mailto: URL.