isodoc 0.7.1 → 0.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (59) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +8 -6
  3. data/README.adoc +3 -3
  4. data/lib/{isodoc → isodoc-yaml}/i18n-en.yaml +0 -0
  5. data/lib/{isodoc → isodoc-yaml}/i18n-fr.yaml +0 -0
  6. data/lib/{isodoc → isodoc-yaml}/i18n-zh-Hans.yaml +0 -0
  7. data/lib/isodoc.rb +13 -6
  8. data/lib/isodoc/class_utils.rb +24 -0
  9. data/lib/isodoc/common.rb +34 -0
  10. data/lib/isodoc/convert.rb +3 -16
  11. data/lib/isodoc/function.rb +4 -0
  12. data/lib/isodoc/{blocks.rb → function/blocks.rb} +2 -2
  13. data/lib/isodoc/{cleanup.rb → function/cleanup.rb} +4 -9
  14. data/lib/isodoc/{i18n.rb → function/i18n.rb} +13 -10
  15. data/lib/isodoc/{inline.rb → function/inline.rb} +2 -4
  16. data/lib/isodoc/{lists.rb → function/lists.rb} +5 -4
  17. data/lib/isodoc/{references.rb → function/references.rb} +4 -3
  18. data/lib/isodoc/{section.rb → function/section.rb} +4 -3
  19. data/lib/isodoc/{table.rb → function/table.rb} +3 -2
  20. data/lib/isodoc/{terms.rb → function/terms.rb} +3 -2
  21. data/lib/isodoc/{iso2wordhtml.rb → function/to_word_html.rb} +2 -3
  22. data/lib/isodoc/{utils.rb → function/utils.rb} +6 -22
  23. data/lib/isodoc/{xref_gen.rb → function/xref_gen.rb} +4 -3
  24. data/lib/isodoc/{xref_sect_gen.rb → function/xref_sect_gen.rb} +4 -3
  25. data/lib/isodoc/html_convert.rb +12 -0
  26. data/lib/isodoc/html_function.rb +4 -0
  27. data/lib/isodoc/{htmlconvert → html_function}/comments.rb +2 -3
  28. data/lib/isodoc/{htmlconvert → html_function}/footnotes.rb +3 -4
  29. data/lib/isodoc/{htmlconvert → html_function}/html.rb +5 -5
  30. data/lib/isodoc/iso/html/html_iso_titlepage.html +2 -2
  31. data/lib/isodoc/iso/{convert.rb → html_convert.rb} +1 -1
  32. data/lib/isodoc/iso/{wordconvert.rb → word_convert.rb} +0 -0
  33. data/lib/isodoc/metadata.rb +27 -12
  34. data/lib/isodoc/version.rb +1 -1
  35. data/lib/isodoc/{wordconvert/convert.rb → word_convert.rb} +9 -11
  36. data/lib/isodoc/word_function.rb +4 -0
  37. data/lib/isodoc/word_function/body.rb +149 -0
  38. data/lib/isodoc/{wordconvert → word_function}/comments.rb +2 -2
  39. data/lib/isodoc/word_function/footnotes.rb +81 -0
  40. data/lib/isodoc/word_function/postprocess.rb +116 -0
  41. data/spec/isodoc/blocks_spec.rb +17 -17
  42. data/spec/isodoc/cleanup_spec.rb +8 -8
  43. data/spec/isodoc/footnotes_spec.rb +2 -2
  44. data/spec/isodoc/i18n_spec.rb +4 -4
  45. data/spec/isodoc/inline_spec.rb +7 -7
  46. data/spec/isodoc/iso_spec.rb +5 -5
  47. data/spec/isodoc/lists_spec.rb +4 -4
  48. data/spec/isodoc/metadata_spec.rb +2 -2
  49. data/spec/isodoc/postproc_spec.rb +9 -9
  50. data/spec/isodoc/ref_spec.rb +3 -3
  51. data/spec/isodoc/section_spec.rb +6 -6
  52. data/spec/isodoc/table_spec.rb +1 -1
  53. data/spec/isodoc/terms_spec.rb +1 -1
  54. data/spec/isodoc/xref_spec.rb +11 -11
  55. metadata +35 -30
  56. data/lib/isodoc/htmlconvert/convert.rb +0 -13
  57. data/lib/isodoc/wordconvert/footnotes.rb +0 -81
  58. data/lib/isodoc/wordconvert/postprocess.rb +0 -115
  59. data/lib/isodoc/wordconvert/wordconvertmodule.rb +0 -150
@@ -2,7 +2,7 @@ require "spec_helper"
2
2
 
3
3
  RSpec.describe IsoDoc do
4
4
  it "processes unordered lists" do
5
- expect(IsoDoc::Convert.new({}).convert("test", <<~"INPUT", true)).to be_equivalent_to <<~"OUTPUT"
5
+ expect(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true)).to be_equivalent_to <<~"OUTPUT"
6
6
  <iso-standard xmlns="http://riboseinc.com/isoxml">
7
7
  <preface><foreword>
8
8
  <ul id="_61961034-0fb1-436b-b281-828857a59ddb">
