asciidoctor-csd 0.3.2 → 0.4.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: 4f757bd08755b310566b64e9cc50010499b1941864540e50e12fa6dea344144f
4
- data.tar.gz: 4eb350a9af73db640aed094df5e4960de0f83ef3cba1ee0f803141385932afa5
3
+ metadata.gz: 30be2cc44cfe0d73460f198daee41578776f694458f7f7c9f12cf0957e95992d
4
+ data.tar.gz: d16113d14770b67229796d002c0b02002cdf9b7076e8e3b1e8d2288f50791584
5
5
  SHA512:
6
- metadata.gz: 23813c54c0cb4bd2c0035e75cb7d2481a02084ad814eb68977d6cb58f5032c984b44c1f8a393747b5632ef2b0d200f9fa17b816c874dcb0133ff79a0ae19e7d3
7
- data.tar.gz: 325a8920f50768a6fc7eac4b265884791497d249dc9a952d1365b4ebace438299b4e88b10affc6babafe0571d5ee2509b1ab051f97ec2a86cbc768e781ea69ae
6
+ metadata.gz: 38cfc2ecb9a55b75b6b6131b0ed5b1530e6d91d47f2005e9c4dd3ebd0185aa4d979e33e7f1526f01c2d054328b0c462e27b943941da9632c0d5054b3324f050d
7
+ data.tar.gz: 1d46a7fc8a15bc2b153a9373c3674b4afccefa5683a63cbf2a9ef96e442112adf42499482cd4ad895a16716b36151fd3a86f22f0a263b79ecef77bcef7c4d7d0
data/.travis.yml ADDED
@@ -0,0 +1,12 @@
1
+ sudo: false
2
+ language: ruby
3
+ rvm:
4
+ - 2.4.3
5
+ node_js:
6
+ - "iojs"
7
+ - "8"
8
+ before_install:
9
+ - gem install bundler -v 1.16.1
10
+ - unset _JAVA_OPTIONS
11
+ - npm install -g puppeteer
12
+ - npm install
data/Gemfile.lock CHANGED
@@ -1,21 +1,22 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- asciidoctor-csd (0.3.1)
5
- asciidoctor-iso (>= 0.8.0)
6
- isodoc (>= 0.7.0)
4
+ asciidoctor-csd (0.4.0)
5
+ asciidoctor-iso (>= 0.9.0)
6
+ isodoc (>= 0.8.0)
7
7
 
8
8
  GEM
9
9
  remote: https://rubygems.org/
10
10
  specs:
11
- algoliasearch (1.22.0)
11
+ algoliasearch (1.23.2)
12
12
  httpclient (~> 2.8, >= 2.8.3)
13
13
  json (>= 1.5.1)
14
14
  asciidoctor (1.5.7.1)
15
- asciidoctor-iso (0.8.1)
15
+ asciidoctor-iso (0.9.0)
16
16
  asciidoctor (~> 1.5.7)
17
- isobib (~> 0.1.4)
18
- isodoc (>= 0.7.0)
17
+ iso-bib-item (~> 0.1.6)
18
+ isobib (~> 0.1.6)
19
+ isodoc (>= 0.8)
19
20
  ruby-jing
20
21
  asciimath (1.0.4)
21
22
  ast (2.4.0)
@@ -23,6 +24,7 @@ GEM
23
24
  coderay (1.1.2)
24
25
  diff-lcs (1.3)
25
26
  docile (1.3.1)
27
+ duplicate (1.1.1)
26
28
  equivalent-xml (0.6.0)
27
29
  nokogiri (>= 1.4.3)
28
30
  ffi (1.9.25)
@@ -53,13 +55,14 @@ GEM
53
55
  htmlentities (4.3.4)
54
56
  httpclient (2.8.3)
55
57
  image_size (2.0.0)
56
- iso-bib-item (0.1.5)
58
+ iso-bib-item (0.1.6)
59
+ duplicate
57
60
  isoics (~> 0.1.6)
58
61
  nokogiri
59
- isobib (0.1.5)
62
+ isobib (0.1.6)
60
63
  algoliasearch
61
64
  iso-bib-item (~> 0.1.2)
62
- isodoc (0.7.0)
65
+ isodoc (0.8)
63
66
  asciimath
64
67
  html2doc (>= 0.7.1)
65
68
  htmlentities (~> 4.3.4)
@@ -87,7 +90,7 @@ GEM
87
90
  mime-types-data (3.2016.0521)
88
91
  mini_portile2 (2.3.0)
89
92
  nenv (0.3.0)
90
- nokogiri (1.8.2)
93
+ nokogiri (1.8.3)
91
94
  mini_portile2 (~> 2.3.0)
92
95
  notiffany (0.1.1)
93
96
  nenv (~> 0.1)
@@ -25,8 +25,8 @@ Gem::Specification.new do |spec|
25
25
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
26
26
  spec.require_paths = ["lib"]
27
27
 
28
- spec.add_dependency "asciidoctor-iso", ">= 0.8.0"
29
- spec.add_dependency "isodoc", ">= 0.7.0"
28
+ spec.add_dependency "asciidoctor-iso", ">= 0.9.0"
29
+ spec.add_dependency "isodoc", ">= 0.8.0"
30
30
 
