metanorma-mpfa 0.4.3 → 0.5.0

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: abb98fbac9c5a7d876d28998843e605d2a89c60028506ebea161b7d753b36df7
4
- data.tar.gz: 26b7e35bfa14f05b62347a094f6098e3ecab134ae54c9a935cc3f22fcdec536a
3
+ metadata.gz: 418038d116be1278ad5197e740c8f14a3675ca1371b5b25c4e3254e460c89029
4
+ data.tar.gz: 98a1c3494bbad4aa223b7c317622a6f4f4d14b8226646d09cf99db0c101e9b26
5
5
  SHA512:
6
- metadata.gz: ff249a97cd6c2998204cc99cc35a290292971c7b146c7d3e25bc090b6851cbe07e91b999f80e824a4c662225b85de2f5231fea36f23563670e35bcef0435716d
7
- data.tar.gz: 8d9750fb688092b1934068e4afa8b73c584b904f57f5a9e6f0d3b95fe25d6d9a0177b590921d50c1bb5cfec76c8ed73bd0d6503139c396ce56c2053211d954e0
6
+ metadata.gz: dcaeba12b30cd6d84050c9143f4589b0e1ca6c0353de5248c9c26f8105a33c5ba63043b016aa5946b56e860bce6af9f56a39d70c0cf5ac9a13425759652cb9e9
7
+ data.tar.gz: 6b2a9b1b2e184bf524d7be19e44098517cd83872839e2222a49d0bbad8e1888e7b93ee246a8ae575e435a659a4966c6c04bc6623effd820e814c8bf999ad6842
@@ -922,6 +922,9 @@
922
922
  <optional>
923
923
  <attribute name="script"/>
924
924
  </optional>
925
+ <optional>
926
+ <attribute name="type"/>
927
+ </optional>
925
928
  <optional>
926
929
  <attribute name="obligation">
927
930
  <choice>
@@ -961,9 +964,6 @@
961
964
  </define>
962
965
  <define name="content-subsection">
963
966
  <element name="clause">
964
- <optional>
965
- <attribute name="type"/>
966
- </optional>
967
967
  <ref name="Content-Section"/>
968
968
  </element>
969
969
  </define>
@@ -992,6 +992,9 @@
992
992
  </choice>
993
993
  </attribute>
994
994
  </optional>
995
+ <optional>
996
+ <attribute name="type"/>
997
+ </optional>
995
998
  <optional>
996
999
  <ref name="section-title"/>
997
1000
  </optional>
@@ -1011,9 +1014,6 @@
1011
1014
  </define>
1012
1015
  <define name="clause">
1013
1016
  <element name="clause">
1014
- <optional>
1015
- <attribute name="type"/>
1016
- </optional>
1017
1017
  <ref name="Clause-Section"/>
1018
1018
  </element>
1019
1019
  </define>
@@ -1042,6 +1042,9 @@
1042
1042
  </choice>
1043
1043
  </attribute>
1044
1044
  </optional>
1045
+ <optional>
1046
+ <attribute name="type"/>
1047
+ </optional>
1045
1048
  <optional>
1046
1049
  <ref name="section-title"/>
1047
1050
  </optional>
@@ -1180,6 +1183,9 @@
1180
1183
  <optional>
1181
1184
  <attribute name="script"/>
1182
1185
  </optional>
1186
+ <optional>
1187
+ <attribute name="type"/>
1188
+ </optional>
1183
1189
  <optional>
1184
1190
  <attribute name="obligation">
1185
1191
  <choice>
@@ -58,7 +58,6 @@ module Asciidoctor
58
58
  attrs[:container] = true if node.role == "container"
59
59
  super
60
60
  end
61
-
62
61
  end
63
62
  end
64
63
  end
@@ -1,51 +1,9 @@
1
1
  require "isodoc"
2
- require_relative "metadata"
3
- require_relative "xref"
4
2
  require "fileutils"
5
3
 
6
4
  module IsoDoc
7
5
  module MPFA
8
6
  module BaseConvert
9
- def metadata_init(lang, script, labels)
10
- @meta = Metadata.new(lang, script, labels)
11
- end
12
-
13
- def xref_init(lang, script, klass, labels, options)
14
- @xrefs = Xref.new(lang, script, klass, labels, options)
15
- end
16
-
17
- def annex_name(annex, name, div)
18
- div.h1 **{ class: "Annex" } do |t|
19
- t << "#{@xrefs.anchor(annex['id'], :label)} "
20
- t.b do |b|
21
- name&.children&.each { |c2| parse(c2, b) }
22
- end
23
- end
24
- end
25
-
26
- def fileloc(loc)
27
- File.join(File.dirname(__FILE__), loc)
28
- end
29
-
30
- def i18n_init(lang, script)
31
- super
32
- y = if lang == "en"
33
- YAML.load_file(File.join(File.dirname(__FILE__), "i18n-en.yaml"))
34
- elsif lang == "zh" && script == "Hans"
35
- YAML.load_file(File.join(File.dirname(__FILE__),
36
- "i18n-zh-Hans.yaml"))
37
- else
38
- YAML.load_file(File.join(File.dirname(__FILE__), "i18n-en.yaml"))
39
- end
40
- @labels = @labels.merge(y)
41
- @annex_lbl = y["annex"]
42
- @clause_lbl = y["clause"]
43
- end
44
-
45
- def terms_defs_title(f)
46
- return f&.at(ns("./title"))&.content
47
- end
48
-
49
7
  TERM_CLAUSE = "//preface/terms | "\
