File tree Expand file tree Collapse file tree 2 files changed +14
-1
lines changed
Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -130,7 +130,7 @@ def guess_code_language(code)
130130 else
131131 "yaml"
132132 end
133- when /^ *<[%a-z]/i
133+ when /^ *<[%a-z]|%>$|< \/ \w +>$ /i
134134 "erb" # also highlights HTML
135135 else
136136 "ruby"
Original file line number Diff line number Diff line change 400400 <%= 1 + 1 %>
401401 ERB
402402
403+ _ ( SDoc ::Postprocessor . guess_code_language ( <<~ERB ) ) . must_equal "erb"
404+ 1 + 1 = <%= 1 + 1 %>
405+ ERB
406+
403407 _ ( SDoc ::Postprocessor . guess_code_language ( <<~ERB ) ) . must_equal "erb"
404408 <% x = 1 + 1 %>
405409 ERB
413417 _ ( SDoc ::Postprocessor . guess_code_language ( <<~HTML ) ) . must_equal "erb"
414418 < p > 1 + 1 = 2</ p >
415419 HTML
420+
421+ _ ( SDoc ::Postprocessor . guess_code_language ( <<~HTML ) ) . must_equal "erb"
422+ 1 + 1 = < span > 2</ span >
423+ HTML
416424 end
417425
418426 it "guesses erb for HTML that includes ERB" do
432440 Object.new # => #<Object>
433441 RUBY
434442
443+ _ ( SDoc ::Postprocessor . guess_code_language ( <<~RUBY ) ) . must_equal "ruby"
444+ Pathname("/span")
445+ # => #<Pathname:/span>
446+ RUBY
447+
435448 _ ( SDoc ::Postprocessor . guess_code_language ( <<~RUBY ) ) . must_equal "ruby"
436449 image_tag("image.png")
437450 # => <img src="/assets/image.png" />
You can’t perform that action at this time.
0 commit comments