@@ -37,7 +37,7 @@ RSpec.describe IsoDoc do
37
37
  end
38
38
 
39
39
  it "processes ordered lists" do
40
- expect(IsoDoc::Convert.new({}).convert("test", <<~"INPUT", true)).to be_equivalent_to <<~"OUTPUT"
40
+ expect(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true)).to be_equivalent_to <<~"OUTPUT"
41
41
  <iso-standard xmlns="http://riboseinc.com/isoxml">
42
42
  <preface><foreword>
43
43
  <ol id="_ae34a226-aab4-496d-987b-1aa7b6314026" type="alphabet">
@@ -86,7 +86,7 @@ RSpec.describe IsoDoc do
86
86
  end
87
87
 
88
88
  it "processes Roman Upper ordered lists" do
89
- expect(IsoDoc::Convert.new({}).convert("test", <<~"INPUT", true)).to be_equivalent_to <<~"OUTPUT"
89
+ expect(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true)).to be_equivalent_to <<~"OUTPUT"
90
90
  <iso-standard xmlns="http://riboseinc.com/isoxml">
91
91
  <preface><foreword>
92
92
  <ol id="_ae34a226-aab4-496d-987b-1aa7b6314026" type="roman_upper">
@@ -127,7 +127,7 @@ RSpec.describe IsoDoc do
127
127
  end
128
128
 
129
129
  it "processes definition lists" do
130
- expect(IsoDoc::Convert.new({}).convert("test", <<~"INPUT", true)).to be_equivalent_to <<~"OUTPUT"
130
+ expect(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true)).to be_equivalent_to <<~"OUTPUT"
131
131
  <iso-standard xmlns="http://riboseinc.com/isoxml">
132
132
  <preface><foreword>
133
133
  <dl id="_732d3f57-4f88-40bf-9ae9-633891edc395">
@@ -69,7 +69,7 @@ RSpec.describe IsoDoc do
69
69
  </version>
70
70
  </iso-standard>
71
71
  INPUT
72
- {:accesseddate=>"2012", :activateddate=>"2013", :agency=>"ISO", :confirmeddate=>"XXX", :createddate=>"2010&ndash;2011", :docnumber=>"PreCD3 17301-1", :docsubtitle=>"C&#xe9;r&#xe9;ales et l&#xe9;gumineuses&nbsp;&mdash; Sp&#xe9;cification et m&#xe9;thodes d&#x27;essai&nbsp;&mdash; Partie&nbsp;1: Riz", :doctitle=>"Cereals and pulses&nbsp;&mdash; Specifications and test methods&nbsp;&mdash; Part&nbsp;1: Rice", :doctype=>"International Standard", :docyear=>"2016", :draft=>"0.4", :draftinfo=>" (draft 0.4, 2016-05-01)", :editorialgroup=>["TC 34", "SC 4", "WG 3"], :implementeddate=>"XXX", :issueddate=>"XXX", :obsoleteddate=>"2014", :obsoletes=>nil, :obsoletes_part=>nil, :publisheddate=>"2011", :revdate=>"2016-05-01", :sc=>"SC 4", :secretariat=>"GB", :stage=>"30", :stageabbr=>"PreCD3", :tc=>"TC 34", :updateddate=>"XXX", :wg=>"WG 3"}
72
+ {:accesseddate=>"2012", :activateddate=>"2013", :agency=>"ISO", :confirmeddate=>"XXX", :createddate=>"2010&ndash;2011", :docnumber=>"PreCD3 17301-1", :docsubtitle=>"C&#xe9;r&#xe9;ales et l&#xe9;gumineuses&nbsp;&mdash; Sp&#xe9;cification et m&#xe9;thodes d&#x27;essai&nbsp;&mdash; Partie&nbsp;1: Riz", :docsubtitleintro=>"C\u00E9r\u00E9ales et l\u00E9gumineuses", :docsubtitlemain=>"Sp\u00E9cification et m\u00E9thodes d'essai", :docsubtitlepart=>"Partie&nbsp;1: Riz", :doctitle=>"Cereals and pulses&nbsp;&mdash; Specifications and test methods&nbsp;&mdash; Part&nbsp;1: Rice", :doctitleintro=>"Cereals and pulses", :doctitlemain=>"Specifications and test methods", :doctitlepart=>"Part&nbsp;1: Rice", :doctype=>"International Standard", :docyear=>"2016", :draft=>"0.4", :draftinfo=>" (draft 0.4, 2016-05-01)", :editorialgroup=>["TC 34", "SC 4", "WG 3"], :implementeddate=>"XXX", :issueddate=>"XXX", :obsoleteddate=>"2014", :obsoletes=>nil, :obsoletes_part=>nil, :publisheddate=>"2011", :revdate=>"2016-05-01", :sc=>"SC 4", :secretariat=>"GB", :stage=>"30", :stageabbr=>"PreCD3", :tc=>"TC 34", :updateddate=>"XXX", :wg=>"WG 3"}
73
73
  OUTPUT
74
74
  end
75
75
 
@@ -143,7 +143,7 @@ OUTPUT
143
143
  </version>
