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
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/qdoc.rb', line 17 def initialize( = {} ) defaults = { output_directory: "doc", index_content: "Choose from the list.", target_extensions: %w(md rc html), bootstrap: :local, bootstrap_version: :v3 } = 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) @bootstrap_version = [:bootstrap_version] case @bootstrap_version when :v4 @bootstrap_cdn = BOOTSTRAPv4_CDN else @bootstrap_cdn = BOOTSTRAP_CDN end end |
Instance Method Details
#run ⇒ Object
Causes QDoc to search the current directory and tree, and parse found files
41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/qdoc.rb', line 41 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 |