Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Implement escaped characters

  • Loading branch information...
commit eaaeed4e103d9cad62afc51be5143cd7c8991f8a 1 parent fa94e92
@drbrain drbrain authored
Showing with 11 additions and 4 deletions.
  1. +3 −4 pegdown.kpeg
  2. +8 −0 test/test_pegdown.rb
View
7 pegdown.kpeg
@@ -528,13 +528,12 @@ Space = Spacechar+
" " }
Str = StartList:a
- < NormalChar+ > { a = text } # raise " a = cons(mk_str(yytext), a); " }
- ( StrChunk:c { a << c } )* { a } # { raise " if (a->next == NULL) { $$ = a; } else { $$ = mk_list(LIST, a); } " }
+ < NormalChar+ > { a = text }
+ ( StrChunk:c { a << c } )* { a }
StrChunk = < (NormalChar | "_"+ &Alphanumeric)+ > { text }
-EscapedChar = "\\" !Newline < /[\`|*_{}\[\]()#+.!><-]/ >
- { raise " $$ = mk_str(yytext); " }
+EscapedChar = "\\" !Newline < /[\`|*_{}\[\]()#+.!><-]/ > { text }
Entity = ( HexEntity | DecEntity | CharEntity )
{ raise " $$ = mk_str(yytext); $$->key = HTML; " }
View
8 test/test_pegdown.rb
@@ -74,6 +74,14 @@ def test_parse_block_quote_separate
assert_equal expected, doc
end
+ def test_parse_escape
+ doc = parse "Backtick: \\`"
+
+ expected = doc(para("Backtick: `"))
+
+ assert_equal expected, doc
+ end
+
def test_parse_heading_atx
doc = parse "# heading\n"
Please sign in to comment.
Something went wrong with that request. Please try again.