Loading lib/jsduck/aggregator.rb +9 −4 Original line number Diff line number Diff line Loading @@ -51,14 +51,19 @@ module JsDuck # Merges new class-doc into old one. def merge_classes(old, new) # Merge booleans [:extends, :singleton, :private, :protected].each do |tag| old[tag] = old[tag] || new[tag] end [:mixins, :alternateClassNames, :meta, :files].each do |tag| # Merge arrays [:mixins, :alternateClassNames, :files].each do |tag| old[tag] = old[tag] + new[tag] end new[:xtypes].each_pair do |key, xtypes| old[:xtypes][key] = (old[:xtypes][key] || []) + xtypes # Merge hashes of arrays [:xtypes, :meta].each do |tag| new[tag].each_pair do |key, contents| old[tag][key] = (old[tag][key] || []) + contents end end old[:doc] = old[:doc].length > 0 ? old[:doc] : new[:doc] # Additionally the doc-comment can contain configs and constructor Loading Loading @@ -144,7 +149,7 @@ module JsDuck :alternateClassNames => [], :members => Class.default_members_hash, :statics => Class.default_members_hash, :meta => [], :meta => {}, :files => [{:filename => "", :linenr => 0}], }) end Loading lib/jsduck/app.rb +5 −3 Original line number Diff line number Diff line Loading @@ -158,9 +158,6 @@ module JsDuck class_formatter = ClassFormatter.new(@relations, doc_formatter) # Don't format types when exporting class_formatter.include_types = !@opts.export # Inject formatter to all meta-tags. @opts.meta_tags.each {|tag| tag.formatter = doc_formatter } class_formatter.meta_tags = @opts.meta_tags # Format all doc-objects in parallel formatted_classes = @parallel.map(@relations.classes) do |cls| { Loading Loading @@ -191,6 +188,11 @@ module JsDuck def write_classes exporter = Exporter.new(@relations) renderer = Renderer.new # Inject formatter to all meta-tags. doc_formatter = get_doc_formatter @opts.meta_tags.each {|tag| tag.formatter = doc_formatter } renderer.meta_tags = @opts.meta_tags dir = @opts.output_dir + (@opts.export ? "" : "/output") @parallel.each(@relations.classes) do |cls| filename = dir + "/" + cls[:name] + (@opts.export ? ".json" : ".js") Loading lib/jsduck/author_tag.rb 0 → 100644 +11 −0 Original line number Diff line number Diff line require "jsduck/meta_tag" module JsDuck # Implementation of hidden @author tag class AuthorTag < MetaTag def initialize @name = "author" end end end lib/jsduck/class_formatter.rb +0 −12 Original line number Diff line number Diff line Loading @@ -9,8 +9,6 @@ module JsDuck class ClassFormatter # Set to false to disable HTML-formatting of type definitions. attr_accessor :include_types # List of meta-tag implementations attr_accessor :meta_tags def initialize(relations, formatter) @relations = relations Loading @@ -32,19 +30,9 @@ module JsDuck cls[:statics].each_pair do |type, members| cls[:statics][type] = members.reject {|m| m[:private] }.map {|m| format_member(m) } end cls[:meta] = cls[:meta].map {|m| format_meta(m) }.compact cls end def format_meta(meta) tag = @meta_tags.find {|tag| tag.name == meta[:name] } if tag.hidden nil else {:name => tag.name, :title => tag.title, :doc => tag.transform(meta[:doc])} end end def format_member(m) @formatter.doc_context = m[:files][0] m[:doc] = @formatter.format(m[:doc]) if m[:doc] Loading lib/jsduck/doc_author_tag.rb 0 → 100644 +11 −0 Original line number Diff line number Diff line require "jsduck/meta_tag" module JsDuck # Implementation of hidden @docauthor tag class DocAuthorTag < MetaTag def initialize @name = "docauthor" end end end Loading
lib/jsduck/aggregator.rb +9 −4 Original line number Diff line number Diff line Loading @@ -51,14 +51,19 @@ module JsDuck # Merges new class-doc into old one. def merge_classes(old, new) # Merge booleans [:extends, :singleton, :private, :protected].each do |tag| old[tag] = old[tag] || new[tag] end [:mixins, :alternateClassNames, :meta, :files].each do |tag| # Merge arrays [:mixins, :alternateClassNames, :files].each do |tag| old[tag] = old[tag] + new[tag] end new[:xtypes].each_pair do |key, xtypes| old[:xtypes][key] = (old[:xtypes][key] || []) + xtypes # Merge hashes of arrays [:xtypes, :meta].each do |tag| new[tag].each_pair do |key, contents| old[tag][key] = (old[tag][key] || []) + contents end end old[:doc] = old[:doc].length > 0 ? old[:doc] : new[:doc] # Additionally the doc-comment can contain configs and constructor Loading Loading @@ -144,7 +149,7 @@ module JsDuck :alternateClassNames => [], :members => Class.default_members_hash, :statics => Class.default_members_hash, :meta => [], :meta => {}, :files => [{:filename => "", :linenr => 0}], }) end Loading
lib/jsduck/app.rb +5 −3 Original line number Diff line number Diff line Loading @@ -158,9 +158,6 @@ module JsDuck class_formatter = ClassFormatter.new(@relations, doc_formatter) # Don't format types when exporting class_formatter.include_types = !@opts.export # Inject formatter to all meta-tags. @opts.meta_tags.each {|tag| tag.formatter = doc_formatter } class_formatter.meta_tags = @opts.meta_tags # Format all doc-objects in parallel formatted_classes = @parallel.map(@relations.classes) do |cls| { Loading Loading @@ -191,6 +188,11 @@ module JsDuck def write_classes exporter = Exporter.new(@relations) renderer = Renderer.new # Inject formatter to all meta-tags. doc_formatter = get_doc_formatter @opts.meta_tags.each {|tag| tag.formatter = doc_formatter } renderer.meta_tags = @opts.meta_tags dir = @opts.output_dir + (@opts.export ? "" : "/output") @parallel.each(@relations.classes) do |cls| filename = dir + "/" + cls[:name] + (@opts.export ? ".json" : ".js") Loading
lib/jsduck/author_tag.rb 0 → 100644 +11 −0 Original line number Diff line number Diff line require "jsduck/meta_tag" module JsDuck # Implementation of hidden @author tag class AuthorTag < MetaTag def initialize @name = "author" end end end
lib/jsduck/class_formatter.rb +0 −12 Original line number Diff line number Diff line Loading @@ -9,8 +9,6 @@ module JsDuck class ClassFormatter # Set to false to disable HTML-formatting of type definitions. attr_accessor :include_types # List of meta-tag implementations attr_accessor :meta_tags def initialize(relations, formatter) @relations = relations Loading @@ -32,19 +30,9 @@ module JsDuck cls[:statics].each_pair do |type, members| cls[:statics][type] = members.reject {|m| m[:private] }.map {|m| format_member(m) } end cls[:meta] = cls[:meta].map {|m| format_meta(m) }.compact cls end def format_meta(meta) tag = @meta_tags.find {|tag| tag.name == meta[:name] } if tag.hidden nil else {:name => tag.name, :title => tag.title, :doc => tag.transform(meta[:doc])} end end def format_member(m) @formatter.doc_context = m[:files][0] m[:doc] = @formatter.format(m[:doc]) if m[:doc] Loading
lib/jsduck/doc_author_tag.rb 0 → 100644 +11 −0 Original line number Diff line number Diff line require "jsduck/meta_tag" module JsDuck # Implementation of hidden @docauthor tag class DocAuthorTag < MetaTag def initialize @name = "docauthor" end end end