Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Implement escaped characters

  • Loading branch information...
commit eaaeed4e103d9cad62afc51be5143cd7c8991f8a 1 parent fa94e92
Eric Hodel drbrain authored

Showing 2 changed files with 11 additions and 4 deletions. Show diff stats Hide diff stats

  1. +3 4 pegdown.kpeg
  2. +8 0 test/test_pegdown.rb
7 pegdown.kpeg
@@ -528,13 +528,12 @@ Space = Spacechar+
528 528 " " }
529 529
530 530 Str = StartList:a
531   - < NormalChar+ > { a = text } # raise " a = cons(mk_str(yytext), a); " }
532   - ( StrChunk:c { a << c } )* { a } # { raise " if (a->next == NULL) { $$ = a; } else { $$ = mk_list(LIST, a); } " }
  531 + < NormalChar+ > { a = text }
  532 + ( StrChunk:c { a << c } )* { a }
533 533
534 534 StrChunk = < (NormalChar | "_"+ &Alphanumeric)+ > { text }
535 535
536   -EscapedChar = "\\" !Newline < /[\`|*_{}\[\]()#+.!><-]/ >
537   - { raise " $$ = mk_str(yytext); " }
  536 +EscapedChar = "\\" !Newline < /[\`|*_{}\[\]()#+.!><-]/ > { text }
538 537
539 538 Entity = ( HexEntity | DecEntity | CharEntity )
540 539 { raise " $$ = mk_str(yytext); $$->key = HTML; " }
8 test/test_pegdown.rb
@@ -74,6 +74,14 @@ def test_parse_block_quote_separate
74 74 assert_equal expected, doc
75 75 end
76 76
  77 + def test_parse_escape
  78 + doc = parse "Backtick: \\`"
  79 +
  80 + expected = doc(para("Backtick: `"))
  81 +
  82 + assert_equal expected, doc
  83 + end
  84 +
77 85 def test_parse_heading_atx
78 86 doc = parse "# heading\n"
79 87

0 comments on commit eaaeed4

Please sign in to comment.
Something went wrong with that request. Please try again.