asciidoctor-rsd 0.3.4 → 0.3.5

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: b34cc6eb881832f419827f68e71d0934c1634a1624ce72a982b9b3f91acd84e2
4
- data.tar.gz: 504689a09ddec754e31539a0a00745c963937041966bd8d254de90d218c417cf
3
+ metadata.gz: 04c9816718afed531d4179413757dd82608d751ffce7aa9dcf353db78a7240af
4
+ data.tar.gz: 8d44773ff6f70116d8e8164d953b66b65f4f23bf8d5d43b72787e0a1be9731c5
5
5
  SHA512:
6
- metadata.gz: 7b240e36e65a9edc28f7ffeda4c34e7df7c522ed1e7c59b2c1bfdf48d17e360d2a84170d8b6bd3b86612cd58a72ea5e05055d43202828588fa1719d025879ec8
7
- data.tar.gz: c124c3352f66520909ffdb3eb7ca881c9e51f15b5e158d3517710f3a59f5997cfc5c875599e78f26b22fc4afa1c82b1ebaf02b5a14ea4cc240322ec72f21cfe9
6
+ metadata.gz: 3cd7bb758a501f97bf999d86bddcbb338b82f4a2a2f470b4efc5ba183cd2fb8c06870639ca2480d2903fd71ba9681842649288e61e8bf391ba857d6ad4924619
7
+ data.tar.gz: 69f88b7921a6988ee328507cd76fdfdb2a8cf813e33fa4b2a09173d050722a37ab51977b579d9bca90b47ad70e10c776921fde1cc90ac9434b6cfcca59c8ca0e
@@ -29,7 +29,7 @@ Gem::Specification.new do |spec|
29
29
  spec.add_dependency "htmlentities", "~> 4.3.4"
30
30
  spec.add_dependency "nokogiri"
31
31
  spec.add_dependency "asciidoctor-iso", "~> 0.10.1"
32
- spec.add_dependency "isodoc", ">= 0.8.4"
32
+ spec.add_dependency "isodoc", ">= 0.8.8"
33
33
 
34
34
  spec.add_development_dependency "bundler", "~> 1.15"
35
35
  spec.add_development_dependency "byebug", "~> 9.1"
@@ -14,6 +14,11 @@ module Asciidoctor
14
14
 
15
15
  register_for "rsd"
16
16
 
17
+ def initialize(backend, opts)
18
+ super
19
+ @libdir = File.dirname(__FILE__)
20
+ end
21
+
17
22
  def metadata_author(node, xml)
18
23
  xml.contributor do |c|
19
24
  c.role **{ type: "author" }
@@ -96,7 +101,8 @@ module Asciidoctor
96
101
 
97
102
  def doctype(node)
98
103
  d = node.attr("doctype")
99
- unless %w{policy-and-procedures best-practices supporting-document report legal directives proposal standard}.include? d
104
+ unless %w{policy-and-procedures best-practices supporting-document
105
+ report legal directives proposal standard}.include? d
100
106
  warn "#{d} is not a legal document type: reverting to 'standard'"
101
107
  d = "standard"
102
108
  end
@@ -158,13 +164,17 @@ module Asciidoctor
158
164
 
159
165
  def html_converter(node)
160
166
  IsoDoc::Rsd::HtmlConvert.new(
161
- script: node.attr("script"),
162
- bodyfont: node.attr("body-font"),
163
- headerfont: node.attr("header-font"),
164
- monospacefont: node.attr("monospace-font"),
165
- titlefont: node.attr("title-font"),
166
- i18nyaml: node.attr("i18nyaml"),
167
- scope: node.attr("scope"),
167
+ script: node.attr("script"),
168
+ bodyfont: node.attr("body-font"),
169
+ headerfont: node.attr("header-font"),
170
+ monospacefont: node.attr("monospace-font"),
171
+ titlefont: node.attr("title-font"),
172
+ i18nyaml: node.attr("i18nyaml"),
173
+ scope: node.attr("scope"),
174
+ htmlstylesheet: node.attr("htmlstylesheet"),
175
+ htmlcoverpage: node.attr("htmlcoverpage"),
176
+ htmlintropage: node.attr("htmlintropage"),
177
+ scripts: node.attr("scripts"),
168
178
  )
