metanorma-cc 1.5.4 → 1.6.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,4 +1,5 @@
1
1
  require_relative "base_convert"
2
+ require "metanorma-generic"
2
3
  require "isodoc"
3
4
 
4
5
  module IsoDoc
@@ -1,9 +1,10 @@
1
1
  require_relative "init"
2
+ require "metanorma-generic"
2
3
  require "isodoc"
3
4
 
4
5
  module IsoDoc
5
6
  module CC
6
- class PresentationXMLConvert < IsoDoc::PresentationXMLConvert
7
+ class PresentationXMLConvert < IsoDoc::Generic::PresentationXMLConvert
7
8
  def annex1(f)
8
9
  lbl = @xrefs.anchor(f['id'], :label)
9
10
  if t = f.at(ns("./title"))
@@ -1,4 +1,5 @@
1
1
  require_relative "base_convert"
2
+ require "isodoc/generic/word_convert"
2
3
  require_relative "init"
3
4
  require "isodoc"
4
5
 
@@ -6,31 +7,7 @@ module IsoDoc
6
7
  module CC
7
8
  # A {Converter} implementation that generates CSD output, and a document
8
9
  # schema encapsulation of the document for validation
9
- class WordConvert < IsoDoc::WordConvert
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' : '"Source Sans Pro","Arial",sans-serif'),
18
- headerfont: (options[:script] == "Hans" ? '"SimHei",sans-serif' : '"Source Sans Pro","Arial",sans-serif'),
19
- monospacefont: '"Source Code Pro","Courier New",monospace'
20
- }
21
- end
22
-
23
- def default_file_locations(options)
24
- {
25
- wordstylesheet: html_doc_path("wordstyle.scss"),
26
- standardstylesheet: html_doc_path("cc.scss"),
27
- header: html_doc_path("header.html"),
28
- wordcoverpage: html_doc_path("word_cc_titlepage.html"),
29
- wordintropage: html_doc_path("word_cc_intro.html"),
30
- ulstyle: "l3",
31
- olstyle: "l2",
32
- }
33
- end
10
+ class WordConvert < IsoDoc::Generic::WordConvert
34
11
 
35
12
  include BaseConvert
36
13
  include Init
@@ -1,6 +1,6 @@
1
1
  module IsoDoc
2
2
  module CC
3
- class Xref < IsoDoc::Xref
3
+ class Xref < IsoDoc::Generic::Xref
4
4
  end
5
5
  end
6
6
  end
@@ -1,29 +1,32 @@
1
+ require "metanorma"
2
+ require "metanorma-generic"
1
3
  require_relative "./cc/processor"
2
4
 
3
5
  module Metanorma
4
6
  module CC
7
+ class Configuration < Metanorma::Generic::Configuration
8
+ def initialize(*args)
9
+ super
10
+ end
11
+ end
5
12
 
6
- DOCSUFFIX = {
7
- "standard" => "",
8
- "directive" => "DIR",
9
- "guide" => "Guide",
10
- "specification" => "S",
11
- "report" => "R",
12
- "amendment" => "Amd",
13
- "technical-corrigendum" => "Cor",
14
- "administrative" => "A",
15
- "advisory" => "Adv",
16
- }
13
+ class << self
14
+ extend Forwardable
17
15
 
18
- DOCSTATUS = {
19
- "working-draft" => "WD",
20
- "committee-draft" => "CD",
21
- "draft-standard" => "DS",
22
- "final-draft" => "FDS",
23
- "published" => "",
24
- "cancelled" => "",
25
- "withdrawn" => "",
26
- }
16
+ attr_accessor :configuration
27
17
 
18
+ Configuration::CONFIG_ATTRS.each do |attr_name|
19
+ def_delegator :@configuration, attr_name
20
+ end
21
+
22
+ def configure
23
+ self.configuration ||= Configuration.new
24
+ yield(configuration)
25
+ end
26
+ end
27
+
28
+ configure {}
28
29
  end
29
30
  end
31
+ Metanorma::Registry.instance.register(Metanorma::CC::Processor)
32
+
@@ -0,0 +1,5 @@
1
+ ---
2
+ Source Sans Pro:
3
+ Source Serif Pro:
4
+ Source Code Pro:
5
+ Source Han Sans:
@@ -2,15 +2,7 @@ require "metanorma/processor"
2
2
 
3
3
  module Metanorma
4
4
  module CC
5
- def self.fonts_used
6
- {
7
- html: %w(SourceSansPro SourceSerifPro SourceCodePro HanSans),
8
- doc: %w(SourceSansPro SourceSerifPro SourceCodePro HanSans),
9
- pdf: %w(SourceSansPro SourceSerifPro SourceCodePro HanSans)
10
- }
11
- end
12
-
13
- class Processor < Metanorma::Processor
5
+ class Processor < Metanorma::Generic::Processor
14
6
 
