metanorma-jis 0.3.7 → 0.4.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 143689fe642bbafd3b997d46a587850eec0af4af80a0f30e302cfa2451c9cff1
4
- data.tar.gz: c4f55a36d8c9279500128f725553473180c6574c44657e326990b5bfcc4fd74d
3
+ metadata.gz: 69d84c2a4a93bd07e8cc03bb17f85b74d5240fe452a221f51633879b49619c59
4
+ data.tar.gz: 0af70c6c8597a621929ba2c67479f1b4eee6c9cd6543f34d5e20bb6c8508a2b7
5
5
  SHA512:
6
- metadata.gz: dc0aba1f4821abc37de307e0fc9a2d7b0323a0c3508efcf345c6617c5b0c61ec177f08c87d0fc96676750038e18e985f90ff202ee1bc0d3c1e25b0af6e905480
7
- data.tar.gz: 52d7c1db05596ebae3eac257c6da53394c361c18e93ff1bc5964f304983c24ea33b58f4b7c6d60760ec4814bef052a7706a3ec0a1e022ddffba2eb313c6220e5
6
+ metadata.gz: ce10805206a513ac7b8a60a309347d509cdca78d7b6ac42fe9793b2c483c3e33dd671c06539a5c9339cd3dc3df5e85ca903e44821cc9d889514c297255ee7d27
7
+ data.tar.gz: 1abd0d8a03a44699f47f7c5724c2478cd819dcf97cb90e7d67de677585b3e5e0a3aa28bd80496244429677ac0be702f050d4779af60031e0eb2502fb1b7b7953
@@ -4,7 +4,8 @@ require "metanorma-iso"
4
4
  module IsoDoc
5
5
  module Jis
6
6
  module BaseConvert
7
- def termnote_parse(node, out)
7
+ # KILL
8
+ def termnote_parsex(node, out)
8
9
  name = node.at(ns("./name"))&.remove
9
10
  out.div **note_attrs(node) do |div|
10
11
  div.p do |p|
@@ -12,20 +13,13 @@ module IsoDoc
12
13
  p.span class: "note_label" do |s|
13
14
  name.children.each { |n| parse(n, s) }
14
15
  end
15
- p << termnote_delim
16
+ p << " "
16
17
  end
17
18
  para_then_remainder(node.first_element_child, node, p, div)
18
19
  end
19
20
  end
20
21
  end
21
22
 
22
- def admonition_name_parse(_node, div, name)
23
- div.span class: "note_label" do |s|
24
- name.children.each { |n| parse(n, s) }
25
- s << " &#x2014; "
26
- end
27
- end
28
-
29
23
  def make_tr_attr(cell, row, totalrows, header, bordered)
30
24
  cell["border"] == "0" and bordered = false
31
25
  super
@@ -37,7 +31,7 @@ module IsoDoc
37
31
  page_break(out)
38
32
  out.div **attr_code(annex_attrs(node)) do |s|
39
33
  node.elements.each do |c1|
40
- if c1.name == "title" then annex_name(node, c1, s)
34
+ if c1.name == "fmt-title" then annex_name(node, c1, s)
41
35
  else parse(c1, s) end
42
36
  end
43
37
  end
@@ -48,7 +42,7 @@ module IsoDoc
48
42
  page_break(out)
49
43
  out.div **attr_code(annex_attrs(node)) do |s|
50
44
  node.elements.each do |c1|
51
- if c1.name == "title" then annex_name(node, c1, s)
45
+ if c1.name == "fmt-title" then annex_name(node, c1, s)
52
46
  else parse(c1, s)
53
47
  end
54
48
  end
@@ -57,7 +51,7 @@ module IsoDoc
57
51
 
58
52
  def table_parse(node, out)
59
53
  cols = table_cols_count(node)
60
- name = node.at(ns("./name"))
54
+ name = node.at(ns("./fmt-name"))
61
55
  thead = table_thead_pt(node, name)
62
56
  table_name(name, thead, cols)
63
57
  super
@@ -90,9 +84,10 @@ module IsoDoc
90
84
 
91
85
  def table_name(name, thead, cols)
92
86
  name or return
