Class: QDoc
- Inherits:
-
Object
- Object
- QDoc
- Defined in:
- lib/qdoc.rb
Overview
require ‘hawaiian’
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ QDoc
constructor
Initializes QDoc [options set the directory to be created for documentation [options#index_content] set the static index page message.
-
#run ⇒ Object
Causes QDoc to search the current directory and tree, and parse found files.
Constructor Details
#initialize(options = {}) ⇒ QDoc
Initializes QDoc
- options[:output_directory
-
set the directory to be created for documentation
- options#index_content
-
set the static index page message
12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/qdoc.rb', line 12 def initialize( = {} ) defaults = { output_directory: "doc", index_content: "Choose from the list.", target_extensions: %w(md rc html) } = defaults.merge @out_dir = [:output_directory] @target_extensions = [:target_extensions].join("|") @index = { file: "index.html", title: "index", extension: "html", content: [:index_content], directory: nil, output_file: "index.html", parse: false } @documents = Array.new @locations = Array.new @redcarpet = Redcarpet::Markdown.new(Redcarpet::Render::HTML.new( :with_toc_data => true), :autolink => true, :space_after_headers => false, :no_intra_emphasis => true, :tables => true) end |
Instance Method Details
#run ⇒ Object
Causes QDoc to search the current directory and tree, and parse found files
27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/qdoc.rb', line 27 def run @locations = identify_locations @documents = stage_files( @locations ) @index[:content] = create_index @documents make_doc_directory @documents.each do |doc| doc[:content] = parse_document( doc ) if doc[:parse] #"#{doc[:directory]}/#{doc[:filename]}") write_file( "#{@out_dir}/#{doc[:output_file]}", create_page(doc[:content], doc[:title]) ) end copy_bootstrap end |