Module: IsoDoc::Generic::BaseConvert
- Included in:
- HtmlConvert, PdfConvert, WordConvert
- Defined in:
- lib/isodoc/generic/base_convert.rb
Instance Method Summary collapse
- #annex_name(annex, name, div) ⇒ Object
- #baselocation(loc) ⇒ Object
- #cleanup(docxml) ⇒ Object
- #fileloc(loc) ⇒ Object
- #i18n_init(lang, script) ⇒ Object
- #info(isoxml, out) ⇒ Object
- #make_body(xml, docxml) ⇒ Object
- #metadata_init(lang, script, labels) ⇒ Object
- #term_cleanup(docxml) ⇒ Object
- #xref_init(lang, script, klass, labels, options) ⇒ Object
Instance Method Details
#annex_name(annex, name, div) ⇒ Object
22 23 24 25 26 27 28 29 30 |
# File 'lib/isodoc/generic/base_convert.rb', line 22 def annex_name(annex, name, div) div.h1 **{ class: "Annex" } do |t| t << "#{@xrefs.anchor(annex['id'], :label)} " t.br t.b do |b| name&.children&.each { |c2| parse(c2, b) } end end end |
#baselocation(loc) ⇒ Object
17 18 19 20 |
# File 'lib/isodoc/generic/base_convert.rb', line 17 def baselocation(loc) return nil if loc.nil? File.(File.join(File.dirname(self.class::_file || __FILE__), "..", "..", "..", loc)) end |
#cleanup(docxml) ⇒ Object
40 41 42 43 |
# File 'lib/isodoc/generic/base_convert.rb', line 40 def cleanup(docxml) super term_cleanup(docxml) end |
#fileloc(loc) ⇒ Object
36 37 38 |
# File 'lib/isodoc/generic/base_convert.rb', line 36 def fileloc(loc) File.join(File.dirname(__FILE__), loc) end |
#i18n_init(lang, script) ⇒ Object
32 33 34 |
# File 'lib/isodoc/generic/base_convert.rb', line 32 def i18n_init(lang, script) super end |
#info(isoxml, out) ⇒ Object
63 64 65 66 |
# File 'lib/isodoc/generic/base_convert.rb', line 63 def info(isoxml, out) .ext isoxml, out super end |
#make_body(xml, docxml) ⇒ Object
54 55 56 57 58 59 60 61 |
# File 'lib/isodoc/generic/base_convert.rb', line 54 def make_body(xml, docxml) body_attr = { lang: "EN-US", link: "blue", vlink: "#954F72", "xml:lang": "EN-US", class: "container" } xml.body **body_attr do |body| make_body1(body, docxml) make_body2(body, docxml) make_body3(body, docxml) end end |
#metadata_init(lang, script, labels) ⇒ Object
9 10 11 |
# File 'lib/isodoc/generic/base_convert.rb', line 9 def (lang, script, labels) = Metadata.new(lang, script, labels) end |
#term_cleanup(docxml) ⇒ Object
45 46 47 48 49 50 51 52 |
# File 'lib/isodoc/generic/base_convert.rb', line 45 def term_cleanup(docxml) docxml.xpath("//p[@class = 'Terms']").each do |d| h2 = d.at("./preceding-sibling::*[@class = 'TermNum'][1]") h2.add_child(" ") h2.add_child(d.remove) end docxml end |
#xref_init(lang, script, klass, labels, options) ⇒ Object
13 14 15 |
# File 'lib/isodoc/generic/base_convert.rb', line 13 def xref_init(lang, script, klass, labels, ) @xrefs = Xref.new(lang, script, klass, labels, ) end |