Class: RDoc::Generator::Markdown
- Inherits:
-
Object
- Object
- RDoc::Generator::Markdown
- Defined in:
- lib/rdoc/generator/markdown.rb
Overview
Generates Markdown output and a CSV search index from an RDoc store.
Defined Under Namespace
Modules: OptionsExtension
Constant Summary collapse
- TEMPLATE_DIR =
Directory containing ERB templates.
File.(File.join(File.dirname(__FILE__), "..", "..", "templates"))
- MARKDOWN_UNKNOWN_TAGS =
Supported reverse_markdown unknown-tag modes.
%i[pass_through drop bypass raise].freeze
Instance Attribute Summary collapse
-
#base_dir ⇒ Pathname
readonly
Working directory captured when the generator is created.
-
#classes ⇒ Array<RDoc::Context>?
readonly
Classes and modules selected for output.
-
#pages ⇒ Array<RDoc::TopLevel>?
readonly
Text files selected for output.
-
#store ⇒ RDoc::Store
readonly
Source store for generated content.
Class Method Summary collapse
-
.setup_options(rdoc_options) ⇒ void
Registers markdown generator-specific RDoc options.
-
.validate_markdown_unknown_tags(value) ⇒ Symbol
Validates the configured reverse_markdown unknown-tag mode.
Instance Method Summary collapse
-
#class_dir ⇒ nil
(also: #file_dir)
Required by RDoc’s generator interface; markdown output has no class subdirectory.
-
#generate ⇒ void
Writes class files, page files, and the search index.
-
#initialize(store, rdoc_options) ⇒ Markdown
constructor
Creates a generator for an RDoc store and options.
Constructor Details
#initialize(store, rdoc_options) ⇒ Markdown
Creates a generator for an RDoc store and options.
112 113 114 115 116 117 118 |
# File 'lib/rdoc/generator/markdown.rb', line 112 def initialize(store, ) @store = store @options = @markdown_unknown_tags = self.class.(.) @base_dir = Pathname.pwd end |
Instance Attribute Details
#base_dir ⇒ Pathname (readonly)
Working directory captured when the generator is created.
87 88 89 |
# File 'lib/rdoc/generator/markdown.rb', line 87 def base_dir @base_dir end |
#classes ⇒ Array<RDoc::Context>? (readonly)
Classes and modules selected for output.
92 93 94 |
# File 'lib/rdoc/generator/markdown.rb', line 92 def classes @classes end |
#pages ⇒ Array<RDoc::TopLevel>? (readonly)
Text files selected for output.
97 98 99 |
# File 'lib/rdoc/generator/markdown.rb', line 97 def pages @pages end |
#store ⇒ RDoc::Store (readonly)
Source store for generated content.
82 83 84 |
# File 'lib/rdoc/generator/markdown.rb', line 82 def store @store end |
Class Method Details
.setup_options(rdoc_options) ⇒ void
This method returns an undefined value.
Registers markdown generator-specific RDoc options.
57 58 59 60 61 62 63 64 |
# File 'lib/rdoc/generator/markdown.rb', line 57 def self.() .option_parser.on( "--markdown-unknown-tags=MODE", "How to handle unknown HTML tags: #{MARKDOWN_UNKNOWN_TAGS.join(", ")}." ) do |value| . = value.to_sym end end |
.validate_markdown_unknown_tags(value) ⇒ Symbol
Validates the configured reverse_markdown unknown-tag mode.
71 72 73 74 75 76 77 |
# File 'lib/rdoc/generator/markdown.rb', line 71 def self.(value) return value if MARKDOWN_UNKNOWN_TAGS.include?(value) expected = MARKDOWN_UNKNOWN_TAGS.map { |mode| ":#{mode}" }.join(", ") raise OptionParser::InvalidArgument, "invalid markdown_unknown_tags: #{value.inspect} (expected one of: #{expected})" end |
Instance Method Details
#class_dir ⇒ nil Also known as: file_dir
Required by RDoc’s generator interface; markdown output has no class subdirectory.
102 103 |
# File 'lib/rdoc/generator/markdown.rb', line 102 def class_dir end |
#generate ⇒ void
This method returns an undefined value.
Writes class files, page files, and the search index.
123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 |
# File 'lib/rdoc/generator/markdown.rb', line 123 def generate debug("Setting things up ") setup debug("Generate documentation in #{@output_dir}") emit_classfiles debug("Generate pages in #{@output_dir}") emit_pagefiles debug("Generate index file in #{@output_dir}") emit_csv_index end |