50
8
  "//preface/clause[descendant::terms]".freeze
51
9
 
@@ -57,7 +15,7 @@ module IsoDoc
57
15
  def terms_defs(isoxml, out, num)
58
16
  f = isoxml.at(ns(self.class::TERM_CLAUSE)) or return num
59
17
  out.div **attr_code(id: f["id"]) do |div|
60
- clause_name(nil, terms_defs_title(f), div, nil)
18
+ clause_name(nil, f&.at(ns("./title")), div, nil)
61
19
  f.elements.each do |e|
62
20
  parse(e, div) unless %w{title source}.include? e.name
63
21
  end
@@ -72,8 +30,7 @@ module IsoDoc
72
30
  if c.name == "terms" || c.at(ns(".//terms")) then terms_defs isoxml, out, 0
73
31
  else
74
32
  out.div **attr_code(id: c["id"]) do |s|
75
- clause_name(@xrefs.anchor(c['id'], :label),
76
- c&.at(ns("./title"))&.content, s, nil)
33
+ clause_name(nil, c&.at(ns("./title")), s, nil)
77
34
  c.elements.reject { |c1| c1.name == "title" }.each do |c1|
78
35
  parse(c1, s)
79
36
  end
@@ -91,6 +48,7 @@ module IsoDoc
91
48
  end
92
49
 
93
50
  def termdef_parse(node, out)
51
+ name = node&.at(ns("./name"))&.remove
94
52
  set_termdomain("")
95
53
  node.children.each { |n| parse(n, out) }
96
54
  end
@@ -98,8 +56,8 @@ module IsoDoc
98
56
  def clause(isoxml, out)
99
57
  isoxml.xpath(ns(middle_clause)).each do |c|
100
58
  out.div **attr_code(id: c["id"]) do |s|
101
- clause_name(@xrefs.anchor(c['id'], :label),
102
- c&.at(ns("./title"))&.content, s, class: c["container"] ? "containerhdr" : nil )
59
+ clause_name(nil, c&.at(ns("./title")), s,
60
+ class: c["container"] ? "containerhdr" : nil )
103
61
  c.elements.reject { |c1| c1.name == "title" }.each do |c1|
104
62
  parse(c1, s)
105
63
  end
@@ -107,17 +65,11 @@ module IsoDoc
107
65
  end
108
66
  end
109
67
 
110
- def clause_parse_title(node, div, c1, out)
111
- if node["inline-header"] == "true"
112
- inline_header_title(out, node, c1)
113
- else
114
- attrs = { class: node["container"] ? "containerhdr" : nil }
115
- div.send "h#{@xrefs.anchor(node['id'], :level, :false) || '1'}", **attr_code(attrs) do |h|
116
- lbl = @xrefs.anchor(node['id'], :label, false)
117
- h << "#{lbl}. " if lbl && !@suppressheadingnumbers
118
- c1&.children&.each { |c2| parse(c2, h) }
119
- end
120
- end
68
+ def clause_parse_title(node, div, c1, out, header_class = {})
69
+ attrs = {}
70
+ attrs = { class: "containerhdr" } if node["container"]
71
+ header_class = header_class.merge(attrs)
72
+ super
121
73
  end
122
74
 
123
75
  def ol_depth(node)
@@ -1,4 +1,5 @@
1
1
  require_relative "base_convert"
2
+ require_relative "init"
2
3
  require "isodoc"
3
4
 
4
5
  module IsoDoc
@@ -57,6 +58,8 @@ module IsoDoc
57
58
  comments div3
58
59
  end
59
60
  end
61
+
62
+ include Init
60
63
  end
61
64
  end
62
65
  end
@@ -1,2 +1,7 @@
1
1
  clause: Paragraph
2
2
  annex: Appendix
