metanorma-standoc 1.8.6 → 1.9.2
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.
- checksums.yaml +4 -4
- data/.gitignore +2 -0
- data/.rubocop.yml +5 -3
- 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 +44 -14
- data/lib/asciidoctor/standoc/blocks_notes.rb +41 -24
- data/lib/asciidoctor/standoc/cleanup.rb +33 -78
- data/lib/asciidoctor/standoc/cleanup_block.rb +77 -62
- data/lib/asciidoctor/standoc/cleanup_boilerplate.rb +51 -29
- 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 +24 -15
- 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 +10 -3
- data/lib/asciidoctor/standoc/datamodel/plantuml_renderer.rb +67 -66
- 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 +304 -1
- data/lib/asciidoctor/standoc/lists.rb +4 -2
- data/lib/asciidoctor/standoc/macros.rb +50 -23
- data/lib/asciidoctor/standoc/macros_form.rb +63 -0
- 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 +22 -19
- data/lib/asciidoctor/standoc/section.rb +3 -1
- data/lib/asciidoctor/standoc/terms.rb +27 -16
- data/lib/asciidoctor/standoc/utils.rb +35 -9
- data/lib/asciidoctor/standoc/validate.rb +30 -28
- data/lib/metanorma-standoc.rb +0 -1
- 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 +832 -727
- data/spec/asciidoctor/cleanup_sections_spec.rb +52 -15
- data/spec/asciidoctor/cleanup_spec.rb +1860 -1874
- data/spec/asciidoctor/inline_spec.rb +272 -273
- data/spec/asciidoctor/isobib_cache_spec.rb +406 -358
- data/spec/asciidoctor/macros_spec.rb +539 -437
- data/spec/asciidoctor/macros_yaml2text_spec.rb +1 -1
- data/spec/asciidoctor/refs_spec.rb +135 -7
- data/spec/asciidoctor/section_spec.rb +743 -690
- 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 +14 -14
- data/spec/vcr_cassettes/isobib_get_123_1.yml +30 -30
- data/spec/vcr_cassettes/isobib_get_123_1_fr.yml +42 -42
- data/spec/vcr_cassettes/isobib_get_123_2001.yml +15 -15
- data/spec/vcr_cassettes/isobib_get_124.yml +15 -15
- 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 +72 -68
- data/.rubocop.ribose.yml +0 -66
- data/.rubocop.tb.yml +0 -650
- data/spec/asciidoctor/macros_lutaml_spec.rb +0 -80
@@ -10,7 +10,9 @@ module Asciidoctor
|
|
10
10
|
@norm_ref = false
|
11
11
|
|
12
12
|
def sectiontype1(node)
|
13
|
-
node&.attr("heading")&.downcase ||
|
13
|
+
node&.attr("heading")&.downcase ||
|
14
|
+
node.title.gsub(%r{<index>.*?</index>}m, "").gsub(/<[^>]+>/, "")
|
15
|
+
.strip.downcase
|
14
16
|
end
|
15
17
|
|
16
18
|
def sectiontype(node, level = true)
|
@@ -12,12 +12,13 @@ module Asciidoctor
|
|
12
12
|
@definitions = defs
|
13
13
|
end
|
14
14
|
|
15
|
-
def symbols_attrs(node,
|
15
|
+
def symbols_attrs(node, attr)
|
16
16
|
case sectiontype1(node)
|
17
|
-
when "symbols" then
|
18
|
-
when "abbreviated terms", "abbreviations"
|
17
|
+
when "symbols" then attr.merge(type: "symbols")
|
18
|
+
when "abbreviated terms", "abbreviations"
|
19
|
+
attr.merge(type: "abbreviated_terms")
|
19
20
|
else
|
20
|
-
|
21
|
+
attr
|
21
22
|
end
|
22
23
|
end
|
23
24
|
|
@@ -51,13 +52,17 @@ module Asciidoctor
|
|
51
52
|
|
52
53
|
# subclause contains subclauses
|
53
54
|
def term_def_subclause_parse(attrs, xml, node)
|
54
|
-
node.role == "nonterm"
|
55
|
-
|
55
|
+
node.role == "nonterm" and
|
56
|
+
return nonterm_term_def_subclause_parse(attrs, xml, node)
|
57
|
+
node.role == "boilerplate" and
|
58
|
+
return terms_boilerplate_parse(attrs, xml, node)
|
56
59
|
st = sectiontype(node, false)
|
57
60
|
return symbols_parse(attrs, xml, node) if @definitions
|
61
|
+
|
58
62
|
sub = node.find_by(context: :section) { |s| s.level == node.level + 1 }
|
59
63
|
sub.empty? || (return term_def_parse(attrs, xml, node, false))
|
60
|
-
st == "symbols and abbreviated terms" and
|
64
|
+
st == "symbols and abbreviated terms" and
|
65
|
+
return symbols_parse(attrs, xml, node)
|
61
66
|
st == "terms and definitions" and return clause_parse(attrs, xml, node)
|
62
67
|
term_def_subclause_parse1(attrs, xml, node)
|
63
68
|
end
|
@@ -69,7 +74,7 @@ module Asciidoctor
|
|
69
74
|
end
|
70
75
|
end
|
71
76
|
|
72
|
-
def term_def_parse(attrs, xml, node,
|
77
|
+
def term_def_parse(attrs, xml, node, _toplevel)
|
73
78
|
xml.terms **attr_code(attrs) do |section|
|
74
79
|
section.title { |t| t << node.title }
|
75
80
|
(s = node.attr("source")) && s.split(/,/).each do |s1|
|
@@ -79,19 +84,23 @@ module Asciidoctor
|
|
79
84
|
end
|
80
85
|
end
|
81
86
|
|
82
|
-
def term_source_attrs(seen_xref)
|
83
|
-
{
|
87
|
+
def term_source_attrs(_node, seen_xref)
|
88
|
+
{ case: seen_xref.children[0]["case"],
|
89
|
+
droploc: seen_xref.children[0]["droploc"],
|
90
|
+
bibitemid: seen_xref.children[0]["target"],
|
84
91
|
format: seen_xref.children[0]["format"], type: "inline" }
|
85
92
|
end
|
86
93
|
|
87
|
-
def add_term_source(xml_t, seen_xref,
|
94
|
+
def add_term_source(node, xml_t, seen_xref, match)
|
88
95
|
if seen_xref.children[0].name == "concept"
|
89
96
|
xml_t.origin { |o| o << seen_xref.children[0].to_xml }
|
90
97
|
else
|
91
|
-
|
98
|
+
attrs = term_source_attrs(node, seen_xref)
|
99
|
+
attrs.delete(:text)
|
100
|
+
xml_t.origin seen_xref.children[0].content, **attr_code(attrs)
|
92
101
|
end
|
93
|
-
|
94
|
-
mod.p { |p| p <<
|
102
|
+
match[:text] && xml_t.modification do |mod|
|
103
|
+
mod.p { |p| p << match[:text].sub(/^\s+/, "") }
|
95
104
|
end
|
96
105
|
end
|
97
106
|
|
@@ -106,7 +115,9 @@ module Asciidoctor
|
|
106
115
|
|
107
116
|
def extract_termsource_refs(text, node)
|
108
117
|
matched = TERM_REFERENCE_RE.match text
|
109
|
-
matched.nil? and @log.add("AsciiDoc Input", node,
|
118
|
+
matched.nil? and @log.add("AsciiDoc Input", node,
|
119
|
+
"term reference not in expected format:"\
|
120
|
+
"#{text}")
|
110
121
|
matched
|
111
122
|
end
|
112
123
|
|
@@ -116,7 +127,7 @@ module Asciidoctor
|
|
116
127
|
attrs = { status: matched[:text] ? "modified" : "identical" }
|
117
128
|
xml.termsource **attrs do |xml_t|
|
118
129
|
seen_xref = Nokogiri::XML.fragment(matched[:xref])
|
119
|
-
add_term_source(xml_t, seen_xref, matched)
|
130
|
+
add_term_source(node, xml_t, seen_xref, matched)
|
120
131
|
end
|
121
132
|
end.join("\n")
|
122
133
|
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,
|
@@ -34,9 +34,9 @@ module Asciidoctor
|
|
34
34
|
fragment = doc.fragment("")
|
35
35
|
::Nokogiri::XML::Builder.with fragment, &block
|
36
36
|
fragment.to_xml(encoding: "US-ASCII", indent: 0).lines.map do |l|
|
37
|
-
l.gsub(/>\n$/, ">").gsub(/\s*\n$/m, " ").gsub("–", "\u0096")
|
38
|
-
gsub("—", "\u0097").gsub("–", "\u0096")
|
39
|
-
gsub("—", "\u0097")
|
37
|
+
l.gsub(/>\n$/, ">").gsub(/\s*\n$/m, " ").gsub("–", "\u0096")
|
38
|
+
.gsub("—", "\u0097").gsub("–", "\u0096")
|
39
|
+
.gsub("—", "\u0097")
|
40
40
|
end
|
41
41
|
end
|
42
42
|
|
@@ -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"
|
@@ -7,13 +7,13 @@ require "iev"
|
|
7
7
|
module Asciidoctor
|
8
8
|
module Standoc
|
9
9
|
module Validate
|
10
|
-
|
11
10
|
SOURCELOCALITY = "./termsource/origin//locality[@type = 'clause']/"\
|
12
11
|
"referenceFrom".freeze
|
13
12
|
|
14
13
|
def init_iev
|
15
14
|
return nil if @no_isobib
|
16
15
|
return @iev if @iev
|
16
|
+
|
17
17
|
@iev = Iev::Db.new(@iev_globalname, @iev_localname) unless @no_isobib
|
18
18
|
@iev
|
19
19
|
end
|
@@ -44,23 +44,23 @@ module Asciidoctor
|
|
44
44
|
found = false
|
45
45
|
doc.xpath("//references[@normative = 'true']/bibitem").each do |b|
|
46
46
|
next unless docid = b.at("./docidentifier[@type = 'metanorma']")
|
47
|
-
next unless
|
48
|
-
|
47
|
+
next unless /^\[\d+\]$/.match?(docid.text)
|
48
|
+
|
49
|
+
@log.add("Bibliography", b,
|
50
|
+
"Numeric reference in normative references")
|
49
51
|
found = true
|
50
52
|
end
|
51
|
-
|
52
|
-
|
53
|
-
abort("Numeric reference in normative references")
|
54
|
-
end
|
53
|
+
found and
|
54
|
+
clean_abort("Numeric reference in normative references", doc.to_xml)
|
55
55
|
end
|
56
56
|
|
57
|
-
def repeat_id_validate1(ids,
|
58
|
-
if ids[
|
59
|
-
@log.add("Anchors",
|
60
|
-
"at line #{ids[
|
57
|
+
def repeat_id_validate1(ids, elem)
|
58
|
+
if ids[elem["id"]]
|
59
|
+
@log.add("Anchors", elem, "Anchor #{elem['id']} has already been "\
|
60
|
+
"used at line #{ids[elem['id']]}")
|
61
61
|
raise StandardError.new "Error: multiple instances of same ID"
|
62
62
|
else
|
63
|
-
ids[
|
63
|
+
ids[elem["id"]] = elem.line
|
64
64
|
end
|
65
65
|
ids
|
66
66
|
end
|
@@ -72,39 +72,41 @@ module Asciidoctor
|
|
72
72
|
ids = repeat_id_validate1(ids, x)
|
73
73
|
end
|
74
74
|
rescue StandardError => e
|
75
|
-
|
76
|
-
abort(e.message)
|
75
|
+
clean_abort(e.message, doc.to_xml)
|
77
76
|
end
|
78
77
|
end
|
79
78
|
|
80
79
|
def schema_validate(doc, schema)
|
81
|
-
Tempfile.open(["tmp", ".xml"], :
|
80
|
+
Tempfile.open(["tmp", ".xml"], encoding: "UTF-8") do |f|
|
82
81
|
begin
|
83
|
-
f
|
84
|
-
f.close
|
85
|
-
errors = Jing.new(schema).validate(f.path)
|
86
|
-
warn "Syntax Valid!" if errors.none?
|
87
|
-
errors.each do |e|
|
88
|
-
@log.add("Metanorma XML Syntax",
|
89
|
-
"XML Line #{"%06d" % e[:line]}:#{e[:column]}",
|
90
|
-
e[:message])
|
91
|
-
end
|
82
|
+
schema_validate1(f, doc, schema)
|
92
83
|
rescue Jing::Error => e
|
93
|
-
|
94
|
-
abort "Jing failed with error: #{e}"
|
84
|
+
clean_abort("Jing failed with error: #{e}", doc.to_xml)
|
95
85
|
ensure
|
96
86
|
f.close!
|
97
87
|
end
|
98
88
|
end
|
99
89
|
end
|
100
90
|
|
91
|
+
def schema_validate1(file, doc, schema)
|
92
|
+
file.write(doc.to_xml)
|
93
|
+
file.close
|
94
|
+
errors = Jing.new(schema).validate(file.path)
|
95
|
+
warn "Syntax Valid!" if errors.none?
|
96
|
+
errors.each do |e|
|
97
|
+
@log.add("Metanorma XML Syntax",
|
98
|
+
"XML Line #{'%06d' % e[:line]}:#{e[:column]}", e[:message])
|
99
|
+
end
|
100
|
+
end
|
101
|
+
|
101
102
|
# RelaxNG cannot cope well with wildcard attributes. So we strip
|
102
103
|
# any attributes from FormattedString instances (which can contain
|
103
104
|
# xs:any markup, and are signalled with @format) before validation.
|
104
105
|
def formattedstr_strip(doc)
|
105
106
|
doc.xpath("//*[@format] | //stem | //bibdata//description | "\
|
106
107
|
"//formattedref | //bibdata//note | //bibdata/abstract | "\
|
107
|
-
"//bibitem/abstract | //bibitem/note | //misc-container")
|
108
|
+
"//bibitem/abstract | //bibitem/note | //misc-container")
|
109
|
+
.each do |n|
|
108
110
|
n.elements.each do |e|
|
109
111
|
e.traverse do |e1|
|
110
112
|
e1.element? and e1.each { |k, _v| e1.delete(k) }
|
data/lib/metanorma-standoc.rb
CHANGED
@@ -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.2".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.2"
|
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
|