~rbn/tlog

3f4808ae2a8b151e88312620f086aa3c2fcebacb — Ruben Schuller 9 months ago ed85dd3
add documentation
3 files changed, 418 insertions(+), 4 deletions(-)

A doc.sh
A doc/tlog.html
M tlog.tcl
A doc.sh => doc.sh +9 -0
@@ 0,0 1,9 @@
#!/bin/sh

mkdir -p doc

tclsh << EOF
source tlog.tcl
package require ruff
::ruff::document ::tlog -includeprivate true -output doc/tlog.html
EOF

A doc/tlog.html => doc/tlog.html +374 -0
@@ 0,0 1,374 @@
<!DOCTYPE html><html><head><meta charset="utf-8"/>
<title></title>
<style>
/*
Copyright (c) 2009, Yahoo! Inc. All rights reserved.
Code licensed under the BSD License:
http://developer.yahoo.net/yui/license.txt
version: 2.7.0
*/
html{color:#000;background:#FFF;}body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,code,form,fieldset,legend,input,button,textarea,p,blockquote,th,td{margin:0;padding:0;}table{border-collapse:collapse;border-spacing:0;}fieldset,img{border:0;}address,caption,cite,code,dfn,em,strong,th,var,optgroup{font-style:inherit;font-weight:inherit;}del,ins{text-decoration:none;}li{list-style:none;}caption,th{text-align:left;}h1,h2,h3,h4,h5,h6{font-size:100%;font-weight:normal;}q:before,q:after{content:'';}abbr,acronym{border:0;font-variant:normal;}sup{vertical-align:baseline;}sub{vertical-align:baseline;}legend{color:#000;}input,button,textarea,select,optgroup,option{font-family:inherit;font-size:inherit;font-style:inherit;font-weight:inherit;}input,button,textarea,select{*font-size:100%;}body{font:13px/1.231 arial,helvetica,clean,sans-serif;*font-size:small;*font:x-small;}select,input,button,textarea,button{font:99% arial,helvetica,clean,sans-serif;}table{font-size:inherit;font:100%;}pre,code,kbd,samp,tt{font-family:monospace;*font-size:108%;line-height:100%;}body{text-align:center;}#doc,#doc2,#doc3,#doc4,.yui-t1,.yui-t2,.yui-t3,.yui-t4,.yui-t5,.yui-t6,.yui-t7{margin:auto;text-align:left;width:57.69em;*width:56.25em;}#doc2{width:73.076em;*width:71.25em;}#doc3{margin:auto 10px;width:auto;}#doc4{width:74.923em;*width:73.05em;}.yui-b{position:relative;}.yui-b{_position:static;}#yui-main .yui-b{position:static;}#yui-main,.yui-g .yui-u .yui-g{width:100%;}.yui-t1 #yui-main,.yui-t2 #yui-main,.yui-t3 #yui-main{float:right;margin-left:-25em;}.yui-t4 #yui-main,.yui-t5 #yui-main,.yui-t6 #yui-main{float:left;margin-right:-25em;}.yui-t1 .yui-b{float:left;width:12.30769em;*width:12.00em;}.yui-t1 #yui-main .yui-b{margin-left:13.30769em;*margin-left:13.05em;}.yui-t2 .yui-b{float:left;width:13.8461em;*width:13.50em;}.yui-t2 #yui-main .yui-b{margin-left:14.8461em;*margin-left:14.55em;}.yui-t3 .yui-b{float:left;width:23.0769em;*width:22.50em;}.yui-t3 #yui-main .yui-b{margin-left:24.0769em;*margin-left:23.62em;}.yui-t4 .yui-b{float:right;width:13.8456em;*width:13.50em;}.yui-t4 #yui-main .yui-b{margin-right:14.8456em;*margin-right:14.55em;}.yui-t5 .yui-b{float:right;width:18.4615em;*width:18.00em;}.yui-t5 #yui-main .yui-b{margin-right:19.4615em;*margin-right:19.125em;}.yui-t6 .yui-b{float:right;width:23.0769em;*width:22.50em;}.yui-t6 #yui-main .yui-b{margin-right:24.0769em;*margin-right:23.62em;}.yui-t7 #yui-main .yui-b{display:block;margin:0 0 1em 0;}#yui-main .yui-b{float:none;width:auto;}.yui-gb .yui-u,.yui-g .yui-gb .yui-u,.yui-gb .yui-g,.yui-gb .yui-gb,.yui-gb .yui-gc,.yui-gb .yui-gd,.yui-gb .yui-ge,.yui-gb .yui-gf,.yui-gc .yui-u,.yui-gc .yui-g,.yui-gd .yui-u{float:left;}.yui-g .yui-u,.yui-g .yui-g,.yui-g .yui-gb,.yui-g .yui-gc,.yui-g .yui-gd,.yui-g .yui-ge,.yui-g .yui-gf,.yui-gc .yui-u,.yui-gd .yui-g,.yui-g .yui-gc .yui-u,.yui-ge .yui-u,.yui-ge .yui-g,.yui-gf .yui-g,.yui-gf .yui-u{float:right;}.yui-g div.first,.yui-gb div.first,.yui-gc div.first,.yui-gd div.first,.yui-ge div.first,.yui-gf div.first,.yui-g .yui-gc div.first,.yui-g .yui-ge div.first,.yui-gc div.first div.first{float:left;}.yui-g .yui-u,.yui-g .yui-g,.yui-g .yui-gb,.yui-g .yui-gc,.yui-g .yui-gd,.yui-g .yui-ge,.yui-g .yui-gf{width:49.1%;}.yui-gb .yui-u,.yui-g .yui-gb .yui-u,.yui-gb .yui-g,.yui-gb .yui-gb,.yui-gb .yui-gc,.yui-gb .yui-gd,.yui-gb .yui-ge,.yui-gb .yui-gf,.yui-gc .yui-u,.yui-gc .yui-g,.yui-gd .yui-u{width:32%;margin-left:1.99%;}.yui-gb .yui-u{*margin-left:1.9%;*width:31.9%;}.yui-gc div.first,.yui-gd .yui-u{width:66%;}.yui-gd div.first{width:32%;}.yui-ge div.first,.yui-gf .yui-u{width:74.2%;}.yui-ge .yui-u,.yui-gf div.first{width:24%;}.yui-g .yui-gb div.first,.yui-gb div.first,.yui-gc div.first,.yui-gd div.first{margin-left:0;}.yui-g .yui-g .yui-u,.yui-gb .yui-g .yui-u,.yui-gc .yui-g .yui-u,.yui-gd .yui-g .yui-u,.yui-ge .yui-g .yui-u,.yui-gf .yui-g .yui-u{width:49%;*width:48.1%;*margin-left:0;}.yui-g .yui-g .yui-u{width:48.1%;}.yui-g .yui-gb div.first,.yui-gb .yui-gb div.first{*margin-right:0;*width:32%;_width:31.7%;}.yui-g .yui-gc div.first,.yui-gd .yui-g{width:66%;}.yui-gb .yui-g div.first{*margin-right:4%;_margin-right:1.3%;}.yui-gb .yui-gc div.first,.yui-gb .yui-gd div.first{*margin-right:0;}.yui-gb .yui-gb .yui-u,.yui-gb .yui-gc .yui-u{*margin-left:1.8%;_margin-left:4%;}.yui-g .yui-gb .yui-u{_margin-left:1.0%;}.yui-gb .yui-gd .yui-u{*width:66%;_width:61.2%;}.yui-gb .yui-gd div.first{*width:31%;_width:29.5%;}.yui-g .yui-gc .yui-u,.yui-gb .yui-gc .yui-u{width:32%;_float:right;margin-right:0;_margin-left:0;}.yui-gb .yui-gc div.first{width:66%;*float:left;*margin-left:0;}.yui-gb .yui-ge .yui-u,.yui-gb .yui-gf .yui-u{margin:0;}.yui-gb .yui-gb .yui-u{_margin-left:.7%;}.yui-gb .yui-g div.first,.yui-gb .yui-gb div.first{*margin-left:0;}.yui-gc .yui-g .yui-u,.yui-gd .yui-g .yui-u{*width:48.1%;*margin-left:0;}.yui-gb .yui-gd div.first{width:32%;}.yui-g .yui-gd div.first{_width:29.9%;}.yui-ge .yui-g{width:24%;}.yui-gf .yui-g{width:74.2%;}.yui-gb .yui-ge div.yui-u,.yui-gb .yui-gf div.yui-u{float:right;}.yui-gb .yui-ge div.first,.yui-gb .yui-gf div.first{float:left;}.yui-gb .yui-ge .yui-u,.yui-gb .yui-gf div.first{*width:24%;_width:20%;}.yui-gb .yui-ge div.first,.yui-gb .yui-gf .yui-u{*width:73.5%;_width:65.5%;}.yui-ge div.first .yui-gd .yui-u{width:65%;}.yui-ge div.first .yui-gd div.first{width:32%;}#hd:after,#bd:after,#ft:after,.yui-g:after,.yui-gb:after,.yui-gc:after,.yui-gd:after,.yui-ge:after,.yui-gf:after{content:".";display:block;height:0;clear:both;visibility:hidden;}#hd,#bd,#ft,.yui-g,.yui-gb,.yui-gc,.yui-gd,.yui-ge,.yui-gf{zoom:1;}

body{margin:10px;}h1{font-size:138.5%;}h2{font-size:123.1%;}h3{font-size:108%;}h1,h2,h3{margin:1em 0;}h1,h2,h3,h4,h5,h6,strong,dt{font-weight:bold;}optgroup{font-weight:normal;}abbr,acronym{border-bottom:1px dotted #000;cursor:help;}em{font-style:italic;}del{text-decoration:line-through;}blockquote,ul,ol,dl{margin:1em;}ol,ul,dl{margin-left:2em;}ol li{list-style:decimal outside;}ul li{list-style:disc outside;}dl dd{margin-left:1em;}th,td{border:1px solid #000;padding:.5em;}th{font-weight:bold;text-align:center;}caption{margin-bottom:.5em;text-align:center;}sup{vertical-align:super;}sub{vertical-align:sub;}p,fieldset,table,pre{margin-bottom:1em;}button,input[type="checkbox"],input[type="radio"],input[type="reset"],input[type="submit"]{padding:1px;}


/* Ruff default CSS */

body {
  max-width: 70em;
  margin: 0;
}

h1,h2 {
  color: #888888;
  margin-bottom: 0.5em;
  margin-top: 0em;
}

#ft {
  text-align: left;
  border-top: 1px solid #006666;
  color: #888888;
  margin-top: 10px;
}

.banner h2 {
  color: #006666;
}

#hd.banner {
 font-family: "Times New Roman", serif;
 font-size: 200%;
 line-height: 64px;
 border-bottom: thin solid #006666;
 color: #006666;
}

