metanorma-gb 1.4.1 → 1.4.2

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: 8e077fbc8c1b78bd762f3f835e746c9ef3962b7b006b1d2f52b0ceb1f456a60b
4
- data.tar.gz: e96cd7481cafe9c70008beca81331c3cd5fc39f76ffa90d27befe94311ce8fbf
3
+ metadata.gz: 8174bc7b39fa8089f62c94500ef94424ecbc48ac4ebe78022873307e2b619da5
4
+ data.tar.gz: 88b8c6ba983a7f49648edcf1839536bd947784b549bd29a9ced0a9bf2496d9e6
5
5
  SHA512:
6
- metadata.gz: 95871f762fadc540a35ec9676d97a14f8c1996afa33d09525b22d603224e199fb284e82a762b84a7da10f554548511ee20c1ce3210df0ee96478cb0079fb2e49
7
- data.tar.gz: 5a102ff4ecb8556943d21d66f73f1744a84bce3b27e8e8649c8feef778ad854a1d69ca94735952d823f287323e4d2b9875c41249671d857e4ec81416954257cd
6
+ metadata.gz: e6c702a9ea7b33d36a7d2ed08a12966472c475268037a19ca1f94a272d34a63a58b14090fb92b9f7ee066b6d879cabf01f35eacd91b4d794b62a71f4721b94ab
7
+ data.tar.gz: 6da57b1874fbff0ea896bd645d930a44c161647bc6a392848d5cb9244d7e7e8c6373ea08de696d44bfb1e4c6ffae4f6da9134e0e552a3b05368f3de34f9a07e0
data/Gemfile CHANGED
@@ -3,7 +3,6 @@ Encoding.default_internal = Encoding::UTF_8
3
3
 
4
4
  source "https://rubygems.org"
5
5
  git_source(:github) { |repo| "https://github.com/#{repo}" }
6
-
7
6
  gemspec
8
7
 
9
8
  if File.exist? 'Gemfile.devel'
data/Rakefile CHANGED
@@ -1,6 +1,23 @@
1
1
  require "bundler/gem_tasks"
2
2
  require "rspec/core/rake_task"
3
+ require 'isodoc/gem_tasks'
3
4
 
5
+ module IsoDoc
6
+ module GemTasks
7
+ module_function
8
+
9
+ def fonts_placeholder
10
+ <<~TEXT
11
+ $bodyfont: '{{bodyfont}}';
12
+ $headerfont: '{{headerfont}}';
13
+ $monospacefont: '{{monospacefont}}';
14
+ $titlefont: '{{titlefont}}';
15
+ TEXT
16
+ end
17
+ end
18
+ end
19
+
20
+ IsoDoc::GemTasks.install
4
21
  RSpec::Core::RakeTask.new(:spec)
5
22
 
6
23
  task :default => :spec
@@ -15,7 +15,7 @@ module Asciidoctor
15
15
 
16
16
  def stage_name(stage, substage)
17
17
  return "Proof" if stage == "60" && substage == "00"
18
- @language == "en" ?
18
+ @lang == "en" ?
19
19
  STAGE_NAMES[stage.to_sym] : STAGE_ABBRS_CN[stage.to_sym]
20
20
  end
21
21
 
@@ -7,14 +7,14 @@ require "fileutils"
7
7
  module IsoDoc
8
8
  module Gb
9
9
  module BaseConvert
10
- def extract_fonts(options)
10
+ def scss_fontheader
11
11
  b = options[:bodyfont] || "Arial"
12
12
  h = options[:headerfont] || "Arial"
13
13
  m = options[:monospacefont] || "Courier"
14
14
  t = options[:titlefont] || "Arial"
15
15
  "$bodyfont: #{b};\n$headerfont: #{h};\n$monospacefont: #{m};\n"\
16
16
  "$titlefont: #{t};\n"
17
- end
17
+ end
18
18
 
19
19
  def metadata_init(lang, script, labels)
20
20
  unless ["en", "zh"].include? lang
@@ -2526,6 +2526,7 @@
2526
2526
  <xsl:attribute name="font-family">SimHei</xsl:attribute>
2527
2527
 
2528
2528
 
2529
+
2529
2530
  <xsl:variable name="title-note">
2530
2531
  <xsl:call-template name="getTitle">
2531
2532
  <xsl:with-param name="name" select="'title-note'"/>
@@ -3618,4 +3619,35 @@
3618
3619
  </xsl:if>
3619
3620
  </xsl:template><xsl:template name="getDocumentId">
3620
3621
  <xsl:call-template name="getLang"/><xsl:value-of select="//*[local-name() = 'p'][1]/@id"/>
3622
+ </xsl:template><xsl:template name="namespaceCheck">
3623
+ <xsl:variable name="documentNS" select="namespace-uri(/*)"/>
3624
+ <xsl:variable name="XSLNS">
3625
+
3626
+
3627
+
3628
+
3629
+
3630
+
3631
+
3632
+
3633
+
3634
+
3635
+
3636
+
3637
+ <xsl:value-of select="document('')//*/namespace::gb"/>
3638
+
3639
+ </xsl:variable>
3640
+ <xsl:if test="$documentNS != $XSLNS">
3641
+ <xsl:message>[WARNING]: Document namespace: '<xsl:value-of select="$documentNS"/>' doesn't equal to xslt namespace '<xsl:value-of select="$XSLNS"/>'</xsl:message>
3642
+ </xsl:if>
3643
+ </xsl:template><xsl:template name="getLanguage">
3644
+ <xsl:param name="lang"/>
3645
+ <xsl:variable name="language" select="java:toLowerCase(java:java.lang.String.new($lang))"/>
3646
+ <xsl:choose>
3647
+ <xsl:when test="$language = 'en'">English</xsl:when>
3648
+ <xsl:when test="$language = 'fr'">French</xsl:when>
3649
+ <xsl:when test="$language = 'de'">Deutsch</xsl:when>
3650
+ <xsl:when test="$language = 'cn'">Chinese</xsl:when>
3651
+ <xsl:otherwise><xsl:value-of select="$language"/></xsl:otherwise>
3652
+ </xsl:choose>
3621
3653
  </xsl:template></xsl:stylesheet>
