metanorma-csa 1.6.6 → 1.6.7

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: 3167e8f69fcf1788c807e29b0b0bf466372b86a587e349db7ed2b9581593b919
4
- data.tar.gz: c47618d4156d5d68d37a033260b5d3f13c4dd1ef7ad5165eeb20b8b25be9cbc8
3
+ metadata.gz: 9482a7b054061fd42439fac150f5d2e328bcd165387e5d0213811b736362c75b
4
+ data.tar.gz: 5e5e352e61b1c4f62fe5f9aaab7592d49704874c28f461c13009a7df1037cd9c
5
5
  SHA512:
6
- metadata.gz: b9fd562124e26c29ce6df45597cda035dc3f4042efd1af231c3020d9c643c09702ac889b4c64fe782c5519839ebffe13ae6769e6cbd1093e2d1144f06730fc1d
7
- data.tar.gz: 2478c8a52b6663cc90e82f7b51d7f85b40546eebc432fd6c990e20859a7cec3fcc9f8b73b2705b98f5c2337687541088d2e6e7db4bdbae19360d6ae8271697f6
6
+ metadata.gz: '058d7bf311553b32294bd267c6e58146f80241d804e8eb866421f5c93fe9932082cba1c71e7de6ca3ac3ff796e1d1d3d557cae6da7d9a11df07c9627c10aaa3b'
7
+ data.tar.gz: 07b932b56ca67039d21a19bb4aa0bcf9f885a0d28cc86cb0bcda0aa298fee6bc71b1abe6576b671eb01c7c87d88de9f24a753116c10dc22e4631d65bff316a03
@@ -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,19 +1,15 @@
1
- = AsciiCSAND: Asciidoctor processor for CSA Normal Documents (CSAND)
1
+ = Metanorma processor for CSA documents
2
2
 
3
3
  image:https://img.shields.io/gem/v/metanorma-csa.svg["Gem Version", link="https://rubygems.org/gems/metanorma-csa"]
4
- image:https://github.com/metanorma/metanorma-csa/workflows/ubuntu/badge.svg["Build Status", link="https://github.com/metanorma/metanorma-csa/actions?query=workflow%3Aubuntu"]
5
- image:https://github.com/metanorma/metanorma-csa/workflows/macos/badge.svg["Build Status", link="https://github.com/metanorma/metanorma-csa/actions?query=workflow%3Amacos"]
6
- image:https://github.com/metanorma/metanorma-csa/workflows/windows/badge.svg["Build Status", link="https://github.com/metanorma/metanorma-csa/actions?query=workflow%3Awindows"]
4
+ image:https://github.com/metanorma/metanorma-csa/workflows/rake/badge.svg["Build Status", link="https://github.com/metanorma/metanorma-csa/actions?query=workflow=rake"]
7
5
  image:https://codeclimate.com/github/metanorma/metanorma-csand/badges/gpa.svg["Code Climate", link="https://codeclimate.com/github/metanorma/metanorma-csand"]
8
6
  image:https://img.shields.io/github/issues-pr-raw/metanorma/metanorma-csa.svg["Pull Requests", link="https://github.com/metanorma/metanorma-csa/pulls"]
9
7
  image:https://img.shields.io/github/commits-since/metanorma/metanorma-csa/latest.svg["Commits since latest",link="https://github.com/metanorma/metanorma-csa/releases"]
10
8
 
11
- _Formerly known as_ `asciidoctor-csand`.
12
-
13
9
  == Functionality
14
10
 
15
- This gem processes http://asciidoctor.org/[Asciidoctor] documents following
16
- a template for generating CSAND documents.
11
+ This gem processes https://www.metanorma.com/[Metanorma documents] following
12
+ a template for generating CSA documents.
17
13
 
18
14
  The gem currently inherits from the https://github.com/metanorma/metanorma-standoc
19
15
  gem, and aligns closely to it. Refer to the ISO gem documentation
@@ -21,24 +17,15 @@ for guidance, including https://github.com/metanorma/metanorma-iso/wiki/Guidance
21
17
 
22
18
  The following outputs are generated.
23
19
 
24
- * (Optional) An HTML preview generated directly from the Asciidoctor document,
25
- using native Asciidoctor formatting.
26
- ** http://asciimath.org[AsciiMathML] is to be used for mathematical formatting.
27
- The gem uses the https://github.com/asciidoctor/asciimath[Ruby AsciiMath parser],
28
- which is syntactically stricter than the common MathJax processor;
29
- if you do not get expected results, try bracketing terms your in AsciiMathML
30
- expressions.
31
- * an XML representation of the document, intended as a document model for CSAND
32
- International Standards.
33
- * The XML representation is processed in turn to generate the following outputs
34
- as end deliverable CSAND standard drafts.
35
- ** HTML output.
36
-
37
- This AsciiDoc syntax for writing CSAND standards is hereby named "AsciiCSAND".
20
+ * Metanorma XML
21
+ * HTML output (from Metanorma XML)
22
+ * PDF output (from Metanorma XML)
23
+
24
+ // This AsciiDoc syntax for writing CSAND standards is hereby named "AsciiCSAND".
38
25
 
