metanorma-iso 1.3.23 → 1.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (69) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/macos.yml +8 -0
  3. data/.github/workflows/ubuntu.yml +8 -0
  4. data/.github/workflows/windows.yml +8 -0
  5. data/lib/asciidoctor/iso/base.rb +26 -13
  6. data/lib/asciidoctor/iso/biblio.rng +36 -6
  7. data/lib/asciidoctor/iso/cleanup.rb +20 -3
  8. data/lib/asciidoctor/iso/front.rb +16 -107
  9. data/lib/asciidoctor/iso/front_id.rb +196 -0
  10. data/lib/asciidoctor/iso/isodoc.rng +450 -4
  11. data/lib/asciidoctor/iso/isostandard-amd.rng +98 -0
  12. data/lib/asciidoctor/iso/isostandard.rng +12 -1
  13. data/lib/asciidoctor/iso/macros.rb +21 -0
  14. data/lib/asciidoctor/iso/reqt.rng +23 -0
  15. data/lib/asciidoctor/iso/section.rb +18 -32
  16. data/lib/asciidoctor/iso/term_lookup_cleanup.rb +87 -0
  17. data/lib/asciidoctor/iso/validate.rb +41 -25
  18. data/lib/asciidoctor/iso/validate_requirements.rb +1 -1
  19. data/lib/asciidoctor/iso/validate_section.rb +2 -2
  20. data/lib/asciidoctor/iso/validate_style.rb +6 -5
  21. data/lib/asciidoctor/iso/validate_title.rb +1 -1
  22. data/lib/isodoc/iso/base_convert.rb +67 -99
  23. data/lib/isodoc/iso/html/header.html +10 -6
  24. data/lib/isodoc/iso/html/html_iso_titlepage.html +25 -16
  25. data/lib/isodoc/iso/html/isodoc.scss +25 -0
  26. data/lib/isodoc/iso/html/scripts.html +18 -0
  27. data/lib/isodoc/iso/html/style-human.scss +23 -0
  28. data/lib/isodoc/iso/html/style-iso.scss +18 -0
  29. data/lib/isodoc/iso/html/word_iso_intro.html +4 -0
  30. data/lib/isodoc/iso/html/word_iso_titlepage.html +21 -0
  31. data/lib/isodoc/iso/html/wordstyle.scss +45 -4
  32. data/lib/isodoc/iso/html_convert.rb +7 -0
  33. data/lib/isodoc/iso/iso.amendment.xsl +5082 -0
  34. data/lib/isodoc/iso/iso.international-standard.xsl +1899 -796
  35. data/lib/isodoc/iso/metadata.rb +69 -23
  36. data/lib/isodoc/iso/pdf_convert.rb +5 -11
  37. data/lib/isodoc/iso/presentation_xml_convert.rb +13 -0
  38. data/lib/isodoc/iso/sections.rb +66 -0
  39. data/lib/isodoc/iso/sts_convert.rb +31 -0
  40. data/lib/isodoc/iso/xref.rb +111 -0
  41. data/lib/metanorma-iso.rb +2 -0
  42. data/lib/metanorma/iso/processor.rb +23 -8
  43. data/lib/metanorma/iso/version.rb +1 -1
  44. data/metanorma-iso.gemspec +5 -2
  45. data/spec/asciidoctor-iso/amd_spec.rb +726 -0
  46. data/spec/asciidoctor-iso/base_spec.rb +31 -21
  47. data/spec/asciidoctor-iso/blocks_spec.rb +6 -6
  48. data/spec/asciidoctor-iso/cleanup_spec.rb +15 -15
  49. data/spec/asciidoctor-iso/inline_spec.rb +1 -1
  50. data/spec/asciidoctor-iso/macros_spec.rb +289 -0
  51. data/spec/asciidoctor-iso/refs_spec.rb +5 -5
  52. data/spec/asciidoctor-iso/section_spec.rb +8 -8
  53. data/spec/asciidoctor-iso/table_spec.rb +1 -1
  54. data/spec/isodoc/amd_spec.rb +652 -0
  55. data/spec/isodoc/blocks_spec.rb +112 -27
  56. data/spec/isodoc/i18n_spec.rb +8 -8
  57. data/spec/isodoc/inline_spec.rb +4 -4
  58. data/spec/isodoc/iso_spec.rb +1 -1
  59. data/spec/isodoc/metadata_spec.rb +90 -4
  60. data/spec/isodoc/postproc_spec.rb +11 -116
  61. data/spec/isodoc/ref_spec.rb +9 -9
  62. data/spec/isodoc/section_spec.rb +33 -6
  63. data/spec/isodoc/table_spec.rb +29 -29
  64. data/spec/isodoc/terms_spec.rb +4 -4
  65. data/spec/isodoc/xref_spec.rb +34 -28
  66. data/spec/metanorma/processor_spec.rb +2 -2
  67. data/spec/spec_helper.rb +11 -0
  68. metadata +63 -12
  69. data/asciidoctor-iso.gemspec.old +0 -50
