class JsDuck::Tag::Aside
Attributes
assets[RW]
special accessor for @aside alone through which assets are set
Public Class Methods
new()
click to toggle source
# File lib/jsduck/tag/aside.rb, line 6 def initialize @pattern = "aside" @tagname = :aside @repeatable = true @html_position = POS_ASIDE end
Public Instance Methods
aside_type(p)
click to toggle source
# File lib/jsduck/tag/aside.rb, line 22 def aside_type(p) p.look(/\w+/) ? p.ident.to_sym : nil end
get_assets_group(type)
click to toggle source
# File lib/jsduck/tag/aside.rb, line 56 def get_assets_group(type) case type when :guide then @assets.guides when :video then @assets.videos when :example then @assets.examples else {} end end
parse_doc(p, pos)
click to toggle source
Parses: @aside [ guide | video| example ] name
# File lib/jsduck/tag/aside.rb, line 14 def parse_doc(p, pos) { :tagname => :aside, :type => aside_type(p), :name => p.hw.ident, } end
process_doc(h, tags, pos)
click to toggle source
# File lib/jsduck/tag/aside.rb, line 26 def process_doc(h, tags, pos) h[:aside] = tags end
to_html(context)
click to toggle source
# File lib/jsduck/tag/aside.rb, line 30 def to_html(context) context[:aside].map do |aside| type = aside[:type] name = aside[:name] assets_group = get_assets_group(type) asset = assets_group[name] if asset url = "#!/#{type}/#{name}" heading = type.to_s.capitalize title = asset["title"] icon_url = assets_group.icon_url(asset) <<-EOHTML <div class='aside #{type}'> <h4>#{heading}</h4> <p><a href='#{url}'><img src='#{icon_url}' alt=''> #{title}</a></p> </div> EOHTML else warn("Unknown @aside name: #{type} #{name}", context) end end.compact end
warn(msg, context)
click to toggle source
# File lib/jsduck/tag/aside.rb, line 65 def warn(msg, context) JsDuck::Logger.warn(:aside, msg, context[:files][0]) nil end