metanorma-m3aawg 1.5.6 → 1.6.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 24f72496b09470f4ba51be8bab7dd660afe55d6992c0e796a62ab9cf55e827eb
4
- data.tar.gz: 1ced435294ef6563be291a9f3819d6d7c0d56c7c052b158e92ca3fbefcc5302e
3
+ metadata.gz: c2fd3488774323dab01d7b10d584bae9492abebe8d22376a1a3a5351026cd8f2
4
+ data.tar.gz: f3d059e05c404ad418f7bce4251e36b00781dd8e7df08891957e8becd64477be
5
5
  SHA512:
6
- metadata.gz: 88c4d252e305ed09ec1306ee4fc7a93450d61c548046e4cfcd2a71e5a17117f49a649c2e94e808582d9c9ea9cde10938e5cad417e97c9bfa81d5898724e2c534
7
- data.tar.gz: 31ba0a8661ab3c840ab132710a0e440cb4a3ae9fb0a94b76a40eb48d8a73a431b89d589bc7d611cb6aab569888ab8bf3924c1dd4a09f4b67c366298dc79df4ee
6
+ metadata.gz: ce3566f1142e13b1e7643dff05304bfe46e00a45aefcd147fcc7b6c995cf390bf7ead57f1951aab95327408908611810f8a6b00abcd4231e5a66418de1953f21
7
+ data.tar.gz: f46acdf4f84b6a3c14cbe24c4ef9115254150afba1bda0dbc8583478a265eb9f1148f2bdacec040f8dcea820c9e270cf31b94660aaba49328318c810ac97ab80
@@ -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,32 @@ jobs:
31
32
  steps:
32
33
  - uses: actions/checkout@master
33
34
 
34
- - name: Use Ruby
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
- - name: Update gems
41
- run: bundle install --jobs 4 --retry 3
39
+ - uses: actions/cache@v1
40
+ with:
41
+ path: vendor/bundle
42
+ key: bundle-${{ matrix.os }}-${{ matrix.ruby }}-${{ hashFiles('**/*.gemspec') }}
43
+ restore-keys: bundle-${{ matrix.os }}-${{ matrix.ruby }}
44
+
45
+ - run: bundle config set path 'vendor/bundle'
46
+
47
+ - run: bundle install --jobs 4 --retry 3
42
48
 
43
- - name: Run specs
44
- run: bundle exec rake
49
+ - run: bundle exec rake
50
+
51
+ notify:
52
+ name: Trigger notify workflow
53
+ needs: rake
54
+ runs-on: ubuntu-latest
55
+ steps:
56
+ - name: Trigger notify workflow
57
+ uses: Sibz/github-status-action@v1
58
+ with:
59
+ authToken: ${{ secrets.GITHUB_TOKEN }}
60
+ context: 'tests-passed-successfully'
61
+ description: 'Tests passed successfully'
62
+ state: 'success'
63
+ sha: ${{ github.event.pull_request.head.sha || github.sha }}
@@ -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/macos/badge.svg["Build Status", link="https://github.com/metanorma/metanorma-m3aawg/actions?workflow=macos"]
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 http://asciidoctor.org/[Asciidoctor] documents following
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
@@ -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 "fileutils"
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
- def metadata_id(node, xml)
40
- docstatus = node.attr("status")
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">
@@ -141,6 +149,11 @@
141
149
  <data type="boolean"/>
142
150
  </attribute>
143
151
  </optional>
152
+ <optional>
153
+ <attribute name="key">
154
+ <data type="boolean"/>
155
+ </attribute>
156
+ </optional>
144
157
  <oneOrMore>
145
158
  <ref name="dt"/>
146
159
  <ref name="dd"/>
@@ -3,18 +3,8 @@ require "fileutils"
3
3
  module IsoDoc
4
4
  module M3AAWG
5
5
  module BaseRender
6
- def cleanup(docxml)
7
- super
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("&nbsp;")
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
@@ -1,35 +1,18 @@
1
1
  require "isodoc"
2
+ require "isodoc/generic/html_convert"
2
3
  require_relative "base_convert"
3
4
  require_relative "init"
4
5
 
5
6
  module IsoDoc
6
7
  module M3AAWG