p.linkline {
    text-align: right;
    font-size: smaller;
    /*    margin-top: -1em; */
    margin-bottom: 0;
}

.tinylink {
    font-size: x-small;
    font-variant: normal;
    font-family: Arial, sans-serif;
    float: right;
    padding:2px;
}

h1 .tinylink a {
    color: white;
}

#bd {
font-family: Arial, sans-serif;
font-size: 108%;
}

div.navbox {
  /* margin-top: 1em; */
    background-color: #006666;
    color: white;
    padding: 3px 4px 2px 4px;
    font-family: Arial, sans-serif;
    overflow: hidden;
}

div.navbox:hover {
    overflow: visible;
}

/* Note .navbox header css should be based on $header_levels */
.navbox h1, .navbox h2, .navbox h3, .navbox h4, .navbox h5 {
  font-size: 85%;
  margin: 0px;
  font-weight: normal;
}
.navbox h1 {
    font-weight: bold; /* Override */
}
.navbox h2 {
  padding-left: 1em;
}
.navbox h3 {
  padding-left: 2em;
}
.navbox h4 {
  padding-left: 2.5em;
  font-weight: normal;
}
.navbox h5 {
  padding-left: 3em;
  font-weight: normal;
}
.navbox hr {
  color: white;
  margin-top:0.1em;
  margin-bottom:0.1em;
}

