isodoc 1.2.6 → 1.4.0

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 (63) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/rake.yml +69 -0
  3. data/README.adoc +1 -3
  4. data/isodoc.gemspec +2 -1
  5. data/lib/isodoc-yaml/i18n-en.yaml +56 -0
  6. data/lib/isodoc-yaml/i18n-fr.yaml +64 -7
  7. data/lib/isodoc-yaml/i18n-zh-Hans.yaml +1 -0
  8. data/lib/isodoc/base_style/all.css +4 -0
  9. data/lib/isodoc/base_style/blocks.scss +2 -2
  10. data/lib/isodoc/base_style/reset.css +4 -0
  11. data/lib/isodoc/base_style/reset.scss +5 -0
  12. data/lib/isodoc/base_style/typography.scss +1 -1
  13. data/lib/isodoc/convert.rb +13 -98
  14. data/lib/isodoc/css.rb +95 -0
  15. data/lib/isodoc/function/inline.rb +0 -33
  16. data/lib/isodoc/function/inline_simple.rb +4 -1
  17. data/lib/isodoc/function/lists.rb +2 -1
  18. data/lib/isodoc/function/references.rb +8 -13
  19. data/lib/isodoc/function/section.rb +1 -1
  20. data/lib/isodoc/function/table.rb +10 -0
  21. data/lib/isodoc/function/to_word_html.rb +2 -2
  22. data/lib/isodoc/gem_tasks.rb +4 -0
  23. data/lib/isodoc/html_function/html.rb +1 -0
  24. data/lib/isodoc/html_function/mathvariant_to_plain.rb +82 -0
  25. data/lib/isodoc/html_function/postprocess.rb +41 -20
  26. data/lib/isodoc/i18n.rb +15 -2
  27. data/lib/isodoc/metadata.rb +28 -109
  28. data/lib/isodoc/metadata_contributor.rb +91 -0
  29. data/lib/isodoc/metadata_date.rb +6 -0
  30. data/lib/isodoc/presentation_function/bibdata.rb +79 -7
  31. data/lib/isodoc/presentation_function/block.rb +14 -9
  32. data/lib/isodoc/presentation_function/inline.rb +126 -22
  33. data/lib/isodoc/presentation_function/section.rb +9 -0
  34. data/lib/isodoc/presentation_xml_convert.rb +5 -0
  35. data/lib/isodoc/version.rb +1 -1
  36. data/lib/isodoc/word_convert.rb +0 -20
  37. data/lib/isodoc/word_function/body.rb +12 -0
  38. data/lib/isodoc/word_function/postprocess.rb +38 -80
  39. data/lib/isodoc/word_function/postprocess_cover.rb +55 -0
  40. data/lib/isodoc/word_function/table.rb +10 -0
  41. data/lib/isodoc/xref.rb +1 -0
  42. data/lib/isodoc/xref/xref_counter.rb +20 -9
  43. data/lib/isodoc/xref/xref_gen.rb +20 -2
  44. data/lib/isodoc/xref/xref_sect_gen.rb +1 -1
  45. data/spec/assets/html.scss +14 -0
  46. data/spec/assets/i18n.yaml +17 -9
  47. data/spec/isodoc/blocks_spec.rb +89 -241
  48. data/spec/isodoc/cleanup_spec.rb +0 -1
  49. data/spec/isodoc/footnotes_spec.rb +4 -5
  50. data/spec/isodoc/i18n_spec.rb +73 -38
  51. data/spec/isodoc/inline_spec.rb +177 -199
  52. data/spec/isodoc/lists_spec.rb +1 -1
  53. data/spec/isodoc/metadata_spec.rb +50 -7
  54. data/spec/isodoc/postproc_spec.rb +472 -11
  55. data/spec/isodoc/presentation_xml_spec.rb +584 -1
  56. data/spec/isodoc/ref_spec.rb +327 -12
  57. data/spec/isodoc/table_spec.rb +28 -0
  58. data/spec/isodoc/xref_spec.rb +162 -17
  59. data/spec/spec_helper.rb +2 -0
  60. metadata +22 -7
  61. data/.github/workflows/macos.yml +0 -42
  62. data/.github/workflows/ubuntu.yml +0 -62
  63. data/.github/workflows/windows.yml +0 -44
@@ -2313,7 +2313,7 @@ OUTPUT
2313
2313
  <li id="N1"><p>A</p></li>
2314
2314
  </ol>
2315
2315
  <clause id="xyz"><title>Preparatory</title>