7
- # A {Converter} implementation that generates CSAND output, and a document
8
- # schema encapsulation of the document for validation
9
- class HtmlConvert < IsoDoc::HtmlConvert
10
- def initialize(options)
11
- @libdir = File.dirname(__FILE__)
12
- super
13
- end
14
-
15
- def default_fonts(options)
16
- {
17
- bodyfont: (options[:script] == "Hans" ? '"SimSun",serif' :
18
- '"Overpass",sans-serif'),
19
- headerfont: (options[:script] == "Hans" ? '"SimHei",sans-serif' :
20
- '"Overpass",sans-serif'),
21
- monospacefont: '"Space Mono",monospace'
22
- }
8
+ class HtmlConvert < IsoDoc::Generic::HtmlConvert
9
+ def configuration
10
+ Metanorma::M3AAWG.configuration
23
11
  end
24
12
 
25
- def default_file_locations(_options)
26
- {
27
- htmlstylesheet: html_doc_path("htmlstyle.scss"),
28
- htmlcoverpage: html_doc_path("html_m3d_titlepage.html"),
29
- htmlintropage: html_doc_path("html_m3d_intro.html"),
30
- standardstylesheet: nil,
31
- scripts: html_doc_path("scripts.html"),
32
- }
13
+ def initialize(options)
14
+ #require "byebug"; byebug
15
+ super
33
16
  end
34
17
 
35
18
  def colophon(body, docxml)
@@ -45,13 +28,6 @@ module IsoDoc
45
28
  end
46
29
  end
47
30
 
48
- def googlefonts()
49
- <<~HEAD.freeze
50
- <link href="https://fonts.googleapis.com/css?family=Open+Sans:300,300i,400,400i,600,600i|Space+Mono:400,700" rel="stylesheet">
51
- <link href="https://fonts.googleapis.com/css?family=Overpass:300,300i,600,900" rel="stylesheet">
52
- HEAD
53
- end
54
-
55
31
  def make_body(xml, docxml)
56
32
  body_attr = { lang: "EN-US", link: "blue", vlink: "#954F72",
57
33
  "xml:lang": "EN-US", class: "container" }
@@ -1,9 +1,8 @@
1
1
  module IsoDoc
2
2
  module M3AAWG
3
- class I18n < IsoDoc::I18n
4
- def load_yaml1(lang, script)
5
- y = YAML.load_file(File.join(File.dirname(__FILE__), "i18n-en.yaml"))
6
- super.merge(y)
3
+ class I18n < IsoDoc::Generic::I18n
4
+ def configuration
5
+ Metanorma::M3AAWG.configuration
7
6
  end
8
7
  end
9
8
  end
@@ -11,16 +11,13 @@ module IsoDoc
11
11
  end
12
12
 
13
13
  def xref_init(lang, script, klass, labels, options)
14
- @xrefs = Xref.new(lang, script, HtmlConvert.new(language: lang, script: script), labels, options)
14
+ html = HtmlConvert.new(language: lang, script: script)
15
+ @xrefs = Xref.new(lang, script, html, labels, options)
15
16
  end
16
17
 
17
18
  def i18n_init(lang, script, i18nyaml = nil)
18
19
  @i18n = I18n.new(lang, script, i18nyaml || @i18nyaml)
19
20
  end
20
-
21
- def fileloc(loc)
22
- File.join(File.dirname(__FILE__), loc)
23
- end
24
21
  end
25
22
  end
26
23
  end
@@ -908,13 +908,22 @@
908
908
  <title-part lang="en">
909
909
 
910
910
 
911
+
911
912
  </title-part>
912
913
  <title-part lang="fr">
913
914
 
914
915
 
916
+
915
917
  </title-part>
916
918
  <title-part lang="zh">第 # 部分:</title-part>
917
919
 
920
+ <title-subpart lang="en">
921
+
922
+ </title-subpart>
923
+ <title-subpart lang="fr">
924
+
925
+ </title-subpart>
926
+
918
927
  <title-modified lang="en">modified</title-modified>
919
928
  <title-modified lang="fr">modifiée</title-modified>
920
929
 
@@ -1380,7 +1389,9 @@
1380
1389
 
1381
1390
 
1382
1391
 
1383
-
1392
+ <!-- <xsl:if test="$namespace = 'bipm'">
1393
+ <fo:block>&#xA0;</fo:block>
1394
+ </xsl:if> -->
1384
1395
 
1385
1396
  <!-- $namespace = 'iso' or -->
1386
1397
 
@@ -1543,6 +1554,7 @@
1543
1554
  <xsl:if test="normalize-space() != ''">
