metanorma-generic 1.7.3 → 1.8.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: c325e9aa02cddaf26372e0199b21c55338e5abff1b8a1e8a25007567fb03b799
4
- data.tar.gz: b6fc284631a359dc78e4f83744d1fbda26211b1692d74417b5a45af254b0266b
3
+ metadata.gz: 4ecff55e1f5665be747c3502c80865395444c81341f884f886fdd2962e769824
4
+ data.tar.gz: b6ca5204417ec9fd4a55010a85dfdc9379747aab1519254762410c72bca330e7
5
5
  SHA512:
6
- metadata.gz: a0496b1c8cb2ef30e8265d08eaf4c0206f110a6687f6e2acc7d9e172e2e1975e266f9740ac628fa492d5b151ecad4a171653f9cc8704625e76359676231b6364
7
- data.tar.gz: 3a4fd80dfd4fd4540950837182bf860676d4ea15f6a09cc207f64ab2025c2a54b0fa9aa84ba324585f6dcee41632ff38117b00a1dc8594c6d215e8b6779cc0e8
6
+ metadata.gz: 36b0019a33b5900b6d3ecd5392fc8f99e061f3d0f0e1b58e504095d002db8b44efb6ec11fb518468a6398a4f89d0da88f824bf799ccc7fbe3edec1b27ac6bc74
7
+ data.tar.gz: 425d8153f56479453f61c760799fdf2625a0ee9bb78e34fd8dfff3ca4d54eb793810bee43bb9faf1d41a8930a9aa220a2fbc652f312a5973dbe42cab4161021a
@@ -36,7 +36,7 @@ jobs:
36
36
  with:
37
37
  ruby-version: ${{ matrix.ruby }}
38
38
 
39
- - uses: actions/cache@v1
39
+ - uses: actions/cache@v2
40
40
  with:
41
41
  path: vendor/bundle
42
42
  key: bundle-${{ matrix.os }}-${{ matrix.ruby }}-${{ hashFiles('**/*.gemspec') }}
@@ -48,15 +48,14 @@ jobs:
48
48
 
49
49
  - run: bundle exec rake
50
50
 
51
- notify:
52
- name: Trigger notify workflow
51
+ tests-passed:
53
52
  needs: rake
54
53
  runs-on: ubuntu-latest
55
54
  steps:
56
- - name: Trigger notify workflow
55
+ - name: Trigger tests passed event
57
56
  uses: Sibz/github-status-action@v1
58
57
  with:
59
- authToken: ${{ secrets.GITHUB_TOKEN }}
58
+ authToken: ${{ secrets.METANORMA_CI_PAT_TOKEN || secrets.GITHUB_TOKEN }}
60
59
  context: 'tests-passed-successfully'
61
60
  description: 'Tests passed successfully'
62
61
  state: 'success'
@@ -21,6 +21,7 @@ module Asciidoctor
21
21
 
22
22
  def baselocation(loc)
23
23
  return nil if loc.nil?
24
+ return loc
24
25
  File.expand_path(File.join(File.dirname(
25
26
  self.class::_file || __FILE__), "..", "..", "..", loc))
26
27
  end
@@ -32,7 +32,11 @@ module IsoDoc
32
32
  options[:script] == "Hans" ? '"SimHei",sans-serif' :
33
33
  configuration.html_headerfont || '"Overpass",sans-serif'
34
34
  ),
35
- monospacefont: configuration.html_monospacefont || '"Space Mono",monospace'
35
+ monospacefont: configuration.html_monospacefont || '"Space Mono",monospace',
36
+ normalfontsize: configuration.html_normalfontsize,
37
+ smallerfontsize: configuration.html_smallerfontsize,
38
+ footnotefontsize: configuration.html_footnotefontsize,
39
+ monospacefontsize: configuration.html_monospacefontsize,
36
40
  }.transform_values { |v| v&.empty? ? nil : v }
37
41
  end
38
42
 
@@ -51,12 +55,6 @@ module IsoDoc
51
55
  }.transform_values { |v| v&.empty? ? nil : v }
52
56
  end
53
57
 
54
- =begin
55
- def configuration
56
- Metanorma::Generic.configuration
57
- end
58
- =end
59
-
60
58
  def googlefonts
61
59
  return unless configuration.webfont
62
60
  Array(configuration.webfont).map do |x|
