isodoc 1.0.29 → 1.1.3.pre.alpha2

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 (57) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/macos.yml +6 -12
  3. data/.github/workflows/ubuntu.yml +18 -20
  4. data/.github/workflows/windows.yml +6 -12
  5. data/Rakefile +3 -1
  6. data/isodoc.gemspec +2 -2
  7. data/lib/isodoc.rb +2 -0
  8. data/lib/isodoc/base_style/all.css +207 -0
  9. data/lib/isodoc/base_style/blocks.css +0 -0
  10. data/lib/isodoc/base_style/coverpage.css +0 -0
  11. data/lib/isodoc/base_style/defaults.css +0 -0
  12. data/lib/isodoc/base_style/metanorma_word.css +34 -0
  13. data/lib/isodoc/base_style/metanorma_word.scss +0 -1
  14. data/lib/isodoc/base_style/nav.css +0 -0
  15. data/lib/isodoc/base_style/reset.css +105 -0
  16. data/lib/isodoc/base_style/reset.scss +3 -3
  17. data/lib/isodoc/base_style/typography.css +0 -0
  18. data/lib/isodoc/common.rb +0 -4
  19. data/lib/isodoc/convert.rb +121 -58
  20. data/lib/isodoc/function/blocks.rb +3 -3
  21. data/lib/isodoc/function/blocks_example_note.rb +2 -2
  22. data/lib/isodoc/function/inline.rb +5 -5
  23. data/lib/isodoc/function/references.rb +29 -34
  24. data/lib/isodoc/function/reqt.rb +1 -1
  25. data/lib/isodoc/function/section.rb +7 -11
  26. data/lib/isodoc/function/table.rb +1 -1
  27. data/lib/isodoc/function/terms.rb +2 -2
  28. data/lib/isodoc/function/to_word_html.rb +2 -2
  29. data/lib/isodoc/function/utils.rb +57 -51
  30. data/lib/isodoc/gem_tasks.rb +117 -0
  31. data/lib/isodoc/headlesshtml_convert.rb +7 -6
  32. data/lib/isodoc/html_convert.rb +2 -1
  33. data/lib/isodoc/html_function/html.rb +1 -1
  34. data/lib/isodoc/html_function/postprocess.rb +1 -1
  35. data/lib/isodoc/metadata.rb +69 -63
  36. data/lib/isodoc/pdf_convert.rb +8 -6
  37. data/lib/isodoc/presentation_xml_convert.rb +29 -0
  38. data/lib/isodoc/sassc_importer.rb +11 -0
  39. data/lib/isodoc/version.rb +1 -1
  40. data/lib/isodoc/word_convert.rb +2 -1
  41. data/lib/isodoc/word_function/body.rb +1 -1
  42. data/lib/isodoc/word_function/postprocess.rb +1 -0
  43. data/lib/isodoc/xref.rb +59 -0
  44. data/lib/isodoc/{function → xref}/xref_anchor.rb +10 -21
  45. data/lib/isodoc/xref/xref_counter.rb +74 -0
  46. data/lib/isodoc/{function → xref}/xref_gen.rb +9 -22
  47. data/lib/isodoc/{function → xref}/xref_gen_seq.rb +34 -26
  48. data/lib/isodoc/{function → xref}/xref_sect_gen.rb +33 -23
  49. data/lib/isodoc/xslfo_convert.rb +16 -4
  50. data/spec/assets/{html.css → html.scss} +0 -0
  51. data/spec/isodoc/footnotes_spec.rb +2 -2
  52. data/spec/isodoc/postproc_spec.rb +1319 -1345
  53. data/spec/isodoc/presentation_xml_spec.rb +20 -0
  54. data/spec/isodoc/ref_spec.rb +1 -1
  55. data/spec/isodoc/section_spec.rb +52 -0
  56. metadata +40 -28
  57. data/lib/isodoc/function/xref_counter.rb +0 -84
@@ -0,0 +1,20 @@
1
+ require "spec_helper"
2
+
3
+ RSpec.describe IsoDoc do
4
+ it "generates file based on string input" do
5
+ FileUtils.rm_f "test.presentation.xml"
6
+ IsoDoc::PresentationXMLConvert.new({filename: "test"}).convert("test", <<~"INPUT", false)
7
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
8
+ <bibdata>
9
+ <title language="en">test</title>
10
+ </bibdata>
11
+ <preface><foreword>
12
+ <note>
13
+ <p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f">These results are based on a study carried out on three different types of kernel.</p>
14
+ </note>
15
+ </foreword></preface>
16
+ </iso-standard>
17
+ INPUT
18
+ expect(File.exist?("test.presentation.xml")).to be true
19
+ end
20
+ end
@@ -231,7 +231,7 @@ RSpec.describe IsoDoc do
231
231
  <i>Internet Calendaring and Scheduling Core Object Specification (iCalendar)</i>