1544
1555
  <fo:block xsl:use-attribute-sets="table-name-style">
1545
1556
 
1557
+
1546
1558
  <xsl:apply-templates/>
1547
1559
  </fo:block>
1548
1560
  </xsl:if>
@@ -1896,6 +1908,7 @@
1896
1908
 
1897
1909
 
1898
1910
 
1911
+
1899
1912
  <!-- <xsl:if test="$namespace = 'bipm'">
1900
1913
  <xsl:attribute name="height">8mm</xsl:attribute>
1901
1914
  </xsl:if> -->
@@ -1981,7 +1994,8 @@
1981
1994
  </xsl:attribute>
1982
1995
  </xsl:if>
1983
1996
  <xsl:call-template name="display-align"/>
1984
- <fo:block>
1997
+ <fo:block>
1998
+
1985
1999
  <xsl:apply-templates/>
1986
2000
  </fo:block>
1987
2001
  </fo:table-cell>
@@ -2193,7 +2207,11 @@
2193
2207
  <xsl:apply-templates/>
2194
2208
  </fo:inline>
2195
2209
  </xsl:template><xsl:template match="*[local-name()='dl']">
2196
- <fo:block-container margin-left="0mm">
2210
+ <fo:block-container>
2211
+
2212
+ <xsl:attribute name="margin-left">0mm</xsl:attribute>
2213
+
2214
+
2197
2215
  <xsl:if test="parent::*[local-name() = 'note']">
2198
2216
  <xsl:attribute name="margin-left">
2199
2217
  <xsl:choose>
@@ -2203,8 +2221,11 @@
2203
2221
  </xsl:attribute>
2204
2222
 
2205
2223
  </xsl:if>
2206
- <fo:block-container margin-left="0mm">
2207
-
2224
+ <fo:block-container>
2225
+
2226
+ <xsl:attribute name="margin-left">0mm</xsl:attribute>
2227
+
2228
+
2208
2229
  <xsl:variable name="parent" select="local-name(..)"/>
2209
2230
 
2210
2231
  <xsl:variable name="key_iso">
@@ -2218,9 +2239,12 @@
2218
2239
  <fo:block margin-bottom="12pt" text-align="left">
2219
2240
 
2220
2241
  <xsl:variable name="title-where">
2221
- <xsl:call-template name="getTitle">
2222
- <xsl:with-param name="name" select="'title-where'"/>
2223
- </xsl:call-template>
2242
+
2243
+
2244
+ <xsl:call-template name="getTitle">
2245
+ <xsl:with-param name="name" select="'title-where'"/>
2246
+ </xsl:call-template>
2247
+
2224
2248
  </xsl:variable>
2225
2249
  <xsl:value-of select="$title-where"/><xsl:text> </xsl:text>
2226
2250
  <xsl:apply-templates select="*[local-name()='dt']/*"/>
@@ -2236,9 +2260,12 @@
2236
2260
 
2237
2261
 
2238
2262
  <xsl:variable name="title-where">
2239
- <xsl:call-template name="getTitle">
2240
- <xsl:with-param name="name" select="'title-where'"/>
2241
- </xsl:call-template>
2263
+
2264
+
2265
+ <xsl:call-template name="getTitle">
2266
+ <xsl:with-param name="name" select="'title-where'"/>
2267
+ </xsl:call-template>
2268
+
2242
2269
  </xsl:variable>
2243
2270
  <xsl:value-of select="$title-where"/>
2244
2271
  </fo:block>
@@ -2249,9 +2276,12 @@
2249
2276
 
2250
2277
 
2251
2278
  <xsl:variable name="title-key">
2252
- <xsl:call-template name="getTitle">
2253
- <xsl:with-param name="name" select="'title-key'"/>
2254
- </xsl:call-template>
2279
+
2280
+
2281
+ <xsl:call-template name="getTitle">
2282
+ <xsl:with-param name="name" select="'title-key'"/>
2283
+ </xsl:call-template>
2284
+
2255
2285
  </xsl:variable>
2256
2286
  <xsl:value-of select="$title-key"/>
2257
2287
  </fo:block>
@@ -2827,7 +2857,18 @@
2827
2857
  <xsl:with-param name="previousRow" select="$newRow"/>
2828
2858
  </xsl:apply-templates>
2829
2859
  </xsl:template><xsl:template name="getLang">
