Class: JsDuck::ClassFormatter
- Inherits:
-
Object
- Object
- JsDuck::ClassFormatter
- Defined in:
- lib/jsduck/class_formatter.rb
Overview
Converts :doc properties of class from markdown to HTML, resolves @links, and converts type definitions to HTML.
Instance Attribute Summary collapse
-
#include_types ⇒ Object
Set to false to disable HTML-formatting of type definitions.
Instance Method Summary collapse
-
#format(cls) ⇒ Object
Runs the formatter on doc object of a class.
-
#images ⇒ Object
Access to the Img::DirSet object inside doc-formatter.
-
#initialize(relations, formatter) ⇒ ClassFormatter
constructor
A new instance of ClassFormatter.
Constructor Details
#initialize(relations, formatter) ⇒ ClassFormatter
Returns a new instance of ClassFormatter.
15 16 17 18 19 20 21 |
# File 'lib/jsduck/class_formatter.rb', line 15 def initialize(relations, formatter) @relations = relations @formatter = formatter # inject formatter to all meta-tags MetaTagRegistry.instance.formatter = formatter @include_types = true end |
Instance Attribute Details
#include_types ⇒ Object
Set to false to disable HTML-formatting of type definitions.
13 14 15 |
# File 'lib/jsduck/class_formatter.rb', line 13 def include_types @include_types end |
Instance Method Details
#format(cls) ⇒ Object
Runs the formatter on doc object of a class. Accessed using Class#internal_doc
25 26 27 28 29 30 31 32 33 34 |
# File 'lib/jsduck/class_formatter.rb', line 25 def format(cls) @cls = cls @formatter.class_context = cls[:name] @formatter.doc_context = cls[:files][0] cls[:doc] = @formatter.format(cls[:doc]) if cls[:doc] # format all members (except hidden ones) cls[:members] = cls[:members].map {|m| m[:meta][:hide] ? m : format_member(m) } cls[:html_meta] = (cls) cls end |
#images ⇒ Object
Access to the Img::DirSet object inside doc-formatter
37 38 39 |
# File 'lib/jsduck/class_formatter.rb', line 37 def images @formatter.images end |