@@ -12,6 +12,7 @@ module IsoDoc
12
12
  def baselocation(loc)
13
13
  return nil if loc.nil?
14
14
  return "" if loc.empty?
15
+ return loc
15
16
  f = defined?(self.class::_file) ? (self.class::_file || __FILE__) :
16
17
  __FILE__
17
18
  File.expand_path(File.join(
@@ -31,7 +31,11 @@ module IsoDoc
31
31
  options[:script] == "Hans" ? '"SimHei",sans-serif' :
32
32
  configuration.word_headerfont || '"Arial",sans-serif'
33
33
  ),
34
- monospacefont: configuration.word_monospacefont || '"Courier New",monospace'
34
+ monospacefont: configuration.word_monospacefont || '"Courier New",monospace',
35
+ normalfontsize: configuration.word_normalfontsize,
36
+ smallerfontsize: configuration.word_smallerfontsize,
37
+ footnotefontsize: configuration.word_footnotefontsize,
38
+ monospacefontsize: configuration.word_monospacefontsize,
35
39
  }.transform_values { |v| v&.empty? ? nil : v }
36
40
  end
37
41
 
@@ -31,6 +31,10 @@ module Metanorma
31
31
  html_bodyfont
32
32
  html_headerfont
33
33
  html_monospacefont
34
+ html_normalfontsize
35
+ html_monospacefontsize
36
+ html_smallerfontsize
37
+ html_footnotefontsize
34
38
  metadata_extensions
35
39
  metanorma_name
36
40
  normref_titles
@@ -51,9 +55,33 @@ module Metanorma
51
55
  word_bodyfont
52
56
  word_headerfont
53
57
  word_monospacefont
58
+ word_normalfontsize
59
+ word_monospacefontsize
60
+ word_smallerfontsize
61
+ word_footnotefontsize
54
62
  xml_root_tag
55
63
  ].freeze
56
64
 
65
+ def filepath_attrs
66
+ return %i[
67
+ i18nyaml
68
+ boilerplate
69
+ logo_path
70
+ logo_paths
71
+ header
72
+ htmlcoverpage
73
+ htmlintropage
74
+ htmlstylesheet
75
+ scripts
76
+ scripts_pdf
77
+ standardstylesheet
78
+ validate_rng_file
79
+ wordcoverpage
80
+ wordintropage
81
+ wordstylesheet
82
+ ]
83
+ end
84
+
57
85
  attr_accessor(*CONFIG_ATTRS)
58
86
 
59
87
  class << self
@@ -84,17 +112,47 @@ module Metanorma
84
112
  end
85
113
 
86
114
  def set_default_values_from_yaml_file(config_file)
115
+ root_path = File.dirname(self.class::_file || __FILE__)
87
116
  default_config_options = YAML.load(File.read(config_file))
88
117
  if default_config_options["doctypes"]&.is_a? Array
89
118
  default_config_options["doctypes"] = default_config_options["doctypes"].
90
119
  each_with_object({}) { |k, m| m[k] = nil }
91
120
  end
92
121
  CONFIG_ATTRS.each do |attr_name|
93
- instance_variable_set("@#{attr_name}", default_config_options[attr_name.to_s])
122
+ value = default_config_options[attr_name.to_s]
123
+ if value && filepath_attrs.include?(attr_name)
124
+ value = absolute_path(value, root_path)
125
+ end
126
+
127
+ instance_variable_set("@#{attr_name}", value)
128
+ end
129
+ end
130
+
131
+ def blank?(v)
132
+ v.nil? || v.respond_to?(:empty?) && v.empty?
133
+ end
134
+
135
+ def absolute_path(value, root_path)
136
+ if value.is_a? Hash then absolute_path1(value, root_path)
137
+ elsif value.is_a? Array
138
+ value.reject { |a| blank?(a) }.each_with_object([]) do |v1, g|
139
+ g << absolute_path(v1, root_path)
140
+ end
141
+ elsif value.is_a?(String) && !value.empty?
142
+ File.join(root_path, "..", "..", value)
143
+ else
144
+ value
145
+ end
146
+ end
147
+
148
+ def absolute_path1(h, pref)
149
+ h.reject { |k, v| blank?(v) }.each_with_object({}) do |(k, v), g|
150
+ g[k] = absolute_path(v, pref)
94
151
  end
95
152
  end
96
153
  end
97
154
 