@@ -6,19 +6,25 @@ module IsoDoc
6
6
  def initialize(lang, script, labels)
7
7
  super
8
8
  @metadata = {
9
- tc: "XXXX",
10
- sc: "XXXX",
11
- wg: "XXXX",
12
- editorialgroup: [],
13
- secretariat: "XXXX",
14
- obsoletes: nil,
15
- obsoletes_part: nil
16
- }
9
+ tc: "XXXX",
10
+ sc: "XXXX",
11
+ wg: "XXXX",
12
+ editorialgroup: [],
13
+ secretariat: "XXXX",
14
+ obsoletes: nil,
15
+ obsoletes_part: nil
16
+ }
17
17
  end
18
18
 
19
- def status_abbrev(stage, substage, iter, draft)
19
+ def status_abbrev(stage, substage, iter, draft, doctype)
20
20
  return "" unless stage
21
- stage += iter if iter
21
+ if %w(technical-report technical-specification).include?(doctype)
22
+ stage = "DTS" if stage == "DIS"
23
+ stage = "FDTS" if stage == "FDIS"
24
+ end
25
+ if %w(PWI NWIP WD CD).include?(stage)
26
+ stage += iter if iter
27
+ end
22
28
  stage = "Pre" + stage if draft =~ /^0\./
23
29
  stage
24
30
  end
@@ -33,7 +39,8 @@ module IsoDoc
33
39
  set(:statusabbr, status_abbrev(docstatus["abbreviation"] || "??",
34
40
  isoxml&.at(ns("//bibdata/status/substage"))&.text,
35
41
  isoxml&.at(ns("//bibdata/status/iteration"))&.text,
36
- isoxml&.at(ns("//version/draft"))&.text))
42
+ isoxml&.at(ns("//version/draft"))&.text,
43
+ isoxml&.at(ns("//bibdata/ext/doctype"))&.text))
37
44
  unpublished(docstatus.text) and
38
45
  set(:stageabbr, docstatus["abbreviation"])
39
46
  end
@@ -46,12 +53,14 @@ module IsoDoc
46
53
  end
47
54
 
48
55
  def docid(isoxml, _out)
49
- dn = isoxml.at(ns("//bibdata/docidentifier[@type = 'iso']"))
56
+ dn = isoxml.at(ns("//bibdata/docidentifier[@type = 'ISO']"))
50
57
  set(:docnumber, dn&.text)
51
58
  tcdn = isoxml.xpath(ns("//bibdata/docidentifier[@type = 'iso-tc']"))
52
59
  set(:tc_docnumber, tcdn.map { |n| n.text })
53
60
  dn = isoxml.at(ns("//bibdata/docidentifier[@type = 'iso-with-lang']"))
54
61
  set(:docnumber_lang, dn&.text)
62
+ dn = isoxml.at(ns("//bibdata/docidentifier[@type = 'iso-reference']"))
63
+ set(:docnumber_reference, dn&.text)
55
64
  end
56
65
 
