diff --git a/lib/jsduck/doc_links.rb b/lib/jsduck/doc_formatter.rb similarity index 88% rename from lib/jsduck/doc_links.rb rename to lib/jsduck/doc_formatter.rb index 075f97daa0c7048785c1f4db85600dcf1b43df36..eae159973335b631b9f8e964fee1d0052905f3d4 100644 --- a/lib/jsduck/doc_links.rb +++ b/lib/jsduck/doc_formatter.rb @@ -2,10 +2,8 @@ require 'maruku' module JsDuck - # Detects {@link ...} tags in text and replaces them with HTML links - # pointing to documentation. In addition to the href attribute - # links will also contain ext:cls and ext:member attributes. - class DocLinks + # Formats doc-comments + class DocFormatter # Initializes instance to work in context of particular class, so # that when {@link #blah} is encountered it knows that # Context#blah is meant. @@ -14,7 +12,9 @@ module JsDuck end # Replaces {@link Class#member link text} in given string with - # HTML links. + # HTML links pointing to documentation. In addition to the href + # attribute links will also contain ext:cls and ext:member + # attributes. def replace(input) input.gsub(/\{@link +(\S*?)(?: +(.+?))?\}/) do target = $1 diff --git a/lib/jsduck/long_params.rb b/lib/jsduck/long_params.rb index b8407dd19a0871cf8bb7b1aac5380348e100979e..4d7ca8797bcae18005caf377e64df3da0e469f8e 100644 --- a/lib/jsduck/long_params.rb +++ b/lib/jsduck/long_params.rb @@ -1,10 +1,12 @@ +require "jsduck/doc_formatter" + module JsDuck # Renders method/event parameters list in long form # for use in documentation body. class LongParams def initialize(cls) - @links = DocLinks.new(cls.full_name) + @formatter = DocFormatter.new(cls.full_name) end def render(params) @@ -16,7 +18,7 @@ module JsDuck end def render_single(param) - doc = @links.format(param[:doc]) + doc = @formatter.format(param[:doc]) return [ "
#{param[:name]}
: #{param[:type]}",
diff --git a/lib/jsduck/page.rb b/lib/jsduck/page.rb
index 5a8f94a44764d008ee44e0dace68864587cbece3..e3e7cc46818f85728b68495eaf5d61eb36894308 100644
--- a/lib/jsduck/page.rb
+++ b/lib/jsduck/page.rb
@@ -1,4 +1,4 @@
-require 'jsduck/doc_links'
+require 'jsduck/doc_formatter'
require 'jsduck/cfg_table'
require 'jsduck/property_table'
require 'jsduck/method_table'
@@ -10,7 +10,7 @@ module JsDuck
class Page
def initialize(cls)
@cls = cls
- @links = DocLinks.new(cls.full_name)
+ @formatter = DocFormatter.new(cls.full_name)
end
def to_html
@@ -48,7 +48,7 @@ module JsDuck
end
def description
- "