2316
- <ol id="N02">
2316
+ <ol id="N02" type="arabic">
2317
2317
  <li id="N2"><p>A</p></li>
2318
2318
  </ol>
2319
2319
  </clause>
@@ -2321,17 +2321,17 @@ OUTPUT
2321
2321
  </preface>
2322
2322
  <sections>
2323
2323
  <clause id="scope" type="scope"><title>Scope</title>
2324
- <ol id="N0">
2324
+ <ol id="N0" type="roman">
2325
2325
  <li id="N"><p>A</p></li>
2326
2326
  </ol>
2327
2327
  </clause>
2328
2328
  <terms id="terms"/>
2329
2329
  <clause id="widgets"><title>Widgets</title>
2330
2330
  <clause id="widgets1">
2331
- <ol id="note1l">
2331
+ <ol id="note1l" type="alphabet">
2332
2332
  <li id="note1"><p>A</p></li>
2333
2333
  </ol>
2334
- <ol id="note2l">
2334
+ <ol id="note2l" type="roman_upper">
2335
2335
  <li id="note2"><p>A</p></li>
2336
2336
  </ol>
2337
2337
  </clause>
@@ -2339,12 +2339,12 @@ OUTPUT
2339
2339
  </sections>
2340
2340
  <annex id="annex1">
2341
2341
  <clause id="annex1a">
2342
- <ol id="ANl">
2342
+ <ol id="ANl" type="alphabet_upper">
2343
2343
  <li id="AN"><p>A</p></li>
2344
2344
  </ol>
2345
2345
  </clause>
2346
2346
  <clause id="annex1b">
2347
- <ol id="Anote1l">
2347
+ <ol id="Anote1l" type="roman" start="4">
2348
2348
  <li id="Anote1"><p>A</p></li>
2349
2349
  </ol>
2350
2350
  <ol id="Anote2l">
@@ -2360,12 +2360,12 @@ OUTPUT
2360
2360
  <foreword>
2361
2361
  <p>
2362
2362
  <xref target='N1'>Introduction, a)</xref>
2363
- <xref target='N2'>Preparatory, a)</xref>
2364
- <xref target='N'>Clause 1, a)</xref>
2363
+ <xref target='N2'>Preparatory, 1)</xref>
2364
+ <xref target='N'>Clause 1, i)</xref>
2365
2365
  <xref target='note1'>Clause 3.1, List 1 a)</xref>
2366
- <xref target='note2'>Clause 3.1, List 2 a)</xref>
2367
- <xref target='AN'>Annex A.1, a)</xref>
2368
- <xref target='Anote1'>Annex A.2, List 1 a)</xref>
2366
+ <xref target='note2'>Clause 3.1, List 2 I)</xref>
2367
+ <xref target='AN'>Annex A.1, A)</xref>
2368
+ <xref target='Anote1'>Annex A.2, List 1 iv)</xref>
2369
2369
  <xref target='Anote2'>Annex A.2, List 2 a)</xref>
2370
2370
  </p>
2371
2371
  </foreword>
@@ -2377,7 +2377,7 @@ OUTPUT
2377
2377
  </ol>
2378
2378
  <clause id='xyz'>
2379
2379
  <title depth='2'>Preparatory</title>
2380
- <ol id='N02'>
2380
+ <ol id='N02' type="arabic">
2381
2381
  <li id='N2'>
2382
2382
  <p>A</p>
2383
2383
  </li>
@@ -2392,7 +2392,7 @@ OUTPUT
2392
2392
  <tab/>
2393
2393
  Scope
2394
2394
  </title>
2395
- <ol id='N0'>
2395
+ <ol id='N0' type="roman">
2396
2396
  <li id='N'>
2397
2397
  <p>A</p>
2398
2398
  </li>
@@ -2408,12 +2408,12 @@ OUTPUT
2408
2408
  Widgets
2409
2409
  </title>
2410
2410
  <clause id='widgets1'><title>3.1.</title>
2411
- <ol id='note1l'>
2411
+ <ol id='note1l' type="alphabet">
2412
2412
  <li id='note1'>
2413
2413
  <p>A</p>
2414
2414
  </li>
2415
2415
  </ol>
2416
- <ol id='note2l'>
2416
+ <ol id='note2l' type="roman_upper">
2417
2417
  <li id='note2'>
2418
2418
  <p>A</p>
2419
2419
  </li>
@@ -2428,14 +2428,14 @@ OUTPUT
2428
2428
  (informative)
2429
2429
  </title>
2430
2430
  <clause id='annex1a'><title>A.1.</title>