.navbox a:link, .navbox a:visited, .navbox a:hover {
  text-decoration: none;
  color: white;
  background-color: #006666;
}

.navbox a:hover {
   font-weight: bold;
}

/* Tooltip text - see https://www.w3schools.com/css/css_tooltip.asp */
.tooltip {
    position: relative;
    /* display: inline-block; */
}

.tooltip .tooltiptext {
    width: 100%;
    font-weight: bold;
    background-color: white;
    color: #006666;
    text-align: left;
    border: 1px solid #006666;
    /* border-radius: 4px; */
    position: absolute;
    z-index: 1;
    margin-left: 4px;
    padding: 2px 3px;
    visibility: hidden;
}

/* Show the tooltip text when you mouse over the tooltip container */
.tooltip:hover .tooltiptext {
    visibility: visible;
}

span.ns_scope {
    color: #aaaaaa;
}

span.ns_scope a:link, span.ns_scope a:visited {
  text-decoration: none;
  color: #aaaaaa;

}

li {
  margin-top: 0.5em;
}

span.ns_scope a:hover {
  text-decoration: none;
  color: #666666;
}

table {
  margin: 1em;
  margin-top: 0.5em;
  border: thin solid;
  border-collapse: collapse;
  border-color: #808080;
  padding: 4px;
}

