html2index 1.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/bin/html2index +32 -0
- data/doc/html/html2index.html +638 -0
- data/doc/man/html2index.1.gz +0 -0
- data/doc/pdf/html2index.pdf +0 -0
- data/doc/rst/html2index.rst +265 -0
- data/html2index.gemspec +21 -0
- data/lib/argparser.rb +111 -0
- data/lib/configuration.rb +183 -0
- data/lib/constants.rb +55 -0
- data/lib/definition.rb +43 -0
- data/lib/dictionary.rb +46 -0
- data/lib/file_checking.rb +103 -0
- data/lib/html2index.rb +277 -0
- data/lib/log.conf +56 -0
- data/lib/logging.rb +206 -0
- data/lib/template.rb +134 -0
- data/lib/translating.rb +89 -0
- data/lib/translations +0 -0
- data/lib/user_input.rb +45 -0
- data/lib/version.rb +12 -0
- metadata +104 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 4c4c9cefe3aac56725cbc19e3347819b9f6e76b5188a3369fdd4cf74b2daeb41
|
4
|
+
data.tar.gz: bffd0943de63a9d6b7c6062461b3214a4ee53ce4dcece86b311f5ee94eca4ede
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: c5b93346259d8feb59570835d9d74c6ae35dbca452f7d98707a69ac9608c3352df57312be4fc2c3b88464474bb16f776ada856abe0f260d47d3bb1b3cd0160bc
|
7
|
+
data.tar.gz: 35576d0c4c7df8c829a324e55375ae79bed7af3a4b690cb907b2d61f24d503f7016735e641a70e35ccebe02aae071b2fe45fa983f0fad69ebd592ab24ace1679
|
data/bin/html2index
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
#encoding: UTF-8
|
3
|
+
=begin
|
4
|
+
/***************************************************************************
|
5
|
+
* ©2011-2013, Michael Uplawski <michael.uplawski@uplawski.eu> *
|
6
|
+
* *
|
7
|
+
* This program is free software; you can redistribute it and/or modify *
|
8
|
+
* it under the terms of the GNU General Public License as published by *
|
9
|
+
* the Free Software Foundation; either version 3 of the License, or *
|
10
|
+
* (at your option) any later version. *
|
11
|
+
* *
|
12
|
+
* This program is distributed in the hope that it will be useful, *
|
13
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
14
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
15
|
+
* GNU General Public License for more details. *
|
16
|
+
* *
|
17
|
+
* You should have received a copy of the GNU General Public License *
|
18
|
+
* along with this program; if not, write to the *
|
19
|
+
* Free Software Foundation, Inc., *
|
20
|
+
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
21
|
+
***************************************************************************/
|
22
|
+
=end
|
23
|
+
|
24
|
+
require_relative '../lib/html2index'
|
25
|
+
|
26
|
+
if(ARGV.empty?)
|
27
|
+
# puts "\n\tError: Arguments missing"
|
28
|
+
# HTML2Index::usage
|
29
|
+
# exit false
|
30
|
+
end
|
31
|
+
|
32
|
+
generator = HTML2Index.new(*ARGV)
|
@@ -0,0 +1,638 @@
|
|
1
|
+
<?xml version="1.0" encoding="utf-8" ?>
|
2
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
3
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
4
|
+
<head>
|
5
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
6
|
+
<meta name="generator" content="Docutils 0.14: http://docutils.sourceforge.net/" />
|
7
|
+
<title>Html2index</title>
|
8
|
+
<style type="text/css">
|
9
|
+
|
10
|
+
/*
|
11
|
+
:Author: David Goodger (goodger@python.org)
|
12
|
+
:Id: $Id: html4css1.css 7952 2016-07-26 18:15:59Z milde $
|
13
|
+
:Copyright: This stylesheet has been placed in the public domain.
|
14
|
+
|
15
|
+
Default cascading style sheet for the HTML output of Docutils.
|
16
|
+
|
17
|
+
See http://docutils.sf.net/docs/howto/html-stylesheets.html for how to
|
18
|
+
customize this style sheet.
|
19
|
+
*/
|
20
|
+
|
21
|
+
/* used to remove borders from tables and images */
|
22
|
+
.borderless, table.borderless td, table.borderless th {
|
23
|
+
border: 0 }
|
24
|
+
|
25
|
+
table.borderless td, table.borderless th {
|
26
|
+
/* Override padding for "table.docutils td" with "! important".
|
27
|
+
The right padding separates the table cells. */
|
28
|
+
padding: 0 0.5em 0 0 ! important }
|
29
|
+
|
30
|
+
.first {
|
31
|
+
/* Override more specific margin styles with "! important". */
|
32
|
+
margin-top: 0 ! important }
|
33
|
+
|
34
|
+
.last, .with-subtitle {
|
35
|
+
margin-bottom: 0 ! important }
|
36
|
+
|
37
|
+
.hidden {
|
38
|
+
display: none }
|
39
|
+
|
40
|
+
.subscript {
|
41
|
+
vertical-align: sub;
|
42
|
+
font-size: smaller }
|
43
|
+
|
44
|
+
.superscript {
|
45
|
+
vertical-align: super;
|
46
|
+
font-size: smaller }
|
47
|
+
|
48
|
+
a.toc-backref {
|
49
|
+
text-decoration: none ;
|
50
|
+
color: black }
|
51
|
+
|
52
|
+
blockquote.epigraph {
|
53
|
+
margin: 2em 5em ; }
|
54
|
+
|
55
|
+
dl.docutils dd {
|
56
|
+
margin-bottom: 0.5em }
|
57
|
+
|
58
|
+
object[type="image/svg+xml"], object[type="application/x-shockwave-flash"] {
|
59
|
+
overflow: hidden;
|
60
|
+
}
|
61
|
+
|
62
|
+
/* Uncomment (and remove this text!) to get bold-faced definition list terms
|
63
|
+
dl.docutils dt {
|
64
|
+
font-weight: bold }
|
65
|
+
*/
|
66
|
+
|
67
|
+
div.abstract {
|
68
|
+
margin: 2em 5em }
|
69
|
+
|
70
|
+
div.abstract p.topic-title {
|
71
|
+
font-weight: bold ;
|
72
|
+
text-align: center }
|
73
|
+
|
74
|
+
div.admonition, div.attention, div.caution, div.danger, div.error,
|
75
|
+
div.hint, div.important, div.note, div.tip, div.warning {
|
76
|
+
margin: 2em ;
|
77
|
+
border: medium outset ;
|
78
|
+
padding: 1em }
|
79
|
+
|
80
|
+
div.admonition p.admonition-title, div.hint p.admonition-title,
|
81
|
+
div.important p.admonition-title, div.note p.admonition-title,
|
82
|
+
div.tip p.admonition-title {
|
83
|
+
font-weight: bold ;
|
84
|
+
font-family: sans-serif }
|
85
|
+
|
86
|
+
div.attention p.admonition-title, div.caution p.admonition-title,
|
87
|
+
div.danger p.admonition-title, div.error p.admonition-title,
|
88
|
+
div.warning p.admonition-title, .code .error {
|
89
|
+
color: red ;
|
90
|
+
font-weight: bold ;
|
91
|
+
font-family: sans-serif }
|
92
|
+
|
93
|
+
/* Uncomment (and remove this text!) to get reduced vertical space in
|
94
|
+
compound paragraphs.
|
95
|
+
div.compound .compound-first, div.compound .compound-middle {
|
96
|
+
margin-bottom: 0.5em }
|
97
|
+
|
98
|
+
div.compound .compound-last, div.compound .compound-middle {
|
99
|
+
margin-top: 0.5em }
|
100
|
+
*/
|
101
|
+
|
102
|
+
div.dedication {
|
103
|
+
margin: 2em 5em ;
|
104
|
+
text-align: center ;
|
105
|
+
font-style: italic }
|
106
|
+
|
107
|
+
div.dedication p.topic-title {
|
108
|
+
font-weight: bold ;
|
109
|
+
font-style: normal }
|
110
|
+
|
111
|
+
div.figure {
|
112
|
+
margin-left: 2em ;
|
113
|
+
margin-right: 2em }
|
114
|
+
|
115
|
+
div.footer, div.header {
|
116
|
+
clear: both;
|
117
|
+
font-size: smaller }
|
118
|
+
|
119
|
+
div.line-block {
|
120
|
+
display: block ;
|
121
|
+
margin-top: 1em ;
|
122
|
+
margin-bottom: 1em }
|
123
|
+
|
124
|
+
div.line-block div.line-block {
|
125
|
+
margin-top: 0 ;
|
126
|
+
margin-bottom: 0 ;
|
127
|
+
margin-left: 1.5em }
|
128
|
+
|
129
|
+
div.sidebar {
|
130
|
+
margin: 0 0 0.5em 1em ;
|
131
|
+
border: medium outset ;
|
132
|
+
padding: 1em ;
|
133
|
+
background-color: #ffffee ;
|
134
|
+
width: 40% ;
|
135
|
+
float: right ;
|
136
|
+
clear: right }
|
137
|
+
|
138
|
+
div.sidebar p.rubric {
|
139
|
+
font-family: sans-serif ;
|
140
|
+
font-size: medium }
|
141
|
+
|
142
|
+
div.system-messages {
|
143
|
+
margin: 5em }
|
144
|
+
|
145
|
+
div.system-messages h1 {
|
146
|
+
color: red }
|
147
|
+
|
148
|
+
div.system-message {
|
149
|
+
border: medium outset ;
|
150
|
+
padding: 1em }
|
151
|
+
|
152
|
+
div.system-message p.system-message-title {
|
153
|
+
color: red ;
|
154
|
+
font-weight: bold }
|
155
|
+
|
156
|
+
div.topic {
|
157
|
+
margin: 2em }
|
158
|
+
|
159
|
+
h1.section-subtitle, h2.section-subtitle, h3.section-subtitle,
|
160
|
+
h4.section-subtitle, h5.section-subtitle, h6.section-subtitle {
|
161
|
+
margin-top: 0.4em }
|
162
|
+
|
163
|
+
h1.title {
|
164
|
+
text-align: center }
|
165
|
+
|
166
|
+
h2.subtitle {
|
167
|
+
text-align: center }
|
168
|
+
|
169
|
+
hr.docutils {
|
170
|
+
width: 75% }
|
171
|
+
|
172
|
+
img.align-left, .figure.align-left, object.align-left, table.align-left {
|
173
|
+
clear: left ;
|
174
|
+
float: left ;
|
175
|
+
margin-right: 1em }
|
176
|
+
|
177
|
+
img.align-right, .figure.align-right, object.align-right, table.align-right {
|
178
|
+
clear: right ;
|
179
|
+
float: right ;
|
180
|
+
margin-left: 1em }
|
181
|
+
|
182
|
+
img.align-center, .figure.align-center, object.align-center {
|
183
|
+
display: block;
|
184
|
+
margin-left: auto;
|
185
|
+
margin-right: auto;
|
186
|
+
}
|
187
|
+
|
188
|
+
table.align-center {
|
189
|
+
margin-left: auto;
|
190
|
+
margin-right: auto;
|
191
|
+
}
|
192
|
+
|
193
|
+
.align-left {
|
194
|
+
text-align: left }
|
195
|
+
|
196
|
+
.align-center {
|
197
|
+
clear: both ;
|
198
|
+
text-align: center }
|
199
|
+
|
200
|
+
.align-right {
|
201
|
+
text-align: right }
|
202
|
+
|
203
|
+
/* reset inner alignment in figures */
|
204
|
+
div.align-right {
|
205
|
+
text-align: inherit }
|
206
|
+
|
207
|
+
/* div.align-center * { */
|
208
|
+
/* text-align: left } */
|
209
|
+
|
210
|
+
.align-top {
|
211
|
+
vertical-align: top }
|
212
|
+
|
213
|
+
.align-middle {
|
214
|
+
vertical-align: middle }
|
215
|
+
|
216
|
+
.align-bottom {
|
217
|
+
vertical-align: bottom }
|
218
|
+
|
219
|
+
ol.simple, ul.simple {
|
220
|
+
margin-bottom: 1em }
|
221
|
+
|
222
|
+
ol.arabic {
|
223
|
+
list-style: decimal }
|
224
|
+
|
225
|
+
ol.loweralpha {
|
226
|
+
list-style: lower-alpha }
|
227
|
+
|
228
|
+
ol.upperalpha {
|
229
|
+
list-style: upper-alpha }
|
230
|
+
|
231
|
+
ol.lowerroman {
|
232
|
+
list-style: lower-roman }
|
233
|
+
|
234
|
+
ol.upperroman {
|
235
|
+
list-style: upper-roman }
|
236
|
+
|
237
|
+
p.attribution {
|
238
|
+
text-align: right ;
|
239
|
+
margin-left: 50% }
|
240
|
+
|
241
|
+
p.caption {
|
242
|
+
font-style: italic }
|
243
|
+
|
244
|
+
p.credits {
|
245
|
+
font-style: italic ;
|
246
|
+
font-size: smaller }
|
247
|
+
|
248
|
+
p.label {
|
249
|
+
white-space: nowrap }
|
250
|
+
|
251
|
+
p.rubric {
|
252
|
+
font-weight: bold ;
|
253
|
+
font-size: larger ;
|
254
|
+
color: maroon ;
|
255
|
+
text-align: center }
|
256
|
+
|
257
|
+
p.sidebar-title {
|
258
|
+
font-family: sans-serif ;
|
259
|
+
font-weight: bold ;
|
260
|
+
font-size: larger }
|
261
|
+
|
262
|
+
p.sidebar-subtitle {
|
263
|
+
font-family: sans-serif ;
|
264
|
+
font-weight: bold }
|
265
|
+
|
266
|
+
p.topic-title {
|
267
|
+
font-weight: bold }
|
268
|
+
|
269
|
+
pre.address {
|
270
|
+
margin-bottom: 0 ;
|
271
|
+
margin-top: 0 ;
|
272
|
+
font: inherit }
|
273
|
+
|
274
|
+
pre.literal-block, pre.doctest-block, pre.math, pre.code {
|
275
|
+
margin-left: 2em ;
|
276
|
+
margin-right: 2em }
|
277
|
+
|
278
|
+
pre.code .ln { color: grey; } /* line numbers */
|
279
|
+
pre.code, code { background-color: #eeeeee }
|
280
|
+
pre.code .comment, code .comment { color: #5C6576 }
|
281
|
+
pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold }
|
282
|
+
pre.code .literal.string, code .literal.string { color: #0C5404 }
|
283
|
+
pre.code .name.builtin, code .name.builtin { color: #352B84 }
|
284
|
+
pre.code .deleted, code .deleted { background-color: #DEB0A1}
|
285
|
+
pre.code .inserted, code .inserted { background-color: #A3D289}
|
286
|
+
|
287
|
+
span.classifier {
|
288
|
+
font-family: sans-serif ;
|
289
|
+
font-style: oblique }
|
290
|
+
|
291
|
+
span.classifier-delimiter {
|
292
|
+
font-family: sans-serif ;
|
293
|
+
font-weight: bold }
|
294
|
+
|
295
|
+
span.interpreted {
|
296
|
+
font-family: sans-serif }
|
297
|
+
|
298
|
+
span.option {
|
299
|
+
white-space: nowrap }
|
300
|
+
|
301
|
+
span.pre {
|
302
|
+
white-space: pre }
|
303
|
+
|
304
|
+
span.problematic {
|
305
|
+
color: red }
|
306
|
+
|
307
|
+
span.section-subtitle {
|
308
|
+
/* font-size relative to parent (h1..h6 element) */
|
309
|
+
font-size: 80% }
|
310
|
+
|
311
|
+
table.citation {
|
312
|
+
border-left: solid 1px gray;
|
313
|
+
margin-left: 1px }
|
314
|
+
|
315
|
+
table.docinfo {
|
316
|
+
margin: 2em 4em }
|
317
|
+
|
318
|
+
table.docutils {
|
319
|
+
margin-top: 0.5em ;
|
320
|
+
margin-bottom: 0.5em }
|
321
|
+
|
322
|
+
table.footnote {
|
323
|
+
border-left: solid 1px black;
|
324
|
+
margin-left: 1px }
|
325
|
+
|
326
|
+
table.docutils td, table.docutils th,
|
327
|
+
table.docinfo td, table.docinfo th {
|
328
|
+
padding-left: 0.5em ;
|
329
|
+
padding-right: 0.5em ;
|
330
|
+
vertical-align: top }
|
331
|
+
|
332
|
+
table.docutils th.field-name, table.docinfo th.docinfo-name {
|
333
|
+
font-weight: bold ;
|
334
|
+
text-align: left ;
|
335
|
+
white-space: nowrap ;
|
336
|
+
padding-left: 0 }
|
337
|
+
|
338
|
+
/* "booktabs" style (no vertical lines) */
|
339
|
+
table.docutils.booktabs {
|
340
|
+
border: 0px;
|
341
|
+
border-top: 2px solid;
|
342
|
+
border-bottom: 2px solid;
|
343
|
+
border-collapse: collapse;
|
344
|
+
}
|
345
|
+
table.docutils.booktabs * {
|
346
|
+
border: 0px;
|
347
|
+
}
|
348
|
+
table.docutils.booktabs th {
|
349
|
+
border-bottom: thin solid;
|
350
|
+
text-align: left;
|
351
|
+
}
|
352
|
+
|
353
|
+
h1 tt.docutils, h2 tt.docutils, h3 tt.docutils,
|
354
|
+
h4 tt.docutils, h5 tt.docutils, h6 tt.docutils {
|
355
|
+
font-size: 100% }
|
356
|
+
|
357
|
+
ul.auto-toc {
|
358
|
+
list-style-type: none }
|
359
|
+
|
360
|
+
</style>
|
361
|
+
</head>
|
362
|
+
<body>
|
363
|
+
<div class="document" id="html2index">
|
364
|
+
<h1 class="title">HTML2Index</h1>
|
365
|
+
<h2 class="subtitle" id="creates-an-index-or-glossary-of-marked-expressions-in-an-html-file">Creates an index or glossary of marked expressions in an HTML-file</h2>
|
366
|
+
|
367
|
+
<div class="section" id="synopsis">
|
368
|
+
<h1>SYNOPSIS</h1>
|
369
|
+
<blockquote>
|
370
|
+
<p><strong>html2index -s input.html [-o output.html] [-t template.html] [-c config] [-d]</strong></p>
|
371
|
+
<p><strong>html2index -v</strong></p>
|
372
|
+
<p><strong>html2index -h</strong></p>
|
373
|
+
</blockquote>
|
374
|
+
</div>
|
375
|
+
<div class="section" id="description">
|
376
|
+
<h1>DESCRIPTION</h1>
|
377
|
+
<p>The program identifies in an HTML source all expressions which need to be copied
|
378
|
+
to the generated index and searches given dictionaries on the Web for an
|
379
|
+
explanation of each expression.</p>
|
380
|
+
<p>The resulting glossary is written to a new HTML-file or its HTML-code printed to STDOUT.</p>
|
381
|
+
<p><strong>NOTE</strong>: The default dictionaries are French: Larousse and JargonF. Non-French speakers MUST define the dictionary by editing the configuration file ~/.config/HTML2Index/config as described under Configuration below.</p>
|
382
|
+
</div>
|
383
|
+
<div class="section" id="options">
|
384
|
+
<h1>OPTIONS</h1>
|
385
|
+
<table class="docutils field-list" frame="void" rules="none">
|
386
|
+
<col class="field-name" />
|
387
|
+
<col class="field-body" />
|
388
|
+
<tbody valign="top">
|
389
|
+
<tr class="field"><th class="field-name">-d, --debug:</th><td class="field-body">Be verbose</td>
|
390
|
+
</tr>
|
391
|
+
<tr class="field"><th class="field-name" colspan="2">-s, --source=SOURCE:</th></tr>
|
392
|
+
<tr class="field"><td> </td><td class="field-body">Source is the the original html-file
|
393
|
+
which contains marked expressions (see
|
394
|
+
<strong>Preparations</strong>, below).</td>
|
395
|
+
</tr>
|
396
|
+
<tr class="field"><th class="field-name" colspan="2">-o, --out=GLOSSARY:</th></tr>
|
397
|
+
<tr class="field"><td> </td><td class="field-body">Glossary is the generated file in HTML-format.</td>
|
398
|
+
</tr>
|
399
|
+
<tr class="field"><th class="field-name" colspan="2">-t, --template=TEMPLATE:</th></tr>
|
400
|
+
<tr class="field"><td> </td><td class="field-body">A html file containing placeholders for the references to the dictionaries used and
|
401
|
+
the generated glossary. The placeholders are
|
402
|
+
currently defined as %=dict_list=% and
|
403
|
+
%=glossary=%. You can set different
|
404
|
+
field-delimiters and names in the
|
405
|
+
configuration-file. See below under
|
406
|
+
<em>EXAMPLE-Template</em> for a rudimentary example.</td>
|
407
|
+
</tr>
|
408
|
+
<tr class="field"><th class="field-name" colspan="2">-c, --config=CONFIG:</th></tr>
|
409
|
+
<tr class="field"><td> </td><td class="field-body">Configuration-file. Command-line arguments override the settings in this file. You find a functional
|
410
|
+
configuration after the first program-execution in <em>~/.config/HTML2Index</em>. The file is commented and
|
411
|
+
can immediately be adapted to your needs.</td>
|
412
|
+
</tr>
|
413
|
+
</tbody>
|
414
|
+
</table>
|
415
|
+
<div class="section" id="common-options">
|
416
|
+
<h2>Common Options</h2>
|
417
|
+
<p><strong>-h, --help</strong> Show this message</p>
|
418
|
+
<p><strong>-v, --version</strong> Show program version</p>
|
419
|
+
</div>
|
420
|
+
</div>
|
421
|
+
<div class="section" id="example-usage">
|
422
|
+
<h1>EXAMPLE Usage</h1>
|
423
|
+
<p>Here is a html-page containing instructions on how to enable and disable a
|
424
|
+
touchpad using the xinput command (or any other HTML-file) in the French (or
|
425
|
+
any other) language.</p>
|
426
|
+
<p><strong>touchpad_fr.html</strong></p>
|
427
|
+
<div class="section" id="execution">
|
428
|
+
<h2>Execution</h2>
|
429
|
+
<p>Executing HTML2Index with the -s argument and the HTML-file as its value, like this:</p>
|
430
|
+
<pre class="literal-block">
|
431
|
+
:~$ html2index -s /[path]/touchpad_fr.html
|
432
|
+
</pre>
|
433
|
+
<p>will produce output like this with expressions from the HTML-file explained in
|
434
|
+
the French language :</p>
|
435
|
+
<pre class="literal-block">
|
436
|
+
vi
|
437
|
+
(JargonF): 1. [Unix]. « Visual Interface » (littéralement, « interface
|
438
|
+
visuelle », ça ne s'invente pas !) éditeur de texte du pléistocène codé par
|
439
|
+
Bill Joy, aussi fondateur de Sun. Des aficionados d'Unix s'en servent
|
440
|
+
encore, même s'il est très concurrencé par Emacs. Son principal avantage
|
441
|
+
est que quel que soit l'état de votre système (par exemple complètement
|
442
|
+
déglingué ou allégé) il a de fortes chances de fonctionner encore
|
443
|
+
correctement.
|
444
|
+
La version la plus répandue est vim.
|
445
|
+
|
446
|
+
2. [nom de domaine]. Nom de domaine de premier niveau des îles Vierges étasuniennes.
|
447
|
+
------------------------------------------------------------
|
448
|
+
xinput
|
449
|
+
(JargonF): commande. [X11] Utilitaire facilitant la gestion des
|
450
|
+
périphériques X Window d'entrée. Il peut en fournir la liste, détailler
|
451
|
+
leurs propriétés et modifier celles qui peuvent l'être.
|
452
|
+
http://www.souris-libre.fr/savoir_faire/touchpad/touchpad_fr.html Exemple
|
453
|
+
d'utilisation: désactivation et activation rapide du pavé tactile.
|
454
|
+
</pre>
|
455
|
+
<p>If you name an output file with the -o option, html2index will direct its
|
456
|
+
output in HTML-format to this file.</p>
|
457
|
+
</div>
|
458
|
+
<div class="section" id="preparations">
|
459
|
+
<h2>Preparations</h2>
|
460
|
+
<div class="section" id="mark-catchwords">
|
461
|
+
<h3>Mark catchwords</h3>
|
462
|
+
<p>In the source-code of the original HTML- page, expressions for the future
|
463
|
+
glossary are marked by means of</p>
|
464
|
+
<ul class="simple">
|
465
|
+
<li>a tag</li>
|
466
|
+
<li>an attribute of this tag</li>
|
467
|
+
<li>the value of the attribute.</li>
|
468
|
+
</ul>
|
469
|
+
<p>By default, the <em>span</em>-tag with an attribute <em>lang="fy"</em> is used, 'fy' meaning
|
470
|
+
Frisian, a language which is rarely used on the Web.., I venture.</p>
|
471
|
+
<p><em>Example</em>:</p>
|
472
|
+
<pre class="literal-block">
|
473
|
+
<span lang="fy" xml:lang="fy">pavé tactile</span>
|
474
|
+
</pre>
|
475
|
+
<p>You can, though, define your own tag, attribute and attribute-value, if you prefer
|
476
|
+
to mark expressions in your original html-file differently, like in</p>
|
477
|
+
<p><em>Example</em>:</p>
|
478
|
+
<pre class="literal-block">
|
479
|
+
<em class="expression">Tripane</em>
|
480
|
+
</pre>
|
481
|
+
<p>Remember that you can combine css classes and thus economize on html-elements, if
|
482
|
+
you use them anyway to style your html-content. This would complicate the task for
|
483
|
+
html2index only a little bit, as we will see further below.</p>
|
484
|
+
</div>
|
485
|
+
<div class="section" id="configuration">
|
486
|
+
<h3>Configuration</h3>
|
487
|
+
<p>Apart from the way that expressions are marked in the original html, you can prepare
|
488
|
+
a few settings for HTML2Index, which influence its behaviour. Command-line
|
489
|
+
options override the values stored in the configuration-file.</p>
|
490
|
+
<p>A default configuration will be stored in the file <em>~/.config/HTML2Index/config</em> the
|
491
|
+
first time that you run html2index. It should be sufficiently commented to allow you
|
492
|
+
to comprehend and alter any values in the file.</p>
|
493
|
+
<p>However, an explanation of each one of the available variables follows:</p>
|
494
|
+
<table class="docutils field-list" frame="void" rules="none">
|
495
|
+
<col class="field-name" />
|
496
|
+
<col class="field-body" />
|
497
|
+
<tbody valign="top">
|
498
|
+
<tr class="field"><th class="field-name">debug:</th><td class="field-body"><p class="first">Does the same as the command-line options '-d' or '--debug'.
|
499
|
+
Accepts the values false or true or can be left empty.
|
500
|
+
If set to true, this setting causes html2index to be very verbose.
|
501
|
+
Usually, you do not need to change the default value to this
|
502
|
+
variable, which is <em>false</em>.</p>
|
503
|
+
</td>
|
504
|
+
</tr>
|
505
|
+
<tr class="field"><th class="field-name">dictionaries:</th><td class="field-body"><p class="first">Here, you <strong>HAVE</strong> to define the online-dictionaries to
|
506
|
+
consult, if you do not want to stick with the defaults, which are
|
507
|
+
Larousse and JargonF, two French speaking sites, which also provide
|
508
|
+
explanations in the French language only.</p>
|
509
|
+
<p>The dictionaries are defined with four variables, each: <em>name, url, xpath, color</em>.
|
510
|
+
Each dictionary-definition must start with a dash, followed by a white-space, then the
|
511
|
+
first variable. Each variable-name must be enclosed by colons (see comments in the config-file).</p>
|
512
|
+
<table class="docutils field-list" frame="void" rules="none">
|
513
|
+
<col class="field-name" />
|
514
|
+
<col class="field-body" />
|
515
|
+
<tbody valign="top">
|
516
|
+
<tr class="field"><th class="field-name">name:</th><td class="field-body">The name of the dictionary, how it will be referred to in the Glossary. An example could be 'Meriam-Webster'</td>
|
517
|
+
</tr>
|
518
|
+
<tr class="field"><th class="field-name">url:</th><td class="field-body">Note here the part from the url to a search-result in
|
519
|
+
the chosen dictionary, which precedes the searched
|
520
|
+
expression. You determine this string by doing a
|
521
|
+
search in the online-dictionary, then copy&paste the
|
522
|
+
url as it is displayed in your browser. Rearrange
|
523
|
+
possible request-parameters (following '?') to ensure
|
524
|
+
that the searched word or expression is the very last
|
525
|
+
item in the url. Remove only the searched expression
|
526
|
+
and note the remainder as the value to the variable
|
527
|
+
<em>url</em>.</td>
|
528
|
+
</tr>
|
529
|
+
<tr class="field"><th class="field-name">xpath:</th><td class="field-body">This is the xpath which identifies the HTML-element
|
530
|
+
in a search-result which contains the explanation of
|
531
|
+
an expression. Many resources on the Web explain how
|
532
|
+
to compose an xpath. Be as specific as possible, to
|
533
|
+
avoid a miss-interpretation of the xpath-expression,
|
534
|
+
use html-attributes which may be applied to an HTML
|
535
|
+
container-tag. Especially <em>id</em>, if present but also
|
536
|
+
css-classes can help to identify a tag unambiguously.</td>
|
537
|
+
</tr>
|
538
|
+
<tr class="field"><th class="field-name">color:</th><td class="field-body">A hexadecimal rgb color value in single quotes is
|
539
|
+
attributed to each dictionary to facilitate the
|
540
|
+
identification of the dictionary which provides a
|
541
|
+
specific explanation in the glossary. Exemplary
|
542
|
+
colors are <em>'800000'</em> or <em>'500050'</em>. Take care to
|
543
|
+
choose colors which harmonize with the background in
|
544
|
+
your template-file, if you use one.</td>
|
545
|
+
</tr>
|
546
|
+
</tbody>
|
547
|
+
</table>
|
548
|
+
</td>
|
549
|
+
</tr>
|
550
|
+
<tr class="field"><th class="field-name">template:</th><td class="field-body"><p class="first">An HTML-file which contains placeholders. Two placeholders are needed
|
551
|
+
at the time of this writing, one to name the dictionaries which are
|
552
|
+
used to look-up definitions, another one to locate the spot where
|
553
|
+
the new glossary will be written. See below under <em>EXAMPLE-Template</em>
|
554
|
+
for a rudimentary example. The default template is internally defined.</p>
|
555
|
+
</td>
|
556
|
+
</tr>
|
557
|
+
<tr class="field"><th class="field-name">fdelim:</th><td class="field-body"><p class="first">A character sequence which is used to mark placeholders in the
|
558
|
+
HTML-template file. The default is '<em>%-</em>', meaning that a
|
559
|
+
percent-symbol followed by a dash marks the beginning, a dash
|
560
|
+
followed by a percent-symbol the end of a placeholder, like in
|
561
|
+
<strong>%-dict-list-%</strong> for the placeholder named 'dict-list'.</p>
|
562
|
+
</td>
|
563
|
+
</tr>
|
564
|
+
<tr class="field"><th class="field-name">placeholders:</th><td class="field-body"><p class="first">A list of placeholder names. Currently, there are only two
|
565
|
+
placeholders recognized by Html2Index: <em>dict_list</em> and
|
566
|
+
<em>glossary</em>. As the value to these two variables, note the name
|
567
|
+
that you chose for the placeholders in your HTML-template. The
|
568
|
+
defaults are <em>dict_list</em> for <em>dict_list</em> and <em>index</em> for
|
569
|
+
<em>glossary</em>.</p>
|
570
|
+
</td>
|
571
|
+
</tr>
|
572
|
+
<tr class="field"><th class="field-name">html_tag:</th><td class="field-body"><p class="first">This is the tag which encloses marked expressions in the original
|
573
|
+
HTML-page (the source-file). Default is <em>span</em></p>
|
574
|
+
</td>
|
575
|
+
</tr>
|
576
|
+
<tr class="field"><th class="field-name">html_attribute:</th><td class="field-body"><p class="first">An attribute of the html_tag which encloses marked expressions
|
577
|
+
in the original HTML-page (the source-file). Default is <em>lang</em>.</p>
|
578
|
+
</td>
|
579
|
+
</tr>
|
580
|
+
<tr class="field"><th class="field-name">html_value:</th><td class="field-body"><p class="first last">The value of an attribute of the html_tag which encloses marked
|
581
|
+
expressions in the original HTML-page (the source-file). Default is
|
582
|
+
<em>fy</em>.</p>
|
583
|
+
</td>
|
584
|
+
</tr>
|
585
|
+
</tbody>
|
586
|
+
</table>
|
587
|
+
</div>
|
588
|
+
</div>
|
589
|
+
</div>
|
590
|
+
<div class="section" id="example-template">
|
591
|
+
<h1>EXAMPLE-Template</h1>
|
592
|
+
<blockquote>
|
593
|
+
Assuming that the defaults are used, the following could be a working
|
594
|
+
HTML-template to use with HTML2Index:</blockquote>
|
595
|
+
<pre class="literal-block">
|
596
|
+
<html>
|
597
|
+
<head><title>Glossary</title></head>
|
598
|
+
<body>
|
599
|
+
<h1>Glossary</h1>
|
600
|
+
<h2>Dictionaries used to produce this glossary</h2>
|
601
|
+
<!-- will be replaced by an unnumbered list <ul><li> ... </li></ul> -->
|
602
|
+
%-dict_list-%
|
603
|
+
<h2>Definitions</h2>
|
604
|
+
<!-- will be replaced by a definition list <dl><dt><dd>... </dd></dt></dl> -->
|
605
|
+
%-glossary-%
|
606
|
+
</body>
|
607
|
+
</html>
|
608
|
+
</pre>
|
609
|
+
</div>
|
610
|
+
<div class="section" id="errors-and-warnings">
|
611
|
+
<h1>ERRORS and WARNINGS</h1>
|
612
|
+
<blockquote>
|
613
|
+
<p>html2index warns you if the output-file exists and asks you if you want
|
614
|
+
to replace it with a new version.</p>
|
615
|
+
<p>The program also tries to determine the file-type of the input (HTML) file and
|
616
|
+
gives out a warning if the file is considered unsuitable.</p>
|
617
|
+
<p>Each time, that an expression cannot be found in one of the targeted dictionaries,
|
618
|
+
a warning is given. All these problematic expressions will be listed in a
|
619
|
+
temporary file, which is named after html2index has terminated.</p>
|
620
|
+
</blockquote>
|
621
|
+
</div>
|
622
|
+
<div class="section" id="source-code-and-development">
|
623
|
+
<h1>SOURCE CODE and DEVELOPMENT</h1>
|
624
|
+
<p>html2index is developed in Ruby and can be installed as a Ruby-Gem. As Ruby is
|
625
|
+
an interpreter-language, the source-code of the installed version is always
|
626
|
+
accessible. You can also decompress the gem-file to take a look at the code.</p>
|
627
|
+
<table class="docutils field-list" frame="void" rules="none">
|
628
|
+
<col class="field-name" />
|
629
|
+
<col class="field-body" />
|
630
|
+
<tbody valign="top">
|
631
|
+
<tr class="field"><th class="field-name">AUTHOR:</th><td class="field-body">Michael Uplawski <michael[dot]uplawski[at]uplawski[dot]eu></td>
|
632
|
+
</tr>
|
633
|
+
</tbody>
|
634
|
+
</table>
|
635
|
+
</div>
|
636
|
+
</div>
|
637
|
+
</body>
|
638
|
+
</html>
|
Binary file
|
File without changes
|