isodoc 1.2.6 → 1.2.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.
@@ -70,11 +70,8 @@ RSpec.describe IsoDoc do
70
70
  presxml = <<~"PRESXML"
71
71
  <iso-standard xmlns='http://riboseinc.com/isoxml' type="presentation">
72
72
  <bibdata>
73
- <language>en</language>
73
+ <language current="true">en</language>
74
74
  </bibdata>
75
- <local_bibdata>
76
- <language>en</language>
77
- </local_bibdata>
78
75
  <preface>
79
76
  <foreword obligation='informative'>
80
77
  <title>Foreword</title>
@@ -229,12 +226,12 @@ PRESXML
229
226
  </body>
230
227
  </html>
231
228
  OUTPUT
232
- expect(xmlpp(IsoDoc::PresentationXMLConvert.new({}).convert("test", input, true))).to be_equivalent_to xmlpp(presxml)
229
+ expect(xmlpp(IsoDoc::PresentationXMLConvert.new({}).convert("test", input, true).sub(%r{<localized-strings>.*</localized-strings>}m, ""))).to be_equivalent_to xmlpp(presxml)
233
230
  expect(xmlpp(IsoDoc::HtmlConvert.new({}).convert("test", presxml, true))).to be_equivalent_to xmlpp(output)
234
231
  end
235
232
 
236
233
  it "defaults to English" do