2830
- <xsl:variable name="language" select="//*[local-name()='bibdata']//*[local-name()='language']"/>
2860
+ <xsl:variable name="language_current" select="normalize-space(//*[local-name()='bibdata']//*[local-name()='language'][@current = 'true'])"/>
2861
+ <xsl:variable name="language">
2862
+ <xsl:choose>
2863
+ <xsl:when test="$language_current != ''">
2864
+ <xsl:value-of select="$language_current"/>
2865
+ </xsl:when>
2866
+ <xsl:otherwise>
2867
+ <xsl:value-of select="//*[local-name()='bibdata']//*[local-name()='language']"/>
2868
+ </xsl:otherwise>
2869
+ </xsl:choose>
2870
+ </xsl:variable>
2871
+
2831
2872
  <xsl:choose>
2832
2873
  <xsl:when test="$language = 'English'">en</xsl:when>
2833
2874
  <xsl:otherwise><xsl:value-of select="$language"/></xsl:otherwise>
@@ -2862,6 +2903,7 @@
2862
2903
  <xsl:value-of select="substring($str, 2)"/>
2863
2904
  </xsl:template><xsl:template match="mathml:math">
2864
2905
  <fo:inline font-family="STIX Two Math"> <!-- -->
2906
+
2865
2907
  <xsl:variable name="mathml">
2866
2908
  <xsl:apply-templates select="." mode="mathml"/>
2867
2909
  </xsl:variable>
@@ -2944,10 +2986,14 @@
2944
2986
  </fo:inline>
2945
2987
  </xsl:template><xsl:template match="*[local-name() = 'modification']">
2946
2988
  <xsl:variable name="title-modified">
2947
- <xsl:call-template name="getTitle">
2948
- <xsl:with-param name="name" select="'title-modified'"/>
2949
- </xsl:call-template>
2989
+
2990
+
2991
+ <xsl:call-template name="getTitle">
2992
+ <xsl:with-param name="name" select="'title-modified'"/>
2993
+ </xsl:call-template>
2994
+
2950
2995
  </xsl:variable>
2996
+
2951
2997
  <xsl:choose>
2952
2998
  <xsl:when test="$lang = 'zh'"><xsl:text>、</xsl:text><xsl:value-of select="$title-modified"/><xsl:text>—</xsl:text></xsl:when>
2953
2999
  <xsl:otherwise><xsl:text>, </xsl:text><xsl:value-of select="$title-modified"/><xsl:text> — </xsl:text></xsl:otherwise>
@@ -3824,9 +3870,12 @@
3824
3870
  </fo:block>
3825
3871
  </xsl:template><xsl:template match="*[local-name() = 'deprecates']">
3826
3872
  <xsl:variable name="title-deprecated">
3827
- <xsl:call-template name="getTitle">
3828
- <xsl:with-param name="name" select="'title-deprecated'"/>
3829
- </xsl:call-template>
3873
+
3874
+
3875
+ <xsl:call-template name="getTitle">
3876
+ <xsl:with-param name="name" select="'title-deprecated'"/>
3877
+ </xsl:call-template>
3878
+
3830
3879
  </xsl:variable>
3831
3880
  <fo:block xsl:use-attribute-sets="deprecates-style">
3832
3881
  <xsl:value-of select="$title-deprecated"/>: <xsl:apply-templates/>
@@ -4194,13 +4243,22 @@
4194
4243
  </xsl:template><xsl:template name="split">
4195
4244
  <xsl:param name="pText" select="."/>
4196
4245
  <xsl:param name="sep" select="','"/>
4246
+ <xsl:param name="normalize-space" select="'true'"/>
4197
4247
  <xsl:if test="string-length($pText) &gt;0">
4198
4248
  <item>
4199
- <xsl:value-of select="normalize-space(substring-before(concat($pText, ','), $sep))"/>
4249
+ <xsl:choose>
4250
+ <xsl:when test="$normalize-space = 'true'">
4251
+ <xsl:value-of select="normalize-space(substring-before(concat($pText, $sep), $sep))"/>
4252
+ </xsl:when>
4253
+ <xsl:otherwise>
4254
+ <xsl:value-of select="substring-before(concat($pText, $sep), $sep)"/>
4255
+ </xsl:otherwise>
4256
+ </xsl:choose>
4200
4257
  </item>
4201
4258
  <xsl:call-template name="split">
4202
4259
  <xsl:with-param name="pText" select="substring-after($pText, $sep)"/>
