metanorma-acme 1.4.0 → 1.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/asciidoctor/acme/acme.rng +1 -1
- data/lib/asciidoctor/acme/converter.rb +18 -14
- data/lib/isodoc/acme/base_convert.rb +3 -9
- data/lib/isodoc/acme/html_convert.rb +13 -5
- data/lib/isodoc/acme/metadata.rb +19 -53
- data/lib/isodoc/acme/pdf_convert.rb +12 -4
- data/lib/isodoc/acme/word_convert.rb +14 -6
- data/lib/metanorma/acme.rb +5 -1
- data/lib/metanorma/acme/version.rb +1 -1
- data/metanorma.yml.example +4 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0e8878b8c45aca79d255b1c00055dab18317ee51f34c3444b2413a8c9d40eede
|
4
|
+
data.tar.gz: 81ec71492aa8194efa5613732f269be81968d9c24e50e5ad386e788ebffac35c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: af551bed15e41f056f3b31d8ffe5768b2c0daae3dbe39e721f53733b9e88fe79c165e71a609dcf450374bd352d9092d053cdd6ae673b07b449ce9151c2784d92
|
7
|
+
data.tar.gz: 8448ed20ea599f56075ea49ea1293722e0fda3b2ef65039af1daeea0af11c31940afdf754c0590689748412270300784866c2c310d9a3f5de49c992a9fe12896
|
@@ -1,5 +1,5 @@
|
|
1
1
|
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
-
<grammar xmlns="http://relaxng.org/ns/structure/1.0">
|
2
|
+
<grammar ns="https://www.metanorma.org/ns/acme" xmlns="http://relaxng.org/ns/structure/1.0">
|
3
3
|
<!--
|
4
4
|
Currently we inherit from a namespaced grammar, isostandard. Until we inherit from isodoc,
|
5
5
|
we cannot have a new default namespace: we will end up with a grammar with two different
|
@@ -43,11 +43,17 @@ module Asciidoctor
|
|
43
43
|
end
|
44
44
|
end
|
45
45
|
|
46
|
+
def docidentifier_cleanup(xmldoc)
|
47
|
+
template = configuration.docid_template ||
|
48
|
+
"{{ organization_name_short }} {{ docnumeric }}"
|
49
|
+
docid = xmldoc.at("//bibdata/docidentifier")
|
50
|
+
id = boilerplate_isodoc(xmldoc).populate_template(template, nil)
|
51
|
+
id.empty? and docid.remove or docid.children = id
|
52
|
+
end
|
53
|
+
|
46
54
|
def metadata_id(node, xml)
|
47
|
-
return unless node.attr("docnumber")
|
48
55
|
xml.docidentifier do |i|
|
49
|
-
i << "
|
50
|
-
"#{node.attr("docnumber")}"
|
56
|
+
i << "DUMMY"
|
51
57
|
end
|
52
58
|
xml.docnumber { |i| i << node.attr("docnumber") }
|
53
59
|
end
|
@@ -64,16 +70,6 @@ module Asciidoctor
|
|
64
70
|
end
|
65
71
|
end
|
66
72
|
|
67
|
-
def metadata_security(node, xml)
|
68
|
-
security = node.attr("security") || return
|
69
|
-
xml.security security
|
70
|
-
end
|
71
|
-
|
72
|
-
def metadata_ext(node, xml)
|
73
|
-
super
|
74
|
-
metadata_security(node, xml)
|
75
|
-
end
|
76
|
-
|
77
73
|
def title_validate(root)
|
78
74
|
nil
|
79
75
|
end
|
@@ -121,7 +117,7 @@ module Asciidoctor
|
|
121
117
|
content_validate(doc)
|
122
118
|
schema_validate(formattedstr_strip(doc.dup),
|
123
119
|
configuration.validate_rng_file ||
|
124
|
-
|
120
|
+
File.join(File.dirname(__FILE__), "acme.rng"))
|
125
121
|
end
|
126
122
|
|
127
123
|
def html_path_acme(file)
|
@@ -154,6 +150,14 @@ module Asciidoctor
|
|
154
150
|
def configuration
|
155
151
|
Metanorma::Acme.configuration
|
156
152
|
end
|
153
|
+
|
154
|
+
def boilerplate_isodoc(xmldoc)
|
155
|
+
conv = super
|
156
|
+
Metanorma::Acme::Configuration::CONFIG_ATTRS.each do |a|
|
157
|
+
conv.labels[a] = configuration.send a
|
158
|
+
end
|
159
|
+
conv
|
160
|
+
end
|
157
161
|
end
|
158
162
|
end
|
159
163
|
end
|
@@ -5,19 +5,13 @@ require "fileutils"
|
|
5
5
|
module IsoDoc
|
6
6
|
module Acme
|
7
7
|
module BaseConvert
|
8
|
-
#def convert1(docxml, filename, dir)
|
9
|
-
# FileUtils.cp html_doc_path('logo.jpg'), File.join(@localdir, "logo.jpg")
|
10
|
-
# @files_to_delete << File.join(@localdir, "logo.jpg")
|
11
|
-
# super
|
12
|
-
#end
|
13
|
-
|
14
8
|
def metadata_init(lang, script, labels)
|
15
9
|
@meta = Metadata.new(lang, script, labels)
|
16
10
|
end
|
17
11
|
|
18
|
-
def
|
19
|
-
|
20
|
-
|
12
|
+
def baselocation(loc)
|
13
|
+
return nil if loc.nil?
|
14
|
+
File.expand_path(File.join(File.dirname(self.class::_file || __FILE__), "..", "..", "..", loc))
|
21
15
|
end
|
22
16
|
|
23
17
|
def annex_name(annex, name, div)
|
@@ -13,6 +13,14 @@ module IsoDoc
|
|
13
13
|
super
|
14
14
|
end
|
15
15
|
|
16
|
+
class << self
|
17
|
+
attr_accessor :_file
|
18
|
+
end
|
19
|
+
|
20
|
+
def self.inherited( k )
|
21
|
+
k._file = caller_locations.first.absolute_path
|
22
|
+
end
|
23
|
+
|
16
24
|
def default_fonts(options)
|
17
25
|
{
|
18
26
|
bodyfont: (options[:script] == "Hans" ? '"SimSun",serif' : '"Overpass",sans-serif'),
|
@@ -23,15 +31,15 @@ module IsoDoc
|
|
23
31
|
|
24
32
|
def default_file_locations(_options)
|
25
33
|
{
|
26
|
-
htmlstylesheet: configuration.htmlstylesheet ||
|
34
|
+
htmlstylesheet: baselocation(configuration.htmlstylesheet) ||
|
27
35
|
html_doc_path("htmlstyle.scss"),
|
28
|
-
htmlcoverpage: configuration.htmlcoverpage ||
|
36
|
+
htmlcoverpage: baselocation(configuration.htmlcoverpage) ||
|
29
37
|
html_doc_path("html_acme_titlepage.html"),
|
30
|
-
htmlintropage: configuration.htmlintropage ||
|
38
|
+
htmlintropage: baselocation(configuration.htmlintropage) ||
|
31
39
|
html_doc_path("html_acme_intro.html"),
|
32
|
-
scripts: configuration.scripts ||
|
40
|
+
scripts: baselocation(configuration.scripts) ||
|
33
41
|
html_doc_path("scripts.html"),
|
34
|
-
i18nyaml: configuration.i18nyaml
|
42
|
+
i18nyaml: baselocation(configuration.i18nyaml)
|
35
43
|
}
|
36
44
|
end
|
37
45
|
|
data/lib/isodoc/acme/metadata.rb
CHANGED
@@ -8,74 +8,40 @@ module IsoDoc
|
|
8
8
|
super
|
9
9
|
here = File.dirname(__FILE__)
|
10
10
|
default_logo_path = File.expand_path(File.join(here, "html", "logo.jpg"))
|
11
|
-
set(:logo, configuration.logo_path || default_logo_path)
|
11
|
+
set(:logo, baselocation(configuration.logo_path) || default_logo_path)
|
12
12
|
end
|
13
13
|
|
14
|
-
|
15
|
-
|
16
|
-
end
|
17
|
-
|
18
|
-
def author(isoxml, _out)
|
19
|
-
super
|
20
|
-
tc = isoxml.at(ns("//bibdata/ext/editorialgroup/committee"))
|
21
|
-
set(:tc, tc.text) if tc
|
14
|
+
class << self
|
15
|
+
attr_accessor :_file
|
22
16
|
end
|
23
17
|
|
24
|
-
def
|
25
|
-
|
26
|
-
docstatus = isoxml.at(ns("//bibdata/status/stage"))
|
27
|
-
dn = docnumber&.text
|
28
|
-
if docstatus
|
29
|
-
abbr = status_abbr(docstatus.text)
|
30
|
-
dn = "#{dn}(#{abbr})" unless abbr.empty?
|
31
|
-
end
|
32
|
-
set(:docnumber, dn)
|
18
|
+
def self.inherited( k )
|
19
|
+
k._file = caller_locations.first.absolute_path
|
33
20
|
end
|
34
21
|
|
35
|
-
def
|
36
|
-
|
37
|
-
|
38
|
-
when "committee-draft" then "cd"
|
39
|
-
when "draft-standard" then "d"
|
40
|
-
else
|
41
|
-
""
|
42
|
-
end
|
22
|
+
def baselocation(loc)
|
23
|
+
return nil if loc.nil?
|
24
|
+
File.expand_path(File.join(File.dirname(self.class::_file || __FILE__), "..", "..", "..", loc))
|
43
25
|
end
|
44
26
|
|
45
|
-
def
|
46
|
-
|
27
|
+
def configuration
|
28
|
+
Metanorma::Acme.configuration
|
47
29
|
end
|
48
30
|
|
49
|
-
def
|
31
|
+
def author(isoxml, _out)
|
50
32
|
super
|
51
|
-
|
52
|
-
set(:
|
33
|
+
tc = isoxml.at(ns("//bibdata/ext/editorialgroup/committee"))
|
34
|
+
set(:tc, tc.text) if tc
|
53
35
|
end
|
54
36
|
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
"03": "March",
|
59
|
-
"04": "April",
|
60
|
-
"05": "May",
|
61
|
-
"06": "June",
|
62
|
-
"07": "July",
|
63
|
-
"08": "August",
|
64
|
-
"09": "September",
|
65
|
-
"10": "October",
|
66
|
-
"11": "November",
|
67
|
-
"12": "December",
|
68
|
-
}.freeze
|
69
|
-
|
70
|
-
def monthyr(isodate)
|
71
|
-
m = /(?<yr>\d\d\d\d)-(?<mo>\d\d)/.match isodate
|
72
|
-
return isodate unless m && m[:yr] && m[:mo]
|
73
|
-
return "#{MONTHS[m[:mo].to_sym]} #{m[:yr]}"
|
37
|
+
def stage_abbr(status)
|
38
|
+
return super unless configuration.stage_abbreviations
|
39
|
+
Hash(configuration.stage_abbreviations).dig(status)
|
74
40
|
end
|
75
41
|
|
76
|
-
def
|
77
|
-
|
78
|
-
|
42
|
+
def unpublished(status)
|
43
|
+
stages = configuration&.published_stages || ["published"]
|
44
|
+
!(Array(stages).map { |m| m.downcase }.include? status.downcase)
|
79
45
|
end
|
80
46
|
end
|
81
47
|
end
|
@@ -11,6 +11,14 @@ module IsoDoc
|
|
11
11
|
super
|
12
12
|
end
|
13
13
|
|
14
|
+
class << self
|
15
|
+
attr_accessor :_file
|
16
|
+
end
|
17
|
+
|
18
|
+
def self.inherited( k )
|
19
|
+
k._file = caller_locations.first.absolute_path
|
20
|
+
end
|
21
|
+
|
14
22
|
def default_fonts(options)
|
15
23
|
{
|
16
24
|
bodyfont: (options[:script] == "Hans" ? '"SimSun",serif' : '"Overpass",sans-serif'),
|
@@ -21,13 +29,13 @@ module IsoDoc
|
|
21
29
|
|
22
30
|
def default_file_locations(_options)
|
23
31
|
{
|
24
|
-
htmlstylesheet: configuration.htmlstylesheet ||
|
32
|
+
htmlstylesheet: baselocation(configuration.htmlstylesheet) ||
|
25
33
|
html_doc_path("htmlstyle.scss"),
|
26
|
-
htmlcoverpage: configuration.htmlcoverpage ||
|
34
|
+
htmlcoverpage: baselocation(configuration.htmlcoverpage) ||
|
27
35
|
html_doc_path("html_acme_titlepage.html"),
|
28
|
-
htmlintropage: configuration.htmlintropage ||
|
36
|
+
htmlintropage: baselocation(configuration.htmlintropage) ||
|
29
37
|
html_doc_path("html_acme_intro.html"),
|
30
|
-
scripts_pdf: configuration.scripts_pdf ||
|
38
|
+
scripts_pdf: baselocation(configuration.scripts_pdf) ||
|
31
39
|
html_doc_path("scripts.pdf.html")
|
32
40
|
}
|
33
41
|
end
|
@@ -12,6 +12,14 @@ module IsoDoc
|
|
12
12
|
super
|
13
13
|
end
|
14
14
|
|
15
|
+
class << self
|
16
|
+
attr_accessor :_file
|
17
|
+
end
|
18
|
+
|
19
|
+
def self.inherited( k )
|
20
|
+
k._file = caller_locations.first.absolute_path
|
21
|
+
end
|
22
|
+
|
15
23
|
def default_fonts(options)
|
16
24
|
{
|
17
25
|
bodyfont: (options[:script] == "Hans" ? '"SimSun",serif' : '"Arial",sans-serif'),
|
@@ -22,17 +30,17 @@ module IsoDoc
|
|
22
30
|
|
23
31
|
def default_file_locations(options)
|
24
32
|
{
|
25
|
-
wordstylesheet: configuration.wordstylesheet ||
|
33
|
+
wordstylesheet: baselocation(configuration.wordstylesheet) ||
|
26
34
|
html_doc_path("wordstyle.scss"),
|
27
|
-
standardstylesheet: configuration.standardstylesheet ||
|
35
|
+
standardstylesheet: baselocation(configuration.standardstylesheet) ||
|
28
36
|
html_doc_path("acme.scss"),
|
29
|
-
header: configuration.header ||
|
37
|
+
header: baselocation(configuration.header) ||
|
30
38
|
html_doc_path("header.html"),
|
31
|
-
wordcoverpage: configuration.wordcoverpage ||
|
39
|
+
wordcoverpage: baselocation(configuration.wordcoverpage) ||
|
32
40
|
html_doc_path("word_acme_titlepage.html"),
|
33
|
-
wordintropage: configuration.wordintropage ||
|
41
|
+
wordintropage: baselocation(configuration.wordintropage) ||
|
34
42
|
html_doc_path("word_acme_intro.html"),
|
35
|
-
i18nyaml: configuration.i18nyaml,
|
43
|
+
i18nyaml: baselocation(configuration.i18nyaml),
|
36
44
|
ulstyle: "l3",
|
37
45
|
olstyle: "l2",
|
38
46
|
}
|
data/lib/metanorma/acme.rb
CHANGED
@@ -1,12 +1,13 @@
|
|
1
1
|
require "metanorma/acme/processor"
|
2
2
|
require "metanorma/acme/version"
|
3
3
|
require 'forwardable'
|
4
|
+
require 'yaml'
|
4
5
|
|
5
6
|
module Metanorma
|
6
7
|
module Acme
|
7
8
|
ORGANIZATION_NAME_SHORT = "Acme"
|
8
9
|
ORGANIZATION_NAME_LONG = "Acme Corp."
|
9
|
-
DOCUMENT_NAMESPACE = "https://
|
10
|
+
DOCUMENT_NAMESPACE = "https://metanorma.org/ns/acme"
|
10
11
|
YAML_CONFIG_FILE = 'metanorma.yml'
|
11
12
|
|
12
13
|
class Configuration
|
@@ -14,12 +15,15 @@ module Metanorma
|
|
14
15
|
organization_name_short
|
15
16
|
organization_name_long
|
16
17
|
document_namespace
|
18
|
+
docid_template
|
17
19
|
i18nyaml
|
18
20
|
logo_path
|
19
21
|
header
|
20
22
|
htmlcoverpage
|
21
23
|
htmlintropage
|
22
24
|
htmlstylesheet
|
25
|
+
published_stages
|
26
|
+
stage_abbreviations
|
23
27
|
scripts
|
24
28
|
scripts_pdf
|
25
29
|
standardstylesheet
|
data/metanorma.yml.example
CHANGED
@@ -13,4 +13,7 @@ standardstylesheet: /metanorma-mine/lib/isodoc/mine/html/
|
|
13
13
|
header: /metanorma-mine/lib/isodoc/mine/html/header.html
|
14
14
|
wordcoverpage: /metanorma-mine/lib/isodoc/mine/html/word_mine_titlepage.html
|
15
15
|
wordintropage: /metanorma-mine/lib/isodoc/mine/html/word_mine_intro.html
|
16
|
-
wordstylesheet: /metanorma-mine/lib/isodoc/mine/html/wordstyle.scss
|
16
|
+
wordstylesheet: /metanorma-mine/lib/isodoc/mine/html/wordstyle.scss
|
17
|
+
docid_template: "{{ organization_name_short }} {{ docnumeric }}"
|
18
|
+
published_stages:
|
19
|
+
- published
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: metanorma-acme
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.4.
|
4
|
+
version: 1.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ribose Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-02-
|
11
|
+
date: 2020-02-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: htmlentities
|