lib/jsduck/format/doc.rb in jsduck-5.3.4 vs lib/jsduck/format/doc.rb in jsduck-6.0.0beta
- old
+ new
@@ -6,21 +6,22 @@
require 'jsduck/inline/auto_link'
require 'jsduck/inline/link_renderer'
require 'jsduck/inline/img'
require 'jsduck/inline/video'
require 'jsduck/inline/example'
+require 'ostruct'
module JsDuck
module Format
# Formats doc-comments
class Doc
# Creates a formatter configured with options originating from
# command line. For the actual effect of the options see
# Inline::* classes.
- def initialize(relations={}, opts={})
+ def initialize(relations={}, opts=OpenStruct.new)
@relations = relations
@opts = opts
@subproperties = Format::Subproperties.new(self)
@link_renderer = Inline::LinkRenderer.new(relations, opts)
@inline_link = Inline::Link.new(@link_renderer)
@@ -86,13 +87,13 @@
# Replaces {@link} and {@img} tags, auto-generates links for
# recognized classnames.
#
# Replaces {@link Class#member link text} in given string with
- # HTML from @link_tpl.
+ # HTML from --link.
#
- # Replaces {@img path/to/image.jpg Alt text} with HTML from @img_tpl.
+ # Replaces {@img path/to/image.jpg Alt text} with HTML from --img.
#
# Adds 'inline-example' class to code examples beginning with @example.
#
# Additionally replaces strings recognized as ClassNames or
# #members with links to these classes or members. So one doesn't
@@ -102,11 +103,11 @@
out = ""
# Keep track of open HTML tags. We're not auto-detecting class
# names when inside <a>. Also we want to close down the unclosed
# tags.
- tags = Format::HtmlStack.new(@opts[:ignore_html] || {}, @doc_context)
+ tags = Format::HtmlStack.new(@opts.ignore_html || {}, @doc_context)
while !s.eos? do
if substitute = @inline_link.replace(s)
out += substitute
elsif substitute = @inline_img.replace(s)
@@ -145,10 +146,10 @@
@link_renderer.link(cls, member, anchor_text, type, static)
end
# Turns type parsing on or off.
#
- # Used to skipping parsing of CSS var and mixin types.
+ # Used to skipping parsing of SCSS var and mixin types.
def skip_type_parsing=(skip)
@subproperties.skip_type_parsing = skip
end
# Recursively formats a subproperty.