57
66
  # we don't leave this to i18n.rb, because we have both English and
@@ -63,6 +72,20 @@ module IsoDoc
63
72
  end
64
73
  end
65
74
 
75
+ def amd_label(lang)
76
+ case lang
77
+ when "en" then "AMENDMENT"
78
+ when "fr" then "AMENDMENT"
79
+ end
80
+ end
81
+
82
+ def corr_label(lang)
83
+ case lang
84
+ when "en" then "TECHNICAL CORRIGENDUM"
85
+ when "fr" then "RECTIFICATIF TECHNIQUE"
86
+ end
87
+ end
88
+
66
89
  def part_title(part, partnum, subpartnum, lang)
67
90
  return "" unless part
68
91
  suffix = @c.encode(part.text, :hexadecimal)
@@ -76,6 +99,14 @@ module IsoDoc
76
99
  "#{part_label(lang)} #{partnum}"
77
100
  end
78
101
 
102
+ def amd_prefix(num, lang)
103
+ "#{amd_label(lang)} #{num}"
104
+ end
105
+
106
+ def corr_prefix(num, lang)
107
+ "#{corr_label(lang)} #{num}"
108
+ end
109
+
79
110
  def compose_title(main, intro, part, partnum, subpartnum, lang)
80
111
  main = main.nil? ? "" : @c.encode(main.text, :hexadecimal)
81
112
  intro &&
@@ -87,12 +118,23 @@ module IsoDoc
87
118
  main
88
119
  end
89
120
 
121
+ def title_nums(isoxml)
122
+ [isoxml.at(ns("//bibdata//project-number/@part")),
123
+ isoxml.at(ns("//bibdata//project-number/@subpart")),
124
+ isoxml.at(ns("//bibdata//project-number/@amendment")),
125
+ isoxml.at(ns("//bibdata//project-number/@corrigendum"))]
126
+ end
127
+
128
+ def title_parts(isoxml, lang)
129
+ [isoxml.at(ns("//bibdata//title[@type='title-intro' and @language='#{lang}']")),
130
+ isoxml.at(ns("//bibdata//title[@type='title-main' and @language='#{lang}']")),
131
+ isoxml.at(ns("//bibdata//title[@type='title-part' and @language='#{lang}']")),
132
+ isoxml.at(ns("//bibdata//title[@type='title-amd' and @language='#{lang}']"))]
133
+ end
134
+
90
135
  def title(isoxml, _out)
91
- intro = isoxml.at(ns("//bibdata//title[@type='title-intro' and @language='en']"))
92
- main = isoxml.at(ns("//bibdata//title[@type='title-main' and @language='en']"))
93
- part = isoxml.at(ns("//bibdata//title[@type='title-part' and @language='en']"))
94
- partnumber = isoxml.at(ns("//bibdata//project-number/@part"))
95
- subpartnumber = isoxml.at(ns("//bibdata//project-number/@subpart"))
136
+ intro, main, part, amd = title_parts(isoxml, "en")
137
+ partnumber, subpartnumber, amdnumber, corrnumber = title_nums(isoxml)
96
138
 
97
139
  set(:doctitlemain, @c.encode(main ? main.text : "", :hexadecimal))
98
140
  main = compose_title(main, intro, part, partnumber, subpartnumber, "en")
@@ -100,20 +142,24 @@ module IsoDoc
100
142
  set(:doctitleintro, @c.encode(intro ? intro.text : "", :hexadecimal)) if intro
101
143
  set(:doctitlepartlabel, part_prefix(partnumber, subpartnumber, "en"))
102
144
  set(:doctitlepart, @c.encode(part.text, :hexadecimal)) if part
145
+ set(:doctitleamdlabel, amd_prefix(amdnumber, "en")) if amdnumber
146
+ set(:doctitleamd, @c.encode(amd.text, :hexadecimal)) if amd
147
+ set(:doctitlecorrlabel, corr_prefix(corrnumber, "en")) if corrnumber
103
148
  end
104
149
 
105
150
  def subtitle(isoxml, _out)