144
144
  </iso-standard>
145
145
  INPUT
146
- {:accesseddate=>"XXX", :agency=>"ISO/IEC", :confirmeddate=>"XXX", :createddate=>"XXX", :docnumber=>"CD 17301-1-3", :docsubtitle=>"C&#xe9;r&#xe9;ales et l&#xe9;gumineuses&nbsp;&mdash; Sp&#xe9;cification et m&#xe9;thodes d&#x27;essai&nbsp;&mdash; Partie&nbsp;1&ndash;3: Riz", :doctitle=>"Cereals and pulses&nbsp;&mdash; Specifications and test methods&nbsp;&mdash; Part&nbsp;1&ndash;3: Rice", :doctype=>"International Standard", :docyear=>"2016", :draft=>"12", :draftinfo=>" (draft 12, 2016-05-01)", :editorialgroup=>["ABC 34", "DEF 4", "GHI 3"], :implementeddate=>"XXX", :issueddate=>"XXX", :obsoleteddate=>"XXX", :obsoletes=>"IEC 8121", :obsoletes_part=>"3.1", :publisheddate=>"XXX", :revdate=>"2016-05-01", :sc=>"DEF 4", :secretariat=>"XXXX", :stage=>"30", :stageabbr=>"CD", :tc=>"ABC 34", :updateddate=>"XXX", :wg=>"GHI 3"}
146
+ {:accesseddate=>"XXX", :agency=>"ISO/IEC", :confirmeddate=>"XXX", :createddate=>"XXX", :docnumber=>"CD 17301-1-3", :docsubtitle=>"C&#xe9;r&#xe9;ales et l&#xe9;gumineuses&nbsp;&mdash; Sp&#xe9;cification et m&#xe9;thodes d&#x27;essai&nbsp;&mdash; Partie&nbsp;1&ndash;3: Riz", :docsubtitleintro=>"C\u00E9r\u00E9ales et l\u00E9gumineuses", :docsubtitlemain=>"Sp\u00E9cification et m\u00E9thodes d'essai", :docsubtitlepart=>"Partie&nbsp;1&ndash;3: Riz", :doctitle=>"Cereals and pulses&nbsp;&mdash; Specifications and test methods&nbsp;&mdash; Part&nbsp;1&ndash;3: Rice", :doctitleintro=>"Cereals and pulses", :doctitlemain=>"Specifications and test methods", :doctitlepart=>"Part&nbsp;1&ndash;3: Rice", :doctype=>"International Standard", :docyear=>"2016", :draft=>"12", :draftinfo=>" (draft 12, 2016-05-01)", :editorialgroup=>["ABC 34", "DEF 4", "GHI 3"], :implementeddate=>"XXX", :issueddate=>"XXX", :obsoleteddate=>"XXX", :obsoletes=>"IEC 8121", :obsoletes_part=>"3.1", :publisheddate=>"XXX", :revdate=>"2016-05-01", :sc=>"DEF 4", :secretariat=>"XXXX", :stage=>"30", :stageabbr=>"CD", :tc=>"ABC 34", :updateddate=>"XXX", :wg=>"GHI 3"}
147
147
  OUTPUT
148
148
  end
149
149
 
@@ -4,7 +4,7 @@ RSpec.describe IsoDoc do
4
4
  it "generates file based on string input" do
5
5
  system "rm -f test.doc"
6
6
  system "rm -f test.html"
7
- IsoDoc::Convert.new({wordstylesheet: "spec/assets/word.css", htmlstylesheet: "spec/assets/html.css", filename: "test"}).convert("test", <<~"INPUT", false)
7
+ IsoDoc::HtmlConvert.new({wordstylesheet: "spec/assets/word.css", htmlstylesheet: "spec/assets/html.css", filename: "test"}).convert("test", <<~"INPUT", false)
8
8
  <iso-standard xmlns="http://riboseinc.com/isoxml">
9
9
  <preface><foreword>
10
10
  <note>
@@ -24,7 +24,7 @@ RSpec.describe IsoDoc do
24
24
  it "generates HTML output docs with null configuration" do
25
25
  system "rm -f test.doc"
26
26
  system "rm -f test.html"
27
- IsoDoc::Convert.new({wordstylesheet: "spec/assets/word.css", htmlstylesheet: "spec/assets/html.css"}).convert("test", <<~"INPUT", false)
27
+ IsoDoc::HtmlConvert.new({wordstylesheet: "spec/assets/word.css", htmlstylesheet: "spec/assets/html.css"}).convert("test", <<~"INPUT", false)
28
28
  <iso-standard xmlns="http://riboseinc.com/isoxml">
29
29
  <preface><foreword>
30
30
  <note>
@@ -61,7 +61,7 @@ RSpec.describe IsoDoc do
61
61
  it "generates HTML output docs with null configuration from file" do
62
62
  system "rm -f spec/assets/iso.doc"
63
63
  system "rm -f spec/assets/iso.html"
