Skip to content

Commit

Permalink
fix raw tag parser to allow multi-line HTML
Browse files Browse the repository at this point in the history
  • Loading branch information
SampsonCrowley committed May 6, 2019
1 parent 2f4e079 commit 76df26b
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/inky.rb
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def transform_doc(elem)
def self.extract_raws(string)
raws = []
i = 0
regex = %r(< *raw *>(.*?)</ *raw *>)
regex = %r(< *raw *>(.*?)</ *raw *>)miu
str = string
while raw = str.match(regex)
raws[i] = raw[1]
Expand Down
9 changes: 9 additions & 0 deletions spec/cases/raw/raw_multiple_lines_and_tags.inky
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<div>
<raw>
<<LCG ProgramTG LCG Coupon Code Default='246996'>>
</raw>
<button href="#">Test</button>
<raw>
<asdf>more raw content</asdf>
</raw>
</div>
7 changes: 7 additions & 0 deletions spec/cases/raw/raw_multiple_lines_invalid_closing_tag.inky
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<div>
<raw>
<<LCG ProgramTG LCG Coupon Code Default='246996'>>
</raw>
<button href="#">Test</button>
</raw>
</div>
6 changes: 6 additions & 0 deletions spec/cases/raw/raw_multiple_lines_single_tag.inky
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<div>
<raw>
<<LCG ProgramTG LCG Coupon Code Default='246996'>>\
<button href="#">Test</button>
</raw>
</div>
1 change: 1 addition & 0 deletions spec/cases/raw/raw_single_line_multiple_tags.inky
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<div><raw><<LCG ProgramTG LCG Coupon Code Default='246996'>></raw><button href="#">Test</button><raw><asdf>more raw content</asdf></raw></div>
1 change: 1 addition & 0 deletions spec/cases/raw/raw_single_line_single_tag.inky
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<raw><<LCG ProgramTG LCG Coupon Code Default='246996'>></raw>

0 comments on commit 76df26b

Please sign in to comment.