Module: IsoDoc::JIS::BaseConvert

Included in:
HtmlConvert, WordConvert
Defined in:
lib/isodoc/jis/base_convert.rb

Instance Method Summary collapse

Instance Method Details

#admonition_name_parse(_node, div, name) ⇒ Object



89
90
91
92
93
94
# File 'lib/isodoc/jis/base_convert.rb', line 89

def admonition_name_parse(_node, div, name)
  div.span class: "note_label" do |s|
    name.children.each { |n| parse(n, s) }
    s << " &#x2014; "
  end
end

#annex(isoxml, out) ⇒ Object



119
120
121
122
123
124
125
126
127
128
129
130
131
132
# File 'lib/isodoc/jis/base_convert.rb', line 119

def annex(isoxml, out)
  amd(isoxml) and @suppressheadingnumbers = @oldsuppressheadingnumbers
  isoxml.xpath(ns("//annex[not(@commentary = 'true')]")).each do |c|
    page_break(out)
    out.div **attr_code(annex_attrs(c)) do |s|
      c.elements.each do |c1|
        if c1.name == "title" then annex_name(c, c1, s)
        else parse(c1, s)
        end
      end
    end
  end
  amd(isoxml) and @suppressheadingnumbers = true
end

#commentary(isoxml, out) ⇒ Object



134
135
136
137
138
139
140
141
142
143
144
145
# File 'lib/isodoc/jis/base_convert.rb', line 134

def commentary(isoxml, out)
  isoxml.xpath(ns("//annex[@commentary = 'true']")).each do |c|
    page_break(out)
    out.div **attr_code(annex_attrs(c)) do |s|
      c.elements.each do |c1|
        if c1.name == "title" then annex_name(c, c1, s)
        else parse(c1, s)
        end
      end
    end
  end
end

#commentary_title(_isoxml, out) ⇒ Object



59
60
61
62
# File 'lib/isodoc/jis/base_convert.rb', line 59

def commentary_title(_isoxml, out)
  commentary_title_hdr(out)
  middle_title_main(out, "CommentaryStandardName")
end

#commentary_title_hdr(out) ⇒ Object



64
65
66
67
68
69
70
71
72
# File 'lib/isodoc/jis/base_convert.rb', line 64

def commentary_title_hdr(out)
  out.p(class: "CommentaryStandardNumber") do |p|
    p << "JIS #{@meta.get[:docnumber_undated]}"
    if yr = @meta.get[:docyear]
      p << ": "
      p << "<span class='CommentaryEffectiveYear'>#{yr}</span>"
    end
  end
end

#make_tr_attr(cell, row, totalrows, header, bordered) ⇒ Object



100
101
102
103
# File 'lib/isodoc/jis/base_convert.rb', line 100

def make_tr_attr(cell, row, totalrows, header, bordered)
  cell["border"] == "0" and bordered = false
  super
end

#middle(isoxml, out) ⇒ Object



105
106
107
108
109
110
111
112
113
114
115
116
117
# File 'lib/isodoc/jis/base_convert.rb', line 105

def middle(isoxml, out)
  middle_title(isoxml, out)
  middle_admonitions(isoxml, out)
  i = isoxml.at(ns("//sections/introduction")) and
    introduction i, out
  scope isoxml, out, 0
  norm_ref isoxml, out, 0
  clause_etc isoxml, out, 0
  annex isoxml, out
  bibliography isoxml, out
  commentary isoxml, out
  indexsect isoxml, out
end

#middle_subtitle_main(out) ⇒ Object



45
46
47
48
49
50
51
52
53
54
55
56
57
# File 'lib/isodoc/jis/base_convert.rb', line 45

def middle_subtitle_main(out)
  @meta.get[:docsubtitlemain] or return
  out.p(class: "zzSTDTitle2") do |p|
    p << @meta.get[:docsubtitleintro]
    p << " &#x2014; " if @meta.get[:docsubtitleintro] && @meta.get[:docsubtitlemain]
    p << @meta.get[:docsubtitlemain]
    p << " &#x2014; " if @meta.get[:docsubtitlemain] && @meta.get[:docsubtitlepart]
  end
  a = @meta.get[:docsubtitlepart] and out.p(class: "zzSTDTitle2") do |p|
    b = @meta.get[:docsubtitlepartlabel] and p << "#{b}: "
    p << "<br/><b>#{a}</b>"
  end
end

#middle_title(_isoxml, out) ⇒ Object



7
8
9
10
11
12
# File 'lib/isodoc/jis/base_convert.rb', line 7

def middle_title(_isoxml, out)
  middle_title_hdr(out)
  middle_title_main(out, "zzSTDTitle1")
  middle_subtitle_main(out)
  # middle_title_amd(out)
end

#middle_title_hdr(out) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/isodoc/jis/base_convert.rb', line 14

def middle_title_hdr(out)
  out.p(class: "JapaneseIndustrialStandard") do |p|
    p << @i18n.jis
    @meta.get[:unpublished] and p << @i18n.l10n("(#{@i18n.draft_label})")
    insert_tab(p, 7)
    p << "<span class='JIS'>JIS</span>"
  end
  out.p(class: "StandardNumber") do |p|
    insert_tab(p, 1)
    p << @meta.get[:docnumber_undated]
    if yr = @meta.get[:docyear]
      p << ": "
      p << "<span class='EffectiveYear'>#{yr}</span>"
    end
  end
  out.p(class: "IDT")
end

#middle_title_main(out, style) ⇒ Object



32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/isodoc/jis/base_convert.rb', line 32

def middle_title_main(out, style)
  out.p(class: style) do |p|
    p << @meta.get[:doctitleintro]
    p << " &#x2014; " if @meta.get[:doctitleintro] && @meta.get[:doctitlemain]
    p << @meta.get[:doctitlemain]
    p << " &#x2014; " if @meta.get[:doctitlemain] && @meta.get[:doctitlepart]
  end
  a = @meta.get[:doctitlepart] and out.p(class: "zzSTDTitle1") do |p|
    b = @meta.get[:doctitlepartlabel] and p << "#{b}: "
    p << "<br/><b>#{a}</b>"
  end
end

#para_class(node) ⇒ Object



96
97
98
# File 'lib/isodoc/jis/base_convert.rb', line 96

def para_class(node)
  super || node["class"]
end

#termnote_parse(node, out) ⇒ Object



74
75
76
77
78
79
80
81
82
83
84
85
86
87
# File 'lib/isodoc/jis/base_convert.rb', line 74

def termnote_parse(node, out)
  name = node.at(ns("./name"))&.remove
  out.div **note_attrs(node) do |div|
    div.p do |p|
      if name
        p.span class: "note_label" do |s|
          name.children.each { |n| parse(n, s) }
        end
        p << termnote_delim
      end
      para_then_remainder(node.first_element_child, node, p, div)
    end
  end
end