64
- IsoDoc::Convert.new({wordstylesheet: "spec/assets/word.css", htmlstylesheet: "spec/assets/html.css"}).convert("spec/assets/iso.xml", nil, false)
64
+ IsoDoc::HtmlConvert.new({wordstylesheet: "spec/assets/word.css", htmlstylesheet: "spec/assets/html.css"}).convert("spec/assets/iso.xml", nil, false)
65
65
  expect(File.exist?("spec/assets/iso.html")).to be true
66
66
  html = File.read("spec/assets/iso.html")
67
67
  expect(html).to match(/another empty stylesheet/)
@@ -80,7 +80,7 @@ RSpec.describe IsoDoc do
80
80
  it "generates HTML output docs with complete configuration" do
81
81
  system "rm -f test.doc"
82
82
  system "rm -f test.html"
83
- IsoDoc::Convert.new({wordstylesheet: "spec/assets/word.css", htmlstylesheet: "spec/assets/html.css", standardstylesheet: "spec/assets/std.css", header: "spec/assets/header.html", htmlcoverpage: "spec/assets/htmlcover.html", htmlintropage: "spec/assets/htmlintro.html", scripts: "spec/assets/scripts.html", wordcoverpage: "spec/assets/wordcover.html", wordintropage: "spec/assets/wordintro.html", i18nyaml: "spec/assets/i18n.yaml", ulstyle: "l1", olstyle: "l2"}).convert("test", <<~"INPUT", false)
83
+ IsoDoc::HtmlConvert.new({wordstylesheet: "spec/assets/word.css", htmlstylesheet: "spec/assets/html.css", standardstylesheet: "spec/assets/std.css", header: "spec/assets/header.html", htmlcoverpage: "spec/assets/htmlcover.html", htmlintropage: "spec/assets/htmlintro.html", scripts: "spec/assets/scripts.html", wordcoverpage: "spec/assets/wordcover.html", wordintropage: "spec/assets/wordintro.html", i18nyaml: "spec/assets/i18n.yaml", ulstyle: "l1", olstyle: "l2"}).convert("test", <<~"INPUT", false)
84
84
  <iso-standard xmlns="http://riboseinc.com/isoxml">
85
85
  <preface><foreword>
86
86
  <note>
@@ -261,8 +261,8 @@ Content-Location: file:///C:/Doc/test_files/header.html
261
261
  Content-Transfer-Encoding: base64
262
262
  Content-Type: text/html charset="utf-8"
263
263
 
264
- Ci8qIGFuIGVtcHR5IGhlYWRlciAqLwoKU1RBUlQgRE9DIElEOiB7eyBkb2NudW1iZXIgfX06IEVO
265
- RCBET0MgSUQKCkZJTEVOQU1FOiB7eyBmaWxlbmFtZSB9fQoK
264
+ Ci8qIGFuIGVtcHR5IGhlYWRlciAqLwoKU1RBUlQgRE9DIElEOiAxMDAwLTE6IEVORCBET0MgSUQK
265
+ CkZJTEVOQU1FOiB0ZXN0Cgo=
266
266
 
267
267
  OUTPUT
268
268
  end
@@ -348,7 +348,7 @@ RCBET0MgSUQKCkZJTEVOQU1FOiB7eyBmaWxlbmFtZSB9fQoK
348
348
 
349
349
  it "reorders footnote numbers in HTML" do
350
350
  system "rm -f test.html"
351
- IsoDoc::Convert.new({wordstylesheet: "spec/assets/word.css", htmlstylesheet: "spec/assets/html.css", wordintropage: "spec/assets/wordintro.html"}).convert("test", <<~"INPUT", false)
351
+ IsoDoc::HtmlConvert.new({wordstylesheet: "spec/assets/word.css", htmlstylesheet: "spec/assets/html.css", wordintropage: "spec/assets/wordintro.html"}).convert("test", <<~"INPUT", false)
352
352
  <iso-standard xmlns="http://riboseinc.com/isoxml">
353
353
  <sections>
354
354
  <clause inline-header="false" obligation="normative"><title>Clause 4</title><fn reference="3">
@@ -403,7 +403,7 @@ RCBET0MgSUQKCkZJTEVOQU1FOiB7eyBmaWxlbmFtZSB9fQoK
403
403
  it "moves images in HTML" do
404
404
  system "rm -f test.html"
405
405
  system "rm -rf _images"
406
- IsoDoc::Convert.new({wordstylesheet: "spec/assets/word.css", htmlstylesheet: "spec/assets/html.css"}).convert("test", <<~"INPUT", false)
406
+ IsoDoc::HtmlConvert.new({wordstylesheet: "spec/assets/word.css", htmlstylesheet: "spec/assets/html.css"}).convert("test", <<~"INPUT", false)
407
407
  <iso-standard xmlns="http://riboseinc.com/isoxml">
408
408
  <preface><foreword>
409
409
  <figure id="_">
@@ -435,7 +435,7 @@ RCBET0MgSUQKCkZJTEVOQU1FOiB7eyBmaWxlbmFtZSB9fQoK
435
435
  it "processes IsoXML terms for HTML" do
436
436
  system "rm -f test.doc"
437
437
  system "rm -f test.html"