39
26
  == Usage
40
27
 
41
- The preferred way to invoke this gem is via the `metanorma` script:
28
+ The preferred way to invoke this gem is via the `metanorma` command:
42
29
 
43
30
  [source,console]
44
31
  ----
@@ -56,13 +43,6 @@ document.
56
43
  The gem then converts the XML to HTML, and
57
44
  outputs that files with the appropriate `.html` suffix.
58
45
 
59
- The gem can also be invoked directly within asciidoctor, though this is deprecated:
60
-
61
- [source,console]
62
- ----
63
- $ asciidoctor -b csa -r 'metanorma-csa' a.adoc
64
- ----
65
-
66
46
  === Installation
67
47
 
68
48
  If you are using a Mac, the https://github.com/metanorma/metanorma-macos-setup
@@ -83,3 +63,7 @@ See https://www.metanorma.com/author/csa/[Author Cloud Security Alliance documen
83
63
  == Examples
84
64
 
85
65
  See https://github.com/metanorma/mn-samples-csa for sample documents.
66
+
67
+ == Notes
68
+
69
+ Metanorma-CSA was formerly published as `asciidoctor-csand`.
@@ -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"/>
@@ -928,13 +928,22 @@
928
928
  <title-part lang="en">
929
929
 
930
930
 
931
+
931
932
  </title-part>
932
933
  <title-part lang="fr">
933
934
 
934
935
 
936
+
935
937
  </title-part>
936
938
  <title-part lang="zh">第 # 部分:</title-part>
937
939
 
940
+ <title-subpart lang="en">
941
+
942
+ </title-subpart>
943
+ <title-subpart lang="fr">
944
+
945
+ </title-subpart>
946
+
938
947
  <title-modified lang="en">modified</title-modified>
939
948
  <title-modified lang="fr">modifiée</title-modified>
940
949
 
@@ -1403,7 +1412,9 @@
1403
1412
 
1404
1413
 
1405
1414
 
1406
-
1415
+ <!-- <xsl:if test="$namespace = 'bipm'">
1416
+ <fo:block>&#xA0;</fo:block>
1417
+ </xsl:if> -->
1407
1418
 
1408
1419
  <!-- $namespace = 'iso' or -->
1409
1420
 
@@ -1564,6 +1575,7 @@
1564
1575
  <xsl:if test="normalize-space() != ''">
1565
1576
  <fo:block xsl:use-attribute-sets="table-name-style">
1566
1577
 
1578
+
1567
1579
  <xsl:apply-templates/>
1568
1580
  </fo:block>
1569
1581
  </xsl:if>
@@ -1917,6 +1929,7 @@
1917
1929
 
1918
1930
 
1919
1931
 
1932
+
1920
1933
  <!-- <xsl:if test="$namespace = 'bipm'">
1921
1934
  <xsl:attribute name="height">8mm</xsl:attribute>
1922
1935
  </xsl:if> -->
@@ -2002,7 +2015,8 @@
2002
2015
  </xsl:attribute>
2003
2016
  </xsl:if>
2004
2017
  <xsl:call-template name="display-align"/>
2005
- <fo:block>
2018
+ <fo:block>
2019
+
2006
2020
  <xsl:apply-templates/>
2007
2021
  </fo:block>
2008
2022
  </fo:table-cell>
@@ -2212,7 +2226,11 @@
2212
2226
  <xsl:apply-templates/>
2213
2227
  </fo:inline>
2214
2228
  </xsl:template><xsl:template match="*[local-name()='dl']">
2215
- <fo:block-container margin-left="0mm">
2229
+ <fo:block-container>
2230
+
2231
+ <xsl:attribute name="margin-left">0mm</xsl:attribute>
2232
+
2233
+
2216
2234
  <xsl:if test="parent::*[local-name() = 'note']">
2217
2235
  <xsl:attribute name="margin-left">
2218
2236
  <xsl:choose>
@@ -2222,8 +2240,11 @@
2222
2240
  </xsl:attribute>
2223
2241
 
2224
2242
  </xsl:if>