106
- intro = isoxml.at(ns("//bibdata//title[@type='title-intro' and @language='fr']"))
107
- main = isoxml.at(ns("//bibdata//title[@type='title-main' and @language='fr']"))
108
- part = isoxml.at(ns("//bibdata//title[@type='title-part' and @language='fr']"))
109
- partnumber = isoxml.at(ns("//bibdata//project-number/@part"))
110
- subpartnumber = isoxml.at(ns("//bibdata//project-number/@subpart"))
151
+ intro, main, part, amd = title_parts(isoxml, "fr")
152
+ partnumber, subpartnumber, amdnumber, corrnumber = title_nums(isoxml)
153
+
111
154
  set(:docsubtitlemain, @c.encode(main ? main.text : "", :hexadecimal))
112
155
  main = compose_title(main, intro, part, partnumber, subpartnumber, "fr")
113
156
  set(:docsubtitle, main)
114
157
  set(:docsubtitleintro, @c.encode(intro ? intro.text : "", :hexadecimal)) if intro
115
158
  set(:docsubtitlepartlabel, part_prefix(partnumber, subpartnumber, "fr"))
116
159
  set(:docsubtitlepart, @c.encode(part.text, :hexadecimal)) if part
160
+ set(:docsubtitleamdlabel, amd_prefix(amdnumber, "fr")) if amdnumber
161
+ set(:docsubtitleamd, @c.encode(amd.text, :hexadecimal)) if amd
162
+ set(:docsubtitlecorrlabel, corr_prefix(corrnumber, "fr")) if corrnumber
117
163
  end
118
164
 
119
165
  def author(xml, _out)
@@ -164,7 +210,7 @@ module IsoDoc
164
210
  super
165
211
  ics = []
166
212
  isoxml.xpath(ns("//bibdata/ext/ics/code")).each { |i| ics << i.text }
167
- set(:ics, ics.empty? ? "XXX" : ics.join(", "))
213
+ set(:ics, ics.empty? ? nil : ics.join(", "))
168
214
  end
169
215
  end
170
216
  end
@@ -13,18 +13,12 @@ module IsoDoc
13
13
  super
14
14
  end
15
15
 
16
- def convert(filename, file = nil, debug = false)
17
- file = File.read(filename, encoding: "utf-8") if file.nil?
18
- docxml, outname_html, dir = convert_init(file, filename, debug)
19
- /\.xml$/.match(filename) or
20
- filename = Tempfile.open([outname_html, ".xml"], encoding: "utf-8") do |f|
21
- f.write file
22
- f.path
16
+ def pdf_stylesheet(docxml)
17
+ case doctype = docxml&.at(ns("//bibdata/ext/doctype"))&.text
18
+ when "amendment", "technical-corrigendum" then "itu.recommendation-annex.xsl"
19
+ else
20
+ "iso.international-standard.xsl"
23
21
  end
24
- FileUtils.rm_rf dir
25
- ::Metanorma::Output::XslfoPdf.new.convert(
26
- filename, outname_html + ".pdf",
27
- File.join(@libdir, "iso.international-standard.xsl"))
28
22
  end
29
23
  end
30
24
  end
