isodoc 3.1.6 → 3.1.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. checksums.yaml +4 -4
  2. data/lib/isodoc/css_border_parser.rb +229 -0
  3. data/lib/isodoc/css_border_parser_vars.rb +211 -0
  4. data/lib/isodoc/function/blocks.rb +1 -1
  5. data/lib/isodoc/function/blocks_example_note.rb +0 -2
  6. data/lib/isodoc/function/footnotes.rb +2 -1
  7. data/lib/isodoc/function/section.rb +6 -2
  8. data/lib/isodoc/function/section_titles.rb +2 -2
  9. data/lib/isodoc/function/terms.rb +1 -1
  10. data/lib/isodoc/function/to_word_html.rb +2 -0
  11. data/lib/isodoc/function/utils.rb +6 -15
  12. data/lib/isodoc/html_function/postprocess.rb +1 -2
  13. data/lib/isodoc/html_function/postprocess_cover.rb +14 -5
  14. data/lib/isodoc/init.rb +12 -3
  15. data/lib/isodoc/presentation_function/autonum.rb +4 -3
  16. data/lib/isodoc/presentation_function/block.rb +14 -1
  17. data/lib/isodoc/presentation_function/concepts.rb +17 -11
  18. data/lib/isodoc/presentation_function/docid.rb +2 -1
  19. data/lib/isodoc/presentation_function/erefs.rb +1 -1
  20. data/lib/isodoc/presentation_function/image.rb +1 -2
  21. data/lib/isodoc/presentation_function/inline.rb +13 -7
  22. data/lib/isodoc/presentation_function/math.rb +19 -23
  23. data/lib/isodoc/presentation_function/section.rb +11 -10
  24. data/lib/isodoc/presentation_function/terms.rb +34 -12
  25. data/lib/isodoc/presentation_function/title.rb +1 -2
  26. data/lib/isodoc/presentation_function/xrefs.rb +2 -2
  27. data/lib/isodoc/presentation_xml_convert.rb +3 -0
  28. data/lib/isodoc/version.rb +1 -1
  29. data/lib/isodoc/word_function/comments.rb +1 -2
  30. data/lib/isodoc/word_function/inline.rb +1 -1
  31. data/lib/isodoc/word_function/postprocess.rb +0 -1
  32. data/lib/isodoc/xref/xref_gen_seq.rb +5 -30
  33. data/lib/isodoc/xref/xref_sect_asset.rb +44 -0
  34. data/lib/isodoc/xref/xref_sect_gen.rb +39 -37
  35. data/lib/isodoc/xref/xref_util.rb +28 -1
  36. data/lib/isodoc-yaml/i18n-ar.yaml +1 -0
  37. data/lib/isodoc-yaml/i18n-de.yaml +1 -0
  38. data/lib/isodoc-yaml/i18n-en.yaml +1 -0
  39. data/lib/isodoc-yaml/i18n-es.yaml +1 -0
  40. data/lib/isodoc-yaml/i18n-fr.yaml +1 -0
  41. data/lib/isodoc-yaml/i18n-ja.yaml +1 -0
  42. data/lib/isodoc-yaml/i18n-ru.yaml +1 -0
  43. data/lib/isodoc-yaml/i18n-zh-Hans.yaml +1 -0
  44. data/lib/isodoc.rb +1 -1
  45. metadata +5 -2
@@ -1,4 +1,5 @@
1
1
  require_relative "clause_order"
2
+ require_relative "xref_sect_asset"
2
3
 
3
4
  module IsoDoc
4
5
  module XrefGen
@@ -58,22 +59,6 @@ module IsoDoc
58
59
  end
59
60
  end
60
61
 
61
- # preempt clause notes with all other types of note (ISO default)
62
- def asset_anchor_names(doc)
63
- (@parse_settings.empty? || @parse_settings[:assets]) or return
64
- middle_section_asset_names(doc)
65
- termnote_anchor_names(doc)
66
- termexample_anchor_names(doc)
67
- note_anchor_names(doc.xpath(ns("//table | //figure")))
68
- sections = doc.xpath(ns(sections_xpath))
69
- note_anchor_names(sections)
70
- admonition_anchor_names(sections)
71
- example_anchor_names(sections)
72
- list_anchor_names(sections)
73
- deflist_anchor_names(sections)
74
- bookmark_anchor_names(doc)
75
- end
76
-
77
62
  def clause_title(clause, use_elem_name: false)
78
63
  ret = clause.at(ns("./title"))&.text
79
64
  if use_elem_name && ret.blank?
@@ -83,9 +68,6 @@ module IsoDoc
83
68
  end
