MIME-Version: 1.0
X-Mailer: SVN::Notify 2.70: https://metacpan.org/dist/SVN-Notify/
From: theory
Errors-To: theory
To: test@example.com
Subject: [555] = Trac-Style Log Message Formatting =
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: 8bit

Revision
555
Author
theory
Date
2008-02-23 16:49:35 -0700 (Sat, 23 Feb 2008)

Log Message

Trac-Style Log Message Formatting

This "commit" demonstrates how log messages look when they are written in Trac wiki syntax and converted to HTML by Text::Trac via the SVN::Notify::Filter::Trac filter. All of the various features of that syntax are demonstrated here.

I expect that there will soon be filters for Markdown, Textile, POD, and other formatting paradigms. Hopefully, most of the HTML generated by parsing those other syntaxes into HTML will look just as good, mainly because I'm not doing anything special: this is just plain 'ole HTML. But if I've missed something, do let me know.

These three paragraphs, by the way, demostrate how paragraphs look.

Type Styles

Here are the various typographic styles supported by the Trac format:

Headings

Trac supports three levels of headings:

Heading

Subheading

Sub-Subheading

Lists

Lists can be nested, of course:

  1. Item 1
    1. Item 1.a
    2. Item 1.b
      1. Item 1.b.i
      2. Item 1.b.ii
  2. Item 2
  3. Item 3

Definition Lists

I've styled definition lists so that the terms are followed by a colon (:), and the definitions preceded by a closing angle quotation mark (»).

camel
One lump, or two?
python
My hovercraft is full of eels.
elephant
Um, I don't remember.

Preformatted Text

Usually used for blocks of code and the like.

package SVN::Notify::Filter::Trac;

SVN::Notify->register_attributes( trac_url => 'trac-url=s' );

sub log_message {
    my ($notify, $lines) = @_;
    return $lines unless $notify->content_type eq 'text/html';
    my $trac = Text::Trac->new( trac_url => $notify->trac_url );
    return [ $trac->parse( join $/, @{ $lines } ) ];
}

Blockquotes

Unlike the official Trac format (see ticket #6887 for the details), Text::Trac 0.09 nicely includes multiple indented paragraphs in a single block:

Ask not what your country can do for you. Ask what you can do for your country.

—John F. Kennedy

Discussion Citations

As of version 0.09 of Text::Trac, citations are supported. These are the style of citation that's supposed to look kind of like email:

This is some deeply buried original text, in which the poster was going on and on, ad naseum. Make it stop!

This is the reply to the ad naseum comment. This poster, too, went on and on, saying nothing useful, as you might expect. It's usenet, after all!

This is slightly more relevant, or a pile-on, as you might expect.

The last quoted bit from someone else attempting to add a bit of sanity to the discussion.

This bit would be, of course, an application of Godwin's law. ;-P

Tables

I borrowed this example table, as well its style, from Styling Tables with CSS.

Browser20002001200220032004
MSIE 6.x235274
MSIE 5.x4572643918
MSIE 4.x301241< 1
Netscape 6+/Mozilla< 1< 1< 2
Netscape 4-181041< 1
Opera< 1< 1< 1< 11

Escaping Links and WikiPageNames

This paragraph has what appears to be a TracLink, because of the camel-casing of "TracLink", but it's not a link, is it?

Horizontal Rules

This is exactly what you'd think it is:


And that's it!

Modified Paths

Diff

Modified: SVN-Notify/trunk/lib/SVN/Notify/HTML.pm (3460 => 3461)


--- SVN-Notify/trunk/lib/SVN/Notify/HTML.pm	2008-02-24 00:00:08 UTC (rev 3460)
+++ SVN-Notify/trunk/lib/SVN/Notify/HTML.pm	2008-02-24 00:31:10 UTC (rev 3461)
@@ -603,14 +603,12 @@
             qq(font-size: 10pt; font-weight: bold; }\n),
         q(#msg pre { overflow: auto; background: #ffc; ),
             qq(border: 1px #fc0 solid; padding: 6px; }\n),
-        qq(#logmsg { background: #ffc; border: 1px #fc0 solid; padding: 0 6px; }\n),
-        qq(#logmsg ul, #logmsg ol { padding: 0 0 0 1em; margin: 0; list-style-position: outside; }\n),
-        qq(#logmsg ul { margin: 1em 0 0 0; }\n),
-        qq(#logmsg ol { margin: 1em; }\n),
-        qq(#logmsg li p { margin: .5em 0 0 0; }\n),
+        qq(#logmsg { background: #ffc; border: 1px #fc0 solid; padding: 6px 6px 0 6px; }\n),
+        qq(#logmsg p, #logmsg ul, #logmsg ol, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }\n),
+        qq(#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside;}\n),
         qq(#logmsg code, #logmsg tt { background: #ccc; padding: 3px; }\n),
-        qq(#logmsg pre, #logmsg code { background: #ddd; }\n),
-        qq(#logmsg blockquote { margin: 0; border: 1px solid #fc0; border-left-width: 10px; padding: 0 1em; background: white;}\n),
+        qq(#logmsg pre { background: #ddd; padding: 1em; }\n),
+        qq(#logmsg blockquote { border: 1px solid #fc0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}\n),
         q(#header, #footer { color: #fff; background: #636; ),
         qq(border: 1px #300 solid; padding: 6px; }\n),
         qq(#patch { width: 100%; }\n),