15
7
  def initialize
16
8
  @short = [:csd, :cc]
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module CC
3
- VERSION = "1.5.4"
3
+ VERSION = "1.6.2"
4
4
  end
5
5
  end
@@ -28,8 +28,7 @@ Gem::Specification.new do |spec|
28
28
  spec.require_paths = ["lib"]
29
29
  spec.required_ruby_version = Gem::Requirement.new(">= 2.4.0")
30
30
 
31
- spec.add_dependency "metanorma-standoc", "~> 1.6.0"
32
- spec.add_dependency "isodoc", "~> 1.2.0"
31
+ spec.add_dependency "metanorma-generic", "~> 1.8.0"
33
32
 
34
33
  spec.add_development_dependency "byebug", "~> 9.1"
35
34
  spec.add_development_dependency "sassc", "2.4.0"
@@ -0,0 +1,58 @@
1
+ metanorma_name: cc
2
+ organization_name_short: CalConnect
3
+ organization_name_long: CalConnect
4
+ document_namespace: https://www.metanorma.org/ns/csd
5
+ xml_root_tag: csd-standard
6
+ html_bodyfont: '"Source Sans Pro",sans-serif'
7
+ html_headerfont: '"Source Sans Pro",sans-serif'
8
+ html_monospacefont: '"Source Code Pro",monospace'
9
+ validate_rng_file: lib/asciidoctor/cc/cc.rng
10
+ htmlcoverpage: lib/isodoc/cc/html/html_cc_titlepage.html
11
+ htmlintropage: lib/isodoc/cc/html/html_cc_intro.html
12
+ htmlstylesheet: lib/isodoc/cc/html/htmlstyle.scss
13
+ html_normalfontsize: "15px"
14
+ html_footnotefontsize: "0.9em"
15
+ scripts: lib/isodoc/cc/html/scripts.html
16
+ i18nyaml: lib/isodoc/cc/i18n-en.yaml
17
+ word_bodyfont: '"Source Sans Pro","Arial",sans-serif'
18
+ word_headerfont: '"Source Sans Pro","Arial",sans-serif'
19
+ word_monospacefont: '"Source Code Pro","Courier New",monospace'
20
+ word_normalfontsize: "10.5pt"
21
+ word_smallerfontsize: "10.0pt"
22
+ word_monospacefontsize: "10.0pt"
23
+ word_footnotefontsize: "10.0pt"
24
+ standardstylesheet: lib/isodoc/cc/html/cc.scss
25
+ header: lib/isodoc/cc/html/header.html
26
+ wordcoverpage: lib/isodoc/cc/html/word_cc_titlepage.html
27
+ wordintropage: lib/isodoc/cc/html/word_cc_intro.html
28
+ wordstylesheet: lib/isodoc/cc/html/wordstyle.scss
29
+ webfont:
30
+ - "https://fonts.googleapis.com/css?family=Source+Sans+Pro:400,400i,700"
31
+ - "https://fonts.googleapis.com/css2?family=Source+Code+Pro:ital,wght@0,400;0,700;1,400;1,700"
32
+ docid_template: "CC{% if doctype_abbr %}/{{ doctype_abbr }}{%endif%}{% if stageabbr %}/{{ stageabbr }}{%endif%} {{ docnumeric }}{% if docyear %}:{{docyear}}{%endif%}"
33
+ doctypes:
34
+ standard:
35
+ directive: DIR
36
+ guide: Guide
37
+ specification: S
38
+ report: R
39
+ amendment: Amd
40
+ technical-corrigendum: Cor
41
+ administrative: A
42
+ advisory: Adv
43
+ default_doctype: standard
44
+ published_stages:
45
+ - published
46
+ - cancelled
47
+ - withdrawn
48
+ default_stage: published
49
+ stage_abbreviations:
50
+ working-draft: WD
51
+ committee-draft: CD
52
+ draft-standard: DS
53
+ final-draft: FDS
54
+ published:
55
+ cancelled:
56
+ withdrawn:
57
+ logo_path: ""
58
+
metadata CHANGED
@@ -1,43 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metanorma-cc
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.4
4
+ version: 1.6.2
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-09-26 00:00:00.000000000 Z
11
+ date: 2020-12-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: metanorma-standoc
14
+ name: metanorma-generic
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 1.6.0
19
+ version: 1.8.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 1.6.0
27
- - !ruby/object:Gem::Dependency
28
- name: isodoc
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - "~>"
32
- - !ruby/object:Gem::Version
33
- version: 1.2.0
34
- type: :runtime
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - "~>"
39
- - !ruby/object:Gem::Version
40
- version: 1.2.0
26
+ version: 1.8.0
41
27
  - !ruby/object:Gem::Dependency
