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

Commit

Permalink
fix a TODO test
Browse files Browse the repository at this point in the history
but Smart is an extension, not strict Markdown
  • Loading branch information
fperrad committed Mar 23, 2009
1 parent 1fbf6a8 commit 13ac70e
Show file tree
Hide file tree
Showing 3 changed files with 78 additions and 2 deletions.
32 changes: 32 additions & 0 deletions src/parser/actions.pm
Expand Up @@ -299,6 +299,38 @@ method Space($/) {
make Markdown::Space.new( :text( $/.text() ) );
}

method Smart($/, $key) {
make $( $/{$key} );
}

method Apostrophe($/) {
# make Markdown::Entity.new( :text( '’' ) );
make Markdown::Entity.new( :text( $/.text() ) );
}

method Ellipsis($/) {
# make Markdown::Entity.new( :text( '…' ) );
make Markdown::Entity.new( :text( $/.text() ) );
}

method Dash($/, $key) {
make $( $/{$key} );
}

method EnDash($/) {
# make Markdown::Entity.new( :text( '–' ) );
make Markdown::Entity.new( :text( $/.text() ) );
}

method EmDash($/) {
# make Markdown::Entity.new( :text( '—' ) );
make Markdown::Entity.new( :text( $/.text() ) );
}

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

# Local Variables:
# mode: cperl
# cperl-indent-level: 4
Expand Down
46 changes: 45 additions & 1 deletion src/parser/grammar.pg
Expand Up @@ -204,6 +204,7 @@ token Inline {
| <Code> {*} #= Code
| <Entity> {*} #= Entity
| <EscapedChar> {*} #= EscapedChar
| <Smart> {*} #= Smart
| <Symbol> {*} #= Symbol
}

Expand Down Expand Up @@ -494,12 +495,14 @@ token Sp { <Spacechar>* }

token Spnl { <.Sp> [<.Newline> <.Sp>]? }

token SpecialChar { '*' | '_' | '`' | '&' | '[' | ']' | '<' | '!' | '\\' }
token SpecialChar { '*' | '_' | '`' | '&' | '[' | ']' | '<' | '!' | '\\' | '.' | '-' | '\'' | '"' | '^' }

token NormalChar { <!SpecialChar> <!Spacechar> <!Newline> . }

token Alphanumeric { \w }

token Digit { \d }

token HexEntity { '&#' <[Xx]> <[0..9a..fA..F]>+ ';' }

token DecEntity { '&#' <[0..9]>+ ';'}
Expand All @@ -523,3 +526,44 @@ token RawLine {
]
{*}
}

token Smart {
| <Ellipsis> {*} #= Ellipsis
| <Dash> {*} #= Dash
| <DoubleQuoted> {*} #= DoubleQuoted
| <Apostrophe> {*} #= Apostrophe
}

token Apostrophe {
'\''
{*}
}

token Ellipsis {
'...' | '. . .'
{*}
}

token Dash {
| <EmDash> {*} #= EmDash
| <EnDash> {*} #= EnDash
}

token EnDash {
'-' <!Digit>
{*}
}

token EmDash {
'---' | '--'
{*}
}

token DoubleQuoteStart { '"' }

token DoubleQuoteEnd { '"' }

token DoubleQuoted {
<.DoubleQuoteStart> [ <!DoubleQuoteEnd> <.Inline> ]+ <.DoubleQuoteEnd>
{*}
}
2 changes: 1 addition & 1 deletion t/32-reflink.t
Expand Up @@ -41,7 +41,7 @@ CODE

OUT

language_output_is( 'markdown', <<'CODE', <<'OUT', 'reference link simple', todo => 'bug with quoted ref' );
language_output_is( 'markdown', <<'CODE', <<'OUT', 'reference link simple' );
Or you can use a [shortcut][] reference, which links the text "shortcut"
to the link named "[shortcut]" on the next paragraph.
Expand Down

0 comments on commit 13ac70e

Please sign in to comment.