metanorma-m3d 1.3.20 → 1.3.21

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,31 @@
1
+ require_relative "base_convert"
2
+ require "isodoc"
3
+
4
+ module IsoDoc
5
+ module M3d
6
+
7
+ # A {Converter} implementation that generates HTML output, and a document
8
+ # schema encapsulation of the document for validation
9
+ #
10
+ class PdfConvert < IsoDoc::XslfoPdfConvert
11
+ def initialize(options)
12
+ @libdir = File.dirname(__FILE__)
13
+ super
14
+ end
15
+
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
23
+ end
24
+ FileUtils.rm_rf dir
25
+ ::Metanorma::Output::XslfoPdf.new.convert(
26
+ filename, outname_html + ".pdf", File.join(@libdir, "m3d.report.xsl"))
27
+ end
28
+ end
29
+ end
30
+ end
31
+
@@ -2,6 +2,7 @@ require "asciidoctor" unless defined? Asciidoctor::Converter
2
2
  require_relative "asciidoctor/m3d/converter"
3
3
  require_relative "isodoc/m3d/html_convert"
4
4
  require_relative "isodoc/m3d/word_convert"
5
+ require_relative "isodoc/m3d/pdf_convert"
5
6
  require_relative "metanorma/m3d/version"
6
7
 
7
8
  if defined? Metanorma
@@ -5,6 +5,7 @@ module Metanorma
5
5
  def self.fonts_used
6
6
  {
7
7
  html: ["Overpass", "Space Mono"],
8
+ doc: ["Garamond", "Courier New"],
8
9
  doc: ["Garamond", "Courier New"]
9
10
  }
10
11
  end
@@ -20,7 +21,8 @@ module Metanorma
20
21
  def output_formats
21
22
  super.merge(
22
23
  html: "html",
23
- doc: "doc"
24
+ doc: "doc",
25
+ pdf: "pdf"
24
26
  )
25
27
  end
26
28
 
@@ -38,6 +40,8 @@ module Metanorma
38
40
  IsoDoc::M3d::HtmlConvert.new(options).convert(outname, isodoc_node)
39
41
  when :doc
40
42
  IsoDoc::M3d::WordConvert.new(options).convert(outname, isodoc_node)
43
+ when :pdf
44
+ IsoDoc::M3d::WordConvert.new(options).convert(outname, isodoc_node)
41
45
  else
42
46
  super
43
47
  end
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module M3d
3
- VERSION = "1.3.20"
3
+ VERSION = "1.3.21"
4
4
  end
5
5
  end
@@ -37,7 +37,7 @@ Gem::Specification.new do |spec|
37
37
  spec.add_dependency "thread_safe"
38
38
  spec.add_dependency "uuidtools"
39
39
 
40
- spec.add_dependency "metanorma-standoc", "~> 1.3.0"
40
+ spec.add_dependency "metanorma-standoc", "~> 1.4.0"
41
41
  spec.add_dependency "isodoc", "~> 1.0.0"
42
42
 
43
43
  spec.add_development_dependency "byebug", "~> 9.1"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metanorma-m3d
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.20
4
+ version: 1.3.21
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-05-26 00:00:00.000000000 Z
11
+ date: 2020-06-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: asciimath
@@ -114,14 +114,14 @@ dependencies:
114
114
  requirements:
115
115
  - - "~>"
116
116
  - !ruby/object:Gem::Version
117
- version: 1.3.0
117
+ version: 1.4.0
118
118
  type: :runtime
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
122
  - - "~>"
123
123
  - !ruby/object:Gem::Version
124
- version: 1.3.0
124
+ version: 1.4.0
125
125
  - !ruby/object:Gem::Dependency
126
126
  name: isodoc
127
127
  requirement: !ruby/object:Gem::Requirement
@@ -312,7 +312,9 @@ files:
312
312
  - lib/isodoc/m3d/html/word_m3d_titlepage.html
313
313
  - lib/isodoc/m3d/html/wordstyle.scss
314
314
  - lib/isodoc/m3d/html_convert.rb
315
+ - lib/isodoc/m3d/m3d.report.xsl
315
316
  - lib/isodoc/m3d/metadata.rb
317
+ - lib/isodoc/m3d/pdf_convert.rb
316
318
  - lib/isodoc/m3d/word_convert.rb
317
319
  - lib/metanorma-m3d.rb
318
320
  - lib/metanorma/m3d.rb