td {
  border: thin solid;
  border-color: #808080;
  vertical-align: top;
  font-size: 93%;
  padding: 0.3em;
  padding-top: 0.1em;
}
th {
  border: thin solid;
  border-color: #808080;
  padding: 0.3em;
  padding-top: 0.1em;
  background-color: #CCCCCC;
}

dt, dd {
   font-size: 93%;
}

h1.ruff {
    background-color: #006666;
    color: #ffffff;
    padding-left: 0.2em;
    font-family: "Times New Roman", serif;
}
h2.ruff {
    font-variant: small-caps;
    color: #006666;
    font-family: "Times New Roman", serif;
}

h3.ruff, h4.ruff, h5.ruff, h6.ruff {
    color: #006666;
}
h5.ruff {
    font-style: italic;
    font-weight: normal;
}
h6.ruff {
    font-weight: normal;
}
h3.ruffclass, h3.ruffproc, h3.ruffmethod,
h4.ruffclass, h4.ruffproc, h4.ruffmethod,
h5.ruffclass, h5.ruffproc, h5.ruffmethod {
    border-bottom: thin solid #006666;
    color: #006666;
    margin-bottom: 0.2em;
}

pre {
    background-color: #eeeeee;
    margin-top: 1em;
    margin-left: 1em;
    padding: 5px;
    font-family: Consolas, "Courier New", monospace;
    width: max-content;
    font-size: smaller;
    line-height: 1.2em;
}

.ruff_dyn_src {
    display: none; /* Displayed via JS */
}

.ruff_synopsis {
    border: thin solid #cccccc;
    background: #eeeeee;
    font-size: smaller;
    font-family: Consolas, "Courier New", monospace;
    padding: 5px;
    margin: 0em 2em 1em;
}
.ruff_const, .ruff_cmd, ruff_defitem {
    font-weight: bold;
    font-family: Consolas, "Courier New", monospace;
}
.ruff_arg {
    font-style: italic;
    font-family: Consolas, "Courier New", monospace;
}

