-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgenx.html
206 lines (199 loc) · 7.83 KB
/
genx.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8'>
<title> genx - XML writer </title>
<script src="jquery.js"></script>
<script src="jquery-cookie.js"></script>
<script src="jquery-tablesorter.js"></script>
<script src="strftime.js"></script>
<script src="mustache.js"></script>
<script src="config.js"></script>
<script src="main.js"></script>
<link rel="stylesheet" type="text/css" href="templates/reset.css" />
<link rel="stylesheet" type="text/css" href="templates/hack.css" />
<link rel="stylesheet" type="text/css" id="lights_css" />
<script>
var DOCNAME = 'genx'
var PROJECT = 'genx'
//set the lights before rendering starts
set_lights()
</script>
</head>
<body>
<header>
<div class="container">
<div class="btn-container btn-lights-container">
<a href="#" class="btn btn-lights" id="lights">lights</a>
</div>
<div class="btn-container btn-home-container">
<a href="/" class="btn btn-home">luapower</a>
</div>
<table id="header_table">
<tr>
<td style="vertical-align: middle;" width="100%">
<h1> genx </h1>
<h2> XML writer </h2>
</td>
<td style="vertical-align: middle;" align="right" style="height: 150px">
<table><tr><td>
<div class="doc" id="package_info_container">
<div id="package_info"> </div>
<div id="commit_log"> </div>
</div>
<a href="https://github.com/luapower/genx" class="btn btn-rightside btn-github"><span class="icon"></span>View on GitHub</a>
</td></tr><tr><td>
<a href="https://github.com/luapower/genx/tarball/master" class="btn btn-rightside">Download as .tar.gz</a>
</td></tr><tr><td>
<a href="https://github.com/luapower/genx/zipball/master" class="btn btn-rightside">Download as .zip</a>
</td></tr></table>
</td>
</tr>
</table>
<div class="btn-container btn-discuss-container">
<a href="https://github.com/luapower/genx/issues/new" target="_blank"
class="btn btn-rightside btn-discuss"><span class="icon"></span>Discuss</a>
</div>
</div>
</header>
<div class="bg-container">
<div class="bg-center-container">
<div class="bg bg-genx" style="background-image: url('bg/genx.png');"></div>
</div>
</div>
<div class="under-header">
<div class="container">
<div id="toc_container" class="toc_container doc"></div>
<button id=tab1_button class="tab_button hidden">Documentation</button>
<button id=tab2_button class="tab_button hidden">Package Info</button>
<div id="tabs_cointainer">
<div id="tab1_container">
<section class="doc">
<span id="module_info"></span>
<h2 id="local-genx-requiregenx"><code>local genx = require'genx'</code></h2>
<p>A ffi binding of <a href="http://www.tbray.org/ongoing/When/200x/2004/02/20/GenxStatus">genx</a>, a library for generating well-formed canonical XML documents, written by Tim Bray.</p>
<h2 id="features">Features</h2>
<ul>
<li>does all necessary XML escaping.</li>
<li>prevents generating text that isn't well-formed.</li>
<li>generates namespace prefixes.</li>
<li>produces Canonical XML, suitable for use with digital signatures.</li>
</ul>
<h2 id="limitations">Limitations</h2>
<ul>
<li>only UTF8 encoding supported</li>
<li>no empty element tags</li>
<li>no <code><!DOCTYPE></code> declarations (write it yourself before calling <code>w:start_doc()</code>)</li>
<li>no pretty-printing (add linebreaks and indentation yourself with <code>w:text()</code> where needed)</li>
</ul>
<h2 id="example">Example</h2>
<pre class="sourceCode lua"><code class="sourceCode lua"><span class="kw">local</span> <span class="kw">w</span> <span class="ot">=</span> <span class="kw">genx</span><span class="ot">.</span>new<span class="ot">()</span>
<span class="kw">w</span>:start_doc<span class="ot">(</span><span class="fu">io.stdout</span><span class="ot">)</span>
<span class="kw">w</span>:start_element<span class="st">'root'</span>
<span class="kw">w</span>:text<span class="st">'hello'</span>
<span class="kw">w</span>:end_element<span class="ot">()</span>
<span class="kw">w</span>:end_doc<span class="ot">()</span>
<span class="kw">w</span>:free<span class="ot">()</span></code></pre>
<table>
<tbody>
<tr class="odd">
<td align="left"><code>genx.new() -> w</code></td>
<td align="left">Create a new genx writer.</td>
</tr>
<tr class="even">
<td align="left"><code>w:free()</code></td>
<td align="left">Free the genx writer.</td>
</tr>
<tr class="odd">
<td align="left"><code>w:start_doc(file)</code></td>
<td align="left">Start an XML document on a <code>FILE *</code> or Lua file object</td>
</tr>
<tr class="even">
<td align="left"><code>w:start_doc(write)</code></td>
<td align="left">Start an XML document on a write function to be called as <code>write([s[, size]])</code></td>
</tr>
<tr class="odd">
<td align="left"><code>w:end_doc()</code></td>
<td align="left">Flush pending updates and release the file handle</td>
</tr>
<tr class="even">
<td align="left"><code>w:ns(uri[, prefix]) -> ns</code></td>
<td align="left">Declare a namespace for reuse. The same namespace can be declared multiple times.</td>
</tr>
<tr class="odd">
<td align="left"><code>w:element(name[, ns | uri,prefix]) -> elem</code></td>
<td align="left">Declare an element for reuse. The same element can be declared multiple times.</td>
</tr>
<tr class="even">
<td align="left"><code>w:attr(name[, ns | uri,prefix]) -> attr</code></td>
<td align="left">Declare an attribute for reuse. The same attribute can be declared multiple times.</td>
</tr>
<tr class="odd">
<td align="left"><code>w:comment(s)</code></td>
<td align="left">Add a comment to the current XML stream.</td>
</tr>
<tr class="even">
<td align="left"><code>w:pi(target, text)</code></td>
<td align="left">Add a PI to the current XML stream.</td>
</tr>
<tr class="odd">
<td align="left"><code>w:start_element(elem | name [, ns | uri,prefix])</code></td>
<td align="left">Start a new XML element.</td>
</tr>
<tr class="even">
<td align="left"><code>w:end_element()</code></td>
<td align="left">End the current element.</td>
</tr>
<tr class="odd">
<td align="left"><code>w:add_attr(attr, val[, ns | uri,prefix])</code></td>
<td align="left">Add an attribute to the current element. Attributes are sorted by name in the output stream.</td>
</tr>
<tr class="even">
<td align="left"><code>w:add_ns(ns | [uri,prefix])</code></td>
<td align="left">Add a namespace to the current element.</td>
</tr>
<tr class="odd">
<td align="left"><code>w:unset_default_namespace()</code></td>
<td align="left">Add a <code>xmlns=""</code> declaration to unset the default namespace declaration. This is a no-op if no default namespace is in effect.</td>
</tr>
<tr class="even">
<td align="left"><code>w:text(s[, size])</code></td>
<td align="left">Add utf-8 text.</td>
</tr>
<tr class="odd">
<td align="left"><code>w:char(char)</code></td>
<td align="left">Add an unicode code point.</td>
</tr>
<tr class="even">
<td align="left"><code>w:check_text(s) -> genxStatus</code></td>
<td align="left">Check utf-8 text.</td>
</tr>
<tr class="odd">
<td align="left"><code>w:scrub_text(s) -> s</code></td>
<td align="left">Scrub utf-8 text of invalid characters.</td>
</tr>
</tbody>
</table>
<p>See the <a href="http://www.tbray.org/ongoing/genx/docs/Guide.html">genx manual</a> for more info.</p>
</section>
</div>
<div id="tab2_container" class="doc"></div>
</div>
</div>
<div class="container">
<footer>
<div id="disqus_thread"></div>
<div class="faint">[email protected] | <a href="http://unlicense.org/">public domain</a></div>
</footer>
</div>
</div>
<script type="text/x-mustache" id=info_tab_template>
<h3>Modules</h3>
<ul>
{{#module_array}}
<li>{{name}}</li>
{{/module_array}}
</ul>
</script>
</body>
</html>