169
179
  end
170
180
 
@@ -177,6 +187,13 @@ module Asciidoctor
177
187
  titlefont: node.attr("title-font"),
178
188
  i18nyaml: node.attr("i18nyaml"),
179
189
  scope: node.attr("scope"),
190
+ wordstylesheet: node.attr("wordstylesheet"),
191
+ standardstylesheet: node.attr("standardstylesheet"),
192
+ header: node.attr("header"),
193
+ wordcoverpage: node.attr("wordcoverpage"),
194
+ wordintropage: node.attr("wordintropage"),
195
+ ulstyle: node.attr("ulstyle"),
196
+ olstyle: node.attr("olstyle"),
180
197
  )
181
198
  end
182
199
 
@@ -18,7 +18,21 @@
18
18
  of this.
19
19
  -->
20
20
  <grammar xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
21
- <include href="biblio.rng"/>
21
+ <include href="biblio.rng">
22
+ <define name="status">
23
+ <element name="status">
24
+ <choice>
25
+ <value>proposal</value>
26
+ <value>working_draft</value>
27
+ <value>committee_draft</value>
28
+ <value>draft_standard</value>
29
+ <value>final_draft</value>
30
+ <value>published</value>
31
+ <value>withdrawn</value>
32
+ </choice>
33
+ </element>
34
+ </define>
35
+ </include>
22
36
  <start>
23
37
  <ref name="standard-document"/>
24
38
  </start>
@@ -28,9 +42,10 @@
28
42
  <optional>
29
43
  <ref name="version"/>
30
44
  </optional>
31
- <oneOrMore>
32
- <ref name="sections"/>
33
- </oneOrMore>
45
+ <optional>
46
+ <ref name="preface"/>
47
+ </optional>
48
+ <ref name="sections"/>
34
49
  <zeroOrMore>
35
50
  <ref name="annex"/>
36
51
  </zeroOrMore>
@@ -44,11 +59,6 @@
44
59
  <ref name="BibData"/>
45
60
  </element>
46
61
  </define>
47
- <define name="status">
48
- <element name="status">
49
- <ref name="FormattedString"/>
50
- </element>
51
- </define>
52
62
  <define name="version">
53
63
  <element name="version">
54
64
  <optional>
@@ -77,6 +87,13 @@
77
87
  <text/>
78
88
  </element>
79
89
  </define>
90
+ <define name="preface">
91
+ <element name="preface">
92
+ <oneOrMore>
93
+ <ref name="content"/>
94
+ </oneOrMore>
95
+ </element>
96
+ </define>
80
97
  <define name="sections">
81
98
  <element name="sections">
82
99
  <oneOrMore>
@@ -104,7 +121,9 @@
104
121
  </define>
105
122
  <define name="section-title">
106
123
  <element name="title">
107
- <text/>
124
+ <zeroOrMore>
125
+ <ref name="TextElement"/>
126
+ </zeroOrMore>
108
127
  </element>
109
128
  </define>
110
129
  <define name="content">
@@ -324,7 +343,7 @@
324
343
  <attribute name="id">
325
344
  <data type="ID"/>
326
345
  </attribute>
327
- <ref name="BasicBlock"/>
346
+ <ref name="paragraph"/>
328
347
  </element>
329
348
  </define>
330
349
  <define name="termsource">
@@ -423,7 +442,7 @@
423
442
  <data type="ID"/>
424
443
  </attribute>
425
444
  <oneOrMore>
426
- <ref name="paragraph-with-footnote"/>
445
+ <ref name="paragraph"/>
427
446
  </oneOrMore>
428
447
  </element>
429
448
  </define>
