metanorma-vsd 0.3.3 → 0.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +15 -10
- data/Gemfile +3 -0
- data/README.adoc +11 -15
- data/appveyor.yml +36 -0
- data/lib/asciidoctor/vsd/converter.rb +3 -3
- data/lib/isodoc/vsd/html/html_vsd_titlepage.html +4 -4
- data/lib/isodoc/vsd/html/htmlstyle.scss +10 -1
- data/lib/isodoc/vsd/html/scripts.html +3 -1
- data/lib/isodoc/vsd/html/word_vsd_titlepage.html +2 -2
- data/lib/isodoc/vsd/html_convert.rb +26 -30
- data/lib/isodoc/vsd/metadata.rb +8 -2
- data/lib/isodoc/vsd/pdf_convert.rb +21 -31
- data/lib/isodoc/vsd/word_convert.rb +24 -24
- data/lib/metanorma/vsd/processor.rb +4 -4
- data/lib/metanorma/vsd/version.rb +1 -1
- data/metanorma-vsd.gemspec +5 -5
- metadata +15 -29
- data/lib/asciidoctor/vsd/pdf.js +0 -31
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1dcd7b0097099695ea64dc393d368259a9cb9018761fe2d7bef3122a464cc9e8
|
4
|
+
data.tar.gz: 3068a1e2a43d4aa125cb0473d95b7aa0f453f079049a95bbee0fe870bfab56ec
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cde8ea03566fe1d5c45323a172b426f22231d10b729a3ef0cd4e248014d3c4701f60178b70dd91dca4835b7330fb86596f8055ed77eee8d543f7ad41a3b0d00d
|
7
|
+
data.tar.gz: 219c2b23836081d0aef8f9d527909bf98160c3c6dc825a2102f1f3ab535e90c60589ebcef0f724e4e0bf3adc1cee5e28c85886b361fc1d55427509007ddb2069
|
data/.travis.yml
CHANGED
@@ -1,15 +1,20 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
# Auto-generated !!! Do not edit it manually
|
2
|
+
# use ci-master https://github.com/metanorma/metanorma-build-scripts
|
3
3
|
language: ruby
|
4
|
+
cache: bundler
|
5
|
+
os:
|
6
|
+
- linux
|
7
|
+
- osx
|
4
8
|
rvm:
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
before_install:
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
9
|
+
- 2.5
|
10
|
+
- 2.4
|
11
|
+
- ruby-head
|
12
|
+
before_install:
|
13
|
+
- nvm install 8
|
14
|
+
- npm install -g puppeteer
|
15
|
+
- npm install
|
16
|
+
- gem install bundler -v "~> 2"
|
17
|
+
- bundle update
|
13
18
|
matrix:
|
14
19
|
allow_failures:
|
15
20
|
- rvm: ruby-head
|
data/Gemfile
CHANGED
data/README.adoc
CHANGED
@@ -1,8 +1,10 @@
|
|
1
1
|
= Metanorma for VSD: Metanorma processor for Vitagreen Standard Documents (VSD)
|
2
2
|
|
3
|
-
image:https://img.shields.io/gem/v/metanorma-
|
4
|
-
image:https://img.shields.io/travis/riboseinc/metanorma-
|
5
|
-
image:https://codeclimate.com/github/riboseinc/metanorma-
|
3
|
+
image:https://img.shields.io/gem/v/metanorma-vsd.svg["Gem Version", link="https://rubygems.org/gems/metanorma-vsd"]
|
4
|
+
image:https://img.shields.io/travis/riboseinc/metanorma-vsd/master.svg["Build Status", link="https://travis-ci.org/riboseinc/metanorma-vsd"]
|
5
|
+
image:https://codeclimate.com/github/riboseinc/metanorma-vsd/badges/gpa.svg["Code Climate", link="https://codeclimate.com/github/riboseinc/metanorma-vsd"]
|
6
|
+
image:https://ci.appveyor.com/api/projects/status/525uihjhrm2e9s4f?svg=true["Appveyor Build Status", link="https://ci.appveyor.com/project/ribose/metanorma-vsd"]
|
7
|
+
|
6
8
|
|
7
9
|
WARNING: This gem is still under development.
|
8
10
|
|
@@ -39,10 +41,10 @@ The preferred way to invoke this gem is via the `metanorma` script:
|
|
39
41
|
|
40
42
|
[source,console]
|
41
43
|
----
|
42
|
-
$ metanorma --type
|
43
|
-
$ metanorma --type
|
44
|
-
$ metanorma --type
|
45
|
-
$ metanorma --type
|
44
|
+
$ metanorma --type vsd a.adoc # output HTML and DOC
|
45
|
+
$ metanorma --type vsd --extensions html a.adoc # output just HTML
|
46
|
+
$ metanorma --type vsd --extensions doc a.adoc # output just DOC
|
47
|
+
$ metanorma --type vsd --extensions xml a.adoc # output VSD XML
|
46
48
|
----
|
47
49
|
|
48
50
|
The gem translates the document into VSD XML format, and then
|
@@ -53,12 +55,6 @@ document.
|
|
53
55
|
|
54
56
|
The gem then converts the XML into HTML and PDF.
|
55
57
|
|
56
|
-
The gem can also be invoked directly within asciidoctor, though this is deprecated:
|
57
|
-
|
58
|
-
[source,console]
|
59
|
-
----
|
60
|
-
$ asciidoctor -b rsd -r 'asciidoctor-rsd' a.adoc
|
61
|
-
----
|
62
58
|
|
63
59
|
=== Installation
|
64
60
|
|
@@ -69,7 +65,7 @@ scripts such as this one. You need only run the following in a Terminal console:
|
|
69
65
|
[source,console]
|
70
66
|
----
|
71
67
|
$ bash <(curl -s https://raw.githubusercontent.com/riboseinc/metanorma-macos-setup/master/metanorma-setup)
|
72
|
-
$ gem install
|
68
|
+
$ gem install metanorma-vsd
|
73
69
|
----
|
74
70
|
|
75
71
|
|
@@ -163,7 +159,7 @@ these are otherwise suppressed.
|
|
163
159
|
The VSD Standard Document format is an instance of the
|
164
160
|
https://github.com/riboseinc/isodoc-models[StandardDocument model]. Details of
|
165
161
|
this general model can be found on its page. Details of the VSD modifications
|
166
|
-
to this general model can be found on the https://github.com/riboseinc/
|
162
|
+
to this general model can be found on the https://github.com/riboseinc/metanorma-model-vsd[VSD model]
|
167
163
|
repository.
|
168
164
|
|
169
165
|
== Examples
|
data/appveyor.yml
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
# Auto-generated !!! Do not edit it manually
|
2
|
+
# use ci-master https://github.com/metanorma/metanorma-build-scripts
|
3
|
+
version: '{build}'
|
4
|
+
|
5
|
+
cache:
|
6
|
+
- vendor/bundle
|
7
|
+
|
8
|
+
environment:
|
9
|
+
matrix:
|
10
|
+
- RUBY_VERSION: 25
|
11
|
+
- RUBY_VERSION: 24
|
12
|
+
- RUBY_VERSION: _trunk
|
13
|
+
|
14
|
+
matrix:
|
15
|
+
allow_failures:
|
16
|
+
- RUBY_VERSION: _trunk
|
17
|
+
|
18
|
+
install:
|
19
|
+
- ps: . { iwr -useb https://raw.githubusercontent.com/metanorma/metanorma-build-scripts/master/appveyor.ps1 } | iex
|
20
|
+
- refreshenv
|
21
|
+
|
22
|
+
build_script:
|
23
|
+
- set PATH=C:\Ruby%RUBY_VERSION%\bin;%PATH%
|
24
|
+
- set GIT_TERMINAL_PROMPT=0
|
25
|
+
- gem install bundler -v "~> 2"
|
26
|
+
- bundle config --local path vendor/bundle
|
27
|
+
- bundle update
|
28
|
+
- bundle install
|
29
|
+
|
30
|
+
before_test:
|
31
|
+
- ruby -v
|
32
|
+
- gem -v
|
33
|
+
- bundle -v
|
34
|
+
|
35
|
+
test_script:
|
36
|
+
- bundle exec rake
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require "asciidoctor/
|
1
|
+
require "asciidoctor/standoc/converter"
|
2
2
|
require "isodoc/vsd"
|
3
3
|
|
4
4
|
module Asciidoctor
|
@@ -7,7 +7,7 @@ module Asciidoctor
|
|
7
7
|
# A {Converter} implementation that generates RSD output, and a document
|
8
8
|
# schema encapsulation of the document for validation
|
9
9
|
#
|
10
|
-
class Converter <
|
10
|
+
class Converter < Standoc::Converter
|
11
11
|
|
12
12
|
register_for "vsd"
|
13
13
|
|
@@ -47,7 +47,7 @@ module Asciidoctor
|
|
47
47
|
result << noko { |ixml| front node, ixml }
|
48
48
|
result << noko { |ixml| middle node, ixml }
|
49
49
|
result << "</vsd-standard>"
|
50
|
-
result = textcleanup(result
|
50
|
+
result = textcleanup(result)
|
51
51
|
ret1 = cleanup(Nokogiri::XML(result))
|
52
52
|
validate(ret1)
|
53
53
|
ret1.root.add_namespace(nil, IsoDoc::Vsd::DOCUMENT_NAMESPACE)
|
@@ -1,5 +1,5 @@
|
|
1
|
-
<div class="document-stage-band" id='{{
|
2
|
-
<p class="document-stage">{{
|
1
|
+
<div class="document-stage-band" id='{{ stage | downcase | replace: " ", "-" }}-band'>
|
2
|
+
<p class="document-stage">{{ stage }}</p>
|
3
3
|
</div>
|
4
4
|
|
5
5
|
<div class="document-type-band" id='{{ doctype | downcase | replace: " ", "-" }}-band'>
|
@@ -46,7 +46,7 @@
|
|
46
46
|
</div>
|
47
47
|
|
48
48
|
<div class="coverpage-stage-block" >
|
49
|
-
<p><span class="coverpage-maturity" id="{{
|
49
|
+
<p><span class="coverpage-maturity" id="{{ stage | replace: ' ', '-' | downcase }}">{{ stage }}</span></p>
|
50
50
|
{% if security %}
|
51
51
|
<p><span class="coverpage-maturity">Classification: {{ security }}</span></p>
|
52
52
|
{% endif %}
|
@@ -56,7 +56,7 @@
|
|
56
56
|
<div class="coverpage-stage-block" >{{ revdate }}</div>
|
57
57
|
{% endif %}
|
58
58
|
|
59
|
-
{% if
|
59
|
+
{% if stage != "Published" and stage != "Withdrawn" %}
|
60
60
|
<div class="coverpage-warning">
|
61
61
|
<span class="title">Warning for Drafts</span>
|
62
62
|
|
@@ -212,7 +212,7 @@ table {
|
|
212
212
|
list-style: none;
|
213
213
|
}
|
214
214
|
|
215
|
-
#toc li {
|
215
|
+
#toc li a {
|
216
216
|
padding: 5px 10px;
|
217
217
|
}
|
218
218
|
|
@@ -223,6 +223,7 @@ table {
|
|
223
223
|
}
|
224
224
|
|
225
225
|
#toc a:hover {
|
226
|
+
box-shadow: none;
|
226
227
|
color: white;
|
227
228
|
}
|
228
229
|
|
@@ -521,6 +522,14 @@ ul li:first-child {
|
|
521
522
|
margin-top: 1em;
|
522
523
|
}
|
523
524
|
|
525
|
+
div.figure > img {
|
526
|
+
margin-left: auto;
|
527
|
+
margin-right: auto;
|
528
|
+
display: block;
|
529
|
+
max-width: 100%;
|
530
|
+
height: auto;
|
531
|
+
}
|
532
|
+
|
524
533
|
#toc-list ul {margin-bottom: 0.25em;}
|
525
534
|
|
526
535
|
#toc-list li {list-style-type: none;}
|
@@ -1,7 +1,7 @@
|
|
1
1
|
<script>
|
2
2
|
//TOC generation
|
3
3
|
$('#toc').toc({
|
4
|
-
'selectors':
|
4
|
+
'selectors': toclevel(), //elements to use as headings
|
5
5
|
'container': 'main', //element to find all selectors in
|
6
6
|
'smoothScrolling': true, //enable or disable smooth scrolling on click
|
7
7
|
'prefix': 'toc', //prefix for anchor tags and class names
|
@@ -66,6 +66,7 @@ $('#toggle').on('click', function(){
|
|
66
66
|
!function(A,e){"use strict";"function"==typeof define&&define.amd?define([],e):"object"==typeof module&&module.exports?module.exports=e():(A.AnchorJS=e(),A.anchors=new A.AnchorJS)}(this,function(){"use strict";return function(A){function e(A){A.icon=A.hasOwnProperty("icon")?A.icon:"",A.visible=A.hasOwnProperty("visible")?A.visible:"hover",A.placement=A.hasOwnProperty("placement")?A.placement:"right",A.ariaLabel=A.hasOwnProperty("ariaLabel")?A.ariaLabel:"Anchor",A.class=A.hasOwnProperty("class")?A.class:"",A.truncate=A.hasOwnProperty("truncate")?Math.floor(A.truncate):64}function t(A){var e;if("string"==typeof A||A instanceof String)e=[].slice.call(document.querySelectorAll(A));else{if(!(Array.isArray(A)||A instanceof NodeList))throw new Error("The selector provided to AnchorJS was invalid.");e=[].slice.call(A)}return e}function i(){if(null===document.head.querySelector("style.anchorjs")){var A,e=document.createElement("style");e.className="anchorjs",e.appendChild(document.createTextNode("")),void 0===(A=document.head.querySelector('[rel="stylesheet"], style'))?document.head.appendChild(e):document.head.insertBefore(e,A),e.sheet.insertRule(" .anchorjs-link { opacity: 0; text-decoration: none; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }",e.sheet.cssRules.length),e.sheet.insertRule(" *:hover > .anchorjs-link, .anchorjs-link:focus { opacity: 1; }",e.sheet.cssRules.length),e.sheet.insertRule(" [data-anchorjs-icon]::after { content: attr(data-anchorjs-icon); }",e.sheet.cssRules.length),e.sheet.insertRule(' @font-face { font-family: "anchorjs-icons"; src: url(data:n/a;base64,AAEAAAALAIAAAwAwT1MvMg8yG2cAAAE4AAAAYGNtYXDp3gC3AAABpAAAAExnYXNwAAAAEAAAA9wAAAAIZ2x5ZlQCcfwAAAH4AAABCGhlYWQHFvHyAAAAvAAAADZoaGVhBnACFwAAAPQAAAAkaG10eASAADEAAAGYAAAADGxvY2EACACEAAAB8AAAAAhtYXhwAAYAVwAAARgAAAAgbmFtZQGOH9cAAAMAAAAAunBvc3QAAwAAAAADvAAAACAAAQAAAAEAAHzE2p9fDzz1AAkEAAAAAADRecUWAAAAANQA6R8AAAAAAoACwAAAAAgAAgAAAAAAAAABAAADwP/AAAACgAAA/9MCrQABAAAAAAAAAAAAAAAAAAAAAwABAAAAAwBVAAIAAAAAAAIAAAAAAAAAAAAAAAAAAAAAAAMCQAGQAAUAAAKZAswAAACPApkCzAAAAesAMwEJAAAAAAAAAAAAAAAAAAAAARAAAAAAAAAAAAAAAAAAAAAAQAAg//0DwP/AAEADwABAAAAAAQAAAAAAAAAAAAAAIAAAAAAAAAIAAAACgAAxAAAAAwAAAAMAAAAcAAEAAwAAABwAAwABAAAAHAAEADAAAAAIAAgAAgAAACDpy//9//8AAAAg6cv//f///+EWNwADAAEAAAAAAAAAAAAAAAAACACEAAEAAAAAAAAAAAAAAAAxAAACAAQARAKAAsAAKwBUAAABIiYnJjQ3NzY2MzIWFxYUBwcGIicmNDc3NjQnJiYjIgYHBwYUFxYUBwYGIwciJicmNDc3NjIXFhQHBwYUFxYWMzI2Nzc2NCcmNDc2MhcWFAcHBgYjARQGDAUtLXoWOR8fORYtLTgKGwoKCjgaGg0gEhIgDXoaGgkJBQwHdR85Fi0tOAobCgoKOBoaDSASEiANehoaCQkKGwotLXoWOR8BMwUFLYEuehYXFxYugC44CQkKGwo4GkoaDQ0NDXoaShoKGwoFBe8XFi6ALjgJCQobCjgaShoNDQ0NehpKGgobCgoKLYEuehYXAAAADACWAAEAAAAAAAEACAAAAAEAAAAAAAIAAwAIAAEAAAAAAAMACAAAAAEAAAAAAAQACAAAAAEAAAAAAAUAAQALAAEAAAAAAAYACAAAAAMAAQQJAAEAEAAMAAMAAQQJAAIABgAcAAMAAQQJAAMAEAAMAAMAAQQJAAQAEAAMAAMAAQQJAAUAAgAiAAMAAQQJAAYAEAAMYW5jaG9yanM0MDBAAGEAbgBjAGgAbwByAGoAcwA0ADAAMABAAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAH//wAP) format("truetype"); }',e.sheet.cssRules.length)}}this.options=A||{},this.elements=[],e(this.options),this.isTouchDevice=function(){return!!("ontouchstart"in window||window.DocumentTouch&&document instanceof DocumentTouch)},this.add=function(A){var n,o,s,a,r,c,h,l,u,d,f,p=[];if(e(this.options),"touch"===(f=this.options.visible)&&(f=this.isTouchDevice()?"always":"hover"),A||(A="h2, h3, h4, h5, h6"),0===(n=t(A)).length)return this;for(i(),o=document.querySelectorAll("[id]"),s=[].map.call(o,function(A){return A.id}),r=0;r<n.length;r++)if(this.hasAnchorJSLink(n[r]))p.push(r);else{if(n[r].hasAttribute("id"))a=n[r].getAttribute("id");else if(n[r].hasAttribute("data-anchor-id"))a=n[r].getAttribute("data-anchor-id");else{u=l=this.urlify(n[r].textContent),h=0;do{void 0!==c&&(u=l+"-"+h),c=s.indexOf(u),h+=1}while(-1!==c);c=void 0,s.push(u),n[r].setAttribute("id",u),a=u}a.replace(/-/g," "),(d=document.createElement("a")).className="anchorjs-link "+this.options.class,d.href="#"+a,d.setAttribute("aria-label",this.options.ariaLabel),d.setAttribute("data-anchorjs-icon",this.options.icon),"always"===f&&(d.style.opacity="1"),""===this.options.icon&&(d.style.font="1em/1 anchorjs-icons","left"===this.options.placement&&(d.style.lineHeight="inherit")),"left"===this.options.placement?(d.style.position="absolute",d.style.marginLeft="-1em",d.style.paddingRight="0.5em",n[r].insertBefore(d,n[r].firstChild)):(d.style.paddingLeft="0.375em",n[r].appendChild(d))}for(r=0;r<p.length;r++)n.splice(p[r]-r,1);return this.elements=this.elements.concat(n),this},this.remove=function(A){for(var e,i,n=t(A),o=0;o<n.length;o++)(i=n[o].querySelector(".anchorjs-link"))&&(-1!==(e=this.elements.indexOf(n[o]))&&this.elements.splice(e,1),n[o].removeChild(i));return this},this.removeAll=function(){this.remove(this.elements)},this.urlify=function(A){var t=/[& +$,:;=?@"#{}|^~[`%!'<>\]\.\/\(\)\*\\]/g;return this.options.truncate||e(this.options),A.trim().replace(/\'/gi,"").replace(t,"-").replace(/-{2,}/g,"-").substring(0,this.options.truncate).replace(/^-+|-+$/gm,"").toLowerCase()},this.hasAnchorJSLink=function(A){var e=A.firstChild&&(" "+A.firstChild.className+" ").indexOf(" anchorjs-link ")>-1,t=A.lastChild&&(" "+A.lastChild.className+" ").indexOf(" anchorjs-link ")>-1;return e||t||!1}}}); </script>
|
67
67
|
|
68
68
|
<script>
|
69
|
+
/*
|
69
70
|
$(document).ready(function() {
|
70
71
|
$('[id^=toc]').each(function ()
|
71
72
|
{
|
@@ -74,6 +75,7 @@ $('#toggle').on('click', function(){
|
|
74
75
|
currentToc.wrap("<a href='" + url + "#" + currentToc.attr("id") + "' </a>");
|
75
76
|
});
|
76
77
|
});
|
78
|
+
*/
|
77
79
|
anchors.options = {
|
78
80
|
placement: 'left'
|
79
81
|
};
|
@@ -18,7 +18,7 @@ margin-left:4.25pt;margin-right:4.25pt'>
|
|
18
18
|
|
19
19
|
<p class="MsoNormal" align="center" style='text-align:center;border:none;
|
20
20
|
mso-border-alt:solid windowtext .5pt;padding:0cm;mso-padding-alt:1.0pt 4.0pt 1.0pt 4.0pt'><span
|
21
|
-
lang="EN-GB" style='font-size:16.0pt'>{{
|
21
|
+
lang="EN-GB" style='font-size:16.0pt'>{{ stage }} {{ doctype }}</span></p>
|
22
22
|
|
23
23
|
{% if security %}
|
24
24
|
<p class="MsoNormal" align="center" style='text-align:center;border:none;
|
@@ -39,7 +39,7 @@ mso-border-alt:solid windowtext .5pt;padding:0cm;mso-padding-alt:1.0pt 4.0pt 1.0
|
|
39
39
|
mso-border-alt:solid windowtext .5pt;padding:1.0pt 4.0pt 1.0pt 4.0pt;
|
40
40
|
margin-left:4.25pt;margin-right:4.25pt'>
|
41
41
|
|
42
|
-
{% if
|
42
|
+
{% if stage != "Published" and stage != "Withdrawn" %}
|
43
43
|
<p class="MsoNormal" align="center" style='margin-bottom:6.0pt;text-align:center;
|
44
44
|
border:none;mso-border-alt:solid windowtext .5pt;padding:0cm;mso-padding-alt:
|
45
45
|
1.0pt 4.0pt 1.0pt 4.0pt'><b style='mso-bidi-font-weight:normal'><span
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require "isodoc/
|
1
|
+
require "isodoc/html_convert"
|
2
2
|
require_relative "metadata"
|
3
3
|
|
4
4
|
module IsoDoc
|
@@ -7,46 +7,43 @@ module IsoDoc
|
|
7
7
|
# A {Converter} implementation that generates HTML output, and a document
|
8
8
|
# schema encapsulation of the document for validation
|
9
9
|
#
|
10
|
-
class HtmlConvert < IsoDoc::
|
11
|
-
def
|
12
|
-
File.
|
10
|
+
class HtmlConvert < IsoDoc::HtmlConvert
|
11
|
+
def initialize(options)
|
12
|
+
@libdir ||= File.dirname(__FILE__)
|
13
|
+
super
|
13
14
|
end
|
14
15
|
|
15
|
-
def
|
16
|
+
def convert1(docxml, filename, dir)
|
17
|
+
FileUtils.cp html_doc_path('logo.png'), File.join(@localdir, "logo.png")
|
18
|
+
@files_to_delete << File.join(@localdir, "logo.png")
|
16
19
|
super
|
17
|
-
@htmlstylesheet = generate_css(vsd_html_path("htmlstyle.scss"), true, default_fonts(options))
|
18
|
-
@htmlcoverpage = vsd_html_path("html_vsd_titlepage.html")
|
19
|
-
@htmlintropage = vsd_html_path("html_vsd_intro.html")
|
20
|
-
@scripts = vsd_html_path("scripts.html")
|
21
|
-
system "cp #{vsd_html_path('logo.png')} logo.png"
|
22
|
-
@files_to_delete << "logo.png"
|
23
20
|
end
|
24
21
|
|
25
22
|
def default_fonts(options)
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
'"Overpass",sans-serif')
|
32
|
-
m = options[:monospacefont] || '"Space Mono",monospace'
|
33
|
-
"$bodyfont: #{b};\n$headerfont: #{h};\n$monospacefont: #{m};\n"
|
23
|
+
{
|
24
|
+
bodyfont: (options[:script] == "Hans" ? '"SimSun",serif' : '"Overpass",sans-serif'),
|
25
|
+
headerfont: (options[:script] == "Hans" ? '"SimHei",sans-serif' : '"Overpass",sans-serif'),
|
26
|
+
monospacefont: '"Space Mono",monospace'
|
27
|
+
}
|
34
28
|
end
|
35
29
|
|
36
|
-
def
|
37
|
-
|
38
|
-
|
30
|
+
def default_file_locations(_options)
|
31
|
+
{
|
32
|
+
htmlstylesheet: html_doc_path("htmlstyle.scss"),
|
33
|
+
htmlcoverpage: html_doc_path("html_vsd_titlepage.html"),
|
34
|
+
htmlintropage: html_doc_path("html_vsd_intro.html"),
|
35
|
+
scripts: html_doc_path("scripts.html"),
|
36
|
+
}
|
37
|
+
end
|
39
38
|
|
40
|
-
|
41
|
-
|
39
|
+
def metadata_init(lang, script, labels)
|
40
|
+
@meta = Metadata.new(lang, script, labels)
|
41
|
+
end
|
42
42
|
|
43
|
-
|
43
|
+
def googlefonts
|
44
|
+
<<~HEAD.freeze
|
44
45
|
<link href="https://fonts.googleapis.com/css?family=Open+Sans:300,300i,400,400i,600,600i|Space+Mono:400,700" rel="stylesheet">
|
45
46
|
<link href="https://fonts.googleapis.com/css?family=Overpass:300,300i,600,900" rel="stylesheet">
|
46
|
-
<!--Font awesome import for the link icon-->
|
47
|
-
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.0.8/css/solid.css" integrity="sha384-v2Tw72dyUXeU3y4aM2Y0tBJQkGfplr39mxZqlTBDUZAb9BGoC40+rdFCG0m10lXk" crossorigin="anonymous">
|
48
|
-
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.0.8/css/fontawesome.css" integrity="sha384-q3jl8XQu1OpdLgGFvNRnPdj5VIlCvgsDQTQB6owSOHWlAurxul7f+JpUOVdAiJ5P" crossorigin="anonymous">
|
49
|
-
<style class="anchorjs"></style>
|
50
47
|
HEAD
|
51
48
|
end
|
52
49
|
|
@@ -58,7 +55,6 @@ module IsoDoc
|
|
58
55
|
make_body3(body, docxml)
|
59
56
|
end
|
60
57
|
end
|
61
|
-
|
62
58
|
end
|
63
59
|
end
|
64
60
|
end
|
data/lib/isodoc/vsd/metadata.rb
CHANGED
@@ -1,10 +1,16 @@
|
|
1
1
|
require "isodoc"
|
2
|
-
require "isodoc/rsd/metadata"
|
3
2
|
|
4
3
|
module IsoDoc
|
5
4
|
module Vsd
|
5
|
+
class Metadata < IsoDoc::Metadata
|
6
6
|
|
7
|
-
|
7
|
+
def security(isoxml, _out)
|
8
|
+
keywords = []
|
9
|
+
isoxml.xpath(ns("//bibdata/keyword")).each do |kw|
|
10
|
+
keywords << kw.text
|
11
|
+
end
|
12
|
+
set(:keywords, keywords)
|
13
|
+
end
|
8
14
|
|
9
15
|
end
|
10
16
|
end
|
@@ -1,51 +1,41 @@
|
|
1
|
-
require "isodoc"
|
2
|
-
require "isodoc/rsd/pdf_convert"
|
1
|
+
require "isodoc/pdf_convert"
|
3
2
|
require_relative "metadata"
|
4
3
|
|
5
4
|
module IsoDoc
|
6
5
|
module Vsd
|
7
6
|
# A {Converter} implementation that generates PDF HTML output, and a
|
8
7
|
# document schema encapsulation of the document for validation
|
9
|
-
class PdfConvert < IsoDoc::
|
10
|
-
def vsd_html_path(file)
|
11
|
-
File.join(File.dirname(__FILE__), File.join("html", file))
|
12
|
-
end
|
13
|
-
|
8
|
+
class PdfConvert < IsoDoc::PdfConvert
|
14
9
|
def initialize(options)
|
10
|
+
@libdir ||= File.dirname(__FILE__)
|
15
11
|
super
|
16
|
-
@htmlstylesheet = generate_css(vsd_html_path("htmlstyle.scss"), true, default_fonts(options))
|
17
|
-
@htmlcoverpage = vsd_html_path("html_vsd_titlepage.html")
|
18
|
-
@htmlintropage = vsd_html_path("html_vsd_intro.html")
|
19
|
-
@scripts = vsd_html_path("scripts.html")
|
20
|
-
system "cp #{vsd_html_path('logo.png')} logo.png"
|
21
|
-
@files_to_delete << "logo.png"
|
22
12
|
end
|
23
13
|
|
24
14
|
def default_fonts(options)
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
'"Overpass",sans-serif')
|
31
|
-
m = options[:monospacefont] || '"Space Mono",monospace'
|
32
|
-
"$bodyfont: #{b};\n$headerfont: #{h};\n$monospacefont: #{m};\n"
|
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
|
+
}
|
33
20
|
end
|
34
21
|
|
35
|
-
def
|
36
|
-
|
37
|
-
|
22
|
+
def default_file_locations(_options)
|
23
|
+
{
|
24
|
+
htmlstylesheet: html_doc_path("htmlstyle.scss"),
|
25
|
+
htmlcoverpage: html_doc_path("html_vsd_titlepage.html"),
|
26
|
+
htmlintropage: html_doc_path("html_vsd_intro.html"),
|
27
|
+
scripts: html_doc_path("scripts.html"),
|
28
|
+
}
|
29
|
+
end
|
38
30
|
|
39
|
-
|
40
|
-
|
31
|
+
def metadata_init(lang, script, labels)
|
32
|
+
@meta = Metadata.new(lang, script, labels)
|
33
|
+
end
|
41
34
|
|
42
|
-
|
35
|
+
def googlefonts
|
36
|
+
<<~HEAD.freeze
|
43
37
|
<link href="https://fonts.googleapis.com/css?family=Open+Sans:300,300i,400,400i,600,600i|Space+Mono:400,700" rel="stylesheet">
|
44
38
|
<link href="https://fonts.googleapis.com/css?family=Overpass:300,300i,600,900" rel="stylesheet">
|
45
|
-
<!--Font awesome import for the link icon-->
|
46
|
-
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.0.8/css/solid.css" integrity="sha384-v2Tw72dyUXeU3y4aM2Y0tBJQkGfplr39mxZqlTBDUZAb9BGoC40+rdFCG0m10lXk" crossorigin="anonymous">
|
47
|
-
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.0.8/css/fontawesome.css" integrity="sha384-q3jl8XQu1OpdLgGFvNRnPdj5VIlCvgsDQTQB6owSOHWlAurxul7f+JpUOVdAiJ5P" crossorigin="anonymous">
|
48
|
-
<style class="anchorjs"></style>
|
49
39
|
HEAD
|
50
40
|
end
|
51
41
|
|
@@ -1,5 +1,4 @@
|
|
1
|
-
require "isodoc"
|
2
|
-
require "isodoc/rsd/word_convert"
|
1
|
+
require "isodoc/word_convert"
|
3
2
|
require_relative "metadata"
|
4
3
|
|
5
4
|
module IsoDoc
|
@@ -7,33 +6,34 @@ module IsoDoc
|
|
7
6
|
# A {Converter} implementation that generates Word output, and a document
|
8
7
|
# schema encapsulation of the document for validation
|
9
8
|
|
10
|
-
class WordConvert < IsoDoc::
|
11
|
-
def vsd_html_path(file)
|
12
|
-
File.join(File.dirname(__FILE__), File.join("html", file))
|
13
|
-
end
|
14
|
-
|
9
|
+
class WordConvert < IsoDoc::WordConvert
|
15
10
|
def initialize(options)
|
11
|
+
@libdir ||= File.dirname(__FILE__)
|
16
12
|
super
|
17
|
-
@wordstylesheet = generate_css(vsd_html_path("wordstyle.scss"), false, default_fonts(options))
|
18
|
-
@standardstylesheet = generate_css(vsd_html_path("vsd.scss"), false, default_fonts(options))
|
19
|
-
@header = vsd_html_path("header.html")
|
20
|
-
@wordcoverpage = vsd_html_path("word_vsd_titlepage.html")
|
21
|
-
@wordintropage = vsd_html_path("word_vsd_intro.html")
|
22
|
-
@ulstyle = "l3"
|
23
|
-
@olstyle = "l2"
|
24
|
-
system "cp #{vsd_html_path('logo.png')} logo.png"
|
25
|
-
@files_to_delete << "logo.png"
|
26
13
|
end
|
27
14
|
|
28
15
|
def default_fonts(options)
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
16
|
+
{
|
17
|
+
bodyfont: (options[:script] == "Hans" ? '"SimSun",serif' : '"Arial",sans-serif'),
|
18
|
+
headerfont: (options[:script] == "Hans" ? '"SimHei",sans-serif' : '"Arial",sans-serif'),
|
19
|
+
monospacefont: '"Courier New",monospace'
|
20
|
+
}
|
21
|
+
end
|
22
|
+
|
23
|
+
def default_file_locations(options)
|
24
|
+
{
|
25
|
+
wordstylesheet: html_doc_path("wordstyle.scss"),
|
26
|
+
standardstylesheet: html_doc_path("vsd.scss"),
|
27
|
+
header: html_doc_path("header.html"),
|
28
|
+
wordcoverpage: html_doc_path("word_vsd_titlepage.html"),
|
29
|
+
wordintropage: html_doc_path("word_vsd_intro.html"),
|
30
|
+
ulstyle: "l3",
|
31
|
+
olstyle: "l2",
|
32
|
+
}
|
33
|
+
end
|
34
|
+
|
35
|
+
def metadata_init(lang, script, labels)
|
36
|
+
@meta = Metadata.new(lang, script, labels)
|
37
37
|
end
|
38
38
|
|
39
39
|
def make_body(xml, docxml)
|
@@ -1,8 +1,8 @@
|
|
1
|
-
require "metanorma/
|
1
|
+
require "metanorma/processor"
|
2
2
|
|
3
3
|
module Metanorma
|
4
4
|
module Vsd
|
5
|
-
class Processor < Metanorma::
|
5
|
+
class Processor < Metanorma::Processor
|
6
6
|
|
7
7
|
def initialize
|
8
8
|
@short = :vsd
|
@@ -22,8 +22,8 @@ module Metanorma
|
|
22
22
|
"Metanorma::Vsd #{Metanorma::Vsd::VERSION}"
|
23
23
|
end
|
24
24
|
|
25
|
-
def input_to_isodoc(file)
|
26
|
-
Metanorma::Input::Asciidoc.new.process(file, @asciidoctor_backend)
|
25
|
+
def input_to_isodoc(file, filename)
|
26
|
+
Metanorma::Input::Asciidoc.new.process(file, filename, @asciidoctor_backend)
|
27
27
|
end
|
28
28
|
|
29
29
|
def output(isodoc_node, outname, format, options={})
|
data/metanorma-vsd.gemspec
CHANGED
@@ -15,7 +15,7 @@ Gem::Specification.new do |spec|
|
|
15
15
|
This gem is in active development.
|
16
16
|
DESCRIPTION
|
17
17
|
|
18
|
-
spec.homepage = "https://github.com/
|
18
|
+
spec.homepage = "https://github.com/metanorma/metanorma-vsd"
|
19
19
|
spec.license = "BSD-2-Clause"
|
20
20
|
|
21
21
|
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
@@ -24,16 +24,16 @@ Gem::Specification.new do |spec|
|
|
24
24
|
spec.bindir = "exe"
|
25
25
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
26
26
|
spec.require_paths = ["lib"]
|
27
|
+
spec.required_ruby_version = Gem::Requirement.new(">= 2.4.0")
|
27
28
|
|
28
29
|
spec.add_dependency "asciidoctor", "~> 1.5.7"
|
29
30
|
spec.add_dependency "htmlentities", "~> 4.3.4"
|
30
31
|
spec.add_dependency "nokogiri"
|
31
|
-
spec.add_dependency "
|
32
|
-
spec.add_dependency "asciidoctor-rsd", "~> 0.3.3"
|
32
|
+
spec.add_dependency "metanorma-iso", "~> 1.2.0"
|
33
33
|
spec.add_dependency "metanorma"
|
34
|
-
spec.add_dependency "isodoc", "
|
34
|
+
spec.add_dependency "isodoc", "~> 0.10.0"
|
35
35
|
|
36
|
-
spec.add_development_dependency "bundler", "~>
|
36
|
+
spec.add_development_dependency "bundler", "~> 2"
|
37
37
|
spec.add_development_dependency "byebug", "~> 9.1"
|
38
38
|
spec.add_development_dependency "equivalent-xml", "~> 0.6"
|
39
39
|
spec.add_development_dependency "guard", "~> 2.14"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: metanorma-vsd
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ribose Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-07-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: asciidoctor
|
@@ -53,33 +53,19 @@ dependencies:
|
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
|
-
name:
|
56
|
+
name: metanorma-iso
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version:
|
61
|
+
version: 1.2.0
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version:
|
69
|
-
- !ruby/object:Gem::Dependency
|
70
|
-
name: asciidoctor-rsd
|
71
|
-
requirement: !ruby/object:Gem::Requirement
|
72
|
-
requirements:
|
73
|
-
- - "~>"
|
74
|
-
- !ruby/object:Gem::Version
|
75
|
-
version: 0.3.3
|
76
|
-
type: :runtime
|
77
|
-
prerelease: false
|
78
|
-
version_requirements: !ruby/object:Gem::Requirement
|
79
|
-
requirements:
|
80
|
-
- - "~>"
|
81
|
-
- !ruby/object:Gem::Version
|
82
|
-
version: 0.3.3
|
68
|
+
version: 1.2.0
|
83
69
|
- !ruby/object:Gem::Dependency
|
84
70
|
name: metanorma
|
85
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -98,30 +84,30 @@ dependencies:
|
|
98
84
|
name: isodoc
|
99
85
|
requirement: !ruby/object:Gem::Requirement
|
100
86
|
requirements:
|
101
|
-
- - "
|
87
|
+
- - "~>"
|
102
88
|
- !ruby/object:Gem::Version
|
103
|
-
version: 0.
|
89
|
+
version: 0.10.0
|
104
90
|
type: :runtime
|
105
91
|
prerelease: false
|
106
92
|
version_requirements: !ruby/object:Gem::Requirement
|
107
93
|
requirements:
|
108
|
-
- - "
|
94
|
+
- - "~>"
|
109
95
|
- !ruby/object:Gem::Version
|
110
|
-
version: 0.
|
96
|
+
version: 0.10.0
|
111
97
|
- !ruby/object:Gem::Dependency
|
112
98
|
name: bundler
|
113
99
|
requirement: !ruby/object:Gem::Requirement
|
114
100
|
requirements:
|
115
101
|
- - "~>"
|
116
102
|
- !ruby/object:Gem::Version
|
117
|
-
version: '
|
103
|
+
version: '2'
|
118
104
|
type: :development
|
119
105
|
prerelease: false
|
120
106
|
version_requirements: !ruby/object:Gem::Requirement
|
121
107
|
requirements:
|
122
108
|
- - "~>"
|
123
109
|
- !ruby/object:Gem::Version
|
124
|
-
version: '
|
110
|
+
version: '2'
|
125
111
|
- !ruby/object:Gem::Dependency
|
126
112
|
name: byebug
|
127
113
|
requirement: !ruby/object:Gem::Requirement
|
@@ -265,6 +251,7 @@ files:
|
|
265
251
|
- LICENSE
|
266
252
|
- README.adoc
|
267
253
|
- Rakefile
|
254
|
+
- appveyor.yml
|
268
255
|
- bin/console
|
269
256
|
- bin/rspec
|
270
257
|
- bin/setup
|
@@ -273,7 +260,6 @@ files:
|
|
273
260
|
- lib/asciidoctor/vsd/converter.rb
|
274
261
|
- lib/asciidoctor/vsd/isodoc.rng
|
275
262
|
- lib/asciidoctor/vsd/isostandard.rng
|
276
|
-
- lib/asciidoctor/vsd/pdf.js
|
277
263
|
- lib/asciidoctor/vsd/vsd.rng
|
278
264
|
- lib/isodoc/vsd.rb
|
279
265
|
- lib/isodoc/vsd/html/header.html
|
@@ -295,7 +281,7 @@ files:
|
|
295
281
|
- lib/metanorma/vsd/processor.rb
|
296
282
|
- lib/metanorma/vsd/version.rb
|
297
283
|
- metanorma-vsd.gemspec
|
298
|
-
homepage: https://github.com/
|
284
|
+
homepage: https://github.com/metanorma/metanorma-vsd
|
299
285
|
licenses:
|
300
286
|
- BSD-2-Clause
|
301
287
|
metadata: {}
|
@@ -307,7 +293,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
307
293
|
requirements:
|
308
294
|
- - ">="
|
309
295
|
- !ruby/object:Gem::Version
|
310
|
-
version:
|
296
|
+
version: 2.4.0
|
311
297
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
312
298
|
requirements:
|
313
299
|
- - ">="
|
@@ -315,7 +301,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
315
301
|
version: '0'
|
316
302
|
requirements: []
|
317
303
|
rubyforge_project:
|
318
|
-
rubygems_version: 2.7.
|
304
|
+
rubygems_version: 2.7.6
|
319
305
|
signing_key:
|
320
306
|
specification_version: 4
|
321
307
|
summary: metanorma-vsd lets you write RSD in Metanorma.
|
data/lib/asciidoctor/vsd/pdf.js
DELETED
@@ -1,31 +0,0 @@
|
|
1
|
-
'use strict';
|
2
|
-
|
3
|
-
try {
|
4
|
-
require.resolve("puppeteer");
|
5
|
-
} catch(e) {
|
6
|
-
console.error("puppeteer Node library is not installed; will not generate PDF");
|
7
|
-
process.exit(e.code);
|
8
|
-
}
|
9
|
-
|
10
|
-
const puppeteer = require('puppeteer');
|
11
|
-
|
12
|
-
const createPdf = async() => {
|
13
|
-
let browser;
|
14
|
-
try {
|
15
|
-
browser = await puppeteer.launch({args: ['--no-sandbox', '--disable-setuid-sandbox']});
|
16
|
-
const page = await browser.newPage();
|
17
|
-
await page.goto(process.argv[2], {waitUntil: 'networkidle2'});
|
18
|
-
await page.pdf({
|
19
|
-
path: process.argv[3],
|
20
|
-
format: 'A4'
|
21
|
-
});
|
22
|
-
} catch (err) {
|
23
|
-
console.log(err.message);
|
24
|
-
} finally {
|
25
|
-
if (browser) {
|
26
|
-
browser.close();
|
27
|
-
}
|
28
|
-
process.exit();
|
29
|
-
}
|
30
|
-
};
|
31
|
-
createPdf();
|