438
- IsoDoc::Convert.new({wordstylesheet: "spec/assets/word.css", htmlstylesheet: "spec/assets/html.css"}).convert("test", <<~"INPUT", false)
438
+ IsoDoc::HtmlConvert.new({wordstylesheet: "spec/assets/word.css", htmlstylesheet: "spec/assets/html.css"}).convert("test", <<~"INPUT", false)
439
439
  <iso-standard xmlns="http://riboseinc.com/isoxml">
440
440
  <sections>
441
441
  <terms id="_terms_and_definitions" obligation="normative"><title>Terms and Definitions</title>
@@ -2,7 +2,7 @@ require "spec_helper"
2
2
 
3
3
  RSpec.describe IsoDoc do
4
4
  it "processes IsoXML bibliographies" do
5
- expect(IsoDoc::Convert.new({}).convert("test", <<~"INPUT", true)).to be_equivalent_to <<~"OUTPUT"
5
+ expect(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true)).to be_equivalent_to <<~"OUTPUT"
6
6
  <iso-standard xmlns="http://riboseinc.com/isoxml">
7
7
  <preface><foreword>
8
8
  <p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f">
@@ -110,10 +110,10 @@ RSpec.describe IsoDoc do
110
110
  </body>
111
111
  </html>
112
112
  OUTPUT
113
- end
113
+ end
114
114
 
115
115
  it "processes empty IsoXML Normative references" do
116
- expect(IsoDoc::Convert.new({}).convert("test", <<~"INPUT", true)).to be_equivalent_to <<~"OUTPUT"
116
+ expect(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true)).to be_equivalent_to <<~"OUTPUT"
117
117
  <iso-standard xmlns="http://riboseinc.com/isoxml">
118
118
  <bibliography><references id="_normative_references" obligation="informative"><title>Normative References</title>
119
119
  </references>
@@ -2,7 +2,7 @@ require "spec_helper"
2
2
 
3
3
  RSpec.describe IsoDoc do
4
4
  it "processes section names" do
5
- expect(IsoDoc::Convert.new({}).convert("test", <<~"INPUT", true)).to be_equivalent_to <<~"OUTPUT"
5
+ expect(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true)).to be_equivalent_to <<~"OUTPUT"
6
6
  <iso-standard xmlns="http://riboseinc.com/isoxml">
7
7
  <preface>
8
8
  <foreword obligation="informative">
@@ -326,7 +326,7 @@ OUTPUT
326
326
  end
327
327
 
328
328
  it "processes simple terms & definitions" do
329
- expect(IsoDoc::Convert.new({}).convert("test", <<~"INPUT", true)).to be_equivalent_to <<~"OUTPUT"
329
+ expect(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true)).to be_equivalent_to <<~"OUTPUT"
330
330
  <iso-standard xmlns="http://riboseinc.com/isoxml">
331
331
  <sections>
332
332
  <terms id="H" obligation="normative"><title>Terms, Definitions, Symbols and Abbreviated Terms</title>
@@ -360,7 +360,7 @@ OUTPUT
360
360
  end
361
361
 
362
362
  it "processes terms & definitions with external source" do
363
- expect(IsoDoc::Convert.new({}).convert("test", <<~"INPUT", true)).to be_equivalent_to <<~"OUTPUT"
363
+ expect(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true)).to be_equivalent_to <<~"OUTPUT"
364
364
  <iso-standard xmlns="http://riboseinc.com/isoxml">
365
365
  <termdocsource type="inline" bibitemid="ISO712"/>
366
366
  <sections>
@@ -413,7 +413,7 @@ OUTPUT
413
413
  end
414
414
 
415
415
  it "processes empty terms & definitions with external source" do
416
- expect(IsoDoc::Convert.new({}).convert("test", <<~"INPUT", true)).to be_equivalent_to <<~"OUTPUT"
416
+ expect(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true)).to be_equivalent_to <<~"OUTPUT"
417
417
  <iso-standard xmlns="http://riboseinc.com/isoxml">
418
418
  <termdocsource type="inline" bibitemid="ISO712"/>
419
419
  <termdocsource type="inline" bibitemid="ISO712"/>
@@ -464,7 +464,7 @@ OUTPUT
464
464
 
465
465
 
466
466
  it "processes empty terms & definitions" do
467
- expect(IsoDoc::Convert.new({}).convert("test", <<~"INPUT", true)).to be_equivalent_to <<~"OUTPUT"
467
+ expect(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true)).to be_equivalent_to <<~"OUTPUT"
468
468
  <iso-standard xmlns="http://riboseinc.com/isoxml">
469
469
  <sections>
470
470
  <terms id="H" obligation="normative"><title>Terms, Definitions, Symbols and Abbreviated Terms</title>
@@ -492,7 +492,7 @@ OUTPUT
492
492
  end
493
493
 
494
494
  it "processes inline section headers" do
495
- expect(IsoDoc::Convert.new({}).convert("test", <<~"INPUT", true)).to be_equivalent_to <<~"OUTPUT"
495
+ expect(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true)).to be_equivalent_to <<~"OUTPUT"
496
496
  <iso-standard xmlns="http://riboseinc.com/isoxml">
