Module: IsoDoc::NIST::Init
- Included in:
- HtmlConvert, PresentationXMLConvert, WordConvert
- Defined in:
- lib/isodoc/nist/init.rb
Instance Method Summary collapse
- #fileloc(loc) ⇒ Object
- #i18n_init(lang, script, i18nyaml = nil) ⇒ Object
- #metadata_init(lang, script, labels) ⇒ Object
- #suppress_biblio_title(node) ⇒ Object
- #xref_init(lang, script, _klass, labels, options) ⇒ Object
Instance Method Details
#fileloc(loc) ⇒ Object
21 22 23 |
# File 'lib/isodoc/nist/init.rb', line 21 def fileloc(loc) File.join(File.dirname(__FILE__), loc) end |
#i18n_init(lang, script, i18nyaml = nil) ⇒ Object
17 18 19 |
# File 'lib/isodoc/nist/init.rb', line 17 def i18n_init(lang, script, i18nyaml = nil) @i18n = I18n.new(lang, script, i18nyaml || @i18nyaml) end |
#metadata_init(lang, script, labels) ⇒ Object
9 10 11 |
# File 'lib/isodoc/nist/init.rb', line 9 def (lang, script, labels) = Metadata.new(lang, script, labels) end |
#suppress_biblio_title(node) ⇒ Object
25 26 27 28 29 30 31 32 33 |
# File 'lib/isodoc/nist/init.rb', line 25 def suppress_biblio_title(node) return false unless node.parent.name == "annex" return false if node.parent.xpath("./references | ./clause | "\ "./terms | ./definitions").size > 1 title1 = node&.at(ns("./title"))&.text&.sub(/^[A-Z]\.(\d+\.)*/, "") return true unless title1 && !title1.empty? title2 = node&.parent&.at(ns("./title"))&.text&.sub(/^.*?— /, "") title1&.casecmp(title2) == 0 end |
#xref_init(lang, script, _klass, labels, options) ⇒ Object
13 14 15 |
# File 'lib/isodoc/nist/init.rb', line 13 def xref_init(lang, script, _klass, labels, ) @xrefs = Xref.new(lang, script, HtmlConvert.new(language: lang, script: script), labels, ) end |