Loading lib/jsduck/merger.rb +15 −1 Original line number Diff line number Diff line Loading @@ -14,7 +14,7 @@ module JsDuck # producing hash as a result. def merge(docset, filename="", linenr=0) docs = docset[:comment] code = docset[:code] code = process_code(docset[:tagname], docset[:code]) h = { :tagname => docset[:tagname], Loading @@ -33,6 +33,20 @@ module JsDuck private # When code was detected with the correct member type, leaves it # as is, otherwise applies processing to extract fields relevant # to the member type def process_code(tagname, code) if code[:tagname] == tagname code else result = TagRegistry.get_by_name(tagname).process_code(code) result[:tagname] = code[:tagname] result[:autodetected] = code[:autodetected] result end end # Invokes the #merge methods of tags registered for the given # merge context. def invoke_merge_in_tags(h, docs, code) Loading lib/jsduck/tag/cfg.rb +8 −0 Original line number Diff line number Diff line Loading @@ -47,6 +47,14 @@ module JsDuck::Tag h[:name] = nested[:name] end def process_code(code) return { :name => code[:name], :type => code[:type], :default => code[:default], } end def to_html(cfg, cls) JsDuck::Render::PropertySignature.render(cfg) end Loading lib/jsduck/tag/class.rb +7 −0 Original line number Diff line number Diff line Loading @@ -20,6 +20,13 @@ module JsDuck::Tag h[:name] = tags[0][:name] end # Although class is not a member, it also has the auto-detected # part from code. So we need this method to say that when we # didn't detect code as a class, we only take the name from code. def process_code(code) {:name => code[:name]} end # Ensure the empty members array. def merge(h, docs, code) h[:members] = [] Loading lib/jsduck/tag/css_var.rb +8 −0 Original line number Diff line number Diff line Loading @@ -27,6 +27,14 @@ module JsDuck::Tag h[:default] = p[:default] end def process_code(code) return { :name => code[:name], :type => code[:type], :default => code[:default], } end def to_html(var, cls) JsDuck::Render::PropertySignature.render(var) end Loading lib/jsduck/tag/member_tag.rb +24 −0 Original line number Diff line number Diff line Loading @@ -56,6 +56,30 @@ module JsDuck::Tag MEMBER_POS_CSS_VAR = 5 MEMBER_POS_CSS_MIXIN = 6 # Called when the member type detected from code doesn't match # with the final member type determined from code + doc-comment. # # The job of this method is then to extract the fields relevant to # the member type. # # The input is a hash of auto-detected data. For example: # # {:name => "foo", :type => "String", :default => "hello"} # # In the context of method :type and :default don't make any # sense, so we should return just the name: # # {:name => "foo"} # # Extracting just the :name field is also the default behavior of # this method. # # Note: The special :tagname and :autodetected fields are filtered # out automatically, no need to worry about these. def process_code(code) {:name => code[:name]} end # This method defines the signature-line of the member. # For example it might return something like this: # Loading Loading
lib/jsduck/merger.rb +15 −1 Original line number Diff line number Diff line Loading @@ -14,7 +14,7 @@ module JsDuck # producing hash as a result. def merge(docset, filename="", linenr=0) docs = docset[:comment] code = docset[:code] code = process_code(docset[:tagname], docset[:code]) h = { :tagname => docset[:tagname], Loading @@ -33,6 +33,20 @@ module JsDuck private # When code was detected with the correct member type, leaves it # as is, otherwise applies processing to extract fields relevant # to the member type def process_code(tagname, code) if code[:tagname] == tagname code else result = TagRegistry.get_by_name(tagname).process_code(code) result[:tagname] = code[:tagname] result[:autodetected] = code[:autodetected] result end end # Invokes the #merge methods of tags registered for the given # merge context. def invoke_merge_in_tags(h, docs, code) Loading
lib/jsduck/tag/cfg.rb +8 −0 Original line number Diff line number Diff line Loading @@ -47,6 +47,14 @@ module JsDuck::Tag h[:name] = nested[:name] end def process_code(code) return { :name => code[:name], :type => code[:type], :default => code[:default], } end def to_html(cfg, cls) JsDuck::Render::PropertySignature.render(cfg) end Loading
lib/jsduck/tag/class.rb +7 −0 Original line number Diff line number Diff line Loading @@ -20,6 +20,13 @@ module JsDuck::Tag h[:name] = tags[0][:name] end # Although class is not a member, it also has the auto-detected # part from code. So we need this method to say that when we # didn't detect code as a class, we only take the name from code. def process_code(code) {:name => code[:name]} end # Ensure the empty members array. def merge(h, docs, code) h[:members] = [] Loading
lib/jsduck/tag/css_var.rb +8 −0 Original line number Diff line number Diff line Loading @@ -27,6 +27,14 @@ module JsDuck::Tag h[:default] = p[:default] end def process_code(code) return { :name => code[:name], :type => code[:type], :default => code[:default], } end def to_html(var, cls) JsDuck::Render::PropertySignature.render(var) end Loading
lib/jsduck/tag/member_tag.rb +24 −0 Original line number Diff line number Diff line Loading @@ -56,6 +56,30 @@ module JsDuck::Tag MEMBER_POS_CSS_VAR = 5 MEMBER_POS_CSS_MIXIN = 6 # Called when the member type detected from code doesn't match # with the final member type determined from code + doc-comment. # # The job of this method is then to extract the fields relevant to # the member type. # # The input is a hash of auto-detected data. For example: # # {:name => "foo", :type => "String", :default => "hello"} # # In the context of method :type and :default don't make any # sense, so we should return just the name: # # {:name => "foo"} # # Extracting just the :name field is also the default behavior of # this method. # # Note: The special :tagname and :autodetected fields are filtered # out automatically, no need to worry about these. def process_code(code) {:name => code[:name]} end # This method defines the signature-line of the member. # For example it might return something like this: # Loading