Class: QDoc
- Inherits:
-
Object
- Object
- QDoc
- Defined in:
- lib/qdoc.rb
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 [options#bootstratp] :local (default) copies the local file, otherwise CDN stylesheet is used.
-
#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
- options#bootstratp
-
:local (default) copies the local file, otherwise CDN stylesheet is used
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/qdoc.rb', line 14 def initialize( = {} ) defaults = { output_directory: "doc", index_content: "Choose from the list.", target_extensions: %w(md rc html), bootstrap: :local } = 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) @bootstrap_local = ([:bootstrap] == :local) end |
Instance Method Details
#run ⇒ Object
Causes QDoc to search the current directory and tree, and parse found files
31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/qdoc.rb', line 31 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 |