31
31
  spec.add_development_dependency "bundler", "~> 1.15"
32
32
  spec.add_development_dependency "byebug", "~> 9.1"
@@ -2,3 +2,8 @@ require "asciidoctor" unless defined? Asciidoctor::Converter
2
2
  require_relative "asciidoctor/csd/converter"
3
3
  require_relative "isodoc/csd/csdconvert"
4
4
  require_relative "asciidoctor/csd/version"
5
+
6
+ if defined? Metanorma
7
+ require_relative "metanorma/csd"
8
+ Metanorma::Registry.instance.register(Metanorma::Csd::Processor)
9
+ end
@@ -148,7 +148,7 @@ module Asciidoctor
148
148
  end
149
149
 
150
150
  def html_converter(node)
151
- IsoDoc::Csd::Convert.new(
151
+ IsoDoc::Csd::HtmlConvert.new(
152
152
  script: node.attr("script"),
153
153
  bodyfont: node.attr("body-font"),
154
154
  headerfont: node.attr("header-font"),
@@ -1,5 +1,5 @@
1
1
  module Asciidoctor
2
2
  module Csd
3
- VERSION = "0.3.2"
3
+ VERSION = "0.4.0"
4
4
  end
5
5
  end
@@ -5,7 +5,7 @@ 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 Convert < IsoDoc::Convert
8
+ class HtmlConvert < IsoDoc::HtmlConvert
9
9
  def html_doc_path(file)
10
10
  File.join(File.dirname(__FILE__), File.join("html", file))
11
11
  end
@@ -67,7 +67,7 @@ module IsoDoc
67
67
  def error_parse(node, out)
68
68
  # catch elements not defined in ISO
69
69
  case node.name
70
- when "pre"
70
+ when "pre"
71
71
  pre_parse(node, out)
72
72
  when "keyword"
73
73
  out.span node.text, **{ class: "keyword" }
@@ -0,0 +1,7 @@
1
+ require_relative "./csd/processor"
2
+
3
+ module Metanorma
4
+ module Csd
5
+
6
+ end
7
+ end
@@ -0,0 +1,42 @@
1
+ require "metanorma/processor"
2
+
3
+ module Metanorma
4
+ module Csd
5
+ class Processor < Metanorma::Processor
6
+
7
+ def initialize
8
+ @short = :csd
9
+ @input_format = :asciidoc
10
+ @asciidoctor_backend = :csd
11
+ end
12
+
13
+ def output_formats
14
+ {
15
+ html: "html",
16
+ pdf: "pdf"
17
+ }
18
+ end
19
+
20
+ def input_to_isodoc(file)
21
+ Metanorma::Input::Asciidoc.new.process(file, @asciidoctor_backend)
22
+ end
23
+
24
+ def output(isodoc_node, outname, format, options={})
25
+ case format
26
+ when :html
27
+ IsoDoc::Csd::HtmlConvert.new(options).convert(outname, isodoc_node)
28
+ when :pdf
29
+ require 'tempfile'
30
+ # Tempfile.open("#{outname}.html") do |tmp|
31
+ outname_html = outname + ".html"
32
+ IsoDoc::Csd::HtmlConvert.new(options).convert(outname_html, isodoc_node)
33
+ puts outname_html
34
+ system "cat #{outname_html}"
35
+ Metanorma::Output::Pdf.new.convert(outname_html, outname)
36
+ end
37
+
38
+ end
39
+
40
+ end
41
+ end
42
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: asciidoctor-csd
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2
4
+ version: 0.4.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: 2018-06-18 00:00:00.000000000 Z
11
+ date: 2018-06-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: asciidoctor-iso
@@ -16,28 +16,28 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: 0.8.0
19
+ version: 0.9.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: 0.8.0
26
+ version: 0.9.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: isodoc
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: 0.7.0
33
+ version: 0.8.0
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - ">="
39
39
  - !ruby/object:Gem::Version
40
- version: 0.7.0
40
+ version: 0.8.0
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: bundler
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -189,6 +189,7 @@ extensions: []
189
189
  extra_rdoc_files: []
190
190
  files:
191
191
  - ".gitignore"
192
+ - ".travis.yml"
192
193
  - CODE_OF_CONDUCT.md
193
194
  - Gemfile
194
195
  - Gemfile.lock
@@ -218,6 +219,8 @@ files:
218
219
  - lib/isodoc/csd/html/htmlstyle.scss
219
220
  - lib/isodoc/csd/html/scripts.html
220
221
  - lib/isodoc/csd/metadata.rb
222
+ - lib/metanorma/csd.rb
223
+ - lib/metanorma/csd/processor.rb
221
224
  homepage: https://github.com/riboseinc/asciidoctor-csd
222
225
  licenses:
223
226
  - MIT
@@ -238,7 +241,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
238
241
  version: '0'
239
242
  requirements: []
240
243
  rubyforge_project:
241
- rubygems_version: 2.7.6
244
+ rubygems_version: 2.7.7
242
245
  signing_key:
243
246
  specification_version: 4
244
247
  summary: asciidoctor-csd lets you write CSD in AsciiDoc.