@@ -690,21 +709,20 @@
690
709
  <ref name="tname"/>
691
710
  </optional>
692
711
  <choice>
693
- <oneOrMore>
712
+ <ref name="image"/>
713
+ <zeroOrMore>
694
714
  <ref name="figure"/>
695
- </oneOrMore>
696
- <group>
697
- <zeroOrMore>
698
- <ref name="TextElement"/>
699
- </zeroOrMore>
700
- <zeroOrMore>
701
- <ref name="note"/>
702
- </zeroOrMore>
703
- <optional>
704
- <ref name="dl"/>
705
- </optional>
706
- </group>
715
+ </zeroOrMore>
707
716
  </choice>
717
+ <zeroOrMore>
718
+ <ref name="fn"/>
719
+ </zeroOrMore>
720
+ <optional>
721
+ <ref name="dl"/>
722
+ </optional>
723
+ <zeroOrMore>
724
+ <ref name="note"/>
725
+ </zeroOrMore>
708
726
  </element>
709
727
  </define>
710
728
  <define name="TextElement">
@@ -681,6 +681,14 @@
681
681
  <ref name="paragraph"/>
682
682
  </element>
683
683
  </define>
684
+ <define name="preface">
685
+ <element name="preface">
686
+ <ref name="foreword"/>
687
+ <optional>
688
+ <ref name="introduction"/>
689
+ </optional>
690
+ </element>
691
+ </define>
684
692
  </include>
685
693
  <!-- end overrides -->
686
694
  <!--
@@ -706,14 +714,6 @@
706
714
  <ref name="bibliography"/>
707
715
  </element>
708
716
  </define>
709
- <define name="preface">
710
- <element name="preface">
711
- <ref name="foreword"/>
712
- <optional>
713
- <ref name="introduction"/>
714
- </optional>
715
- </element>
716
- </define>
717
717
  <define name="bibliography">
718
718
  <element name="bibliography">
719
719
  <oneOrMore>
@@ -1,5 +1,5 @@
1
1
  module Asciidoctor
2
2
  module Rsd
3
- VERSION = "0.3.4"
3
+ VERSION = "0.3.5"
4
4
  end
5
5
  end
@@ -1,5 +1,6 @@
1
1
  require "isodoc"
2
2
  require_relative "metadata"
3
+ require "fileutils"
3
4
 
4
5
  module IsoDoc
5
6
  module Rsd
@@ -8,29 +9,29 @@ module IsoDoc
8
9
  # schema encapsulation of the document for validation
9
10
  #
10
11
  class HtmlConvert < IsoDoc::HtmlConvert
11
- def rsd_html_path(file)
12
- File.join(File.dirname(__FILE__), File.join("html", file))
13
- end
14
-
15
12
  def initialize(options)
13
+ @libdir = File.dirname(__FILE__)
16
14
  super
17
- @htmlstylesheet = generate_css(rsd_html_path("htmlstyle.scss"), true, default_fonts(options))
18
- @htmlcoverpage = rsd_html_path("html_rsd_titlepage.html")
19
- @htmlintropage = rsd_html_path("html_rsd_intro.html")
20
- @scripts = rsd_html_path("scripts.html")
21
- system "cp #{html_doc_path('logo.svg')} logo.svg"
15
+ #system "cp #{html_doc_path('logo.svg')} logo.svg"
16
+ FileUtils.cp html_doc_path('logo.svg'), "logo.svg"
22
17
  @files_to_delete << "logo.svg"
23
18
  end
24
19
 
25
20
  def default_fonts(options)
