|
Revision 223, 1.0 kB
(checked in by ingy, 1 year ago)
|
r3795@dhcp199: ingy | 2007-04-08 10:10:59 +0900
Refactor Doc::Parser
|
- Property svn:executable set to
*
|
| Line | |
|---|
| 1 |
#!/usr/bin/perl |
|---|
| 2 |
use lib 'lib'; |
|---|
| 3 |
use Test::Base tests => 2; |
|---|
| 4 |
use Spork::Parser; |
|---|
| 5 |
use Spork::Emitter::HTML; |
|---|
| 6 |
|
|---|
| 7 |
run_is spork => 'html'; |
|---|
| 8 |
|
|---|
| 9 |
sub format { |
|---|
| 10 |
my $text = shift; |
|---|
| 11 |
my $ast = Spork::Parser->new->parse($text); |
|---|
| 12 |
return Spork::Emitter::HTML->new->emit($ast); |
|---|
| 13 |
} |
|---|
| 14 |
|
|---|
| 15 |
__DATA__ |
|---|
| 16 |
=== Format Spork Slide |
|---|
| 17 |
--- spork format |
|---|
| 18 |
== This is a test |
|---|
| 19 |
|
|---|
| 20 |
.center |
|---|
| 21 |
* foo |
|---|
| 22 |
** `123` |
|---|
| 23 |
* *hello* |
|---|
| 24 |
.center |
|---|
| 25 |
|
|---|
| 26 |
Cool *stuff* is /here/. |
|---|
| 27 |
|
|---|
| 28 |
xxx |
|---|
| 29 |
xxx |
|---|
| 30 |
> yyy |
|---|
| 31 |
> yyy |
|---|
| 32 |
xxx |
|---|
| 33 |
|
|---|
| 34 |
sub foo { |
|---|
| 35 |
... |
|---|
| 36 |
} |
|---|
| 37 |
--- html |
|---|
| 38 |
<h2>This is a test</h2> |
|---|
| 39 |
<div class="center-outer"><div class="center-inner"> |
|---|
| 40 |
<ul> |
|---|
| 41 |
<li>foo</li> |
|---|
| 42 |
<ul> |
|---|
| 43 |
<li><tt>123</tt></li> |
|---|
| 44 |
</ul> |
|---|
| 45 |
<li><b>hello</b></li> |
|---|
| 46 |
</ul> |
|---|
| 47 |
</div></div> |
|---|
| 48 |
<p>Cool <b>stuff</b> is <i>here</i>.</p> |
|---|
| 49 |
<p>xxx<br /> |
|---|
| 50 |
xxx</p> |
|---|
| 51 |
<blockquote> |
|---|
| 52 |
<p>yyy<br /> |
|---|
| 53 |
yyy</p> |
|---|
| 54 |
</blockquote> |
|---|
| 55 |
<p>xxx</p> |
|---|
| 56 |
<pre> |
|---|
| 57 |
sub foo { |
|---|
| 58 |
... |
|---|
| 59 |
} |
|---|
| 60 |
</pre> |
|---|
| 61 |
=== Format Another Spork Slide |
|---|
| 62 |
--- spork format |
|---|
| 63 |
This is *bold* |
|---|
| 64 |
|
|---|
| 65 |
This *bold* is |
|---|
| 66 |
|
|---|
| 67 |
*Bold* is this |
|---|
| 68 |
--- html |
|---|
| 69 |
<p>This is <b>bold</b></p> |
|---|
| 70 |
<p>This <b>bold</b> is</p> |
|---|
| 71 |
<p><b>Bold</b> is this</p> |
|---|
| 72 |
|
|---|