155
+
98
156
  class << self
99
157
  extend Forwardable
100
158
 
@@ -0,0 +1,5 @@
1
+ ---
2
+ Source Sans Pro:
3
+ Overpass:
4
+ Space Mono:
5
+ Arial:
@@ -2,21 +2,6 @@ require "metanorma/processor"
2
2
 
3
3
  module Metanorma
4
4
  module Generic
5
- def self.fonts_used
6
- {
7
- html: [
8
- configuration.html_bodyfont || "Overpass", configuration.html_headerfont || "Overpass",
9
- configuration.html_monospacefont || "Space Mono"
10
- ].uniq,
11
- doc: [
12
- configuration.word_bodyfont || "Overpass", configuration.word_headerfont || "Overpass",
13
- configuration.word_monospacefont || "Space Mono"].uniq,
14
- pdf: [
15
- configuration.word_bodyfont || "Overpass", configuration.word_headerfont || "Overpass",
16
- configuration.word_monospacefont || "Space Mono"].uniq,
17
- }
18
- end
19
-
20
5
  class Processor < Metanorma::Processor
21
6
  def configuration
22
7
  Metanorma::Generic.configuration
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module Generic
3
- VERSION = "1.7.3"
3
+ VERSION = "1.8.0"
4
4
  end
5
5
  end
@@ -29,7 +29,7 @@ Gem::Specification.new do |spec|
29
29
  spec.add_dependency "htmlentities", "~> 4.3.4"
30
30
  spec.add_dependency "ruby-jing"
31
31
  spec.add_dependency "metanorma-standoc", "~> 1.6.0"
32
- spec.add_dependency "isodoc", "~> 1.2.0"
32
+ spec.add_dependency "isodoc", "~> 1.3.0"
33
33
 
34
34
  spec.add_development_dependency "byebug", "~> 9.1"
35
35
  spec.add_development_dependency "sassc", "2.4.0"
@@ -14,6 +14,10 @@ htmlstylesheet: /metanorma-mine/lib/isodoc/mine/html/htmlstyle.scss
14
14
  html_bodyfont: '"Source Sans Pro",sans-serif'
15
15
  html_headerfont: '"Source Sans Pro",sans-serif'
16
16
  html_monospacefont: '"Source Code Pro",monospace'
17
+ html_normalfontsize: "1.0em"
18
+ html_monospacefontsize: "0.8em"
19
+ html_smallerfontsize: "0.9em"
20
+ html_footnotefontsize: "0.8em"
17
21
  scripts: /metanorma-mine/lib/isodoc/mine/html/scripts.html
18
22
  scripts_pdf: /metanorma-mine/lib/isodoc/mine/html/scripts.prd.html
19
23
  standardstylesheet: /metanorma-mine/lib/isodoc/mine/html/
@@ -24,6 +28,10 @@ wordstylesheet: /metanorma-mine/lib/isodoc/mine/html/wordstyle.scss
24
28
  word_bodyfont: '"Source Sans Pro","Arial",sans-serif'
25
29
  word_headerfont: '"Source Sans Pro","Arial",sans-serif'
26
30
  word_monospacefont: '"Source Code Pro",monospace'
31
+ word_normalfontsize: "12.0pt"
32
+ word_monospacefontsize: "11.0pt"
33
+ word_smallerfontsize: "10.0pt"
34
+ word_footnotefontsize: "9.0pt"
27
35
  docid_template: "{{ organization_name_short }} {{ docnumeric }}"
28
36
  metadata_extensions:
29
37
  - security
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metanorma-generic
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.7.3
4
+ version: 1.8.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-11-09 00:00:00.000000000 Z
11
+ date: 2020-11-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: htmlentities
@@ -58,14 +58,14 @@ dependencies:
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: 1.2.0
61
+ version: 1.3.0
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: 1.2.0
68
+ version: 1.3.0
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: byebug
71
71
  requirement: !ruby/object:Gem::Requirement
@@ -262,6 +262,7 @@ files:
262
262
  - lib/isodoc/generic/xref.rb
263
263
  - lib/metanorma-generic.rb
264
264
  - lib/metanorma/generic.rb
265
+ - lib/metanorma/generic/fonts_manifest.yaml
265
266
  - lib/metanorma/generic/processor.rb
266
267
  - lib/metanorma/generic/version.rb
267
268
  - metanorma-generic.gemspec