Loading lib/jsduck/class_formatter.rb +1 −1 Original line number Diff line number Diff line Loading @@ -51,7 +51,7 @@ module JsDuck end def expandable?(m) m[:params] || (m[:properties] && m[:properties].length > 0) || m[:default] || m[:deprecated] m[:params] || (m[:properties] && m[:properties].length > 0) || m[:default] || m[:deprecated] || m[:template] end def format_item(it, is_css_tag) Loading lib/jsduck/doc_parser.rb +2 −0 Original line number Diff line number Diff line Loading @@ -125,6 +125,8 @@ module JsDuck boolean_at_tag(/@protected/, :protected) elsif look(/@accessor\b/) boolean_at_tag(/@accessor/, :accessor) elsif look(/@template\b/) boolean_at_tag(/@template/, :template) elsif look(/@markdown\b/) # this is detected just to be ignored boolean_at_tag(/@markdown/, :markdown) Loading lib/jsduck/merger.rb +1 −0 Original line number Diff line number Diff line Loading @@ -143,6 +143,7 @@ module JsDuck :doc => detect_doc(docs), :params => detect_params(docs, code), :return => detect_return(doc_map, name == "constructor" ? "Object" : "undefined"), :template => !!doc_map[:template], }, doc_map) end Loading lib/jsduck/renderer.rb +12 −0 Original line number Diff line number Diff line Loading @@ -228,6 +228,9 @@ module JsDuck if m[:tagname] == :cfg && !m[:optional] after += "<strong class='required-signature'>required</strong>" end if m[:template] after += "<strong class='template-signature'>template</strong>" end uri = "#!/api/#{m[:owner]}-#{m[:tagname]}-#{m[:name]}" Loading Loading @@ -261,6 +264,15 @@ module JsDuck ] end if m[:template] doc << [ "<div class='template'>", "<p>This is a template method. A hook into the functionality of this class.", "Feel free to override it in child classes.</p>", "</div>", ] end doc << render_params_and_return(m) doc Loading spec/aggregator_methods_and_events_spec.rb +16 −0 Original line number Diff line number Diff line Loading @@ -264,6 +264,22 @@ describe JsDuck::Aggregator do it_should_behave_like "has return" end describe "method with @template" do before do @doc = parse(<<-EOS)[0] /** * @method foo * Some function * @template */ EOS end it_should_behave_like "method documentation" it "is a template method" do @doc[:template].should == true end end describe "method without doc-comment" do before do @docs = parse(<<-EOS) Loading Loading
lib/jsduck/class_formatter.rb +1 −1 Original line number Diff line number Diff line Loading @@ -51,7 +51,7 @@ module JsDuck end def expandable?(m) m[:params] || (m[:properties] && m[:properties].length > 0) || m[:default] || m[:deprecated] m[:params] || (m[:properties] && m[:properties].length > 0) || m[:default] || m[:deprecated] || m[:template] end def format_item(it, is_css_tag) Loading
lib/jsduck/doc_parser.rb +2 −0 Original line number Diff line number Diff line Loading @@ -125,6 +125,8 @@ module JsDuck boolean_at_tag(/@protected/, :protected) elsif look(/@accessor\b/) boolean_at_tag(/@accessor/, :accessor) elsif look(/@template\b/) boolean_at_tag(/@template/, :template) elsif look(/@markdown\b/) # this is detected just to be ignored boolean_at_tag(/@markdown/, :markdown) Loading
lib/jsduck/merger.rb +1 −0 Original line number Diff line number Diff line Loading @@ -143,6 +143,7 @@ module JsDuck :doc => detect_doc(docs), :params => detect_params(docs, code), :return => detect_return(doc_map, name == "constructor" ? "Object" : "undefined"), :template => !!doc_map[:template], }, doc_map) end Loading
lib/jsduck/renderer.rb +12 −0 Original line number Diff line number Diff line Loading @@ -228,6 +228,9 @@ module JsDuck if m[:tagname] == :cfg && !m[:optional] after += "<strong class='required-signature'>required</strong>" end if m[:template] after += "<strong class='template-signature'>template</strong>" end uri = "#!/api/#{m[:owner]}-#{m[:tagname]}-#{m[:name]}" Loading Loading @@ -261,6 +264,15 @@ module JsDuck ] end if m[:template] doc << [ "<div class='template'>", "<p>This is a template method. A hook into the functionality of this class.", "Feel free to override it in child classes.</p>", "</div>", ] end doc << render_params_and_return(m) doc Loading
spec/aggregator_methods_and_events_spec.rb +16 −0 Original line number Diff line number Diff line Loading @@ -264,6 +264,22 @@ describe JsDuck::Aggregator do it_should_behave_like "has return" end describe "method with @template" do before do @doc = parse(<<-EOS)[0] /** * @method foo * Some function * @template */ EOS end it_should_behave_like "method documentation" it "is a template method" do @doc[:template].should == true end end describe "method without doc-comment" do before do @docs = parse(<<-EOS) Loading