4203
4260
  <xsl:with-param name="sep" select="$sep"/>
4261
+ <xsl:with-param name="normalize-space" select="$normalize-space"/>
4204
4262
  </xsl:call-template>
4205
4263
  </xsl:if>
4206
4264
  </xsl:template><xsl:template name="getDocumentId">
@@ -4266,4 +4324,23 @@
4266
4324
  <xsl:with-param name="letter-spacing" select="$letter-spacing"/>
4267
4325
  </xsl:call-template>
4268
4326
  </xsl:if>
4327
+ </xsl:template><xsl:template name="repeat">
4328
+ <xsl:param name="char" select="'*'"/>
4329
+ <xsl:param name="count"/>
4330
+ <xsl:if test="$count &gt; 0">
4331
+ <xsl:value-of select="$char"/>
4332
+ <xsl:call-template name="repeat">
4333
+ <xsl:with-param name="char" select="$char"/>
4334
+ <xsl:with-param name="count" select="$count - 1"/>
4335
+ </xsl:call-template>
4336
+ </xsl:if>
4337
+ </xsl:template><xsl:template name="getLocalizedString">
4338
+ <xsl:param name="key"/>
4339
+
4340
+ <xsl:variable name="curr_lang">
4341
+ <xsl:call-template name="getLang"/>
4342
+ </xsl:variable>
4343
+
4344
+ <xsl:value-of select="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
4345
+
4269
4346
  </xsl:template></xsl:stylesheet>
@@ -2,9 +2,11 @@ require "isodoc"
2
2
 
3
3
  module IsoDoc
4
4
  module M3AAWG
5
- # A {Converter} implementation that generates CSAND output, and a document
6
- # schema encapsulation of the document for validation
7
- class Metadata < IsoDoc::Metadata
5
+ class Metadata < IsoDoc::Generic::Metadata
6
+ def configuration
7
+ Metanorma::M3AAWG.configuration
8
+ end
9
+
8
10
  def initialize(lang, script, labels)
9
11
  super
10
12
  here = File.dirname(__FILE__)
@@ -34,20 +36,6 @@ module IsoDoc
34
36
  docnumber = isoxml.at(ns("//bibdata/docidentifier"))
35
37
  set(:docnumber, docnumber&.text)
36
38
  end
37
-
38
- def stage_abbr(status)
39
- case status
40
- when "working-draft" then "wd"
41
- when "committee-draft" then "cd"
42
- when "draft-standard" then "d"
43
- else
44
- ""
45
- end
46
- end
47
-
48
- def unpublished(status)
49
- !%w(published withdrawn).include? status.downcase
50
- end
51
39
  end
52
40
  end
53
41
  end
@@ -1,16 +1,21 @@
1
1
  require_relative "init"
2
+ require "metanorma-generic"
2
3
  require "isodoc"
3
4
 
4
5
  module IsoDoc
5
6
  module M3AAWG
6
- class PresentationXMLConvert < IsoDoc::PresentationXMLConvert
7
+ class PresentationXMLConvert < IsoDoc::Generic::PresentationXMLConvert
8
+ def configuration
9
+ Metanorma::M3AAWG.configuration
10
+ end
11
+
7
12
  def annex1(f)
8
- lbl = @xrefs.anchor(f['id'], :label)
9
- if t = f.at(ns("./title"))
10
- t.children = "<strong>#{t.children.to_xml}</strong>"
13
+ lbl = @xrefs.anchor(f['id'], :label)
14
+ if t = f.at(ns("./title"))
15
+ t.children = "<strong>#{t.children.to_xml}</strong>"
16
+ end
17
+ prefix_name(f, "<br/>", lbl, "title")
11
18
  end
12
- prefix_name(f, "<br/>", lbl, "title")
13
- end
14
19
 
15
20
  include Init
16
21
  end
@@ -1,39 +1,13 @@
1
1
  require "isodoc"
2
2
  require_relative "base_convert"
3
+ require "isodoc/generic/word_convert"
3
4
  require_relative "init"
4
5
 
5
6
  module IsoDoc
6
7
  module M3AAWG