497
497
  <sections>
498
498
  <clause id="M" inline-header="false" obligation="normative"><title>Clause 4</title><clause id="N" inline-header="false" obligation="normative">
@@ -2,7 +2,7 @@ require "spec_helper"
2
2
 
3
3
  RSpec.describe IsoDoc do
4
4
  it "processes IsoXML tables" do
5
- expect(IsoDoc::Convert.new({}).convert("test", <<~"INPUT", true)).to be_equivalent_to <<~"OUTPUT"
5
+ expect(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true)).to be_equivalent_to <<~"OUTPUT"
6
6
  <iso-standard xmlns="http://riboseinc.com/isoxml">
7
7
  <preface>
8
8
  <foreword>
@@ -2,7 +2,7 @@ require "spec_helper"
2
2
 
3
3
  RSpec.describe IsoDoc do
4
4
  it "processes IsoXML terms" do
5
- expect(IsoDoc::Convert.new({}).convert("test", <<~"INPUT", true)).to be_equivalent_to <<~"OUTPUT"
5
+ expect(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true)).to be_equivalent_to <<~"OUTPUT"
6
6
  <iso-standard xmlns="http://riboseinc.com/isoxml">
7
7
  <sections>
8
8
  <terms id="_terms_and_definitions" obligation="normative"><title>Terms and Definitions</title>
@@ -2,7 +2,7 @@ require "spec_helper"
2
2
 
3
3
  RSpec.describe IsoDoc do
4
4
  it "cross-references notes" do
5
- expect(IsoDoc::Convert.new({}).convert("test", <<~"INPUT", true)). to be_equivalent_to <<~"OUTPUT"
5
+ expect(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true)). to be_equivalent_to <<~"OUTPUT"
6
6
  <iso-standard xmlns="http://riboseinc.com/isoxml">
7
7
  <preface>
8
8
  <foreword>
@@ -115,7 +115,7 @@ RSpec.describe IsoDoc do
115
115
  end
116
116
 
117
117
  it "cross-references figures" do
118
- expect(IsoDoc::Convert.new({}).convert("test", <<~"INPUT", true)).to be_equivalent_to <<~"OUTPUT"
118
+ expect(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true)).to be_equivalent_to <<~"OUTPUT"
119
119
  <iso-standard xmlns="http://riboseinc.com/isoxml">
120
120
  <preface>
121
121
  <foreword id="fwd">
@@ -247,7 +247,7 @@ RSpec.describe IsoDoc do
247
247
  end
248
248
 
249
249
  it "cross-references subfigures" do
250
- expect(IsoDoc::Convert.new({}).convert("test", <<~"INPUT", true)).to be_equivalent_to <<~"OUTPUT"
250
+ expect(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true)).to be_equivalent_to <<~"OUTPUT"
251
251
  <iso-standard xmlns="http://riboseinc.com/isoxml">
252
252
  <preface>
253
253
  <foreword id="fwd">
@@ -367,7 +367,7 @@ RSpec.describe IsoDoc do
367
367
  end
368
368
 
369
369
  it "cross-references examples" do
370
- expect(IsoDoc::Convert.new({}).convert("test", <<~"INPUT", true)).to be_equivalent_to <<~"OUTPUT"
370
+ expect(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true)).to be_equivalent_to <<~"OUTPUT"
371
371
  <iso-standard xmlns="http://riboseinc.com/isoxml">
372
372
  <preface>
373
373
  <foreword>
@@ -492,7 +492,7 @@ RSpec.describe IsoDoc do
492
492
  end
493
493
 
494
494
  it "cross-references formulae" do
495
- expect(IsoDoc::Convert.new({}).convert("test", <<~"INPUT", true)).to be_equivalent_to <<~"OUTPUT"
495
+ expect(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true)).to be_equivalent_to <<~"OUTPUT"
496
496
  <iso-standard xmlns="http://riboseinc.com/isoxml">
497
497
  <preface>
498
498
  <foreword>
@@ -614,7 +614,7 @@ RSpec.describe IsoDoc do
614
614
  end
615
615
 
616
616
  it "cross-references tables" do
617
- expect(IsoDoc::Convert.new({}).convert("test", <<~"INPUT", true)).to be_equivalent_to <<~"OUTPUT"
617
+ expect(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true)).to be_equivalent_to <<~"OUTPUT"
618
618
  <iso-standard xmlns="http://riboseinc.com/isoxml">
619
619
  <preface>
620
620
  <foreword>
@@ -775,7 +775,7 @@ RSpec.describe IsoDoc do
775
775
  end
776
776
 
777
777
  it "cross-references term notes" do
778
- expect(IsoDoc::Convert.new({}).convert("test", <<~"INPUT", true)).to be_equivalent_to <<~"OUTPUT"
778
+ expect(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true)).to be_equivalent_to <<~"OUTPUT"
779
779
  <iso-standard xmlns="http://riboseinc.com/isoxml">
780
780
  <preface>
781
781
  <foreword>
@@ -841,7 +841,7 @@ RSpec.describe IsoDoc do
841
841
  end
842
842
 
843
843
  it "cross-references sections" do