26
- b = options[:bodyfont] ||
27
- (options[:script] == "Hans" ? '"SimSun",serif' :
28
- '"Overpass",sans-serif')
29
- h = options[:headerfont] ||
30
- (options[:script] == "Hans" ? '"SimHei",sans-serif' :
31
- '"Overpass",sans-serif')
32
- m = options[:monospacefont] || '"Space Mono",monospace'
33
- "$bodyfont: #{b};\n$headerfont: #{h};\n$monospacefont: #{m};\n"
21
+ {
22
+ bodyfont: (options[:script] == "Hans" ? '"SimSun",serif' : '"Overpass",sans-serif'),
23
+ headerfont: (options[:script] == "Hans" ? '"SimHei",sans-serif' : '"Overpass",sans-serif'),
24
+ monospacefont: '"Space Mono",monospace'
25
+ }
26
+ end
27
+
28
+ def default_file_locations(_options)
29
+ {
30
+ htmlstylesheet: html_doc_path("htmlstyle.scss"),
31
+ htmlcoverpage: html_doc_path("html_rsd_titlepage.html"),
32
+ htmlintropage: html_doc_path("html_rsd_intro.html"),
33
+ scripts: html_doc_path("scripts.html"),
34
+ }
34
35
  end
35
36
 
36
37
  def metadata_init(lang, script, labels)
@@ -1,34 +1,35 @@
1
1
  require "isodoc"
2
2
  require_relative "metadata"
3
+ require "fileutils"
3
4
 
4
5
  module IsoDoc
5
6
  module Rsd
6
7
  # A {Converter} implementation that generates PDF HTML output, and a
7
8
  # document schema encapsulation of the document for validation
8
9
  class PdfConvert < IsoDoc::PdfConvert
9
- def rsd_html_path(file)
10
- File.join(File.dirname(__FILE__), File.join("html", file))
11
- end
12
-
13
10
  def initialize(options)
11
+ @libdir = File.dirname(__FILE__)
14
12
  super
15
- @htmlstylesheet = generate_css(rsd_html_path("htmlstyle.scss"), true, default_fonts(options))
16
- @htmlcoverpage = rsd_html_path("html_rsd_titlepage.html")
17
- @htmlintropage = rsd_html_path("html_rsd_intro.html")
18
- @scripts = rsd_html_path("scripts.html")
19
- system "cp #{html_doc_path('logo.svg')} logo.svg"
13
+ #system "cp #{html_doc_path('logo.svg')} logo.svg"
14
+ FileUtils.cp html_doc_path('logo.svg'), "logo.svg"
20
15
  @files_to_delete << "logo.svg"
21
16
  end
22
17
 
23
18
  def default_fonts(options)
24
- b = options[:bodyfont] ||
25
- (options[:script] == "Hans" ? '"SimSun",serif' :
26
- '"Overpass",sans-serif')
27
- h = options[:headerfont] ||
28
- (options[:script] == "Hans" ? '"SimHei",sans-serif' :
29
- '"Overpass",sans-serif')
30
- m = options[:monospacefont] || '"Space Mono",monospace'
31
- "$bodyfont: #{b};\n$headerfont: #{h};\n$monospacefont: #{m};\n"
19
+ {
20
+ bodyfont: (options[:script] == "Hans" ? '"SimSun",serif' : '"Overpass",sans-serif'),
21
+ headerfont: (options[:script] == "Hans" ? '"SimHei",sans-serif' : '"Overpass",sans-serif'),
22
+ monospacefont: '"Space Mono",monospace'
23
+ }
24
+ end
25
+
26
+ def default_file_locations(options)
27
+ {
28
+ htmlstylesheet: html_doc_path("htmlstyle.scss"),
29
+ htmlcoverpage: html_doc_path("html_rsd_titlepage.html"),
30
+ htmlintropage: html_doc_path("html_rsd_intro.html"),
31
+ scripts: html_doc_path("scripts.html"),
32
+ }
32
33
  end
33
34
 
34
35
  def metadata_init(lang, script, labels)
@@ -1,5 +1,6 @@
1
1
  require "isodoc"
2
2
  require_relative "metadata"
3
+ require "fileutils"
3
4
 
4
5
  module IsoDoc
5
6
  module Rsd
@@ -7,32 +8,32 @@ module IsoDoc
7
8
  # schema encapsulation of the document for validation
8
9
 