42
28
  name: byebug
43
29
  requirement: !ruby/object:Gem::Requirement
@@ -190,9 +176,7 @@ executables: []
190
176
  extensions: []
191
177
  extra_rdoc_files: []
192
178
  files:
193
- - ".github/workflows/macos.yml"
194
- - ".github/workflows/ubuntu.yml"
195
- - ".github/workflows/windows.yml"
179
+ - ".github/workflows/rake.yml"
196
180
  - ".gitignore"
197
181
  - ".hound.yml"
198
182
  - ".rubocop.yml"
@@ -212,10 +196,8 @@ files:
212
196
  - lib/asciidoctor/cc/boilerplate.xml
213
197
  - lib/asciidoctor/cc/cc.rng
214
198
  - lib/asciidoctor/cc/converter.rb
215
- - lib/asciidoctor/cc/front.rb
216
199
  - lib/asciidoctor/cc/isodoc.rng
217
200
  - lib/asciidoctor/cc/reqt.rng
218
- - lib/asciidoctor/cc/validate.rb
219
201
  - lib/asciidoctor/cc/validate_section.rb
220
202
  - lib/isodoc/cc/base_convert.rb
221
203
  - lib/isodoc/cc/csd.standard.xsl
@@ -246,9 +228,11 @@ files:
246
228
  - lib/isodoc/cc/xref.rb
247
229
  - lib/metanorma-cc.rb
248
230
  - lib/metanorma/cc.rb
231
+ - lib/metanorma/cc/fonts_manifest.yaml
249
232
  - lib/metanorma/cc/processor.rb
250
233
  - lib/metanorma/cc/version.rb
251
234
  - metanorma-cc.gemspec
235
+ - metanorma.yml
252
236
  homepage: https://github.com/metanorma/metanorma-cc
253
237
  licenses:
254
238
  - BSD-2-Clause