237
- expect(xmlpp(IsoDoc::PresentationXMLConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
234
+ expect(xmlpp(IsoDoc::PresentationXMLConvert.new({}).convert("test", <<~"INPUT", true).sub(%r{<localized-strings>.*</localized-strings>}m, ""))).to be_equivalent_to xmlpp(<<~"OUTPUT")
238
235
  <iso-standard xmlns="http://riboseinc.com/isoxml">
239
236
  <bibdata>
240
237
  <language>tlh</language>
@@ -301,11 +298,8 @@ PRESXML
301
298
  <?xml version='1.0'?>
302
299
  <iso-standard xmlns='http://riboseinc.com/isoxml' type="presentation">
303
300
  <bibdata>
304
- <language>tlh</language>
301
+ <language current="true">tlh</language>
305
302
  </bibdata>
306
- <local_bibdata>
307
- <language>tlh</language>
308
- </local_bibdata>
309
303
  <preface>
310
304
  <foreword obligation='informative'>
311
305
  <title>Foreword</title>
@@ -457,11 +451,8 @@ PRESXML
457
451
  presxml = <<~"PRESXML"
458
452
  <iso-standard xmlns='http://riboseinc.com/isoxml' type="presentation">
459
453
  <bibdata>
460
- <language>fr</language>
454
+ <language current="true">fr</language>
461
455
  </bibdata>
462
- <local_bibdata>
463
- <language>fr</language>
464
- </local_bibdata>
465
456
  <preface>
466
457
  <foreword obligation='informative'>
467
458
  <title>Foreword</title>
@@ -616,7 +607,7 @@ PRESXML
616
607
  </body>
617
608
  </html>
618
609
  OUTPUT
619
- expect(xmlpp(IsoDoc::PresentationXMLConvert.new({}).convert("test", input, true))).to be_equivalent_to xmlpp(presxml)
610
+ expect(xmlpp(IsoDoc::PresentationXMLConvert.new({}).convert("test", input, true).sub(%r{<localized-strings>.*</localized-strings>}m, ""))).to be_equivalent_to xmlpp(presxml)
620
611
  expect(xmlpp(IsoDoc::HtmlConvert.new({}).convert("test", presxml, true))).to be_equivalent_to xmlpp(output)
621
612
  end
622
613
 
@@ -700,13 +691,9 @@ PRESXML
700
691
  presxml = <<~"PRESXML"
701
692
  <iso-standard xmlns='http://riboseinc.com/isoxml' type="presentation">
702
693
  <bibdata>
703
- <language>zh</language>
704
- <script>Hans</script>
694
+ <language current="true">zh</language>
695
+ <script current="true">Hans</script>
705
696
  </bibdata>
706
- <local_bibdata>
707
- <language>zh</language>
708
- <script>Hans</script>
709
- </local_bibdata>
710
697
  <preface>
711
698
  <foreword obligation='informative'>
712
699
  <title>Foreword</title>
@@ -875,11 +862,12 @@ PRESXML
875
862
  </body>
876
863
  </html>
877
864
  OUTPUT
878
- expect(xmlpp(IsoDoc::PresentationXMLConvert.new({}).convert("test", input, true))).to be_equivalent_to xmlpp(presxml)
865
+ expect(xmlpp(IsoDoc::PresentationXMLConvert.new({}).convert("test", input, true).sub(%r{<localized-strings>.*</localized-strings>}m, ""))).to be_equivalent_to xmlpp(presxml)
879
866
  expect(xmlpp(IsoDoc::HtmlConvert.new({}).convert("test", presxml, true))).to be_equivalent_to xmlpp(output)
880
867
  end
881
868
 
882
869
  it "processes i18n file" do
870
+ mock_i18n
883
871
  input = <<~"INPUT"
884
872
  <iso-standard xmlns="http://riboseinc.com/isoxml">
885
873
  <bibdata>
@@ -966,27 +954,46 @@ PRESXML
966
954
  presxml = <<~OUTPUT
967
955
  <iso-standard xmlns="http://riboseinc.com/isoxml" type="presentation">
968
956
  <bibdata>
969
- <language>eo</language>
970
- <script>Latn</script>
957
+ <language current="true">eo</language>
958
+ <script current="true">Latn</script>
971
959
  <status>
972
- <stage>published</stage>
973
- <substage>withdrawn</substage>
960
+ <stage language=''>published</stage>
961
+ <stage language='eo'>publikigita</stage>
962
+ <substage language=''>withdrawn</substage>
963
+ <substage language='eo'>fortirita</substage>
974
964
  </status>
975
965
  <ext>
976
- <doctype>brochure</doctype>
966
+ <doctype language=''>brochure</doctype>
967
+ <doctype language='eo'>bro&#x15D;uro</doctype>
977
968
  </ext>
978
969
  </bibdata>
979
- <local_bibdata>
980
- <language>eo</language>
981
- <script>Latn</script>
982
- <status>
983
- <stage>publikigita</stage>
984
- <substage>fortirita</substage>
985
- </status>
986
- <ext>
987
- <doctype>bro&#x15D;uro</doctype>
988
- </ext>
989
- </local_bibdata>
970
+ <localized-strings>
971
+ <localized-string key='foreword' language='eo'>Anta&#x16D;parolo</localized-string>
972
+ <localized-string key='introduction' language='eo'>Enkonduko</localized-string>
973
+ <localized-string key='clause' language='eo'>kla&#x16D;zo</localized-string>
974
+ <localized-string key='table' language='eo'>Tabelo</localized-string>
975
+ <localized-string key='source' language='eo'>SOURCE</localized-string>
976
+ <localized-string key='modified' language='eo'>modified</localized-string>
977
+ <localized-string key='scope' language='eo'>Amplekso</localized-string>
978
+ <localized-string key='symbols' language='eo'>Simboloj kai mallongigitaj terminoj</localized-string>
979
+ <localized-string key='annex' language='eo'>Aldono</localized-string>
980
+ <localized-string key='normref' language='eo'>Normaj cita&#x135;oj</localized-string>
981
+ <localized-string key='bibliography' language='eo'>Bibliografio</localized-string>
982
+ <localized-string key='inform_annex' language='eo'>informa</localized-string>
983
+ <localized-string key='all_parts' language='eo'>&#x109;iuj partoj</localized-string>
984
+ <localized-string key='norm_annex' language='eo'>normative</localized-string>
985
+ <localized-string key='locality.table' language='eo'>Tabelo</localized-string>
986
+ <localized-string key='doctype_dict.brochure' language='eo'>bro&#x15D;uro</localized-string>
987
+ <localized-string key='doctype_dict.conference_proceedings' language='eo'>konferencaktoj</localized-string>
988
+ <localized-string key='stage_dict.published' language='eo'>publikigita</localized-string>
989
+ <localized-string key='substage_dict.withdrawn' language='eo'>fortirita</localized-string>
990
+ <localized-string key='array.0' language='eo'>elem1</localized-string>
991
+ <localized-string key='array.1' language='eo'>elem2</localized-string>
992
+ <localized-string key='array.2.elem3' language='eo'>elem4</localized-string>
993
+ <localized-string key='array.2.elem5' language='eo'>elem6</localized-string>
994
+ <localized-string key='language' language='eo'>eo</localized-string>
995
+ <localized-string key='script' language='eo'>Latn</localized-string>
996
+ </localized-strings>
990
997
  <preface>
991
998
  <foreword obligation="informative">
992
999
  <title>Foreword</title>
@@ -1166,4 +1173,11 @@ PRESXML
1166
1173
  expect(xmlpp(IsoDoc::PresentationXMLConvert.new({i18nyaml: "spec/assets/i18n.yaml"}).convert("test", input, true))).to be_equivalent_to xmlpp(presxml)
1167
1174
  expect(xmlpp(IsoDoc::HtmlConvert.new({i18nyaml: "spec/assets/i18n.yaml"}).convert("test", presxml, true))).to be_equivalent_to xmlpp(output)
1168
1175
  end
1176
+
1177
+ private
1178
+
1179
+ def mock_i18n
1180
+ allow_any_instance_of(::IsoDoc::I18n).to receive(:load_yaml).with("eo", "Latn", "spec/assets/i18n.yaml").and_return(YAML.load_file("spec/assets/i18n.yaml"))
1181
+ end
1182
+
1169
1183
  end
@@ -18,6 +18,8 @@ RSpec.describe IsoDoc do
18
18
  <uri type="pdf">URL D</uri>
19
19
  <uri type="doc">URL E</uri>
20
20
  <docidentifier>17301-1</docidentifier>
21
+ <docidentifier type="ISBN">ISBN 13</docidentifier>
22
+ <docidentifier type="ISBN10">ISBN 10</docidentifier>
21
23
  <docnumber>17301</docnumber>
22
24
  <date type="published"><on>2011</on></date>
23
25
  <date type="accessed"><on>2012</on></date>
@@ -98,8 +100,6 @@ RSpec.describe IsoDoc do
98
100
  <doctype>international-standard</doctype>
99
101
  </ext>
100
102
  </bibdata>
101
- <local_bibdata type="standard">
102
- </local_bibdata>
103
103
  </iso-standard>
104
104
  INPUT
105
105
  {:accesseddate=>"2012",
@@ -116,24 +116,31 @@ INPUT
116
116
  :docnumeric=>"17301",
117
117
  :doctitle=>"Cereals and pulses",
118
118
  :doctype=>"International Standard",
119
+ :doctype_display=>"International Standard",
119
120
  :docyear=>"2016",
120
121
  :draft=>"0.4",
121
122
  :draftinfo=>" (draft 0.4, 2016-05-01)",
122
123
  :edition=>"2",
123
124
  :html=>"URL B",
124
125
  :implementeddate=>"XXX",
126
+ :isbn=>"ISBN 13",
127
+ :isbn10=>"ISBN 10",
125
128
  :issueddate=>"XXX",
126
129
  :iteration=>"2",
127
130
  :keywords=>["KW2", "KW1", "KW3"],
131
+ :lang=>"en",
128
132
  :obsoleteddate=>"2014",
129
133
  :pdf=>"URL D",
130
134
  :publisheddate=>"2011",
131
135
  :receiveddate=>"XXX",
132
136
  :revdate=>"2016-05-01",
133
137
  :revdate_monthyear=>"May 2016",
138
+ :script=>"Latn",
134
139
  :stage=>"Committee Draft",
140
+ :stage_display=>"Committee Draft",
135
141
  :stageabbr=>"CD",
136
142
  :substage=>"Withdrawn",
143
+ :substage_display=>"Withdrawn",
137
144
  :title_footnote=>["A footnote", "Another footnote"],
138
145
  :transmitteddate=>"2020",
139
146
  :unchangeddate=>"2019",
@@ -234,11 +241,13 @@ INPUT
234
241
  :docnumeric=>"17301",
235
242
  :doctitle=>"Cereals and pulses",
236
243
  :doctype=>"International Standard",
244
+ :doctype_display=>"International Standard",
237
245
  :docyear=>"2016",
238
246
  :draft=>"12",
239
247
  :draftinfo=>" (draft 12, 2016-05)",
240
248
  :implementeddate=>"XXX",
241
249
  :issueddate=>"XXX",
250
+ :lang=>"en",
242
251
  :obsoleteddate=>"XXX",
243
252
  :obsoletes=>"IEC 8121",
244
253
  :obsoletes_part=>"3.1",
@@ -253,7 +262,9 @@ INPUT
253
262
  :receiveddate=>"XXX",
254
263
  :revdate=>"2016-05",
255
264
  :revdate_monthyear=>"May 2016",
265
+ :script=>"Latn",
256
266
  :stage=>"Published",
267
+ :stage_display=>"Published",
257
268
  :subdivision=>"Subdivision",
258
269
  :transmitteddate=>"XXX",
259
270
  :unchangeddate=>"XXX",
@@ -271,6 +282,17 @@ OUTPUT
271
282
  <bibdata type="standard">
272
283
  <language>fr</language>
273
284
  <script>Latn</script>
285
+ <status>
286
+ <stage lang="">Committee Draft</stage>
287
+ <stage lang=fr">Projet de comité</stage>
288
+ <substage lang="">Withdrawn</substage>
289
+ <substage lang="fr">Rétiré</substage>
290
+ <iteration>2</iteration>
291
+ </status>
292
+ <ext>
293
+ <doctype lang="">international-standard</doctype>
294
+ <doctype lang="fr">Standard international</doctype>
295
+ </ext>
274
296
  </bibdata>
275
297
  </iso-standard>
276
298
  INPUT
@@ -307,7 +329,13 @@ OUTPUT
307
329
  </contributor>
308
330
  <language>fr</language>
309
331
  <script>Latn</script>
310
- <status><stage>Published</stage></status>
332
+ <status>
333
+ <stage language="">Committee Draft</stage>
334
+ <stage language="fr">Projet de comité</stage>
335
+ <substage language="">Withdrawn</substage>
336
+ <substage language="fr">Rétiré</substage>
337
+ <iteration>2</iteration>
338
+ </status>
311
339
  <copyright>
312
340
  <from>2016</from>
313
341
  <owner>
@@ -316,6 +344,10 @@ OUTPUT
316
344
  </organization>
317
345
  </owner>
318
346
  </copyright>
347
+ <ext>
348
+ <doctype language="">international-standard</doctype>
349
+ <doctype language="fr">Standard international</doctype>
350
+ </ext>
319
351
  </bibdata>
320
352
  </iso-standard>
321
353
  INPUT
@@ -327,20 +359,29 @@ INPUT
327
359
  :createddate=>"XXX",
328
360
  :docnumber=>"17301-1-3",
329
361
  :docnumeric=>"17301",
330
- :doctitle=>"Cereals and pulses",
362
+ :doctitle=>"Céréales et légumineuses",
363
+ :doctype=>"International Standard",
364
+ :doctype_display=>"Standard International",
331
365
  :docyear=>"2016",
332
366
  :implementeddate=>"XXX",
333
367
  :issueddate=>"XXX",
368
+ :iteration=>"2",
369
+ :lang=>"fr",
334
370
  :obsoleteddate=>"XXX",
335
371
  :publisheddate=>"2011-01",
336
372
  :publisher=>"International Organization for Standardization et International Electrotechnical Commission",
337
373
  :receiveddate=>"XXX",
338
374
  :revdate=>"2016-05",
339
375
  :revdate_monthyear=>"Mai 2016",
340
- :stage=>"Published",
376
+ :script=>"Latn",
377
+ :stage=>"Committee Draft",
378
+ :stage_display=>"Projet De Comité",
379
+ :stageabbr=>"CD",
380
+ :substage=>"Withdrawn",
381
+ :substage_display=>"Rétiré",
341
382
  :transmitteddate=>"XXX",
342
383
  :unchangeddate=>"XXX",
343
- :unpublished=>false,
384
+ :unpublished=>true,
344
385
  :updateddate=>"XXX",
345
386
  :vote_endeddate=>"XXX",
346
387
  :vote_starteddate=>"XXX"}
@@ -127,11 +127,8 @@ RSpec.describe IsoDoc do
127
127
  presxml = <<~PRESXML
128
128
  <iso-standard xmlns='http://riboseinc.com/isoxml' type="presentation">
129
129
  <bibdata>
130
- <language>en</language>
130
+ <language current="true">en</language>
131
131
  </bibdata>
132
- <local_bibdata>
133
- <language>en</language>
134
- </local_bibdata>
135
132
  <preface>
136
133
  <foreword>
137
134
  <p id='_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f'>
@@ -423,7 +420,7 @@ RSpec.describe IsoDoc do
423
420
  </html>
424
421
 
425
422
  OUTPUT
426
- expect(xmlpp(IsoDoc::PresentationXMLConvert.new({}).convert("test", input, true))).to be_equivalent_to xmlpp(presxml)
423
+ expect(xmlpp(IsoDoc::PresentationXMLConvert.new({}).convert("test", input, true).sub(%r{<localized-strings>.*</localized-strings>}m, ""))).to be_equivalent_to xmlpp(presxml)
427
424
  expect(xmlpp(IsoDoc::HtmlConvert.new({}).convert("test", presxml, true))).to be_equivalent_to xmlpp(html)
428
425
  end
429
426
 
@@ -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.2.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: 2020-10-11 00:00:00.000000000 Z
11
+ date: 2020-10-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: asciimath
@@ -128,14 +128,14 @@ dependencies:
128
128
  requirements:
129
129
  - - "~>"
130
130
  - !ruby/object:Gem::Version
131
- version: 1.1.0
131
+ version: 1.2.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: 1.1.0
138
+ version: 1.2.0
139
139
  - !ruby/object:Gem::Dependency
140
140
  name: relaton-cli
141
141
  requirement: !ruby/object:Gem::Requirement
@@ -150,6 +150,20 @@ dependencies:
150
150
  - - ">="
151
151
  - !ruby/object:Gem::Version
152
152
  version: '0'
153
+ - !ruby/object:Gem::Dependency
154
+ name: gyoku
155
+ requirement: !ruby/object:Gem::Requirement
156
+ requirements:
157
+ - - "~>"
158
+ - !ruby/object:Gem::Version
159
+ version: '1.3'
160
+ type: :runtime
161
+ prerelease: false
162
+ version_requirements: !ruby/object:Gem::Requirement
163
+ requirements:
164
+ - - "~>"
165
+ - !ruby/object:Gem::Version
166
+ version: '1.3'
153
167
  - !ruby/object:Gem::Dependency
154
168
  name: rake
155
169
  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"
@@ -364,6 +376,7 @@ files:
364
376
  - lib/isodoc/html_function/postprocess.rb
365
377
  - lib/isodoc/i18n.rb
366
378
  - lib/isodoc/metadata.rb
379
+ - lib/isodoc/metadata_contributor.rb
367
380
  - lib/isodoc/metadata_date.rb
368
381
  - lib/isodoc/pdf_convert.rb
369
382
  - 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