@@ -0,0 +1,13 @@
1
+ require_relative "base_convert"
2
+ require "isodoc"
3
+
4
+ module IsoDoc
5
+ module Iso
6
+
7
+ # A {Converter} implementation that generates HTML output, and a document
8
+ # schema encapsulation of the document for validation
9
+ #
10
+ class PresentationXMLConvert < IsoDoc::PresentationXMLConvert
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,66 @@
1
+ module IsoDoc
2
+ module Iso
3
+ module BaseConvert
4
+ def middle_title(out)
5
+ middle_title_main(out)
6
+ middle_title_amd(out)
7
+ end
8
+
9
+ def middle_title_main(out)
10
+ out.p(**{ class: "zzSTDTitle1" }) do |p|
11
+ p << @meta.get[:doctitleintro]
12
+ p << " &mdash; " if @meta.get[:doctitleintro] && @meta.get[:doctitlemain]
13
+ p << @meta.get[:doctitlemain]
14
+ p << " &mdash; " if @meta.get[:doctitlemain] && @meta.get[:doctitlepart]
15
+ end
16
+ a = @meta.get[:doctitlepart] and out.p(**{ class: "zzSTDTitle2" }) do |p|
17
+ b = @meta.get[:doctitlepartlabel] and p << "#{b}: "
18
+ p << "<br/><b>#{a}</b>"
19
+ end
20
+ end
21
+
22
+ def middle_title_amd(out)
23
+ a = @meta.get[:doctitleamdlabel] and out.p(**{ class: "zzSTDTitle2" }) do |p|
24
+ p << a
25
+ a = @meta.get[:doctitleamd] and p << ": #{a}"
26
+ end
27
+ a = @meta.get[:doctitlecorrlabel] and out.p(**{ class: "zzSTDTitle2" }) do |p|
28
+ p << a
29
+ end
30
+ end
31
+
32
+ def annex(isoxml, out)
33
+ amd(isoxml) and @suppressheadingnumbers = @oldsuppressheadingnumbers
34
+ super
35
+ amd(isoxml) and @suppressheadingnumbers = true
36
+ end
37
+
38
+ def introduction(isoxml, out)
39
+ f = isoxml.at(ns("//introduction")) || return
40
+ num = f.at(ns(".//clause")) ? "0" : nil
41
+ title_attr = { class: "IntroTitle" }
42
+ page_break(out)
43
+ out.div **{ class: "Section3", id: f["id"] } do |div|
44
+ clause_name(num, @introduction_lbl, div, title_attr)
45
+ f.elements.each do |e|
46
+ parse(e, div) unless e.name == "title"
47
+ end
48
+ end
49
+ end
50
+
51
+ def foreword(isoxml, out)
52
+ f = isoxml.at(ns("//foreword")) || return
53
+ page_break(out)
54
+ out.div **attr_code(id: f["id"]) do |s|
55
+ s.h1(**{ class: "ForewordTitle" }) { |h1| h1 << @foreword_lbl }
56
+ f.elements.each { |e| parse(e, s) unless e.name == "title" }
57
+ end
58
+ end
59
+
60
+ def clause_parse_title(node, div, c1, out)
61
+ return inline_header_title(out, node, c1) if c1.nil?
62
+ super
63
+ end
64
+ end
65
+ end
66
+ end
@@ -0,0 +1,31 @@
1
+ require "isodoc"
2
+ require "mn2sts"
3
+
4
+ module IsoDoc
5
+ module Iso
6
+
7
+ # A {Converter} implementation that generates HTML output, and a document
8
+ # schema encapsulation of the document for validation
9
+ #
10
+ class StsConvert < IsoDoc::XslfoPdfConvert
11
+ def initialize(options)
12
+ @libdir = File.dirname(__FILE__)
13
+ @format = :sts
14
+ @suffix = "sts.xml"
15
+ end
16
+
17
+ def convert(input_filename, file = nil, debug = false, output_filename = nil)
18
+ file = File.read(input_filename, encoding: "utf-8") if file.nil?
19
+ docxml, filename, dir = convert_init(file, input_filename, debug)
20
+ /\.xml$/.match(input_filename) or
21
+ input_filename = Tempfile.open([filename, ".xml"], encoding: "utf-8") do |f|
22
+ f.write file
23
+ f.path
24
+ end
25
+ FileUtils.rm_rf dir
26
+ Mn2sts.convert(input_filename, output_filename || "#{filename}.#{@suffix}")
27
+ end
28
+ end
29
+ end
30
+ end
31
+
@@ -0,0 +1,111 @@
1
+ module IsoDoc
2
+ module Iso
3
+ class Xref < IsoDoc::Xref
4
+ def parse(docxml)
5
+ if @klass.amd(docxml)
6
+ back_anchor_names(docxml)
7
+ note_anchor_names(docxml.xpath(ns("//annex//table | //annex//figure")))
8
+ note_anchor_names(docxml.xpath(ns("//annex")))
9
+ example_anchor_names(docxml.xpath(ns("//annex")))
10
+ list_anchor_names(docxml.xpath(ns("//annex")))
11
+ else
12
+ super
13
+ end
14
+ end
15
+
16
+ def initial_anchor_names(d)
17
+ super
18
+ introduction_names(d.at(ns("//introduction")))
19
+ end
20
+
21
+ # we can reference 0-number clauses in introduction
22
+ def introduction_names(clause)
23
+ return if clause.nil?
24
+ clause.xpath(ns("./clause")).each_with_index do |c, i|
25
+ section_names1(c, "0.#{i + 1}", 2)
26
+ end
27
+ end
28
+
29
+ def annex_names(clause, num)
30
+ appendix_names(clause, num)
31
+ super
32
+ end
33
+
34
+ def appendix_names(clause, num)
35
+ clause.xpath(ns("./appendix")).each_with_index do |c, i|
36
+ @anchors[c["id"]] = anchor_struct(i + 1, nil, @labels["appendix"], "clause")
37
+ @anchors[c["id"]][:level] = 2
38
+ @anchors[c["id"]][:container] = clause["id"]
39
+ end
40
+ end
41
+
42
+ def section_names1(clause, num, level)
43
+ @anchors[clause["id"]] =
44
+ { label: num, level: level, xref: num }
45
+ # subclauses are not prefixed with "Clause"
46
+ clause.xpath(ns("./clause | ./terms | ./term | ./definitions | "\
47
+ "./references")).
48
+ each_with_index do |c, i|
49
+ section_names1(c, "#{num}.#{i + 1}", level + 1)
50
+ end
51
+ end
52
+
53
+ def annex_names1(clause, num, level)
54
+ @anchors[clause["id"]] = { label: num, xref: num, level: level }
55
+ clause.xpath(ns("./clause | ./references")).each_with_index do |c, i|
56
+ annex_names1(c, "#{num}.#{i + 1}", level + 1)
57
+ end
58
+ end
59
+
60
+ def hierarchical_formula_names(clause, num)
61
+ c = IsoDoc::XrefGen::Counter.new
62
+ clause.xpath(ns(".//formula")).each do |t|
63
+ next if t["id"].nil? || t["id"].empty?
64
+ @anchors[t["id"]] =
65
+ anchor_struct("#{num}#{hiersep}#{c.increment(t).print}", t,
66
+ t["inequality"] ? @labels["inequality"] : @labels["formula"],
67
+ "formula", t["unnumbered"])
68
+ end
69
+ end
70
+
71
+ def figure_anchor(t, sublabel, label)
72
+ @anchors[t["id"]] = anchor_struct(
73
+ (sublabel ? "#{label} #{sublabel}" : label),
74
+ nil, @labels["figure"], "figure", t["unnumbered"])
75
+ sublabel && t["unnumbered"] != "true" and
76
+ @anchors[t["id"]][:label] = sublabel
77
+ end
78
+
79
+ def sequential_figure_names(clause)
80
+ c = IsoDoc::XrefGen::Counter.new
81
+ j = 0
82
+ clause.xpath(ns(".//figure | .//sourcecode[not(ancestor::example)]")).
83
+ each do |t|
84
+ j = subfigure_increment(j, c, t)
85
+ sublabel = j.zero? ? nil : "#{(j+96).chr})"
86
+ next if t["id"].nil? || t["id"].empty?
87
+ figure_anchor(t, sublabel, c.print)
88
+ end
89
+ end
90
+
91
+ def hierarchical_figure_names(clause, num)
92
+ c = IsoDoc::XrefGen::Counter.new
93
+ j = 0
94
+ clause.xpath(ns(".//figure | .//sourcecode[not(ancestor::example)]")).
95
+ each do |t|
96
+ j = subfigure_increment(j, c, t)
97
+ label = "#{num}#{hiersep}#{c.print}"
98
+ sublabel = j.zero? ? nil : "#{(j+96).chr})"
99
+ next if t["id"].nil? || t["id"].empty?
100
+ figure_anchor(t, sublabel, label)
101
+ end
102
+ end
103
+
104
+ def reference_names(ref)
105
+ super
106
+ @anchors[ref["id"]] = { xref: @anchors[ref["id"]][:xref].
107
+ sub(/ \(All Parts\)/i, "") }
108
+ end
109
+ end
110
+ end
111
+ end
@@ -4,6 +4,8 @@ require_relative "metanorma/iso/version"
4
4
  require_relative "isodoc/iso/html_convert"