@@ -1,38 +0,0 @@
1
- # Auto-generated by Cimas: Do not edit it manually!
2
- # See https://github.com/metanorma/cimas
3
- name: macos
4
-
5
- on:
6
- push:
7
- branches: [ master ]
8
- pull_request:
9
- paths-ignore:
10
- - .github/workflows/ubuntu.yml
11
- - .github/workflows/windows.yml
12
-
13
- jobs:
14
- test-macos:
15
- name: Test on Ruby ${{ matrix.ruby }} macOS
16
- runs-on: macos-latest
17
- continue-on-error: ${{ matrix.experimental }}
18
- strategy:
19
- fail-fast: false
20
- matrix:
21
- ruby: [ '2.6', '2.5', '2.4' ]
22
- experimental: [false]
23
- include:
24
- - ruby: '2.7'
25
- experimental: true
26
- steps:
27
- - uses: actions/checkout@master
28
- - name: Use Ruby
29
- uses: actions/setup-ruby@v1
30
- with:
31
- ruby-version: ${{ matrix.ruby }}
32
- - name: Update gems
33
- run: |
34
- sudo gem install bundler --force
35
- bundle install --jobs 4 --retry 3
36
- - name: Run specs
37
- run: |
38
- bundle exec rake
@@ -1,56 +0,0 @@
1
- # Auto-generated by Cimas: Do not edit it manually!
2
- # See https://github.com/metanorma/cimas
3
- name: ubuntu
4
-
5
- on:
6
- push:
7
- branches: [ master ]
8
- tags:
9
- - '*'
10
- pull_request:
11
- paths-ignore:
12
- - .github/workflows/macos.yml
13
- - .github/workflows/windows.yml
14
-
15
- jobs:
16
- test-linux:
17
- name: Test on Ruby ${{ matrix.ruby }} Ubuntu
18
- runs-on: ubuntu-latest
19
- continue-on-error: ${{ matrix.experimental }}
20
- strategy:
21
- fail-fast: false
22
- matrix:
23
- ruby: [ '2.6', '2.5', '2.4' ]
24
- experimental: [false]
25
- include:
26
- - ruby: '2.7'
27
- experimental: true
28
- steps:
29
- - uses: actions/checkout@master
30
- - name: Use Ruby
31
- uses: actions/setup-ruby@v1
32
- with:
33
- ruby-version: ${{ matrix.ruby }}
34
- - name: Update gems
35
- run: |
36
- gem install bundler
37
- bundle install --jobs 4 --retry 3
38
- - name: Run specs
39
- run: |
40
- bundle exec rake
41
- - name: Trigger repositories
42
- if: matrix.ruby == '2.6'
43
- env:
44
- GH_USERNAME: metanorma-ci
45
- GH_ACCESS_TOKEN: ${{ secrets.METANORMA_CI_PAT_TOKEN }}
46
- run: |
47
- curl -LO --retry 3 https://raw.githubusercontent.com/metanorma/metanorma-build-scripts/master/trigger-gh-actions.sh
48
- [[ -f ".github/workflows/dependent_repos.env" ]] && source .github/workflows/dependent_repos.env
49
- CLIENT_PAYLOAD=$(cat <<EOF
50
- "{ "ref": "${GITHUB_REF}", "repo": "${GITHUB_REPOSITORY}" }"
51
- EOF
52
- )
53
- for repo in $REPOS
54
- do
55
- sh trigger-gh-actions.sh $ORGANISATION $repo $GH_USERNAME $GH_ACCESS_TOKEN $GITHUB_REPOSITORY "$CLIENT_PAYLOAD"
56
- done
@@ -1,40 +0,0 @@
1
- # Auto-generated by Cimas: Do not edit it manually!
2
- # See https://github.com/metanorma/cimas
3
- name: windows
4
-
5
- on:
6
- push:
7
- branches: [ master ]
8
- pull_request:
9
- paths-ignore:
10
- - .github/workflows/macos.yml
11
- - .github/workflows/ubuntu.yml
12
-
13
- jobs:
14
- test-windows:
15
- name: Test on Ruby ${{ matrix.ruby }} Windows
16
- runs-on: windows-latest
17
- continue-on-error: ${{ matrix.experimental }}
18
- strategy:
19
- fail-fast: false
20
- matrix:
21
- ruby: [ '2.6', '2.5', '2.4' ]
22
- experimental: [false]
23
- include:
24
- - ruby: '2.7'
25
- experimental: true
26
- steps:
27
- - uses: actions/checkout@master
28
- - name: Use Ruby
29
- uses: actions/setup-ruby@v1
30
- with:
31
- ruby-version: ${{ matrix.ruby }}
32
- - name: Update gems
33
- shell: pwsh
34
- run: |
35
- gem install bundler
36
- bundle config --local path vendor/bundle
37
- bundle install --jobs 4 --retry 3
38
- - name: Run specs
39
- run: |
40
- bundle exec rake
@@ -1,67 +0,0 @@
1
- require "asciidoctor"
2
- require "asciidoctor/standoc/converter"
3
- require "fileutils"
4
-
5
- module Asciidoctor
6
- module CC
7
- class Converter < Standoc::Converter
8
- def default_publisher
9
- "CalConnect"
10
- end
11
-
12
- def metadata_committee(node, xml)
13
- return unless node.attr("technical-committee")
14
- xml.editorialgroup do |a|
15
- a.technical_committee node.attr("technical-committee"),
16
- **attr_code(type: node.attr("technical-committee-type"))
17
- i = 2
18
- while node.attr("technical-committee_#{i}") do
19
- a.technical_committee node.attr("technical-committee_#{i}"),
20
- **attr_code(type: node.attr("technical-committee-type_#{i}"))
21
- i += 1
22
- end
23
- end
24
- end
25
-
26
- def metadata_status(node, xml)
27
- status = node.attr("status")
28
- unless status && ::Metanorma::CC::DOCSTATUS.keys.include?(status)
29
- @log.add("Document Attributes", nil, "#{status} is not a legal status")
30
- end
31
- super
32
- end
33
-
34
- def prefix_id(node)
35
- prefix = "CC"
36
- typesuffix = ::Metanorma::CC::DOCSUFFIX[doctype(node)] || ""
37
- prefix += "/#{typesuffix}" unless typesuffix.empty?
38
- status = ::Metanorma::CC::DOCSTATUS[node.attr("status")] || ""
39
- prefix += "/#{status}" unless status.empty?
40
- prefix
41
- end
42
-
43
- def metadata_id(node, xml)
44
- id = node.attr("docnumber") || "???"
45
- prefix = prefix_id(node)
46
- id = "#{prefix} #{id}"
47
- year = node.attr("copyright-year")
48
- id += ":#{year}" if year
49
- xml.docidentifier id, **{type: "CalConnect"}
50
- xml.docnumber node.attr("docnumber")
51
- end
52
-
53
- @log_doctype = false
54
-
55
- def doctype(node)
56
- d = super
57
- unless ::Metanorma::CC::DOCSUFFIX.keys.include?(d) && !@log_doctype
58
- @log.add("Document Attributes", nil,
59
- "#{d} is not a legal document type: reverting to 'standard'")
60
- @log_doctype = true
61
- d = "standard"
62
- end
63
- d
64
- end
65
- end
66
- end
67
- end