Loading lib/jsduck/doc/ast.rb +0 −4 Original line number Diff line number Diff line Loading @@ -74,11 +74,7 @@ module JsDuck def create_property(docs, doc_map) return add_shared({ :tagname => :property, :name => detect_name(:property, doc_map), :type => detect_type(:property, doc_map), :doc => detect_doc(:property, doc_map), :default => detect_default(:property, doc_map), :properties => detect_subproperties(:property, docs), }, doc_map) end Loading lib/jsduck/tag/property.rb +17 −0 Original line number Diff line number Diff line require "jsduck/tag/tag" require "jsduck/doc/subproperties" module JsDuck::Tag class Property < Tag def initialize @pattern = "property" @key = :property @member_type = :property end Loading @@ -13,5 +15,20 @@ module JsDuck::Tag tag[:doc] = :multiline tag end def process_doc(h, tags, pos) p = tags[0] h[:name] = p[:name] # Type might also come from @type, don't overwrite it with nil. h[:type] = p[:type] if p[:type] h[:default] = p[:default] h[:properties] = nest_properties(tags, pos) end def nest_properties(tags, pos) items, warnings = JsDuck::Doc::Subproperties.nest(tags) warnings.each {|msg| JsDuck::Logger.warn(:subproperty, msg, pos[:filename], pos[:linenr]) } items[0][:properties] end end end lib/jsduck/tag/type.rb +5 −0 Original line number Diff line number Diff line Loading @@ -4,6 +4,7 @@ module JsDuck::Tag class Type < Tag def initialize @pattern = "type" @key = :type end # matches @type {type} or @type type Loading @@ -21,5 +22,9 @@ module JsDuck::Tag p.hw.match(/\S+/) end def process_doc(h, tags, pos) h[:type] = tags[0][:type] unless h[:type] end end end Loading
lib/jsduck/doc/ast.rb +0 −4 Original line number Diff line number Diff line Loading @@ -74,11 +74,7 @@ module JsDuck def create_property(docs, doc_map) return add_shared({ :tagname => :property, :name => detect_name(:property, doc_map), :type => detect_type(:property, doc_map), :doc => detect_doc(:property, doc_map), :default => detect_default(:property, doc_map), :properties => detect_subproperties(:property, docs), }, doc_map) end Loading
lib/jsduck/tag/property.rb +17 −0 Original line number Diff line number Diff line require "jsduck/tag/tag" require "jsduck/doc/subproperties" module JsDuck::Tag class Property < Tag def initialize @pattern = "property" @key = :property @member_type = :property end Loading @@ -13,5 +15,20 @@ module JsDuck::Tag tag[:doc] = :multiline tag end def process_doc(h, tags, pos) p = tags[0] h[:name] = p[:name] # Type might also come from @type, don't overwrite it with nil. h[:type] = p[:type] if p[:type] h[:default] = p[:default] h[:properties] = nest_properties(tags, pos) end def nest_properties(tags, pos) items, warnings = JsDuck::Doc::Subproperties.nest(tags) warnings.each {|msg| JsDuck::Logger.warn(:subproperty, msg, pos[:filename], pos[:linenr]) } items[0][:properties] end end end
lib/jsduck/tag/type.rb +5 −0 Original line number Diff line number Diff line Loading @@ -4,6 +4,7 @@ module JsDuck::Tag class Type < Tag def initialize @pattern = "type" @key = :type end # matches @type {type} or @type type Loading @@ -21,5 +22,9 @@ module JsDuck::Tag p.hw.match(/\S+/) end def process_doc(h, tags, pos) h[:type] = tags[0][:type] unless h[:type] end end end