Loading lib/jsduck/doc_formatter.rb +1 −1 Original line number Diff line number Diff line Loading @@ -63,7 +63,7 @@ module JsDuck @link_re = /\{@link\s+(\S*?)(?:\s+(.+?))?\}/m @img_re = /\{@img\s+(\S*?)(?:\s+(.+?))?\}/m @example_re = /\{@example\s+(\S*?)\s*\}/m @example_annotation_re = /<pre><code>@example\s*\n/m @example_annotation_re = /<pre><code>@example( +[^\n]*)?\s+/m end # Replaces {@link} and {@img} tags, auto-generates links for Loading spec/doc_formatter_spec.rb +28 −10 Original line number Diff line number Diff line Loading @@ -301,6 +301,20 @@ describe JsDuck::DocFormatter do end end shared_examples_for "example" do it "creates <pre> with inline-example class" do @html.should =~ /<pre class="inline-example">/m end it "removes the line with @example markup" do @html.should_not =~ /@example/m end it "completely removes the first line and whitespace after it" do @html.should =~ /code>if/m end end describe "code block beginning with @example" do before do @html = @formatter.format(<<-EOS.gsub(/^ *\|/, "")) Loading @@ -312,18 +326,22 @@ describe JsDuck::DocFormatter do | } EOS end it "creates <pre> with inline-example class" do @html.should =~ /<pre class="inline-example">/m it_should_behave_like "example" end it "removes the line with @example markup" do @html.should_not =~ /@example/m end it "completely removes the first line" do @html.should =~ /code>if/m describe "code block beginning with @example and title" do before do @html = @formatter.format(<<-EOS.gsub(/^ *\|/, "")) |See example: | | @example My little example | | if (condition) { | doSomething(); | } EOS end it_should_behave_like "example" end end Loading Loading
lib/jsduck/doc_formatter.rb +1 −1 Original line number Diff line number Diff line Loading @@ -63,7 +63,7 @@ module JsDuck @link_re = /\{@link\s+(\S*?)(?:\s+(.+?))?\}/m @img_re = /\{@img\s+(\S*?)(?:\s+(.+?))?\}/m @example_re = /\{@example\s+(\S*?)\s*\}/m @example_annotation_re = /<pre><code>@example\s*\n/m @example_annotation_re = /<pre><code>@example( +[^\n]*)?\s+/m end # Replaces {@link} and {@img} tags, auto-generates links for Loading
spec/doc_formatter_spec.rb +28 −10 Original line number Diff line number Diff line Loading @@ -301,6 +301,20 @@ describe JsDuck::DocFormatter do end end shared_examples_for "example" do it "creates <pre> with inline-example class" do @html.should =~ /<pre class="inline-example">/m end it "removes the line with @example markup" do @html.should_not =~ /@example/m end it "completely removes the first line and whitespace after it" do @html.should =~ /code>if/m end end describe "code block beginning with @example" do before do @html = @formatter.format(<<-EOS.gsub(/^ *\|/, "")) Loading @@ -312,18 +326,22 @@ describe JsDuck::DocFormatter do | } EOS end it "creates <pre> with inline-example class" do @html.should =~ /<pre class="inline-example">/m it_should_behave_like "example" end it "removes the line with @example markup" do @html.should_not =~ /@example/m end it "completely removes the first line" do @html.should =~ /code>if/m describe "code block beginning with @example and title" do before do @html = @formatter.format(<<-EOS.gsub(/^ *\|/, "")) |See example: | | @example My little example | | if (condition) { | doSomething(); | } EOS end it_should_behave_like "example" end end Loading