metanorma-csd 1.3.18 → 1.3.20

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,27 +1,11 @@
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
-
24
- <script>
7
+
8
+ <script>
25
9
  //TOC toggle animation
26
10
  $('#toggle').on('click', function(){
27
11
  if( $('nav').is(':visible') ) {
@@ -5,51 +5,27 @@ module IsoDoc
5
5
  module Csd
6
6
  # A {Converter} implementation that generates CSD output, and a document
7
7
  # schema encapsulation of the document for validation
8
- class PdfConvert < IsoDoc::PdfConvert
8
+ class PdfConvert < IsoDoc::XslfoPdfConvert
9
9
  def initialize(options)
10
10
  @libdir = File.dirname(__FILE__)
11
11
  super
12
12
  end
13
13
 
14
- def default_fonts(options)
15
- {
16
- bodyfont: (options[:script] == "Hans" ? '"SimSun",serif' : '"Overpass",sans-serif'),
17
- headerfont: (options[:script] == "Hans" ? '"SimHei",sans-serif' : '"Overpass",sans-serif'),
18
- monospacefont: '"Space Mono",monospace'
19
- }
20
- end
21
-
22
- def default_file_locations(options)
23
- {
24
- htmlstylesheet: html_doc_path("htmlstyle.scss"),
25
- htmlcoverpage: html_doc_path("html_csd_titlepage.html"),
26
- htmlintropage: html_doc_path("html_csd_intro.html"),
27
- scripts_pdf: html_doc_path("scripts.pdf.html"),
28
- }
29
- end
30
-
31
- def googlefonts()
32
- <<~HEAD.freeze
33
- <link href="https://fonts.googleapis.com/css?family=Open+Sans:300,300i,400,400i,600,600i|Space+Mono:400,700" rel="stylesheet">
34
- <link href="https://fonts.googleapis.com/css?family=Overpass:300,300i,600,900" rel="stylesheet">
35
- HEAD
36
- end
37
-
38
- def make_body(xml, docxml)
39
- body_attr = { lang: "EN-US", link: "blue", vlink: "#954F72", "xml:lang": "EN-US", class: "container" }
40
- xml.body **body_attr do |body|
41
- make_body1(body, docxml)
42
- make_body2(body, docxml)
43
- make_body3(body, docxml)
14
+ def convert(filename, file = nil, debug = false)
15
+ file = File.read(filename, encoding: "utf-8") if file.nil?
16
+ docxml, outname_html, dir = convert_init(file, filename, debug)
17
+ /\.xml$/.match(filename) or
18
+ filename = Tempfile.open([outname_html, ".xml"], encoding: "utf-8") do |f|
19
+ f.write file
20
+ f.path
44
21
  end
22
+ FileUtils.rm_rf dir
23
+ ::Metanorma::Output::XslfoPdf.new.convert(
24
+ filename, outname_html + ".pdf",
25
+ File.join(@libdir, "csd.standard.xsl"))
45
26
  end
46
-
47
- def html_toc(docxml)
48
- docxml
49
- end
50
-
51
- include BaseConvert
52
27
  end
53
28
  end
54
29
  end
55
30
 
31
+
@@ -2,6 +2,10 @@ require "metanorma/processor"
2
2
 
3
3
  module Metanorma
4
4
  module Csd
5
+ def self.pdf_fonts
6
+ %w(SourceSansPro SourceSerifPro SourceCodePro HanSans)
7
+ end
8
+
5
9
  class Processor < Metanorma::Processor
6
10
 
7
11
  def initialize
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module Csd
3
- VERSION = "1.3.18"
3
+ VERSION = "1.3.20"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metanorma-csd
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.18
4
+ version: 1.3.20
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-17 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: metanorma-standoc
@@ -204,6 +204,7 @@ files:
204
204
  - lib/asciidoctor/csd/validate.rb
205
205
  - lib/asciidoctor/csd/validate_section.rb
206
206
  - lib/isodoc/csd/base_convert.rb
207
+ - lib/isodoc/csd/csd.standard.xsl
207
208
  - lib/isodoc/csd/html/_coverpage.scss
208
209
  - lib/isodoc/csd/html/csd.scss
209
210
  - lib/isodoc/csd/html/dots-w@2x.png