= isodoc
image:https://img.shields.io/gem/v/isodoc.svg["Gem Version", link="https://rubygems.org/gems/isodoc"]
image:https://img.shields.io/travis/riboseinc/asciidoctor-iso/master.svg["Build Status", link="https://travis-ci.org/riboseinc/isodoc"]
image:https://codeclimate.com/github/riboseinc/isodoc/badges/gpa.svg["Code Climate", link="https://codeclimate.com/github/riboseinc/isodoc"]
This Gem converts documents in the https://github.com/riboseinc/isodoc-models[ISODoc document model] into HTML and Microsoft Word.
The Gem contains two classes, `IsoDoc::Convert` (for HTML output) and `IsoDoc::WordConvert` (for Word output). They are initialised with the following rendering parameters:
i18nyaml:: YAML file giving internationalisation equivalents for keywords in rendering output; see https://github.com/riboseinc/asciidoctor-iso#document-attributes for further documentation
bodyfont:: Font for body text
headerfont:: Font for header text
monospacefont:: Font for monospace text
titlefont:: Font for document title text (currently used only in GB)
script:: The ISO 15924 code for the main script that the standard document is in; used to pick the default fonts for the document
alt:: Generate alternate rendering (currently used only in ISO)
The IsoDoc gem classes themselves are abstract (though their current implementation contains rendering specific to the ISO standard.) Subclasses of the Isodoc gem classes are specific to different standards, and are associated with templates and stylesheets speciific to the rendering of those standards. Subclasses also provide the default values for the rendering parameters above; they should be used only as overrides.
e.g.
[source,ruby]
--
IsoDoc::Convert::Iso.new(
bodyfont: "Zapf Chancery",
headerfont: "Comic Sans",
monospacefont: "Andale Mono",
alt: true,
script: "Hans",
i18nyaml: "i18n-en.yaml"
)
--
The conversion takes place with a `convert` method, with three arguments: the filename to be used for the output (once its file type suffix is stripped), the XML document string to be converted (optional), and a "debug" argument (optional), which stops execution before the output file is generated. If the document string is nil, its contents are read in from the filename provided. So:
[source,ruby]
--
IsoDoc::Iso::Convert.new({}).convert("test.xml") # generates test.html
IsoDoc::Iso::WordConvert.new({script: "Hans"}).convert("test.xml") # generates test.doc, with Chinese font defaults rather than Roman
IsoDoc::Iso::Convert.new({}).convert("test", File.read("file1.xml")) # generates test.html, based on file1.xml
IsoDoc::Iso::Convert.new({}).convert("test", <<~"INPUT", true)
These results are based on a
study carried out on three different types of kernel.
`, not `
`.