2225
- <fo:block-container margin-left="0mm">
2226
-
2243
+ <fo:block-container>
2244
+
2245
+ <xsl:attribute name="margin-left">0mm</xsl:attribute>
2246
+
2247
+
2227
2248
  <xsl:variable name="parent" select="local-name(..)"/>
2228
2249
 
2229
2250
  <xsl:variable name="key_iso">
@@ -2237,9 +2258,12 @@
2237
2258
  <fo:block margin-bottom="12pt" text-align="left">
2238
2259
 
2239
2260
  <xsl:variable name="title-where">
2240
- <xsl:call-template name="getTitle">
2241
- <xsl:with-param name="name" select="'title-where'"/>
2242
- </xsl:call-template>
2261
+
2262
+
2263
+ <xsl:call-template name="getTitle">
2264
+ <xsl:with-param name="name" select="'title-where'"/>
2265
+ </xsl:call-template>
2266
+
2243
2267
  </xsl:variable>
2244
2268
  <xsl:value-of select="$title-where"/><xsl:text> </xsl:text>
2245
2269
  <xsl:apply-templates select="*[local-name()='dt']/*"/>
@@ -2255,9 +2279,12 @@
2255
2279
 
2256
2280
 
2257
2281
  <xsl:variable name="title-where">
2258
- <xsl:call-template name="getTitle">
2259
- <xsl:with-param name="name" select="'title-where'"/>
2260
- </xsl:call-template>
2282
+
2283
+
2284
+ <xsl:call-template name="getTitle">
2285
+ <xsl:with-param name="name" select="'title-where'"/>
2286
+ </xsl:call-template>
2287
+
2261
2288
  </xsl:variable>
2262
2289
  <xsl:value-of select="$title-where"/>
2263
2290
  </fo:block>
@@ -2268,9 +2295,12 @@
2268
2295
 
2269
2296
 
2270
2297
  <xsl:variable name="title-key">
2271
- <xsl:call-template name="getTitle">
2272
- <xsl:with-param name="name" select="'title-key'"/>
2273
- </xsl:call-template>
2298
+
2299
+
2300
+ <xsl:call-template name="getTitle">
2301
+ <xsl:with-param name="name" select="'title-key'"/>
2302
+ </xsl:call-template>
2303
+
2274
2304
  </xsl:variable>
2275
2305
  <xsl:value-of select="$title-key"/>
2276
2306
  </fo:block>
@@ -2841,7 +2871,18 @@
2841
2871
  <xsl:with-param name="previousRow" select="$newRow"/>
2842
2872
  </xsl:apply-templates>
2843
2873
  </xsl:template><xsl:template name="getLang">
2844
- <xsl:variable name="language" select="//*[local-name()='bibdata']//*[local-name()='language']"/>
2874
+ <xsl:variable name="language_current" select="normalize-space(//*[local-name()='bibdata']//*[local-name()='language'][@current = 'true'])"/>
2875
+ <xsl:variable name="language">
2876
+ <xsl:choose>
2877
+ <xsl:when test="$language_current != ''">
2878
+ <xsl:value-of select="$language_current"/>
2879
+ </xsl:when>
2880
+ <xsl:otherwise>
2881
+ <xsl:value-of select="//*[local-name()='bibdata']//*[local-name()='language']"/>
2882
+ </xsl:otherwise>
2883
+ </xsl:choose>
2884
+ </xsl:variable>
2885
+
2845
2886
  <xsl:choose>
2846
2887
  <xsl:when test="$language = 'English'">en</xsl:when>
2847
2888
  <xsl:otherwise><xsl:value-of select="$language"/></xsl:otherwise>
@@ -2876,6 +2917,7 @@
2876
2917
  <xsl:value-of select="substring($str, 2)"/>
2877
2918
  </xsl:template><xsl:template match="mathml:math">
2878
2919
  <fo:inline font-family="STIX Two Math"> <!-- -->
2920
+
2879
2921
  <xsl:variable name="mathml">
2880
2922
  <xsl:apply-templates select="." mode="mathml"/>
2881
2923
  </xsl:variable>
@@ -2958,10 +3000,14 @@
2958
3000
  </fo:inline>
2959
3001
  </xsl:template><xsl:template match="*[local-name() = 'modification']">
2960
3002
  <xsl:variable name="title-modified">
2961
- <xsl:call-template name="getTitle">
2962
- <xsl:with-param name="name" select="'title-modified'"/>
2963
- </xsl:call-template>
3003
+
3004
+
3005
+ <xsl:call-template name="getTitle">
3006
+ <xsl:with-param name="name" select="'title-modified'"/>
3007
+ </xsl:call-template>
3008
+
2964
3009
  </xsl:variable>
