Loading lib/jsduck/doc_formatter.rb +1 −1 Original line number Diff line number Diff line Loading @@ -33,7 +33,7 @@ module JsDuck # attribute links will also contain ext:cls and ext:member # attributes. def replace(input) input.gsub(/\{@link +(\S*?)(?: +(.+?))?\}/) do input.gsub(/\{@link\s+(\S*?)(?:\s+(.+?))?\}/m) do target = $1 text = $2 if target =~ /^(.*)#(.*)$/ Loading spec/doc_formatter_spec.rb +10 −0 Original line number Diff line number Diff line Loading @@ -38,6 +38,16 @@ describe JsDuck::DocFormatter do @formatter.replace("unfinished {@link tag here").should == 'unfinished {@link tag here' end it "handles {@link} spanning multiple lines" do @formatter.replace("Look at {@link\nExt.Msg\nsome text}").should == 'Look at <a href="Ext.Msg" rel="Ext.Msg">some text</a>' end it "handles {@link} with label spanning multiple lines" do @formatter.replace("Look at {@link Ext.Msg some\ntext}").should == "Look at <a href=\"Ext.Msg\" rel=\"Ext.Msg\">some\ntext</a>" end end describe "#format" do Loading Loading
lib/jsduck/doc_formatter.rb +1 −1 Original line number Diff line number Diff line Loading @@ -33,7 +33,7 @@ module JsDuck # attribute links will also contain ext:cls and ext:member # attributes. def replace(input) input.gsub(/\{@link +(\S*?)(?: +(.+?))?\}/) do input.gsub(/\{@link\s+(\S*?)(?:\s+(.+?))?\}/m) do target = $1 text = $2 if target =~ /^(.*)#(.*)$/ Loading
spec/doc_formatter_spec.rb +10 −0 Original line number Diff line number Diff line Loading @@ -38,6 +38,16 @@ describe JsDuck::DocFormatter do @formatter.replace("unfinished {@link tag here").should == 'unfinished {@link tag here' end it "handles {@link} spanning multiple lines" do @formatter.replace("Look at {@link\nExt.Msg\nsome text}").should == 'Look at <a href="Ext.Msg" rel="Ext.Msg">some text</a>' end it "handles {@link} with label spanning multiple lines" do @formatter.replace("Look at {@link Ext.Msg some\ntext}").should == "Look at <a href=\"Ext.Msg\" rel=\"Ext.Msg\">some\ntext</a>" end end describe "#format" do Loading