232
232
  </p>
233
233
  <p id='ref12' class='Biblio'>
234
- [6]&#160; Citn, IETF RFC 20, CitationWorks. 2019.
234
+ Citn&#160; IETF RFC 20, CitationWorks. 2019.
235
235
  <i>How to cite a reference</i>
236
236
  .
237
237
  </p>
@@ -1109,5 +1109,57 @@ OUTPUT
1109
1109
  OUTPUT
1110
1110
  end
1111
1111
 
1112
+ it "processes clauses containing normative references" do
1113
+ expect(xmlpp(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
1114
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
1115
+ <bibliography>
1116
+ <clause id="D" obligation="informative">
1117
+ <title>Bibliography</title>
1118
+ <references id="E" obligation="informative" normative="false">
1119
+ <title>Bibliography Subsection 1</title>
1120
+ </references>
1121
+ <references id="F" obligation="informative" normative="false">
1122
+ <title>Bibliography Subsection 2</title>
1123
+ </references>
1124
+ </clause>
1125
+ <clause id="A" obligation="informative"><title>First References</title>
1126
+ <references id="B" obligation="informative" normative="true">
1127
+ <title>Normative References 1</title>
1128
+ </references>
1129
+ <references id="C" obligation="informative" normative="false">
1130
+ <title>Normative References 2</title>
1131
+ </references>
1132
+ </clause>
1133
+
1134
+ </bibliography>
1135
+ INPUT
1136
+ #{HTML_HDR}
1137
+ <p class='zzSTDTitle1'/>
1138
+ <div>
1139
+ <h1>1.&#160; Normative references</h1>
1140
+ <div>
1141
+ <h2>1.1.&#160; Normative References 1</h2>
1142
+ </div>
1143
+ <div>
1144
+ <h2>1.2.&#160; Normative References 2</h2>
1145
+ </div>
1146
+ </div>
1147
+ <br/>
1148
+ <div>
1149
+ <h1 class='Section3'>Bibliography</h1>
1150
+ <div>
1151
+ <h2 class='Section3'>Bibliography Subsection 1</h2>
1152
+ </div>
1153
+ <div>
1154
+ <h2 class='Section3'>Bibliography Subsection 2</h2>
1155
+ </div>
1156
+ </div>
1157
+ </div>
1158
+ </body>
1159
+ </html>
1160
+
1161
+ OUTPUT
1162
+ end
1163
+
1112
1164
 
1113
1165
  end
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: 1.0.29
4
+ version: 1.1.3.pre.alpha2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-06-19 00:00:00.000000000 Z
11
+ date: 2020-07-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: asciimath
@@ -123,61 +123,61 @@ dependencies:
123
123
  - !ruby/object:Gem::Version
124
124
  version: '0'
125
125
  - !ruby/object:Gem::Dependency
126
- name: sassc
126
+ name: metanorma
127
127
  requirement: !ruby/object:Gem::Requirement
128
128
  requirements:
129
129
  - - "~>"
130
130
  - !ruby/object:Gem::Version
131
- version: 2.4.0
131
+ version: 1.1.0
132
132
  type: :runtime
133
133
  prerelease: false
134
134
  version_requirements: !ruby/object:Gem::Requirement
135
135
  requirements:
136
136
  - - "~>"
137
137
  - !ruby/object:Gem::Version
138
- version: 2.4.0
138
+ version: 1.1.0
139
139
  - !ruby/object:Gem::Dependency
140
- name: metanorma
140
+ name: rake
141
141
  requirement: !ruby/object:Gem::Requirement
142
142
  requirements:
143
143
  - - "~>"
144
144
  - !ruby/object:Gem::Version
145
- version: 1.0.0
145
+ version: '12.0'
146
146
  type: :runtime
147
147
  prerelease: false
148
148
  version_requirements: !ruby/object:Gem::Requirement
149
149
  requirements:
150
150
  - - "~>"
151
151
  - !ruby/object:Gem::Version
152
- version: 1.0.0
152
+ version: '12.0'
153
153
  - !ruby/object:Gem::Dependency
154
- name: rake
154
+ name: byebug
155
155
  requirement: !ruby/object:Gem::Requirement
156
156
  requirements:
157
157
  - - "~>"
158
158
  - !ruby/object:Gem::Version
159
- version: '12.0'
160
- type: :runtime
159
+ version: '9.1'
160
+ type: :development
161
161
  prerelease: false
162
162
  version_requirements: !ruby/object:Gem::Requirement
163
163
  requirements:
164
164
  - - "~>"
165
165
  - !ruby/object:Gem::Version
166
- version: '12.0'
166
+ version: '9.1'
167
167
  - !ruby/object:Gem::Dependency
168
- name: byebug
168
+ name: sassc
169
169
  requirement: !ruby/object:Gem::Requirement
170
170
  requirements:
171
171
  - - "~>"
172
172
  - !ruby/object:Gem::Version
173
- version: '9.1'
173
+ version: 2.4.0
174
174
  type: :development
175
175
  prerelease: false
176
176
  version_requirements: !ruby/object:Gem::Requirement
177
177
  requirements:
178
178
  - - "~>"
179
179
  - !ruby/object:Gem::Version
180
- version: '9.1'
180
+ version: 2.4.0
181
181
  - !ruby/object:Gem::Dependency
182
182
  name: equivalent-xml
183
183
  requirement: !ruby/object:Gem::Requirement
@@ -306,14 +306,22 @@ files:
306
306
  - lib/isodoc-yaml/i18n-fr.yaml
307
307
  - lib/isodoc-yaml/i18n-zh-Hans.yaml
308
308
  - lib/isodoc.rb
309
+ - lib/isodoc/base_style/all.css
309
310
  - lib/isodoc/base_style/all.scss
310
311
  - lib/isodoc/base_style/bands.scss
312
+ - lib/isodoc/base_style/blocks.css
311
313
  - lib/isodoc/base_style/blocks.scss
314
+ - lib/isodoc/base_style/coverpage.css
312
315
  - lib/isodoc/base_style/coverpage.scss
316
+ - lib/isodoc/base_style/defaults.css
313
317
  - lib/isodoc/base_style/defaults.scss
318
+ - lib/isodoc/base_style/metanorma_word.css
314
319
  - lib/isodoc/base_style/metanorma_word.scss
320
+ - lib/isodoc/base_style/nav.css
315
321
  - lib/isodoc/base_style/nav.scss
322
+ - lib/isodoc/base_style/reset.css
316
323
  - lib/isodoc/base_style/reset.scss
324
+ - lib/isodoc/base_style/typography.css
317
325
  - lib/isodoc/base_style/typography.scss
318
326
  - lib/isodoc/class_utils.rb
319
327
  - lib/isodoc/common.rb
@@ -333,11 +341,7 @@ files:
333
341
  - lib/isodoc/function/terms.rb
334
342
  - lib/isodoc/function/to_word_html.rb
335
343
  - lib/isodoc/function/utils.rb
336
- - lib/isodoc/function/xref_anchor.rb
337
- - lib/isodoc/function/xref_counter.rb
338
- - lib/isodoc/function/xref_gen.rb
339
- - lib/isodoc/function/xref_gen_seq.rb
340
- - lib/isodoc/function/xref_sect_gen.rb
344
+ - lib/isodoc/gem_tasks.rb
341
345
  - lib/isodoc/headlesshtml_convert.rb
342
346
  - lib/isodoc/html_convert.rb
343
347
  - lib/isodoc/html_function.rb
@@ -348,6 +352,8 @@ files:
348
352
  - lib/isodoc/metadata.rb
349
353
  - lib/isodoc/metadata_date.rb
350
354
  - lib/isodoc/pdf_convert.rb
355
+ - lib/isodoc/presentation_xml_convert.rb
356
+ - lib/isodoc/sassc_importer.rb
351
357
  - lib/isodoc/version.rb
352
358
  - lib/isodoc/word_convert.rb
353
359
  - lib/isodoc/word_function.rb
@@ -358,9 +364,15 @@ files:
358
364
  - lib/isodoc/word_function/postprocess.rb
359
365
  - lib/isodoc/word_function/postprocess_cover.rb
360
366
  - lib/isodoc/word_function/table.rb
367
+ - lib/isodoc/xref.rb
368
+ - lib/isodoc/xref/xref_anchor.rb
369
+ - lib/isodoc/xref/xref_counter.rb
370
+ - lib/isodoc/xref/xref_gen.rb
371
+ - lib/isodoc/xref/xref_gen_seq.rb
372
+ - lib/isodoc/xref/xref_sect_gen.rb
361
373
  - lib/isodoc/xslfo_convert.rb
362
374
  - spec/assets/header.html
363
- - spec/assets/html.css
375
+ - spec/assets/html.scss
364
376
  - spec/assets/htmlcover.html
365
377
  - spec/assets/htmlintro.html
366
378
  - spec/assets/i18n.yaml
@@ -383,6 +395,7 @@ files:
383
395
  - spec/isodoc/lists_spec.rb
384
396
  - spec/isodoc/metadata_spec.rb
385
397
  - spec/isodoc/postproc_spec.rb
398
+ - spec/isodoc/presentation_xml_spec.rb
386
399
  - spec/isodoc/ref_spec.rb
387
400
  - spec/isodoc/section_spec.rb
388
401
  - spec/isodoc/table_spec.rb
@@ -393,7 +406,7 @@ homepage: https://github.com/metanorma/isodoc
393
406
  licenses:
394
407
  - BSD-2-Clause
395
408
  metadata: {}
396
- post_install_message:
409
+ post_install_message:
397
410
  rdoc_options: []
398
411
  require_paths:
399
412
  - lib
@@ -404,13 +417,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
404
417
  version: 2.4.0
405
418
  required_rubygems_version: !ruby/object:Gem::Requirement
406
419
  requirements:
407
- - - ">="
420
+ - - ">"
408
421
  - !ruby/object:Gem::Version
409
- version: '0'
422
+ version: 1.3.1
410
423
  requirements: []
411
- rubyforge_project:
412
- rubygems_version: 2.7.6
413
- signing_key:
424
+ rubygems_version: 3.0.3
425
+ signing_key:
414
426
  specification_version: 4
415
427
  summary: Convert documents in IsoDoc into Word and HTML in AsciiDoc.
416
428
  test_files: []
@@ -1,84 +0,0 @@
1
- require "roman-numerals"
2
-
3
- module IsoDoc::Function
4
- module XrefGen
5
- def hiersep
6
- "."
7
- end
8
-
9
- def hierfigsep
10
- "-"
11
- end
12
-
13
- class Counter
14
- def initialize
15
- @num = 0
16
- @letter = ""
17
- @subseq = ""
18
- @letter_override = nil
19
- @number_override = nil
20
- end
21
-
22
- def new_subseq_increment(node)
23
- @subseq = node["subsequence"]
24
- @num += 1
25
- @letter = node["subsequence"] ? "a" : ""
26
- if node["number"]
27
- /^(?<n>\d*)(?<a>[a-z]*)$/ =~ node["number"]
28
- if n || a
29
- @letter_override = @letter = a if a
30
- @number_override = @num = n.to_i if n
31
- else
32
- @letter_override = node["number"]
33
- @letter = @letter_override if /^[a-z]$/.match(@letter_override)
34
- end
35
- end
36
- end
37
-
38
- def sequence_increment(node)
39
- if node["number"]
40
- @number_override = node["number"]
41
- @num = @number_override.to_i if /^\d+$/.match(@number_override)
42
- else
43
- @num += 1
44
- end
45
- end
46
-
47
- def subsequence_increment(node)
48
- if node["number"]
49
- @letter_override = node["number"]
50
- @letter = @letter_override if /^[a-z]$/.match(@letter_override)
51
- else
52
- @letter = (@letter.ord + 1).chr.to_s
53
- end
54
- end
55
-
56
- def increment(node)
57
- return self if node["unnumbered"]
58
- @letter_override = nil
59
- @number_override = nil
60
- if node["subsequence"] != @subseq
61
- new_subseq_increment(node)
62
- elsif @letter.empty?
63
- sequence_increment(node)
64
- else
65
- subsequence_increment(node)
66
- end
67
- self
68
- end
69
-
70
- def print
71
- "#{@number_override || @num}#{@letter_override || @letter}"
72
- end
73
-
74
- def listlabel(depth)
75
- return @num.to_s if [2, 7].include? depth
76
- return (96 + @num).chr.to_s if [1, 6].include? depth
77
- return (64 + @num).chr.to_s if [4, 9].include? depth
78
- return RomanNumerals.to_roman(@num).downcase if [3, 8].include? depth
79
- return RomanNumerals.to_roman(@num).upcase if [5, 10].include? depth
80
- return @num.to_s
81
- end
82
- end
83
- end
84
- end