Commit d7b83dbb authored by Rene Saarsoo's avatar Rene Saarsoo
Browse files

Merge branch 'master' into doc-tags

parents 7a99dd1a e026049b
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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.
+20 −0
Original line number Diff line number Diff line
@@ -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>&lt;pre&gt;</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>&lt;pre&gt;&lt;code&gt;</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