84
69
  end
85
70
 
86
- SUBCLAUSES =
87
- "./clause | ./references | ./term | ./terms | ./definitions".freeze
88
-
89
71
  # in StanDoc, prefaces have no numbering; they are referenced only by title
90
72
  def preface_names(clause)
91
73
  unnumbered_names(clause)
@@ -103,7 +85,7 @@ module IsoDoc
103
85
  clause.nil? and return
104
86
  title = clause_title(clause, use_elem_name: true)
105
87
  preface_name_anchors(clause, 1, title)
106
- clause.xpath(ns(SUBCLAUSES)).each_with_index do |c, i|
88
+ clause.xpath(ns(subclauses)).each_with_index do |c, i|
107
89
  t = c.at(ns("./title"))
108
90
  tt = "#{semx(clause, title, clause.name)}" \
109
91
  "<span class='fmt-comma'>,</span> #{semx(c, i + 1)}"
@@ -114,7 +96,7 @@ module IsoDoc
114
96
  def preface_names1(clause, title, parent_title, level)
115
97
  label = title || parent_title
116
98
  preface_name_anchors(clause, level, title || parent_title)
117
- clause.xpath(ns(SUBCLAUSES)).each_with_index do |c, i|
99
+ clause.xpath(ns(subclauses)).each_with_index do |c, i|
118
100
  t = c.at(ns("./title"))
119
101
  preface_names1(c, t ? semx(c, t.text, c.name) : nil,
120
102
  "#{label} #{semx(c, i + 1)}",
@@ -131,20 +113,12 @@ module IsoDoc
131
113
  type: "clause", elem: @labels["clause"] }
132
114
  end
133
115
 
134
- def middle_section_asset_names(doc)
135
- middle_sections =
136
- "//clause[@type = 'scope'] | #{@klass.norm_ref_xpath} | " \
137
- "//sections/terms | //preface/* | " \
138
- "//sections/definitions | //clause[parent::sections]"
139
- sequential_asset_names(doc.xpath(ns(middle_sections)))
140
- end
141
-
142
116
  def section_names(clause, num, lvl)
143
117
  unnumbered_section_name?(clause) and return num
144
118
  num.increment(clause)
145
119
  lbl = semx(clause, num.print)
146
120
  section_name_anchors(clause, lbl, lvl)
147
- clause.xpath(ns(SUBCLAUSES))
121
+ clause.xpath(ns(subclauses))
148
122
  .each_with_object(clause_counter(0)) do |c, i|
149
123
  section_names1(c, lbl, i.increment(c).print, lvl + 1)
150
124
  end
@@ -153,12 +127,12 @@ module IsoDoc
153
127
 
154
128
  def clause_number_semx(parentnum, clause, num)
155
129
  if clause["branch-number"]
156
- semx(clause, clause["branch-number"])
130
+ semx(clause, clause["branch-number"])
157
131
  elsif parentnum.nil?
158
132
  semx(clause, num)
159
- else
160
- "#{parentnum}#{delim_wrap(clausesep)}#{semx(clause, num)}"
161
- end
133
+ else
134
+ "#{parentnum}#{delim_wrap(clausesep)}#{semx(clause, num)}"
135
+ end
162
136
  end
163
137
 
164
138
  def section_names1(clause, parentnum, num, level)
@@ -166,7 +140,7 @@ module IsoDoc
166
140
  lbl = clause_number_semx(parentnum, clause, num)
167
141
  section_name_anchors(clause, lbl, level)
168
142
  i = clause_counter(0)
169
- clause.xpath(ns(SUBCLAUSES)).each do |c|
143
+ clause.xpath(ns(subclauses)).each do |c|
170
144
  section_names1(c, lbl, i.increment(c).print, level + 1)
171
145
  end
172
146
  end
@@ -218,13 +192,14 @@ module IsoDoc
218
192
  end
219
193
 
220
194
  def annex_names(clause, num)
195
+ appendix_names(clause, num)
221
196
  label = semx(clause, num)
222
197
  annex_name_anchors(clause, label, 1)
223
198
  if @klass.single_term_clause?(clause)
224
199
  annex_names1(clause.at(ns("./references | ./terms | ./definitions")),
225
200
  nil, num.to_s, 1)
226
201
  else
227
- clause.xpath(ns(SUBCLAUSES))
202
+ clause.xpath(ns(subclauses))
228
203
  .each_with_object(clause_counter(0)) do |c, i|
229
204
  annex_names1(c, label, i.increment(c).print, 2)
230
205
  end
