summaryrefslogtreecommitdiffstats
path: root/tkhtml1/doc/spec.html
blob: cc88b520ed6d8471886257fb227d5306692dbd7e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
<html>
<!-- 
  Specifications for the Tk HTML Widget 
  $Revision$
  Copyright (C) 1997, 1998, 1999 D. Richard Hipp

  This program is free software; you can redistribute it and/or modify
  it under the terms of the GNU General Public License as published by
  the Free Software Foundation; either version 2 of the License, or
  (at your option) any later version.

  This program is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  GNU General Public License for more details.

  You should have received a copy of the GNU General Public License
  along with this program; if not, write to the Free Software
  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

  Author Contact Information:
     drh@acm.org
     http://www.hwaci.com/drh/

  @(#) $Id$
-->
<head>
<title>Interface Specification For The HTML Widget</title>
</head>
<body bgcolor=white>
<h1>Interface Specification For The HTML Widget</h1>

<p>This is a draft interface specification for the Tk HTML 
widget currently under development.
Since it is still a draft, it is subject to change.
Eventually, the interface will stabilize and this interface
specification will morph into a manual page.</p>

<h2>Configuration Options</h2>

<table cellspacing=10>
<tr><td valign=top><tt>-appletcommand</tt></td>
<td>
  <p>This option specifies the name of the Tcl procedure to invoke when the
  <tt>&lt;applet&gt;...&lt;/applet&gt;</tt> tag sequence is seen.  The html
  widget will append two arguments to the procedure before calling it.
  The first argument is the name of a widget that the callback should
  create to hold the applet.  
  The second argument is
  a list of name/value pairs which are the arguments to
  the <tt>&lt;applet&gt;</tt> tag.</p>

  <p>The text between <tt>&lt;applet&gt</tt> and <tt>&lt;/applet&gt;</tt>
  is normally suppressed.
  However, if the <tt>-appletcommand</tt> option is set to the empty string,
  the <tt>&lt;applet&gt</tt> tag is ignored and all text between
  <tt>&lt;applet&gt;</tt> and <tt>&lt;/applet&gt;</tt> is displayed
  normally.</p>

  <p>"&lt;embed&gt;" is treated as an alias for
     "&lt;applet&gt;&lt;/applet&gt".</p>
</td></tr>

<tr><td valign=top><tt>-background</tt></td>
<td>
  <p>The background color for the widget.</p>

  <p>Note that the <tt>&lt;body bgcolor=...&gt;</tt> HTML tag does not
  automatically cause the widget to change its background color.  If
  you want the background color to change in response to this HTML tag,
  then your Tcl script should intercept
  the <tt>&lt;body&gt;</tt> tag using the
  ``<tt>token handler</tt>'' widget command (described below) and
  change the background color manually.</p>
</td></tr>

<tr><td valign=top><tt>-base</tt></td>
<td>
  <p>The base URI for the current document.  This should be set to
     the URI that was used to retrieve the document before parsing
     begins.</p>
</td></tr>

<tr><td valign=top><tt>-bd</tt><td>An alias for <tt>-borderwidth</tt>

<tr><td valign=top><tt>-bg</tt><td>An alias for <tt>-background</tt>

<tr><td valign=top><tt>-borderwidth</tt></td>
<td>
  <p>The width of the 3-D border drawn around the parameter of the widget, in
  pixels.</p>
</td></tr>

<tr><td valign=top><tt>-cursor</tt></td>
<td>
  <p>The cursor displayed when the pointer is positioned over the HTML widget.
  If {}, the cursor reverts to its default shape.</p>
</td></tr>

<tr><td valign=top><tt>-exportselection</tt></td>
</tr>

<tr><td valign=top><tt>-fontcommand</tt></td>
<td>
  <p>The name of a TCL procedure that is used to convert HTML font names
  into TCL font names.  A default built-in procedure is used if the value
  of this option is {}.</p>

  <p>When the HTML widget needs a new font, it calls this procedure with
  two arguments.  This first argument is the font size expressed as an
  integer between 1 and 7.  The standard size is 4.  The second argument
  is a set of between 0 and 3 keywords drawn from the following set:
  "bold", "italic", and "fixed".  If the "bold" keyword is present in
  the second argument, the font returned should be bold.  If the "italic"
  keyword is present, the font should be italic.  If the "fixed" keyword
  is present, the font should be fixed-width.  The TCL procedure should
  return the name of the TCL font that the HTML widget will use to render
  the given HTML font.  If the TCL procedure returns an empty string,
  then the built-in default procedure is used to determine the font.</p>

  <p>Examples:  This is {4 {}}.  <tt>This is {4 fixed}</tt>.
  <small>This is {3 {}}</small>.  <large><tt><bold>This is {5 {fixed bold}}
  </bold></tt></large></p>
</td></tr>


<tr><td valign=top><tt>-fg</tt></td>
<td>An alias for <tt>-foreground</tt>.</td>
</tr>

<tr><td valign=top><tt>-foreground</tt></td>
<td>
  The default foreground color in which HTML text is rendered.
  The HTML can override this using the <tt>color=...</tt> attribute
  on various HTML tags.
</td></tr>

<tr><td valign=top>
<code>-formcommand <var>string</var></code>
</td><td>
Declares a handler for everything to do with forms within a document.
Arguments will be appended to <var>string</var> and the result evaluated
during parsing (for form creation) and when the widget is cleared (for
form cleanup).  The first argument is a token for
identifying a form.  The second argument selects the action to perform.
The remaining arguments depend on the action, as follows.

<dl><dt><code><var>string token</var> form <var>URL method attrs</var></code>
<dd>The handler should begin taking notes for form <var>token</var>,
especially the (resolved) <var>URL</var> of the action and the
<var>method</var> to be applied.  The raw attributes of the FORM element
are in the pairlist <var>attrs</var>.

<dt><code><var>string token</var> flush</code>
<dd>When the document is cleared, the widget will destroy all the windows
it requested.  This handler should clean up anything else
it created for that form.

<dt><code><var>string token</var> input <var>path attrs</var></code>
<dd>The handler should create a window named <var>path</var>
appropriate for the element described by the <var>attrs</var>.
The widget will map the window into its rendering appropriately.
<p>It is not an error for the handler to return without creating such a window
(it's natural in the case of type=hidden); the widget simply
ignores the element in that case.
The attributes are the raw values in the HTML, with one exception;
a <code>src</code> will be resolved before the handler is called.

<dt><code><var>string token</var> textarea <var>path attrs initial</var></code>
<dd>The handler should create a window (a single Text, or a Frame with Text
and Scrollbars, or whatever) appropriate for a &lt;textarea&gt; and
initialise it to the <var>initial</var> string.

<dt><code><var>string token</var> select <var>path attrs choices initial</var></code>
<dd><em>&lt;select&gt is quite a complicated case...</em>
The handler should create a window 
appropriate for a &lt;select&gt; of the given attributes and
present the list of <var>choices</var>.  Each choice is a pair, the
value and its label.  <var>initial</var> is a list of values initially
selected.  <em>This approach is somewhat questionable but should do
most of the time.</em>
</dl>

Caution: Be very careful to avoid confusing HTML variables with TCL
variables.  It may be tempting to use the <code>name</code> attribute
fairly directly to link
together related widgets, but it will likely cause incorrect
behaviours.  Also be careful to observe the order in which the elements are
created; this determines the order in which they must be submitted.
A default form handler with the correct bahaviour written in TCL will be
bundled with the widget.
<p>The attribute names will be downcased within <var>attrs</var>.
</td></tr>

<tr><td valign=top><tt>-framecommand</tt><td>
The script specified by this option is invoked when the HTML parser
encounters a <tt>&lt;frameset&gt;...&lt;/frameset&gt;</tt> tag sequence.
The arguments to the script are TBD.
If the value of the option is the empty string, then the text within
the <tt>&lt;noframe&gt...&lt;/noframe&gt;</tt> tag sequence is displayed.

<tr><td valign=top><tt>-height</tt><td>
Specifies the height of the area into which HTML is rendered.
This value plus twice the <tt>-padx</tt>, <tt>-borderwidth</tt> and
<tt>-highlightthickness</tt> values is the total height of the widget.

<tr><td valign=top><tt>-highlightbackground</tt><td>

<tr><td valign=top><tt>-highlightcolor</tt><td>

<tr><td valign=top><tt>-highlightthickness</tt><td>

<tr><td valign=top><tt>-hyperlinkcommand</tt></td>
<td>
  The script specified by this option is invoked whenever the user
  clicks on a hyperlink on the HTML page.  Before invoking this
  script, the URI for the hyperlink is appended.
</td></tr>

<tr><td valign=top><tt>-imagecommand</tt></td>
<td>
  When a ``<tt>&lt;img src=...&gt;</tt>'' tag is encountered, the
  HTML widget invokes the script specified by this option in order to
  get the name of a Tk image object to display the HTML image.
  Before invoking the script, the following arguments are appended:
  <ol>
  <li>The value of the <tt>src=...</tt> parameter after have been
      processed by the resolver.
  <li>The value of the <tt>width=...</tt> parameter.
  <li>The value of the <tt>height=...</tt> parameter.
  <li>A list containing the names and values of all parameters.
  </ol>
  If the name returned by this script is the empty string, or if the
  script is an empty string, then the HTML widget displays the 
  <tt>alt=...</tt> text of the <tt>&lt;img&gt</tt> tag instead of
  an image.
</td></tr>

<tr><td valign=top><tt>-isvisitedcommand</tt><td>
When the HTML widget encounters a hyperlink
(``<tt>&lt;a href=...&gt;</tt>'') it invokes the script specified
by this option in order to determine whether or not the hyperlink
has been visited.
This information is needed to determine what color to use to display
the hyperlink.

<tr><td valign=top><tt>-padx</tt><td>
The amount of extra space to insert between the 3-D border and the
left and right sides of the document text.

<tr><td valign=top><tt>-pady</tt><td>
The amount of extra space to insert between the 3-D border and the top
and bottom of the document text.

<tr><td valign=top><tt>-relief</tt><td>
The relief used to draw the 3-D border.

<tr><td valign=top><tt>-resolvercommand</tt></td>
<td>
  <p>The name of a TCL command used to resolve URIs.  If blank, a built-in
  resolver is used. If a TCL command is specified but it returns
  an empty string, the built-in resolver is used then too.  
  The build-in resolver is based on the algorithm
  in section 5.2 of RFC 2396. </p>

  <p>Multiple URIs are appended to the TCL command before it is executed.
  The first URI is the BASE URI of the document (the URL that specified
  by the -base configuration option and updated according to any prior
  &lt;BASE&gt; markup).  Zero or more additional URIs are
  appended to this base.  The result of the script should be the resolution
  of the whole series or URIs.</p>
</td></tr>

<tr><td valign=top><tt>-rulerelief</tt></td>
<td>
  <p>Determines the appearance of the Horizontal Rule (&lt;HR&gt) markup.
  The default is "sunken".  This can also be "raised" or "flat".  If
  "flat", then the &lt;HR&gt; is drawn using a solid line in the current
  foreground color.  "groove" and "ridge" are the same as "flat".</p>
</td></tr>

<tr><td valign=top><tt>-scriptcommand</tt></td>
<td>
  <p>Whenever &lt;SCRIPT&gt;...&lt;/SCRIPT&gt; markup is encountered in
  the input HTML, the attributes of the &lt;SCRIPT&gt; markup and
  the body of the script are appended to this string and the result
  is executed as a TCL command.  If this options is the empty string,
  then the script is ignored.
</td></tr>

<tr><td valign=top><tt>-selectioncolor</tt><td>
The background color used when drawing the selection.  The
foreground color for the selection is the same as the regular
foreground color.

<tr><td valign=top><tt>-tablerelief</tt></td>
<td>
  <p>Determines the appearance of the borders around tables.
  The default is "raised".  This can also be "sunken" or "flat".  If
  "flat", then the borders is drawn using solid lines in the current
  foreground color.  "groove" and "ridge" are the same as "flat".</p>
</td></tr>

<tr><td valign=top><tt>-takefocus</tt><td>

<tr><td valign=top><tt>-unvisitedcolor</tt><td>
The foreground color used to draw hyperlinks that have not been visited.

<tr><td valign=top><tt>-underlinehyperlinks</tt><td>
Set to TRUE to cause hyperlinks to be drawn using an underlined font.

<tr><td valign=top><tt>-visitedcolor</tt><td>
The foreground color used to draw hyperlinks that have been visited.

<tr><td valign=top><tt>-width</tt><td>
The width of the document text.
This value does not include space allocated for
<tt>-highlightthickness</tt>, <tt>-borderwiddth</tt> or
<tt>-padx</tt>.

<tr><td valign=top><tt>-xscrollcommand</tt><td>

<tr><td valign=top><tt>-yscrollcommand</tt><td>

</table>

<h2>Indices</h2>

Internally, the HTML widget stores the HTML document as a list of
tokens.
Each token is either
<ul>
<li>a contiguous sequence of non-space characters (Text),
<li>a contiguous sequence of spaces, tabs or newlines (Space),
<li>or an HTML markup tag (such as ``<tt>&lt;em&gt;</tt>''.)
</ul>
Tokens are identified by number.
The first token is ``1'', the second is ``2'' and so forth.
So in its simplest form, an index is just an integer greater than 0.
<p>
Within a single Text or Space token, individual characters are
also identified by number, though the counting starts with 0 instead
of 1.
The character number is connected to the token number by a period.
So, for example, the 4th character in the 9th token would be
``9.3''.
<p>
Two integers separated by a dot is called the <em>connonical</em> form
of an index.
Other index forms are available, including:

<table cellspacing=10>
<tr><td valign=top>end<td>
The keyword ``end'' means one character past
the last character of the last token.
<tr><td valign=top>@X,Y<td>
The character located at screen coordinates X,Y.
<tr><td valign=top>*.last<td>
The second integer can be replaced by the keyword ``last'' to mean the
last character in the token.
<tr><td valign=top>sel.first<td>
This is the first character that is part of the selection.
<tr><td valign=top>sel.last<td>
This is the last character that is part of the selection.
<tr><td valign=top>ins<td>
The character immediately following the insertion cursor.
</table>

<h2>Commands</h2>

<dl>
<dt><b>html</b> <i>window</i> ?<i>options ...</i>?</dt><p>
<dd>
  Create a new HTML widget instance named <i>windows</i>
</dd>
<p>
<dt><b>html</b> <b>reformat</b> <i>from to text</i><p>
<dd>
Convert text from one encoding to another.  The text is given
in the <i>text</i> argument.  The current encoding of the text
is specified by the <i>from</i> argument.  This command returns
the same text in the <i>to</i> encoding.
<p>
<i>From</i> and <i>to</i> may be any of the following values:
<p>
<table cellspacing=10>
<tr><td valign=top>plain</td>
<td>
  Ordinary text with no characters escaped.
</td></tr>
<tr><td valign=top>http</td>
<td>
  The text is encoded in a form suitable for use with the HTTP
  protocol.  Spaces are converted to "+".  Special characters
  and escaped as "%aa" where "a" is a hexadecimal digit.  A special
  character is anything other than an alphanumeric or one of these:
  ".", "$", "-", or "_".
</td></tr>
<tr><td valign=top>url</td>
<td>
  The text is encoded in a form suitable for use as a URI.
  Spaces are converted to "+".  Special characters
  and escaped as "%aa" where "a" is a hexadecimal digit.  A special
  character is anything other than an alphanumeric or one of these:
  ".", "$", "-", "_", or "/".
</td></tr>
<tr><td valign=top>html</td>
<td>
  The text is encoded in a form suitable for use within HTML.
  "&amp;" is encoded as "&amp;amp;", "&lt;" is encoded as "&amp;lt;" and so
  forth.
</td></tr>
</table>
<p>
This command is intended to be useful to the TCL procedures that implement
callbacks for the HTML widget.
</dd>
<p>
<dt><b>html</b> <b>uri join</b> <i>scheme authority path query fragment</i><p>
<dd>
This command takes the five main components of a URI and joins them together
into a complete URI.  Special characters in any component are escaped.
</dd>
<p>
<dt><b>html</b> <b>uri split</b> <i>uri</i><p>
<dd>
This command takes a single URI and splits it into its five major
components: scheme, authorithy, path, query and fragement.  The command
returns a list where each component is an element of the list. 
Components missing from the URI are represented as empty elements in
the list.
</dd>

</dl>

<h2>Widget Commands</h2>

<dl>

<dt><i>WIDGET</i>&nbsp <tt>cget</tt> <i>config-option</i><p>
<dd>
Return the value of a configuration option.  Works just like any
other Tk widget.
<p>

<dt><i>WIDGET</i>&nbsp <tt>clear</tt><p>
<dd>
Remove all tokens and text from the HTML widget.
The parser is reset to its initial state.
This routine should be called to changes pages.
<p>

<dt><i>WIDGET</i>&nbsp <tt>configure</tt> ?<i>args...</i>?<p>
<dd>
The standard Tk configuration command.
<p>

<dt><i>WIDGET</i>&nbsp <tt>href</tt>&nbsp <i>X&nbsp Y</i><p>
<dd>If the coordinates <i>X Y</i> define a point above a hyperlink,
then this command will return the target URL for that hyperlink.
The URL will be resolved using the -resolvercommand before it
is returned.
<p>

<dt><i>WIDGET</i>&nbsp <tt>index</tt>&nbsp <i>INDEX&nbsp ?COUNT&nbsp UNITS?</i></p>
<dd>
Translates <i>INDEX</i> into its connonical form.
The connonical form of an index is two integers separated by a period.
<p>
The optional 3rd and 4th arguments specify a displacement from <i>INDEX</i>
to the value of the index returned.
<i>COUNT</i> can be any integer value, including a negative number.
<i>UNITS</i> must be either ``<tt>char</tt>'' or ``<tt>line</tt>''.
<p>

<dt><i>WIDGET</i>&nbsp <tt>insert</tt>&nbsp <i>INDEX</i><p>
<dd>
Causes the insertion cursor (a flashing vertical bar) to be positioned
immediately before the character specified by <i>INDEX</i>.
<p>

<dt><i>WIDGET</i>&nbsp <tt>names</tt><p>
<dd>
This command causes the widget to scan the entire text of the document
looking for tags of the form ``<tt>&lt;a name=...&gt;</tt>''.
It returns a list of values of the <tt>name=...</tt> fields.
<p>
The vertical position of the document can be moved to any of these names
using the ``<i>WIDGET</i> <tt>yview</tt> <i>NAME</i>'' command described
below.
<p>

<dt><i>WIDGET</i>&nbsp <tt>parse</tt>&nbsp <i>HTML-TEXT</i><p>
<dd>Adds the given HTML text to the end of any text previously received
through the <tt>parse</tt> command and parses as much of the text as
possible into tokens.
Afterwards, the display is updated to show the new tokens, if they are
visible.<p>

<dt><i>WIDGET</i>&nbsp; <tt>resolver</tt>&nbsp; ?<i>uri ...</i>?<p>
<dd>The resolver specified by the -resolvercommand option 
    is called with the
    base URI of the document followed
    by the remaining arguments to this commant.  The result of this
    command is the result of the -resolvercommand script.<p>

<dt><i>WIDGET</i>&nbsp <tt>selection</tt>&nbsp <i>subcommand args...</i><p>
<dd>The selection widget command is used to control the selection.<p>
    <dl>
    <dt><i>WIDGET</i>&nbsp <tt>selection clear</tt><p>
    <dd>Clear the current selection.  No text will be selected after this
        command executes.<p>

    <dt><i>WIDGET</i>&nbsp <tt>selection set</tt>&nbsp <i>START&nbsp END</i><p>
    <dd>Change the selection to be all text contained within the given
        indices.<p>
    </dl>
    <p>

<dt><i>WIDGET</i>&nbsp <tt>text</tt>&nbsp <i>subcommand args...</i><p>
<dd>There are several token commands.  They all have the common
property that they directly manipulate the text that is displayed.
These commands (none of which are currently implemented) can be used
to build an WYSIWYG editor for HTML.<p>
    <dl>
    <dt><i>WIDGET</i>&nbsp; <tt>text ascii</tt>&nbsp <i>INDEX-1&nbsp INDEX-2</i><p>
    <dd><p>
    Returns plain ASCII text that represents all characters between 
    <i>INDEX-1</i> and <i>INDEX-2</i>.  Formatting tags are omitted.
    The <i>INDEX-1</i> character is included by <i>INDEX-2</i> is omitted.
    <p>

    <dt><i>WIDGET</i>&nbsp; <tt>text delete</tt>&nbsp <i>INDEX-1&nbsp INDEX-2</i><p>
    <dd><p>
    All text from <i>INDEX-1</i> up to, but not including <i>INDEX-2</i> is
    removed and the display is updated accordingly.
    <p>

    <dt><i>WIDGET</i>&nbsp; <tt>text html</tt>&nbsp <i>INDEX-1&nbsp INDEX-2</i><p>
    <dd><p>
    Returns HTML text that represents all characters and formatting tags
    between <i>INDEX-1</i> and <i>INDEX-2</i>.
    The <i>INDEX-1</i> character is included by <i>INDEX-2</i> is omitted.
    <p>

    <dt><i>WIDGET</i>&nbsp; <tt>text insert</tt>&nbsp <i>INDEX&nbsp TEXT</i><p>
    <dd><p>
    Inserts one or more characters immediately before the character whose
    index is given.
    <p>
    </dl>


<dt><i>WIDGET</i>&nbsp <tt>token</tt>&nbsp <i>subcommand args...</i><p>
<dd>There are several token commands.  They all have the common
    property that they involve the list of tokens into which the
    HTML is parsed.<p>
    Some of the following subcommands make use of indices.  The 
    character number of these indices is ignored since these commands
    deal only with whole tokens.
    <p>
    <dl>
    <dt><i>WIDGET</i>&nbsp; <tt>token append</tt>&nbsp; 
        <i>TAG&nbsp; ARGUMENTS</i><p>
    <dd>
    The command causes a token to be appended to the current list of
    tokens in the HTML widget.  This command is typically used within
    a token handler.
    <p>


    <dt><i>WIDGET</i>&nbsp; <tt>token delete</tt>&nbsp; 
        <i>INDEX&nbsp ?INDEX-2?</i><p>
    <dd>
    Deletes the single token indentified by the index.  If a second index is
    given, the range of tokens from the first to the second index inclusive
    is deleted.
    <p>

    <dt><i>WIDGET</i>&nbsp; <tt>token find</tt>&nbsp; 
        <i>TAG</i><p>
    <dd>
    Locates all tokens with the given <i>TAG</i> and returns them all
    as a list.
    Each element of the returned list is a sublist containing the index
    for the token and the arguments for the token.
    <p>

    <dt><i>WIDGET</i>&nbsp; <tt>token get</tt>&nbsp; 
        <i>INDEX&nbsp ?INDEX-2?</i><p>
    <dd>
    Returns a list of tokens in the range of <i>INDEX</i> through
    <i>INDEX-2</i>.
    Each element of the list consists of the token tag followed by
    the token arguments.
    <p>

    <dt><i>WIDGET</i>&nbsp; <tt>token handler</tt>&nbsp; 
        <i>TAG&nbsp; ?SCRIPT?</i><p>
    <dd>
    This command allows special processing to occur for selected tokens
    in the HTML input stream.
    The <i>TAG</i> argument is either ``Text'' or ``Space'' or the name
    of an HTML tag (ex: ``H3'' or ``/A'').
    If a non-empty script is specified for a particular tag, then when
    instances of that tag are encountered by the parser, the parser calls the
    corresponding script instead of appending the token to the end of the
    token list.  Before calling the script, three arguments are appended:
    <ol>
    <li>The token number.
    <li>The tag.  (ex: <tt>H3</tt>)
    <li>A list of name/value pairs describing all arguments to the tag.
    </ol>
    An empty handler script causes the default processing to occur for
    the tag.  If the script argument is omitted all together, then
    the current value of the token handler for the given tag is returned.
    <p>
    Only one handler may be defined for each token type.  If a new
    handler is specified for a token type that previously had a different
    handler defined, then the old handler is overwritten by the new.
    <p>

    <dt><i>WIDGET</i>&nbsp; <tt>token insert</tt>&nbsp; 
        <i>INDEX&nbsp TAG&nbsp ARGUMENTS</i><p>
    <dd>
    Inserts a single token given by <i>TAG</i> and <i>ARGUMENTS</i> into
    the token list immediately before <i>INDEX</i>.
    <p>
    </dl>

<p>

<dt><i>WIDGET</i>&nbsp; <tt>xview</tt>&nbsp;  <i>args...</i><p>
<dd>Used to control horizontal scrolling.<p>
   <dl>
   <dt><i>WIDGET</i>&nbsp <tt>xview</tt><p>
   <dd>Returns a list containing two elements.  The elements are a fractions
       between 0.0 and 1.0 that define the position of the left and right
       edges of
       the visible part of the document as a fraction of the whole.<p>
   <dt><i>WIDGET</i>&nbsp <tt>xview moveto</tt>&nbsp <i>FRACTION</i><p>
   <dd>Adjusts the horizontal position of the document so that 
       <i>FRACTION</i> of the horizontal span of the document is off-screen
       to the left.<p>
   <dt><i>WIDGET</i>&nbsp <tt>xview scroll</i>&nbsp <i>NUMBER&nbsp WHAT</i><p>
   <dd>
       Shifts the view in the window left or right according to 
       <i>NUMBER</i> and <i>WHAT</i>.&nbsp&nbsp  <i>NUMBER</i> is an integer
       and <i>WHAT</i> is either <tt>units</tt> or <tt>pages</tt>.<p>
   </dl>

<dt><i>WIDGET</i>&nbsp <tt>yview</tt>&nbsp;  <i>args...</i><p>
<dd>Used to control the vertical position of the document.<p>
   <dl>
   <dt><i>WIDGET</i>&nbsp <tt>yview</tt><p>
   <dd>Returns a list containing two elements.  The elements are a fractions
       between 0.0 and 1.0 that define the position of the top and bottom
       edges of
       the visible part of the document as a fraction of the whole.<p>
   <dt><i>WIDGET</i>&nbsp <tt>yview</tt>&nbsp <i>NAME</i><p>
   <dd>Adjusts the vertical position of the document so that the tag
       ``<tt>&lt;a name=</tt><i>NAME</i><tt>&gt;</tt>'' is on screen,
       and preferably near the top of the screen.<p>
   <dt><i>WIDGET</i>&nbsp <tt>yview moveto</tt>&nbsp <i>FRACTION</i><p>
   <dd>Adjusts the horizontal position of the document so that 
       <i>FRACTION</i> of the vertical span of the document is off-screen
       above the visible region.<p>
   <dt><i>WIDGET</i>&nbsp <tt>xview scroll</i>&nbsp; <i>NUMBER&nbsp; WHAT</i><p>
   <dd>
       Shifts the view in the window up or down according to 
       <i>NUMBER</i> and <i>WHAT</i>.&nbsp&nbsp  <i>NUMBER</i> is an integer
       and <i>WHAT</i> is either <tt>units</tt> or <tt>pages</tt>.<p>
   </dl>

</dl>
</body>
</html>