5
5
  require_relative "isodoc/iso/word_convert"
6
6
  require_relative "isodoc/iso/pdf_convert"
7
+ require_relative "isodoc/iso/sts_convert"
8
+ require_relative "isodoc/iso/presentation_xml_convert"
7
9
  require "asciidoctor/extensions"
8
10
 
9
11
  if defined? Metanorma
@@ -2,8 +2,13 @@ require "metanorma/processor"
2
2
 
3
3
  module Metanorma
4
4
  module Iso
5
- def self.pdf_fonts
6
- ["Cambria", "Times New Roman", "Cambria Math", "HanSans", "Courier"]
5
+ def self.fonts_used
6
+ {
7
+ html: ["Cambria", "Times New Roman", "Cambria Math", "HanSans", "Courier New"],
8
+ html_alt: ["Cambria", "Times New Roman", "Cambria Math", "HanSans", "Courier New"],
9
+ doc: ["Cambria", "Times New Roman", "Cambria Math", "HanSans", "Courier New"],
10
+ pdf: ["Cambria", "Times New Roman", "Cambria Math", "HanSans", "Courier New"],
11
+ }
7
12
  end
8
13
 
9
14
  class Processor < Metanorma::Processor
@@ -19,7 +24,8 @@ module Metanorma
19
24
  html: "html",