@@ -236,7 +211,7 @@ module IsoDoc
236
211
  lbl = clause_number_semx(parentnum, clause, num)
237
212
  annex_name_anchors1(clause, lbl, level)
238
213
  i = clause_counter(0)
239
- clause.xpath(ns(SUBCLAUSES)).each do |c|
214
+ clause.xpath(ns(subclauses)).each do |c|
240
215
  annex_names1(c, lbl, i.increment(c).print, level + 1)
241
216
  end
242
217
  end
@@ -245,6 +220,33 @@ module IsoDoc
245
220
  def annex_name_anchors1(clause, num, level)
246
221
  annex_name_anchors(clause, num, level)
247
222
  end
223
+
224
+ def appendix_names(clause, _num)
225
+ i = clause_counter(0)
226
+ clause.xpath(ns("./appendix")).each do |c|
227
+ i.increment(c)
228
+ num = semx(c, i.print)
229
+ lbl = labelled_autonum(@labels["appendix"], num)
230
+ @anchors[c["id"]] =
231
+ anchor_struct(i.print, c, @labels["appendix"],
232
+ "clause").merge(level: 2, subtype: "annex",
233
+ container: clause["id"])
234
+ j = clause_counter(0)
235
+ c.xpath(ns("./clause | ./references")).each do |c1|
236
+ appendix_names1(c1, lbl, j.increment(c1).print, 3, clause["id"])
237
+ end
238
+ end
239
+ end
240
+
241
+ def appendix_names1(clause, parentnum, num, level, container)
242
+ num = clause_number_semx(parentnum, clause, num)
243
+ @anchors[clause["id"]] = { label: num, xref: num, level: level,
244
+ container: container }
245
+ i = clause_counter(0)
246
+ clause.xpath(ns("./clause | ./references")).each do |c|
247
+ appendix_names1(c, num, i.increment(c).print, level + 1, container)
248
+ end
249
+ end
248
250
  end
249
251
  end
250
252
  end
@@ -68,7 +68,7 @@ module IsoDoc
68
68
 
69
69
  SECTIONS_XPATH =
70
70
  "//foreword | //introduction | //acknowledgements | " \
71
- "//preface/abstract | " \
71
+ "//executivesummary | //preface/abstract | " \
72
72
  "//preface/terms | //preface/definitions | //preface/references | " \
73
73
  "//preface/clause | //sections/terms | //annex | " \
74
74
  "//sections/clause | //sections/definitions | " \
@@ -91,6 +91,33 @@ module IsoDoc
91
91
  CHILD_SECTIONS
92
92
  end
93
93
 
94
+ SUBCLAUSES =
95
+ "./clause | ./references | ./term | ./terms | ./definitions".freeze
96
+
97
+ def subclauses
98
+ SUBCLAUSES
99
+ end
100
+
101
+ FIRST_LVL_REQ_RULE = <<~XPATH.freeze
102
+ [not(ancestor::permission or ancestor::requirement or ancestor::recommendation)]
103
+ XPATH
104
+
105
+ FIRST_LVL_REQ = <<~XPATH.freeze
106
+ .//permission#{FIRST_LVL_REQ_RULE} | .//requirement#{FIRST_LVL_REQ_RULE} | .//recommendation#{FIRST_LVL_REQ_RULE}
107
+ XPATH
108
+
109
+ def first_lvl_req
110
+ FIRST_LVL_REQ
111
+ end
112
+
113
+ REQ_CHILDREN = <<~XPATH.freeze
114
+ ./permission | ./requirement | ./recommendation
115
+ XPATH
116
+
117
+ def req_children
118
+ REQ_CHILDREN
119
+ end
120
+
94
121
  # if hierarchically marked up node in label already,
95
122
  # leave alone, else wrap in semx
96
123
  def semx(node, label, element = "autonum")
@@ -9,6 +9,7 @@ section: قسم
9
9
  foreword: تمهيد
10
10
  abstract: ملخص
11
11
  acknowledgements: شكر
12
+ executivesummary: الملخص التنفيذي
12
13
  termsdef: مصطلحات معرفة
13
14
  termsdefsymbolsabbrev: المصطلحات والتعريفات والرموز والاختصارات
14
15
  termsdefsymbols: المصطلحات والتعريفات والرموز
@@ -9,6 +9,7 @@ introduction: Einführung
9
9
  foreword: Vorwort
10
10
  abstract: Abstrakt
11
11
  acknowledgements: Danksagung
12
+ executivesummary: Zusammenfassung
12
13
  termsdef: Begriffe und Definitionen
13
14
  termsdefsymbolsabbrev: Begriffe, Definitionen, Symbole und abgekürzte Begriffe