7
- # A {Converter} implementation that generates GB output, and a document
8
- # schema encapsulation of the document for validation
9
-
10
- class WordConvert < IsoDoc::WordConvert
11
- def initialize(options)
12
- @libdir = File.dirname(__FILE__)
13
- super
14
- end
15
-
16
- def default_fonts(options)
17
- {
18
- bodyfont: (options[:script] == "Hans" ? '"SimSun",serif' : '"Garamond",serif'),
19
- headerfont: (options[:script] == "Hans" ? '"SimHei",sans-serif' : '"Garamond",serif'),
20
- monospacefont: '"Courier New",monospace'
21
- }
22
- end
23
-
24
- def default_file_locations(_options)
25
- {
26
- htmlstylesheet: html_doc_path("htmlstyle.scss"),
27
- htmlcoverpage: html_doc_path("html_m3d_titlepage.html"),
28
- htmlintropage: html_doc_path("html_m3d_intro.html"),
29
- scripts: html_doc_path("scripts.html"),
30
- wordstylesheet: html_doc_path("wordstyle.scss"),
31
- standardstylesheet: html_doc_path("m3d.scss"),
32
- header: html_doc_path("header.html"),
33
- wordintropage: html_doc_path("word_m3d_intro.html"),
34
- ulstyle: "l3",
35
- olstyle: "l2",
36
- }
8
+ class WordConvert < IsoDoc::Generic::WordConvert
9
+ def configuration
10
+ Metanorma::M3AAWG.configuration
37
11
  end
38
12
 
39
13
  def colophon(body, docxml)
@@ -51,11 +25,6 @@ module IsoDoc
51
25
  end
52
26
  end
53
27
 
54
- def title(isoxml, _out)
55
- main = isoxml&.at(ns("//title[@language='en']"))&.text
56
- set_metadata(:doctitle, main)
57
- end
58
-
59
28
  include BaseRender
60
29
  include Init
61
30
  end
@@ -1,6 +1,11 @@
1
+ require "metanorma-generic"
2
+
1
3
  module IsoDoc
2
4
  module M3AAWG
3
5
  class Xref < IsoDoc::Xref
6
+ def configuration
7
+ Metanorma::M3AAWG.configuration
8
+ end
4
9
  end
5
10
  end
6
11
  end
@@ -1,7 +1,33 @@
1
- require_relative "./m3aawg/processor"
1
+ require "metanorma"
2
+ require "metanorma-generic"
3
+ require "metanorma/m3aawg/processor"
2
4
 
3
5
  module Metanorma
4
- module M3AWWG
6
+ module M3AAWG
5
7
 
8
+ class Configuration < Metanorma::Generic::Configuration
9
+ def initialize(*args)
10
+ super
11
+ end
12
+ end
13
+
14
+ class << self
15
+ extend Forwardable
16
+
17
+ attr_accessor :configuration
18
+
19
+ Configuration::CONFIG_ATTRS.each do |attr_name|
20
+ def_delegator :@configuration, attr_name
21
+ end
22
+
23
+ def configure
24
+ self.configuration ||= Configuration.new
25
+ yield(configuration)
26
+ end
27
+ end
28
+
29
+ configure {}
6
30
  end
7
31
  end
32
+ Metanorma::Registry.instance.register(Metanorma::M3AAWG::Processor)
33
+
@@ -10,7 +10,10 @@ module Metanorma
10
10
  }
11
11
  end
12
12
 
13
- class Processor < Metanorma::Processor
13
+ class Processor < Metanorma::Generic::Processor
14
+ def configuration
15
+ Metanorma::Ribose.configuration
16
+ end
14
17
 
15
18
  def initialize
16
19
  @short = [:m3d, :m3aawg]
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module M3AAWG
3
- VERSION = "1.5.6"
3
+ VERSION = "1.6.0"
4
4
  end
5
5
  end
@@ -31,7 +31,7 @@ Gem::Specification.new do |spec|
31
31
  spec.add_dependency "htmlentities", "~> 4.3.4"
32
32
  spec.add_dependency "thread_safe"
33
33
 
34
- spec.add_dependency "metanorma-standoc", "~> 1.6.0"
34
+ spec.add_dependency "metanorma-generic", "~> 1.7.0"
35
35
  spec.add_dependency "isodoc", "~> 1.2.0"
36
36
 
37
37
  spec.add_development_dependency "byebug", "~> 9.1"
