Subject: | [PATCH] add Trac support to Pod::Simple::Wiki |
Here's a patch to Pod::Simple::Wiki (0.05) that adds support for the
wiki that's a part of Edgewall's Trac. According to Trac's docs, the
format is derived from MoinMoin.
Subject: | pod-simple-wiki_add-trac.diff |
diff -ru Pod-Simple-Wiki-0.05.old/lib/Pod/Simple/Wiki.pm Pod-Simple-Wiki-0.05/lib/Pod/Simple/Wiki.pm
--- Pod-Simple-Wiki-0.05.old/lib/Pod/Simple/Wiki.pm 2005-03-30 17:24:58.000000000 -0500
+++ Pod-Simple-Wiki-0.05/lib/Pod/Simple/Wiki.pm 2006-04-23 21:38:12.000000000 -0400
@@ -147,6 +147,25 @@
'<h4>' => "=====",
'</h4>' => "=====\n",
},
+ 'trac' => {
+ '<b>' => "'''",
+ '</b>' => "'''",
+ '<i>' => "''",
+ '</i>' => "''",
+ '<tt>' => '`',
+ '</tt>' => '`',
+ '<pre>' => "\n{{{\n",
+ '</pre>' => "\n}}}\n",
+
+ '<h1>' => "= ",
+ '</h1>' => " =\n",
+ '<h2>' => "== ",
+ '</h2>' => " ==\n",
+ '<h3>' => "=== ",
+ '</h3>' => " ===\n",
+ '<h4>' => "==== ",
+ '</h4>' => " ====\n",
+ },
);
@@ -283,6 +302,18 @@
$self->_append(";" x $indent_level . ' ');
}
}
+ elsif ($self->{_format} eq 'trac') {
+
+ if ($item_type eq 'bullet') {
+ $self->_append(' *' x $indent_level . ' ');
+ }
+ elsif ($item_type eq 'number') {
+ $self->_append(' 1.' x $indent_level . ' ');
+ }
+ elsif ($item_type eq 'text') {
+ $self->_append(" " x $indent_level . ' ');
+ }
+ }
}
@@ -497,7 +528,8 @@
$_[0]->_output(" ; ") if $_[0]->{_format} eq 'kwiki';
$_[0]->_output(":" ) if $_[0]->{_format} eq 'usemod';
$_[0]->_output(": " ) if $_[0]->{_format} eq 'twiki';
- $_[0]->_output(" : ") if $_[0]->{_format} eq 'wikipedia';}
+ $_[0]->_output(" : ") if $_[0]->{_format} eq 'wikipedia';
+ $_[0]->_output(" : ") if $_[0]->{_format} eq 'trac';}
sub _start_over_block {$_[0]->{_item_indent}++}
sub _end_over_block {$_[0]->{_item_indent}--}