Skip to content
This repository has been archived by the owner on Jun 9, 2018. It is now read-only.

Commit

Permalink
remove final \n
Browse files Browse the repository at this point in the history
now strict compliant with official test suite
update all tests
  • Loading branch information
fperrad committed Mar 29, 2009
1 parent 09c0afc commit 03e121d
Show file tree
Hide file tree
Showing 19 changed files with 20 additions and 68 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Expand Up @@ -17,5 +17,7 @@ src/gen_*.pir

t/*.text
t/*.html
t/*.parse
t/*.past
t/*.zip
t/MarkdownTest_1.0
31 changes: 17 additions & 14 deletions src/Compiler.pir
Expand Up @@ -106,12 +106,14 @@ Return generated HTML for all of its children.

.sub 'html_children' :method
.param pmc node
.param string fsep :optional
.param int has_fsep :opt_flag
.param string ssep :optional
.param int has_ssep :opt_flag
.param string esep :optional
.param int has_esep :opt_flag
.param string lsep :optional
.param int has_lsep :opt_flag
.local int first
first = 1
.local pmc code, iter
code = new 'CodeString'
iter = node.'iterator'()
Expand All @@ -122,20 +124,21 @@ Return generated HTML for all of its children.
$P0 = self.'html'(cpast)
$I0 = elements $P0
unless $I0 goto iter_loop
unless has_ssep goto L1
code .= ssep
unless first goto L1
first = 0
unless has_fsep goto L2
code .= fsep
goto L2
L1:
unless has_ssep goto L2
code .= ssep
L2:
code .= $P0
unless iter goto iter_end
unless has_esep goto L2
unless has_esep goto L3
code .= esep
L2:
L3:
goto iter_loop
iter_end:
unless $I0 goto L3
unless has_lsep goto L3
code .= lsep
L3:
.return (code)
.end

Expand All @@ -156,7 +159,7 @@ Return generated HTML for all of its children.

.sub 'html' :method :multi(_, ['Markdown'; 'Document'])
.param pmc node
.tailcall self.'html_children'(node, '', "\n\n", "\n\n")
.tailcall self.'html_children'(node, '', "\n", "\n")
.end


Expand Down Expand Up @@ -236,7 +239,7 @@ Return generated HTML for all of its children.
.param pmc node
$S0 = "<blockquote>\n"
$S0 .= " "
$S1 = self.'html_children'(node, '', "\n\n", "\n")
$S1 = self.'html_children'(node, '', "\n", "\n")
$S0 .= $S1
$S0 .= "</blockquote>"
.local pmc code
Expand Down Expand Up @@ -289,7 +292,7 @@ Return generated HTML for all of its children.
$S1 = self.'html_children'(node)
goto L2
L1:
$S1 = self.'html_children'(node, "<p>", "</p>\n\n", "</p>")
$S1 = self.'html_children'(node, "<p>", "\n\n<p>", "</p>")
L2:
$S0 .= $S1
$S0 .= "</li>\n"
Expand Down
1 change: 0 additions & 1 deletion t/00-sanity.t
Expand Up @@ -32,7 +32,6 @@ CODE
<h1>Title</h1>

<p>some text.</p>

OUT

# Local Variables:
Expand Down
4 changes: 0 additions & 4 deletions t/10-heading.t
Expand Up @@ -25,7 +25,6 @@ First-level heading
CODE
<h1>First-level heading</h1>

OUT

language_output_is( 'markdown', <<'CODE', <<'OUT', 'SetextHeading2' );
Expand All @@ -35,7 +34,6 @@ Second-level heading
CODE
<h2>Second-level heading</h2>

OUT

language_output_is( 'markdown', <<'CODE', <<'OUT', 'AtxHeading 1' );
Expand All @@ -44,7 +42,6 @@ language_output_is( 'markdown', <<'CODE', <<'OUT', 'AtxHeading 1' );
CODE
<h1>First-level heading</h1>

OUT

language_output_is( 'markdown', <<'CODE', <<'OUT', 'AtxHeading 4' );
Expand All @@ -53,7 +50,6 @@ language_output_is( 'markdown', <<'CODE', <<'OUT', 'AtxHeading 4' );
CODE
<h4>Fourth-level heading</h4>

OUT

# Local Variables:
Expand Down
3 changes: 0 additions & 3 deletions t/11-hrule.t
Expand Up @@ -24,7 +24,6 @@ language_output_is( 'markdown', <<'CODE', <<'OUT', 'rule *' );
CODE
<hr />

OUT

language_output_is( 'markdown', <<'CODE', <<'OUT', 'rule -' );
Expand All @@ -33,7 +32,6 @@ language_output_is( 'markdown', <<'CODE', <<'OUT', 'rule -' );
CODE
<hr />

OUT

language_output_is( 'markdown', <<'CODE', <<'OUT', 'rule _' );
Expand All @@ -42,7 +40,6 @@ language_output_is( 'markdown', <<'CODE', <<'OUT', 'rule _' );
CODE
<hr />

OUT

# Local Variables:
Expand Down
4 changes: 0 additions & 4 deletions t/12-blockquote.t
Expand Up @@ -26,7 +26,6 @@ CODE
<blockquote>
<p>This text will be enclosed in an HTML blockquote element.</p>
</blockquote>

OUT

language_output_is( 'markdown', <<'CODE', <<'OUT', 'BlockQuote 2' );
Expand All @@ -39,7 +38,6 @@ CODE
<p>Use the > character in front of a line, <em>just like in email</em>.
Use it if you're quoting a person, a song or whatever.</p>
</blockquote>
OUT
language_output_is( 'markdown', <<'CODE', <<'OUT', 'BlockQuote 3' );
Expand All @@ -60,7 +58,6 @@ part of the blockquote, even without the > character in front.</p>
</blockquote>
<p>To end the blockquote, just put a blank line before the following paragraph.</p>
OUT
language_output_is( 'markdown', <<'CODE', <<'OUT', 'BlockQuote 4' );
Expand All @@ -75,7 +72,6 @@ CODE

<p>Use it if you're quoting a person, a song or whatever.</p>
</blockquote>
OUT
# Local Variables:
Expand Down
2 changes: 0 additions & 2 deletions t/13-para.t
Expand Up @@ -28,7 +28,6 @@ CODE
<p>This is a paragraph. It has two sentences.</p>

<p>This is another paragraph. It also has two sentences.</p>

OUT

language_output_is( 'markdown', <<'CODE', <<'OUT', 'Para multi-line' );
Expand All @@ -39,7 +38,6 @@ It has two sentences.
CODE
<p>This is a paragraph.
It has two sentences.</p>

OUT


Expand Down
5 changes: 0 additions & 5 deletions t/14-list.t
Expand Up @@ -28,7 +28,6 @@ CODE
<li>An item in a bulleted (unordered) list</li>
<li>Another item in a bulleted list</li>
</ul>

OUT

language_output_is( 'markdown', <<'CODE', <<'OUT', 'ordered tight' );
Expand All @@ -41,7 +40,6 @@ CODE
<li>An item in a enumeradted (ordered) list</li>
<li>Another item in a enumeradted list</li>
</ol>

OUT

language_output_is( 'markdown', <<'CODE', <<'OUT', 'unordered loose' );
Expand All @@ -55,7 +53,6 @@ CODE
<li><p>Bird</p></li>
<li><p>Magic</p></li>
</ul>

OUT

language_output_is( 'markdown', <<'CODE', <<'OUT', 'with continuation' );
Expand All @@ -70,7 +67,6 @@ CODE
With continuation.</li>
<li>Another item in the list.</li>
</ul>

OUT

language_output_is( 'markdown', <<'CODE', <<'OUT', 'with multi-para' );
Expand All @@ -88,7 +84,6 @@ CODE
<p>Para 2.</p></li>
<li><p>Another item in the list.</p></li>
</ul>

OUT


Expand Down
3 changes: 0 additions & 3 deletions t/15-codeblock.t
Expand Up @@ -29,7 +29,6 @@ CODE

<pre><code>This is a code block.
</code></pre>

OUT

language_output_is( 'markdown', <<'CODE', <<'OUT', 'CodeBlock 2' );
Expand All @@ -47,7 +46,6 @@ CODE
bell
end tell
</code></pre>

OUT

language_output_is( 'markdown', <<'CODE', <<'OUT', 'CodeBlock HTML' );
Expand All @@ -65,7 +63,6 @@ CODE
&amp;copy; 2004 Foo Corporation
&lt;/div&gt;
</code></pre>

OUT

# Local Variables:
Expand Down
4 changes: 0 additions & 4 deletions t/20-emphasis.t
Expand Up @@ -24,7 +24,6 @@ language_output_is( 'markdown', <<'CODE', <<'OUT', 'emphasis star' );
CODE
<p><em>emphasis</em> (e.g., italics)</p>

OUT

language_output_is( 'markdown', <<'CODE', <<'OUT', 'strong star' );
Expand All @@ -33,7 +32,6 @@ language_output_is( 'markdown', <<'CODE', <<'OUT', 'strong star' );
CODE
<p><strong>strong emphasis</strong> (e.g., boldface)</p>

OUT

language_output_is( 'markdown', <<'CODE', <<'OUT', 'emphasis UI' );
Expand All @@ -42,7 +40,6 @@ _emphasis_ (e.g., italics)
CODE
<p><em>emphasis</em> (e.g., italics)</p>

OUT

language_output_is( 'markdown', <<'CODE', <<'OUT', 'strong UI' );
Expand All @@ -51,7 +48,6 @@ __strong emphasis__ (e.g., boldface)
CODE
<p><strong>strong emphasis</strong> (e.g., boldface)</p>

OUT


Expand Down
6 changes: 0 additions & 6 deletions t/21-code.t
Expand Up @@ -24,7 +24,6 @@ language_output_is( 'markdown', <<'CODE', <<'OUT', 'code' );
CODE
<p><code>code</code></p>

OUT

language_output_is( 'markdown', <<'CODE', <<'OUT', 'printf' );
Expand All @@ -33,7 +32,6 @@ Use the `printf()` function.
CODE
<p>Use the <code>printf()</code> function.</p>

OUT

language_output_is( 'markdown', <<'CODE', <<'OUT', 'literal backtick' );
Expand All @@ -42,7 +40,6 @@ language_output_is( 'markdown', <<'CODE', <<'OUT', 'literal backtick' );
CODE
<p><code>There is a literal backtick (`) here.</code></p>
OUT
language_output_is( 'markdown', <<'CODE', <<'OUT', 'with space' );
Expand All @@ -55,7 +52,6 @@ CODE
<p>A single backtick in a code span: <code>`</code></p>
<p>A backtick-delimited string in a code span: <code>`foo`</code></p>
OUT
language_output_is( 'markdown', <<'CODE', <<'OUT', 'HTML tag' );
Expand All @@ -64,7 +60,6 @@ Please don't use any `<blink>` tags.
CODE
<p>Please don't use any <code>&lt;blink&gt;</code> tags.</p>
OUT
language_output_is( 'markdown', <<'CODE', <<'OUT', 'HTML entity' );
Expand All @@ -73,7 +68,6 @@ language_output_is( 'markdown', <<'CODE', <<'OUT', 'HTML entity' );

CODE
<p><code>&amp;#8212;</code> is the decimal-encoded equivalent of <code>&amp;mdash;</code>.</p>

OUT

# Local Variables:
Expand Down
3 changes: 0 additions & 3 deletions t/22-escape.t
Expand Up @@ -24,7 +24,6 @@ language_output_is( 'markdown', <<'CODE', <<'OUT', 'asterisk' );
CODE
<p>*literal astericks*</p>

OUT

language_output_is( 'markdown', <<'CODE', <<'OUT', 'dot' );
Expand All @@ -33,7 +32,6 @@ language_output_is( 'markdown', <<'CODE', <<'OUT', 'dot' );
CODE
<p>1986. What a great season.</p>

OUT

language_output_is( 'markdown', <<'CODE', <<'OUT', 'symbol (not escaped)' );
Expand All @@ -42,7 +40,6 @@ Hello, World!
CODE
<p>Hello, World!</p>

OUT

# Local Variables:
Expand Down
3 changes: 0 additions & 3 deletions t/23-entity.t
Expand Up @@ -24,7 +24,6 @@ language_output_is( 'markdown', <<'CODE', <<'OUT', 'CharEntity' );
CODE
<p>4 &lt; 5</p>

OUT

language_output_is( 'markdown', <<'CODE', <<'OUT', 'HexEntity' );
Expand All @@ -33,11 +32,9 @@ language_output_is( 'markdown', <<'CODE', <<'OUT', 'HexEntity' );
CODE
<p>20 &#x20ac;.</p>

OUT



# Local Variables:
# mode: cperl
# cperl-indent-level: 4
Expand Down

0 comments on commit 03e121d

Please sign in to comment.