line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
# = HISTORY SECTION =====================================================================
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
# ---------------------------------------------------------------------------------------
|
6
|
|
|
|
|
|
|
# version | date | author | changes
|
7
|
|
|
|
|
|
|
# ---------------------------------------------------------------------------------------
|
8
|
|
|
|
|
|
|
# 0.08 |03.12.2006| JSTENZEL | INDEXCLOUD POD fix: chapterdelimiter => chapterDelimiter;
|
9
|
|
|
|
|
|
|
# 0.07 |25.04.2006| JSTENZEL | added INDEXCLOUD;
|
10
|
|
|
|
|
|
|
# 0.06 |05.03.2006| JSTENZEL | FORMAT, HIDE, INDEX, INDEXRELATIONS, LOCALTOC and READY
|
11
|
|
|
|
|
|
|
# | | | got a "standalone" configuration flag;
|
12
|
|
|
|
|
|
|
# |10.03.2006| JSTENZEL | IMAGE now adds an "alt" option ("Image") as default;
|
13
|
|
|
|
|
|
|
# 0.05 |15.04.2005| JSTENZEL | A is now checking if it is the innermost tag/macro;
|
14
|
|
|
|
|
|
|
# |16.05.2005| JSTENZEL | alt option of REF can handle backslash guarded commata;
|
15
|
|
|
|
|
|
|
# |23.08.2005| JSTENZEL | doc fix: intro option of INDEXRELATIONS was not described;
|
16
|
|
|
|
|
|
|
# 0.04 |18.08.2003| JSTENZEL | A is a basic tag now;
|
17
|
|
|
|
|
|
|
# |02.05.2004| JSTENZEL | F is a basic tag now;
|
18
|
|
|
|
|
|
|
# |05.05.2004| JSTENZEL | anchors now take the number of their definition page;
|
19
|
|
|
|
|
|
|
# | | JSTENZEL | additional hook parameter: page number;
|
20
|
|
|
|
|
|
|
# | | JSTENZEL | REF: type=plain was ignored in case of a body - why? changed;
|
21
|
|
|
|
|
|
|
# | | JSTENZEL | new REF option "valueformat";
|
22
|
|
|
|
|
|
|
# | | JSTENZEL | REF: __value__ now holds an array reference to object name
|
23
|
|
|
|
|
|
|
# | | | and page;
|
24
|
|
|
|
|
|
|
# |06.05.2004| JSTENZEL | A stored headline IDs in the anchor, replaced by name;
|
25
|
|
|
|
|
|
|
# 0.03 |26.01.2003| JSTENZEL | X is a basic tag now;
|
26
|
|
|
|
|
|
|
# | | JSTENZEL | new index related tags INDEX and INDEXRELATIONS;
|
27
|
|
|
|
|
|
|
# |02.02.2003| JSTENZEL | X is now checking if it is the innermost tag/macro;
|
28
|
|
|
|
|
|
|
# |26.04.2003| JSTENZEL | documented new tags;
|
29
|
|
|
|
|
|
|
# 0.02 |02.10.2001| JSTENZEL | added LOCALTOC;
|
30
|
|
|
|
|
|
|
# |11.10.2001| JSTENZEL | added SEQ;
|
31
|
|
|
|
|
|
|
# |12.10.2001| JSTENZEL | added REF;
|
32
|
|
|
|
|
|
|
# |13.10.2001| JSTENZEL | added HIDE;
|
33
|
|
|
|
|
|
|
# |24.10.2001| JSTENZEL | added FORMAT and STOP;
|
34
|
|
|
|
|
|
|
# |31.10.2001| JSTENZEL | added FORMAT doc;
|
35
|
|
|
|
|
|
|
# |03.12.2001| JSTENZEL | now all messages mention the inflicted tag name and
|
36
|
|
|
|
|
|
|
# | | | a source line number where possible;
|
37
|
|
|
|
|
|
|
# 0.01 |19.03.2001| JSTENZEL | new.
|
38
|
|
|
|
|
|
|
# ---------------------------------------------------------------------------------------
|
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
# = POD SECTION =========================================================================
|
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
=head1 NAME
|
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
B - declares basic PerlPoint tags
|
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
=head1 VERSION
|
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
This manual describes version B<0.08>.
|
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=head1 SYNOPSIS
|
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
# declare basic tags
|
53
|
|
|
|
|
|
|
use PerlPoint::Tags::Basic;
|
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
=head1 DESCRIPTION
|
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
This module declares several basic PerlPoint tags. Tag declarations
|
58
|
|
|
|
|
|
|
are used by the parser to determine if a used tag is valid, if it needs
|
59
|
|
|
|
|
|
|
options, if it needs a body and so on. Please see
|
60
|
|
|
|
|
|
|
\B for a detailed description of tag declaration.
|
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
Every PerlPoint translator willing to handle the tags of this module
|
63
|
|
|
|
|
|
|
can declare this by using the module in the scope where it built the
|
64
|
|
|
|
|
|
|
parser object.
|
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
# declare basic tags
|
67
|
|
|
|
|
|
|
use PerlPoint::Tags::Basic;
|
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
# load parser module
|
70
|
|
|
|
|
|
|
use PerlPoint::Parser;
|
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
...
|
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
# build parser
|
75
|
|
|
|
|
|
|
my $parser=new PerlPoint::Parser(...);
|
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
...
|
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
It is also possible to select certain declarations.
|
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
# declare basic tags
|
82
|
|
|
|
|
|
|
use PerlPoint::Tags::Basic qw(I C);
|
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
A set name is provided as well to declare all the flags at once.
|
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
# declare basic tags
|
88
|
|
|
|
|
|
|
use PerlPoint::Tags::Basic qw(:basic);
|
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
=head1 TAGS
|
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
=head2 B
|
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
marks text as I. No options, but a mandatory tag body.
|
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
=head2 C
|
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
marks text as I. No options, but a mandatory tag body.
|
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
=head2 F
|
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
This is a generalized I tag, introduced by C
|
105
|
|
|
|
|
|
|
and made generally available. It sets up the formatting of a
|
106
|
|
|
|
|
|
|
selected text. Traditionally, these are font settings like
|
107
|
|
|
|
|
|
|
text color and font size, but there can be more formattings.
|
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
Both options and body are mandatory.
|
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
Please note that this tag is fairly general. Accepted options and
|
112
|
|
|
|
|
|
|
their meaning are defined by the I, but there are
|
113
|
|
|
|
|
|
|
conventions that make documents portable between converters.
|
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
So, by convention, options C and C set up the color
|
116
|
|
|
|
|
|
|
and font size of the selected text, in the tradition and argument
|
117
|
|
|
|
|
|
|
syntax of HTML.
|
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
A \F{color=red} colored text.
|
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
=head2 FORMAT
|
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
is a container tag to configure result formatting. Configuration
|
124
|
|
|
|
|
|
|
settings are received via tag options and are intended to remain
|
125
|
|
|
|
|
|
|
valid until another modification. For example, one may set the
|
126
|
|
|
|
|
|
|
default text color of examples to green. This would remain valid
|
127
|
|
|
|
|
|
|
until the next text color setting.
|
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
Please note that this tag is very general. Accepted options and
|
130
|
|
|
|
|
|
|
their meaning are defined by the I. Nevertheless,
|
131
|
|
|
|
|
|
|
certain settings are commonly used by convention.
|
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
If used as the only contents of a text paragraph the paragraph wrapper
|
134
|
|
|
|
|
|
|
will be removed from the stream and the tag is streamed standalone.
|
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
=head2 HIDE
|
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
hides everything in its body. Makes most sense when used with
|
140
|
|
|
|
|
|
|
a tag condition.
|
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
If used as the only contents of a text paragraph the paragraph wrapper
|
143
|
|
|
|
|
|
|
will be removed from the stream and the tag is streamed standalone.
|
144
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
=head2 I
|
147
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
marks text as I. No options, but a mandatory tag body.
|
149
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
=head2 IMAGE
|
151
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
includes an I. No tag body, but a mandatory option C<"src"> to pass
|
153
|
|
|
|
|
|
|
the image file, and an optional option C<"alt"> to store text alternatively
|
154
|
|
|
|
|
|
|
to be displayed. The option set is open - there can be more options
|
155
|
|
|
|
|
|
|
but they will not be checked by the parser. If C is not set it defaults
|
156
|
|
|
|
|
|
|
to an empty string (added automatically).
|
157
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
The image source file name will be supplied I in the stream.
|
159
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
If used as the only contents of a text paragraph the paragraph wrapper
|
161
|
|
|
|
|
|
|
will be removed from the stream and the tag is streamed standalone.
|
162
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
=head2 INDEX
|
165
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
Generates an index listing all keywords collected via I. Index formatting
|
167
|
|
|
|
|
|
|
is up to the converters.
|
168
|
|
|
|
|
|
|
|
169
|
|
|
|
|
|
|
If used as the only contents of a text paragraph the paragraph wrapper
|
170
|
|
|
|
|
|
|
will be removed from the stream and the tag is streamed standalone.
|
171
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
|
173
|
|
|
|
|
|
|
=head2 INDEXCLOUD
|
174
|
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
Generates a "cloud" of the index entries. The term is inspired by the "tag clouds"
|
176
|
|
|
|
|
|
|
which became popular in the Internet, but the final formatting might be different,
|
177
|
|
|
|
|
|
|
as it is up to the converters. Not all target formats might have features to
|
178
|
|
|
|
|
|
|
present a cloud, but finally one should get a kind of a ranking that shows which
|
179
|
|
|
|
|
|
|
index entries were used frequently.
|
180
|
|
|
|
|
|
|
|
181
|
|
|
|
|
|
|
If used as the only contents of a text paragraph the paragraph wrapper
|
182
|
|
|
|
|
|
|
will be removed from the stream and the tag is streamed standalone.
|
183
|
|
|
|
|
|
|
|
184
|
|
|
|
|
|
|
This tag can be configured by options. All options are optional, except where stated.
|
185
|
|
|
|
|
|
|
|
186
|
|
|
|
|
|
|
=over
|
187
|
|
|
|
|
|
|
|
188
|
|
|
|
|
|
|
=item chapterDelimiter
|
189
|
|
|
|
|
|
|
|
190
|
|
|
|
|
|
|
A supplementary option to C. Defines the delimiter string used to separate
|
191
|
|
|
|
|
|
|
multiple chapter names in the C value.
|
192
|
|
|
|
|
|
|
|
193
|
|
|
|
|
|
|
Without this parameter the value of C is treated as I chapter title.
|
194
|
|
|
|
|
|
|
|
195
|
|
|
|
|
|
|
This option has no effect if C is not used.
|
196
|
|
|
|
|
|
|
|
197
|
|
|
|
|
|
|
Example:
|
198
|
|
|
|
|
|
|
|
199
|
|
|
|
|
|
|
chapterDelimiter="==" chapters="One Chapter==Another Chapter"
|
200
|
|
|
|
|
|
|
|
201
|
|
|
|
|
|
|
|
202
|
|
|
|
|
|
|
=item chapters
|
203
|
|
|
|
|
|
|
|
204
|
|
|
|
|
|
|
This mandatory parameter specifies the chapters of which index entries should be
|
205
|
|
|
|
|
|
|
taken into account, including all their subchapters. A chapter is specified by
|
206
|
|
|
|
|
|
|
its title, as with C<\REF>. To list more than one chapter, delimit the titles
|
207
|
|
|
|
|
|
|
by a string that is not contained in them, and declare this delimiter string with
|
208
|
|
|
|
|
|
|
the C option.
|
209
|
|
|
|
|
|
|
|
210
|
|
|
|
|
|
|
Example:
|
211
|
|
|
|
|
|
|
|
212
|
|
|
|
|
|
|
chapterDelimiter="==" chapters="One Chapter==Another Chapter"
|
213
|
|
|
|
|
|
|
|
214
|
|
|
|
|
|
|
|
215
|
|
|
|
|
|
|
=item coolestColor
|
216
|
|
|
|
|
|
|
|
217
|
|
|
|
|
|
|
The color that should be used for index entries that have the least references.
|
218
|
|
|
|
|
|
|
The color is specified the HTML way, hexadecimal with a C<#> prefix.
|
219
|
|
|
|
|
|
|
|
220
|
|
|
|
|
|
|
As colorization strongly depends on the target format, converters I ignore
|
221
|
|
|
|
|
|
|
this setting.
|
222
|
|
|
|
|
|
|
|
223
|
|
|
|
|
|
|
This parameter is optional. The default value is subject of converter definitions.
|
224
|
|
|
|
|
|
|
|
225
|
|
|
|
|
|
|
Example:
|
226
|
|
|
|
|
|
|
|
227
|
|
|
|
|
|
|
coolestColor="#ff3c5d"
|
228
|
|
|
|
|
|
|
|
229
|
|
|
|
|
|
|
|
230
|
|
|
|
|
|
|
=item hottestColor
|
231
|
|
|
|
|
|
|
|
232
|
|
|
|
|
|
|
This is the color that should be used for index entries that are referenced most.
|
233
|
|
|
|
|
|
|
It is specified as a hexadecimal RGB value, preceded by C<#> (as in HTML).
|
234
|
|
|
|
|
|
|
|
235
|
|
|
|
|
|
|
As colorization strongly depends on the target format, converters I ignore
|
236
|
|
|
|
|
|
|
this setting.
|
237
|
|
|
|
|
|
|
|
238
|
|
|
|
|
|
|
This parameter is optional. The default value is subject of converter definitions.
|
239
|
|
|
|
|
|
|
|
240
|
|
|
|
|
|
|
Example:
|
241
|
|
|
|
|
|
|
|
242
|
|
|
|
|
|
|
hottestColor="#ff3c5d"
|
243
|
|
|
|
|
|
|
|
244
|
|
|
|
|
|
|
|
245
|
|
|
|
|
|
|
=item intro
|
246
|
|
|
|
|
|
|
|
247
|
|
|
|
|
|
|
An optional text to be displayed before the cloud. If there are no index entries
|
248
|
|
|
|
|
|
|
found in the chapters specified, this text will I be displayed.
|
249
|
|
|
|
|
|
|
|
250
|
|
|
|
|
|
|
This parameter is optional.
|
251
|
|
|
|
|
|
|
|
252
|
|
|
|
|
|
|
Example:
|
253
|
|
|
|
|
|
|
|
254
|
|
|
|
|
|
|
intro="Index entries in this chapter:"
|
255
|
|
|
|
|
|
|
|
256
|
|
|
|
|
|
|
|
257
|
|
|
|
|
|
|
=item largestFont
|
258
|
|
|
|
|
|
|
|
259
|
|
|
|
|
|
|
An optional parameter configuring the font size for index entries referenced most,
|
260
|
|
|
|
|
|
|
in pixels. The default size is up the converters.
|
261
|
|
|
|
|
|
|
|
262
|
|
|
|
|
|
|
Depending on their capabilities converters might ignore this setting.
|
263
|
|
|
|
|
|
|
|
264
|
|
|
|
|
|
|
Example:
|
265
|
|
|
|
|
|
|
|
266
|
|
|
|
|
|
|
largestFont=40
|
267
|
|
|
|
|
|
|
|
268
|
|
|
|
|
|
|
|
269
|
|
|
|
|
|
|
=item smallestFont
|
270
|
|
|
|
|
|
|
|
271
|
|
|
|
|
|
|
This option specifies the minimal font size to be used in the cloud. The default
|
272
|
|
|
|
|
|
|
value is up to the converters.
|
273
|
|
|
|
|
|
|
|
274
|
|
|
|
|
|
|
Depending on their capabilities converters might ignore this setting.
|
275
|
|
|
|
|
|
|
|
276
|
|
|
|
|
|
|
Example:
|
277
|
|
|
|
|
|
|
|
278
|
|
|
|
|
|
|
smallestFont=10
|
279
|
|
|
|
|
|
|
|
280
|
|
|
|
|
|
|
|
281
|
|
|
|
|
|
|
=item top
|
282
|
|
|
|
|
|
|
|
283
|
|
|
|
|
|
|
Limits the number of index entries visualized by the cloud to the specified
|
284
|
|
|
|
|
|
|
number of top rated entries.
|
285
|
|
|
|
|
|
|
|
286
|
|
|
|
|
|
|
Example:
|
287
|
|
|
|
|
|
|
|
288
|
|
|
|
|
|
|
top=20
|
289
|
|
|
|
|
|
|
|
290
|
|
|
|
|
|
|
|
291
|
|
|
|
|
|
|
=back
|
292
|
|
|
|
|
|
|
|
293
|
|
|
|
|
|
|
|
294
|
|
|
|
|
|
|
=head2 INDEXRELATIONS
|
295
|
|
|
|
|
|
|
|
296
|
|
|
|
|
|
|
Inserts a chapter "cross reference" based on the keywords found in all
|
297
|
|
|
|
|
|
|
chapters using this tag.
|
298
|
|
|
|
|
|
|
|
299
|
|
|
|
|
|
|
So, the tag has two functions. First, it I all index entries
|
300
|
|
|
|
|
|
|
made in its chapters (and optionally all its subchapters). Second, it
|
301
|
|
|
|
|
|
|
includes a reference to other chapters with I which
|
302
|
|
|
|
|
|
|
match the own index entries according to the configuration.
|
303
|
|
|
|
|
|
|
|
304
|
|
|
|
|
|
|
If used as the only contents of a text paragraph the paragraph wrapper
|
305
|
|
|
|
|
|
|
will be removed from the stream and the tag is streamed standalone.
|
306
|
|
|
|
|
|
|
|
307
|
|
|
|
|
|
|
Configuration is done via options.
|
308
|
|
|
|
|
|
|
|
309
|
|
|
|
|
|
|
=over 4
|
310
|
|
|
|
|
|
|
|
311
|
|
|
|
|
|
|
=item format
|
312
|
|
|
|
|
|
|
|
313
|
|
|
|
|
|
|
This setting configures what kind of list will be generated. The following
|
314
|
|
|
|
|
|
|
values are specified:
|
315
|
|
|
|
|
|
|
|
316
|
|
|
|
|
|
|
=over 4
|
317
|
|
|
|
|
|
|
|
318
|
|
|
|
|
|
|
=item bullets
|
319
|
|
|
|
|
|
|
|
320
|
|
|
|
|
|
|
produces an I (bullet) list,
|
321
|
|
|
|
|
|
|
|
322
|
|
|
|
|
|
|
=item enumerated
|
323
|
|
|
|
|
|
|
|
324
|
|
|
|
|
|
|
produces an I list,
|
325
|
|
|
|
|
|
|
|
326
|
|
|
|
|
|
|
=item numbers
|
327
|
|
|
|
|
|
|
|
328
|
|
|
|
|
|
|
produces a list where each chapter is preceeded by its chapter number,
|
329
|
|
|
|
|
|
|
according to the documents hierarchy (C<1.1.5>, C<2.3.> etc.).
|
330
|
|
|
|
|
|
|
|
331
|
|
|
|
|
|
|
=back
|
332
|
|
|
|
|
|
|
|
333
|
|
|
|
|
|
|
If this option is omitted, the setting defaults to C.
|
334
|
|
|
|
|
|
|
|
335
|
|
|
|
|
|
|
=item intro
|
336
|
|
|
|
|
|
|
|
337
|
|
|
|
|
|
|
A text that can optional preceed the list of related chapters.
|
338
|
|
|
|
|
|
|
I
|
339
|
|
|
|
|
|
|
|
340
|
|
|
|
|
|
|
=item readdepth
|
341
|
|
|
|
|
|
|
|
342
|
|
|
|
|
|
|
Configures where keywords shall be collected - B includes
|
343
|
|
|
|
|
|
|
only the chapter where the tag is located in, while B includes
|
344
|
|
|
|
|
|
|
all the subchapters as well.
|
345
|
|
|
|
|
|
|
|
346
|
|
|
|
|
|
|
Defaults to C.
|
347
|
|
|
|
|
|
|
|
348
|
|
|
|
|
|
|
=item reldepth
|
349
|
|
|
|
|
|
|
|
350
|
|
|
|
|
|
|
Determines which keywords of other chapters shall be taken into account:
|
351
|
|
|
|
|
|
|
keywords found in the chapters containing I directly
|
352
|
|
|
|
|
|
|
(B), or all their subchapters as well (B).
|
353
|
|
|
|
|
|
|
|
354
|
|
|
|
|
|
|
Defaults to C.
|
355
|
|
|
|
|
|
|
|
356
|
|
|
|
|
|
|
=item threshold
|
357
|
|
|
|
|
|
|
|
358
|
|
|
|
|
|
|
Sets up what chapters shall be counted as "related", basing on the matching
|
359
|
|
|
|
|
|
|
index entries: can be set up absolutely (e.g. C<3 similar entries at least>) or
|
360
|
|
|
|
|
|
|
by a percentage (e.g. C<50% of I entries shall be marked there at least>).
|
361
|
|
|
|
|
|
|
|
362
|
|
|
|
|
|
|
Defaults to 100%.
|
363
|
|
|
|
|
|
|
|
364
|
|
|
|
|
|
|
=item type
|
365
|
|
|
|
|
|
|
|
366
|
|
|
|
|
|
|
B makes each listed chapter title a link to the related
|
367
|
|
|
|
|
|
|
chapter. Note that this feature depends on the target formats link
|
368
|
|
|
|
|
|
|
support, so results may vary.
|
369
|
|
|
|
|
|
|
|
370
|
|
|
|
|
|
|
By default, titles are displayed as I - B can be
|
371
|
|
|
|
|
|
|
used to specify this explicitly.
|
372
|
|
|
|
|
|
|
|
373
|
|
|
|
|
|
|
=back
|
374
|
|
|
|
|
|
|
|
375
|
|
|
|
|
|
|
B
|
376
|
|
|
|
|
|
|
|
377
|
|
|
|
|
|
|
|
378
|
|
|
|
|
|
|
\INDEXRELATIONS{format=numbers}
|
379
|
|
|
|
|
|
|
|
380
|
|
|
|
|
|
|
C<>
|
381
|
|
|
|
|
|
|
|
382
|
|
|
|
|
|
|
\INDEXRELATIONS{threshold="100%"
|
383
|
|
|
|
|
|
|
format=enumerated
|
384
|
|
|
|
|
|
|
type=plain}
|
385
|
|
|
|
|
|
|
|
386
|
|
|
|
|
|
|
C<>
|
387
|
|
|
|
|
|
|
|
388
|
|
|
|
|
|
|
\INDEXRELATIONS{readdepth=full
|
389
|
|
|
|
|
|
|
reldepth=startpage
|
390
|
|
|
|
|
|
|
threshold="50%"
|
391
|
|
|
|
|
|
|
format=bullets
|
392
|
|
|
|
|
|
|
type=linked}
|
393
|
|
|
|
|
|
|
|
394
|
|
|
|
|
|
|
|
395
|
|
|
|
|
|
|
|
396
|
|
|
|
|
|
|
|
397
|
|
|
|
|
|
|
=head2 LOCALTOC
|
398
|
|
|
|
|
|
|
|
399
|
|
|
|
|
|
|
inserts a list of subchapters, which means a list of the plain subchapter
|
400
|
|
|
|
|
|
|
titles. This is especially useful at the beginning of a greater document
|
401
|
|
|
|
|
|
|
section, or on an introduction page where you want to preview what the
|
402
|
|
|
|
|
|
|
audience can expect in the following talk section.
|
403
|
|
|
|
|
|
|
|
404
|
|
|
|
|
|
|
Using a tag relieves the documents author from writing and maintaining
|
405
|
|
|
|
|
|
|
this list manually.
|
406
|
|
|
|
|
|
|
|
407
|
|
|
|
|
|
|
If used as the only contents of a text paragraph the paragraph wrapper
|
408
|
|
|
|
|
|
|
will be removed from the stream and the tag is streamed standalone.
|
409
|
|
|
|
|
|
|
|
410
|
|
|
|
|
|
|
There is no tag body, but the result can be configured by I.
|
411
|
|
|
|
|
|
|
|
412
|
|
|
|
|
|
|
=over 4
|
413
|
|
|
|
|
|
|
|
414
|
|
|
|
|
|
|
=item depth
|
415
|
|
|
|
|
|
|
|
416
|
|
|
|
|
|
|
Subchapters may have subchapters as well. By default, the whole tree is
|
417
|
|
|
|
|
|
|
displayed, but this can be limited by this option. Pass the I
|
418
|
|
|
|
|
|
|
of sublevels that shall be included. The lowest possible value is C<1>.
|
419
|
|
|
|
|
|
|
Invalid option values will cause syntax errors.
|
420
|
|
|
|
|
|
|
|
421
|
|
|
|
|
|
|
Consider you are in a level 1 headline with these subchapters:
|
422
|
|
|
|
|
|
|
|
423
|
|
|
|
|
|
|
==Details 1
|
424
|
|
|
|
|
|
|
==Details 2
|
425
|
|
|
|
|
|
|
===Details 2 explained
|
426
|
|
|
|
|
|
|
===Details 2 furtherly explained
|
427
|
|
|
|
|
|
|
==Conclusion
|
428
|
|
|
|
|
|
|
|
429
|
|
|
|
|
|
|
Depth C<1> will result in listing "Details 1", "Details 2" and "Conclusion".
|
430
|
|
|
|
|
|
|
Depth C<2> or greater will add the explanation subchapters of level 3.
|
431
|
|
|
|
|
|
|
|
432
|
|
|
|
|
|
|
Note that the option expects an I value. The list depth is
|
433
|
|
|
|
|
|
|
independend of the I levels of subchapters. This way,
|
434
|
|
|
|
|
|
|
your settings will remain valid even if absolute levels change (which
|
435
|
|
|
|
|
|
|
might happen when the document is included, for example).
|
436
|
|
|
|
|
|
|
|
437
|
|
|
|
|
|
|
=item format
|
438
|
|
|
|
|
|
|
|
439
|
|
|
|
|
|
|
This setting configures what kind of list will be generated. The following
|
440
|
|
|
|
|
|
|
values are specified:
|
441
|
|
|
|
|
|
|
|
442
|
|
|
|
|
|
|
=over 4
|
443
|
|
|
|
|
|
|
|
444
|
|
|
|
|
|
|
=item bullets
|
445
|
|
|
|
|
|
|
|
446
|
|
|
|
|
|
|
produces an unordered list,
|
447
|
|
|
|
|
|
|
|
448
|
|
|
|
|
|
|
=item enumerated
|
449
|
|
|
|
|
|
|
|
450
|
|
|
|
|
|
|
produces an I list,
|
451
|
|
|
|
|
|
|
|
452
|
|
|
|
|
|
|
=item numbers
|
453
|
|
|
|
|
|
|
|
454
|
|
|
|
|
|
|
produces a list where each chapter is preceeded by its chapter number,
|
455
|
|
|
|
|
|
|
according to the documents hierarchy (C<1.1.5>, C<2.3.> etc.).
|
456
|
|
|
|
|
|
|
|
457
|
|
|
|
|
|
|
=back
|
458
|
|
|
|
|
|
|
|
459
|
|
|
|
|
|
|
If this option is omitted, the setting defaults to C.
|
460
|
|
|
|
|
|
|
|
461
|
|
|
|
|
|
|
|
462
|
|
|
|
|
|
|
=item type
|
463
|
|
|
|
|
|
|
|
464
|
|
|
|
|
|
|
B makes each listed subchapter title a link to the related
|
465
|
|
|
|
|
|
|
chapter. Note that this feature depends on the target formats link
|
466
|
|
|
|
|
|
|
support, so results may vary.
|
467
|
|
|
|
|
|
|
|
468
|
|
|
|
|
|
|
By default, titles are displayed as I - B can be
|
469
|
|
|
|
|
|
|
used to specify this explicitly.
|
470
|
|
|
|
|
|
|
|
471
|
|
|
|
|
|
|
|
472
|
|
|
|
|
|
|
=back
|
473
|
|
|
|
|
|
|
|
474
|
|
|
|
|
|
|
B
|
475
|
|
|
|
|
|
|
|
476
|
|
|
|
|
|
|
|
477
|
|
|
|
|
|
|
\LOCALTOC
|
478
|
|
|
|
|
|
|
|
479
|
|
|
|
|
|
|
C<>
|
480
|
|
|
|
|
|
|
|
481
|
|
|
|
|
|
|
\LOCALTOC{depth=2}
|
482
|
|
|
|
|
|
|
|
483
|
|
|
|
|
|
|
C<>
|
484
|
|
|
|
|
|
|
|
485
|
|
|
|
|
|
|
\LOCALTOC{format=enumerated type=linked}
|
486
|
|
|
|
|
|
|
|
487
|
|
|
|
|
|
|
|
488
|
|
|
|
|
|
|
|
489
|
|
|
|
|
|
|
=head2 READY
|
490
|
|
|
|
|
|
|
|
491
|
|
|
|
|
|
|
declares the document to be read completely. No options, no body. Works
|
492
|
|
|
|
|
|
|
instantly. Not even the current paragraph will become part of the result.
|
493
|
|
|
|
|
|
|
I
|
494
|
|
|
|
|
|
|
It is suggested to use it in a single text paragraph, usually embedded
|
495
|
|
|
|
|
|
|
into conditions.
|
496
|
|
|
|
|
|
|
|
497
|
|
|
|
|
|
|
? ready
|
498
|
|
|
|
|
|
|
|
499
|
|
|
|
|
|
|
C<>
|
500
|
|
|
|
|
|
|
|
501
|
|
|
|
|
|
|
\READY
|
502
|
|
|
|
|
|
|
|
503
|
|
|
|
|
|
|
C<>
|
504
|
|
|
|
|
|
|
|
505
|
|
|
|
|
|
|
? 1
|
506
|
|
|
|
|
|
|
|
507
|
|
|
|
|
|
|
|
508
|
|
|
|
|
|
|
=head2 REF
|
509
|
|
|
|
|
|
|
|
510
|
|
|
|
|
|
|
This is a very general and highly configurable reference.
|
511
|
|
|
|
|
|
|
It can be used both to make linked and unlinked references,
|
512
|
|
|
|
|
|
|
it can fallback to alternative references if necessary,
|
513
|
|
|
|
|
|
|
and it can finally be that optional that the specified
|
514
|
|
|
|
|
|
|
reference does not even has to exist.
|
515
|
|
|
|
|
|
|
|
516
|
|
|
|
|
|
|
There are various options. Please note that several options
|
517
|
|
|
|
|
|
|
are filled by the parser. They are not intended to be
|
518
|
|
|
|
|
|
|
propagated to document authors.
|
519
|
|
|
|
|
|
|
|
520
|
|
|
|
|
|
|
To make best use of \REF it is recommended to register
|
521
|
|
|
|
|
|
|
all anchors at parsing time (with the parsers anchor
|
522
|
|
|
|
|
|
|
object passed to all tag hooks).
|
523
|
|
|
|
|
|
|
|
524
|
|
|
|
|
|
|
|
525
|
|
|
|
|
|
|
=over 4
|
526
|
|
|
|
|
|
|
|
527
|
|
|
|
|
|
|
=item name
|
528
|
|
|
|
|
|
|
|
529
|
|
|
|
|
|
|
specifies the name of the target anchor.
|
530
|
|
|
|
|
|
|
A missing link is an error unless C
|
531
|
|
|
|
|
|
|
is set to a true value or an Cternative
|
532
|
|
|
|
|
|
|
address can be found.
|
533
|
|
|
|
|
|
|
|
534
|
|
|
|
|
|
|
Links are verified using the parsers anchor
|
535
|
|
|
|
|
|
|
object which is passed to all tag hooks.
|
536
|
|
|
|
|
|
|
|
537
|
|
|
|
|
|
|
=item type
|
538
|
|
|
|
|
|
|
|
539
|
|
|
|
|
|
|
configures which way the result should be produced:
|
540
|
|
|
|
|
|
|
|
541
|
|
|
|
|
|
|
I: The result is made a link to the referenced object.
|
542
|
|
|
|
|
|
|
|
543
|
|
|
|
|
|
|
I: This is the default and means that the result is supplied as plain text.
|
544
|
|
|
|
|
|
|
(This is the body text. For bodyless use, option I determines which text this is.)
|
545
|
|
|
|
|
|
|
|
546
|
|
|
|
|
|
|
=item valueformat
|
547
|
|
|
|
|
|
|
|
548
|
|
|
|
|
|
|
This option configures which text to display I. If there I a
|
549
|
|
|
|
|
|
|
tag body, this option is ignored and the body text is used.
|
550
|
|
|
|
|
|
|
|
551
|
|
|
|
|
|
|
=over 4
|
552
|
|
|
|
|
|
|
|
553
|
|
|
|
|
|
|
=item pure
|
554
|
|
|
|
|
|
|
|
555
|
|
|
|
|
|
|
This is the default. The text displayed is the I of the referenced object.
|
556
|
|
|
|
|
|
|
The value of a referenced object highly depends on its construction method. Please
|
557
|
|
|
|
|
|
|
refer to the specific elements documentation for details or just find it out be a trial.
|
558
|
|
|
|
|
|
|
|
559
|
|
|
|
|
|
|
Headline anchors made by the parser have an value
|
560
|
|
|
|
|
|
|
of the "headline string", which means the pure title
|
561
|
|
|
|
|
|
|
without any included tags.
|
562
|
|
|
|
|
|
|
|
563
|
|
|
|
|
|
|
Sequence numbers made by C<\SEQ> are evaluated
|
564
|
|
|
|
|
|
|
with their respective numbers.
|
565
|
|
|
|
|
|
|
|
566
|
|
|
|
|
|
|
|
567
|
|
|
|
|
|
|
=item pagetitle
|
568
|
|
|
|
|
|
|
|
569
|
|
|
|
|
|
|
The I of the page the referenced object is located in.
|
570
|
|
|
|
|
|
|
|
571
|
|
|
|
|
|
|
=item pagenr
|
572
|
|
|
|
|
|
|
|
573
|
|
|
|
|
|
|
The I of the page the referenced object is located in, e.g. "1.2.3.4.".
|
574
|
|
|
|
|
|
|
(Note that the format depends on the documents numbering scheme, which might be determined
|
575
|
|
|
|
|
|
|
by the used converter and calling options.)
|
576
|
|
|
|
|
|
|
|
577
|
|
|
|
|
|
|
=back
|
578
|
|
|
|
|
|
|
|
579
|
|
|
|
|
|
|
|
580
|
|
|
|
|
|
|
|
581
|
|
|
|
|
|
|
=item alt
|
582
|
|
|
|
|
|
|
|
583
|
|
|
|
|
|
|
If the anchor specified by C cannot be found,
|
584
|
|
|
|
|
|
|
the tag will try all entries of a comma separated list
|
585
|
|
|
|
|
|
|
specified by this options value. (For readability,
|
586
|
|
|
|
|
|
|
commata may be surrounded by whitespaces.) Trials
|
587
|
|
|
|
|
|
|
follow the listed link order, the first valid address
|
588
|
|
|
|
|
|
|
found will be used.
|
589
|
|
|
|
|
|
|
|
590
|
|
|
|
|
|
|
If an alternative contains commata itself, guard them
|
591
|
|
|
|
|
|
|
by a preceeding backslash.
|
592
|
|
|
|
|
|
|
|
593
|
|
|
|
|
|
|
Links are verified using the parsers anchor
|
594
|
|
|
|
|
|
|
object which is passed to all tag hooks.
|
595
|
|
|
|
|
|
|
|
596
|
|
|
|
|
|
|
=item occasion
|
597
|
|
|
|
|
|
|
|
598
|
|
|
|
|
|
|
If the tag cannot find a valid address (either
|
599
|
|
|
|
|
|
|
by C or by trying ), usually an
|
600
|
|
|
|
|
|
|
error occurs. By setting this option to a true
|
601
|
|
|
|
|
|
|
value a missing link will be ignored. The result
|
602
|
|
|
|
|
|
|
is equal to a I C<\REF> tag.
|
603
|
|
|
|
|
|
|
|
604
|
|
|
|
|
|
|
=item __body__
|
605
|
|
|
|
|
|
|
|
606
|
|
|
|
|
|
|
A flag saying there was a body specified or not.
|
607
|
|
|
|
|
|
|
This information can help converters to start a translation
|
608
|
|
|
|
|
|
|
before having read the tag body tokens (producing
|
609
|
|
|
|
|
|
|
links, a tag without body means that we have to
|
610
|
|
|
|
|
|
|
use the value of the referenced object (see C<__value__>)
|
611
|
|
|
|
|
|
|
our text, otherwise, the body text must be used).
|
612
|
|
|
|
|
|
|
|
613
|
|
|
|
|
|
|
=item __value__
|
614
|
|
|
|
|
|
|
|
615
|
|
|
|
|
|
|
The value of the (finally) referenced object. This
|
616
|
|
|
|
|
|
|
only works if the referenced anchor was registered
|
617
|
|
|
|
|
|
|
to the parsers C object which
|
618
|
|
|
|
|
|
|
is passed to all tag hooks.
|
619
|
|
|
|
|
|
|
|
620
|
|
|
|
|
|
|
=item __chapter__
|
621
|
|
|
|
|
|
|
|
622
|
|
|
|
|
|
|
The I number of the chapter the reference points to.
|
623
|
|
|
|
|
|
|
Again, this only works if the referenced anchor was registered
|
624
|
|
|
|
|
|
|
to the parsers C object.
|
625
|
|
|
|
|
|
|
|
626
|
|
|
|
|
|
|
=back
|
627
|
|
|
|
|
|
|
|
628
|
|
|
|
|
|
|
|
629
|
|
|
|
|
|
|
=head2 SEQ
|
630
|
|
|
|
|
|
|
|
631
|
|
|
|
|
|
|
Inserts the next value of a certain numerical sequence.
|
632
|
|
|
|
|
|
|
Optionally, the generated number can be made an I
|
633
|
|
|
|
|
|
|
to reference it at another place.
|
634
|
|
|
|
|
|
|
|
635
|
|
|
|
|
|
|
There is no tag body, but there are several I.
|
636
|
|
|
|
|
|
|
Please note that the parser passes informations by
|
637
|
|
|
|
|
|
|
internal options as well.
|
638
|
|
|
|
|
|
|
|
639
|
|
|
|
|
|
|
|
640
|
|
|
|
|
|
|
=over 4
|
641
|
|
|
|
|
|
|
|
642
|
|
|
|
|
|
|
=item type
|
643
|
|
|
|
|
|
|
|
644
|
|
|
|
|
|
|
This specifies the sequence the number shall
|
645
|
|
|
|
|
|
|
belong to. If the specified string is not already
|
646
|
|
|
|
|
|
|
registered as a sequence, a new sequence is opened.
|
647
|
|
|
|
|
|
|
The first number in a new sequence is C<1>. If
|
648
|
|
|
|
|
|
|
the sequence is already known, the next number in
|
649
|
|
|
|
|
|
|
it will be supplied.
|
650
|
|
|
|
|
|
|
|
651
|
|
|
|
|
|
|
=item name
|
652
|
|
|
|
|
|
|
|
653
|
|
|
|
|
|
|
If passed, this option sets an anchor name which
|
654
|
|
|
|
|
|
|
is registered to the parsers C
|
655
|
|
|
|
|
|
|
object (which is passed to all tag hooks). This makes
|
656
|
|
|
|
|
|
|
it easy to reference the generated number at another
|
657
|
|
|
|
|
|
|
place (by \REF or another referencing tag). The value
|
658
|
|
|
|
|
|
|
of such a link is the sequence number.
|
659
|
|
|
|
|
|
|
|
660
|
|
|
|
|
|
|
By default, no anchor is generated.
|
661
|
|
|
|
|
|
|
|
662
|
|
|
|
|
|
|
=item __nr__
|
663
|
|
|
|
|
|
|
|
664
|
|
|
|
|
|
|
This is the generated sequence number, inserted by the parser.
|
665
|
|
|
|
|
|
|
No user option.
|
666
|
|
|
|
|
|
|
|
667
|
|
|
|
|
|
|
=back
|
668
|
|
|
|
|
|
|
|
669
|
|
|
|
|
|
|
=head2 STOP
|
670
|
|
|
|
|
|
|
|
671
|
|
|
|
|
|
|
Enforces an syntactical error which stops document processing immediately.
|
672
|
|
|
|
|
|
|
Most useful when used with tag conditions.
|
673
|
|
|
|
|
|
|
|
674
|
|
|
|
|
|
|
=head2 X
|
675
|
|
|
|
|
|
|
|
676
|
|
|
|
|
|
|
Marks the body to included into the index. Formatting of the index is up to
|
677
|
|
|
|
|
|
|
the converters, as is its location unless the I tag is used to include
|
678
|
|
|
|
|
|
|
it explicitly.
|
679
|
|
|
|
|
|
|
|
680
|
|
|
|
|
|
|
There are no basic options, but usually converters declare their own, so please
|
681
|
|
|
|
|
|
|
refer to the docs of your preferred converter for option details.
|
682
|
|
|
|
|
|
|
|
683
|
|
|
|
|
|
|
|
684
|
|
|
|
|
|
|
=head1 TAG SETS
|
685
|
|
|
|
|
|
|
|
686
|
|
|
|
|
|
|
There is only one set "basic" including all the tags.
|
687
|
|
|
|
|
|
|
|
688
|
|
|
|
|
|
|
=cut
|
689
|
|
|
|
|
|
|
|
690
|
|
|
|
|
|
|
|
691
|
|
|
|
|
|
|
# check perl version
|
692
|
|
|
|
|
|
|
require 5.00503;
|
693
|
|
|
|
|
|
|
|
694
|
|
|
|
|
|
|
# = PACKAGE SECTION (internal helper package) ==========================================
|
695
|
|
|
|
|
|
|
|
696
|
|
|
|
|
|
|
# declare package
|
697
|
|
|
|
|
|
|
package PerlPoint::Tags::Basic;
|
698
|
|
|
|
|
|
|
|
699
|
|
|
|
|
|
|
# declare package version
|
700
|
|
|
|
|
|
|
$VERSION=0.08;
|
701
|
|
|
|
|
|
|
|
702
|
|
|
|
|
|
|
# declare base "class"
|
703
|
4
|
|
|
4
|
|
5492
|
use base qw(PerlPoint::Tags);
|
|
4
|
|
|
|
|
8
|
|
|
4
|
|
|
|
|
596
|
|
704
|
|
|
|
|
|
|
|
705
|
|
|
|
|
|
|
|
706
|
|
|
|
|
|
|
# = PRAGMA SECTION =======================================================================
|
707
|
|
|
|
|
|
|
|
708
|
|
|
|
|
|
|
# set pragmata
|
709
|
4
|
|
|
4
|
|
25
|
use strict;
|
|
4
|
|
|
|
|
7
|
|
|
4
|
|
|
|
|
145
|
|
710
|
4
|
|
|
4
|
|
21
|
use vars qw(%tags %sets);
|
|
4
|
|
|
|
|
7
|
|
|
4
|
|
|
|
|
382
|
|
711
|
|
|
|
|
|
|
|
712
|
|
|
|
|
|
|
# = LIBRARY SECTION ======================================================================
|
713
|
|
|
|
|
|
|
|
714
|
|
|
|
|
|
|
# load modules
|
715
|
4
|
|
|
4
|
|
23
|
use File::Basename;
|
|
4
|
|
|
|
|
16
|
|
|
4
|
|
|
|
|
361
|
|
716
|
4
|
|
|
4
|
|
23
|
use Cwd qw(cwd abs_path);
|
|
4
|
|
|
|
|
8
|
|
|
4
|
|
|
|
|
281
|
|
717
|
4
|
|
|
4
|
|
24
|
use PerlPoint::Constants 0.14 qw(:parsing :tags);
|
|
4
|
|
|
|
|
119
|
|
|
4
|
|
|
|
|
19683
|
|
718
|
|
|
|
|
|
|
|
719
|
|
|
|
|
|
|
|
720
|
|
|
|
|
|
|
# = CODE SECTION =========================================================================
|
721
|
|
|
|
|
|
|
|
722
|
|
|
|
|
|
|
# private variables
|
723
|
|
|
|
|
|
|
my (%seq, %index);
|
724
|
|
|
|
|
|
|
|
725
|
|
|
|
|
|
|
# tag declarations
|
726
|
|
|
|
|
|
|
%tags=(
|
727
|
|
|
|
|
|
|
# base fomatting tags: no options, mandatory body
|
728
|
|
|
|
|
|
|
B => {body => TAGS_MANDATORY,},
|
729
|
|
|
|
|
|
|
C => {body => TAGS_MANDATORY,},
|
730
|
|
|
|
|
|
|
I => {body => TAGS_MANDATORY,},
|
731
|
|
|
|
|
|
|
|
732
|
|
|
|
|
|
|
|
733
|
|
|
|
|
|
|
# anchor
|
734
|
|
|
|
|
|
|
A => {
|
735
|
|
|
|
|
|
|
# optional options, mandatory body
|
736
|
|
|
|
|
|
|
options => TAGS_MANDATORY,
|
737
|
|
|
|
|
|
|
body => TAGS_OPTIONAL,
|
738
|
|
|
|
|
|
|
|
739
|
|
|
|
|
|
|
# hook - update the hash of index entries
|
740
|
|
|
|
|
|
|
hook => sub
|
741
|
|
|
|
|
|
|
{
|
742
|
|
|
|
|
|
|
# take parameters
|
743
|
|
|
|
|
|
|
my ($tagLine, $options, $body, $anchors, $headlineIds, $chapterNr)=@_;
|
744
|
|
|
|
|
|
|
|
745
|
|
|
|
|
|
|
# inits
|
746
|
|
|
|
|
|
|
my $ok=PARSING_OK;
|
747
|
|
|
|
|
|
|
|
748
|
|
|
|
|
|
|
# probably we should check if the anchor entry is the innermost tag
|
749
|
|
|
|
|
|
|
# - which it currently should be (at least for HTML targets), but of
|
750
|
|
|
|
|
|
|
# course this makes it more inconvenient for users ...
|
751
|
|
|
|
|
|
|
warn qq(\n\n[Error] Anchor tags need to be the innermost tags/macros in line $tagLine, sorry.\n) and return(PARSING_ERROR) if grep((ref), @$body);
|
752
|
|
|
|
|
|
|
|
753
|
|
|
|
|
|
|
# check options
|
754
|
|
|
|
|
|
|
$ok=PARSING_FAILED, warn qq(\n\n[Error] Missing "name" option in A tag, line $tagLine.\n) unless exists $options->{name};
|
755
|
|
|
|
|
|
|
|
756
|
|
|
|
|
|
|
# all right?
|
757
|
|
|
|
|
|
|
if ($ok==PARSING_OK)
|
758
|
|
|
|
|
|
|
{
|
759
|
|
|
|
|
|
|
# add an anchor
|
760
|
|
|
|
|
|
|
$anchors->add($options->{name}, $options->{name}, $chapterNr);
|
761
|
|
|
|
|
|
|
}
|
762
|
|
|
|
|
|
|
|
763
|
|
|
|
|
|
|
# flag success
|
764
|
|
|
|
|
|
|
$ok;
|
765
|
|
|
|
|
|
|
},
|
766
|
|
|
|
|
|
|
},
|
767
|
|
|
|
|
|
|
|
768
|
|
|
|
|
|
|
|
769
|
|
|
|
|
|
|
# index entry
|
770
|
|
|
|
|
|
|
X => {
|
771
|
|
|
|
|
|
|
# optional options, mandatory body
|
772
|
|
|
|
|
|
|
options => TAGS_OPTIONAL,
|
773
|
|
|
|
|
|
|
body => TAGS_MANDATORY,
|
774
|
|
|
|
|
|
|
|
775
|
|
|
|
|
|
|
# hook - update the hash of index entries
|
776
|
|
|
|
|
|
|
hook => sub
|
777
|
|
|
|
|
|
|
{
|
778
|
|
|
|
|
|
|
# take parameters
|
779
|
|
|
|
|
|
|
my ($tagLine, $options, $body, $anchors, $headlineIds, $chapterNr)=@_;
|
780
|
|
|
|
|
|
|
|
781
|
|
|
|
|
|
|
# probably we should check if the index entry is the innermost tag
|
782
|
|
|
|
|
|
|
# - which it currently should be, but of course this makes it more
|
783
|
|
|
|
|
|
|
# inconvenient for users ...
|
784
|
|
|
|
|
|
|
warn qq(\n\n[Error] Index tags need to be the innermost tags/macros in line $tagLine, sorry.\n) and return(PARSING_ERROR) if grep((ref), @$body);
|
785
|
|
|
|
|
|
|
|
786
|
|
|
|
|
|
|
# add or update entry (this only works if the tag is the innermost tag/macro)
|
787
|
|
|
|
|
|
|
my $entry=join(' ', @$body);
|
788
|
|
|
|
|
|
|
$index{tags}{$headlineIds}{$entry}++;
|
789
|
|
|
|
|
|
|
|
790
|
|
|
|
|
|
|
# add an anchor (with a generic name), store its name for \INDEX
|
791
|
|
|
|
|
|
|
# and make it part of the option list (for converter access)
|
792
|
|
|
|
|
|
|
$anchors->add((my $anchor)=$anchors->generic, $headlineIds, $chapterNr);
|
793
|
|
|
|
|
|
|
push(@{$index{anchors}{$entry}}, [$anchor, (split('-', $headlineIds))[-1]], $chapterNr);
|
794
|
|
|
|
|
|
|
$options->{__anchor}=$anchor;
|
795
|
|
|
|
|
|
|
|
796
|
|
|
|
|
|
|
# flag success
|
797
|
|
|
|
|
|
|
PARSING_OK;
|
798
|
|
|
|
|
|
|
},
|
799
|
|
|
|
|
|
|
},
|
800
|
|
|
|
|
|
|
|
801
|
|
|
|
|
|
|
|
802
|
|
|
|
|
|
|
# full index
|
803
|
|
|
|
|
|
|
INDEX => {
|
804
|
|
|
|
|
|
|
# no body, currently no options
|
805
|
|
|
|
|
|
|
body => TAGS_DISABLED,
|
806
|
|
|
|
|
|
|
options => TAGS_DISABLED,
|
807
|
|
|
|
|
|
|
|
808
|
|
|
|
|
|
|
# can be used as a standalone tag
|
809
|
|
|
|
|
|
|
standalone => 1,
|
810
|
|
|
|
|
|
|
|
811
|
|
|
|
|
|
|
# activate the finish hook
|
812
|
|
|
|
|
|
|
hook => sub {PARSING_OK;},
|
813
|
|
|
|
|
|
|
|
814
|
|
|
|
|
|
|
# finish hook - provide index data
|
815
|
|
|
|
|
|
|
finish => sub
|
816
|
|
|
|
|
|
|
{
|
817
|
|
|
|
|
|
|
# take parameters
|
818
|
|
|
|
|
|
|
my ($options, $anchors)=@_;
|
819
|
|
|
|
|
|
|
|
820
|
|
|
|
|
|
|
# preformat an index
|
821
|
|
|
|
|
|
|
foreach my $entry (sort keys %{$index{anchors}})
|
822
|
|
|
|
|
|
|
{
|
823
|
|
|
|
|
|
|
my $group=uc(substr($entry, 0, 1));
|
824
|
|
|
|
|
|
|
$group='_' if $group=~/[\W\d]/;
|
825
|
|
|
|
|
|
|
push(@{$options->{__anchors}{$group}}, [$entry, $index{anchors}{$entry}]);
|
826
|
|
|
|
|
|
|
}
|
827
|
|
|
|
|
|
|
|
828
|
|
|
|
|
|
|
# flag success
|
829
|
|
|
|
|
|
|
PARSING_OK;
|
830
|
|
|
|
|
|
|
},
|
831
|
|
|
|
|
|
|
},
|
832
|
|
|
|
|
|
|
|
833
|
|
|
|
|
|
|
|
834
|
|
|
|
|
|
|
# index cloud - the implementation here is very similar to INDEX
|
835
|
|
|
|
|
|
|
INDEXCLOUD => {
|
836
|
|
|
|
|
|
|
# no body, currently no options
|
837
|
|
|
|
|
|
|
body => TAGS_DISABLED,
|
838
|
|
|
|
|
|
|
options => TAGS_OPTIONAL,
|
839
|
|
|
|
|
|
|
|
840
|
|
|
|
|
|
|
# can be used as a standalone tag
|
841
|
|
|
|
|
|
|
standalone => 1,
|
842
|
|
|
|
|
|
|
|
843
|
|
|
|
|
|
|
# activate the finish hook
|
844
|
|
|
|
|
|
|
hook => sub {PARSING_OK;},
|
845
|
|
|
|
|
|
|
|
846
|
|
|
|
|
|
|
# finish hook - provide index data
|
847
|
|
|
|
|
|
|
finish => sub
|
848
|
|
|
|
|
|
|
{
|
849
|
|
|
|
|
|
|
# take parameters
|
850
|
|
|
|
|
|
|
my ($options, $anchors)=@_;
|
851
|
|
|
|
|
|
|
|
852
|
|
|
|
|
|
|
# preformat an index
|
853
|
|
|
|
|
|
|
foreach my $entry (sort keys %{$index{anchors}})
|
854
|
|
|
|
|
|
|
{
|
855
|
|
|
|
|
|
|
my $group=uc(substr($entry, 0, 1));
|
856
|
|
|
|
|
|
|
$group='_' if $group=~/[\W\d]/;
|
857
|
|
|
|
|
|
|
push(@{$options->{__anchors}{$group}}, [$entry, $index{anchors}{$entry}]);
|
858
|
|
|
|
|
|
|
}
|
859
|
|
|
|
|
|
|
|
860
|
|
|
|
|
|
|
# flag success
|
861
|
|
|
|
|
|
|
PARSING_OK;
|
862
|
|
|
|
|
|
|
},
|
863
|
|
|
|
|
|
|
},
|
864
|
|
|
|
|
|
|
|
865
|
|
|
|
|
|
|
|
866
|
|
|
|
|
|
|
# index crossref (related chapters according to matching index entries)
|
867
|
|
|
|
|
|
|
INDEXRELATIONS => {
|
868
|
|
|
|
|
|
|
# options, no body
|
869
|
|
|
|
|
|
|
options => TAGS_OPTIONAL,
|
870
|
|
|
|
|
|
|
body => TAGS_DISABLED,
|
871
|
|
|
|
|
|
|
|
872
|
|
|
|
|
|
|
# can be used as a standalone tag
|
873
|
|
|
|
|
|
|
standalone => 1,
|
874
|
|
|
|
|
|
|
|
875
|
|
|
|
|
|
|
# hook!
|
876
|
|
|
|
|
|
|
hook => sub
|
877
|
|
|
|
|
|
|
{
|
878
|
|
|
|
|
|
|
# take parameters
|
879
|
|
|
|
|
|
|
my ($tagLine, $options, $body, $anchors, $headlineIds, $chapterNr)=@_;
|
880
|
|
|
|
|
|
|
|
881
|
|
|
|
|
|
|
# declare variables
|
882
|
|
|
|
|
|
|
my $ok=PARSING_OK;
|
883
|
|
|
|
|
|
|
|
884
|
|
|
|
|
|
|
# check options
|
885
|
|
|
|
|
|
|
$ok=PARSING_ERROR, warn qq(\n\n[Error] Option "readdepth" of tag INDEXRELATIONS needs to be "startpage" or "full", line $tagLine.\n) if exists $options->{readdepth} and $options->{readdepth}!~/^(startpage|full)$/;
|
886
|
|
|
|
|
|
|
$ok=PARSING_ERROR, warn qq(\n\n[Error] Option "reldepth" of tag INDEXRELATIONS needs to be "startpage" or "full", line $tagLine.\n) if exists $options->{reldepth} and $options->{reldepth}!~/^(startpage|full)$/;
|
887
|
|
|
|
|
|
|
$ok=PARSING_ERROR, warn qq(\n\n[Error] Option "threshold" of tag INDEXRELATIONS needs to be a number or a valid percentage spec, line $tagLine.\n) if exists $options->{threshold} and $options->{threshold}!~/^\s*((((\d{1,2})|(100))\s*\%)|(\d+))\s*$/;
|
888
|
|
|
|
|
|
|
|
889
|
|
|
|
|
|
|
$ok=PARSING_FAILED, warn qq(\n\n[Error] Invalid "format" setting "$options->{format}" in LOCALTOC tag, line $tagLine.\n)
|
890
|
|
|
|
|
|
|
if exists $options->{format}
|
891
|
|
|
|
|
|
|
and $options->{format}!~/^(bullets|enumerated|numbers)$/;
|
892
|
|
|
|
|
|
|
|
893
|
|
|
|
|
|
|
$ok=PARSING_FAILED, warn qq(\n\n[Error] Invalid "type" setting "$options->{type}" in LOCALTOC tag, line $tagLine.\n)
|
894
|
|
|
|
|
|
|
if exists $options->{type}
|
895
|
|
|
|
|
|
|
and $options->{type}!~/^(linked|plain)$/;
|
896
|
|
|
|
|
|
|
|
897
|
|
|
|
|
|
|
# check successfull?
|
898
|
|
|
|
|
|
|
return $ok unless $ok==PARSING_OK;
|
899
|
|
|
|
|
|
|
|
900
|
|
|
|
|
|
|
# set defaults, if necessary
|
901
|
|
|
|
|
|
|
if ($ok==PARSING_OK)
|
902
|
|
|
|
|
|
|
{
|
903
|
|
|
|
|
|
|
$options->{format}='bullets' unless exists $options->{format};
|
904
|
|
|
|
|
|
|
$options->{type}='plain' unless exists $options->{type};
|
905
|
|
|
|
|
|
|
}
|
906
|
|
|
|
|
|
|
|
907
|
|
|
|
|
|
|
# note occurence
|
908
|
|
|
|
|
|
|
$index{idr}{$headlineIds}={};
|
909
|
|
|
|
|
|
|
|
910
|
|
|
|
|
|
|
# pass the headline id to the finish hook
|
911
|
|
|
|
|
|
|
$options->{__id}=$headlineIds;
|
912
|
|
|
|
|
|
|
|
913
|
|
|
|
|
|
|
# flag success
|
914
|
|
|
|
|
|
|
PARSING_OK;
|
915
|
|
|
|
|
|
|
},
|
916
|
|
|
|
|
|
|
|
917
|
|
|
|
|
|
|
# finish hook - extract index data
|
918
|
|
|
|
|
|
|
finish => sub
|
919
|
|
|
|
|
|
|
{
|
920
|
|
|
|
|
|
|
# take parameters
|
921
|
|
|
|
|
|
|
my ($options)=@_;
|
922
|
|
|
|
|
|
|
|
923
|
|
|
|
|
|
|
# declarations
|
924
|
|
|
|
|
|
|
my @chapters;
|
925
|
|
|
|
|
|
|
|
926
|
|
|
|
|
|
|
# prepare the index for cross references unless done before
|
927
|
|
|
|
|
|
|
unless (exists $index{flags}{arranged})
|
928
|
|
|
|
|
|
|
{
|
929
|
|
|
|
|
|
|
# make a list of all entry points (to avoid multiple
|
930
|
|
|
|
|
|
|
# usage of "keys %..." later on)
|
931
|
|
|
|
|
|
|
my @collectors=keys %{$index{idr}};
|
932
|
|
|
|
|
|
|
|
933
|
|
|
|
|
|
|
# build a pattern to search for matching chapters
|
934
|
|
|
|
|
|
|
my $pattern=join('|', map {"($_)"} keys %{$index{idr}});
|
935
|
|
|
|
|
|
|
|
936
|
|
|
|
|
|
|
# now collect all relevant tags for their "parent" INDEXRELATIONs
|
937
|
|
|
|
|
|
|
foreach my $chapter (grep(/^($pattern)/o, keys %{$index{tags}}))
|
938
|
|
|
|
|
|
|
{
|
939
|
|
|
|
|
|
|
# make a list of index entries known for this chapter
|
940
|
|
|
|
|
|
|
my %entries;
|
941
|
|
|
|
|
|
|
@entries{keys %{$index{tags}{$chapter}}}=();
|
942
|
|
|
|
|
|
|
|
943
|
|
|
|
|
|
|
# store index entries for all entry points (collectors)
|
944
|
|
|
|
|
|
|
foreach my $collector (grep($chapter=~/^$_/, @collectors))
|
945
|
|
|
|
|
|
|
{
|
946
|
|
|
|
|
|
|
# Found in the collectors own chapter? Note this.
|
947
|
|
|
|
|
|
|
@{$index{idr}{$collector}{direct}}{keys %entries}=() if $chapter eq $collector;
|
948
|
|
|
|
|
|
|
|
949
|
|
|
|
|
|
|
# ALL occurences, including those in collectors subchapters, are stored in a second list.
|
950
|
|
|
|
|
|
|
@{$index{idr}{$collector}{full}}{keys %entries}=();
|
951
|
|
|
|
|
|
|
}
|
952
|
|
|
|
|
|
|
}
|
953
|
|
|
|
|
|
|
|
954
|
|
|
|
|
|
|
# mark that data were arranged
|
955
|
|
|
|
|
|
|
$index{flags}{arranged}=1;
|
956
|
|
|
|
|
|
|
}
|
957
|
|
|
|
|
|
|
|
958
|
|
|
|
|
|
|
# get chapter id (and delete it by the way)
|
959
|
|
|
|
|
|
|
my $headlineIds=delete($options->{__id});
|
960
|
|
|
|
|
|
|
|
961
|
|
|
|
|
|
|
# get all index entries of your own chapter, depending on the depth option
|
962
|
|
|
|
|
|
|
my %entries;
|
963
|
|
|
|
|
|
|
@entries{exists $index{idr}{$headlineIds} ? keys %{$index{idr}{$headlineIds}{(exists $options->{readdepth} and lc($options->{readdepth}) eq 'startpage') ? 'direct' : 'full'}} : ()}=();
|
964
|
|
|
|
|
|
|
|
965
|
|
|
|
|
|
|
# anything found?
|
966
|
|
|
|
|
|
|
if (%entries)
|
967
|
|
|
|
|
|
|
{
|
968
|
|
|
|
|
|
|
# collect data (skip all chapters in the same hierachy chain)
|
969
|
|
|
|
|
|
|
foreach my $id (sort grep {(not _checkHeadlineChain($_, $headlineIds))} keys %{$index{idr}})
|
970
|
|
|
|
|
|
|
{
|
971
|
|
|
|
|
|
|
# scopy
|
972
|
|
|
|
|
|
|
my @found;
|
973
|
|
|
|
|
|
|
|
974
|
|
|
|
|
|
|
# get all equal entries;
|
975
|
|
|
|
|
|
|
@found=map {exists $entries{$_} ? $_ : ()} keys %{$index{idr}{$id}{(exists $options->{reldepth} and lc($options->{reldepth}) eq 'startpage') ? 'direct' : 'full'}};
|
976
|
|
|
|
|
|
|
|
977
|
|
|
|
|
|
|
# calculate percentage, extract chapter id
|
978
|
|
|
|
|
|
|
my $percentage=100*@found/scalar(keys %entries);
|
979
|
|
|
|
|
|
|
my $chapter=(split(/-/, $id))[-1];
|
980
|
|
|
|
|
|
|
|
981
|
|
|
|
|
|
|
# validate results - can we use them?
|
982
|
|
|
|
|
|
|
if (@found)
|
983
|
|
|
|
|
|
|
{
|
984
|
|
|
|
|
|
|
# validate results - can we use them?
|
985
|
|
|
|
|
|
|
if (exists $options->{threshold})
|
986
|
|
|
|
|
|
|
{
|
987
|
|
|
|
|
|
|
# percentage calculation required?
|
988
|
|
|
|
|
|
|
if ($options->{threshold}=~/^\s*((\d{1,2})|(100))\s*\%\s*$/)
|
989
|
|
|
|
|
|
|
{
|
990
|
|
|
|
|
|
|
# check percentage
|
991
|
|
|
|
|
|
|
push(@chapters, [$chapter, $percentage]) if $percentage>=$1;
|
992
|
|
|
|
|
|
|
}
|
993
|
|
|
|
|
|
|
else
|
994
|
|
|
|
|
|
|
{
|
995
|
|
|
|
|
|
|
# check the number of results
|
996
|
|
|
|
|
|
|
push(@chapters, [$chapter, $percentage]) if $options->{threshold}<=@found;
|
997
|
|
|
|
|
|
|
}
|
998
|
|
|
|
|
|
|
}
|
999
|
|
|
|
|
|
|
else
|
1000
|
|
|
|
|
|
|
{
|
1001
|
|
|
|
|
|
|
# no threshold - use results
|
1002
|
|
|
|
|
|
|
push(@chapters, [$chapter, $percentage]);
|
1003
|
|
|
|
|
|
|
}
|
1004
|
|
|
|
|
|
|
}
|
1005
|
|
|
|
|
|
|
}
|
1006
|
|
|
|
|
|
|
}
|
1007
|
|
|
|
|
|
|
|
1008
|
|
|
|
|
|
|
# provide results via option, sort it by relevance
|
1009
|
|
|
|
|
|
|
$options->{__data}=[sort {$a->[1]<=>$b->[1]} @chapters];
|
1010
|
|
|
|
|
|
|
|
1011
|
|
|
|
|
|
|
# flag success in the appropriate way
|
1012
|
|
|
|
|
|
|
@chapters ? PARSING_OK : PARSING_IGNORE;
|
1013
|
|
|
|
|
|
|
},
|
1014
|
|
|
|
|
|
|
},
|
1015
|
|
|
|
|
|
|
|
1016
|
|
|
|
|
|
|
|
1017
|
|
|
|
|
|
|
# container of formatting switches
|
1018
|
|
|
|
|
|
|
FORMAT => {
|
1019
|
|
|
|
|
|
|
# all switches are passed by options
|
1020
|
|
|
|
|
|
|
options => TAGS_MANDATORY,
|
1021
|
|
|
|
|
|
|
|
1022
|
|
|
|
|
|
|
# no body needed
|
1023
|
|
|
|
|
|
|
body => TAGS_DISABLED,
|
1024
|
|
|
|
|
|
|
|
1025
|
|
|
|
|
|
|
# can be used as a standalone tag
|
1026
|
|
|
|
|
|
|
standalone => 1,
|
1027
|
|
|
|
|
|
|
},
|
1028
|
|
|
|
|
|
|
|
1029
|
|
|
|
|
|
|
|
1030
|
|
|
|
|
|
|
# format a selected text ("F" initially meant "font")
|
1031
|
|
|
|
|
|
|
F => {
|
1032
|
|
|
|
|
|
|
# options and body both are required
|
1033
|
|
|
|
|
|
|
options => TAGS_MANDATORY,
|
1034
|
|
|
|
|
|
|
body => TAGS_MANDATORY,
|
1035
|
|
|
|
|
|
|
},
|
1036
|
|
|
|
|
|
|
|
1037
|
|
|
|
|
|
|
# resolve a reference
|
1038
|
|
|
|
|
|
|
HIDE => {
|
1039
|
|
|
|
|
|
|
# conditions are options (currently), so ...
|
1040
|
|
|
|
|
|
|
options => TAGS_OPTIONAL,
|
1041
|
|
|
|
|
|
|
|
1042
|
|
|
|
|
|
|
# there must be something to hide
|
1043
|
|
|
|
|
|
|
body => TAGS_MANDATORY,
|
1044
|
|
|
|
|
|
|
|
1045
|
|
|
|
|
|
|
# hook!
|
1046
|
|
|
|
|
|
|
hook => sub
|
1047
|
|
|
|
|
|
|
{
|
1048
|
|
|
|
|
|
|
# if this hook is invoked, it means we *shall* hide
|
1049
|
|
|
|
|
|
|
# all content, so instruct the parser appropriately
|
1050
|
|
|
|
|
|
|
PARSING_ERASE;
|
1051
|
|
|
|
|
|
|
},
|
1052
|
|
|
|
|
|
|
},
|
1053
|
|
|
|
|
|
|
|
1054
|
|
|
|
|
|
|
# image: no body, but several mandatory options
|
1055
|
|
|
|
|
|
|
IMAGE => {
|
1056
|
|
|
|
|
|
|
# mandatory options
|
1057
|
|
|
|
|
|
|
options => TAGS_MANDATORY,
|
1058
|
|
|
|
|
|
|
|
1059
|
|
|
|
|
|
|
# no body required
|
1060
|
|
|
|
|
|
|
body => TAGS_DISABLED,
|
1061
|
|
|
|
|
|
|
|
1062
|
|
|
|
|
|
|
# can be used as a standalone tag
|
1063
|
|
|
|
|
|
|
standalone => 1,
|
1064
|
|
|
|
|
|
|
|
1065
|
|
|
|
|
|
|
# hook!
|
1066
|
|
|
|
|
|
|
hook => sub
|
1067
|
|
|
|
|
|
|
{
|
1068
|
|
|
|
|
|
|
# declare and init variable
|
1069
|
|
|
|
|
|
|
my $ok=PARSING_OK;
|
1070
|
|
|
|
|
|
|
|
1071
|
|
|
|
|
|
|
# take parameters
|
1072
|
|
|
|
|
|
|
my ($tagLine, $options)=@_;
|
1073
|
|
|
|
|
|
|
|
1074
|
|
|
|
|
|
|
# check them
|
1075
|
|
|
|
|
|
|
$ok=PARSING_FAILED, warn qq(\n\n[Error] Missing "src" option in IMAGE tag, line $tagLine.\n) unless exists $options->{src};
|
1076
|
|
|
|
|
|
|
$ok=PARSING_ERROR, warn qq(\n\n[Error] Image file "$options->{src}" does not exist or is no file in IMAGE tag, line $tagLine.\n) if $ok==PARSING_OK and not (-e $options->{src} and not -d _);
|
1077
|
|
|
|
|
|
|
|
1078
|
|
|
|
|
|
|
# add "alt" option, if necessary
|
1079
|
|
|
|
|
|
|
$options->{alt}='Image' unless exists $options->{alt};
|
1080
|
|
|
|
|
|
|
|
1081
|
|
|
|
|
|
|
# add current path to options, if necessary (deprecated)
|
1082
|
|
|
|
|
|
|
$options->{__loaderpath__}=cwd() if $ok==PARSING_OK;
|
1083
|
|
|
|
|
|
|
|
1084
|
|
|
|
|
|
|
# absolutify the image source path (should work on UNIX and DOS, but other systems?)
|
1085
|
|
|
|
|
|
|
my ($base, $path, $type)=fileparse($options->{src});
|
1086
|
|
|
|
|
|
|
$options->{src}=join('/', abs_path($path), basename($options->{src})) if $ok==PARSING_OK;
|
1087
|
|
|
|
|
|
|
|
1088
|
|
|
|
|
|
|
# supply status
|
1089
|
|
|
|
|
|
|
$ok;
|
1090
|
|
|
|
|
|
|
},
|
1091
|
|
|
|
|
|
|
},
|
1092
|
|
|
|
|
|
|
|
1093
|
|
|
|
|
|
|
# subchapter list
|
1094
|
|
|
|
|
|
|
LOCALTOC => {
|
1095
|
|
|
|
|
|
|
# no body, optional options
|
1096
|
|
|
|
|
|
|
body => TAGS_DISABLED,
|
1097
|
|
|
|
|
|
|
options => TAGS_OPTIONAL,
|
1098
|
|
|
|
|
|
|
|
1099
|
|
|
|
|
|
|
# can be used as a standalone tag
|
1100
|
|
|
|
|
|
|
standalone => 1,
|
1101
|
|
|
|
|
|
|
|
1102
|
|
|
|
|
|
|
# hook in to check option values
|
1103
|
|
|
|
|
|
|
hook => sub
|
1104
|
|
|
|
|
|
|
{
|
1105
|
|
|
|
|
|
|
# declare and init variable
|
1106
|
|
|
|
|
|
|
my $ok=PARSING_OK;
|
1107
|
|
|
|
|
|
|
|
1108
|
|
|
|
|
|
|
# take parameters
|
1109
|
|
|
|
|
|
|
my ($tagLine, $options)=@_;
|
1110
|
|
|
|
|
|
|
|
1111
|
|
|
|
|
|
|
# check them
|
1112
|
|
|
|
|
|
|
$ok=PARSING_FAILED, warn qq(\n\n[Error] LOCALTOC tag option "depth" requires a number greater 0, line $tagLine.\n)
|
1113
|
|
|
|
|
|
|
if exists $options->{depth}
|
1114
|
|
|
|
|
|
|
and $options->{depth}!~/^\d+$/
|
1115
|
|
|
|
|
|
|
and $options->{depth};
|
1116
|
|
|
|
|
|
|
|
1117
|
|
|
|
|
|
|
$ok=PARSING_FAILED, warn qq(\n\n[Error] Invalid "format" setting "$options->{format}" in LOCALTOC tag, line $tagLine.\n)
|
1118
|
|
|
|
|
|
|
if exists $options->{format}
|
1119
|
|
|
|
|
|
|
and $options->{format}!~/^(bullets|enumerated|numbers)$/;
|
1120
|
|
|
|
|
|
|
|
1121
|
|
|
|
|
|
|
$ok=PARSING_FAILED, warn qq(\n\n[Error] Invalid "type" setting "$options->{type}" in LOCALTOC tag, line $tagLine.\n)
|
1122
|
|
|
|
|
|
|
if exists $options->{type}
|
1123
|
|
|
|
|
|
|
and $options->{type}!~/^(linked|plain)$/;
|
1124
|
|
|
|
|
|
|
|
1125
|
|
|
|
|
|
|
# set defaults, if necessary
|
1126
|
|
|
|
|
|
|
if ($ok==PARSING_OK)
|
1127
|
|
|
|
|
|
|
{
|
1128
|
|
|
|
|
|
|
$options->{depth}=0 unless exists $options->{depth};
|
1129
|
|
|
|
|
|
|
$options->{format}='bullets' unless exists $options->{format};
|
1130
|
|
|
|
|
|
|
$options->{type}='plain' unless exists $options->{type};
|
1131
|
|
|
|
|
|
|
}
|
1132
|
|
|
|
|
|
|
|
1133
|
|
|
|
|
|
|
# supply status
|
1134
|
|
|
|
|
|
|
$ok;
|
1135
|
|
|
|
|
|
|
},
|
1136
|
|
|
|
|
|
|
},
|
1137
|
|
|
|
|
|
|
|
1138
|
|
|
|
|
|
|
|
1139
|
|
|
|
|
|
|
# declare document to be complete
|
1140
|
|
|
|
|
|
|
READY => {
|
1141
|
|
|
|
|
|
|
# no options required
|
1142
|
|
|
|
|
|
|
options => TAGS_DISABLED,
|
1143
|
|
|
|
|
|
|
|
1144
|
|
|
|
|
|
|
# no body required
|
1145
|
|
|
|
|
|
|
body => TAGS_DISABLED,
|
1146
|
|
|
|
|
|
|
|
1147
|
|
|
|
|
|
|
# can be used as a standalone tag
|
1148
|
|
|
|
|
|
|
standalone => 1,
|
1149
|
|
|
|
|
|
|
|
1150
|
|
|
|
|
|
|
# hook!
|
1151
|
|
|
|
|
|
|
hook => sub
|
1152
|
|
|
|
|
|
|
{
|
1153
|
|
|
|
|
|
|
# flag that parsing is completed
|
1154
|
|
|
|
|
|
|
PARSING_COMPLETED;
|
1155
|
|
|
|
|
|
|
},
|
1156
|
|
|
|
|
|
|
},
|
1157
|
|
|
|
|
|
|
|
1158
|
|
|
|
|
|
|
|
1159
|
|
|
|
|
|
|
# resolve a reference
|
1160
|
|
|
|
|
|
|
REF => {
|
1161
|
|
|
|
|
|
|
# at least one option is required
|
1162
|
|
|
|
|
|
|
options => TAGS_MANDATORY,
|
1163
|
|
|
|
|
|
|
|
1164
|
|
|
|
|
|
|
# there can be a body
|
1165
|
|
|
|
|
|
|
body => TAGS_OPTIONAL,
|
1166
|
|
|
|
|
|
|
|
1167
|
|
|
|
|
|
|
# hook!
|
1168
|
|
|
|
|
|
|
hook => sub
|
1169
|
|
|
|
|
|
|
{
|
1170
|
|
|
|
|
|
|
# declare and init variable
|
1171
|
|
|
|
|
|
|
my $ok=PARSING_OK;
|
1172
|
|
|
|
|
|
|
|
1173
|
|
|
|
|
|
|
# take parameters
|
1174
|
|
|
|
|
|
|
my ($tagLine, $options, $body, $anchors)=@_;
|
1175
|
|
|
|
|
|
|
|
1176
|
|
|
|
|
|
|
# check them (a name must be specified at least)
|
1177
|
|
|
|
|
|
|
$ok=PARSING_FAILED, warn qq(\n\n[Error] Missing "name" option in REF tag, line $tagLine.\n) unless exists $options->{name};
|
1178
|
|
|
|
|
|
|
|
1179
|
|
|
|
|
|
|
$ok=PARSING_FAILED, warn qq(\n\n[Error] Invalid "type" setting "$options->{type}" in REF tag, line $tagLine.\n)
|
1180
|
|
|
|
|
|
|
if exists $options->{type}
|
1181
|
|
|
|
|
|
|
and $options->{type}!~/^(linked|plain)$/;
|
1182
|
|
|
|
|
|
|
|
1183
|
|
|
|
|
|
|
$ok=PARSING_FAILED, warn qq(\n\n[Error] Invalid "valueformat" setting "$options->{valueformat}" in REF tag, line $tagLine.\n)
|
1184
|
|
|
|
|
|
|
if exists $options->{valueformat}
|
1185
|
|
|
|
|
|
|
and $options->{valueformat}!~/^(pure|pagetitle|pagenr)$/;
|
1186
|
|
|
|
|
|
|
|
1187
|
|
|
|
|
|
|
# set defaults, if necessary
|
1188
|
|
|
|
|
|
|
$options->{type}='plain' unless exists $options->{type};
|
1189
|
|
|
|
|
|
|
$options->{valueformat}='pure' unless exists $options->{valueformat};
|
1190
|
|
|
|
|
|
|
|
1191
|
|
|
|
|
|
|
# store a body hint
|
1192
|
|
|
|
|
|
|
$options->{__body__}=@$body ? 1 : 0;
|
1193
|
|
|
|
|
|
|
|
1194
|
|
|
|
|
|
|
# format address to simplify anchor search
|
1195
|
|
|
|
|
|
|
$options->{name}=~s/\s*\|\s*/\|/g if exists $options->{name};
|
1196
|
|
|
|
|
|
|
|
1197
|
|
|
|
|
|
|
# supply status
|
1198
|
|
|
|
|
|
|
$ok;
|
1199
|
|
|
|
|
|
|
},
|
1200
|
|
|
|
|
|
|
|
1201
|
|
|
|
|
|
|
# afterburner
|
1202
|
|
|
|
|
|
|
finish => sub
|
1203
|
|
|
|
|
|
|
{
|
1204
|
|
|
|
|
|
|
# declare and init variable
|
1205
|
|
|
|
|
|
|
my $ok=PARSING_OK;
|
1206
|
|
|
|
|
|
|
|
1207
|
|
|
|
|
|
|
# take parameters
|
1208
|
|
|
|
|
|
|
my ($options, $anchors)=@_;
|
1209
|
|
|
|
|
|
|
|
1210
|
|
|
|
|
|
|
# try to find an alternative, if possible
|
1211
|
|
|
|
|
|
|
if (exists $options->{alt} and not $anchors->query($options->{name}))
|
1212
|
|
|
|
|
|
|
{
|
1213
|
|
|
|
|
|
|
foreach my $alternative (split(/\s*(?{alt}))
|
1214
|
|
|
|
|
|
|
{
|
1215
|
|
|
|
|
|
|
# remove guarding backslashes
|
1216
|
|
|
|
|
|
|
$alternative=~s/(?
|
1217
|
|
|
|
|
|
|
$alternative=~s/\\\\/\\/g;
|
1218
|
|
|
|
|
|
|
|
1219
|
|
|
|
|
|
|
if ($anchors->query($alternative))
|
1220
|
|
|
|
|
|
|
{
|
1221
|
|
|
|
|
|
|
warn qq(\n\n[Info] Unknown link address "$options->{name}" is replaced by alternative "$alternative" in REF tag.\n);
|
1222
|
|
|
|
|
|
|
$options->{name}=$alternative;
|
1223
|
|
|
|
|
|
|
last;
|
1224
|
|
|
|
|
|
|
}
|
1225
|
|
|
|
|
|
|
}
|
1226
|
|
|
|
|
|
|
}
|
1227
|
|
|
|
|
|
|
|
1228
|
|
|
|
|
|
|
# check link for being valid - finally
|
1229
|
|
|
|
|
|
|
unless ($anchors->query($options->{name}))
|
1230
|
|
|
|
|
|
|
{
|
1231
|
|
|
|
|
|
|
# allowed case?
|
1232
|
|
|
|
|
|
|
if (exists $options->{occasion} and $options->{occasion})
|
1233
|
|
|
|
|
|
|
{
|
1234
|
|
|
|
|
|
|
$ok=PARSING_IGNORE;
|
1235
|
|
|
|
|
|
|
warn qq(\n\n[Info] Unknown link address "$options->{name}": REF tag ignored.\n);
|
1236
|
|
|
|
|
|
|
}
|
1237
|
|
|
|
|
|
|
else
|
1238
|
|
|
|
|
|
|
{
|
1239
|
|
|
|
|
|
|
$ok=PARSING_FAILED;
|
1240
|
|
|
|
|
|
|
warn qq(\n\n[Error] Unknown link address "$options->{name}" in REF tag.\n);
|
1241
|
|
|
|
|
|
|
}
|
1242
|
|
|
|
|
|
|
}
|
1243
|
|
|
|
|
|
|
else
|
1244
|
|
|
|
|
|
|
{
|
1245
|
|
|
|
|
|
|
# link ok, get value and chapter number
|
1246
|
|
|
|
|
|
|
@{$options}{qw(__value__ __chapter__)}=@{$anchors->query($options->{name})->{$options->{name}}};
|
1247
|
|
|
|
|
|
|
}
|
1248
|
|
|
|
|
|
|
|
1249
|
|
|
|
|
|
|
# supply status
|
1250
|
|
|
|
|
|
|
$ok;
|
1251
|
|
|
|
|
|
|
},
|
1252
|
|
|
|
|
|
|
},
|
1253
|
|
|
|
|
|
|
|
1254
|
|
|
|
|
|
|
|
1255
|
|
|
|
|
|
|
# add a new sequence entry
|
1256
|
|
|
|
|
|
|
SEQ => {
|
1257
|
|
|
|
|
|
|
# at least one option is required
|
1258
|
|
|
|
|
|
|
options => TAGS_MANDATORY,
|
1259
|
|
|
|
|
|
|
|
1260
|
|
|
|
|
|
|
# no body required
|
1261
|
|
|
|
|
|
|
body => TAGS_DISABLED,
|
1262
|
|
|
|
|
|
|
|
1263
|
|
|
|
|
|
|
# hook!
|
1264
|
|
|
|
|
|
|
hook => sub
|
1265
|
|
|
|
|
|
|
{
|
1266
|
|
|
|
|
|
|
# declare and init variable
|
1267
|
|
|
|
|
|
|
my $ok=PARSING_OK;
|
1268
|
|
|
|
|
|
|
|
1269
|
|
|
|
|
|
|
# take parameters
|
1270
|
|
|
|
|
|
|
my ($tagLine, $options, $body, $anchors, $headlineIds, $chapterNr)=@_;
|
1271
|
|
|
|
|
|
|
|
1272
|
|
|
|
|
|
|
# check them (a sequence type must be specified, a name is optional)
|
1273
|
|
|
|
|
|
|
$ok=PARSING_FAILED, warn qq(\n\n[Error] Missing "type" option in SEQ tag, line $tagLine.\n) unless exists $options->{type};
|
1274
|
|
|
|
|
|
|
|
1275
|
|
|
|
|
|
|
# still all right?
|
1276
|
|
|
|
|
|
|
if ($ok==PARSING_OK)
|
1277
|
|
|
|
|
|
|
{
|
1278
|
|
|
|
|
|
|
# get a new entry, store it by option
|
1279
|
|
|
|
|
|
|
$options->{__nr__}=++$seq{$options->{type}};
|
1280
|
|
|
|
|
|
|
|
1281
|
|
|
|
|
|
|
# if a name was set, store it together with the value
|
1282
|
|
|
|
|
|
|
$anchors->add($options->{name}, $seq{$options->{type}}, $chapterNr) if $options->{name};
|
1283
|
|
|
|
|
|
|
}
|
1284
|
|
|
|
|
|
|
|
1285
|
|
|
|
|
|
|
# supply status
|
1286
|
|
|
|
|
|
|
$ok;
|
1287
|
|
|
|
|
|
|
},
|
1288
|
|
|
|
|
|
|
},
|
1289
|
|
|
|
|
|
|
|
1290
|
|
|
|
|
|
|
|
1291
|
|
|
|
|
|
|
# stop document processing by raising an syntactical error
|
1292
|
|
|
|
|
|
|
STOP => {
|
1293
|
|
|
|
|
|
|
# conditions are options (currently), so ...
|
1294
|
|
|
|
|
|
|
options => TAGS_OPTIONAL,
|
1295
|
|
|
|
|
|
|
|
1296
|
|
|
|
|
|
|
# no body needed
|
1297
|
|
|
|
|
|
|
body => TAGS_DISABLED,
|
1298
|
|
|
|
|
|
|
|
1299
|
|
|
|
|
|
|
# hook!
|
1300
|
|
|
|
|
|
|
hook => sub
|
1301
|
|
|
|
|
|
|
{
|
1302
|
|
|
|
|
|
|
# enforce fatal error
|
1303
|
|
|
|
|
|
|
PARSING_FAILED;
|
1304
|
|
|
|
|
|
|
},
|
1305
|
|
|
|
|
|
|
},
|
1306
|
|
|
|
|
|
|
);
|
1307
|
|
|
|
|
|
|
|
1308
|
|
|
|
|
|
|
|
1309
|
|
|
|
|
|
|
%sets=(
|
1310
|
|
|
|
|
|
|
basic => [qw(A B C I FORMAT HIDE IMAGE LOCALTOC READY REF SEQ STOP)],
|
1311
|
|
|
|
|
|
|
);
|
1312
|
|
|
|
|
|
|
|
1313
|
|
|
|
|
|
|
|
1314
|
|
|
|
|
|
|
|
1315
|
|
|
|
|
|
|
# INTERNAL HELPER FUNCTIONS ###########################################
|
1316
|
|
|
|
|
|
|
|
1317
|
|
|
|
|
|
|
sub _checkHeadlineChain
|
1318
|
|
|
|
|
|
|
{
|
1319
|
|
|
|
|
|
|
# get parameters
|
1320
|
9
|
|
|
9
|
|
15
|
my ($c1, $c2)=@_;
|
1321
|
|
|
|
|
|
|
|
1322
|
|
|
|
|
|
|
# quick check
|
1323
|
9
|
100
|
|
|
|
31
|
return 1 if $c1 eq $c2;
|
1324
|
|
|
|
|
|
|
|
1325
|
|
|
|
|
|
|
# declare variable
|
1326
|
6
|
|
|
|
|
11
|
my $rc=0;
|
1327
|
|
|
|
|
|
|
|
1328
|
|
|
|
|
|
|
# split the chain strings
|
1329
|
6
|
|
|
|
|
20
|
$c1=[split('-', $c1)];
|
1330
|
6
|
|
|
|
|
17
|
$c2=[split('-', $c2)];
|
1331
|
|
|
|
|
|
|
|
1332
|
|
|
|
|
|
|
# make $c1 pointing to the shorter array
|
1333
|
6
|
50
|
|
|
|
20
|
($c1, $c2)=($c2, $c1) if @$c1>@$c2;
|
1334
|
|
|
|
|
|
|
|
1335
|
|
|
|
|
|
|
# now compare all levels of @c1
|
1336
|
6
|
|
|
|
|
14
|
for (my $i=0; $i<@$c1; $i++)
|
1337
|
|
|
|
|
|
|
{
|
1338
|
|
|
|
|
|
|
# if there is a different element, the chains differ
|
1339
|
6
|
50
|
|
|
|
120
|
return $rc if $c1->[$i] ne $c2->[$i];
|
1340
|
|
|
|
|
|
|
}
|
1341
|
|
|
|
|
|
|
|
1342
|
|
|
|
|
|
|
# ok, these are in the same chain
|
1343
|
0
|
|
|
|
|
|
return 1;
|
1344
|
|
|
|
|
|
|
}
|
1345
|
|
|
|
|
|
|
|
1346
|
|
|
|
|
|
|
|
1347
|
|
|
|
|
|
|
1;
|
1348
|
|
|
|
|
|
|
|
1349
|
|
|
|
|
|
|
|
1350
|
|
|
|
|
|
|
# = POD TRAILER SECTION =================================================================
|
1351
|
|
|
|
|
|
|
|
1352
|
|
|
|
|
|
|
=pod
|
1353
|
|
|
|
|
|
|
|
1354
|
|
|
|
|
|
|
=head1 SEE ALSO
|
1355
|
|
|
|
|
|
|
|
1356
|
|
|
|
|
|
|
=over 4
|
1357
|
|
|
|
|
|
|
|
1358
|
|
|
|
|
|
|
=item B
|
1359
|
|
|
|
|
|
|
|
1360
|
|
|
|
|
|
|
The tag declaration base "class".
|
1361
|
|
|
|
|
|
|
|
1362
|
|
|
|
|
|
|
=back
|
1363
|
|
|
|
|
|
|
|
1364
|
|
|
|
|
|
|
|
1365
|
|
|
|
|
|
|
=head1 SUPPORT
|
1366
|
|
|
|
|
|
|
|
1367
|
|
|
|
|
|
|
A PerlPoint mailing list is set up to discuss usage, ideas,
|
1368
|
|
|
|
|
|
|
bugs, suggestions and translator development. To subscribe,
|
1369
|
|
|
|
|
|
|
please send an empty message to perlpoint-subscribe@perl.org.
|
1370
|
|
|
|
|
|
|
|
1371
|
|
|
|
|
|
|
If you prefer, you can contact me via perl@jochen-stenzel.de
|
1372
|
|
|
|
|
|
|
as well.
|
1373
|
|
|
|
|
|
|
|
1374
|
|
|
|
|
|
|
=head1 AUTHOR
|
1375
|
|
|
|
|
|
|
|
1376
|
|
|
|
|
|
|
Copyright (c) Jochen Stenzel (perl@jochen-stenzel.de), 1999-2004.
|
1377
|
|
|
|
|
|
|
All rights reserved.
|
1378
|
|
|
|
|
|
|
|
1379
|
|
|
|
|
|
|
This module is free software, you can redistribute it and/or modify it
|
1380
|
|
|
|
|
|
|
under the terms of the Artistic License distributed with Perl version
|
1381
|
|
|
|
|
|
|
5.003 or (at your option) any later version. Please refer to the
|
1382
|
|
|
|
|
|
|
Artistic License that came with your Perl distribution for more
|
1383
|
|
|
|
|
|
|
details.
|
1384
|
|
|
|
|
|
|
|
1385
|
|
|
|
|
|
|
The Artistic License should have been included in your distribution of
|
1386
|
|
|
|
|
|
|
Perl. It resides in the file named "Artistic" at the top-level of the
|
1387
|
|
|
|
|
|
|
Perl source tree (where Perl was downloaded/unpacked - ask your
|
1388
|
|
|
|
|
|
|
system administrator if you dont know where this is). Alternatively,
|
1389
|
|
|
|
|
|
|
the current version of the Artistic License distributed with Perl can
|
1390
|
|
|
|
|
|
|
be viewed on-line on the World-Wide Web (WWW) from the following URL:
|
1391
|
|
|
|
|
|
|
http://www.perl.com/perl/misc/Artistic.html
|
1392
|
|
|
|
|
|
|
|
1393
|
|
|
|
|
|
|
|
1394
|
|
|
|
|
|
|
=head1 DISCLAIMER
|
1395
|
|
|
|
|
|
|
|
1396
|
|
|
|
|
|
|
This software is distributed in the hope that it will be useful, but
|
1397
|
|
|
|
|
|
|
is provided "AS IS" WITHOUT WARRANTY OF ANY KIND, either expressed or
|
1398
|
|
|
|
|
|
|
implied, INCLUDING, without limitation, the implied warranties of
|
1399
|
|
|
|
|
|
|
MERCHANTABILITY and FITNESS FOR A PARTICULAR PURPOSE.
|
1400
|
|
|
|
|
|
|
|
1401
|
|
|
|
|
|
|
The ENTIRE RISK as to the quality and performance of the software
|
1402
|
|
|
|
|
|
|
IS WITH YOU (the holder of the software). Should the software prove
|
1403
|
|
|
|
|
|
|
defective, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR
|
1404
|
|
|
|
|
|
|
CORRECTION.
|
1405
|
|
|
|
|
|
|
|
1406
|
|
|
|
|
|
|
IN NO EVENT WILL ANY COPYRIGHT HOLDER OR ANY OTHER PARTY WHO MAY CREATE,
|
1407
|
|
|
|
|
|
|
MODIFY, OR DISTRIBUTE THE SOFTWARE BE LIABLE OR RESPONSIBLE TO YOU OR TO
|
1408
|
|
|
|
|
|
|
ANY OTHER ENTITY FOR ANY KIND OF DAMAGES (no matter how awful - not even
|
1409
|
|
|
|
|
|
|
if they arise from known or unknown flaws in the software).
|
1410
|
|
|
|
|
|
|
|
1411
|
|
|
|
|
|
|
Please refer to the Artistic License that came with your Perl
|
1412
|
|
|
|
|
|
|
distribution for more details.
|
1413
|
|
|
|
|
|
|
|