Module: IsoDoc::Iso::Init

Included in:
HtmlConvert, PresentationXMLConvert, WordConvert
Defined in:
lib/isodoc/iso/init.rb

Instance Method Summary collapse

Instance Method Details

#amd(docxml) ⇒ Object



22
23
24
25
# File 'lib/isodoc/iso/init.rb', line 22

def amd(docxml)
  doctype = docxml&.at(ns("//bibdata/ext/doctype"))&.text
  %w(amendment technical-corrigendum).include? doctype
end

#clausedelimObject



27
28
29
# File 'lib/isodoc/iso/init.rb', line 27

def clausedelim
  ""
end

#i18n_init(lang, script, i18nyaml = nil) ⇒ Object



18
19
20
# File 'lib/isodoc/iso/init.rb', line 18

def i18n_init(lang, script, i18nyaml = nil)
  @i18n = I18n.new(lang, script, i18nyaml: i18nyaml || @i18nyaml)
end

#metadata_init(lang, script, i18n) ⇒ Object



9
10
11
# File 'lib/isodoc/iso/init.rb', line 9

def (lang, script, i18n)
  @meta = Metadata.new(lang, script, i18n)
end

#requirements_processorObject



31
32
33
# File 'lib/isodoc/iso/init.rb', line 31

def requirements_processor
  ::Metanorma::Requirements::Iso
end

#std_docid_semantic(id) ⇒ Object



35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/isodoc/iso/init.rb', line 35

def std_docid_semantic(id)
  return nil if id.nil?

  ids = id.split(/ /)
  ids.map! do |i|
    if %w(GUIDE TR TS DIR).include?(i)
      "<span class='stddocNumber'>#{i}</span>"
    else
      i.sub(/^([^0-9]+)(\s|$)/, "<span class='stdpublisher'>\\1</span>\\2")
        .sub(/([0-9]+)/, "<span class='stddocNumber'>\\1</span>")
        .sub(/-([0-9]+)/, "-<span class='stddocPartNumber'>\\1</span>")
        .sub(/:([0-9]{4})(?!\d)/, ":<span class='stdyear'>\\1</span>")
    end
  end.join(" ")
end

#xref_init(lang, script, _klass, i18n, options) ⇒ Object



13
14
15
16
# File 'lib/isodoc/iso/init.rb', line 13

def xref_init(lang, script, _klass, i18n, options)
  html = HtmlConvert.new(language: lang, script: script)
  @xrefs = Xref.new(lang, script, html, i18n, options)
end