Loading lib/jsduck/format/doc.rb +1 −1 Original line number Diff line number Diff line Loading @@ -75,7 +75,7 @@ module JsDuck # normal Markdown, which often causes nested <pre>-blocks. # # To prevent this, we always add extra newline before <pre>. input.gsub!(/([^\n])<pre>/, "\\1\n<pre>") input.gsub!(/([^\n])<pre>((<code>)?$)/, "\\1\n<pre>\\2") # But we remove trailing newline after <pre> to prevent # code-blocks beginning with empty line. Loading spec/format_doc_spec.rb +20 −0 Original line number Diff line number Diff line Loading @@ -494,6 +494,26 @@ describe JsDuck::Format::Doc do end end describe "quoted `<pre>`" do before do @html = @formatter.format("Some `<pre>` in here.") end it "is correctly escaped" do @html.should == "<p>Some <code><pre></code> in here.</p>\n" end end describe "quoted `<pre><code>`" do before do @html = @formatter.format("Some `<pre><code>` in here.") end it "is correctly escaped" do @html.should == "<p>Some <code><pre><code></code> in here.</p>\n" end end shared_examples_for "example" do it "creates <pre> with inline-example class" do @html.should =~ /<pre class='inline-example *'>/m Loading Loading
lib/jsduck/format/doc.rb +1 −1 Original line number Diff line number Diff line Loading @@ -75,7 +75,7 @@ module JsDuck # normal Markdown, which often causes nested <pre>-blocks. # # To prevent this, we always add extra newline before <pre>. input.gsub!(/([^\n])<pre>/, "\\1\n<pre>") input.gsub!(/([^\n])<pre>((<code>)?$)/, "\\1\n<pre>\\2") # But we remove trailing newline after <pre> to prevent # code-blocks beginning with empty line. Loading
spec/format_doc_spec.rb +20 −0 Original line number Diff line number Diff line Loading @@ -494,6 +494,26 @@ describe JsDuck::Format::Doc do end end describe "quoted `<pre>`" do before do @html = @formatter.format("Some `<pre>` in here.") end it "is correctly escaped" do @html.should == "<p>Some <code><pre></code> in here.</p>\n" end end describe "quoted `<pre><code>`" do before do @html = @formatter.format("Some `<pre><code>` in here.") end it "is correctly escaped" do @html.should == "<p>Some <code><pre><code></code> in here.</p>\n" end end shared_examples_for "example" do it "creates <pre> with inline-example class" do @html.should =~ /<pre class='inline-example *'>/m Loading