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

Commit

Permalink
add a new node : Newline
Browse files Browse the repository at this point in the history
  • Loading branch information
fperrad committed Mar 28, 2009
1 parent e3255e8 commit 7568ab1
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 4 deletions.
12 changes: 12 additions & 0 deletions src/Compiler.pir
Expand Up @@ -498,6 +498,18 @@ Return generated HTML for all of its children.
.return (code)
.end

=item html(Markdown::Newline node)

=cut

.sub 'html' :method :multi(_, ['Markdown'; 'Newline'])
.param pmc node
.local pmc code
new code, 'CodeString'
set code, "\n"
.return (code)
.end

=back

=cut
Expand Down
1 change: 1 addition & 0 deletions src/Node.pir
Expand Up @@ -29,6 +29,7 @@ for Markdown.
p6meta.'new_class'('Markdown::Line', 'parent'=>base)
p6meta.'new_class'('Markdown::Link', 'parent'=>base)
p6meta.'new_class'('Markdown::ListItem', 'parent'=>base)
p6meta.'new_class'('Markdown::Newline', 'parent'=>base)
p6meta.'new_class'('Markdown::OrderedList', 'parent'=>base)
p6meta.'new_class'('Markdown::Para', 'parent'=>base)
p6meta.'new_class'('Markdown::RefLink', 'parent'=>base)
Expand Down
8 changes: 4 additions & 4 deletions src/parser/actions.pm
Expand Up @@ -96,7 +96,7 @@ method BlockQuoteChunk($/) {
my $first := 1;
for $<BlockQuoteLine> {
unless ( $first ) {
$mast.push( Markdown::Word.new( :text( "\n" ) ) );
$mast.push( Markdown::Newline.new() );
}
$mast.push( $( $_ ) );
$first := 0;
Expand All @@ -108,7 +108,7 @@ method BlockQuoteLine($/) {
my $mast := Markdown::Node.new();
$mast.push( $( $<BlockQuoteFirstLine> ) );
for $<BlockQuoteNextLine> {
$mast.push( Markdown::Word.new( :text( "\n" ) ) );
$mast.push( Markdown::Newline.new() );
$mast.push( $( $_ ) );
}
make $mast;
Expand All @@ -135,7 +135,7 @@ method Line($/) {
}

method BlankLine($/) {
make Markdown::Line.new( :text( $/.text() ) );
make Markdown::Newline.new( :text( $/.text() ) );
}

method NonblankIndentedLine($/) {
Expand Down Expand Up @@ -213,7 +213,7 @@ method ListBlock($/) {
method ListContinuationBlock($/) {
my $mast := Markdown::Node.new();
for $<ListBlock> {
$mast.push( Markdown::Word.new( :text( "\n" ) ) );
$mast.push( Markdown::Newline.new() );
$mast.push( $( $_ ) );
}
make $mast;
Expand Down

0 comments on commit 7568ab1

Please sign in to comment.