93
- thead.children.first.previous =
94
- full_row(cols, "<p class='TableTitle' style='text-align:center;'> " \
95
- "#{name.remove.children.to_xml}</p>")
87
+ thead.add_first_child full_row(
88
+ cols, "<p class='TableTitle' style='text-align:center;'> " \
89
+ "#{name.remove.children.to_xml}</p>"
90
+ )
96
91
  end
97
92
 
98
93
  def table_note_cleanup(docxml)
@@ -14,7 +14,7 @@ module IsoDoc
14
14
  { units: node.at(ns("./note[@type = 'units']")),
15
15
  notes_etc: figure_notes_examples_paras(node
16
16
  .xpath(ns("./note[not(@type = 'units')] | ./example | ./p"))),
17
- name: node.at(ns("./name")),
17
+ name: node.at(ns("./fmt-name")),
18
18
  key: node.xpath(ns("./p[@class = 'ListTitle' or @class = 'dl']")),
19
19
  img: node.at(ns("./image")),
20
20
  aside: node.at(ns("./aside")),
@@ -1393,7 +1393,7 @@ div.Note table.dl {
1393
1393
  font-size: {{smallerfontsize}};
1394
1394
  margin-left: 1.0cm; }
1395
1395
 
1396
- span.note_label, span.example_label, td.example_label, td.note_label {
1396
+ span.note_label, span.example_label, td.example_label, td.note_label, span.termnote_label, td.termnote_label {
1397
1397
  font-size: {{smallerfontsize}};
1398
1398
  font-family: {{headerfont}}; }
1399
1399
 
@@ -1352,7 +1352,7 @@ div.Note table.dl {
1352
1352
  margin-left: 1.0cm;
1353
1353
  }
1354
1354
 
1355
- span.note_label, span.example_label, td.example_label, td.note_label
1355
+ span.note_label, span.example_label, td.example_label, td.note_label, span.termnote_label, td.termnote_label
1356
1356
  {
1357
1357
  font-size: $smallerfontsize;
1358
1358
  font-family:$headerfont;
@@ -35,12 +35,14 @@ module IsoDoc
35
35
  }
36
36
  end
37
37
 
38
+ # TODO to Presentation XML
38
39
  def make_table_footnote_target(out, fnid, fnref)
39
40
  attrs = { id: fnid, class: "TableFootnoteRef" }
40
41
  out.span do |s|
42
+ # TODO to Presentation XML
41
43
  s << @i18n.table_footnote
42
44
  out.span **attrs do |a|
43
- a << "#{fnref})"
45
+ a << fnref
44
46
  end
45
47
  insert_tab(s, 1)
46
48
  end
@@ -10,9 +10,8 @@ module IsoDoc
10
10
  end
11
11
 
12
12
  def xref_init(lang, script, _klass, labels, options)
13
- @xrefs = Xref.new(lang, script,
14
- HtmlConvert.new(language: lang, script: script),
15
- labels, options)
13
+ p = HtmlConvert.new(language: lang, script: script)
14
+ @xrefs = Xref.new(lang, script, p, labels, options)
16
15
  end
17
16
 
18
17
  def i18n_init(lang, script, locale, i18nyaml = nil)
@@ -21,19 +20,21 @@ module IsoDoc
21
20
  end
22
21
 
23
22
  def bibrenderer(options = {})
24
- ::Relaton::Render::Jis::General.new(options.merge(language: @lang,
25
- i18nhash: @i18n.get))
26
- end
27
-
28
- def omit_docid_prefix(prefix)
29
- return true if prefix.nil? || prefix.empty?
30
-
31
- super || %w(JIS).include?(prefix)
23
+ ::Relaton::Render::Jis::General.new(options
24
+ .merge(language: @lang, i18nhash: @i18n.get))
32
25
  end
33
26
 
34
27
  def std_docid_semantic(text)
35
28
  text
36
29
  end
30
+
31
+ def convert_i18n_init1(docxml)
32
+ b = docxml.at("//xmlns:bibdata") or return
33
+ lang = docxml.at("//xmlns:bibdata/xmlns:language") ||
34
+ (docxml << "<language/>")
35
+ %w(en ja).include?(lang&.text) or lang.content = "ja"
36
+ super
37
+ end
37
38
  end
38
39
  end
39
40
  end