metanorma-csa 1.4.8 → 1.4.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,24 +1,8 @@
1
1
  <script>
2
- //TOC generation
3
- $('#toc').toc({
4
- 'selectors': toclevel(), //elements to use as headings
5
- 'container': 'main', //element to find all selectors in
6
- 'smoothScrolling': true, //enable or disable smooth scrolling on click
7
- 'prefix': 'toc', //prefix for anchor tags and class names
8
- 'onHighlight': function(el) {}, //called when a new section is highlighted
9
- 'highlightOnScroll': true, //add class to heading that is currently in focus
10
- 'highlightOffset': 100, //offset to trigger the next headline
11
- 'anchorName': function(i, heading, prefix) { //custom function for anchor name
12
- return prefix+i;
13
- },
14
- 'headerText': function(i, heading, $heading) { //custom function building the header-item text
15
- return $heading.text();
16
- },
17
- 'itemClass': function(i, heading, $heading, prefix) { // custom function for item class
18
- return $heading[0].tagName.toLowerCase();
19
- }
20
- });
21
-
2
+ $("#toc").on('click', 'li', function(e) {
3
+ $(this).parent().find('li.toc-active').removeClass('toc-active');
4
+ $(this).addClass('toc-active');
5
+ });
22
6
  </script>
23
7
 
24
8
  <script>
@@ -1,62 +1,31 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative 'base_convert'
4
3
  require 'isodoc'
5
4
 
6
5
  module IsoDoc
7
6
  module Csa
8
7
  # A {Converter} implementation that generates CSA output, and a document
9
8
  # schema encapsulation of the document for validation
10
- class PdfConvert < IsoDoc::PdfConvert
9
+
10
+ class PdfConvert < IsoDoc::XslfoPdfConvert
11
11
  def initialize(options)
12
12
  @libdir = File.dirname(__FILE__)
13
13
  super
14
14
  end
15
15
 
16
- def default_fonts(options)
17
- is_hans = options[:script] == 'Hans'
18
-
19
- {
20
- bodyfont: is_hans ? '"SimSun",serif' : '"Source Sans Pro",sans-serif',
21
- headerfont: (is_hans ? '"SimHei",sans-serif'
22
- : '"Source Sans Pro",sans-serif'),
23
- monospacefont: '"Space Mono",monospace'
24
- }
25
- end
26
-
27
- def default_file_locations(options)
28
- {
29
- htmlstylesheet: html_doc_path('htmlstyle.scss'),
30
- htmlcoverpage: html_doc_path('html_csa_titlepage.html'),
31
- htmlintropage: html_doc_path('html_csa_intro.html'),
32
- scripts_pdf: html_doc_path('scripts.pdf.html')
33
- }
34
- end
35
-
36
- def googlefonts()
37
- <<~HEAD.freeze
38
- <link href="https://fonts.googleapis.com/css?family=Open+Sans:300,300i,400,400i,600,600i|Space+Mono:400,700" rel="stylesheet">
39
- <link href="https://fonts.googleapis.com/css?family=Rubik:300,300i,500" rel="stylesheet">
40
- <link href="https://fonts.googleapis.com/css?family=Overpass:100,300,300i,600,900" rel="stylesheet">
41
- <link href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,300i,400,700,900" rel="stylesheet">
42
- HEAD
43
- end
44
-
45
- def make_body(xml, docxml)
46
- body_attr = { lang: 'EN-US', link: 'blue', vlink: '#954F72',
47
- 'xml:lang': 'EN-US', class: 'container' }
48
- xml.body **body_attr do |body|
49
- make_body1(body, docxml)
50
- make_body2(body, docxml)
51
- make_body3(body, docxml)
16
+ def convert(filename, file = nil, debug = false)
17
+ file = File.read(filename, encoding: "utf-8") if file.nil?
18
+ docxml, outname_html, dir = convert_init(file, filename, debug)
19
+ /\.xml$/.match(filename) or
20
+ filename = Tempfile.open([outname_html, ".xml"], encoding: "utf-8") do |f|
21
+ f.write file
22
+ f.path
52
23
  end
24
+ FileUtils.rm_rf dir
25
+ ::Metanorma::Output::XslfoPdf.new.convert(
26
+ filename, outname_html + ".pdf",
27
+ File.join(@libdir, "csa.standard.xsl"))
53
28
  end
54
-
55
- def html_toc(docxml)
56
- docxml
57
- end
58
-
59
- include BaseConvert
60
29
  end
61
30
  end
62
31
  end
@@ -5,6 +5,10 @@ require 'asciidoctor/csa/converter'
5
5
 
6
6
  module Metanorma
7
7
  module Csa
8
+ def self.pdf_fonts
9
+ %w(AzoSans AzoSans-Light SourceCodePro-Light)
10
+ end
11
+
8
12
  class Processor < Metanorma::Processor
9
13
 
10
14
  def initialize
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Metanorma
4
4
  module Csa
5
- VERSION = '1.4.8'
5
+ VERSION = '1.4.9'
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.4.8
4
+ version: 1.4.9
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-04-03 00:00:00.000000000 Z
11
+ date: 2020-05-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: htmlentities
@@ -284,6 +284,7 @@ files:
284
284
  - lib/asciidoctor/csa/reqt.rng
285
285
  - lib/asciidoctor/csa/validate.rb
286
286
  - lib/isodoc/csa/base_convert.rb
287
+ - lib/isodoc/csa/csa.standard.xsl
287
288
  - lib/isodoc/csa/html/csa-logo-white.png
288
289
  - lib/isodoc/csa/html/csa.png
289
290
  - lib/isodoc/csa/html/csa.scss