Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Implement HTML block parsing

  • Loading branch information...
commit 1675ae1812091400de121bb1d148e7fa07534bbc 1 parent de8456c
@drbrain drbrain authored
View
7 lib/rdoc/markup/to_joined_paragraph.rb
@@ -18,11 +18,12 @@ def accept_paragraph paragraph
alias accept_block_quote ignore
alias accept_heading ignore
- alias accept_rule ignore
- alias accept_list_start ignore
alias accept_list_end ignore
- alias accept_list_item_start ignore
alias accept_list_item_end ignore
+ alias accept_list_item_start ignore
+ alias accept_list_start ignore
+ alias accept_raw ignore
+ alias accept_rule ignore
alias accept_verbatim ignore
end
View
10 pegdown.kpeg
@@ -410,13 +410,9 @@ HtmlBlockInTags = HtmlBlockAddress
HtmlBlock = < ( HtmlBlockInTags | HtmlComment | HtmlBlockSelfClosing ) >
BlankLine+
- { raise 'if (extension(EXT_FILTER_HTML)) {
- $$ = mk_list(LIST, NULL);
- } else {
- $$ = mk_str(yytext);
- $$->key = HTMLBLOCK;
- }'
- }
+ { if html? then
+ RDoc::Markup::Raw.new text
+ end }
HtmlBlockSelfClosing = "<" Spnl HtmlBlockType Spnl HtmlAttribute* "/" Spnl ">"
View
19 test/test_pegdown.rb
@@ -181,6 +181,25 @@ def test_parse_heading_setext_equals
assert_equal expected, doc
end
+ def test_parse_html
+ @parser.html = true
+
+ doc = parse "<address>Links here</address>\n"
+
+ expected = doc(
+ @RM::Raw.new("<address>Links here</address>"))
+
+ assert_equal expected, doc
+ end
+
+ def test_parse_html_no_html
+ doc = parse "<address>Links here</address>\n"
+
+ expected = doc()
+
+ assert_equal expected, doc
+ end
+
def test_parse_image
doc = parse "image ![alt text](path/to/image.jpg)"
Please sign in to comment.
Something went wrong with that request. Please try again.