diff --git a/lib/jsduck/ast.rb b/lib/jsduck/ast.rb index b952251f279a4a9b84a4c2c2b5ac696e182b520c..10ee328bdce9a6a8d4000a3a04def14a8402a236 100644 --- a/lib/jsduck/ast.rb +++ b/lib/jsduck/ast.rb @@ -185,7 +185,7 @@ module JsDuck cls[:code_type] = :ext_define ast["arguments"][1].each_property do |key, value, pair| - if tag = TagRegistry.get_ext_define(key) + if tag = TagRegistry.get_by_ext_define_pattern(key) tag.parse_ext_define(cls, value) else case key diff --git a/lib/jsduck/class_formatter.rb b/lib/jsduck/class_formatter.rb index fb9bca932907206625bbdd98d08e1575edf907bf..b66130f70c2cb9592cdf87bf9217308e6be3b486 100644 --- a/lib/jsduck/class_formatter.rb +++ b/lib/jsduck/class_formatter.rb @@ -21,7 +21,7 @@ module JsDuck def inject_formatter_to_tags # inject formatter to all html-producing tags - TagRegistry.get_html_renderers.each do |tag| + TagRegistry.html_renderers.each do |tag| tag.formatter = @formatter end end @@ -93,7 +93,7 @@ module JsDuck def format_tags_data(context) result = {} - TagRegistry.get_html_renderers.each do |tag| + TagRegistry.html_renderers.each do |tag| if context[tag.key] result[tag.key] = tag.to_html(context) end diff --git a/lib/jsduck/doc_parser.rb b/lib/jsduck/doc_parser.rb index b87230aa5506f73de395173d941e24a0aa69dddc..d8276f35a36e87d930733e90c6dc577698b276c1 100644 --- a/lib/jsduck/doc_parser.rb +++ b/lib/jsduck/doc_parser.rb @@ -81,7 +81,7 @@ module JsDuck if !name # ignore - elsif tag = TagRegistry.get_tag(name) + elsif tag = TagRegistry.get_by_pattern(name) match(/\w+/) tag.parse(self) skip_white diff --git a/lib/jsduck/tag_registry.rb b/lib/jsduck/tag_registry.rb index c59ab44d29de47cc34b7b70c2cf6cf20dcc1d066..83791769957728ec32b5bb565793def63b5ada95 100644 --- a/lib/jsduck/tag_registry.rb +++ b/lib/jsduck/tag_registry.rb @@ -60,32 +60,24 @@ module JsDuck JsDuck::Tag::Tag.descendants.sort {|a, b| a.to_s <=> b.to_s } end - # Accesses tag by @name pattern - def get_tag(name) - @patterns[name] - end + # + # Accessors for lists of tags + # # Returns all multiline tags. attr_reader :multiliners - # Accesses tag by Ext.define pattern - def get_ext_define(name) - @ext_define_patterns[name] - end - # Default values for class config when Ext.define is encountered. attr_reader :ext_define_defaults - # Accesses tag by key name - the symbol under which the tag data - # is stored in final hash. - def get_by_key(key) - @keys[key] - end + # Array of attributes to be shown in member signatures + # (and in order they should be shown in). + attr_reader :signatures # Returns tags for rendering HTML. One can ask for tags for # rendering either :top or :bottom section. By default renderers # for both sections are returned. - def get_html_renderers(position = :all) + def html_renderers(position = :all) if position == :all @html_renderers[:top] + @html_renderers[:bottom] else @@ -93,9 +85,25 @@ module JsDuck end end - # Array of attributes to be shown in member signatures - # (and in order they should be shown in). - attr_reader :signatures + # + # Accessors for a single tag + # + + # Accesses tag by @name pattern + def get_by_pattern(name) + @patterns[name] + end + + # Accesses tag by Ext.define pattern + def get_by_ext_define_pattern(name) + @ext_define_patterns[name] + end + + # Accesses tag by key name - the symbol under which the tag data + # is stored in final hash. + def get_by_key(key) + @keys[key] + end # Gives access to assets from @aside tag def assets=(assets) diff --git a/lib/jsduck/tag_renderer.rb b/lib/jsduck/tag_renderer.rb index f066e467e0c895fb3519d5a55297bbb03343d140..e59334877a81f370f26c01bc1234d030ae82d348 100644 --- a/lib/jsduck/tag_renderer.rb +++ b/lib/jsduck/tag_renderer.rb @@ -10,7 +10,7 @@ module JsDuck def self.render(html_data, position) return if html_data.size == 0 - TagRegistry.get_html_renderers(position).map do |tag| + TagRegistry.html_renderers(position).map do |tag| html_data[tag.key] end end