Loading lib/jsduck/doc_parser.rb +7 −1 Original line number Diff line number Diff line Loading @@ -193,12 +193,18 @@ module JsDuck skip_white end # matches @return {type} ... # matches @return {type} [ return.name ] ... def at_return match(/@returns?/) add_tag(:return) maybe_type skip_white if look(/return\.\w/) @current_tag[:name] = ident_chain else @current_tag[:name] = "return" end skip_white end # matches @cfg {type} name ... Loading lib/jsduck/merger.rb +2 −0 Original line number Diff line number Diff line Loading @@ -371,7 +371,9 @@ module JsDuck ret = doc_map[:return] ? doc_map[:return].first : {} return { :type => ret[:type] || default_type, :name => ret[:name] || "return", :doc => ret[:doc] || "", :properties => doc_map[:return] ? detect_subproperties(doc_map[:return], :return) : [] } end Loading spec/aggregator_object_properties_spec.rb +25 −1 Original line number Diff line number Diff line Loading @@ -11,7 +11,7 @@ describe JsDuck::Aggregator do shared_examples_for "object with properties" do it "has name" do @obj[:name].should == "coord" @obj[:name].should == @name end it "has type" do Loading Loading @@ -101,6 +101,7 @@ describe JsDuck::Aggregator do describe "single param" do before do @obj = @doc[:params][0] @name = "coord" end it_should_behave_like "object with properties" Loading Loading @@ -130,6 +131,7 @@ describe JsDuck::Aggregator do describe "single param" do before do @obj = @doc[:params][0] @name = "coord" end it_should_behave_like "object with properties" Loading @@ -156,6 +158,7 @@ describe JsDuck::Aggregator do describe "the config" do before do @obj = @doc[0] @name = "coord" end it_should_behave_like "object with properties" Loading @@ -182,9 +185,30 @@ describe JsDuck::Aggregator do describe "the property" do before do @obj = @doc[0] @name = "coord" end it_should_behave_like "object with properties" end end describe "method return value with properties" do before do @obj = parse(<<-EOS)[0][:return] /** * Some function * @return {Object} Geographical coordinates * @return {Object} return.lat Latitude * @return {Number} return.lat.numerator Numerator part of a fraction * @return {Number} return.lat.denominator Denominator part of a fraction * @return {Number} return.lng Longitude */ function foo() {} EOS @name = "return" end it_should_behave_like "object with properties" end end template/app/view/cls/Overview.js +7 −1 Original line number Diff line number Diff line Loading @@ -474,9 +474,15 @@ Ext.define('Docs.view.cls.Overview', { '<span class="pre">{type}</span>', '<div class="sub-desc">', '{doc}', '<tpl if="properties && properties.length">', '{[this.renderParamsAndReturn(values)]}', '</tpl>', '</div>', '</li>', '</ul>' '</ul>', { renderParamsAndReturn: Ext.Function.bind(this.renderParamsAndReturn, this) } ); return this.returnTpl.apply(returnDoc); Loading Loading
lib/jsduck/doc_parser.rb +7 −1 Original line number Diff line number Diff line Loading @@ -193,12 +193,18 @@ module JsDuck skip_white end # matches @return {type} ... # matches @return {type} [ return.name ] ... def at_return match(/@returns?/) add_tag(:return) maybe_type skip_white if look(/return\.\w/) @current_tag[:name] = ident_chain else @current_tag[:name] = "return" end skip_white end # matches @cfg {type} name ... Loading
lib/jsduck/merger.rb +2 −0 Original line number Diff line number Diff line Loading @@ -371,7 +371,9 @@ module JsDuck ret = doc_map[:return] ? doc_map[:return].first : {} return { :type => ret[:type] || default_type, :name => ret[:name] || "return", :doc => ret[:doc] || "", :properties => doc_map[:return] ? detect_subproperties(doc_map[:return], :return) : [] } end Loading
spec/aggregator_object_properties_spec.rb +25 −1 Original line number Diff line number Diff line Loading @@ -11,7 +11,7 @@ describe JsDuck::Aggregator do shared_examples_for "object with properties" do it "has name" do @obj[:name].should == "coord" @obj[:name].should == @name end it "has type" do Loading Loading @@ -101,6 +101,7 @@ describe JsDuck::Aggregator do describe "single param" do before do @obj = @doc[:params][0] @name = "coord" end it_should_behave_like "object with properties" Loading Loading @@ -130,6 +131,7 @@ describe JsDuck::Aggregator do describe "single param" do before do @obj = @doc[:params][0] @name = "coord" end it_should_behave_like "object with properties" Loading @@ -156,6 +158,7 @@ describe JsDuck::Aggregator do describe "the config" do before do @obj = @doc[0] @name = "coord" end it_should_behave_like "object with properties" Loading @@ -182,9 +185,30 @@ describe JsDuck::Aggregator do describe "the property" do before do @obj = @doc[0] @name = "coord" end it_should_behave_like "object with properties" end end describe "method return value with properties" do before do @obj = parse(<<-EOS)[0][:return] /** * Some function * @return {Object} Geographical coordinates * @return {Object} return.lat Latitude * @return {Number} return.lat.numerator Numerator part of a fraction * @return {Number} return.lat.denominator Denominator part of a fraction * @return {Number} return.lng Longitude */ function foo() {} EOS @name = "return" end it_should_behave_like "object with properties" end end
template/app/view/cls/Overview.js +7 −1 Original line number Diff line number Diff line Loading @@ -474,9 +474,15 @@ Ext.define('Docs.view.cls.Overview', { '<span class="pre">{type}</span>', '<div class="sub-desc">', '{doc}', '<tpl if="properties && properties.length">', '{[this.renderParamsAndReturn(values)]}', '</tpl>', '</div>', '</li>', '</ul>' '</ul>', { renderParamsAndReturn: Ext.Function.bind(this.renderParamsAndReturn, this) } ); return this.returnTpl.apply(returnDoc); Loading