@@ -1002,4 +1002,3 @@ span.keyword {
1002
1002
  .Admonition p, .admonition p {
1003
1003
  margin: 0;
1004
1004
  }
1005
-
@@ -27,6 +27,16 @@ module IsoDoc
27
27
  }
28
28
  end
29
29
 
30
+ def fonts_options
31
+ default_font_options = default_fonts(options)
32
+ {
33
+ bodyfont: options[:bodyfont] || default_font_options[:bodyfont],
34
+ headerfont: options[:headerfont] || default_font_options[:headerfont],
35
+ monospacefont: options[:monospacefont] || default_font_options[:monospacefont],
36
+ titlefont: options[:titlefont] || default_font_options[:titlefont]
37
+ }
38
+ end
39
+
30
40
  def default_file_locations(options)
31
41
  {
32
42
  htmlstylesheet: options[:compliant] ? html_doc_path("htmlcompliantstyle.scss") : html_doc_path("htmlstyle.scss"),
@@ -37,7 +47,7 @@ module IsoDoc
37
47
  end
38
48
 
39
49
  def populate_template(docxml, format)
40
- meta = @meta.get.merge(@labels)
50
+ meta = @meta.get.merge(@labels).merge(@meta.fonts_options || {})
41
51
  logo = @common.format_logo(meta[:gbprefix], meta[:gbscope], format, @localdir)
42
52
  logofile = @meta.standard_logo(meta[:gbprefix])
43
53
  meta[:standard_agency_formatted] =
@@ -24,11 +24,21 @@ module IsoDoc
24
24
  monospacefont: '"Courier New",monospace',
25
25
  titlefont: (scope == "national" ? (script != "Hans" ? '"Cambria",serif' : '"SimSun",serif' ) :
26
26
  (script == "Hans" ? '"SimHei",sans-serif' : '"Calibri",sans-serif' ))
27
- }
28
- end
27
+ }
28
+ end
29
+
30
+ def fonts_options
31
+ default_font_options = default_fonts(options)
32
+ {
33
+ bodyfont: options[:bodyfont] || default_font_options[:bodyfont],
34
+ headerfont: options[:headerfont] || default_font_options[:headerfont],
35
+ monospacefont: options[:monospacefont] || default_font_options[:monospacefont],
36
+ titlefont: options[:titlefont] || default_font_options[:titlefont]
37
+ }
38
+ end
29
39
 
30
40
  def default_file_locations(options)
31
- {
41
+ {
32
42
  wordstylesheet: html_doc_path("wordstyle.scss"),
33
43
  standardstylesheet: html_doc_path("gb.scss"),
34
44
  header: html_doc_path("header.html"),
@@ -37,10 +47,10 @@ module IsoDoc
37
47
  ulstyle: "l7",
38
48
  olstyle: "l10",
39
49
  }
40
- end
50
+ end
41
51
 
42
52
  ENDLINE = <<~END.freeze
43
- <v:line
53
+ <v:line
44
54
  alt="" style='position:absolute;left:0;text-align:left;z-index:251662848;
45
55
  mso-wrap-edited:f;mso-width-percent:0;mso-height-percent:0;
46
56
  mso-width-percent:0;mso-height-percent:0'
@@ -71,7 +81,7 @@ module IsoDoc
71
81
  end
72
82
 
73
83
  def populate_template(docxml, format)
74
- meta = @meta.get.merge(@labels)
84
+ meta = @meta.get.merge(@labels).merge(@meta.fonts_options || {})
75
85
  logo = @common.format_logo(meta[:gbprefix], meta[:gbscope], format, @localdir)
76
86
  logofile = @meta.standard_logo(meta[:gbprefix])
77
87
  meta[:standard_agency_formatted] =
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module Gb
3
- VERSION = "1.4.1"
3
+ VERSION = "1.4.2"
4
4
  end
5
5
  end
@@ -36,6 +36,7 @@ Gem::Specification.new do |spec|
36
36
  spec.add_dependency "htmlentities", "~> 4.3.4"
37
37
 
38
38
  spec.add_development_dependency "byebug", "~> 9.1"
39
+ spec.add_development_dependency "sassc", "2.4.0"
39
40
  spec.add_development_dependency "equivalent-xml", "~> 0.6"
40
41
  spec.add_development_dependency "guard", "~> 2.14"
41
42
  spec.add_development_dependency "guard-rspec", "~> 4.7"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metanorma-gb
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.1
4
+ version: 1.4.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-07-10 00:00:00.000000000 Z
11
+ date: 2020-07-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: metanorma-iso
@@ -94,6 +94,20 @@ dependencies:
94
94
  - - "~>"
95
95
  - !ruby/object:Gem::Version
96
96
  version: '9.1'
97
+ - !ruby/object:Gem::Dependency
98
+ name: sassc
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - '='
102
+ - !ruby/object:Gem::Version
103
+ version: 2.4.0
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - '='
109
+ - !ruby/object:Gem::Version
110
+ version: 2.4.0
97
111
  - !ruby/object:Gem::Dependency
98
112
  name: equivalent-xml
99
113
  requirement: !ruby/object:Gem::Requirement