Fossil SCM

Added captureTh1 to www/th1.md, hyperlinked the entries of the th1 command list to their doc sections, and replaced "a name=..." with "a id=...", as the former is long since deprecated (has the same effect, though).

stephan 2020-09-13 22:09 pikchr-th
Commit e7dcfc90f04cc98904c4052ad8ca2e353faaa13e9c952a48af78e04c1e36dc7c
1 file changed +123 -110
+123 -110
--- www/th1.md
+++ www/th1.md
@@ -164,116 +164,129 @@
164164
---------------------
165165
166166
There are many new commands added to TH1 and used to access the special
167167
features of Fossil. The following is a summary of the extended commands:
168168
169
- * anoncap
170
- * anycap
171
- * artifact
172
- * cgiHeaderLine
173
- * checkout
174
- * combobox
175
- * copybtn
176
- * date
177
- * decorate
178
- * defHeader
179
- * dir
180
- * enable\_output
181
- * encode64
182
- * getParameter
183
- * glob\_match
184
- * globalState
185
- * hascap
186
- * hasfeature
187
- * html
188
- * htmlize
189
- * http
190
- * httpize
191
- * insertCsrf
192
- * linecount
193
- * markdown
194
- * nonce
195
- * puts
196
- * query
197
- * randhex
198
- * redirect
199
- * regexp
200
- * reinitialize
201
- * render
202
- * repository
203
- * searchable
204
- * setParameter
205
- * setting
206
- * stime
207
- * styleHeader
208
- * styleFooter
209
- * styleScript
210
- * tclEval
211
- * tclExpr
212
- * tclInvoke
213
- * tclIsSafe
214
- * tclMakeSafe
215
- * tclReady
216
- * trace
217
- * unversioned content
218
- * unversioned list
219
- * utime
220
- * verifyCsrf
221
- * verifyLogin
222
- * wiki
169
+ * [anoncap](#anoncap)
170
+ * [anycap](#anycap)
171
+ * [artifact](#artifact)
172
+ * [captureTh1](#captureTh1)
173
+ * [cgiHeaderLine](#cgiHeaderLine)
174
+ * [checkout](#checkout)
175
+ * [combobox](#combobox)
176
+ * [copybtn](#copybtn)
177
+ * [date](#date)
178
+ * [decorate](#decorate)
179
+ * [defHeader](#defHeader)
180
+ * [dir](#dir)
181
+ * [enable\_output](#enable_output)
182
+ * [encode64](#encode64)
183
+ * [getParameter](#getParameter)
184
+ * [glob\_match](#glob_match)
185
+ * [globalState](#globalState)
186
+ * [hascap](#hascap)
187
+ * [hasfeature](#hasfeature)
188
+ * [html](#html)
189
+ * [htmlize](#htmlize)
190
+ * [http](#http)
191
+ * [httpize](#httpize)
192
+ * [insertCsrf](#insertCsrf)
193
+ * [linecount](#linecount)
194
+ * [markdown](#markdown)
195
+ * [nonce](#nonce)
196
+ * [puts](#puts)
197
+ * [query](#query)
198
+ * [randhex](#randhex)
199
+ * [redirect](#redirect)
200
+ * [regexp](#regexp)
201
+ * [reinitialize](#reinitialize)
202
+ * [render](#render)
203
+ * [repository](#repository)
204
+ * [searchable](#searchable)
205
+ * [setParameter](#setParameter)
206
+ * [setting](#setting)
207
+ * [stime](#stime)
208
+ * [styleHeader](#styleHeader)
209
+ * [styleFooter](#styleFooter)
210
+ * [styleScript](#styleScript)
211
+ * [tclEval](#tclEval)
212
+ * [tclExpr](#tclExpr)
213
+ * [tclInvoke](#tclInvoke)
214
+ * [tclIsSafe](#tclIsSafe)
215
+ * [tclMakeSafe](#tclMakeSafe)
216
+ * [tclReady](#tclReady)
217
+ * [trace](#trace)
218
+ * [unversioned content](#unversioned_content)
219
+ * [unversioned list](#unversioned_list)
220
+ * [utime](#utime)
221
+ * [verifyCsrf](#verifyCsrf)
222
+ * [verifyLogin](#verifyLogin)
223
+ * [wiki](#wiki)
223224
224225
Each of the commands above is documented by a block comment above their
225226
implementation in the th\_main.c or th\_tcl.c source files.
226227
227228
All commands starting with "tcl", with the exception of "tclReady",
228229
require the Tcl integration subsystem be included at compile-time.
229230
Additionally, the "tcl" repository setting must be enabled at runtime
230231
in order to successfully make use of these commands.
231232
232
-<a name="anoncap"></a>TH1 anoncap Command
233
+<a id="anoncap"></a>TH1 anoncap Command
233234
-----------------------------------------
234235
235236
* anoncap STRING...
236237
237238
Returns true if the anonymous user has all of the capabilities listed
238239
in STRING.
239240
240
-<a name="anycap"></a>TH1 anycap Command
241
+<a id="anycap"></a>TH1 anycap Command
241242
---------------------------------------
242243
243244
* anycap STRING
244245
245246
Returns true if the current user user has any one of the capabilities
246247
listed in STRING.
247248
248
-<a name="artifact"></a>TH1 artifact Command
249
+<a id="artifact"></a>TH1 artifact Command
249250
-------------------------------------------
250251
251252
* artifact ID ?FILENAME?
252253
253254
Attempts to locate the specified artifact and return its contents. An
254255
error is generated if the repository is not open or the artifact cannot
255256
be found.
256257
257
-<a name="cgiHeaderLine"></a>TH1 cgiHeaderLine Command
258
+<a id="captureTh1"></a>TH1 captureTh1 Command
259
+-----------------------------------------------------
260
+
261
+ * captureTh1 STRING
262
+
263
+Executes its single argument as TH1 code and captures any
264
+TH1-generated output as a string, which becomes the result of the
265
+function call. e.g. any `puts` calls made from that block will not
266
+generate any output, and instead their output will become part of the
267
+result string.
268
+
269
+
270
+<a id="cgiHeaderLine"></a>TH1 cgiHeaderLine Command
258271
-----------------------------------------------------
259272
260273
* cgiHeaderLine line
261274
262275
Adds the specified line to the CGI header.
263276
264
-<a name="checkout"></a>TH1 checkout Command
277
+<a id="checkout"></a>TH1 checkout Command
265278
-------------------------------------------
266279
267280
* checkout ?BOOLEAN?
268281
269282
Return the fully qualified directory name of the current checkout or an
270283
empty string if it is not available. Optionally, it will attempt to find
271284
the current checkout, opening the configuration ("user") database and the
272285
repository as necessary, if the boolean argument is non-zero.
273286
274
-<a name="combobox"></a>TH1 combobox Command
287
+<a id="combobox"></a>TH1 combobox Command
275288
-------------------------------------------
276289
277290
* combobox NAME TEXT-LIST NUMLINES
278291
279292
Generates and emits an HTML combobox. NAME is both the name of the
@@ -280,11 +293,11 @@
280293
CGI parameter and the name of a variable that contains the currently
281294
selected value. TEXT-LIST is a list of possible values for the
282295
combobox. NUMLINES is 1 for a true combobox. If NUMLINES is greater
283296
than one then the display is a listbox with the number of lines given.
284297
285
-<a name="copybtn"></a>TH1 copybtn Command
298
+<a id="copybtn"></a>TH1 copybtn Command
286299
-----------------------------------------
287300
288301
* copybtn TARGETID FLIPPED TEXT ?COPYLENGTH?
289302
290303
Output TEXT with a click-to-copy button next to it. Loads the copybtn.js
@@ -302,34 +315,34 @@
302315
* >= 3: Truncate TEXT after COPYLENGTH (single-byte) characters.
303316
* 1: Use the "hash-digits" setting as the limit.
304317
* 2: Use the length appropriate for URLs as the limit (defined at
305318
compile-time by `FOSSIL_HASH_DIGITS_URL`, defaults to 16).
306319
307
-<a name="date"></a>TH1 date Command
320
+<a id="date"></a>TH1 date Command
308321
-----------------------------------
309322
310323
* date ?-local?
311324
312325
Return a strings which is the current time and date. If the -local
313326
option is used, the date appears using localtime instead of UTC.
314327
315
-<a name="decorate"></a>TH1 decorate Command
328
+<a id="decorate"></a>TH1 decorate Command
316329
-------------------------------------------
317330
318331
* decorate STRING
319332
320333
Renders STRING as wiki content; however, only links are handled. No
321334
other markup is processed.
322335
323
-<a name="defHeader"></a>TH1 defHeader Command
336
+<a id="defHeader"></a>TH1 defHeader Command
324337
---------------------------------------------
325338
326339
* defHeader
327340
328341
Returns the default page header.
329342
330
-<a name="dir"></a>TH1 dir Command
343
+<a id="dir"></a>TH1 dir Command
331344
---------------------------------
332345
333346
* dir CHECKIN ?GLOB? ?DETAILS?
334347
335348
Returns a list containing all files in CHECKIN. If GLOB is given only
@@ -337,42 +350,42 @@
337350
If DETAILS is non-zero, the result will be a list-of-lists, with each
338351
element containing at least three elements: the file name, the file
339352
size (in bytes), and the file last modification time (relative to the
340353
time zone configured for the repository).
341354
342
-<a name="enable_output"></a>TH1 enable\_output Command
355
+<a id="enable_output"></a>TH1 enable\_output Command
343356
------------------------------------------------------
344357
345358
* enable\_output BOOLEAN
346359
347360
Enable or disable sending output when the combobox, copybtn, puts, or wiki
348361
commands are used.
349362
350
-<a name="encode64"></a>TH1 encode64 Command
363
+<a id="encode64"></a>TH1 encode64 Command
351364
-------------------------------------------
352365
353366
* encode64 STRING
354367
355368
Encode the specified string using Base64 and return the result.
356369
357
-<a name="getParameter"></a>TH1 getParameter Command
370
+<a id="getParameter"></a>TH1 getParameter Command
358371
---------------------------------------------------
359372
360373
* getParameter NAME ?DEFAULT?
361374
362375
Returns the value of the specified query parameter or the specified
363376
default value when there is no matching query parameter.
364377
365
-<a name="glob_match"></a>TH1 glob\_match Command
378
+<a id="glob_match"></a>TH1 glob\_match Command
366379
------------------------------------------------
367380
368381
* glob\_match ?-one? ?--? patternList string
369382
370383
Checks the string against the specified glob pattern -OR- list of glob
371384
patterns and returns non-zero if there is a match.
372385
373
-<a name="globalState"></a>TH1 globalState Command
386
+<a id="globalState"></a>TH1 globalState Command
374387
-------------------------------------------------
375388
376389
* globalState NAME ?DEFAULT?
377390
378391
Returns a string containing the value of the specified global state
@@ -390,19 +403,19 @@
390403
391404
Attempts to query for unsupported global state variables will result
392405
in a script error. Additional global state variables may be exposed
393406
in the future.
394407
395
-<a name="hascap"></a>TH1 hascap Command
408
+<a id="hascap"></a>TH1 hascap Command
396409
---------------------------------------
397410
398411
* hascap STRING...
399412
400413
Returns true if the current user has all of the capabilities listed
401414
in STRING.
402415
403
-<a name="hasfeature"></a>TH1 hasfeature Command
416
+<a id="hasfeature"></a>TH1 hasfeature Command
404417
-----------------------------------------------
405418
406419
* hasfeature STRING
407420
408421
Returns true if the binary has the given compile-time feature enabled.
@@ -425,26 +438,26 @@
425438
1. **see** -- _Uses the SQLite Encryption Extension._
426439
427440
Specifying an unknown feature will return a value of false, it will not
428441
raise a script error.
429442
430
-<a name="html"></a>TH1 html Command
443
+<a id="html"></a>TH1 html Command
431444
-----------------------------------
432445
433446
* html STRING
434447
435448
Outputs the STRING escaped for HTML.
436449
437
-<a name="htmlize"></a>TH1 htmlize Command
450
+<a id="htmlize"></a>TH1 htmlize Command
438451
-----------------------------------------
439452
440453
* htmlize STRING
441454
442455
Escape all characters of STRING which have special meaning in HTML.
443456
Returns the escaped string.
444457
445
-<a name="http"></a>TH1 http Command
458
+<a id="http"></a>TH1 http Command
446459
-----------------------------------
447460
448461
* http ?-asynchronous? ?--? url ?payload?
449462
450463
Performs an HTTP or HTTPS request for the specified URL. If a
@@ -453,58 +466,58 @@
453466
be used. Upon success, if the -asynchronous option is used, an
454467
empty string is returned as the result; otherwise, the response
455468
from the server is returned as the result. Synchronous requests
456469
are not currently implemented.
457470
458
-<a name="httpize"></a>TH1 httpize Command
471
+<a id="httpize"></a>TH1 httpize Command
459472
-----------------------------------------
460473
461474
* httpize STRING
462475
463476
Escape all characters of STRING which have special meaning in URI
464477
components. Returns the escaped string.
465478
466
-<a name="insertCsrf"></a>TH1 insertCsrf Command
479
+<a id="insertCsrf"></a>TH1 insertCsrf Command
467480
-----------------------------------------------
468481
469482
* insertCsrf
470483
471484
While rendering a form, call this command to add the Anti-CSRF token
472485
as a hidden element of the form.
473486
474
-<a name="linecount"></a>TH1 linecount Command
487
+<a id="linecount"></a>TH1 linecount Command
475488
---------------------------------------------
476489
477490
* linecount STRING MAX MIN
478491
479492
Returns one more than the number of \n characters in STRING. But
480493
never returns less than MIN or more than MAX.
481494
482
-<a name="markdown"></a>TH1 markdown Command
495
+<a id="markdown"></a>TH1 markdown Command
483496
-------------------------------------------
484497
485498
* markdown STRING
486499
487500
Renders the input string as markdown. The result is a two-element list.
488501
The first element contains the body, rendered as HTML. The second element
489502
is the text-only title string.
490503
491
-<a name="nonce"></a>TH1 nonce Command
504
+<a id="nonce"></a>TH1 nonce Command
492505
-------------------------------------
493506
494507
* nonce
495508
496509
Returns the value of the cryptographic nonce for the request being processed.
497510
498
-<a name="puts"></a>TH1 puts Command
511
+<a id="puts"></a>TH1 puts Command
499512
-----------------------------------
500513
501514
* puts STRING
502515
503516
Outputs the STRING unchanged.
504517
505
-<a name="query"></a>TH1 query Command
518
+<a id="query"></a>TH1 query Command
506519
-------------------------------------
507520
508521
* query ?-nocomplain? SQL CODE
509522
510523
Runs the SQL query given by the SQL argument. For each row in the result
@@ -512,19 +525,19 @@
512525
513526
In SQL, parameters such as $var are filled in using the value of variable
514527
"var". Result values are stored in variables with the column name prior
515528
to each invocation of CODE.
516529
517
-<a name="randhex"></a>TH1 randhex Command
530
+<a id="randhex"></a>TH1 randhex Command
518531
-----------------------------------------
519532
520533
* randhex N
521534
522535
Returns a string of N*2 random hexadecimal digits with N<50. If N is
523536
omitted, use a value of 10.
524537
525
-<a name="redirect"></a>TH1 redirect Command
538
+<a id="redirect"></a>TH1 redirect Command
526539
-------------------------------------------
527540
528541
* redirect URL ?withMethod?
529542
530543
Issues an HTTP redirect to the specified URL and then exits the process.
@@ -532,43 +545,43 @@
532545
argument is present and non-zero, an HTTP status code of 307 is used, which
533546
should force the user agent to preserve the original method for the request
534547
(e.g. GET, POST) instead of (possibly) forcing the user agent to change the
535548
method to GET.
536549
537
-<a name="regexp"></a>TH1 regexp Command
550
+<a id="regexp"></a>TH1 regexp Command
538551
---------------------------------------
539552
540553
* regexp ?-nocase? ?--? exp string
541554
542555
Checks the string against the specified regular expression and returns
543556
non-zero if it matches. If the regular expression is invalid or cannot
544557
be compiled, an error will be generated.
545558
546
-<a name="reinitialize"></a>TH1 reinitialize Command
559
+<a id="reinitialize"></a>TH1 reinitialize Command
547560
---------------------------------------------------
548561
549562
* reinitialize ?FLAGS?
550563
551564
Reinitializes the TH1 interpreter using the specified flags.
552565
553
-<a name="render"></a>TH1 render Command
566
+<a id="render"></a>TH1 render Command
554567
---------------------------------------
555568
556569
* render STRING
557570
558571
Renders the TH1 template and writes the results.
559572
560
-<a name="repository"></a>TH1 repository Command
573
+<a id="repository"></a>TH1 repository Command
561574
-----------------------------------------------
562575
563576
* repository ?BOOLEAN?
564577
565578
Returns the fully qualified file name of the open repository or an empty
566579
string if one is not currently open. Optionally, it will attempt to open
567580
the repository if the boolean argument is non-zero.
568581
569
-<a name="searchable"></a>TH1 searchable Command
582
+<a id="searchable"></a>TH1 searchable Command
570583
-----------------------------------------------
571584
572585
* searchable STRING...
573586
574587
Return true if searching in any of the document classes identified
@@ -593,54 +606,54 @@
593606
if {[searchable cdtw]} {...}
594607
595608
This command is useful for enabling or disabling a "Search" entry on the
596609
menu bar.
597610
598
-<a name="setParameter"></a>TH1 setParameter Command
611
+<a id="setParameter"></a>TH1 setParameter Command
599612
---------------------------------------------------
600613
601614
* setParameter NAME VALUE
602615
603616
Sets the value of the specified query parameter.
604617
605
-<a name="setting"></a>TH1 setting Command
618
+<a id="setting"></a>TH1 setting Command
606619
-----------------------------------------
607620
608621
* setting name
609622
610623
Gets and returns the value of the specified setting.
611624
612
-<a name="stime"></a>TH1 stime Command
625
+<a id="stime"></a>TH1 stime Command
613626
-------------------------------------
614627
615628
* stime
616629
617630
Returns the number of microseconds of CPU time consumed by the current
618631
process in system space.
619632
620
-<a name="styleHeader"></a>TH1 styleHeader Command
633
+<a id="styleHeader"></a>TH1 styleHeader Command
621634
-------------------------------------------------
622635
623636
* styleHeader TITLE
624637
625638
Render the configured style header for the selected skin.
626639
627
-<a name="styleFooter"></a>TH1 styleFooter Command
640
+<a id="styleFooter"></a>TH1 styleFooter Command
628641
-------------------------------------------------
629642
630643
* styleFooter
631644
632645
Render the configured style footer for the selected skin.
633646
634
-<a name="styleScript"></a>TH1 styleScript Command
647
+<a id="styleScript"></a>TH1 styleScript Command
635648
-------------------------------------------------
636649
637650
* styleScript
638651
639652
Render the configured JavaScript for the selected skin.
640653
641
-<a name="tclEval"></a>TH1 tclEval Command
654
+<a id="tclEval"></a>TH1 tclEval Command
642655
-----------------------------------------
643656
644657
**This command requires the Tcl integration feature.**
645658
646659
* tclEval arg ?arg ...?
@@ -647,11 +660,11 @@
647660
648661
Evaluates the Tcl script and returns its result verbatim. If a Tcl script
649662
error is generated, it will be transformed into a TH1 script error. The
650663
Tcl interpreter will be created automatically if it has not been already.
651664
652
-<a name="tclExpr"></a>TH1 tclExpr Command
665
+<a id="tclExpr"></a>TH1 tclExpr Command
653666
-----------------------------------------
654667
655668
**This command requires the Tcl integration feature.**
656669
657670
* tclExpr arg ?arg ...?
@@ -659,11 +672,11 @@
659672
Evaluates the Tcl expression and returns its result verbatim. If a Tcl
660673
script error is generated, it will be transformed into a TH1 script
661674
error. The Tcl interpreter will be created automatically if it has not
662675
been already.
663676
664
-<a name="tclInvoke"></a>TH1 tclInvoke Command
677
+<a id="tclInvoke"></a>TH1 tclInvoke Command
665678
---------------------------------------------
666679
667680
**This command requires the Tcl integration feature.**
668681
669682
* tclInvoke command ?arg ...?
@@ -670,21 +683,21 @@
670683
671684
Invokes the Tcl command using the supplied arguments. No additional
672685
substitutions are performed on the arguments. The Tcl interpreter
673686
will be created automatically if it has not been already.
674687
675
-<a name="tclIsSafe"></a>TH1 tclIsSafe Command
688
+<a id="tclIsSafe"></a>TH1 tclIsSafe Command
676689
---------------------------------------------
677690
678691
**This command requires the Tcl integration feature.**
679692
680693
* tclIsSafe
681694
682695
Returns non-zero if the Tcl interpreter is "safe". The Tcl interpreter
683696
will be created automatically if it has not been already.
684697
685
-<a name="tclMakeSafe"></a>TH1 tclMakeSafe Command
698
+<a id="tclMakeSafe"></a>TH1 tclMakeSafe Command
686699
-------------------------------------------------
687700
688701
**This command requires the Tcl integration feature.**
689702
690703
* tclMakeSafe
@@ -692,51 +705,51 @@
692705
Forces the Tcl interpreter into "safe" mode by removing all "unsafe"
693706
commands and variables. This operation cannot be undone. The Tcl
694707
interpreter will remain "safe" until the process terminates. The Tcl
695708
interpreter will be created automatically if it has not been already.
696709
697
-<a name="tclReady"></a>TH1 tclReady Command
710
+<a id="tclReady"></a>TH1 tclReady Command
698711
-------------------------------------------
699712
700713
* tclReady
701714
702715
Returns true if the binary has the Tcl integration feature enabled and it
703716
is currently available for use by TH1 scripts.
704717
705
-<a name="trace"></a>TH1 trace Command
718
+<a id="trace"></a>TH1 trace Command
706719
-------------------------------------
707720
708721
* trace STRING
709722
710723
Generates a TH1 trace message if TH1 tracing is enabled.
711724
712
-<a name="unversioned_content"></a>TH1 unversioned content Command
725
+<a id="unversioned_content"></a>TH1 unversioned content Command
713726
-----------------------------------------------------------------
714727
715728
* unversioned content FILENAME
716729
717730
Attempts to locate the specified unversioned file and return its contents.
718731
An error is generated if the repository is not open or the unversioned file
719732
cannot be found.
720733
721
-<a name="unversioned_list"></a>TH1 unversioned list Command
734
+<a id="unversioned_list"></a>TH1 unversioned list Command
722735
-----------------------------------------------------------
723736
724737
* unversioned list
725738
726739
Returns a list of the names of all unversioned files held in the local
727740
repository. An error is generated if the repository is not open.
728741
729
-<a name="utime"></a>TH1 utime Command
742
+<a id="utime"></a>TH1 utime Command
730743
-------------------------------------
731744
732745
* utime
733746
734747
Returns the number of microseconds of CPU time consumed by the current
735748
process in user space.
736749
737
-<a name="verifyCsrf"></a>TH1 verifyCsrf Command
750
+<a id="verifyCsrf"></a>TH1 verifyCsrf Command
738751
-----------------------------------------------
739752
740753
* verifyCsrf
741754
742755
Before using the results of a form, first call this command to verify
@@ -743,19 +756,19 @@
743756
that this Anti-CSRF token is present and is valid. If the Anti-CSRF token
744757
is missing or is incorrect, that indicates a cross-site scripting attack.
745758
If the event of an attack is detected, an error message is generated and
746759
all further processing is aborted.
747760
748
-<a name="verifyLogin"></a>TH1 verifyLogin Command
761
+<a id="verifyLogin"></a>TH1 verifyLogin Command
749762
-------------------------------------------------
750763
751764
* verifyLogin
752765
753766
Returns non-zero if the specified user name and password represent a
754767
valid login for the repository.
755768
756
-<a name="wiki"></a>TH1 wiki Command
769
+<a id="wiki"></a>TH1 wiki Command
757770
-----------------------------------
758771
759772
* wiki STRING
760773
761774
Renders STRING as wiki content.
@@ -769,24 +782,24 @@
769782
Tcl commands:
770783
771784
* th1Eval
772785
* th1Expr
773786
774
-<a name="th1Eval"></a>Tcl th1Eval Command
787
+<a id="th1Eval"></a>Tcl th1Eval Command
775788
-----------------------------------------
776789
777790
**This command requires the Tcl integration feature.**
778791
779792
* th1Eval arg
780793
781794
Evaluates the TH1 script and returns its result verbatim. If a TH1 script
782795
error is generated, it will be transformed into a Tcl script error.
783796
784
-<a name="th1Expr"></a>Tcl th1Expr Command
797
+<a id="th1Expr"></a>Tcl th1Expr Command
785798
-----------------------------------------
786799
787800
**This command requires the Tcl integration feature.**
788801
789802
* th1Expr arg
790803
791804
Evaluates the TH1 expression and returns its result verbatim. If a TH1
792805
script error is generated, it will be transformed into a Tcl script error.
793806
--- www/th1.md
+++ www/th1.md
@@ -164,116 +164,129 @@
164 ---------------------
165
166 There are many new commands added to TH1 and used to access the special
167 features of Fossil. The following is a summary of the extended commands:
168
169 * anoncap
170 * anycap
171 * artifact
172 * cgiHeaderLine
173 * checkout
174 * combobox
175 * copybtn
176 * date
177 * decorate
178 * defHeader
179 * dir
180 * enable\_output
181 * encode64
182 * getParameter
183 * glob\_match
184 * globalState
185 * hascap
186 * hasfeature
187 * html
188 * htmlize
189 * http
190 * httpize
191 * insertCsrf
192 * linecount
193 * markdown
194 * nonce
195 * puts
196 * query
197 * randhex
198 * redirect
199 * regexp
200 * reinitialize
201 * render
202 * repository
203 * searchable
204 * setParameter
205 * setting
206 * stime
207 * styleHeader
208 * styleFooter
209 * styleScript
210 * tclEval
211 * tclExpr
212 * tclInvoke
213 * tclIsSafe
214 * tclMakeSafe
215 * tclReady
216 * trace
217 * unversioned content
218 * unversioned list
219 * utime
220 * verifyCsrf
221 * verifyLogin
222 * wiki
 
223
224 Each of the commands above is documented by a block comment above their
225 implementation in the th\_main.c or th\_tcl.c source files.
226
227 All commands starting with "tcl", with the exception of "tclReady",
228 require the Tcl integration subsystem be included at compile-time.
229 Additionally, the "tcl" repository setting must be enabled at runtime
230 in order to successfully make use of these commands.
231
232 <a name="anoncap"></a>TH1 anoncap Command
233 -----------------------------------------
234
235 * anoncap STRING...
236
237 Returns true if the anonymous user has all of the capabilities listed
238 in STRING.
239
240 <a name="anycap"></a>TH1 anycap Command
241 ---------------------------------------
242
243 * anycap STRING
244
245 Returns true if the current user user has any one of the capabilities
246 listed in STRING.
247
248 <a name="artifact"></a>TH1 artifact Command
249 -------------------------------------------
250
251 * artifact ID ?FILENAME?
252
253 Attempts to locate the specified artifact and return its contents. An
254 error is generated if the repository is not open or the artifact cannot
255 be found.
256
257 <a name="cgiHeaderLine"></a>TH1 cgiHeaderLine Command
 
 
 
 
 
 
 
 
 
 
 
 
258 -----------------------------------------------------
259
260 * cgiHeaderLine line
261
262 Adds the specified line to the CGI header.
263
264 <a name="checkout"></a>TH1 checkout Command
265 -------------------------------------------
266
267 * checkout ?BOOLEAN?
268
269 Return the fully qualified directory name of the current checkout or an
270 empty string if it is not available. Optionally, it will attempt to find
271 the current checkout, opening the configuration ("user") database and the
272 repository as necessary, if the boolean argument is non-zero.
273
274 <a name="combobox"></a>TH1 combobox Command
275 -------------------------------------------
276
277 * combobox NAME TEXT-LIST NUMLINES
278
279 Generates and emits an HTML combobox. NAME is both the name of the
@@ -280,11 +293,11 @@
280 CGI parameter and the name of a variable that contains the currently
281 selected value. TEXT-LIST is a list of possible values for the
282 combobox. NUMLINES is 1 for a true combobox. If NUMLINES is greater
283 than one then the display is a listbox with the number of lines given.
284
285 <a name="copybtn"></a>TH1 copybtn Command
286 -----------------------------------------
287
288 * copybtn TARGETID FLIPPED TEXT ?COPYLENGTH?
289
290 Output TEXT with a click-to-copy button next to it. Loads the copybtn.js
@@ -302,34 +315,34 @@
302 * >= 3: Truncate TEXT after COPYLENGTH (single-byte) characters.
303 * 1: Use the "hash-digits" setting as the limit.
304 * 2: Use the length appropriate for URLs as the limit (defined at
305 compile-time by `FOSSIL_HASH_DIGITS_URL`, defaults to 16).
306
307 <a name="date"></a>TH1 date Command
308 -----------------------------------
309
310 * date ?-local?
311
312 Return a strings which is the current time and date. If the -local
313 option is used, the date appears using localtime instead of UTC.
314
315 <a name="decorate"></a>TH1 decorate Command
316 -------------------------------------------
317
318 * decorate STRING
319
320 Renders STRING as wiki content; however, only links are handled. No
321 other markup is processed.
322
323 <a name="defHeader"></a>TH1 defHeader Command
324 ---------------------------------------------
325
326 * defHeader
327
328 Returns the default page header.
329
330 <a name="dir"></a>TH1 dir Command
331 ---------------------------------
332
333 * dir CHECKIN ?GLOB? ?DETAILS?
334
335 Returns a list containing all files in CHECKIN. If GLOB is given only
@@ -337,42 +350,42 @@
337 If DETAILS is non-zero, the result will be a list-of-lists, with each
338 element containing at least three elements: the file name, the file
339 size (in bytes), and the file last modification time (relative to the
340 time zone configured for the repository).
341
342 <a name="enable_output"></a>TH1 enable\_output Command
343 ------------------------------------------------------
344
345 * enable\_output BOOLEAN
346
347 Enable or disable sending output when the combobox, copybtn, puts, or wiki
348 commands are used.
349
350 <a name="encode64"></a>TH1 encode64 Command
351 -------------------------------------------
352
353 * encode64 STRING
354
355 Encode the specified string using Base64 and return the result.
356
357 <a name="getParameter"></a>TH1 getParameter Command
358 ---------------------------------------------------
359
360 * getParameter NAME ?DEFAULT?
361
362 Returns the value of the specified query parameter or the specified
363 default value when there is no matching query parameter.
364
365 <a name="glob_match"></a>TH1 glob\_match Command
366 ------------------------------------------------
367
368 * glob\_match ?-one? ?--? patternList string
369
370 Checks the string against the specified glob pattern -OR- list of glob
371 patterns and returns non-zero if there is a match.
372
373 <a name="globalState"></a>TH1 globalState Command
374 -------------------------------------------------
375
376 * globalState NAME ?DEFAULT?
377
378 Returns a string containing the value of the specified global state
@@ -390,19 +403,19 @@
390
391 Attempts to query for unsupported global state variables will result
392 in a script error. Additional global state variables may be exposed
393 in the future.
394
395 <a name="hascap"></a>TH1 hascap Command
396 ---------------------------------------
397
398 * hascap STRING...
399
400 Returns true if the current user has all of the capabilities listed
401 in STRING.
402
403 <a name="hasfeature"></a>TH1 hasfeature Command
404 -----------------------------------------------
405
406 * hasfeature STRING
407
408 Returns true if the binary has the given compile-time feature enabled.
@@ -425,26 +438,26 @@
425 1. **see** -- _Uses the SQLite Encryption Extension._
426
427 Specifying an unknown feature will return a value of false, it will not
428 raise a script error.
429
430 <a name="html"></a>TH1 html Command
431 -----------------------------------
432
433 * html STRING
434
435 Outputs the STRING escaped for HTML.
436
437 <a name="htmlize"></a>TH1 htmlize Command
438 -----------------------------------------
439
440 * htmlize STRING
441
442 Escape all characters of STRING which have special meaning in HTML.
443 Returns the escaped string.
444
445 <a name="http"></a>TH1 http Command
446 -----------------------------------
447
448 * http ?-asynchronous? ?--? url ?payload?
449
450 Performs an HTTP or HTTPS request for the specified URL. If a
@@ -453,58 +466,58 @@
453 be used. Upon success, if the -asynchronous option is used, an
454 empty string is returned as the result; otherwise, the response
455 from the server is returned as the result. Synchronous requests
456 are not currently implemented.
457
458 <a name="httpize"></a>TH1 httpize Command
459 -----------------------------------------
460
461 * httpize STRING
462
463 Escape all characters of STRING which have special meaning in URI
464 components. Returns the escaped string.
465
466 <a name="insertCsrf"></a>TH1 insertCsrf Command
467 -----------------------------------------------
468
469 * insertCsrf
470
471 While rendering a form, call this command to add the Anti-CSRF token
472 as a hidden element of the form.
473
474 <a name="linecount"></a>TH1 linecount Command
475 ---------------------------------------------
476
477 * linecount STRING MAX MIN
478
479 Returns one more than the number of \n characters in STRING. But
480 never returns less than MIN or more than MAX.
481
482 <a name="markdown"></a>TH1 markdown Command
483 -------------------------------------------
484
485 * markdown STRING
486
487 Renders the input string as markdown. The result is a two-element list.
488 The first element contains the body, rendered as HTML. The second element
489 is the text-only title string.
490
491 <a name="nonce"></a>TH1 nonce Command
492 -------------------------------------
493
494 * nonce
495
496 Returns the value of the cryptographic nonce for the request being processed.
497
498 <a name="puts"></a>TH1 puts Command
499 -----------------------------------
500
501 * puts STRING
502
503 Outputs the STRING unchanged.
504
505 <a name="query"></a>TH1 query Command
506 -------------------------------------
507
508 * query ?-nocomplain? SQL CODE
509
510 Runs the SQL query given by the SQL argument. For each row in the result
@@ -512,19 +525,19 @@
512
513 In SQL, parameters such as $var are filled in using the value of variable
514 "var". Result values are stored in variables with the column name prior
515 to each invocation of CODE.
516
517 <a name="randhex"></a>TH1 randhex Command
518 -----------------------------------------
519
520 * randhex N
521
522 Returns a string of N*2 random hexadecimal digits with N<50. If N is
523 omitted, use a value of 10.
524
525 <a name="redirect"></a>TH1 redirect Command
526 -------------------------------------------
527
528 * redirect URL ?withMethod?
529
530 Issues an HTTP redirect to the specified URL and then exits the process.
@@ -532,43 +545,43 @@
532 argument is present and non-zero, an HTTP status code of 307 is used, which
533 should force the user agent to preserve the original method for the request
534 (e.g. GET, POST) instead of (possibly) forcing the user agent to change the
535 method to GET.
536
537 <a name="regexp"></a>TH1 regexp Command
538 ---------------------------------------
539
540 * regexp ?-nocase? ?--? exp string
541
542 Checks the string against the specified regular expression and returns
543 non-zero if it matches. If the regular expression is invalid or cannot
544 be compiled, an error will be generated.
545
546 <a name="reinitialize"></a>TH1 reinitialize Command
547 ---------------------------------------------------
548
549 * reinitialize ?FLAGS?
550
551 Reinitializes the TH1 interpreter using the specified flags.
552
553 <a name="render"></a>TH1 render Command
554 ---------------------------------------
555
556 * render STRING
557
558 Renders the TH1 template and writes the results.
559
560 <a name="repository"></a>TH1 repository Command
561 -----------------------------------------------
562
563 * repository ?BOOLEAN?
564
565 Returns the fully qualified file name of the open repository or an empty
566 string if one is not currently open. Optionally, it will attempt to open
567 the repository if the boolean argument is non-zero.
568
569 <a name="searchable"></a>TH1 searchable Command
570 -----------------------------------------------
571
572 * searchable STRING...
573
574 Return true if searching in any of the document classes identified
@@ -593,54 +606,54 @@
593 if {[searchable cdtw]} {...}
594
595 This command is useful for enabling or disabling a "Search" entry on the
596 menu bar.
597
598 <a name="setParameter"></a>TH1 setParameter Command
599 ---------------------------------------------------
600
601 * setParameter NAME VALUE
602
603 Sets the value of the specified query parameter.
604
605 <a name="setting"></a>TH1 setting Command
606 -----------------------------------------
607
608 * setting name
609
610 Gets and returns the value of the specified setting.
611
612 <a name="stime"></a>TH1 stime Command
613 -------------------------------------
614
615 * stime
616
617 Returns the number of microseconds of CPU time consumed by the current
618 process in system space.
619
620 <a name="styleHeader"></a>TH1 styleHeader Command
621 -------------------------------------------------
622
623 * styleHeader TITLE
624
625 Render the configured style header for the selected skin.
626
627 <a name="styleFooter"></a>TH1 styleFooter Command
628 -------------------------------------------------
629
630 * styleFooter
631
632 Render the configured style footer for the selected skin.
633
634 <a name="styleScript"></a>TH1 styleScript Command
635 -------------------------------------------------
636
637 * styleScript
638
639 Render the configured JavaScript for the selected skin.
640
641 <a name="tclEval"></a>TH1 tclEval Command
642 -----------------------------------------
643
644 **This command requires the Tcl integration feature.**
645
646 * tclEval arg ?arg ...?
@@ -647,11 +660,11 @@
647
648 Evaluates the Tcl script and returns its result verbatim. If a Tcl script
649 error is generated, it will be transformed into a TH1 script error. The
650 Tcl interpreter will be created automatically if it has not been already.
651
652 <a name="tclExpr"></a>TH1 tclExpr Command
653 -----------------------------------------
654
655 **This command requires the Tcl integration feature.**
656
657 * tclExpr arg ?arg ...?
@@ -659,11 +672,11 @@
659 Evaluates the Tcl expression and returns its result verbatim. If a Tcl
660 script error is generated, it will be transformed into a TH1 script
661 error. The Tcl interpreter will be created automatically if it has not
662 been already.
663
664 <a name="tclInvoke"></a>TH1 tclInvoke Command
665 ---------------------------------------------
666
667 **This command requires the Tcl integration feature.**
668
669 * tclInvoke command ?arg ...?
@@ -670,21 +683,21 @@
670
671 Invokes the Tcl command using the supplied arguments. No additional
672 substitutions are performed on the arguments. The Tcl interpreter
673 will be created automatically if it has not been already.
674
675 <a name="tclIsSafe"></a>TH1 tclIsSafe Command
676 ---------------------------------------------
677
678 **This command requires the Tcl integration feature.**
679
680 * tclIsSafe
681
682 Returns non-zero if the Tcl interpreter is "safe". The Tcl interpreter
683 will be created automatically if it has not been already.
684
685 <a name="tclMakeSafe"></a>TH1 tclMakeSafe Command
686 -------------------------------------------------
687
688 **This command requires the Tcl integration feature.**
689
690 * tclMakeSafe
@@ -692,51 +705,51 @@
692 Forces the Tcl interpreter into "safe" mode by removing all "unsafe"
693 commands and variables. This operation cannot be undone. The Tcl
694 interpreter will remain "safe" until the process terminates. The Tcl
695 interpreter will be created automatically if it has not been already.
696
697 <a name="tclReady"></a>TH1 tclReady Command
698 -------------------------------------------
699
700 * tclReady
701
702 Returns true if the binary has the Tcl integration feature enabled and it
703 is currently available for use by TH1 scripts.
704
705 <a name="trace"></a>TH1 trace Command
706 -------------------------------------
707
708 * trace STRING
709
710 Generates a TH1 trace message if TH1 tracing is enabled.
711
712 <a name="unversioned_content"></a>TH1 unversioned content Command
713 -----------------------------------------------------------------
714
715 * unversioned content FILENAME
716
717 Attempts to locate the specified unversioned file and return its contents.
718 An error is generated if the repository is not open or the unversioned file
719 cannot be found.
720
721 <a name="unversioned_list"></a>TH1 unversioned list Command
722 -----------------------------------------------------------
723
724 * unversioned list
725
726 Returns a list of the names of all unversioned files held in the local
727 repository. An error is generated if the repository is not open.
728
729 <a name="utime"></a>TH1 utime Command
730 -------------------------------------
731
732 * utime
733
734 Returns the number of microseconds of CPU time consumed by the current
735 process in user space.
736
737 <a name="verifyCsrf"></a>TH1 verifyCsrf Command
738 -----------------------------------------------
739
740 * verifyCsrf
741
742 Before using the results of a form, first call this command to verify
@@ -743,19 +756,19 @@
743 that this Anti-CSRF token is present and is valid. If the Anti-CSRF token
744 is missing or is incorrect, that indicates a cross-site scripting attack.
745 If the event of an attack is detected, an error message is generated and
746 all further processing is aborted.
747
748 <a name="verifyLogin"></a>TH1 verifyLogin Command
749 -------------------------------------------------
750
751 * verifyLogin
752
753 Returns non-zero if the specified user name and password represent a
754 valid login for the repository.
755
756 <a name="wiki"></a>TH1 wiki Command
757 -----------------------------------
758
759 * wiki STRING
760
761 Renders STRING as wiki content.
@@ -769,24 +782,24 @@
769 Tcl commands:
770
771 * th1Eval
772 * th1Expr
773
774 <a name="th1Eval"></a>Tcl th1Eval Command
775 -----------------------------------------
776
777 **This command requires the Tcl integration feature.**
778
779 * th1Eval arg
780
781 Evaluates the TH1 script and returns its result verbatim. If a TH1 script
782 error is generated, it will be transformed into a Tcl script error.
783
784 <a name="th1Expr"></a>Tcl th1Expr Command
785 -----------------------------------------
786
787 **This command requires the Tcl integration feature.**
788
789 * th1Expr arg
790
791 Evaluates the TH1 expression and returns its result verbatim. If a TH1
792 script error is generated, it will be transformed into a Tcl script error.
793
--- www/th1.md
+++ www/th1.md
@@ -164,116 +164,129 @@
164 ---------------------
165
166 There are many new commands added to TH1 and used to access the special
167 features of Fossil. The following is a summary of the extended commands:
168
169 * [anoncap](#anoncap)
170 * [anycap](#anycap)
171 * [artifact](#artifact)
172 * [captureTh1](#captureTh1)
173 * [cgiHeaderLine](#cgiHeaderLine)
174 * [checkout](#checkout)
175 * [combobox](#combobox)
176 * [copybtn](#copybtn)
177 * [date](#date)
178 * [decorate](#decorate)
179 * [defHeader](#defHeader)
180 * [dir](#dir)
181 * [enable\_output](#enable_output)
182 * [encode64](#encode64)
183 * [getParameter](#getParameter)
184 * [glob\_match](#glob_match)
185 * [globalState](#globalState)
186 * [hascap](#hascap)
187 * [hasfeature](#hasfeature)
188 * [html](#html)
189 * [htmlize](#htmlize)
190 * [http](#http)
191 * [httpize](#httpize)
192 * [insertCsrf](#insertCsrf)
193 * [linecount](#linecount)
194 * [markdown](#markdown)
195 * [nonce](#nonce)
196 * [puts](#puts)
197 * [query](#query)
198 * [randhex](#randhex)
199 * [redirect](#redirect)
200 * [regexp](#regexp)
201 * [reinitialize](#reinitialize)
202 * [render](#render)
203 * [repository](#repository)
204 * [searchable](#searchable)
205 * [setParameter](#setParameter)
206 * [setting](#setting)
207 * [stime](#stime)
208 * [styleHeader](#styleHeader)
209 * [styleFooter](#styleFooter)
210 * [styleScript](#styleScript)
211 * [tclEval](#tclEval)
212 * [tclExpr](#tclExpr)
213 * [tclInvoke](#tclInvoke)
214 * [tclIsSafe](#tclIsSafe)
215 * [tclMakeSafe](#tclMakeSafe)
216 * [tclReady](#tclReady)
217 * [trace](#trace)
218 * [unversioned content](#unversioned_content)
219 * [unversioned list](#unversioned_list)
220 * [utime](#utime)
221 * [verifyCsrf](#verifyCsrf)
222 * [verifyLogin](#verifyLogin)
223 * [wiki](#wiki)
224
225 Each of the commands above is documented by a block comment above their
226 implementation in the th\_main.c or th\_tcl.c source files.
227
228 All commands starting with "tcl", with the exception of "tclReady",
229 require the Tcl integration subsystem be included at compile-time.
230 Additionally, the "tcl" repository setting must be enabled at runtime
231 in order to successfully make use of these commands.
232
233 <a id="anoncap"></a>TH1 anoncap Command
234 -----------------------------------------
235
236 * anoncap STRING...
237
238 Returns true if the anonymous user has all of the capabilities listed
239 in STRING.
240
241 <a id="anycap"></a>TH1 anycap Command
242 ---------------------------------------
243
244 * anycap STRING
245
246 Returns true if the current user user has any one of the capabilities
247 listed in STRING.
248
249 <a id="artifact"></a>TH1 artifact Command
250 -------------------------------------------
251
252 * artifact ID ?FILENAME?
253
254 Attempts to locate the specified artifact and return its contents. An
255 error is generated if the repository is not open or the artifact cannot
256 be found.
257
258 <a id="captureTh1"></a>TH1 captureTh1 Command
259 -----------------------------------------------------
260
261 * captureTh1 STRING
262
263 Executes its single argument as TH1 code and captures any
264 TH1-generated output as a string, which becomes the result of the
265 function call. e.g. any `puts` calls made from that block will not
266 generate any output, and instead their output will become part of the
267 result string.
268
269
270 <a id="cgiHeaderLine"></a>TH1 cgiHeaderLine Command
271 -----------------------------------------------------
272
273 * cgiHeaderLine line
274
275 Adds the specified line to the CGI header.
276
277 <a id="checkout"></a>TH1 checkout Command
278 -------------------------------------------
279
280 * checkout ?BOOLEAN?
281
282 Return the fully qualified directory name of the current checkout or an
283 empty string if it is not available. Optionally, it will attempt to find
284 the current checkout, opening the configuration ("user") database and the
285 repository as necessary, if the boolean argument is non-zero.
286
287 <a id="combobox"></a>TH1 combobox Command
288 -------------------------------------------
289
290 * combobox NAME TEXT-LIST NUMLINES
291
292 Generates and emits an HTML combobox. NAME is both the name of the
@@ -280,11 +293,11 @@
293 CGI parameter and the name of a variable that contains the currently
294 selected value. TEXT-LIST is a list of possible values for the
295 combobox. NUMLINES is 1 for a true combobox. If NUMLINES is greater
296 than one then the display is a listbox with the number of lines given.
297
298 <a id="copybtn"></a>TH1 copybtn Command
299 -----------------------------------------
300
301 * copybtn TARGETID FLIPPED TEXT ?COPYLENGTH?
302
303 Output TEXT with a click-to-copy button next to it. Loads the copybtn.js
@@ -302,34 +315,34 @@
315 * >= 3: Truncate TEXT after COPYLENGTH (single-byte) characters.
316 * 1: Use the "hash-digits" setting as the limit.
317 * 2: Use the length appropriate for URLs as the limit (defined at
318 compile-time by `FOSSIL_HASH_DIGITS_URL`, defaults to 16).
319
320 <a id="date"></a>TH1 date Command
321 -----------------------------------
322
323 * date ?-local?
324
325 Return a strings which is the current time and date. If the -local
326 option is used, the date appears using localtime instead of UTC.
327
328 <a id="decorate"></a>TH1 decorate Command
329 -------------------------------------------
330
331 * decorate STRING
332
333 Renders STRING as wiki content; however, only links are handled. No
334 other markup is processed.
335
336 <a id="defHeader"></a>TH1 defHeader Command
337 ---------------------------------------------
338
339 * defHeader
340
341 Returns the default page header.
342
343 <a id="dir"></a>TH1 dir Command
344 ---------------------------------
345
346 * dir CHECKIN ?GLOB? ?DETAILS?
347
348 Returns a list containing all files in CHECKIN. If GLOB is given only
@@ -337,42 +350,42 @@
350 If DETAILS is non-zero, the result will be a list-of-lists, with each
351 element containing at least three elements: the file name, the file
352 size (in bytes), and the file last modification time (relative to the
353 time zone configured for the repository).
354
355 <a id="enable_output"></a>TH1 enable\_output Command
356 ------------------------------------------------------
357
358 * enable\_output BOOLEAN
359
360 Enable or disable sending output when the combobox, copybtn, puts, or wiki
361 commands are used.
362
363 <a id="encode64"></a>TH1 encode64 Command
364 -------------------------------------------
365
366 * encode64 STRING
367
368 Encode the specified string using Base64 and return the result.
369
370 <a id="getParameter"></a>TH1 getParameter Command
371 ---------------------------------------------------
372
373 * getParameter NAME ?DEFAULT?
374
375 Returns the value of the specified query parameter or the specified
376 default value when there is no matching query parameter.
377
378 <a id="glob_match"></a>TH1 glob\_match Command
379 ------------------------------------------------
380
381 * glob\_match ?-one? ?--? patternList string
382
383 Checks the string against the specified glob pattern -OR- list of glob
384 patterns and returns non-zero if there is a match.
385
386 <a id="globalState"></a>TH1 globalState Command
387 -------------------------------------------------
388
389 * globalState NAME ?DEFAULT?
390
391 Returns a string containing the value of the specified global state
@@ -390,19 +403,19 @@
403
404 Attempts to query for unsupported global state variables will result
405 in a script error. Additional global state variables may be exposed
406 in the future.
407
408 <a id="hascap"></a>TH1 hascap Command
409 ---------------------------------------
410
411 * hascap STRING...
412
413 Returns true if the current user has all of the capabilities listed
414 in STRING.
415
416 <a id="hasfeature"></a>TH1 hasfeature Command
417 -----------------------------------------------
418
419 * hasfeature STRING
420
421 Returns true if the binary has the given compile-time feature enabled.
@@ -425,26 +438,26 @@
438 1. **see** -- _Uses the SQLite Encryption Extension._
439
440 Specifying an unknown feature will return a value of false, it will not
441 raise a script error.
442
443 <a id="html"></a>TH1 html Command
444 -----------------------------------
445
446 * html STRING
447
448 Outputs the STRING escaped for HTML.
449
450 <a id="htmlize"></a>TH1 htmlize Command
451 -----------------------------------------
452
453 * htmlize STRING
454
455 Escape all characters of STRING which have special meaning in HTML.
456 Returns the escaped string.
457
458 <a id="http"></a>TH1 http Command
459 -----------------------------------
460
461 * http ?-asynchronous? ?--? url ?payload?
462
463 Performs an HTTP or HTTPS request for the specified URL. If a
@@ -453,58 +466,58 @@
466 be used. Upon success, if the -asynchronous option is used, an
467 empty string is returned as the result; otherwise, the response
468 from the server is returned as the result. Synchronous requests
469 are not currently implemented.
470
471 <a id="httpize"></a>TH1 httpize Command
472 -----------------------------------------
473
474 * httpize STRING
475
476 Escape all characters of STRING which have special meaning in URI
477 components. Returns the escaped string.
478
479 <a id="insertCsrf"></a>TH1 insertCsrf Command
480 -----------------------------------------------
481
482 * insertCsrf
483
484 While rendering a form, call this command to add the Anti-CSRF token
485 as a hidden element of the form.
486
487 <a id="linecount"></a>TH1 linecount Command
488 ---------------------------------------------
489
490 * linecount STRING MAX MIN
491
492 Returns one more than the number of \n characters in STRING. But
493 never returns less than MIN or more than MAX.
494
495 <a id="markdown"></a>TH1 markdown Command
496 -------------------------------------------
497
498 * markdown STRING
499
500 Renders the input string as markdown. The result is a two-element list.
501 The first element contains the body, rendered as HTML. The second element
502 is the text-only title string.
503
504 <a id="nonce"></a>TH1 nonce Command
505 -------------------------------------
506
507 * nonce
508
509 Returns the value of the cryptographic nonce for the request being processed.
510
511 <a id="puts"></a>TH1 puts Command
512 -----------------------------------
513
514 * puts STRING
515
516 Outputs the STRING unchanged.
517
518 <a id="query"></a>TH1 query Command
519 -------------------------------------
520
521 * query ?-nocomplain? SQL CODE
522
523 Runs the SQL query given by the SQL argument. For each row in the result
@@ -512,19 +525,19 @@
525
526 In SQL, parameters such as $var are filled in using the value of variable
527 "var". Result values are stored in variables with the column name prior
528 to each invocation of CODE.
529
530 <a id="randhex"></a>TH1 randhex Command
531 -----------------------------------------
532
533 * randhex N
534
535 Returns a string of N*2 random hexadecimal digits with N<50. If N is
536 omitted, use a value of 10.
537
538 <a id="redirect"></a>TH1 redirect Command
539 -------------------------------------------
540
541 * redirect URL ?withMethod?
542
543 Issues an HTTP redirect to the specified URL and then exits the process.
@@ -532,43 +545,43 @@
545 argument is present and non-zero, an HTTP status code of 307 is used, which
546 should force the user agent to preserve the original method for the request
547 (e.g. GET, POST) instead of (possibly) forcing the user agent to change the
548 method to GET.
549
550 <a id="regexp"></a>TH1 regexp Command
551 ---------------------------------------
552
553 * regexp ?-nocase? ?--? exp string
554
555 Checks the string against the specified regular expression and returns
556 non-zero if it matches. If the regular expression is invalid or cannot
557 be compiled, an error will be generated.
558
559 <a id="reinitialize"></a>TH1 reinitialize Command
560 ---------------------------------------------------
561
562 * reinitialize ?FLAGS?
563
564 Reinitializes the TH1 interpreter using the specified flags.
565
566 <a id="render"></a>TH1 render Command
567 ---------------------------------------
568
569 * render STRING
570
571 Renders the TH1 template and writes the results.
572
573 <a id="repository"></a>TH1 repository Command
574 -----------------------------------------------
575
576 * repository ?BOOLEAN?
577
578 Returns the fully qualified file name of the open repository or an empty
579 string if one is not currently open. Optionally, it will attempt to open
580 the repository if the boolean argument is non-zero.
581
582 <a id="searchable"></a>TH1 searchable Command
583 -----------------------------------------------
584
585 * searchable STRING...
586
587 Return true if searching in any of the document classes identified
@@ -593,54 +606,54 @@
606 if {[searchable cdtw]} {...}
607
608 This command is useful for enabling or disabling a "Search" entry on the
609 menu bar.
610
611 <a id="setParameter"></a>TH1 setParameter Command
612 ---------------------------------------------------
613
614 * setParameter NAME VALUE
615
616 Sets the value of the specified query parameter.
617
618 <a id="setting"></a>TH1 setting Command
619 -----------------------------------------
620
621 * setting name
622
623 Gets and returns the value of the specified setting.
624
625 <a id="stime"></a>TH1 stime Command
626 -------------------------------------
627
628 * stime
629
630 Returns the number of microseconds of CPU time consumed by the current
631 process in system space.
632
633 <a id="styleHeader"></a>TH1 styleHeader Command
634 -------------------------------------------------
635
636 * styleHeader TITLE
637
638 Render the configured style header for the selected skin.
639
640 <a id="styleFooter"></a>TH1 styleFooter Command
641 -------------------------------------------------
642
643 * styleFooter
644
645 Render the configured style footer for the selected skin.
646
647 <a id="styleScript"></a>TH1 styleScript Command
648 -------------------------------------------------
649
650 * styleScript
651
652 Render the configured JavaScript for the selected skin.
653
654 <a id="tclEval"></a>TH1 tclEval Command
655 -----------------------------------------
656
657 **This command requires the Tcl integration feature.**
658
659 * tclEval arg ?arg ...?
@@ -647,11 +660,11 @@
660
661 Evaluates the Tcl script and returns its result verbatim. If a Tcl script
662 error is generated, it will be transformed into a TH1 script error. The
663 Tcl interpreter will be created automatically if it has not been already.
664
665 <a id="tclExpr"></a>TH1 tclExpr Command
666 -----------------------------------------
667
668 **This command requires the Tcl integration feature.**
669
670 * tclExpr arg ?arg ...?
@@ -659,11 +672,11 @@
672 Evaluates the Tcl expression and returns its result verbatim. If a Tcl
673 script error is generated, it will be transformed into a TH1 script
674 error. The Tcl interpreter will be created automatically if it has not
675 been already.
676
677 <a id="tclInvoke"></a>TH1 tclInvoke Command
678 ---------------------------------------------
679
680 **This command requires the Tcl integration feature.**
681
682 * tclInvoke command ?arg ...?
@@ -670,21 +683,21 @@
683
684 Invokes the Tcl command using the supplied arguments. No additional
685 substitutions are performed on the arguments. The Tcl interpreter
686 will be created automatically if it has not been already.
687
688 <a id="tclIsSafe"></a>TH1 tclIsSafe Command
689 ---------------------------------------------
690
691 **This command requires the Tcl integration feature.**
692
693 * tclIsSafe
694
695 Returns non-zero if the Tcl interpreter is "safe". The Tcl interpreter
696 will be created automatically if it has not been already.
697
698 <a id="tclMakeSafe"></a>TH1 tclMakeSafe Command
699 -------------------------------------------------
700
701 **This command requires the Tcl integration feature.**
702
703 * tclMakeSafe
@@ -692,51 +705,51 @@
705 Forces the Tcl interpreter into "safe" mode by removing all "unsafe"
706 commands and variables. This operation cannot be undone. The Tcl
707 interpreter will remain "safe" until the process terminates. The Tcl
708 interpreter will be created automatically if it has not been already.
709
710 <a id="tclReady"></a>TH1 tclReady Command
711 -------------------------------------------
712
713 * tclReady
714
715 Returns true if the binary has the Tcl integration feature enabled and it
716 is currently available for use by TH1 scripts.
717
718 <a id="trace"></a>TH1 trace Command
719 -------------------------------------
720
721 * trace STRING
722
723 Generates a TH1 trace message if TH1 tracing is enabled.
724
725 <a id="unversioned_content"></a>TH1 unversioned content Command
726 -----------------------------------------------------------------
727
728 * unversioned content FILENAME
729
730 Attempts to locate the specified unversioned file and return its contents.
731 An error is generated if the repository is not open or the unversioned file
732 cannot be found.
733
734 <a id="unversioned_list"></a>TH1 unversioned list Command
735 -----------------------------------------------------------
736
737 * unversioned list
738
739 Returns a list of the names of all unversioned files held in the local
740 repository. An error is generated if the repository is not open.
741
742 <a id="utime"></a>TH1 utime Command
743 -------------------------------------
744
745 * utime
746
747 Returns the number of microseconds of CPU time consumed by the current
748 process in user space.
749
750 <a id="verifyCsrf"></a>TH1 verifyCsrf Command
751 -----------------------------------------------
752
753 * verifyCsrf
754
755 Before using the results of a form, first call this command to verify
@@ -743,19 +756,19 @@
756 that this Anti-CSRF token is present and is valid. If the Anti-CSRF token
757 is missing or is incorrect, that indicates a cross-site scripting attack.
758 If the event of an attack is detected, an error message is generated and
759 all further processing is aborted.
760
761 <a id="verifyLogin"></a>TH1 verifyLogin Command
762 -------------------------------------------------
763
764 * verifyLogin
765
766 Returns non-zero if the specified user name and password represent a
767 valid login for the repository.
768
769 <a id="wiki"></a>TH1 wiki Command
770 -----------------------------------
771
772 * wiki STRING
773
774 Renders STRING as wiki content.
@@ -769,24 +782,24 @@
782 Tcl commands:
783
784 * th1Eval
785 * th1Expr
786
787 <a id="th1Eval"></a>Tcl th1Eval Command
788 -----------------------------------------
789
790 **This command requires the Tcl integration feature.**
791
792 * th1Eval arg
793
794 Evaluates the TH1 script and returns its result verbatim. If a TH1 script
795 error is generated, it will be transformed into a Tcl script error.
796
797 <a id="th1Expr"></a>Tcl th1Expr Command
798 -----------------------------------------
799
800 **This command requires the Tcl integration feature.**
801
802 * th1Expr arg
803
804 Evaluates the TH1 expression and returns its result verbatim. If a TH1
805 script error is generated, it will be transformed into a Tcl script error.
806

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button