@@ -0,0 +1,45 @@
1
+ metanorma_name: m3aawg
2
+ organization_name_short: M3AAWG
3
+ organization_name_long: Messaging Malware and Mobile Anti-Abuse Working Group
4
+ document_namespace: https://www.metanorma.org/ns/m3d
5
+ xml_root_tag: m3d-standard
6
+ html_bodyfont: '"Overpass",sans-serif'
7
+ html_headerfont: '"Overpass",sans-serif'
8
+ html_monospacefont: '"Space Mono",monospace'
9
+ i18nyaml: lib/isodoc/m3aawg/i18n-en.yaml
10
+ validate_rng_file: lib/asciidoctor/m3aawg/m3d.rng
11
+ htmlcoverpage: lib/isodoc/m3aawg/html/html_m3d_titlepage.html
12
+ htmlintropage: lib/isodoc/m3aawg/html/html_m3d_intro.html
13
+ htmlstylesheet: lib/isodoc/m3aawg/html/htmlstyle.scss
14
+ scripts: lib/isodoc/m3aawg/html/scripts.html
15
+ word_bodyfont: '"Garamond",serif'
16
+ word_headerfont: '"Garamond",serif'
17
+ word_monospacefont: '"Courier New",monospace'
18
+ standardstylesheet: lib/isodoc/m3aawg/html/m3d.scss
19
+ header: lib/isodoc/m3aawg/html/header.html
20
+ wordcoverpage: ""
21
+ wordintropage: lib/isodoc/m3aawg/html/word_m3d_intro.html
22
+ wordstylesheet: lib/isodoc/m3aawg/html/wordstyle.scss
23
+ webfont:
24
+ - "https://fonts.googleapis.com/css?family=Overpass:300,300i,600,900"
25
+ - "https://fonts.googleapis.com/css?family=Open+Sans:300,300i,400,400i,600,600i|Space+Mono:400,700"
26
+ docid_template: "{{ docnumeric }}{% if stageabbr %}({{ stageabbr }}){%endif%}{% if docyear %}:{{docyear}}{%endif%}"
27
+ doctypes:
28
+ - policy
29
+ - best-practices
30
+ - supporting-document
31
+ - report
32
+ default_doctype: report
33
+ published_stages:
34
+ - published
35
+ - withdrawn
36
+ default_stage: published
37
+ stage_abbreviations:
38
+ proposal:
39
+ working-draft: wd
40
+ committee-draft: cd
41
+ draft-standard: d
42
+ final-draft:
43
+ published:
44
+ withdrawn:
45
+ logo_path: ""
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metanorma-m3aawg
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.6
4
+ version: 1.6.0
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-10-25 00:00:00.000000000 Z
11
+ date: 2020-11-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: htmlentities
@@ -39,19 +39,19 @@ dependencies:
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
- name: metanorma-standoc
42
+ name: metanorma-generic
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: 1.6.0
47
+ version: 1.7.0
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: 1.6.0
54
+ version: 1.7.0
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: isodoc
57
57
  requirement: !ruby/object:Gem::Requirement
@@ -238,7 +238,6 @@ files:
238
238
  - lib/asciidoctor/m3aawg/isodoc.rng
239
239
  - lib/asciidoctor/m3aawg/m3d.rng
240
240
  - lib/asciidoctor/m3aawg/reqt.rng
241
- - lib/asciidoctor/m3aawg/validate.rb
242
241
  - lib/isodoc/m3aawg/base_convert.rb
243
242
  - lib/isodoc/m3aawg/html/dots-w@2x.png
244
243
  - lib/isodoc/m3aawg/html/dots@2x.png
@@ -271,6 +270,7 @@ files:
271
270
  - lib/metanorma/m3aawg/processor.rb
272
271
  - lib/metanorma/m3aawg/version.rb
273
272
  - metanorma-m3d.gemspec
273
+ - metanorma.yml
274
274
  homepage: https://github.com/metanorma/metanorma-m3aawg
275
275
  licenses:
276
276
  - BSD-2-Clause
@@ -1,22 +0,0 @@
1
- module Asciidoctor
2
- module M3AAWG
3
- class Converter < Standoc::Converter
4
- def content_validate(doc)
5
- super
6
- bibdata_validate(doc.root)
7
- end
8
-
9
- def bibdata_validate(doc)
10
- stage_validate(doc)
11
- end
12
-
13
- def stage_validate(xmldoc)
14
- stage = xmldoc&.at("//bibdata/status/stage")&.text
15
- %w(proposal working-draft committee-draft draft-standard final-draft
16
- published withdrawn).include? stage or
17
- @log.add("Document Attributes", nil, "#{stage} is not a recognised status")
18
- end
19
- end
20
- end
21
- end
22
-