844
- expect(IsoDoc::Convert.new({}).convert("test", <<~"INPUT", true)).to be_equivalent_to <<~"OUTPUT"
844
+ expect(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true)).to be_equivalent_to <<~"OUTPUT"
845
845
  <iso-standard xmlns="http://riboseinc.com/isoxml">
846
846
  <preface>
847
847
  <foreword obligation="informative">
@@ -1027,7 +1027,7 @@ RSpec.describe IsoDoc do
1027
1027
  end
1028
1028
 
1029
1029
  it "cross-references lists" do
1030
- expect(IsoDoc::Convert.new({}).convert("test", <<~"INPUT", true)).to be_equivalent_to <<~"OUTPUT"
1030
+ expect(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true)).to be_equivalent_to <<~"OUTPUT"
1031
1031
  <iso-standard xmlns="http://riboseinc.com/isoxml">
1032
1032
  <preface>
1033
1033
  <foreword>
@@ -1141,7 +1141,7 @@ RSpec.describe IsoDoc do
1141
1141
  end
1142
1142
 
1143
1143
  it "cross-references list items" do
1144
- expect(IsoDoc::Convert.new({}).convert("test", <<~"INPUT", true)).to be_equivalent_to <<~"OUTPUT"
1144
+ expect(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true)).to be_equivalent_to <<~"OUTPUT"
1145
1145
  <iso-standard xmlns="http://riboseinc.com/isoxml">
1146
1146
  <preface>
1147
1147
  <foreword>
@@ -1255,7 +1255,7 @@ RSpec.describe IsoDoc do
1255
1255
  end
1256
1256
 
1257
1257
  it "cross-references nested list items" do
1258
- expect(IsoDoc::Convert.new({}).convert("test", <<~"INPUT", true)).to be_equivalent_to <<~"OUTPUT"
1258
+ expect(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true)).to be_equivalent_to <<~"OUTPUT"
1259
1259
  <iso-standard xmlns="http://riboseinc.com/isoxml">
1260
1260
  <preface>
1261
1261
  <foreword>
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: 0.7.1
4
+ version: '0.8'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-06-18 00:00:00.000000000 Z
11
+ date: 2018-06-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: asciimath
@@ -342,20 +342,32 @@ files:
342
342
  - Rakefile
343
343
  - bin/rspec
344
344
  - isodoc.gemspec
345
+ - lib/isodoc-yaml/i18n-en.yaml
346
+ - lib/isodoc-yaml/i18n-fr.yaml
347
+ - lib/isodoc-yaml/i18n-zh-Hans.yaml
345
348
  - lib/isodoc.rb
346
- - lib/isodoc/blocks.rb
347
- - lib/isodoc/cleanup.rb
349
+ - lib/isodoc/class_utils.rb
350
+ - lib/isodoc/common.rb
348
351
  - lib/isodoc/convert.rb
349
- - lib/isodoc/htmlconvert/comments.rb
350
- - lib/isodoc/htmlconvert/convert.rb
351
- - lib/isodoc/htmlconvert/footnotes.rb
352
- - lib/isodoc/htmlconvert/html.rb
353
- - lib/isodoc/i18n-en.yaml
354
- - lib/isodoc/i18n-fr.yaml
355
- - lib/isodoc/i18n-zh-Hans.yaml
356
- - lib/isodoc/i18n.rb
357
- - lib/isodoc/inline.rb
358
- - lib/isodoc/iso/convert.rb
352
+ - lib/isodoc/function.rb
353
+ - lib/isodoc/function/blocks.rb
354
+ - lib/isodoc/function/cleanup.rb
355
+ - lib/isodoc/function/i18n.rb
356
+ - lib/isodoc/function/inline.rb
357
+ - lib/isodoc/function/lists.rb
358
+ - lib/isodoc/function/references.rb
359
+ - lib/isodoc/function/section.rb
360
+ - lib/isodoc/function/table.rb
361
+ - lib/isodoc/function/terms.rb
362
+ - lib/isodoc/function/to_word_html.rb
363
+ - lib/isodoc/function/utils.rb
364
+ - lib/isodoc/function/xref_gen.rb
365
+ - lib/isodoc/function/xref_sect_gen.rb
366
+ - lib/isodoc/html_convert.rb
367
+ - lib/isodoc/html_function.rb
368
+ - lib/isodoc/html_function/comments.rb
369
+ - lib/isodoc/html_function/footnotes.rb
370
+ - lib/isodoc/html_function/html.rb
359
371
  - lib/isodoc/iso/html/header.html
360
372
  - lib/isodoc/iso/html/html_iso_intro.html
361
373
  - lib/isodoc/iso/html/html_iso_titlepage.html
@@ -367,23 +379,16 @@ files:
367
379
  - lib/isodoc/iso/html/word_iso_intro.html
368
380
  - lib/isodoc/iso/html/word_iso_titlepage.html
369
381
  - lib/isodoc/iso/html/wordstyle.scss
