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



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

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

#clausedelimObject



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

def clausedelim
  ""
end

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



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

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

#metadata_init(lang, script, locale, i18n) ⇒ Object



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

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

#requirements_processorObject



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

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

#std_docid_semantic(id) ⇒ Object



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

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 std_docid_semantic_full(i)
    end
  end.join(" ")
end

#std_docid_semantic_full(ident) ⇒ Object



48
49
50
51
52
53
54
# File 'lib/isodoc/iso/init.rb', line 48

def std_docid_semantic_full(ident)
  ident
    .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

#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