.ruff_source_link {
    font-size: smaller;
}
</style>
<script>function toggleSource( id )
{
    /* Copied from Rails */
    var elem
    var link

    if( document.getElementById )
    {
        elem = document.getElementById( id )
        link = document.getElementById( "l_" + id )
    }
    else if ( document.all )
    {
        elem = eval( "document.all." + id )
        link = eval( "document.all.l_" + id )
    }
    else
        return false;

    if( elem.style.display == "block" )
    {
        elem.style.display = "none"
        link.innerHTML = "Show source"
    }
    else
    {
        elem.style.display = "block"
        link.innerHTML = "Hide source"
    }
}
</script></head>
<body><div id='doc3' class='yui-t2'><div id='bd'><div id='yui-main'><div class='yui-b'><h1 class='ruff'><a name='::tlog'></a>::tlog<span class='tinylink'><a href='#top'>Top</a></span></h1>
<div style='clear:both;'></div>
<h2 class='ruff'><a name='::tlog-Commands'></a>Commands<span class='tinylink'><a href='tlog.html#::tlog'>tlog</a>, <a href='#top'>Top</a></span></h2>
<div style='clear:both;'></div>
<h4 class='ruffproc'><a name='::tlog::content_files'>content_files</a><span class='ns_scope'> [<a href="tlog.html#::tlog" title="::tlog" class='ruff_cmd'>::tlog</a>]</span><span class='tinylink'><a href='tlog.html#::tlog'>tlog</a>, <a href='#top'>Top</a></span></h4>
<div style='clear:both;'></div>
<p class='ruff'>content_files collects all supported content files from a directory.</p>
<div class='ruff_synopsis'><span class='ruff_cmd'>content_files</span> <span class='ruff_arg'>dir converters</span></div>
<h5 class='ruff'>Parameters</h5><table class='ruff_deflist'>
<tr><td class='ruff_defitem'><code>dir</code></td><td class='ruff_defitem'>path to directory to search contents.</td></tr>
<tr><td class='ruff_defitem'><code>converters</code></td><td class='ruff_defitem'>dictionary with extension-converter mappings.</td></tr>
</table>
<h5 class='ruff'>Return value</h5><p class='ruff'>Returns list of paths to contents.</p>
<h4 class='ruffproc'><a name='::tlog::contents'>contents</a><span class='ns_scope'> [<a href="tlog.html#::tlog" title="::tlog" class='ruff_cmd'>::tlog</a>]</span><span class='tinylink'><a href='tlog.html#::tlog'>tlog</a>, <a href='#top'>Top</a></span></h4>
<div style='clear:both;'></div>
<p class='ruff'>contents processes content files.</p>
<div class='ruff_synopsis'><span class='ruff_cmd'>contents</span> <span class='ruff_arg'>files converters</span></div>
<h5 class='ruff'>Parameters</h5><table class='ruff_deflist'>
<tr><td class='ruff_defitem'><code>files</code></td><td class='ruff_defitem'>list of paths to content-files.</td></tr>
<tr><td class='ruff_defitem'><code>converters</code></td><td class='ruff_defitem'>dictionary with extension-converter mappings.</td></tr>
</table>
<h5 class='ruff'>Return value</h5><p class='ruff'>Returns dictionary with contents.</p>
<h4 class='ruffproc'><a name='::tlog::execute'>execute</a><span class='ns_scope'> [<a href="tlog.html#::tlog" title="::tlog" class='ruff_cmd'>::tlog</a>]</span><span class='tinylink'><a href='tlog.html#::tlog'>tlog</a>, <a href='#top'>Top</a></span></h4>
<div style='clear:both;'></div>
<p class='ruff'>execute template with a given context.</p>
<div class='ruff_synopsis'><span class='ruff_cmd'>execute</span> <span class='ruff_arg'>template ?contextvar?</span></div>
<h5 class='ruff'>Parameters</h5><table class='ruff_deflist'>
<tr><td class='ruff_defitem'><code>template</code></td><td class='ruff_defitem'>Not documented.</td></tr>
<tr><td class='ruff_defitem'><code>contextvar</code></td><td class='ruff_defitem'>variable name of context variable. it is used with upvar, so its a plain name. Optional, default <code>context</code>.</td></tr>
</table>
<h5 class='ruff'>Return value</h5><p class='ruff'>Returns the template with contents inserted.</p>
<h4 class='ruffproc'><a name='::tlog::extensions'>extensions</a><span class='ns_scope'> [<a href="tlog.html#::tlog" title="::tlog" class='ruff_cmd'>::tlog</a>]</span><span class='tinylink'><a href='tlog.html#::tlog'>tlog</a>, <a href='#top'>Top</a></span></h4>
<div style='clear:both;'></div>
<p class='ruff'>extensions returns the file-extensions supported by converters.</p>
<div class='ruff_synopsis'><span class='ruff_cmd'>extensions</span> <span class='ruff_arg'>converters</span></div>
<h5 class='ruff'>Parameters</h5><table class='ruff_deflist'>
<tr><td class='ruff_defitem'><code>converters</code></td><td class='ruff_defitem'>dictionary with extension-converter mappings.</td></tr>
</table>
<h5 class='ruff'>Return value</h5><p class='ruff'>Returns list of supported extensions.</p>
<h4 class='ruffproc'><a name='::tlog::insert'>insert</a><span class='ns_scope'> [<a href="tlog.html#::tlog" title="::tlog" class='ruff_cmd'>::tlog</a>]</span><span class='tinylink'><a href='tlog.html#::tlog'>tlog</a>, <a href='#top'>Top</a></span></h4>
<div style='clear:both;'></div>
<p class='ruff'>insert helper function for usage in templates.</p>
<div class='ruff_synopsis'><span class='ruff_cmd'>insert</span> <span class='ruff_arg'>name</span></div>
<h5 class='ruff'>Parameters</h5><table class='ruff_deflist'>
<tr><td class='ruff_defitem'><code>name</code></td><td class='ruff_defitem'>name of the content to insert (without $)</td></tr>
</table>
<h5 class='ruff'>Return value</h5><p class='ruff'>Returns the contents.</p>
<h4 class='ruffproc'><a name='::tlog::markdown'>markdown</a><span class='ns_scope'> [<a href="tlog.html#::tlog" title="::tlog" class='ruff_cmd'>::tlog</a>]</span><span class='tinylink'><a href='tlog.html#::tlog'>tlog</a>, <a href='#top'>Top</a></span></h4>
<div style='clear:both;'></div>
<p class='ruff'>markdown formats markdown input.</p>
<div class='ruff_synopsis'><span class='ruff_cmd'>markdown</span> <span class='ruff_arg'>in</span></div>
<h5 class='ruff'>Parameters</h5><table class='ruff_deflist'>
<tr><td class='ruff_defitem'><code>in</code></td><td class='ruff_defitem'>markdown input string.</td></tr>
</table>
<h5 class='ruff'>Return value</h5><p class='ruff'>Returns contents formatted as HTML.</p>
<h4 class='ruffproc'><a name='::tlog::tcl'>tcl</a><span class='ns_scope'> [<a href="tlog.html#::tlog" title="::tlog" class='ruff_cmd'>::tlog</a>]</span><span class='tinylink'><a href='tlog.html#::tlog'>tlog</a>, <a href='#top'>Top</a></span></h4>
<div style='clear:both;'></div>
<p class='ruff'>tcl runs the contents as script in the context of the template.</p>
<div class='ruff_synopsis'><span class='ruff_cmd'>tcl</span> <span class='ruff_arg'>in</span></div>
<h5 class='ruff'>Parameters</h5><table class='ruff_deflist'>
<tr><td class='ruff_defitem'><code>in</code></td><td class='ruff_defitem'>TCL script string.</td></tr>
</table>
<h5 class='ruff'>Return value</h5><p class='ruff'>Returns evaluated TCL script.</p>
<h4 class='ruffproc'><a name='::tlog::verbatim'>verbatim</a><span class='ns_scope'> [<a href="tlog.html#::tlog" title="::tlog" class='ruff_cmd'>::tlog</a>]</span><span class='tinylink'><a href='tlog.html#::tlog'>tlog</a>, <a href='#top'>Top</a></span></h4>
<div style='clear:both;'></div>
<p class='ruff'>verbatim just returns the input</p>
<div class='ruff_synopsis'><span class='ruff_cmd'>verbatim</span> <span class='ruff_arg'>in</span></div>
<h5 class='ruff'>Parameters</h5><table class='ruff_deflist'>
<tr><td class='ruff_defitem'><code>in</code></td><td class='ruff_defitem'>input string.</td></tr>
</table>
<h5 class='ruff'>Return value</h5><p class='ruff'>Returns contents of in.</p>
</div></div><div class='yui-b navbox' ><h1><a href='#::tlog'>tlog</a></h1><h2><a href='#::tlog-Commands'>Commands</a></h2><h4 class='tooltip'><a href='tlog.html#::tlog::content_files'>content_files</a><span class='tooltiptext'>content_files collects all supported content files from a directory.
</span></h4><h4 class='tooltip'><a href='tlog.html#::tlog::contents'>contents</a><span class='tooltiptext'>contents processes content files.
</span></h4><h4 class='tooltip'><a href='tlog.html#::tlog::execute'>execute</a><span class='tooltiptext'>execute template with a given context.
</span></h4><h4 class='tooltip'><a href='tlog.html#::tlog::extensions'>extensions</a><span class='tooltiptext'>extensions returns the file-extensions supported by converters.
</span></h4><h4 class='tooltip'><a href='tlog.html#::tlog::insert'>insert</a><span class='tooltiptext'>insert helper function for usage in templates.
</span></h4><h4 class='tooltip'><a href='tlog.html#::tlog::markdown'>markdown</a><span class='tooltiptext'>markdown formats markdown input.
</span></h4><h4 class='tooltip'><a href='tlog.html#::tlog::tcl'>tcl</a><span class='tooltiptext'>tcl runs the contents as script in the context of the template.
</span></h4><h4 class='tooltip'><a href='tlog.html#::tlog::verbatim'>verbatim</a><span class='tooltiptext'>verbatim just returns the input
</span></h4></div></div><div id='ft'><div style='float: right;'>Document generated by <a href='https://ruff.magicsplat.com'>Ruff!</a></div></div>
</div></body></html>