20
25
  html_alt: "alt.html",
21
26
  doc: "doc",
22
- pdf: "pdf"
27
+ pdf: "pdf",
28
+ sts: "sts.xml"
23
29
  )
24
30
  end
25
31
 
@@ -31,16 +37,25 @@ module Metanorma
31
37
  Metanorma::Input::Asciidoc.new.process(file, filename, @asciidoctor_backend)
32
38
  end
33
39
 
34
- def output(isodoc_node, outname, format, options={})
40
+ def use_presentation_xml(ext)
41
+ return true if ext == :html_alt
42
+ super
43
+ end
44
+
45
+ def output(isodoc_node, inname, outname, format, options={})
35
46
  case format
36
47
  when :html
37
- IsoDoc::Iso::HtmlConvert.new(options).convert(outname, isodoc_node)
48
+ IsoDoc::Iso::HtmlConvert.new(options).convert(inname, isodoc_node, nil, outname)
38
49
  when :html_alt
39
- IsoDoc::Iso::HtmlConvert.new(options.merge(alt: true)).convert(outname, isodoc_node)
50
+ IsoDoc::Iso::HtmlConvert.new(options.merge(alt: true)).convert(inname, isodoc_node, nil, outname)
40
51
  when :doc
41
- IsoDoc::Iso::WordConvert.new(options).convert(outname, isodoc_node)
52
+ IsoDoc::Iso::WordConvert.new(options).convert(inname, isodoc_node, nil, outname)
42
53
  when :pdf
43
- IsoDoc::Iso::PdfConvert.new(options).convert(outname, isodoc_node)
54
+ IsoDoc::Iso::PdfConvert.new(options).convert(inname, isodoc_node, nil, outname)
55
+ when :sts
56
+ IsoDoc::Iso::StsConvert.new(options).convert(inname, isodoc_node, nil, outname)
57
+ when :presentation
58
+ IsoDoc::Iso::PresentationXMLConvert.new(options).convert(inname, isodoc_node, nil, outname)
44
59
  else
45
60
  super
46
61
  end