metanorma-m3aawg 1.5.6 → 1.6.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/rake.yml +29 -8
- data/README.adoc +2 -4
- data/lib/asciidoctor/m3aawg/basicdoc.rng +50 -3
- data/lib/asciidoctor/m3aawg/converter.rb +4 -49
- data/lib/asciidoctor/m3aawg/isodoc.rng +61 -3
- data/lib/isodoc/m3aawg/base_convert.rb +2 -12
- data/lib/isodoc/m3aawg/html/htmlstyle.css +3 -3
- data/lib/isodoc/m3aawg/html/htmlstyle.scss +2 -2
- data/lib/isodoc/m3aawg/html/m3d.css +41 -41
- data/lib/isodoc/m3aawg/html/m3d.scss +41 -41
- data/lib/isodoc/m3aawg/html/wordstyle.css +31 -31
- data/lib/isodoc/m3aawg/html/wordstyle.scss +31 -31
- data/lib/isodoc/m3aawg/html_convert.rb +7 -31
- data/lib/isodoc/m3aawg/i18n.rb +3 -4
- data/lib/isodoc/m3aawg/init.rb +2 -5
- data/lib/isodoc/m3aawg/m3d.report.xsl +361 -109
- data/lib/isodoc/m3aawg/metadata.rb +5 -17
- data/lib/isodoc/m3aawg/presentation_xml_convert.rb +11 -6
- data/lib/isodoc/m3aawg/word_convert.rb +4 -35
- data/lib/isodoc/m3aawg/xref.rb +5 -0
- data/lib/metanorma/m3aawg.rb +28 -2
- data/lib/metanorma/m3aawg/processor.rb +16 -9
- data/lib/metanorma/m3aawg/version.rb +1 -1
- data/metanorma-m3d.gemspec +1 -2
- data/metanorma.yml +51 -0
- metadata +6 -20
- data/lib/asciidoctor/m3aawg/validate.rb +0 -22
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 609a9a25743facaca6a46d3b95562d3c88f495b0861b716c8ab27c8e76395462
|
4
|
+
data.tar.gz: b6527b4b1c98c8db6bfbc78f7671f03f66386e737d72d652ab25976860411705
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0740a2fd599ffaa85273cb1f2fe653f7392321012fc878c350a784555763535a7c30f1b5ff07231446b3929751db5a1c165d481e7bf88277cac0e5b97c329c2e
|
7
|
+
data.tar.gz: b85fd00c45fcb6651acf9e59e34e9dd0bb843275957d8c2d4941fb9877f41b554a57634d0444e413dbcbf5accb2bbac9f254bc060c9625a0544801b59151fc15
|
data/.github/workflows/rake.yml
CHANGED
@@ -4,7 +4,8 @@ name: rake
|
|
4
4
|
|
5
5
|
on:
|
6
6
|
push:
|
7
|
-
branches: [ master ]
|
7
|
+
branches: [ master, main ]
|
8
|
+
tags: [ v* ]
|
8
9
|
pull_request:
|
9
10
|
|
10
11
|
jobs:
|
@@ -31,14 +32,34 @@ jobs:
|
|
31
32
|
steps:
|
32
33
|
- uses: actions/checkout@master
|
33
34
|
|
34
|
-
-
|
35
|
-
uses: ruby/setup-ruby@v1
|
35
|
+
- uses: ruby/setup-ruby@v1
|
36
36
|
with:
|
37
37
|
ruby-version: ${{ matrix.ruby }}
|
38
|
-
bundler-cache: true
|
39
38
|
|
40
|
-
-
|
41
|
-
run:
|
39
|
+
- if: matrix.os == 'macos-latest'
|
40
|
+
run: brew install autoconf automake libtool
|
42
41
|
|
43
|
-
-
|
44
|
-
|
42
|
+
- uses: actions/cache@v2
|
43
|
+
with:
|
44
|
+
path: vendor/bundle
|
45
|
+
key: bundle-${{ matrix.os }}-${{ matrix.ruby }}-${{ hashFiles('**/*.gemspec') }}
|
46
|
+
restore-keys: bundle-${{ matrix.os }}-${{ matrix.ruby }}
|
47
|
+
|
48
|
+
- run: bundle config set path 'vendor/bundle'
|
49
|
+
|
50
|
+
- run: bundle install --jobs 4 --retry 3
|
51
|
+
|
52
|
+
- run: bundle exec rake
|
53
|
+
|
54
|
+
tests-passed:
|
55
|
+
needs: rake
|
56
|
+
runs-on: ubuntu-latest
|
57
|
+
steps:
|
58
|
+
- name: Trigger tests passed event
|
59
|
+
uses: Sibz/github-status-action@v1
|
60
|
+
with:
|
61
|
+
authToken: ${{ secrets.METANORMA_CI_PAT_TOKEN || secrets.GITHUB_TOKEN }}
|
62
|
+
context: 'tests-passed-successfully'
|
63
|
+
description: 'Tests passed successfully'
|
64
|
+
state: 'success'
|
65
|
+
sha: ${{ github.event.pull_request.head.sha || github.sha }}
|
data/README.adoc
CHANGED
@@ -1,9 +1,7 @@
|
|
1
1
|
= Metanorma processor for M3AAWG documents
|
2
2
|
|
3
3
|
https://github.com/metanorma/metanorma-m3aawg[metanorma-m3aawg] image:https://img.shields.io/gem/v/metanorma-m3aawg.svg["Gem Version", link="https://rubygems.org/gems/metanorma-m3aawg"]::
|
4
|
-
image:https://github.com/metanorma/metanorma-m3aawg/workflows/
|
5
|
-
image:https://github.com/metanorma/metanorma-m3aawg/workflows/windows/badge.svg["Build Status", link="https://github.com/metanorma/metanorma-m3aawg/actions?workflow=windows"]
|
6
|
-
image:https://github.com/metanorma/metanorma-m3aawg/workflows/ubuntu/badge.svg["Build Status", link="https://github.com/metanorma/metanorma-m3aawg/actions?workflow=ubuntu"]
|
4
|
+
image:https://github.com/metanorma/metanorma-m3aawg/workflows/rake/badge.svg["Build Status", link="https://github.com/metanorma/metanorma-m3aawg/actions?workflow=rake"]
|
7
5
|
image:https://codeclimate.com/github/metanorma/metanorma-m3aawg/badges/gpa.svg["Code Climate", link="https://codeclimate.com/github/metanorma/metanorma-m3aawg"]
|
8
6
|
image:https://img.shields.io/github/issues-pr-raw/metanorma/metanorma-m3aawg.svg["Pull Requests", link="https://github.com/metanorma/metanorma-m3aawg/pulls"]
|
9
7
|
image:https://img.shields.io/github/commits-since/metanorma/metanorma-m3aawg/latest.svg["Commits since latest",link="https://github.com/metanorma/metanorma-m3aawg/releases"]
|
@@ -12,7 +10,7 @@ _Formerly known as_ `asciidoctor-m3d`.
|
|
12
10
|
|
13
11
|
== Functionality
|
14
12
|
|
15
|
-
This gem processes
|
13
|
+
This gem processes https://www.metanorma.com[Metanorma documents] following
|
16
14
|
a template for generating M3AAWG documents.
|
17
15
|
|
18
16
|
The gem currently inherits from the https://github.com/metanorma/metanorma-standoc
|
@@ -596,6 +596,7 @@
|
|
596
596
|
<ref name="bookmark"/>
|
597
597
|
<ref name="image"/>
|
598
598
|
<ref name="index"/>
|
599
|
+
<ref name="index-xref"/>
|
599
600
|
</choice>
|
600
601
|
</define>
|
601
602
|
<define name="PureTextElement">
|
@@ -728,15 +729,61 @@
|
|
728
729
|
</define>
|
729
730
|
<define name="index">
|
730
731
|
<element name="index">
|
731
|
-
<attribute name="
|
732
|
+
<attribute name="to">
|
733
|
+
<data type="IDREF"/>
|
734
|
+
</attribute>
|
735
|
+
<element name="primary">
|
736
|
+
<oneOrMore>
|
737
|
+
<ref name="PureTextElement"/>
|
738
|
+
</oneOrMore>
|
739
|
+
</element>
|
732
740
|
<optional>
|
733
|
-
<
|
741
|
+
<element name="secondary">
|
742
|
+
<oneOrMore>
|
743
|
+
<ref name="PureTextElement"/>
|
744
|
+
</oneOrMore>
|
745
|
+
</element>
|
734
746
|
</optional>
|
735
747
|
<optional>
|
736
|
-
<
|
748
|
+
<element name="tertiary">
|
749
|
+
<oneOrMore>
|
750
|
+
<ref name="PureTextElement"/>
|
751
|
+
</oneOrMore>
|
752
|
+
</element>
|
737
753
|
</optional>
|
738
754
|
</element>
|
739
755
|
</define>
|
756
|
+
<define name="index-xref">
|
757
|
+
<element name="index-xref">
|
758
|
+
<attribute name="also">
|
759
|
+
<data type="boolean"/>
|
760
|
+
</attribute>
|
761
|
+
<element name="primary">
|
762
|
+
<oneOrMore>
|
763
|
+
<ref name="PureTextElement"/>
|
764
|
+
</oneOrMore>
|
765
|
+
</element>
|
766
|
+
<optional>
|
767
|
+
<element name="secondary">
|
768
|
+
<oneOrMore>
|
769
|
+
<ref name="PureTextElement"/>
|
770
|
+
</oneOrMore>
|
771
|
+
</element>
|
772
|
+
</optional>
|
773
|
+
<optional>
|
774
|
+
<element name="tertiary">
|
775
|
+
<oneOrMore>
|
776
|
+
<ref name="PureTextElement"/>
|
777
|
+
</oneOrMore>
|
778
|
+
</element>
|
779
|
+
</optional>
|
780
|
+
<element name="target">
|
781
|
+
<oneOrMore>
|
782
|
+
<ref name="PureTextElement"/>
|
783
|
+
</oneOrMore>
|
784
|
+
</element>
|
785
|
+
</element>
|
786
|
+
</define>
|
740
787
|
<!-- bare ID element, used for referencing arbitrary spans of text -->
|
741
788
|
<define name="bookmark">
|
742
789
|
<element name="bookmark">
|
@@ -1,27 +1,14 @@
|
|
1
|
-
require "asciidoctor"
|
2
|
-
require "metanorma/m3aawg/version"
|
3
|
-
require "isodoc/m3aawg/html_convert"
|
4
|
-
require "isodoc/m3aawg/word_convert"
|
5
|
-
require "isodoc/m3aawg/pdf_convert"
|
6
1
|
require "asciidoctor/standoc/converter"
|
7
|
-
require
|
8
|
-
require_relative "./validate.rb"
|
2
|
+
require 'asciidoctor/generic/converter'
|
9
3
|
|
10
4
|
module Asciidoctor
|
11
5
|
module M3AAWG
|
12
|
-
|
13
|
-
# A {Converter} implementation that generates M3D output, and a document
|
14
|
-
# schema encapsulation of the document for validation
|
15
|
-
class Converter < Standoc::Converter
|
6
|
+
class Converter < Asciidoctor::Generic::Converter
|
16
7
|
XML_ROOT_TAG = "m3d-standard".freeze
|
17
8
|
XML_NAMESPACE = "https://www.metanorma.org/ns/m3d".freeze
|
18
9
|
|
19
10
|
register_for "m3aawg"
|
20
11
|
|
21
|
-
def default_publisher
|
22
|
-
"Messaging Malware and Mobile Anti-Abuse Working Group"
|
23
|
-
end
|
24
|
-
|
25
12
|
def metadata_committee(node, xml)
|
26
13
|
return unless node.attr("technical-committee")
|
27
14
|
xml.editorialgroup do |a|
|
@@ -36,21 +23,8 @@ module Asciidoctor
|
|
36
23
|
end
|
37
24
|
end
|
38
25
|
|
39
|
-
|
40
|
-
|
41
|
-
dn = node.attr("docnumber")
|
42
|
-
if docstatus
|
43
|
-
abbr = IsoDoc::M3AAWG::Metadata.new("en", "Latn", @i18n).
|
44
|
-
stage_abbr(docstatus)
|
45
|
-
dn = "#{dn}(#{abbr})" unless abbr.empty?
|
46
|
-
end
|
47
|
-
node.attr("copyright-year") and dn += ":#{node.attr("copyright-year")}"
|
48
|
-
xml.docidentifier dn, **{type: "M3AAWG"}
|
49
|
-
xml.docnumber { |i| i << node.attr("docnumber") }
|
50
|
-
end
|
51
|
-
|
52
|
-
def title_validate(root)
|
53
|
-
nil
|
26
|
+
def configuration
|
27
|
+
Metanorma::M3AAWG.configuration
|
54
28
|
end
|
55
29
|
|
56
30
|
def makexml(node)
|
@@ -58,15 +32,6 @@ module Asciidoctor
|
|
58
32
|
super
|
59
33
|
end
|
60
34
|
|
61
|
-
def doctype(node)
|
62
|
-
d = super
|
63
|
-
unless %w{policy best-practices supporting-document report}.include? d
|
64
|
-
@log.add("Document Attributes", nil, "#{d} is not a legal document type: reverting to 'report'")
|
65
|
-
d = "report"
|
66
|
-
end
|
67
|
-
d
|
68
|
-
end
|
69
|
-
|
70
35
|
def outputs(node, ret)
|
71
36
|
File.open(@filename + ".xml", "w:UTF-8") { |f| f.write(ret) }
|
72
37
|
presentation_xml_converter(node).convert(@filename + ".xml")
|
@@ -75,12 +40,6 @@ module Asciidoctor
|
|
75
40
|
pdf_converter(node)&.convert(@filename + ".presentation.xml", nil, false, "#{@filename}.pdf")
|
76
41
|
end
|
77
42
|
|
78
|
-
def validate(doc)
|
79
|
-
content_validate(doc)
|
80
|
-
schema_validate(formattedstr_strip(doc.dup),
|
81
|
-
File.join(File.dirname(__FILE__), "m3d.rng"))
|
82
|
-
end
|
83
|
-
|
84
43
|
def sections_cleanup(x)
|
85
44
|
super
|
86
45
|
x.xpath("//*[@inline-header]").each do |h|
|
@@ -88,10 +47,6 @@ module Asciidoctor
|
|
88
47
|
end
|
89
48
|
end
|
90
49
|
|
91
|
-
def style(n, t)
|
92
|
-
return
|
93
|
-
end
|
94
|
-
|
95
50
|
def presentation_xml_converter(node)
|
96
51
|
IsoDoc::M3AAWG::PresentationXMLConvert.new(html_extract_attributes(node))
|
97
52
|
end
|
@@ -24,6 +24,14 @@
|
|
24
24
|
<start>
|
25
25
|
<ref name="standard-document"/>
|
26
26
|
</start>
|
27
|
+
<define name="doctype">
|
28
|
+
<element name="doctype">
|
29
|
+
<optional>
|
30
|
+
<attribute name="abbreviation"/>
|
31
|
+
</optional>
|
32
|
+
<ref name="DocumentType"/>
|
33
|
+
</element>
|
34
|
+
</define>
|
27
35
|
<define name="hyperlink">
|
28
36
|
<element name="link">
|
29
37
|
<attribute name="target">
|
@@ -47,6 +55,13 @@
|
|
47
55
|
<param name="pattern">\i\c*|\c+#\c+</param>
|
48
56
|
</data>
|
49
57
|
</attribute>
|
58
|
+
<optional>
|
59
|
+
<attribute name="to">
|
60
|
+
<data type="string">
|
61
|
+
<param name="pattern">\i\c*|\c+#\c+</param>
|
62
|
+
</data>
|
63
|
+
</attribute>
|
64
|
+
</optional>
|
50
65
|
<optional>
|
51
66
|
<attribute name="type">
|
52
67
|
<ref name="ReferenceFormat"/>
|
@@ -141,6 +156,11 @@
|
|
141
156
|
<data type="boolean"/>
|
142
157
|
</attribute>
|
143
158
|
</optional>
|
159
|
+
<optional>
|
160
|
+
<attribute name="key">
|
161
|
+
<data type="boolean"/>
|
162
|
+
</attribute>
|
163
|
+
</optional>
|
144
164
|
<oneOrMore>
|
145
165
|
<ref name="dt"/>
|
146
166
|
<ref name="dd"/>
|
@@ -233,6 +253,12 @@
|
|
233
253
|
<data type="boolean"/>
|
234
254
|
</attribute>
|
235
255
|
</optional>
|
256
|
+
<optional>
|
257
|
+
<attribute name="width"/>
|
258
|
+
</optional>
|
259
|
+
<optional>
|
260
|
+
<ref name="colgroup"/>
|
261
|
+
</optional>
|
236
262
|
<optional>
|
237
263
|
<ref name="tname"/>
|
238
264
|
</optional>
|
@@ -751,6 +777,18 @@
|
|
751
777
|
</define>
|
752
778
|
</include>
|
753
779
|
<!-- end overrides -->
|
780
|
+
<define name="colgroup">
|
781
|
+
<element name="colgroup">
|
782
|
+
<oneOrMore>
|
783
|
+
<ref name="col"/>
|
784
|
+
</oneOrMore>
|
785
|
+
</element>
|
786
|
+
</define>
|
787
|
+
<define name="col">
|
788
|
+
<element name="col">
|
789
|
+
<attribute name="width"/>
|
790
|
+
</element>
|
791
|
+
</define>
|
754
792
|
<define name="TextElement" combine="choice">
|
755
793
|
<ref name="concept"/>
|
756
794
|
</define>
|
@@ -801,6 +839,9 @@
|
|
801
839
|
<data type="boolean"/>
|
802
840
|
</attribute>
|
803
841
|
</optional>
|
842
|
+
<optional>
|
843
|
+
<attribute name="number"/>
|
844
|
+
</optional>
|
804
845
|
<optional>
|
805
846
|
<attribute name="obligation">
|
806
847
|
<choice>
|
@@ -856,9 +897,11 @@
|
|
856
897
|
<element name="code">
|
857
898
|
<text/>
|
858
899
|
</element>
|
859
|
-
<
|
860
|
-
<text
|
861
|
-
|
900
|
+
<optional>
|
901
|
+
<element name="text">
|
902
|
+
<text/>
|
903
|
+
</element>
|
904
|
+
</optional>
|
862
905
|
</element>
|
863
906
|
</define>
|
864
907
|
<define name="standard-document">
|
@@ -1028,6 +1071,9 @@
|
|
1028
1071
|
</choice>
|
1029
1072
|
</attribute>
|
1030
1073
|
</optional>
|
1074
|
+
<optional>
|
1075
|
+
<attribute name="number"/>
|
1076
|
+
</optional>
|
1031
1077
|
<optional>
|
1032
1078
|
<attribute name="type"/>
|
1033
1079
|
</optional>
|
@@ -1081,6 +1127,9 @@
|
|
1081
1127
|
<optional>
|
1082
1128
|
<attribute name="type"/>
|
1083
1129
|
</optional>
|
1130
|
+
<optional>
|
1131
|
+
<attribute name="number"/>
|
1132
|
+
</optional>
|
1084
1133
|
<optional>
|
1085
1134
|
<ref name="section-title"/>
|
1086
1135
|
</optional>
|
@@ -1183,6 +1232,9 @@
|
|
1183
1232
|
<optional>
|
1184
1233
|
<attribute name="type"/>
|
1185
1234
|
</optional>
|
1235
|
+
<optional>
|
1236
|
+
<attribute name="number"/>
|
1237
|
+
</optional>
|
1186
1238
|
<optional>
|
1187
1239
|
<attribute name="obligation">
|
1188
1240
|
<choice>
|
@@ -1511,6 +1563,7 @@
|
|
1511
1563
|
<value>add</value>
|
1512
1564
|
<value>modify</value>
|
1513
1565
|
<value>delete</value>
|
1566
|
+
<value>replace</value>
|
1514
1567
|
</choice>
|
1515
1568
|
</attribute>
|
1516
1569
|
<optional>
|
@@ -1541,6 +1594,11 @@
|
|
1541
1594
|
</optional>
|
1542
1595
|
<optional>
|
1543
1596
|
<element name="newcontent">
|
1597
|
+
<optional>
|
1598
|
+
<attribute name="id">
|
1599
|
+
<data type="ID"/>
|
1600
|
+
</attribute>
|
1601
|
+
</optional>
|
1544
1602
|
<zeroOrMore>
|
1545
1603
|
<ref name="BasicBlock"/>
|
1546
1604
|
</zeroOrMore>
|
@@ -3,18 +3,8 @@ require "fileutils"
|
|
3
3
|
module IsoDoc
|
4
4
|
module M3AAWG
|
5
5
|
module BaseRender
|
6
|
-
def
|
7
|
-
|
8
|
-
term_cleanup(docxml)
|
9
|
-
end
|
10
|
-
|
11
|
-
def term_cleanup(docxml)
|
12
|
-
docxml.xpath("//p[@class = 'Terms']").each do |d|
|
13
|
-
h2 = d.at("./preceding-sibling::*[@class = 'TermNum'][1]")
|
14
|
-
h2.add_child(" ")
|
15
|
-
h2.add_child(d.remove)
|
16
|
-
end
|
17
|
-
docxml
|
6
|
+
def configuration
|
7
|
+
Metanorma::M3AAWG.configuration
|
18
8
|
end
|
19
9
|
end
|
20
10
|
end
|
@@ -228,7 +228,7 @@ body {
|
|
228
228
|
margin-left: auto;
|
229
229
|
margin-right: auto;
|
230
230
|
max-width: 100%;
|
231
|
-
font-size:
|
231
|
+
font-size: {{normalfontsize}};
|
232
232
|
font-weight: 300;
|
233
233
|
line-height: 1.4em;
|
234
234
|
color: #1d1d1d;
|
@@ -666,7 +666,7 @@ p.Biblio, p.NormRef {
|
|
666
666
|
pre,
|
667
667
|
.pseudocode {
|
668
668
|
background-color: #F5F6F6;
|
669
|
-
font-size:
|
669
|
+
font-size: {{monospacefontsize}};
|
670
670
|
line-height: 1.6em;
|
671
671
|
padding: 1.5em;
|
672
672
|
margin: 2em 0 1em 0;
|
@@ -789,7 +789,7 @@ a.footnote-number {
|
|
789
789
|
font-size: 0.8em; }
|
790
790
|
|
791
791
|
.footnote {
|
792
|
-
font-size:
|
792
|
+
font-size: {{footnotefontsize}}; }
|
793
793
|
|
794
794
|
/*
|
795
795
|
3.11 Blockquotes
|
@@ -18,7 +18,7 @@ Light Gray: #F5F6F6
|
|
18
18
|
@import 'base_style/all';
|
19
19
|
|
20
20
|
body {
|
21
|
-
@include bodyStyle1(
|
21
|
+
@include bodyStyle1($normalfontsize, 1.4em, #1d1d1d, #ffffff, 300);
|
22
22
|
}
|
23
23
|
|
24
24
|
#report {
|
@@ -431,7 +431,7 @@ a.footnote-number {
|
|
431
431
|
}
|
432
432
|
|
433
433
|
.footnote {
|
434
|
-
font-size:
|
434
|
+
font-size: $footnotefontsize;
|
435
435
|
}
|
436
436
|
|
437
437
|
|