metanorma-standoc 1.8.5 → 1.9.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +2 -0
- data/.rubocop.yml +5 -1
- data/Gemfile.devel +0 -0
- data/lib/asciidoctor/standoc/base.rb +41 -36
- data/lib/asciidoctor/standoc/biblio.rng +4 -6
- data/lib/asciidoctor/standoc/blocks.rb +27 -12
- data/lib/asciidoctor/standoc/blocks_notes.rb +20 -14
- data/lib/asciidoctor/standoc/cleanup.rb +32 -78
- data/lib/asciidoctor/standoc/cleanup_block.rb +56 -59
- data/lib/asciidoctor/standoc/cleanup_boilerplate.rb +32 -21
- data/lib/asciidoctor/standoc/cleanup_footnotes.rb +1 -0
- data/lib/asciidoctor/standoc/cleanup_image.rb +71 -0
- data/lib/asciidoctor/standoc/cleanup_maths.rb +37 -28
- data/lib/asciidoctor/standoc/cleanup_ref.rb +21 -13
- data/lib/asciidoctor/standoc/cleanup_ref_dl.rb +1 -1
- data/lib/asciidoctor/standoc/cleanup_reqt.rb +47 -0
- data/lib/asciidoctor/standoc/cleanup_section.rb +21 -15
- data/lib/asciidoctor/standoc/converter.rb +3 -1
- data/lib/asciidoctor/standoc/front.rb +35 -18
- data/lib/asciidoctor/standoc/front_contributor.rb +5 -5
- data/lib/asciidoctor/standoc/inline.rb +1 -1
- data/lib/asciidoctor/standoc/isodoc.rng +130 -1
- data/lib/asciidoctor/standoc/lists.rb +4 -2
- data/lib/asciidoctor/standoc/macros.rb +40 -13
- data/lib/asciidoctor/standoc/ref.rb +87 -112
- data/lib/asciidoctor/standoc/ref_date_id.rb +62 -0
- data/lib/asciidoctor/standoc/ref_sect.rb +12 -12
- data/lib/asciidoctor/standoc/terms.rb +10 -6
- data/lib/asciidoctor/standoc/utils.rb +32 -6
- data/lib/asciidoctor/standoc/validate.rb +12 -12
- data/lib/metanorma/standoc/version.rb +5 -5
- data/metanorma-standoc.gemspec +11 -11
- data/spec/asciidoctor/base_spec.rb +78 -8
- data/spec/asciidoctor/blocks_spec.rb +10 -0
- data/spec/asciidoctor/cleanup_sections_spec.rb +14 -14
- data/spec/asciidoctor/cleanup_spec.rb +1860 -1874
- data/spec/asciidoctor/inline_spec.rb +272 -273
- data/spec/asciidoctor/macros_spec.rb +8 -2
- data/spec/asciidoctor/refs_spec.rb +135 -7
- data/spec/asciidoctor/section_spec.rb +670 -687
- data/spec/assets/html-override.css +1 -0
- data/spec/assets/word-override.css +1 -0
- data/spec/spec_helper.rb +11 -9
- data/spec/vcr_cassettes/dated_iso_ref_joint_iso_iec.yml +60 -60
- data/spec/vcr_cassettes/isobib_get_123.yml +16 -16
- data/spec/vcr_cassettes/isobib_get_123_1.yml +32 -32
- data/spec/vcr_cassettes/isobib_get_123_1_fr.yml +41 -41
- data/spec/vcr_cassettes/isobib_get_123_2001.yml +15 -15
- data/spec/vcr_cassettes/isobib_get_124.yml +17 -17
- data/spec/vcr_cassettes/rfcbib_get_rfc8341.yml +14 -14
- data/spec/vcr_cassettes/separates_iev_citations_by_top_level_clause.yml +53 -49
- metadata +71 -68
- data/.rubocop.ribose.yml +0 -66
- data/.rubocop.tb.yml +0 -650
- data/spec/asciidoctor/macros_lutaml_spec.rb +0 -80
@@ -0,0 +1,62 @@
|
|
1
|
+
module Asciidoctor
|
2
|
+
module Standoc
|
3
|
+
module Refs
|
4
|
+
def set_date_range(date, text)
|
5
|
+
matched = /^(?<from>[0-9]+)(-+(?<to>[0-9]+))?$/.match text
|
6
|
+
return unless matched[:from]
|
7
|
+
|
8
|
+
if matched[:to]
|
9
|
+
date.from matched[:from]
|
10
|
+
date.to matched[:to]
|
11
|
+
else
|
12
|
+
date.on matched[:from]
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
def id_and_year(id, year)
|
17
|
+
year ? "#{id}:#{year}" : id
|
18
|
+
end
|
19
|
+
|
20
|
+
def norm_year(year)
|
21
|
+
/^&\#821[12];$/.match(year) and return "--"
|
22
|
+
/^\d\d\d\d-\d\d\d\d$/.match(year) and return year
|
23
|
+
year&.sub(/(?<=[0-9])-.*$/, "")
|
24
|
+
end
|
25
|
+
|
26
|
+
def conditional_date(bib, match, noyr)
|
27
|
+
if match.names.include?("year") && !match[:year].nil?
|
28
|
+
bib.date(**{ type: "published" }) do |d|
|
29
|
+
noyr and d.on "--" or set_date_range(d, norm_year(match[:year]))
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
def use_my_anchor(ref, id)
|
35
|
+
ref.parent.elements.last["id"] = id
|
36
|
+
ref
|
37
|
+
end
|
38
|
+
|
39
|
+
def docid(bib, code)
|
40
|
+
type, code1 = if /^\[\d+\]$|^\([^)]+\).*$/.match?(code)
|
41
|
+
["metanorma", mn_code(code)]
|
42
|
+
else
|
43
|
+
@bibdb&.docid_type(code) || [nil, code]
|
44
|
+
end
|
45
|
+
code1.sub!(/^nofetch\((.+)\)$/, "\\1")
|
46
|
+
bib.docidentifier **attr_code(type: type) do |d|
|
47
|
+
d << code1
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
def docnumber(bib, code)
|
52
|
+
bib.docnumber do |d|
|
53
|
+
d << HTMLEntities.new.decode(code).sub(/^[^\d]*/, "")
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
def mn_code(code)
|
58
|
+
code.sub(/^\(/, "[").sub(/\).*$/, "]").sub(/^nofetch\((.+)\)$/, "\\1")
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
@@ -20,12 +20,12 @@ module Asciidoctor
|
|
20
20
|
node.attr("style") == "bibliography" or
|
21
21
|
@log.add("AsciiDoc Input", node, "Section not marked up as [bibliography]!")
|
22
22
|
@biblio = true
|
23
|
-
xml.references **attr_code(attrs.merge(
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
23
|
+
xml.references **attr_code(attrs.merge(
|
24
|
+
normative: node.attr("normative") || false)) do |xml_section|
|
25
|
+
xml_section.title { |t| t << node.title }
|
26
|
+
xml_section << node.content
|
27
|
+
end
|
28
|
+
@biblio = false
|
29
29
|
end
|
30
30
|
|
31
31
|
def bibitem_parse(attrs, xml, node)
|
@@ -43,12 +43,12 @@ module Asciidoctor
|
|
43
43
|
node.attr("style") == "bibliography" or
|
44
44
|
@log.add("AsciiDoc Input", node, "Section not marked up as [bibliography]!")
|
45
45
|
@norm_ref = true
|
46
|
-
xml.references **attr_code(attrs.merge(
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
46
|
+
xml.references **attr_code(attrs.merge(
|
47
|
+
normative: node.attr("normative") || true)) do |xml_section|
|
48
|
+
xml_section.title { |t| t << node.title }
|
49
|
+
xml_section << node.content
|
50
|
+
end
|
51
|
+
@norm_ref = false
|
52
52
|
end
|
53
53
|
|
54
54
|
def global_ievcache_name
|
@@ -79,16 +79,20 @@ module Asciidoctor
|
|
79
79
|
end
|
80
80
|
end
|
81
81
|
|
82
|
-
def term_source_attrs(seen_xref)
|
83
|
-
|
84
|
-
|
82
|
+
def term_source_attrs(node, seen_xref)
|
83
|
+
{ case: seen_xref.children[0]["case"],
|
84
|
+
droploc: seen_xref.children[0]["droploc"],
|
85
|
+
bibitemid: seen_xref.children[0]["target"],
|
86
|
+
format: seen_xref.children[0]["format"], type: "inline" }
|
85
87
|
end
|
86
88
|
|
87
|
-
def add_term_source(xml_t, seen_xref, m)
|
89
|
+
def add_term_source(node, xml_t, seen_xref, m)
|
88
90
|
if seen_xref.children[0].name == "concept"
|
89
91
|
xml_t.origin { |o| o << seen_xref.children[0].to_xml }
|
90
92
|
else
|
91
|
-
|
93
|
+
attrs = term_source_attrs(node, seen_xref)
|
94
|
+
attrs.delete(:text)
|
95
|
+
xml_t.origin seen_xref.children[0].content, **attr_code(attrs)
|
92
96
|
end
|
93
97
|
m[:text] && xml_t.modification do |mod|
|
94
98
|
mod.p { |p| p << m[:text].sub(/^\s+/, "") }
|
@@ -116,7 +120,7 @@ module Asciidoctor
|
|
116
120
|
attrs = { status: matched[:text] ? "modified" : "identical" }
|
117
121
|
xml.termsource **attrs do |xml_t|
|
118
122
|
seen_xref = Nokogiri::XML.fragment(matched[:xref])
|
119
|
-
add_term_source(xml_t, seen_xref, matched)
|
123
|
+
add_term_source(node, xml_t, seen_xref, matched)
|
120
124
|
end
|
121
125
|
end.join("\n")
|
122
126
|
end
|
@@ -19,11 +19,11 @@ module Asciidoctor
|
|
19
19
|
end
|
20
20
|
|
21
21
|
NOKOHEAD = <<~HERE.freeze
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
22
|
+
<!DOCTYPE html SYSTEM
|
23
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
24
|
+
<html xmlns="http://www.w3.org/1999/xhtml">
|
25
|
+
<head> <title></title> <meta charset="UTF-8" /> </head>
|
26
|
+
<body> </body> </html>
|
27
27
|
HERE
|
28
28
|
|
29
29
|
# block for processing XML document fragments as XHTML,
|
@@ -66,10 +66,36 @@ module Asciidoctor
|
|
66
66
|
conv
|
67
67
|
end
|
68
68
|
|
69
|
+
def default_script(lang)
|
70
|
+
case lang
|
71
|
+
when "ar", "fa"
|
72
|
+
"Arab"
|
73
|
+
when "ur"
|
74
|
+
"Aran"
|
75
|
+
when "ru", "bg"
|
76
|
+
"Cyrl"
|
77
|
+
when "hi"
|
78
|
+
"Deva"
|
79
|
+
when "el"
|
80
|
+
"Grek"
|
81
|
+
when "zh"
|
82
|
+
"Hans"
|
83
|
+
when "ko"
|
84
|
+
"Kore"
|
85
|
+
when "he"
|
86
|
+
"Hebr"
|
87
|
+
when "ja"
|
88
|
+
"Jpan"
|
89
|
+
else
|
90
|
+
"Latn"
|
91
|
+
end
|
92
|
+
end
|
93
|
+
|
69
94
|
class EmptyAttr
|
70
|
-
def attr(
|
95
|
+
def attr(_any_attribute)
|
71
96
|
nil
|
72
97
|
end
|
98
|
+
|
73
99
|
def attributes
|
74
100
|
{}
|
75
101
|
end
|
@@ -1,5 +1,5 @@
|
|
1
1
|
require "asciidoctor/standoc/utils"
|
2
|
-
require_relative "./validate_section
|
2
|
+
require_relative "./validate_section"
|
3
3
|
require "nokogiri"
|
4
4
|
require "jing"
|
5
5
|
require "iev"
|
@@ -14,6 +14,7 @@ module Asciidoctor
|
|
14
14
|
def init_iev
|
15
15
|
return nil if @no_isobib
|
16
16
|
return @iev if @iev
|
17
|
+
|
17
18
|
@iev = Iev::Db.new(@iev_globalname, @iev_localname) unless @no_isobib
|
18
19
|
@iev
|
19
20
|
end
|
@@ -44,14 +45,14 @@ module Asciidoctor
|
|
44
45
|
found = false
|
45
46
|
doc.xpath("//references[@normative = 'true']/bibitem").each do |b|
|
46
47
|
next unless docid = b.at("./docidentifier[@type = 'metanorma']")
|
47
|
-
next unless
|
48
|
-
|
48
|
+
next unless /^\[\d+\]$/.match?(docid.text)
|
49
|
+
|
50
|
+
@log.add("Bibliography", b,
|
51
|
+
"Numeric reference in normative references")
|
49
52
|
found = true
|
50
53
|
end
|
51
|
-
|
52
|
-
|
53
|
-
abort("Numeric reference in normative references")
|
54
|
-
end
|
54
|
+
found and
|
55
|
+
clean_abort("Numeric reference in normative references", doc.to_xml)
|
55
56
|
end
|
56
57
|
|
57
58
|
def repeat_id_validate1(ids, x)
|
@@ -72,8 +73,7 @@ module Asciidoctor
|
|
72
73
|
ids = repeat_id_validate1(ids, x)
|
73
74
|
end
|
74
75
|
rescue StandardError => e
|
75
|
-
|
76
|
-
abort(e.message)
|
76
|
+
clean_abort(e.message, doc.to_xml)
|
77
77
|
end
|
78
78
|
end
|
79
79
|
|
@@ -90,8 +90,7 @@ module Asciidoctor
|
|
90
90
|
e[:message])
|
91
91
|
end
|
92
92
|
rescue Jing::Error => e
|
93
|
-
|
94
|
-
abort "Jing failed with error: #{e}"
|
93
|
+
clean_abort("Jing failed with error: #{e}", doc.to_xml)
|
95
94
|
ensure
|
96
95
|
f.close!
|
97
96
|
end
|
@@ -104,7 +103,8 @@ module Asciidoctor
|
|
104
103
|
def formattedstr_strip(doc)
|
105
104
|
doc.xpath("//*[@format] | //stem | //bibdata//description | "\
|
106
105
|
"//formattedref | //bibdata//note | //bibdata/abstract | "\
|
107
|
-
"//bibitem/abstract | //bibitem/note | //misc-container")
|
106
|
+
"//bibitem/abstract | //bibitem/note | //misc-container")
|
107
|
+
.each do |n|
|
108
108
|
n.elements.each do |e|
|
109
109
|
e.traverse do |e1|
|
110
110
|
e1.element? and e1.each { |k, _v| e1.delete(k) }
|
@@ -8,17 +8,17 @@ module Metanorma
|
|
8
8
|
|
9
9
|
def all_modules(mod)
|
10
10
|
[mod] + mod.constants.map { |c| mod.const_get(c) }
|
11
|
-
.select {|c| c.is_a?(Module) && parent_of(c) == mod }
|
12
|
-
.flat_map {|m| all_modules(m) }
|
11
|
+
.select { |c| c.is_a?(Module) && parent_of(c) == mod }
|
12
|
+
.flat_map { |m| all_modules(m) }
|
13
13
|
end
|
14
14
|
|
15
15
|
def versioned(mod, flavour)
|
16
|
-
all_modules(mod).select {|c| defined? c::VERSION}
|
17
|
-
select {|c| c.name =~ /::#{flavour}$/ }
|
16
|
+
all_modules(mod).select { |c| defined? c::VERSION }
|
17
|
+
.select { |c| c.name =~ /::#{flavour}$/ }
|
18
18
|
end
|
19
19
|
end
|
20
20
|
|
21
21
|
module Standoc
|
22
|
-
VERSION= "1.
|
22
|
+
VERSION = "1.9.1".freeze
|
23
23
|
end
|
24
24
|
end
|
data/metanorma-standoc.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# coding: utf-8
|
2
2
|
|
3
|
-
lib = File.expand_path("
|
3
|
+
lib = File.expand_path("lib", __dir__)
|
4
4
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
5
5
|
require "metanorma/standoc/version"
|
6
6
|
|
@@ -27,29 +27,29 @@ Gem::Specification.new do |spec|
|
|
27
27
|
spec.required_ruby_version = Gem::Requirement.new(">= 2.4.0")
|
28
28
|
|
29
29
|
spec.add_dependency "asciidoctor", "~> 2.0.0"
|
30
|
-
spec.add_dependency "ruby-jing"
|
31
|
-
spec.add_dependency "isodoc", "~> 1.5.0"
|
32
30
|
spec.add_dependency "iev", "~> 0.2.1"
|
31
|
+
spec.add_dependency "isodoc", "~> 1.6.0"
|
33
32
|
spec.add_dependency "metanorma-plugin-datastruct"
|
34
|
-
spec.add_dependency "metanorma-plugin-lutaml"
|
33
|
+
spec.add_dependency "metanorma-plugin-lutaml"
|
34
|
+
spec.add_dependency "ruby-jing"
|
35
35
|
# relaton-cli not just relaton, to avoid circular reference in metanorma
|
36
|
+
spec.add_dependency "asciimath2unitsml", "~> 0.3.0"
|
37
|
+
spec.add_dependency "concurrent-ruby"
|
38
|
+
spec.add_dependency "latexmath"
|
39
|
+
spec.add_dependency "mathml2asciimath"
|
40
|
+
spec.add_dependency "metanorma-utils", "~> 1.2.0"
|
36
41
|
spec.add_dependency "relaton-cli", "~> 1.7.0"
|
37
42
|
spec.add_dependency "relaton-iev", "~> 1.1.0"
|
38
|
-
spec.add_dependency "concurrent-ruby"
|
39
43
|
spec.add_dependency "unicode2latex", "~> 0.0.1"
|
40
|
-
spec.add_dependency "metanorma-utils", "~> 1.0.2"
|
41
|
-
spec.add_dependency "mathml2asciimath"
|
42
|
-
spec.add_dependency "latexmath"
|
43
|
-
spec.add_dependency "asciimath2unitsml", "~> 0.2.0"
|
44
44
|
|
45
45
|
spec.add_development_dependency "byebug"
|
46
|
-
spec.add_development_dependency "sassc", "2.4.0"
|
47
46
|
spec.add_development_dependency "equivalent-xml", "~> 0.6"
|
48
47
|
spec.add_development_dependency "guard", "~> 2.14"
|
49
48
|
spec.add_development_dependency "guard-rspec", "~> 4.7"
|
50
49
|
spec.add_development_dependency "rake", "~> 13.0"
|
51
50
|
spec.add_development_dependency "rspec", "~> 3.6"
|
52
|
-
spec.add_development_dependency "rubocop", "
|
51
|
+
spec.add_development_dependency "rubocop", "~> 1.5.2"
|
52
|
+
spec.add_development_dependency "sassc", "2.4.0"
|
53
53
|
spec.add_development_dependency "simplecov", "~> 0.15"
|
54
54
|
spec.add_development_dependency "timecop", "~> 0.9"
|
55
55
|
spec.add_development_dependency "vcr", "~> 5.0.0"
|
@@ -240,6 +240,7 @@ OUTPUT
|
|
240
240
|
:pub-uri: http://www.example.com
|
241
241
|
:isbn: ISBN-13
|
242
242
|
:isbn10: ISBN-10
|
243
|
+
:classification: a:b, c
|
243
244
|
INPUT
|
244
245
|
<?xml version="1.0" encoding="UTF-8"?>
|
245
246
|
<standard-document xmlns="https://www.metanorma.org/ns/standoc" type="semantic" version="#{Metanorma::Standoc::VERSION}">
|
@@ -361,18 +362,51 @@ OUTPUT
|
|
361
362
|
<role type="publisher"/>
|
362
363
|
<organization>
|
363
364
|
<name>Hanna Barbera</name>
|
365
|
+
<address>
|
366
|
+
<formattedAddress>
|
367
|
+
1 Infinity Loop
|
368
|
+
<br/>
|
369
|
+
California
|
370
|
+
</formattedAddress>
|
371
|
+
</address>
|
372
|
+
<phone>3333333</phone>
|
373
|
+
<phone type='fax'>4444444</phone>
|
374
|
+
<email>x@example.com</email>
|
375
|
+
<uri>http://www.example.com</uri>
|
364
376
|
</organization>
|
365
377
|
</contributor>
|
366
378
|
<contributor>
|
367
379
|
<role type="publisher"/>
|
368
380
|
<organization>
|
369
381
|
<name>Cartoon Network</name>
|
382
|
+
<address>
|
383
|
+
<formattedAddress>
|
384
|
+
1 Infinity Loop
|
385
|
+
<br/>
|
386
|
+
California
|
387
|
+
</formattedAddress>
|
388
|
+
</address>
|
389
|
+
<phone>3333333</phone>
|
390
|
+
<phone type='fax'>4444444</phone>
|
391
|
+
<email>x@example.com</email>
|
392
|
+
<uri>http://www.example.com</uri>
|
370
393
|
</organization>
|
371
394
|
</contributor>
|
372
395
|
<contributor>
|
373
396
|
<role type="publisher"/>
|
374
397
|
<organization>
|
375
398
|
<name>Ribose, Inc.</name>
|
399
|
+
<address>
|
400
|
+
<formattedAddress>
|
401
|
+
1 Infinity Loop
|
402
|
+
<br/>
|
403
|
+
California
|
404
|
+
</formattedAddress>
|
405
|
+
</address>
|
406
|
+
<phone>3333333</phone>
|
407
|
+
<phone type='fax'>4444444</phone>
|
408
|
+
<email>x@example.com</email>
|
409
|
+
<uri>http://www.example.com</uri>
|
376
410
|
</organization>
|
377
411
|
</contributor>
|
378
412
|
<edition>2</edition>
|
@@ -392,6 +426,17 @@ OUTPUT
|
|
392
426
|
<owner>
|
393
427
|
<organization>
|
394
428
|
<name>Ribose, Inc.</name>
|
429
|
+
<address>
|
430
|
+
<formattedAddress>
|
431
|
+
1 Infinity Loop
|
432
|
+
<br/>
|
433
|
+
California
|
434
|
+
</formattedAddress>
|
435
|
+
</address>
|
436
|
+
<phone>3333333</phone>
|
437
|
+
<phone type='fax'>4444444</phone>
|
438
|
+
<email>x@example.com</email>
|
439
|
+
<uri>http://www.example.com</uri>
|
395
440
|
</organization>
|
396
441
|
</owner>
|
397
442
|
</copyright>
|
@@ -400,6 +445,17 @@ OUTPUT
|
|
400
445
|
<owner>
|
401
446
|
<organization>
|
402
447
|
<name>Hanna Barbera</name>
|
448
|
+
<address>
|
449
|
+
<formattedAddress>
|
450
|
+
1 Infinity Loop
|
451
|
+
<br/>
|
452
|
+
California
|
453
|
+
</formattedAddress>
|
454
|
+
</address>
|
455
|
+
<phone>3333333</phone>
|
456
|
+
<phone type='fax'>4444444</phone>
|
457
|
+
<email>x@example.com</email>
|
458
|
+
<uri>http://www.example.com</uri>
|
403
459
|
</organization>
|
404
460
|
</owner>
|
405
461
|
</copyright>
|
@@ -421,6 +477,8 @@ OUTPUT
|
|
421
477
|
<docidentifier>JKL MNO</docidentifier>
|
422
478
|
</bibitem>
|
423
479
|
</relation>
|
480
|
+
<classification type='a'>b</classification>
|
481
|
+
<classification type='default'>c</classification>
|
424
482
|
<keyword>a</keyword>
|
425
483
|
<keyword>b</keyword>
|
426
484
|
<keyword>c</keyword>
|
@@ -469,6 +527,7 @@ OUTPUT
|
|
469
527
|
:relaton-uri: F
|
470
528
|
:title-eo: Dokumenttitolo
|
471
529
|
:doctype: This is a DocType
|
530
|
+
:docsubtype: This is a DocSubType
|
472
531
|
:subdivision: Subdivision
|
473
532
|
:subdivision-abbr: SD
|
474
533
|
|
@@ -567,6 +626,7 @@ OUTPUT
|
|
567
626
|
</copyright>
|
568
627
|
<ext>
|
569
628
|
<doctype>this-is-a-doctype</doctype>
|
629
|
+
<subdoctype>This is a DocSubType</subdoctype>
|
570
630
|
</ext>
|
571
631
|
</bibdata>
|
572
632
|
<preface>
|
@@ -625,13 +685,6 @@ OUTPUT
|
|
625
685
|
<name>International Standards Organization</name>
|
626
686
|
<subdivision>Subdivision</subdivision>
|
627
687
|
<abbreviation>SD</abbreviation>
|
628
|
-
<address>
|
629
|
-
<formattedAddress>1 Infinity Loop <br/>California</formattedAddress>
|
630
|
-
</address>
|
631
|
-
<phone>3333333</phone>
|
632
|
-
<phone type='fax'>4444444</phone>
|
633
|
-
<email>x@example.com</email>
|
634
|
-
<uri>http://www.example.com</uri>
|
635
688
|
</organization>
|
636
689
|
</contributor>
|
637
690
|
<contributor>
|
@@ -709,6 +762,7 @@ OUTPUT
|
|
709
762
|
:header-font: Comic Sans
|
710
763
|
:monospace-font: Andale Mono
|
711
764
|
:htmlstylesheet: spec/assets/html.scss
|
765
|
+
:htmlstylesheet-override: spec/assets/html-override.css
|
712
766
|
:htmlcoverpage: spec/assets/htmlcover.html
|
713
767
|
:htmlintropage: spec/assets/htmlintro.html
|
714
768
|
:scripts: spec/assets/scripts.html
|
@@ -727,6 +781,7 @@ OUTPUT
|
|
727
781
|
expect(html).to match(%r[an empty html cover page])
|
728
782
|
expect(html).to match(%r[an empty html intro page])
|
729
783
|
expect(html).to match(%r[This is > a script])
|
784
|
+
expect(html).to match(%r[html-override])
|
730
785
|
end
|
731
786
|
|
732
787
|
it "uses specified fonts and assets in Word" do
|
@@ -741,6 +796,7 @@ OUTPUT
|
|
741
796
|
:header-font: Comic Sans
|
742
797
|
:monospace-font: Andale Mono
|
743
798
|
:wordstylesheet: spec/assets/word.scss
|
799
|
+
:wordstylesheet-override: spec/assets/word-override.css
|
744
800
|
:wordcoverpage: spec/assets/wordcover.html
|
745
801
|
:wordintropage: spec/assets/wordintro.html
|
746
802
|
:header: spec/assets/header.html
|
@@ -758,8 +814,10 @@ OUTPUT
|
|
758
814
|
expect(html).to match(%r[h1[^{]+\{[^{]+font-family: Comic Sans;]m)
|
759
815
|
expect(html).to match(%r[an empty word cover page])
|
760
816
|
expect(html).to match(%r[an empty word intro page])
|
817
|
+
expect(html).to match(%r[word-override])
|
761
818
|
expect(html).to include('\o "1-3"')
|
762
|
-
expect(html).to include(%[Content-
|
819
|
+
expect(html).to include(%[Content-ID: <header.html>
|
820
|
+
Content-Disposition: inline; filename="header.html"
|
763
821
|
Content-Transfer-Encoding: base64
|
764
822
|
Content-Type: text/html charset="utf-8"
|
765
823
|
|
@@ -783,6 +841,18 @@ QU1FOiB0ZXN0Cgo=
|
|
783
841
|
expect(File.exist?("test.doc")).to be true
|
784
842
|
end
|
785
843
|
|
844
|
+
it "process mn2pdf attributes" do
|
845
|
+
node = Nokogiri::XML("<fake/>").at("fake")
|
846
|
+
node["mn2pdf-font-manifest-file"] = "passed/as/font/manifest/to/mn2pdf.jar"
|
847
|
+
|
848
|
+
options = Asciidoctor::Standoc::Converter
|
849
|
+
.new(:standoc, header_footer: true)
|
850
|
+
.doc_extract_attributes(node)
|
851
|
+
|
852
|
+
expect(options.dig(:mn2pdf, :font_manifest_file))
|
853
|
+
.to eq(node["mn2pdf-font-manifest-file"])
|
854
|
+
end
|
855
|
+
|
786
856
|
private
|
787
857
|
|
788
858
|
def mock_org_abbrevs
|