370
- - lib/isodoc/iso/wordconvert.rb
371
- - lib/isodoc/iso2wordhtml.rb
372
- - lib/isodoc/lists.rb
382
+ - lib/isodoc/iso/html_convert.rb
383
+ - lib/isodoc/iso/word_convert.rb
373
384
  - lib/isodoc/metadata.rb
374
- - lib/isodoc/references.rb
375
- - lib/isodoc/section.rb
376
- - lib/isodoc/table.rb
377
- - lib/isodoc/terms.rb
378
- - lib/isodoc/utils.rb
379
385
  - lib/isodoc/version.rb
380
- - lib/isodoc/wordconvert/comments.rb
381
- - lib/isodoc/wordconvert/convert.rb
382
- - lib/isodoc/wordconvert/footnotes.rb
383
- - lib/isodoc/wordconvert/postprocess.rb
384
- - lib/isodoc/wordconvert/wordconvertmodule.rb
385
- - lib/isodoc/xref_gen.rb
386
- - lib/isodoc/xref_sect_gen.rb
386
+ - lib/isodoc/word_convert.rb
387
+ - lib/isodoc/word_function.rb
388
+ - lib/isodoc/word_function/body.rb
389
+ - lib/isodoc/word_function/comments.rb
390
+ - lib/isodoc/word_function/footnotes.rb
391
+ - lib/isodoc/word_function/postprocess.rb
387
392
  - spec/assets/header.html
388
393
  - spec/assets/html.css
389
394
  - spec/assets/htmlcover.html
@@ -431,7 +436,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
431
436
  version: '0'
432
437
  requirements: []
433
438
  rubyforge_project:
434
- rubygems_version: 2.7.6
439
+ rubygems_version: 2.7.7
435
440
  signing_key:
436
441
  specification_version: 4
437
442
  summary: Convert documents in IsoDoc into Word and HTML in AsciiDoc.
@@ -1,13 +0,0 @@
1
- require "uuidtools"
2
- require "html2doc"
3
- require "liquid"
4
-
5
- require_relative "comments.rb"
6
- require_relative "footnotes.rb"
7
- require_relative "html.rb"
8
-
9
- module IsoDoc
10
-
11
- class Convert < Common
12
- end
13
- end
@@ -1,81 +0,0 @@
1
- module IsoDoc
2
- class WordConvert < Common
3
-
4
- def footnotes(div)
5
- return if @footnotes.empty?
6
- @footnotes.each { |fn| div.parent << fn }
7
- end
8
-
9
- def make_table_footnote_link(out, fnid, fnref)
10
- attrs = { href: "##{fnid}", class: "TableFootnoteRef" }
11
- out.a **attrs do |a|
12
- a << fnref
13
- end
14
- end
15
-
16
- def make_table_footnote_target(out, fnid, fnref)
17
- attrs = { id: fnid, class: "TableFootnoteRef" }
18
- out.a **attrs do |a|
19
- a << fnref
20
- insert_tab(a, 1)
21
- end
22
- end
23
-
24
- def make_table_footnote_text(node, fnid, fnref)
25
- attrs = { id: "ftn#{fnid}" }
26
- noko do |xml|
27
- xml.div **attr_code(attrs) do |div|
28
- make_table_footnote_target(div, fnid, fnref)
29
- node.children.each { |n| parse(n, div) }
30
- end
31
- end.join("\n")
32
- end
33
-
34
- def make_generic_footnote_text(node, fnid)
35
- noko do |xml|
36
- xml.aside **{ id: "ftn#{fnid}" } do |div|
37
- node.children.each { |n| parse(n, div) }
38
- end
39
- end.join("\n")
40
- end
41
-
42
- def get_table_ancestor_id(node)
43
- table = node.ancestors("table") || node.ancestors("figure")
44
- return UUIDTools::UUID.random_create.to_s if table.empty?
45
- table.last["id"]
46
- end
47
-
48
- def table_footnote_parse(node, out)
49
- fn = node["reference"]
50
- tid = get_table_ancestor_id(node)
51
- make_table_footnote_link(out, tid + fn, fn)
52
- # do not output footnote text if we have already seen it for this table
53
- return if @seen_footnote.include?(tid + fn)
54
- @in_footnote = true
55
- out.aside { |a| a << make_table_footnote_text(node, tid + fn, fn) }
56
- @in_footnote = false
57
- @seen_footnote << (tid + fn)
58
- end
59
-
60
- def footnote_parse(node, out)
61
- return table_footnote_parse(node, out) if @in_table || @in_figure
62
- fn = node["reference"]
63
- out.a **{ "epub:type": "footnote", href: "#ftn#{fn}" } do |a|
64
- a.sup { |sup| sup << fn }
65
- end
66
- return if @seen_footnote.include?(fn)
67
- @in_footnote = true
68
- @footnotes << make_generic_footnote_text(node, fn)
69
- @in_footnote = false
70
- @seen_footnote << fn
71
- end
72
-
73
- def make_footnote(node, fn)
74
- return if @seen_footnote.include?(fn)
75
- @in_footnote = true
76
- @footnotes << make_generic_footnote_text(node, fn)
77
- @in_footnote = false
78
- @seen_footnote << fn
79
- end
80
- end
81
- end