From e40db066f382406b899d67cfc36211bad84b4cbd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Teichgr=C3=A4ber?= Date: Wed, 1 Dec 2010 22:48:40 +0100 Subject: [PATCH] parser.leg: scan for setext pattern before parsing Inlines (from jgm/peg-markdown) --- README.markdown | 17 ----------------- parser.leg | 14 ++++++++++---- 2 files changed, 10 insertions(+), 21 deletions(-) diff --git a/README.markdown b/README.markdown index 9e1acc3..bedaa47 100644 --- a/README.markdown +++ b/README.markdown @@ -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 diff --git a/parser.leg b/parser.leg index 86bccb1..e2407f3 100644 --- a/parser.leg +++ b/parser.leg @@ -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