2431
- <ol id='ANl'>
2431
+ <ol id='ANl' type="alphabet_upper">
2432
2432
  <li id='AN'>
2433
2433
  <p>A</p>
2434
2434
  </li>
2435
2435
  </ol>
2436
2436
  </clause>
2437
2437
  <clause id='annex1b'><title>A.2.</title>
2438
- <ol id='Anote1l'>
2438
+ <ol id='Anote1l' type="roman" start="4">
2439
2439
  <li id='Anote1'>
2440
2440
  <p>A</p>
2441
2441
  </li>
@@ -2547,6 +2547,151 @@ OUTPUT
2547
2547
  OUTPUT
2548
2548
  end
2549
2549
 
2550
+ it "cross-references bookmarks" do
2551
+ expect(xmlpp(IsoDoc::PresentationXMLConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
2552
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
2553
+ <preface>
2554
+ <foreword>
2555
+ <p>
2556
+ <xref target="N1"/>
2557
+ <xref target="N2"/>
2558
+ <xref target="N"/>
2559
+ <xref target="note1"/>
2560
+ <xref target="note2"/>
2561
+ <xref target="AN"/>
2562
+ <xref target="Anote1"/>
2563
+ <xref target="Anote2"/>
2564
+ </p>
2565
+ </foreword>
2566
+ <introduction id="intro">
2567
+ <p id="N01">
2568
+ <bookmark id="N1"/>
2569
+ </p>
2570
+ <clause id="xyz"><title>Preparatory</title>
2571
+ <p id="N02" type="arabic">
2572
+ <bookmark id="N2"/>
2573
+ </p>
2574
+ </clause>
2575
+ </introduction>
2576
+ </preface>
2577
+ <sections>
2578
+ <clause id="scope" type="scope"><title>Scope</title>
2579
+ <p id="N0" type="roman">
2580
+ <bookmark id="N"/>
2581
+ </p>
2582
+ </clause>
2583
+ <terms id="terms"/>
2584
+ <clause id="widgets"><title>Widgets</title>
2585
+ <clause id="widgets1">
2586
+ <p id="note1l" type="alphabet">
2587
+ <bookmark id="note1"/>
2588
+ </p>
2589
+ <p id="note2l" type="roman_upper">
2590
+ <bookmark id="note2"/>
2591
+ </p>
2592
+ </clause>
2593
+ </clause>
2594
+ </sections>
2595
+ <annex id="annex1">
2596
+ <clause id="annex1a">
2597
+ <p id="ANl" type="alphabet_upper">
2598
+ <bookmark id="AN"/>
2599
+ </p>
2600
+ </clause>
2601
+ <clause id="annex1b">
2602
+ <p id="Anote1l" type="roman" start="4">
2603
+ <bookmark id="Anote1"/>
2604
+ </p>
2605
+ <p id="Anote2l">
2606
+ <bookmark id="Anote2"/>
2607
+ </p>
2608
+ </clause>
2609
+ </annex>
2610
+ </iso-standard>
2611
+ INPUT
2612
+ <iso-standard xmlns='http://riboseinc.com/isoxml' type='presentation'>
2613
+ <preface>
2614
+ <foreword>
2615
+ <p>
2616
+ <xref target='N1'>Introduction</xref>
2617
+ <xref target='N2'>Preparatory</xref>
2618
+ <xref target='N'>Clause 1</xref>
2619
+ <xref target='note1'>Clause 3.1</xref>
2620
+ <xref target='note2'>Clause 3.1</xref>
2621
+ <xref target='AN'>Annex A.1</xref>
2622
+ <xref target='Anote1'>Annex A.2</xref>
2623
+ <xref target='Anote2'>Annex A.2</xref>
2624
+ </p>
2625
+ </foreword>
2626
+ <introduction id='intro'>
2627
+ <p id='N01'>
2628
+ <bookmark id='N1'/>
2629
+ </p>
2630
+ <clause id='xyz'>
2631
+ <title depth='2'>Preparatory</title>
2632
+ <p id='N02' type='arabic'>
2633
+ <bookmark id='N2'/>
2634
+ </p>
2635
+ </clause>
2636
+ </introduction>
2637
+ </preface>
2638
+ <sections>
2639
+ <clause id='scope' type='scope'>
2640
+ <title depth='1'>
2641
+ 1.
2642
+ <tab/>
2643
+ Scope
2644
+ </title>
2645
+ <p id='N0' type='roman'>
2646
+ <bookmark id='N'/>
2647
+ </p>
2648
+ </clause>
2649
+ <terms id='terms'>
2650
+ <title>2.</title>
2651
+ </terms>
2652
+ <clause id='widgets'>
2653
+ <title depth='1'>
2654
+ 3.
2655
+ <tab/>
2656
+ Widgets
2657
+ </title>
2658
+ <clause id='widgets1'>
2659
+ <title>3.1.</title>
2660
+ <p id='note1l' type='alphabet'>
2661
+ <bookmark id='note1'/>
2662
+ </p>
2663
+ <p id='note2l' type='roman_upper'>
2664
+ <bookmark id='note2'/>
2665
+ </p>
2666
+ </clause>
2667
+ </clause>
2668
+ </sections>
2669
+ <annex id='annex1'>
2670
+ <title>
2671
+ <strong>Annex A</strong>
2672
+ <br/>
2673
+ (informative)
2674
+ </title>
2675
+ <clause id='annex1a'>
2676
+ <title>A.1.</title>
2677
+ <p id='ANl' type='alphabet_upper'>
2678
+ <bookmark id='AN'/>
2679
+ </p>
2680
+ </clause>
2681
+ <clause id='annex1b'>
2682
+ <title>A.2.</title>
2683
+ <p id='Anote1l' type='roman' start='4'>
2684
+ <bookmark id='Anote1'/>
2685
+ </p>
2686
+ <p id='Anote2l'>
2687
+ <bookmark id='Anote2'/>
2688
+ </p>
2689
+ </clause>
2690
+ </annex>
2691
+ </iso-standard>
2692
+ OUTPUT
2693
+ end
2694
+
2550
2695
  it "realises subsequences" do
2551
2696
  expect(xmlpp(IsoDoc::PresentationXMLConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
2552
2697
  <iso-standard xmlns="http://riboseinc.com/isoxml">
@@ -33,6 +33,8 @@ def metadata(x)
33
33
  Hash[x.sort].delete_if{ |k, v| v.nil? || v.respond_to?(:empty?) && v.empty? }
34
34
  end
35
35
 
36
+ # expect(metadata(c.info(Nokogiri::XML(<<~"INPUT"), nil))).to be_equivalent_to <<~"OUTPUT"
37
+
36
38
  def strip_guid(x)
37
39
  x.gsub(%r{ id="_[^"]+"}, ' id="_"').gsub(%r{ target="_[^"]+"}, ' target="_"').
38
40
  gsub(%r( href="#[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{13}"), ' href="#_"').
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.2.6
4
+ version: 1.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-10-11 00:00:00.000000000 Z
11
+ date: 2020-12-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: asciimath
@@ -108,6 +108,20 @@ dependencies:
108
108
  - - ">="
109
109
  - !ruby/object:Gem::Version
110
110
  version: '0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: twitter_cldr
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :runtime
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
111
125
  - !ruby/object:Gem::Dependency
112
126
  name: roman-numerals
113
127
  requirement: !ruby/object:Gem::Requirement
@@ -128,14 +142,14 @@ dependencies:
128
142
  requirements:
129
143
  - - "~>"
130
144
  - !ruby/object:Gem::Version
131
- version: 1.1.0
145
+ version: 1.2.0
132
146
  type: :runtime
133
147
  prerelease: false
134
148
  version_requirements: !ruby/object:Gem::Requirement
135
149
  requirements:
136
150
  - - "~>"
137
151
  - !ruby/object:Gem::Version
138
- version: 1.1.0
152
+ version: 1.2.0
139
153
  - !ruby/object:Gem::Dependency
140
154
  name: relaton-cli
141
155
  requirement: !ruby/object:Gem::Requirement
@@ -301,9 +315,7 @@ executables: []
301
315
  extensions: []
302
316
  extra_rdoc_files: []
303
317
  files:
304
- - ".github/workflows/macos.yml"
305
- - ".github/workflows/ubuntu.yml"
306
- - ".github/workflows/windows.yml"
318
+ - ".github/workflows/rake.yml"
307
319
  - ".hound.yml"
308
320
  - ".oss-guides.rubocop.yml"
309
321
  - ".rubocop.ribose.yml"
@@ -340,6 +352,7 @@ files:
340
352
  - lib/isodoc/class_utils.rb
341
353
  - lib/isodoc/common.rb
342
354
  - lib/isodoc/convert.rb
355
+ - lib/isodoc/css.rb
343
356
  - lib/isodoc/function.rb
344
357
  - lib/isodoc/function/blocks.rb
345
358
  - lib/isodoc/function/blocks_example_note.rb
@@ -361,9 +374,11 @@ files:
361
374
  - lib/isodoc/html_function/comments.rb
362
375
  - lib/isodoc/html_function/footnotes.rb
363
376
  - lib/isodoc/html_function/html.rb
377
+ - lib/isodoc/html_function/mathvariant_to_plain.rb
364
378
  - lib/isodoc/html_function/postprocess.rb
365
379
  - lib/isodoc/i18n.rb
366
380
  - lib/isodoc/metadata.rb
381
+ - lib/isodoc/metadata_contributor.rb
367
382
  - lib/isodoc/metadata_date.rb
368
383
  - lib/isodoc/pdf_convert.rb
369
384
  - lib/isodoc/presentation_function/bibdata.rb
@@ -1,42 +0,0 @@
1
- # Auto-generated by Cimas: Do not edit it manually!
2
- # See https://github.com/metanorma/cimas
3
- name: macos
4
-
5
- on:
6
- push:
7
- branches: [ master ]
8
- pull_request:
9
- paths-ignore:
10
- - .github/workflows/ubuntu.yml
11
- - .github/workflows/windows.yml
12
-
13
- jobs:
14
- test-macos:
15
- name: Test on Ruby ${{ matrix.ruby }} macOS
16
- runs-on: macos-latest
17
- continue-on-error: ${{ matrix.experimental }}
18
- strategy:
19
- fail-fast: false
20
- matrix:
21
- ruby: [ '2.6', '2.5', '2.4' ]
22
- experimental: [false]
23
- include:
24
- - ruby: '2.7'
25
- experimental: true
26
- steps:
27
- - uses: actions/checkout@master
28
- - name: Use Ruby
29
- uses: actions/setup-ruby@v1
30
- with:
31
- ruby-version: ${{ matrix.ruby }}
32
- - name: Install Inkscape
33
- run: |
34
- brew cask install inkscape
35
- inkscape --version
36
- - name: Update gems
37
- run: |
38
- sudo gem install bundler --force
39
- bundle install --jobs 4 --retry 3
40
- - name: Run specs
41
- run: |
42
- bundle exec rake
@@ -1,62 +0,0 @@
1
- # Auto-generated by Cimas: Do not edit it manually!
2
- # See https://github.com/metanorma/cimas
3
- name: ubuntu
4
-
5
- on:
6
- push:
7
- branches: [ master ]
8
- tags:
9
- - '*'
10
- pull_request:
11
- paths-ignore:
12
- - .github/workflows/macos.yml
13
- - .github/workflows/windows.yml
14
-
15
- jobs:
16
- test-linux:
17
- name: Test on Ruby ${{ matrix.ruby }} Ubuntu
18
- runs-on: ubuntu-latest
19
- continue-on-error: ${{ matrix.experimental }}
20
- strategy:
21
- fail-fast: false
22
- matrix:
23
- ruby: [ '2.6', '2.5', '2.4' ]
24
- experimental: [false]
25
- include:
26
- - ruby: '2.7'
27
- experimental: true
28
- steps:
29
- - uses: actions/checkout@master
30
- - name: Use Ruby
31
- uses: actions/setup-ruby@v1
32
- with:
33
- ruby-version: ${{ matrix.ruby }}
34
- - name: Install Inkscape
35
- run: |
36
- sudo add-apt-repository ppa:inkscape.dev/stable
37
- sudo apt update
38
- sudo apt install inkscape
39
- inkscape --version
40
- - name: Update gems
41
- run: |
42
- gem install bundler
43
- bundle install --jobs 4 --retry 3
44
- - name: Run specs
45
- run: |
46
- bundle exec rake
47
- - name: Trigger repositories
48
- if: matrix.ruby == '2.6'
49
- env:
50
- GH_USERNAME: metanorma-ci
51
- GH_ACCESS_TOKEN: ${{ secrets.METANORMA_CI_PAT_TOKEN }}
52
- run: |
53
- curl -LO --retry 3 https://raw.githubusercontent.com/metanorma/metanorma-build-scripts/master/trigger-gh-actions.sh
54
- [[ -f ".github/workflows/dependent_repos.env" ]] && source .github/workflows/dependent_repos.env
55
- CLIENT_PAYLOAD=$(cat <<EOF
56
- "{ "ref": "${GITHUB_REF}", "repo": "${GITHUB_REPOSITORY}" }"
57
- EOF
58
- )
59
- for repo in $REPOS
60
- do
61
- sh trigger-gh-actions.sh $ORGANISATION $repo $GH_USERNAME $GH_ACCESS_TOKEN $GITHUB_REPOSITORY "$CLIENT_PAYLOAD"
62
- done