asciidoctor-rsd 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,174 @@
1
+ require "asciidoctor"
2
+ require "asciidoctor/rsd/version"
3
+ require "asciidoctor/rsd/rsdconvert"
4
+ require "asciidoctor/iso/converter"
5
+
6
+ module Asciidoctor
7
+ module Rsd
8
+ RSD_NAMESPACE = "https://open.ribose.com/standards/rsd"
9
+
10
+ # A {Converter} implementation that generates RSD output, and a document
11
+ # schema encapsulation of the document for validation
12
+ class Converter < ISO::Converter
13
+
14
+ register_for "rsd"
15
+
16
+ def metadata_author(node, xml)
17
+ xml.contributor do |c|
18
+ c.role **{ type: "author" }
19
+ c.organization do |a|
20
+ a.name "CalConnect"
21
+ end
22
+ end
23
+ end
24
+
25
+ def metadata_publisher(node, xml)
26
+ xml.contributor do |c|
27
+ c.role **{ type: "publisher" }
28
+ c.organization do |a|
29
+ a.name "CalConnect"
30
+ end
31
+ end
32
+ end
33
+
34
+ def metadata_committee(node, xml)
35
+ xml.editorialgroup do |a|
36
+ a.technical_committee node.attr("technical-committee"),
37
+ **attr_code(type: node.attr("technical-committee-type"))
38
+ end
39
+ end
40
+
41
+ def title(node, xml)
42
+ ["en"].each do |lang|
43
+ xml.title **{ language: lang, format: "plain" } do |t|
44
+ t << asciidoc_sub(node.attr("title"))
45
+ end
46
+ end
47
+ end
48
+
49
+ def metadata_status(node, xml)
50
+ xml.status **{ format: "plain" } { |s| s << node.attr("status") }
51
+ end
52
+
53
+ def metadata_id(node, xml)
54
+ xml.docidentifier { |i| i << node.attr("docnumber") }
55
+ end
56
+
57
+ def metadata_copyright(node, xml)
58
+ from = node.attr("copyright-year") || Date.today.year
59
+ xml.copyright do |c|
60
+ c.from from
61
+ c.owner do |owner|
62
+ owner.organization do |o|
63
+ o.name "CalConnect"
64
+ end
65
+ end
66
+ end
67
+ end
68
+
69
+ def title_validate(root)
70
+ nil
71
+ end
72
+
73
+ def makexml(node)
74
+ result = ["<?xml version='1.0' encoding='UTF-8'?>\n<rsd-standard>"]
75
+ @draft = node.attributes.has_key?("draft")
76
+ result << noko { |ixml| front node, ixml }
77
+ result << noko { |ixml| middle node, ixml }
78
+ result << "</rsd-standard>"
79
+ result = textcleanup(result.flatten * "\n")
80
+ ret1 = cleanup(Nokogiri::XML(result))
81
+ validate(ret1)
82
+ ret1.root.add_namespace(nil, RSD_NAMESPACE)
83
+ ret1
84
+ end
85
+
86
+ def document(node)
87
+ init(node)
88
+ ret1 = makexml(node)
89
+ ret = ret1.to_xml(indent: 2)
90
+ filename = node.attr("docfile").gsub(/\.adoc/, ".xml").
91
+ gsub(%r{^.*/}, "")
92
+ File.open(filename, "w") { |f| f.write(ret) }
93
+ html_converter(node).convert filename unless node.attr("nodoc")
94
+ @files_to_delete.each { |f| system "rm #{f}" }
95
+ ret
96
+ end
97
+
98
+ def validate(doc)
99
+ content_validate(doc)
100
+ schema_validate(formattedstr_strip(doc.dup),
101
+ File.join(File.dirname(__FILE__), "rsd.rng"))
102
+ end
103
+
104
+ def html_doc_path(file)
105
+ File.join(File.dirname(__FILE__), File.join("html", file))
106
+ end
107
+
108
+ def literal(node)
109
+ noko do |xml|
110
+ xml.figure **id_attr(node) do |f|
111
+ figure_title(node, f)
112
+ f.pre node.lines.join("\n")
113
+ end
114
+ end
115
+ end
116
+
117
+ def sections_cleanup(x)
118
+ super
119
+ x.xpath("//*[@inline-header]").each do |h|
120
+ h.delete("inline-header")
121
+ end
122
+ end
123
+
124
+ def style(n, t)
125
+ return
126
+ end
127
+
128
+ def html_converter(_node)
129
+ RsdConvert.new(
130
+ htmlstylesheet: generate_css(html_doc_path("htmlstyle.scss"), true),
131
+ standardstylesheet: generate_css(html_doc_path("rsd.scss"), true),
132
+ htmlcoverpage: html_doc_path("html_rsd_titlepage.html"),
133
+ htmlintropage: html_doc_path("html_rsd_intro.html"),
134
+ scripts: html_doc_path("scripts.html"),
135
+ )
136
+ end
137
+
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
+ def inline_quoted(node)
150
+ noko do |xml|
151
+ case node.type
152
+ when :emphasis then xml.em node.text
153
+ when :strong then xml.strong node.text
154
+ when :monospaced then xml.tt node.text
155
+ when :double then xml << "\"#{node.text}\""
156
+ when :single then xml << "'#{node.text}'"
157
+ when :superscript then xml.sup node.text
158
+ when :subscript then xml.sub node.text
159
+ when :asciimath then stem_parse(node.text, xml)
160
+ else
161
+ case node.role
162
+ when "strike" then xml.strike node.text
163
+ when "smallcap" then xml.smallcap node.text
164
+ when "keyword" then xml.keyword node.text
165
+ else
166
+ xml << node.text
167
+ end
168
+ end
169
+ end.join
170
+ end
171
+
172
+ end
173
+ end
174
+ end
@@ -0,0 +1,184 @@
1
+ <html xmlns:v="urn:schemas-microsoft-com:vml"
2
+ xmlns:o="urn:schemas-microsoft-com:office:office"
3
+ xmlns:w="urn:schemas-microsoft-com:office:word"
4
+ xmlns:m="http://schemas.microsoft.com/office/2004/12/omml"
5
+ xmlns:mv="http://macVmlSchemaUri" xmlns="http://www.w3.org/TR/REC-html40">
6
+
7
+ <head>
8
+ <meta name=Title content="">
9
+ <meta name=Keywords content="">
10
+ <meta http-equiv=Content-Type content="text/html; charset=utf-8">
11
+ <meta name=ProgId content=Word.Document>
12
+ <meta name=Generator content="Microsoft Word 15">
13
+ <meta name=Originator content="Microsoft Word 15">
14
+ <link id=Main-File rel=Main-File href="../{{ filename }}.html">
15
+ <!--[if gte mso 9]><xml>
16
+ <o:shapedefaults v:ext="edit" spidmax="2049"/>
17
+ </xml><![endif]-->
18
+ </head>
19
+
20
+ <body lang=EN link=blue vlink="#954F72">
21
+
22
+ <div style='mso-element:footnote-separator' id=fs>
23
+
24
+ <p class=MsoNormal style='margin-bottom:0cm;margin-bottom:.0001pt;line-height:
25
+ normal'><span lang=EN-GB><span style='mso-special-character:footnote-separator'><![if !supportFootnotes]>
26
+
27
+ <hr align=left size=1 width="33%">
28
+
29
+ <![endif]></span></span></p>
30
+
31
+ </div>
32
+
33
+ <div style='mso-element:footnote-continuation-separator' id=fcs>
34
+
35
+ <p class=MsoNormal style='margin-bottom:0cm;margin-bottom:.0001pt;line-height:
36
+ normal'><span lang=EN-GB><span style='mso-special-character:footnote-continuation-separator'><![if !supportFootnotes]>
37
+
38
+ <hr align=left size=1>
39
+
40
+ <![endif]></span></span></p>
41
+
42
+ </div>
43
+
44
+ <div style='mso-element:endnote-separator' id=es>
45
+
46
+ <p class=MsoNormal style='margin-bottom:0cm;margin-bottom:.0001pt;line-height:
47
+ normal'><span lang=EN-GB><span style='mso-special-character:footnote-separator'><![if !supportFootnotes]>
48
+
49
+ <hr align=left size=1 width="33%">
50
+
51
+ <![endif]></span></span></p>
52
+
53
+ </div>
54
+
55
+ <div style='mso-element:endnote-continuation-separator' id=ecs>
56
+
57
+ <p class=MsoNormal style='margin-bottom:0cm;margin-bottom:.0001pt;line-height:
58
+ normal'><span lang=EN-GB><span style='mso-special-character:footnote-continuation-separator'><![if !supportFootnotes]>
59
+
60
+ <hr align=left size=1>
61
+
62
+ <![endif]></span></span></p>
63
+
64
+ </div>
65
+
66
+ <div style='mso-element:header' id=eh1>
67
+
68
+ <p class=MsoHeader align=left style='text-align:left;line-height:12.0pt;
69
+ mso-line-height-rule:exactly'><span lang=EN-GB>CS&nbsp;{{ docnumber }}:{{ docyear }}</span></p>
70
+
71
+ </div>
72
+
73
+ <div style='mso-element:header' id=h1>
74
+
75
+ <p class=MsoHeader style='margin-bottom:18.0pt'><span lang=EN-GB
76
+ style='font-size:10.0pt;mso-bidi-font-size:11.0pt;font-weight:normal'>©
77
+ The Calendaring and Scheduling Consortium, Inc.&nbsp;{{ docyear }}&nbsp;– All rights reserved</span><span lang=EN-GB
78
+ style='font-weight:normal'><o:p></o:p></span></p>
79
+
80
+ </div>
81
+
82
+ <div style='mso-element:footer' id=ef1>
83
+
84
+ <p class=MsoFooter style='margin-top:12.0pt;line-height:12.0pt;mso-line-height-rule:
85
+ exactly'><!--[if supportFields]><b style='mso-bidi-font-weight:normal'><span
86
+ lang=EN-GB style='font-size:10.0pt;mso-bidi-font-size:11.0pt'><span
87
+ style='mso-element:field-begin'></span><span
88
+ style='mso-spacerun:yes'> </span>PAGE<span style='mso-spacerun:yes'>  
89
+ </span>\* MERGEFORMAT <span style='mso-element:field-separator'></span></span></b><![endif]--><b
90
+ style='mso-bidi-font-weight:normal'><span lang=EN-GB style='font-size:10.0pt;
91
+ mso-bidi-font-size:11.0pt'><span style='mso-no-proof:yes'>2</span></span></b><!--[if supportFields]><b
92
+ style='mso-bidi-font-weight:normal'><span lang=EN-GB style='font-size:10.0pt;
93
+ mso-bidi-font-size:11.0pt'><span style='mso-element:field-end'></span></span></b><![endif]--><span
94
+ lang=EN-GB style='font-size:10.0pt;mso-bidi-font-size:11.0pt'><span
95
+ style='mso-tab-count:1'>                                                                                                                                                                           </span>©
96
+ The Calendaring and Scheduling Consortium, Inc.&nbsp;{{ docyear }}&nbsp;– All rights reserved<o:p></o:p></span></p>
97
+
98
+ </div>
99
+
100
+ <div style='mso-element:header' id=eh2>
101
+
102
+ <p class=MsoHeader align=left style='text-align:left;line-height:12.0pt;
103
+ mso-line-height-rule:exactly'><span lang=EN-GB>The Calendaring and Scheduling Consortium, Inc.&nbsp;{{ docnumber }}:{{ docyear }}</span></p>
104
+
105
+ </div>
106
+
107
+ <div style='mso-element:header' id=h2>
108
+
109
+ <p class=MsoHeader align=right style='text-align:right;line-height:12.0pt;
110
+ mso-line-height-rule:exactly'><span lang=EN-GB>The Calendaring and Scheduling Consortium, Inc.&nbsp;{{ docnumber }}:{{ docyear }}</span></p>
111
+
112
+ </div>
113
+
114
+ <div style='mso-element:footer' id=ef2>
115
+
116
+ <p class=MsoFooter style='line-height:12.0pt;mso-line-height-rule:exactly'><!--[if supportFields]><span
117
+ lang=EN-GB style='font-size:10.0pt;mso-bidi-font-size:11.0pt'><span
118
+ style='mso-element:field-begin'></span><span
119
+ style='mso-spacerun:yes'> </span>PAGE<span style='mso-spacerun:yes'>  
120
+ </span>\* MERGEFORMAT <span style='mso-element:field-separator'></span></span><![endif]--><span
121
+ lang=EN-GB style='font-size:10.0pt;mso-bidi-font-size:11.0pt'><span
122
+ style='mso-no-proof:yes'>ii</span></span><!--[if supportFields]><span
123
+ lang=EN-GB style='font-size:10.0pt;mso-bidi-font-size:11.0pt'><span
124
+ style='mso-element:field-end'></span></span><![endif]--><span lang=EN-GB
125
+ style='font-size:10.0pt;mso-bidi-font-size:11.0pt'><span style='mso-tab-count:
126
+ 1'>                                                                                                                                                                           </span>©
127
+ The Calendaring and Scheduling Consortium, Inc.&nbsp;{{ docyear }}&nbsp;– All rights reserved<o:p></o:p></span></p>
128
+
129
+ </div>
130
+
131
+ <div style='mso-element:footer' id=f2>
132
+
133
+ <p class=MsoFooter style='line-height:12.0pt'><span lang=EN-GB
134
+ style='font-size:10.0pt;mso-bidi-font-size:11.0pt'>© The Calendaring and Scheduling Consortium, Inc.&nbsp;{{ docyear }}&nbsp;– All
135
+ rights reserved<span style='mso-tab-count:1'>                                                                                                                                                                          </span></span><!--[if supportFields]><span
136
+ lang=EN-GB style='font-size:10.0pt;mso-bidi-font-size:11.0pt'><span
137
+ style='mso-element:field-begin'></span> PAGE<span style='mso-spacerun:yes'>  
138
+ </span>\* MERGEFORMAT <span style='mso-element:field-separator'></span></span><![endif]--><span
139
+ lang=EN-GB style='font-size:10.0pt;mso-bidi-font-size:11.0pt'><span
140
+ style='mso-no-proof:yes'>iii</span></span><!--[if supportFields]><span
141
+ lang=EN-GB style='font-size:10.0pt;mso-bidi-font-size:11.0pt'><span
142
+ style='mso-element:field-end'></span></span><![endif]--><span lang=EN-GB
143
+ style='font-size:10.0pt;mso-bidi-font-size:11.0pt'><o:p></o:p></span></p>
144
+
145
+ </div>
146
+
147
+ <div style='mso-element:footer' id=ef3>
148
+
149
+ <p class=MsoFooter style='margin-top:12.0pt;line-height:12.0pt;mso-line-height-rule:
150
+ exactly'><!--[if supportFields]><b style='mso-bidi-font-weight:normal'><span
151
+ lang=EN-GB style='font-size:10.0pt;mso-bidi-font-size:11.0pt'><span
152
+ style='mso-element:field-begin'></span><span
153
+ style='mso-spacerun:yes'> </span>PAGE<span style='mso-spacerun:yes'>  
154
+ </span>\* MERGEFORMAT <span style='mso-element:field-separator'></span></span></b><![endif]--><b
155
+ style='mso-bidi-font-weight:normal'><span lang=EN-GB style='font-size:10.0pt;
156
+ mso-bidi-font-size:11.0pt'><span style='mso-no-proof:yes'>2</span></span></b><!--[if supportFields]><b
157
+ style='mso-bidi-font-weight:normal'><span lang=EN-GB style='font-size:10.0pt;
158
+ mso-bidi-font-size:11.0pt'><span style='mso-element:field-end'></span></span></b><![endif]--><span
159
+ lang=EN-GB style='font-size:10.0pt;mso-bidi-font-size:11.0pt'><span
160
+ style='mso-tab-count:1'>                                                                                                                                                                           </span>©
161
+ The Calendaring and Scheduling Consortium, Inc.&nbsp;{{ docyear }}&nbsp;– All rights reserved<o:p></o:p></span></p>
162
+
163
+ </div>
164
+
165
+ <div style='mso-element:footer' id=f3>
166
+
167
+ <p class=MsoFooter style='line-height:12.0pt'><span lang=EN-GB
168
+ style='font-size:10.0pt;mso-bidi-font-size:11.0pt'>© The Calendaring and Scheduling Consortium, Inc.&nbsp;{{ docyear }}&nbsp;– All
169
+ rights reserved<span style='mso-tab-count:1'>                                                                                                                                                                           </span></span><!--[if supportFields]><b
170
+ style='mso-bidi-font-weight:normal'><span lang=EN-GB style='font-size:10.0pt;
171
+ mso-bidi-font-size:11.0pt'><span style='mso-element:field-begin'></span>
172
+ PAGE<span style='mso-spacerun:yes'>   </span>\* MERGEFORMAT <span
173
+ style='mso-element:field-separator'></span></span></b><![endif]--><b
174
+ style='mso-bidi-font-weight:normal'><span lang=EN-GB style='font-size:10.0pt;
175
+ mso-bidi-font-size:11.0pt'><span style='mso-no-proof:yes'>3</span></span></b><!--[if supportFields]><b
176
+ style='mso-bidi-font-weight:normal'><span lang=EN-GB style='font-size:10.0pt;
177
+ mso-bidi-font-size:11.0pt'><span style='mso-element:field-end'></span></span></b><![endif]--><span
178
+ lang=EN-GB style='font-size:10.0pt;mso-bidi-font-size:11.0pt'><o:p></o:p></span></p>
179
+
180
+ </div>
181
+
182
+ </body>
183
+
184
+ </html>
@@ -0,0 +1,8 @@
1
+ <nav>
2
+ <h1 id="content">Contents</h1>
3
+ <div id="toc"></div>
4
+
5
+ </nav>
6
+
7
+
8
+ <div class="rule toc"></div>
@@ -0,0 +1,95 @@
1
+ <div class="document-stage-band" id="working-draft-band">
2
+ <p class="document-stage">{{ status }}</p>
3
+ </div>
4
+
5
+ <div class="document-type-band" id="standard-band">
6
+ <p class="document-type">Calconnect {{ doctype }}</p>
7
+ </div>
8
+
9
+
10
+
11
+ <div id='toggle'> <span>•</span> </div>
12
+
13
+ <header>
14
+
15
+ <!--<div class="WordSection1">-->
16
+ <div class="coverpage">
17
+ <div class="wrapper-top">
18
+
19
+ <div class="coverpage-doc-identity">
20
+ <div class="doc-number">
21
+ <span class="docnumber">{{ docnumber }}</span>
22
+ <span class="docnumber-separator">:</span>
23
+ <span class="docyear">{{ docyear }}</span>
24
+ </div>
25
+
26
+ <div class="coverpage-title">
27
+ <span class="title-first">{{ doctitle }}</span>
28
+ <!--<span class="title-second">{{ docsubtitle }}</span>-->
29
+ </div>
30
+ </div>
31
+
32
+ <div class="coverpage-logo">
33
+ <span>The Calendaring and Scheduling Consortium</span>
34
+ </div>
35
+
36
+ <div class="coverpage-tc-name">
37
+ <span>TC {{ tc }}</span>
38
+ </div>
39
+ </div>
40
+
41
+ <div class="WordSection11">
42
+ <div class="coverpage-stage-block" >
43
+ <span class="coverpage-stage" id="{{ doctype | replace: ' ', '-' | downcase }}">Calconnect {{ doctype }}</span>
44
+ </div>
45
+
46
+ <div class="coverpage-stage-block" >
47
+ <span class="coverpage-maturity" id="{{ status | replace: ' ', '-' | downcase }}">{{ status }}</span>
48
+ </div>
49
+
50
+ {% if status != "Published" and status != "Withdrawn" %}
51
+ <div class="coverpage-warning">
52
+ <span class="title">Warning for Drafts</span>
53
+
54
+ <p class="content">
55
+ This document is not a CalConnect Standard. It is distributed for review and
56
+ comment, and is subject to change without notice and may not be referred to as
57
+ a Standard. Recipients of this draft are invited to submit, with their
58
+ comments, notification of any relevant patent rights of which they are aware
59
+ and to provide supporting documentation.
60
+ </p>
61
+ </div>
62
+ {% endif %}
63
+
64
+ <div class="copyright">
65
+ <p class="year">
66
+ &copy; {{ docyear }} The Calendaring and Scheduling Consortium, Inc.
67
+ </p>
68
+
69
+ <p class="message">
70
+ All rights reserved. Unless otherwise specified, no part of this
71
+ publication may be reproduced or utilized otherwise in any form or by any
72
+ means, electronic or mechanical, including photocopying, or posting on the
73
+ internet or an intranet, without prior written permission. Permission can
74
+ be requested from the address below.
75
+ </p>
76
+
77
+ <div class="contact-info">
78
+ <p class="name">The Calendaring and Scheduling Consortium, Inc.</p>
79
+ <p class="address">
80
+ 4390 Chaffin Lane<br />
81
+ McKinleyville<br />
82
+ California 95519<br />
83
+ United States of America<br />
84
+ <br />
85
+ <a href="mailto:copyright@ribose.com">copyright@ribose.com</a><br />
86
+ <a href="open.ribose.com">open.ribose.com</a>
87
+ </p>
88
+ </div>
89
+ </div>
90
+
91
+ <div class="rule"></div>
92
+ </div>
93
+
94
+
95
+ </header>