3
+ termsdef: Glossary
4
+ termsdefsymbolsabbrev: Glossary
5
+ termsdefsymbols: Glossary
6
+ termsdefabbrev: Glossary
7
+
@@ -0,0 +1,16 @@
1
+ module IsoDoc
2
+ module MPFA
3
+ class I18n < IsoDoc::I18n
4
+ def load_yaml1(lang, script)
5
+ y = if lang == "en"
6
+ YAML.load_file(File.join(File.dirname(__FILE__), "i18n-en.yaml"))
7
+ elsif lang == "zh" && script == "Hans"
8
+ YAML.load_file(File.join(File.dirname(__FILE__), "i18n-zh-Hans.yaml"))
9
+ else
10
+ YAML.load_file(File.join(File.dirname(__FILE__), "i18n-en.yaml"))
11
+ end
12
+ super.merge(y)
13
+ end
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,28 @@
1
+ require "isodoc"
2
+ require_relative "metadata"
3
+ require_relative "xref"
4
+ require_relative "i18n"
5
+
6
+ module IsoDoc
7
+ module MPFA
8
+ module Init
9
+ def metadata_init(lang, script, labels)
10
+ @meta = Metadata.new(lang, script, labels)
11
+ end
12
+
13
+ def xref_init(lang, script, klass, labels, options)
14
+ html = HtmlConvert.new(language: lang, script: script)
15
+ @xrefs = Xref.new(lang, script, html, labels, options)
16
+ end
17
+
18
+ def i18n_init(lang, script, i18nyaml = nil)
19
+ @i18n = I18n.new(lang, script, i18nyaml || @i18nyaml)
20
+ end
21
+
22
+ def fileloc(loc)
23
+ File.join(File.dirname(__FILE__), loc)
24
+ end
25
+ end
26
+ end
27
+ end
28
+
@@ -1,9 +1,18 @@
1
- require_relative "base_convert"
1
+ require_relative "init"
2
2
  require "isodoc"
3
3
 
4
4
  module IsoDoc
5
5
  module MPFA
6
6
  class PresentationXMLConvert < IsoDoc::PresentationXMLConvert
7
+ def annex1(f)
8
+ lbl = @xrefs.anchor(f['id'], :label)
9
+ if t = f.at(ns("./title"))
10
+ t.children = "<strong>#{t.children.to_xml}</strong>"
11
+ end
12
+ prefix_name(f, " ", lbl, "title")
13
+ end
14
+
15
+ include Init
7
16
  end
8
17
  end
9
18
  end
@@ -1,4 +1,5 @@
1
1
  require_relative "base_convert"
2
+ require_relative "init"
2
3
  require "isodoc"
3
4
 
4
5
  module IsoDoc
@@ -57,6 +58,8 @@ module IsoDoc
57
58
  end
58
59
  section_break(body)
59
60
  end
61
+
62
+ include Init
60
63
  end
61
64
  end
62
65
  end
@@ -15,7 +15,7 @@ module IsoDoc
15
15
  end
16
16
 
17
17
  def annex_name_lbl(clause, num)
18
- l10n("<b>#{@labels['annex']} #{num}</b>")
18
+ l10n("<strong>#{@labels['annex']} #{num}</strong>")
19
19
  end
20
20
 
21
21
  def clause_names(docxml, sect_num)
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module MPFA
3
- VERSION = "0.4.3"
3
+ VERSION = "0.5.0"
4
4
  end
5
5
  end
@@ -29,9 +29,8 @@ Gem::Specification.new do |spec|
29
29
  spec.required_ruby_version = Gem::Requirement.new(">= 2.4.0")
30
30
 
31
31
  spec.add_dependency "htmlentities", "~> 4.3.4"
32
- #spec.add_dependency "nokogiri"
33
- spec.add_dependency "metanorma-standoc", "~> 1.4.0"
34
- spec.add_dependency "isodoc", "~> 1.1.0"
32
+ spec.add_dependency "metanorma-standoc", "~> 1.5.0"
33
+ spec.add_dependency "isodoc", "~> 1.2.0"
35
34
  spec.add_dependency "twitter_cldr"
36
35
 
37
36
  spec.add_development_dependency "byebug", "~> 9.1"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metanorma-mpfa
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.3
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-07-26 00:00:00.000000000 Z
11
+ date: 2020-07-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: htmlentities
@@ -30,28 +30,28 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 1.4.0
33
+ version: 1.5.0
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: 1.4.0
40
+ version: 1.5.0
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: isodoc
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: 1.1.0
47
+ version: 1.2.0
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: 1.1.0
54
+ version: 1.2.0
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: twitter_cldr
57
57
  requirement: !ruby/object:Gem::Requirement
@@ -262,6 +262,8 @@ files:
262
262
  - lib/isodoc/mpfa/html_convert.rb
263
263
  - lib/isodoc/mpfa/i18n-en.yaml
264
264
  - lib/isodoc/mpfa/i18n-zh-Hans.yaml
265
+ - lib/isodoc/mpfa/i18n.rb
266
+ - lib/isodoc/mpfa/init.rb
265
267
  - lib/isodoc/mpfa/metadata.rb
266
268
  - lib/isodoc/mpfa/presentation_xml_convert.rb
267
269
  - lib/isodoc/mpfa/word_convert.rb