14
15
  termsdefsymbols: Begriffe, Definitionen und Symbole
@@ -8,6 +8,7 @@ introduction: Introduction
8
8
  foreword: Foreword
9
9
  abstract: Abstract
10
10
  acknowledgements: Acknowledgements
11
+ executivesummary: Executive summary
11
12
  termsdef: Terms and definitions
12
13
  termsdefsymbolsabbrev: Terms, definitions, symbols and abbreviated terms
13
14
  termsdefsymbols: Terms, definitions and symbols
@@ -8,6 +8,7 @@ introduction: Introducción
8
8
  foreword: Prólogo
9
9
  abstract: Resumen
10
10
  acknowledgements: Agradecimientos
11
+ executivesummary: Resumen ejecutivo
11
12
  termsdef: Términos y definiciones
12
13
  termsdefsymbolsabbrev: Términos, definiciones, símbolos y términos abreviados
13
14
  termsdefsymbols: Términos, definiciones y símbolos
@@ -8,6 +8,7 @@ introduction: Introduction
8
8
  foreword: Avant-propos
9
9
  abstract: Résumé
10
10
  acknowledgements: Remerciements
11
+ executivesummary: Résumé exécutif
11
12
  termsdef: Termes et définitions
12
13
  termsdefsymbolsabbrev: Termes, définitions, symboles et termes abrégés
13
14
  termsdefsymbols: Termes, définitions et symboles
@@ -8,6 +8,7 @@ introduction: 序文
8
8
  foreword: まえがき
9
9
  abstract: はじめに
10
10
  acknowledgements: 謝辞
11
+ executivesummary: エグゼクティブサマリー
11
12
  termsdef: 用語及び定義
12
13
  termsdefsymbolsabbrev: 用語及び定義並びに記号及び略語
13
14
  termsdefsymbols: 用語及び定義並びに記号
@@ -8,6 +8,7 @@ introduction: Введение
8
8
  foreword: Предисловие
9
9
  abstract: Реферат
10
10
  acknowledgements: Подтверждения
11
+ executivesummary: Управляющее резюме
11
12
  termsdef: Термины и определения
12
13
  termsdefsymbolsabbrev: Термины, определения, символы и сокращенные термины
13
14
  termsdefsymbols: Термины, определения и символы
@@ -8,6 +8,7 @@ introduction: 引言
8
8
  foreword: 前言
9
9
  abstract: 摘要
10
10
  acknowledgements: 致謝
11
+ executivesummary: 执行摘要
11
12
  termsdef: 术语和定义
12
13
  termsdefsymbolsabbrev: 术语、定义、符号、代号和缩略语
13
14
  termsdefsymbols: 术语、定义、符号和代号
data/lib/isodoc.rb CHANGED
@@ -5,7 +5,6 @@ require "uuidtools"
5
5
  require "base64"
6
6
  require "mime/types"
7
7
  require "image_size"
8
- require "set"
9
8
  require "html2doc"
10
9
  require "liquid"
11
10
  require "htmlentities"
@@ -22,6 +21,7 @@ require "isodoc/headlesshtml_convert"
22
21
  require "isodoc/presentation_xml_convert"
23
22
  require "isodoc/xref"
24
23
  require "isodoc/i18n"
24
+ require "isodoc/css_border_parser"
25
25
  require "metanorma/output"
26
26
  require "relaton/render-isodoc/general"
27
27
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: isodoc
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.1.6
4
+ version: 3.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-04-15 00:00:00.000000000 Z
11
+ date: 2025-04-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: base64
@@ -399,6 +399,8 @@ files:
399
399
  - lib/isodoc/common.rb
400
400
  - lib/isodoc/convert.rb
401
401
  - lib/isodoc/css.rb
402
+ - lib/isodoc/css_border_parser.rb
403
+ - lib/isodoc/css_border_parser_vars.rb
402
404
  - lib/isodoc/function.rb
403
405
  - lib/isodoc/function/blocks.rb
404
406
  - lib/isodoc/function/blocks_example_note.rb
@@ -476,6 +478,7 @@ files:
476
478
  - lib/isodoc/xref/xref_counter_types.rb
477
479
  - lib/isodoc/xref/xref_gen.rb
478
480
  - lib/isodoc/xref/xref_gen_seq.rb
481
+ - lib/isodoc/xref/xref_sect_asset.rb
479
482
  - lib/isodoc/xref/xref_sect_gen.rb
480
483
  - lib/isodoc/xref/xref_util.rb
481
484
  - lib/isodoc/xslfo_convert.rb