3010
+
2965
3011
  <xsl:choose>
2966
3012
  <xsl:when test="$lang = 'zh'"><xsl:text>、</xsl:text><xsl:value-of select="$title-modified"/><xsl:text>—</xsl:text></xsl:when>
2967
3013
  <xsl:otherwise><xsl:text>, </xsl:text><xsl:value-of select="$title-modified"/><xsl:text> — </xsl:text></xsl:otherwise>
@@ -3690,9 +3736,14 @@
3690
3736
 
3691
3737
  <fo:inline>
3692
3738
 
3693
- <xsl:call-template name="getTitle">
3694
- <xsl:with-param name="name" select="'title-source'"/>
3695
- </xsl:call-template>
3739
+
3740
+
3741
+
3742
+ <xsl:call-template name="getTitle">
3743
+ <xsl:with-param name="name" select="'title-source'"/>
3744
+ </xsl:call-template>
3745
+
3746
+
3696
3747
  <xsl:text>: </xsl:text>
3697
3748
  </fo:inline>
3698
3749
 
@@ -3836,9 +3887,12 @@
3836
3887
  </fo:block>
3837
3888
  </xsl:template><xsl:template match="*[local-name() = 'deprecates']">
3838
3889
  <xsl:variable name="title-deprecated">
3839
- <xsl:call-template name="getTitle">
3840
- <xsl:with-param name="name" select="'title-deprecated'"/>
3841
- </xsl:call-template>
3890
+
3891
+
3892
+ <xsl:call-template name="getTitle">
3893
+ <xsl:with-param name="name" select="'title-deprecated'"/>
3894
+ </xsl:call-template>
3895
+
3842
3896
  </xsl:variable>
3843
3897
  <fo:block xsl:use-attribute-sets="deprecates-style">
3844
3898
  <xsl:value-of select="$title-deprecated"/>: <xsl:apply-templates/>
@@ -4204,13 +4258,22 @@
4204
4258
  </xsl:template><xsl:template name="split">
4205
4259
  <xsl:param name="pText" select="."/>
4206
4260
  <xsl:param name="sep" select="','"/>
4261
+ <xsl:param name="normalize-space" select="'true'"/>
4207
4262
  <xsl:if test="string-length($pText) &gt;0">
4208
4263
  <item>
4209
- <xsl:value-of select="normalize-space(substring-before(concat($pText, ','), $sep))"/>
4264
+ <xsl:choose>
4265
+ <xsl:when test="$normalize-space = 'true'">
4266
+ <xsl:value-of select="normalize-space(substring-before(concat($pText, $sep), $sep))"/>
4267
+ </xsl:when>
4268
+ <xsl:otherwise>
4269
+ <xsl:value-of select="substring-before(concat($pText, $sep), $sep)"/>
4270
+ </xsl:otherwise>
4271
+ </xsl:choose>
4210
4272
  </item>
4211
4273
  <xsl:call-template name="split">
4212
4274
  <xsl:with-param name="pText" select="substring-after($pText, $sep)"/>
4213
4275
  <xsl:with-param name="sep" select="$sep"/>
4276
+ <xsl:with-param name="normalize-space" select="$normalize-space"/>
4214
4277
  </xsl:call-template>
4215
4278
  </xsl:if>
4216
4279
  </xsl:template><xsl:template name="getDocumentId">
@@ -4276,4 +4339,23 @@
4276
4339
  <xsl:with-param name="letter-spacing" select="$letter-spacing"/>
4277
4340
  </xsl:call-template>
4278
4341
  </xsl:if>
4342
+ </xsl:template><xsl:template name="repeat">
4343
+ <xsl:param name="char" select="'*'"/>
4344
+ <xsl:param name="count"/>
4345
+ <xsl:if test="$count &gt; 0">
4346
+ <xsl:value-of select="$char"/>
4347
+ <xsl:call-template name="repeat">
4348
+ <xsl:with-param name="char" select="$char"/>
4349
+ <xsl:with-param name="count" select="$count - 1"/>
4350
+ </xsl:call-template>
4351
+ </xsl:if>
4352
+ </xsl:template><xsl:template name="getLocalizedString">
4353
+ <xsl:param name="key"/>
4354
+
4355
+ <xsl:variable name="curr_lang">
4356
+ <xsl:call-template name="getLang"/>
4357
+ </xsl:variable>
4358
+
4359
+ <xsl:value-of select="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
4360
+
4279
4361
  </xsl:template></xsl:stylesheet>
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Metanorma
4
4
  module Csa
5
- VERSION = '1.6.6'
5
+ VERSION = '1.6.7'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metanorma-csa
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.6
4
+ version: 1.6.7
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