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
4 changes: 2 additions & 2 deletions htmlbook/inline_quoted.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ when :double %><%= class_attr ? %(<span#{class_attr}>&#8220;#{@text}&#8221;</spa
when :single %><%= class_attr ? %(<span#{class_attr}>&#8216;#{@text}&#8217;</span>) : %(&#8216;#{@text}&#8217;) %><%
when :latexmath
open, close = ::Asciidoctor::INLINE_MATH_DELIMITERS[@type] %><%
if (@text.start_with? '\(') && (@text.end_with? '\)') %><%= %(<span data-type="tex">#{@text[2..-3]}</span>) %>
<% else %><%= %(<span data-type="tex">#{@text}</span>) %>
if (@text.start_with? '\(') && (@text.end_with? '\)') %><%= %(<span data-type="tex">#{@text}</span>) %>
<% else %><%= %(<span data-type="tex">#{open}#{@text}#{close}</span>) %>
<% end %><%
when :asciimath
open, close = ::Asciidoctor::INLINE_MATH_DELIMITERS[@type] %><%
Expand Down
12 changes: 6 additions & 6 deletions spec/htmlbook_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -980,17 +980,17 @@ def hello
end

# Tests math in inline_quoted template
it "should convert inline latexmath equations with dollar sign delimeters to use no delimiters" do
it "should convert inline latexmath equations with dollar sign delimeters to use standard delimiters" do
html = Nokogiri::HTML(convert("The Pythagorean Theorem is latexmath:[$a^2 + b^2 = c^2$]"))
expect(html.xpath("//p/span[@data-type='tex']").text).to eq("a^2 + b^2 = c^2")
expect(html.xpath("//p/span[@data-type='tex']").text).to eq("\\(a^2 + b^2 = c^2\\)")
end
it "should convert inline latexmath equations with standard delimiters removed" do
it "should convert inline latexmath equations with standard delimiters with no change" do
html = Nokogiri::HTML(convert("The Pythagorean Theorem is latexmath:[\\(a^2 + b^2 = c^2\\)]"))
expect(html.xpath("//p/span[@data-type='tex']").text).to eq("a^2 + b^2 = c^2")
expect(html.xpath("//p/span[@data-type='tex']").text).to eq("\\(a^2 + b^2 = c^2\\)")
end
it "should convert inline latexmath equations with no delimiters without changing them" do
it "should convert inline latexmath equations with no delimiters and add delimiters" do
html = Nokogiri::HTML(convert("The Pythagorean Theorem is latexmath:[a^2 + b^2 = c^2]"))
expect(html.xpath("//p/span[@data-type='tex']").text).to eq("a^2 + b^2 = c^2")
expect(html.xpath("//p/span[@data-type='tex']").text).to eq("\\(a^2 + b^2 = c^2\\)")
end
it "should convert inline asciimath equations with dollar sign delimeters with no change" do
html = Nokogiri::HTML(convert("The Pythagorean Theorem is asciimath:[\$a^2 + b^2 = c^2\$]"))
Expand Down