Subject: | [patch] add SocialText wiki format |
In a spirit of (unresolved at this time) patch for Trac, I'm submitting
patch for SocialText wiki support.
Do I also need to write tests for inclusion of this patch?
Subject: | Pod-Simple-Wiki-0.05+socialtext.diff |
diff -urw Pod-Simple-Wiki-0.05/lib/Pod/Simple/Wiki.pm Pod-Simple-Wiki-0.05+socialtext/lib/Pod/Simple/Wiki.pm
--- Pod-Simple-Wiki-0.05/lib/Pod/Simple/Wiki.pm 2005-03-31 00:24:58.000000000 +0200
+++ Pod-Simple-Wiki-0.05+socialtext/lib/Pod/Simple/Wiki.pm 2006-11-27 17:21:19.000000000 +0100
@@ -147,6 +147,26 @@
'<h4>' => "=====",
'</h4>' => "=====\n",
},
+ 'socialtext' => {
+ '<b>' => '*',
+ '</b>' => '*',
+ '<i>' => '_',
+ '</i>' => '_',
+ '<tt>' => '`',
+ '</tt>' => '`',
+ '<pre>' => "\n.pre\n",
+ '</pre>' => "\n.pre\n",
+
+ '<h1>' => "^ ",
+ '</h1>' => "\n",
+ '<h2>' => "^^ ",
+ '</h2>' => "\n",
+ '<h3>' => "^^^ ",
+ '</h3>' => "\n",
+ '<h4>' => "^^^^ ",
+ '</h4>' => "\n",
+ },
+
);
@@ -283,6 +303,18 @@
$self->_append(";" x $indent_level . ' ');
}
}
+ elsif ($self->{_format} eq 'socialtext') {
+
+ if ($item_type eq 'bullet') {
+ $self->_append('*' x $indent_level . ' ');
+ }
+ elsif ($item_type eq 'number') {
+ $self->_append('#' x $indent_level . ' ');
+ }
+ elsif ($item_type eq 'text') {
+ $self->_append(">" x $indent_level . ' ');
+ }
+ }
}
@@ -497,7 +529,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("\n") if $_[0]->{_format} eq 'socialtext';}
sub _start_over_block {$_[0]->{_item_indent}++}
sub _end_over_block {$_[0]->{_item_indent}--}