9
10
  class WordConvert < IsoDoc::WordConvert
10
- def rsd_html_path(file)
11
- File.join(File.dirname(__FILE__), File.join("html", file))
12
- end
13
-
14
11
  def initialize(options)
12
+ @libdir = File.dirname(__FILE__)
15
13
  super
16
- @wordstylesheet = generate_css(rsd_html_path("wordstyle.scss"), false, default_fonts(options))
17
- @standardstylesheet = generate_css(rsd_html_path("rsd.scss"), false, default_fonts(options))
18
- @header = rsd_html_path("header.html")
19
- @wordcoverpage = rsd_html_path("word_rsd_titlepage.html")
20
- @wordintropage = rsd_html_path("word_rsd_intro.html")
21
- @ulstyle = "l3"
22
- @olstyle = "l2"
23
- system "cp #{html_doc_path('logo.svg')} logo.svg"
14
+ #system "cp #{html_doc_path('logo.svg')} logo.svg"
15
+ FileUtils.cp html_doc_path('logo.svg'), "logo.svg"
24
16
  @files_to_delete << "logo.svg"
25
17
  end
26
18
 
27
19
  def default_fonts(options)
28
- b = options[:bodyfont] ||
29
- (options[:script] == "Hans" ? '"SimSun",serif' :
30
- '"Arial",sans-serif')
31
- h = options[:headerfont] ||
32
- (options[:script] == "Hans" ? '"SimHei",sans-serif' :
33
- '"Arial",sans-serif')
34
- m = options[:monospacefont] || '"Courier New",monospace'
35
- "$bodyfont: #{b};\n$headerfont: #{h};\n$monospacefont: #{m};\n"
20
+ {
21
+ bodyfont: (options[:script] == "Hans" ? '"SimSun",serif' : '"Arial",sans-serif'),
22
+ headerfont: (options[:script] == "Hans" ? '"SimHei",sans-serif' : '"Arial",sans-serif'),
23
+ monospacefont: '"Courier New",monospace'
24
+ }
25
+ end
26
+
27
+ def default_file_locations(options)
28
+ {
29
+ wordstylesheet: html_doc_path("wordstyle.scss"),
30
+ standardstylesheet: html_doc_path("rsd.scss"),
31
+ header: html_doc_path("header.html"),
32
+ wordcoverpage: html_doc_path("word_rsd_titlepage.html"),
33
+ wordintropage: html_doc_path("word_rsd_intro.html"),
34
+ ulstyle: "l3",
35
+ olstyle: "l2",
36
+ }
36
37
  end
37
38
 
38
39
  def metadata_init(lang, script, labels)
@@ -34,14 +34,6 @@ module Metanorma
34
34
  IsoDoc::Rsd::WordConvert.new(options).convert(outname, isodoc_node)
35
35
  when :pdf
36
36
  IsoDoc::Rsd::PdfConvert.new(options).convert(outname, isodoc_node)
37
- =begin
38
- require 'tempfile'
39
- outname_html = outname + ".html"
40
- IsoDoc::Rsd::HtmlConvert.new(options).convert(outname_html, isodoc_node)
41
- puts outname_html
42
- system "cat #{outname_html}"
43
- Metanorma::Output::Pdf.new.convert(outname_html, outname)
44
- =end
45
37
  else
46
38
  super
47
39
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: asciidoctor-rsd
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.4
4
+ version: 0.3.5
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-08-08 00:00:00.000000000 Z
11
+ date: 2018-08-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: asciidoctor
@@ -72,14 +72,14 @@ dependencies:
72
72
  requirements:
73
73
  - - ">="
74
74
  - !ruby/object:Gem::Version
75
- version: 0.8.4
75
+ version: 0.8.8
76
76
  type: :runtime
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - ">="
81
81
  - !ruby/object:Gem::Version
82
- version: 0.8.4
82
+ version: 0.8.8
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: bundler
85
85
  requirement: !ruby/object:Gem::Requirement