asciidoctor-csd 0.2.4 → 0.2.5
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.
- checksums.yaml +4 -4
- data/lib/asciidoctor-csd.rb +1 -1
- data/lib/asciidoctor/csd/converter.rb +19 -19
- data/lib/asciidoctor/csd/csd.rng +9 -9
- data/lib/asciidoctor/csd/isostandard.rng +1 -1
- data/lib/asciidoctor/csd/version.rb +1 -1
- data/lib/{asciidoctor → isodoc}/csd/csdconvert.rb +39 -22
- data/lib/{asciidoctor → isodoc}/csd/html/csd.scss +0 -1
- data/lib/{asciidoctor → isodoc}/csd/html/dots-w@2x.png +0 -0
- data/lib/{asciidoctor → isodoc}/csd/html/dots@2x.png +0 -0
- data/lib/{asciidoctor → isodoc}/csd/html/header.html +0 -0
- data/lib/{asciidoctor → isodoc}/csd/html/html_csd_intro.html +0 -0
- data/lib/{asciidoctor → isodoc}/csd/html/html_csd_titlepage.html +0 -0
- data/lib/{asciidoctor → isodoc}/csd/html/htmlstyle.scss +0 -0
- data/lib/{asciidoctor → isodoc}/csd/html/scripts.html +2 -1
- metadata +12 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fc649c6e50c63bd68cf9d645552d45f27670a651
|
4
|
+
data.tar.gz: 66d7676ed129c6718d7e6b9db2a72d14804fb11d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d4e682bab7954c924c5d5661f8c48215c78e3c5be4627beb9ce07d90138a2ae77274df0614b939fa5c080945786a9fff66d6d0657cc284cfe27be016af6603f9
|
7
|
+
data.tar.gz: 65537144f3361ce3321f11f9351db28c62329ae8881e22cd11b4b9f75597fc9c61ac1eef0dbd2eb8fb43a563aadaa5ce8c2484015110f98d7137d827b37db075
|
data/lib/asciidoctor-csd.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
require "asciidoctor"
|
2
2
|
require "asciidoctor/csd/version"
|
3
|
-
require "
|
3
|
+
require "isodoc/csd/csdconvert"
|
4
4
|
require "asciidoctor/iso/converter"
|
5
5
|
|
6
6
|
module Asciidoctor
|
@@ -83,6 +83,15 @@ module Asciidoctor
|
|
83
83
|
ret1
|
84
84
|
end
|
85
85
|
|
86
|
+
def doctype(node)
|
87
|
+
d = node.attr("doctype")
|
88
|
+
unless %w{presentation code proposal standard report}.include? d
|
89
|
+
warn "#{d} is not a legal document type: reverting to 'standard'"
|
90
|
+
d = "standard"
|
91
|
+
end
|
92
|
+
d
|
93
|
+
end
|
94
|
+
|
86
95
|
def document(node)
|
87
96
|
init(node)
|
88
97
|
ret1 = makexml(node)
|
@@ -125,27 +134,18 @@ module Asciidoctor
|
|
125
134
|
return
|
126
135
|
end
|
127
136
|
|
128
|
-
def html_converter(
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
137
|
+
def html_converter(node)
|
138
|
+
IsoDoc::Csd::Convert.new(
|
139
|
+
script: node.attr("script"),
|
140
|
+
bodyfont: node.attr("body-font"),
|
141
|
+
headerfont: node.attr("header-font"),
|
142
|
+
monospacefont: node.attr("monospace-font"),
|
143
|
+
titlefont: node.attr("title-font"),
|
144
|
+
i18nyaml: node.attr("i18nyaml"),
|
145
|
+
scope: node.attr("scope"),
|
135
146
|
)
|
136
147
|
end
|
137
148
|
|
138
|
-
def default_fonts(node)
|
139
|
-
b = node.attr("body-font") ||
|
140
|
-
(node.attr("script") == "Hans" ? '"SimSun",serif' :
|
141
|
-
'"Overpass",sans-serif')
|
142
|
-
h = node.attr("header-font") ||
|
143
|
-
(node.attr("script") == "Hans" ? '"SimHei",sans-serif' :
|
144
|
-
'"Overpass",sans-serif')
|
145
|
-
m = node.attr("monospace-font") || '"Space Mono",monospace'
|
146
|
-
"$bodyfont: #{b};\n$headerfont: #{h};\n$monospacefont: #{m};\n"
|
147
|
-
end
|
148
|
-
|
149
149
|
def inline_quoted(node)
|
150
150
|
noko do |xml|
|
151
151
|
case node.type
|
data/lib/asciidoctor/csd/csd.rng
CHANGED
@@ -92,16 +92,16 @@
|
|
92
92
|
<ref name="keyword"/>
|
93
93
|
</choice>
|
94
94
|
</define>
|
95
|
+
<define name="BibItemType">
|
96
|
+
<choice>
|
97
|
+
<value>code</value>
|
98
|
+
<value>presentation</value>
|
99
|
+
<value>proposal</value>
|
100
|
+
<value>standard</value>
|
101
|
+
<value>report</value>
|
102
|
+
</choice>
|
103
|
+
</define>
|
95
104
|
</include>
|
96
|
-
<define name="BibItemType" combine="choice">
|
97
|
-
<choice>
|
98
|
-
<value>code</value>
|
99
|
-
<value>presentation</value>
|
100
|
-
<value>proposal</value>
|
101
|
-
<value>standard</value>
|
102
|
-
<value>report</value>
|
103
|
-
</choice>
|
104
|
-
</define>
|
105
105
|
<define name="pre">
|
106
106
|
<element name="pre">
|
107
107
|
<text/>
|
@@ -1,15 +1,35 @@
|
|
1
1
|
require "isodoc"
|
2
2
|
|
3
|
-
module
|
3
|
+
module IsoDoc
|
4
4
|
module Csd
|
5
5
|
# A {Converter} implementation that generates CSD output, and a document
|
6
6
|
# schema encapsulation of the document for validation
|
7
|
-
class
|
7
|
+
class Convert < IsoDoc::Convert
|
8
|
+
def html_doc_path(file)
|
9
|
+
File.join(File.dirname(__FILE__), File.join("html", file))
|
10
|
+
end
|
11
|
+
|
8
12
|
def initialize(options)
|
9
13
|
super
|
14
|
+
@htmlstylesheet = generate_css(html_doc_path("htmlstyle.scss"), true, default_fonts(options))
|
15
|
+
@standardstylesheet = generate_css(html_doc_path("csd.scss"), true, default_fonts(options))
|
16
|
+
@htmlcoverpage = html_doc_path("html_csd_titlepage.html")
|
17
|
+
@htmlintropage = html_doc_path("html_csd_intro.html")
|
18
|
+
@scripts = html_doc_path("scripts.html")
|
10
19
|
set_metadata(:status, "XXX")
|
11
20
|
end
|
12
21
|
|
22
|
+
def default_fonts(options)
|
23
|
+
b = options[:bodyfont] ||
|
24
|
+
(options[:script] == "Hans" ? '"SimSun",serif' :
|
25
|
+
'"Overpass",sans-serif')
|
26
|
+
h = options[:headerfont] ||
|
27
|
+
(options[:script] == "Hans" ? '"SimHei",sans-serif' :
|
28
|
+
'"Overpass",sans-serif')
|
29
|
+
m = options[:monospacefont] || '"Space Mono",monospace'
|
30
|
+
"$bodyfont: #{b};\n$headerfont: #{h};\n$monospacefont: #{m};\n"
|
31
|
+
end
|
32
|
+
|
13
33
|
def init_metadata
|
14
34
|
super
|
15
35
|
end
|
@@ -56,6 +76,19 @@ module Asciidoctor
|
|
56
76
|
end
|
57
77
|
end
|
58
78
|
|
79
|
+
def annex_name(annex, name, div)
|
80
|
+
div.h1 **{ class: "Annex" } do |t|
|
81
|
+
t << "#{get_anchors[annex['id']][:label]} "
|
82
|
+
t << "<b>#{name.text}</b>"
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
def annex_name_lbl(clause, num)
|
87
|
+
obl = l10n("(#{@inform_annex_lbl})")
|
88
|
+
obl = l10n("(#{@norm_annex_lbl})") if clause["obligation"] == "normative"
|
89
|
+
l10n("<b>#{@annex_lbl} #{num}</b> #{obl}")
|
90
|
+
end
|
91
|
+
|
59
92
|
def pre_parse(node, out)
|
60
93
|
out.pre node.text # content.gsub(/</, "<").gsub(/>/, ">")
|
61
94
|
end
|
@@ -85,7 +118,8 @@ module Asciidoctor
|
|
85
118
|
end
|
86
119
|
end
|
87
120
|
|
88
|
-
|
121
|
+
def html_head()
|
122
|
+
<<~HEAD.freeze
|
89
123
|
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
|
90
124
|
|
91
125
|
<!--TOC script import-->
|
@@ -97,24 +131,7 @@ module Asciidoctor
|
|
97
131
|
<!--Font awesome import for the link icon-->
|
98
132
|
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.0.8/css/solid.css" integrity="sha384-v2Tw72dyUXeU3y4aM2Y0tBJQkGfplr39mxZqlTBDUZAb9BGoC40+rdFCG0m10lXk" crossorigin="anonymous">
|
99
133
|
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.0.8/css/fontawesome.css" integrity="sha384-q3jl8XQu1OpdLgGFvNRnPdj5VIlCvgsDQTQB6owSOHWlAurxul7f+JpUOVdAiJ5P" crossorigin="anonymous">
|
100
|
-
|
101
|
-
|
102
|
-
BUTTON = '<button onclick="topFunction()" id="myBtn" '\
|
103
|
-
'title="Go to top">Top</button>'.freeze
|
104
|
-
|
105
|
-
|
106
|
-
def html_main(docxml)
|
107
|
-
d = docxml.at('//div[@class="WordSection3"]')
|
108
|
-
s = d.replace("<main></main>")
|
109
|
-
s.first.children = d
|
110
|
-
s.first.children.first.previous = BUTTON
|
111
|
-
end
|
112
|
-
|
113
|
-
def html_preface(docxml)
|
114
|
-
super
|
115
|
-
docxml.at("//head").add_child(HEAD)
|
116
|
-
html_main(docxml)
|
117
|
-
docxml
|
134
|
+
HEAD
|
118
135
|
end
|
119
136
|
|
120
137
|
def make_body(xml, docxml)
|
@@ -127,7 +144,7 @@ module Asciidoctor
|
|
127
144
|
end
|
128
145
|
|
129
146
|
def html_toc(docxml)
|
130
|
-
|
147
|
+
docxml
|
131
148
|
end
|
132
149
|
end
|
133
150
|
end
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
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.2.
|
4
|
+
version: 0.2.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-05-
|
11
|
+
date: 2018-05-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: asciidoctor
|
@@ -343,18 +343,18 @@ files:
|
|
343
343
|
- lib/asciidoctor/csd/biblio.rng
|
344
344
|
- lib/asciidoctor/csd/converter.rb
|
345
345
|
- lib/asciidoctor/csd/csd.rng
|
346
|
-
- lib/asciidoctor/csd/csdconvert.rb
|
347
|
-
- lib/asciidoctor/csd/html/csd.scss
|
348
|
-
- lib/asciidoctor/csd/html/dots-w@2x.png
|
349
|
-
- lib/asciidoctor/csd/html/dots@2x.png
|
350
|
-
- lib/asciidoctor/csd/html/header.html
|
351
|
-
- lib/asciidoctor/csd/html/html_csd_intro.html
|
352
|
-
- lib/asciidoctor/csd/html/html_csd_titlepage.html
|
353
|
-
- lib/asciidoctor/csd/html/htmlstyle.scss
|
354
|
-
- lib/asciidoctor/csd/html/scripts.html
|
355
346
|
- lib/asciidoctor/csd/isodoc.rng
|
356
347
|
- lib/asciidoctor/csd/isostandard.rng
|
357
348
|
- lib/asciidoctor/csd/version.rb
|
349
|
+
- lib/isodoc/csd/csdconvert.rb
|
350
|
+
- lib/isodoc/csd/html/csd.scss
|
351
|
+
- lib/isodoc/csd/html/dots-w@2x.png
|
352
|
+
- lib/isodoc/csd/html/dots@2x.png
|
353
|
+
- lib/isodoc/csd/html/header.html
|
354
|
+
- lib/isodoc/csd/html/html_csd_intro.html
|
355
|
+
- lib/isodoc/csd/html/html_csd_titlepage.html
|
356
|
+
- lib/isodoc/csd/html/htmlstyle.scss
|
357
|
+
- lib/isodoc/csd/html/scripts.html
|
358
358
|
homepage: https://github.com/riboseinc/asciidoctor-csd
|
359
359
|
licenses:
|
360
360
|
- MIT
|
@@ -375,7 +375,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
375
375
|
version: '0'
|
376
376
|
requirements: []
|
377
377
|
rubyforge_project:
|
378
|
-
rubygems_version: 2.6.
|
378
|
+
rubygems_version: 2.6.12
|
379
379
|
signing_key:
|
380
380
|
specification_version: 4
|
381
381
|
summary: asciidoctor-csd lets you write CSD in AsciiDoc.
|