Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions lib/canvas/validators/html.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ def extracted_html
end

# We want to strip out the liquid tags and replace them with the
# same number of empty space characters, so that the linter
# reports the correct character number.
# same number of characters, so that the linter reports the
# correct character number.
def strip_out_liquid(html)
html.gsub(LIQUID_TAG_OR_VARIABLE) { |tag| " " * tag.size }
html.gsub(LIQUID_TAG_OR_VARIABLE) { |tag| "x" * tag.size }
end

# We want to strip out the front matter and replace it
Expand Down
2 changes: 1 addition & 1 deletion lib/canvas/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# frozen_string_literal: true

module Canvas
VERSION = "4.15.0"
VERSION = "4.16.0"
end
2 changes: 1 addition & 1 deletion spec/lib/canvas/checks/valid_html_check_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
message = <<~MESSAGE.chop
Invalid HTML: blocks/hero/block.liquid - \n
14:16: ERROR: Start tag of nonvoid HTML element ends with '/>', use '>'.
<h1> <foo/>
<h1>xxxxxxxxxxx<foo/>
^
MESSAGE

Expand Down
8 changes: 8 additions & 0 deletions spec/lib/canvas/validators/html_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,5 +44,13 @@

expect(Canvas::Validator::Html.new(html).validate).to be_truthy
end

it "strips out liquid" do
html = <<-LIQUID
<{{ tag | default: 'div' }}>This is valid html</{{ tag | default: 'div' }}>
LIQUID

expect(Canvas::Validator::Html.new(html).validate).to be_truthy
end
end
end