parser.leg: scan for setext pattern before parsing Inlines (from jgm/peg-markdown)

This commit is contained in:
Michael Teichgräber 2010-12-01 22:48:40 +01:00
parent a6edc52d48
commit e40db066f3
2 changed files with 10 additions and 21 deletions

View File

@ -67,23 +67,6 @@ See the [original README][] for details.
[original README]: https://github.com/jgm/peg-markdown/blob/master/README.markdown
[knieriem/peg]: https://github.com/knieriem/peg
## Known issues
Emphasis and strong markup within items of lists, as in input
like ./PHP Markdown Extra.mdtest/Emphasis.text from Michel
Fortin's [MDTest][] package,
1. ***test test***
2. ___test test___
3. *test **test***
4. **test *test***
...
seem to present a problem for the LEG parser, which needs
(on my system) around four minutes to process that file.
[MDTest]: http://git.michelf.com/mdtest/
## Todo
* Implement definition lists (work in progress), and perhaps tables

View File

@ -137,11 +137,17 @@ AtxHeading = s:AtxStart Sp a:StartList ( AtxInline { a = cons($$, a) } )+ (Sp '#
SetextHeading = SetextHeading1 | SetextHeading2
SetextHeading1 = a:StartList ( !Endline Inline { a = cons($$, a) } )+ Newline "===" '='* Newline
{ $$ = mk_list(H1, a) }
SetextBottom1 = "===" '='* Newline
SetextHeading2 = a:StartList ( !Endline Inline { a = cons($$, a) } )+ Newline "---" '-'* Newline
{ $$ = mk_list(H2, a) }
SetextBottom2 = "---" '-'* Newline
SetextHeading1 = &(RawLine SetextBottom1)
a:StartList ( !Endline Inline { a = cons($$, a) } )+ Newline
SetextBottom1 { $$ = mk_list(H1, a) }
SetextHeading2 = &(RawLine SetextBottom2)
a:StartList ( !Endline Inline { a = cons($$, a) } )+ Newline
SetextBottom2 { $$ = mk_list(H2, a) }
Heading = AtxHeading | SetextHeading