M tlog.tcl => tlog.tcl +35 -4
@@ 4,29 4,47 @@ package require Markdown

namespace eval tlog {
	proc verbatim { in } {
		# verbatim just returns the input
		#  in - input string.
		# Returns contents of in.
		return $in
	}

	proc markdown { in } {
		# markdown formats markdown input.
		#  in - markdown input string.
		# Returns contents formatted as HTML.

		##nagelfar ignore Unknown command
		return [ ::Markdown::convert $in ]
	}

	proc tcl { in } {
		# tcl runs the contents as script in the context of the template.
		#  in - TCL script string.
		# Returns evaluated TCL script.
		upvar 1 context context
		return [ eval $in ]
	}

	proc extensions { converters } {
		# extensions returns the file-extensions supported by converters.
		#  converters - dictionary with extension-converter mappings.
		# Returns list of supported extensions.
		return [ dict keys $converters ]
	}

	proc page { template contents } {
		##nagelfar ignore Found constant
		return [ dict create template $template contents $contents ]
	}
#	proc page { template contents } {
#		##nagelfar ignore Found constant
#		return [ dict create template $template contents $contents ]
#	}

	proc content_files { dir converters } {
		# content_files collects all supported content files from a directory.
		#  dir - path to directory to search contents.
		#  converters - dictionary with extension-converter mappings.
		# Returns list of paths to contents.

		# find all files with registered processors
		set globs "*{[join [ extensions $converters ] , ]}"
		foreach name [ glob -directory $dir $globs ] {


@@ 36,6 54,11 @@ namespace eval tlog {
	}

	proc contents { files converters } {
		# contents processes content files.
		#  files - list of paths to content-files.
		#  converters - dictionary with extension-converter mappings.
		# Returns dictionary with contents.

		set context [ dict create ]
		foreach { path } $files {
			set f [ open $path r ]


@@ 52,11 75,19 @@ namespace eval tlog {
	}

	proc insert { name } {
		# insert helper function for usage in templates.
		#  name - name of the content to insert (without $)
		# Returns the contents.

		upvar 1 $name _name
		return $_name 
	}

	proc execute { template { contextvar context } } {
		# execute template with a given context.
		#  contextvar - variable name of context variable. it is used with upvar, so its a plain name.
		# Returns the template with contents inserted.

		upvar 1 $contextvar context
		dict with context {}
		return [ subst $template ]