Class: IsoDoc::BSI::PresentationXMLConvert

Inherits:
Iso::PresentationXMLConvert
  • Object
show all
Includes:
Init
Defined in:
lib/isodoc/bsi/presentation_xml_convert.rb

Instance Method Summary collapse

Methods included from Init

#i18n_init, #metadata_init, #xref_init

Instance Method Details

#block(docxml) ⇒ Object



7
8
9
10
# File 'lib/isodoc/bsi/presentation_xml_convert.rb', line 7

def block(docxml)
  super
  commentary(docxml)
end

#commentary(docxml) ⇒ Object



16
17
18
19
20
# File 'lib/isodoc/bsi/presentation_xml_convert.rb', line 16

def commentary(docxml)
  docxml.xpath(ns("//admonition[@type = 'commentary']")).each do |f|
    commentary1(f)
  end
end

#commentary1(node) ⇒ Object

introduce name element



23
24
25
26
# File 'lib/isodoc/bsi/presentation_xml_convert.rb', line 23

def commentary1(node)
  n = @xrefs.get[node["id"]]
  prefix_name(node, "", n[:label].upcase, "name")
end

#eref_localities1(target, type, from, to, delim, n, lang = "en") ⇒ Object



46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# File 'lib/isodoc/bsi/presentation_xml_convert.rb', line 46

def eref_localities1(target, type, from, to, delim, n, lang = "en")
  return "" if type == "anchor"

  subsection = from&.text&.match(/\./)
  type = type.downcase
  lang == "zh" and
    return l10n(eref_localities1_zh(target, type, from, to, n, delim))
  ret = if delim == ";"
          ";"
        else
          type == "list" ? "" : delim
        end
  ret += eref_locality_populate(type, n) unless subsection &&
    type == "clause" || type == "list" ||
    target.match(/^IEV$|^IEC 60050-/)
  range = " #{from.text}" if from
  range += "–#{to.text}" if to
  range &&= "<strong>#{range}</strong>" if type == "clause"
  ret += " #{range}"
  ret += ")" if type == "list"
  l10n(ret)
end

#eref_localities1_zh(target, type, from, to, n, delim) ⇒ Object



28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/isodoc/bsi/presentation_xml_convert.rb', line 28

def eref_localities1_zh(target, type, from, to, n, delim)
  subsection = from&.text&.match(/\./)
  ret = if delim == ";"
          ";"
        else
          type == "list" ? "" : delim
        end
  ret += "#{from.text}" if from
  ret += "&ndash;#{to.text}" if to
  ret = "<strong>#{ret}</strong>" if type == "clause"
  loc = (@i18n.locality[type] || type.sub(/^locality:/, "").capitalize)
  ret += " #{loc}" unless subsection && type == "clause" ||
    type == "list" || target.match(/^IEV$|^IEC 60050-/) ||
    n["droploc"] == "true"
  ret += ")" if type == "list"
  ret
end

#termnote1(termnote) ⇒ Object



12
13
14
# File 'lib/isodoc/bsi/presentation_xml_convert.rb', line 12

def termnote1(termnote)
  note1(termnote)
end