Class: Docbook::Output::Formats::InlineFormat
Constant Summary
Constants inherited
from BaseFormat
BaseFormat::DEFAULT_DIST_DIR
Instance Attribute Summary
Attributes inherited from BaseFormat
#dist_dir
Instance Method Summary
collapse
Methods inherited from BaseFormat
default_dist_dir, #initialize
Instance Method Details
#write(output_path, guide, title: "DocBook", _manifest: nil) ⇒ Object
11
12
13
14
15
16
17
18
|
# File 'lib/docbook/output/formats/inline_format.rb', line 11
def write(output_path, guide, title: "DocBook", _manifest: nil)
FileUtils.mkdir_p(File.dirname(output_path))
data_script = "window.DOCBOOK_DATA = #{safe_json(guide)};"
html = html_boilerplate(title: title, body_content: '<div id="docbook-app"></div>',
script_data: data_script)
File.write(output_path, html)
output_path
end
|
#write_library(output_path, guides, manifest:, title: nil) ⇒ Object
20
21
22
23
24
25
26
27
28
29
|
# File 'lib/docbook/output/formats/inline_format.rb', line 20
def write_library(output_path, guides, manifest:, title: nil)
title ||= manifest.name || "DocBook Library"
collection_data = build_collection_data(guides, manifest)
data_script = "window.DOCBOOK_COLLECTION = #{safe_json(collection_data)};"
html = html_boilerplate(title: title, body_content: '<div id="docbook-app"></div>',
script_data: data_script)
FileUtils.mkdir_p(File.dirname(output_path))
File.write(output_path, html)
output_path
end
|