Permalink
Browse files

0.11

  • Loading branch information...
1 parent 1d620cc commit 9ba1407979bf4b0bb4511ae43bfef0384cb21131 @ingydotnet committed Jun 24, 2008
Showing with 80 additions and 8 deletions.
  1. +12 −0 Changes
  2. +2 −2 lib/WikiText/Socialtext.pm
  3. +22 −5 lib/WikiText/Socialtext/Parser.pm
  4. +44 −1 t/parser.t
View
@@ -1,4 +1,16 @@
---
+version: 0.11
+date: Mon Jun 23 19:05:16 PDT 2008
+changes:
+- Lines that don't match anything else are parsed as a plain text paragraph.
+---
+version: 0.10
+date: Wed Jun 11 14:38:45 PDT 2008
+changes:
+- support '^Foo'
+- support '- foo'
+- support '+ foo'
+---
version: 0.09
date: Thu Feb 14 23:12:43 PST 2008
changes: 0.08 Upload got hosed
@@ -2,7 +2,7 @@ package WikiText::Socialtext;
use base 'WikiText';
use 5.006.001;
-our $VERSION = '0.09';
+our $VERSION = '0.11';
1;
@@ -18,7 +18,7 @@ WikiText::Socialtext - Socialtext WikiText Module
=head1 DESCRIPTION
-This module can convert Socialtext markup to HTML.`
+This module can convert Socialtext markup to HTML.
=head1 AUTHOR
@@ -28,7 +28,15 @@ sub create_grammar {
qw(waflphrase asis wikilink a im mail tt b i del)
];
my $all_blocks = [
- qw(pre wafl_block hr hx waflparagraph ul ol blockquote table p empty)
+ qw(
+ pre wafl_block
+ hr hx
+ waflparagraph
+ ul ol
+ blockquote table
+ p empty
+ else
+ )
];
return {
@@ -71,6 +79,15 @@ sub create_grammar {
filter => sub { chomp },
},
+ else => {
+ match => qr/^(.*)\n/,
+ phrases => [],
+ filter => sub {
+ my $node = shift;
+ $node->{type} = 'p';
+ },
+ },
+
pre => {
match => qr/^(?m:^\.pre\ *\n)((?:.*\n)*?)(?m:^\.pre\ *\n)(?:\s*\n)?/,
},
@@ -98,7 +115,7 @@ sub create_grammar {
},
hx => {
- match => qr/^(\^+) +(.*?)(\s+=+)?\s*?\n+/,
+ match => qr/^(\^+) *(.*?)(\s+=+)?\s*?\n+/,
filter => sub {
my $node = shift;
$node->{type} = 'h' . length($node->{1});
@@ -107,9 +124,9 @@ sub create_grammar {
},
ul => {
- match => re_list('\*'),
+ match => re_list('[\*\-\+]'),
blocks => [qw(ul ol subl li)],
- filter => sub { s/^[\*\#] *//mg },
+ filter => sub { s/^[\*\-\+\#] *//mg },
},
ol => {
@@ -301,7 +318,7 @@ sub re_list {
return qr/^( # Block must start at beginning
# Capture everything in $1
^$bullet+\ .*\n # Line starting with one or more bullet
- (?:[\*\#]+\ .*\n)* # Lines starting with '*' or '#'
+ (?:[\*\-\+\#]+\ .*\n)* # Lines starting with '*' or '#'
)(?:\s*\n)?/x, # Eat trailing lines
}
View
@@ -1,7 +1,7 @@
use lib '../WikiText/lib';
use t::TestWikiText;
-plan tests => 19;
+plan tests => 22;
#no_diff;
@@ -13,6 +13,35 @@ filters({wikitext => 'parse_wikitext'});
run_is 'wikitext' => 'wikibyte';
__DATA__
+=== Old lists
+
+--- wikitext
+- one
+- two
+--- wikibyte
++ul
++li
+ one
+-li
++li
+ two
+-li
+-ul
+
+=== Headers Without Spaces
+
+--- wikitext
+^^Welcome to the Workspace
+
+blah blah
+--- wikibyte
++h2
+ Welcome to the Workspace
+-h2
++p
+ blah blah
+-p
+
=== Multiline Paragraphs
--- wikitext
@@ -387,3 +416,17 @@ This is both *_Bold and Italic_*
-i
-b
-p
+
+=== Bad Markup
+--- wikitext
+| *foo* | bar
+
+baz
+--- wikibyte
++p
+ | *foo* | bar
+-p
++p
+ baz
+-p
+

0 comments on commit 9ba1407

Please sign in to comment.