├── .gitattributes
├── .github
└── workflows
│ ├── makefile.yml
│ ├── rl_json-osx.yml
│ ├── rl_json-win.yml
│ └── rl_json.yml
├── LICENSE
├── Makefile
├── README.md
├── apps
└── tpack
│ ├── mini.css
│ ├── tpack-sample.zip
│ ├── tpack.html
│ ├── tpack.md
│ ├── tpack.n
│ └── tpack.tcl
├── bin
├── README.md
├── dotcanvas.tcl
├── mkdoc-0.4.bin
├── mkdoc-0.6.bin
├── tmdoc-0.4.bin
├── tpack.n
└── tpack.tcl
├── lib
├── README.md
├── chesschart
│ ├── chesschart-example.png
│ ├── chesschart.html
│ ├── chesschart.md
│ ├── chesschart.tcl
│ ├── dgw.css
│ ├── doc
│ │ ├── intro-arrows.png
│ │ ├── intro-background.png
│ │ ├── intro-background2.png
│ │ ├── intro-background3.png
│ │ ├── intro-chessboard.png
│ │ ├── intro-coord.png
│ │ ├── intro-font.png
│ │ ├── intro-hello.png
│ │ ├── intro-shapes.png
│ │ ├── intro-spline.png
│ │ ├── intro.html
│ │ ├── intro.md
│ │ └── pandoc.css
│ └── pkgIndex.tcl
├── dgtools
│ ├── argvparse-0.2.tm
│ ├── argvparse.html
│ ├── autoPather.tcl
│ ├── dgtutils-0.1.tm
│ ├── dgtutils.html
│ ├── pkgIndex.tcl
│ ├── recover-0.1.tm
│ ├── recover.html
│ ├── repo-0.1.tm
│ ├── repo.html
│ ├── shistory-0.2.tm
│ └── shistory.html
├── dgw
│ ├── Makefile
│ ├── basegui.html
│ ├── basegui.md
│ ├── basegui.tcl
│ ├── combobox.html
│ ├── combobox.md
│ ├── combobox.tcl
│ ├── dgw.html
│ ├── dgw.md
│ ├── dgw.tcl
│ ├── dgwutils.html
│ ├── dgwutils.md
│ ├── dgwutils.tcl
│ ├── documentation.md
│ ├── drawcanvas.html
│ ├── drawcanvas.md
│ ├── drawcanvas.tcl
│ ├── header.md
│ ├── hyperhelp-docu.txt
│ ├── hyperhelp-markdown-sample.md
│ ├── hyperhelp-minimal.txt
│ ├── hyperhelp-notoc-sample.txt
│ ├── hyperhelp-onepage-sample.txt
│ ├── hyperhelp.html
│ ├── hyperhelp.md
│ ├── hyperhelp.png
│ ├── hyperhelp.tcl
│ ├── license.md
│ ├── pkgIndex.tcl
│ ├── sbuttonbar.html
│ ├── sbuttonbar.md
│ ├── sbuttonbar.tcl
│ ├── seditor.html
│ ├── seditor.ini
│ ├── seditor.md
│ ├── seditor.tcl
│ ├── sfilebrowser.html
│ ├── sfilebrowser.md
│ ├── sfilebrowser.tcl
│ ├── sfinddialog.html
│ ├── sfinddialog.md
│ ├── sfinddialog.tcl
│ ├── sqlview.html
│ ├── sqlview.md
│ ├── sqlview.tcl
│ ├── statusbar.html
│ ├── statusbar.md
│ ├── statusbar.tcl
│ ├── tablelist.html
│ ├── tablelist.md
│ ├── tablelist.tcl
│ ├── test.md
│ ├── tlistbox.html
│ ├── tlistbox.md
│ ├── tlistbox.tcl
│ ├── tvmixins.html
│ ├── tvmixins.md
│ ├── tvmixins.tcl
│ ├── txmixins.html
│ ├── txmixins.md
│ └── txmixins.tcl
├── kroki4tcl
│ ├── Makefile
│ ├── README.html
│ ├── README.md
│ ├── examples
│ │ ├── gui.ditaa
│ │ ├── sample-markdown-gui.png
│ │ ├── sample-sbob-gui.png
│ │ ├── sample-sbob.png
│ │ ├── sample-sbob.sbob
│ │ └── sample-sbob.svg
│ ├── kroki4tcl.md
│ ├── kroki4tcl.tcl
│ ├── mini.css
│ └── pkgIndex.tcl
├── mkdoc
│ ├── mkdoc.html
│ ├── mkdoc.md
│ ├── mkdoc.tcl
│ └── pkgIndex.tcl
├── shtmlview
│ ├── LICENSE
│ ├── README.md
│ ├── pkgIndex.tcl
│ ├── shtmlview-doctools.man
│ ├── shtmlview-doctools.tcl
│ ├── shtmlview-man.tcl
│ ├── shtmlview-mkdoc.man
│ ├── shtmlview-mkdoc.tcl
│ ├── shtmlview.html
│ ├── shtmlview.man
│ └── shtmlview.tcl
├── tdot
│ ├── mini.css
│ ├── pkgIndex.tcl
│ ├── tdot.html
│ └── tdot.tcl
└── tmdoc
│ ├── dgw.css
│ ├── latex
│ ├── tmdoc-template.Tnw
│ ├── tmdoc-template.pdf
│ └── tmdoc.sty
│ ├── pkgIndex.tcl
│ ├── tmdoc.html
│ ├── tmdoc.md
│ ├── tmdoc.tcl
│ └── tutorial
│ ├── canvas.png
│ ├── out.png
│ ├── out2.png
│ ├── tmd.html
│ ├── tmdoc-example-chunk-13.png
│ ├── tmdoc-example-chunk-17.png
│ ├── tmdoc-example-myfig.png
│ ├── tmdoc-example-rect.png
│ ├── tmdoc-example-ukaz1.png
│ └── tmdoc-example-ukaz2.png
├── log
├── README.md
└── test.txt
├── pandoc-tcl-filter
├── LICENSE
├── Makefile
├── Readme.html
├── Readme.md
├── chessboard.svg
├── doc
│ └── Groth-S-and-T-2021.pdf
├── examples
│ ├── Makefile
│ ├── example-dot.html
│ ├── example-dot.md
│ ├── example-mtex.html
│ ├── example-mtex.md
│ ├── example-pic.html
│ ├── example-pic.md
│ ├── example-pik.html
│ ├── example-pik.md
│ ├── example-rplot.html
│ ├── example-rplot.md
│ ├── example-tcl.html
│ ├── example-tcl.md
│ ├── example-tdot.md
│ ├── example-tsvg.html
│ ├── example-tsvg.md
│ ├── ghpandoc.css
│ ├── header.html
│ └── header.md
├── figsample.svg
├── filter-view.html
├── filter
│ ├── Makefile
│ ├── filter-abc.html
│ ├── filter-abc.tcl
│ ├── filter-cmd.html
│ ├── filter-cmd.tcl
│ ├── filter-dot.html
│ ├── filter-dot.tcl
│ ├── filter-eqn.html
│ ├── filter-eqn.tcl
│ ├── filter-kroki.html
│ ├── filter-kroki.tcl
│ ├── filter-mmd.html
│ ├── filter-mmd.tcl
│ ├── filter-mtex.html
│ ├── filter-mtex.tcl
│ ├── filter-pic.html
│ ├── filter-pic.tcl
│ ├── filter-pik.html
│ ├── filter-pik.tcl
│ ├── filter-pipe.html
│ ├── filter-pipe.tcl
│ ├── filter-puml.html
│ ├── filter-puml.tcl
│ ├── filter-rplot.html
│ ├── filter-rplot.tcl
│ ├── filter-sqlite.html
│ ├── filter-sqlite.tcl
│ ├── filter-tcl.html
│ ├── filter-tcl.tcl
│ ├── filter-tcrd.html
│ ├── filter-tcrd.tcl
│ ├── filter-tdot.html
│ ├── filter-tdot.tcl
│ ├── filter-tsvg.html
│ ├── filter-tsvg.tcl
│ ├── header.md
│ ├── mini.css
│ ├── pkgIndex.tcl
│ ├── smallcaps.lua
│ ├── tclfilters.tcl
│ ├── tikz-tree.tex
│ ├── utils.tcl
│ └── xkcd.tex
├── hello-world.svg
├── json-pretty.tcl
├── lib
│ ├── cmdline
│ │ ├── cmdline.tcl
│ │ └── pkgIndex.tcl
│ ├── dgw
│ │ ├── basegui.tcl
│ │ ├── pkgIndex.tcl
│ │ ├── statusbar.tcl
│ │ └── txmixins.tcl
│ ├── fview
│ │ ├── filter-view.tcl
│ │ └── pkgIndex.tcl
│ ├── markdown
│ │ ├── markdown.tcl
│ │ └── pkgIndex.tcl
│ ├── mkdoc
│ │ ├── mkdoc.tcl
│ │ └── pkgIndex.tcl
│ ├── rl_json
│ │ ├── json.html
│ │ ├── json.n
│ │ ├── librl_json0.11.0.dll
│ │ ├── librl_json0.11.0.so
│ │ ├── librl_json0.11.1.dylib
│ │ ├── mini.css
│ │ └── pkgIndex.tcl
│ ├── snit
│ │ ├── main2.tcl
│ │ ├── pkgIndex.tcl
│ │ ├── snit2.tcl
│ │ └── validate.tcl
│ ├── tdot
│ │ ├── pkgIndex.tcl
│ │ ├── tdot.html
│ │ └── tdot.tcl
│ ├── textutil
│ │ ├── adjust.tcl
│ │ ├── dehypht.tex
│ │ ├── eshyph_vo.tex
│ │ ├── expander.tcl
│ │ ├── ithyph.tex
│ │ ├── pkgIndex.tcl
│ │ ├── repeat.tcl
│ │ ├── split.tcl
│ │ ├── string.tcl
│ │ ├── tabify.tcl
│ │ ├── textutil.tcl
│ │ └── trim.tcl
│ ├── tsvg
│ │ ├── pkgIndex.tcl
│ │ ├── tsvg.html
│ │ ├── tsvg.md
│ │ └── tsvg.tcl
│ └── yaml
│ │ ├── huddle.tcl
│ │ ├── huddle_types.tcl
│ │ ├── json2huddle.tcl
│ │ ├── pkgIndex.tcl
│ │ └── yaml.tcl
├── mini.css
├── pandoc-tcl-filter.html
├── pandoc-tcl-filter.md
├── pandoc-tcl-filter.tcl
├── pkgIndex.tcl
├── tests
│ ├── asis.md
│ ├── inc.md
│ ├── table.html
│ └── table.md
└── tsvg-hello-world.svg
└── releases
└── README.md
/.gitattributes:
--------------------------------------------------------------------------------
1 | *.html linguist-detectable=false
2 |
--------------------------------------------------------------------------------
/.github/workflows/makefile.yml:
--------------------------------------------------------------------------------
1 | name: Makefile CI
2 |
3 | on:
4 | workflow_dispatch:
5 | branches: [ master ]
6 | #pull_request:
7 | # branches: [ master ]
8 |
9 | jobs:
10 | build:
11 |
12 | runs-on: ubuntu-latest
13 |
14 | steps:
15 | - uses: actions/checkout@v3
16 |
17 |
18 | #- name: Install dependencies
19 | # run: make
20 |
21 | - name: Run check
22 | run: make check
23 |
24 | - name: Run distcheck
25 | run: make build-test
26 |
27 | - name: Make tcl-filter.tapp
28 | run: |
29 | mkdir pandoc-filter
30 | cd pandoc-tcl-filter && make tcl-filter.tapp
31 | cd ..
32 | cp pandoc-tcl-filter/pandoc-tcl-filter.tapp pandoc-filter
33 | ls -lR pandoc-tcl-filter/* > pandoc-filter/listing.txt
34 | - name: Step 3 - Use the Upload Artifact GitHub Action
35 | uses: actions/upload-artifact@v3
36 | with:
37 | name: pandoc-tcl-filter
38 | path: pandoc-filter
39 |
40 |
--------------------------------------------------------------------------------
/.github/workflows/rl_json-osx.yml:
--------------------------------------------------------------------------------
1 | name: rl_json build macOS
2 |
3 | on:
4 | workflow_dispatch:
5 | branches: [ master ]
6 | #push:
7 | # branches: [ master ]
8 | #pull_request:
9 | # branches: [ master ]
10 |
11 | jobs:
12 | build:
13 |
14 | runs-on: macOS-10.15
15 |
16 | steps:
17 | - uses: actions/checkout@v2
18 | - name: rl_json
19 | run: |
20 | brew install tcl-tk
21 | git clone https://github.com/RubyLane/rl_json.git
22 | cd rl_json
23 | autoconf
24 | ./configure
25 | make
26 | mkdir rl_json
27 | cp librl* rl_json/
28 | cp pkgIndex.tcl rl_json/
29 | cp doc/json.* rl_json/
30 | - name: Upload Artifact GitHub Action
31 | uses: actions/upload-artifact@v2
32 | with:
33 | name: rl_json-package
34 | path: rl_json/rl_json
35 |
36 |
--------------------------------------------------------------------------------
/.github/workflows/rl_json-win.yml:
--------------------------------------------------------------------------------
1 | name: rl_json build Windows
2 |
3 | on:
4 | workflow_dispatch:
5 | branches: [ master ]
6 | #push:
7 | # branches: [ master ]
8 | #pull_request:
9 | # branches: [ master ]
10 |
11 | jobs:
12 | build:
13 |
14 | runs-on: windows-19
15 |
16 | steps:
17 | - uses: actions/checkout@v2
18 | - name: rl_json
19 | run: |
20 | choco install magicsplat-tcl-tk
21 | git clone https://github.com/RubyLane/rl_json.git
22 | cd rl_json
23 | autoconf
24 | ./configure
25 | make
26 | mkdir rl_json
27 | cp librl* rl_json/
28 | cp pkgIndex.tcl rl_json/
29 | cp doc/json.* rl_json/
30 | - name: Upload Artifact GitHub Action
31 | uses: actions/upload-artifact@v2
32 | with:
33 | name: rl_json-package
34 | path: rl_json/rl_json
35 |
36 |
--------------------------------------------------------------------------------
/.github/workflows/rl_json.yml:
--------------------------------------------------------------------------------
1 | name: rl_json build Ubuntu
2 |
3 | on:
4 | workflow_dispatch:
5 | branches: [ master ]
6 | #push:
7 | # branches: [ master ]
8 | #pull_request:
9 | # branches: [ master ]
10 |
11 | jobs:
12 | build:
13 |
14 | runs-on: ubuntu-18.04
15 |
16 | steps:
17 | - uses: actions/checkout@v2
18 | - name: rl_json
19 | run: |
20 | sudo apt-get install tcl-dev
21 | git clone https://github.com/RubyLane/rl_json.git
22 | cd rl_json
23 | autoconf
24 | ./configure
25 | make
26 | mkdir rl_json
27 | cp librl* rl_json/
28 | cp pkgIndex.tcl rl_json/
29 | cp doc/json.* rl_json/
30 | - name: Upload Artifact GitHub Action
31 | uses: actions/upload-artifact@v2
32 | with:
33 | name: rl_json-package
34 | path: rl_json/rl_json
35 |
36 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2017 mittelmark
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/Makefile:
--------------------------------------------------------------------------------
1 | LOGFILE=log/test.txt
2 | default:
3 | echo default
4 | check:
5 | echo Ok
6 | build:
7 | echo build
8 | build-test:
9 | echo "#!/bin/bash" > $(LOGFILE)
10 | ls >> $(LOGFILE)
11 | echo "Operating System" >> $(LOGFILE)
12 | echo "parray tcl_platform" | tclsh >> $(LOGFILE)
13 | #echo "Tcl Version" >> $(LOGFILE)
14 | #echo "set tcl_patchLevel" | tclsh >> $(LOGFILE)
15 | #echo "tpack version" >> $(LOGFILE)
16 | #tclsh bin/tpack.tcl --version >> $(LOGFILE)
17 | #echo "this-is-test-end " >> $(LOGFILE)
18 | pandoc-bin:
19 | if [ -d pandoc-tapp ]; then rm -rf pandoc-tapp ; fi
20 | mkdir pandoc-tapp
21 | cp pandoc-tcl-filter/pandoc-tcl-filter.tcl pandoc-tapp/
22 | if [ ! -d pandoc-tapp/pandoc-tcl-filter.vfs ] ; then mkdir pandoc-tapp/pandoc-tcl-filter.vfs ; fi
23 | echo "lappend auto_path [file normalize [file join [file dirname [info script]] lib]]" > pandoc-tapp/pandoc-tcl-filter.vfs/main.tcl
24 | cp -r pandoc-tcl-filter/lib pandoc-tapp/pandoc-tcl-filter.vfs/
25 | rm -rf pandoc-tapp/pandoc-tcl-filter.vfs/lib/tclfilters
26 | if [ ! -d pandoc-tapp/pandoc-tcl-filter.vfs/lib/tclfilters ] ; then mkdir pandoc-tapp/pandoc-tcl-filter.vfs/lib/tclfilters ; fi
27 | cp -r pandoc-tcl-filter/filter/*.tcl pandoc-tapp/pandoc-tcl-filter.vfs/lib/tclfilters/
28 | rm -f pandoc-tapp/pandoc-tcl-filter.vfs/lib/*/*~
29 | rm -f pandoc-tapp/pandoc-tcl-filter.vfs/lib/*/*.html
30 | rm -f pandoc-tapp/pandoc-tcl-filter.vfs/lib/*/*md
31 | rm -f pandoc-tapp/pandoc-tcl-filter.vfs/lib/*/*lua
32 | rm -f pandoc-tapp/pandoc-tcl-filter.vfs/lib/*/*.n
33 | rm -f pandoc-tapp/pandoc-tcl-filter.vfs/lib/*/*.dot
34 | cd pandoc-tapp && tclsh ../bin/tpack.tcl wrap pandoc-tcl-filter.tapp
35 | cp pandoc-tapp/pandoc-tcl-filter.tapp ../
36 | #rm -rf pandoc-tapp
37 |
--------------------------------------------------------------------------------
/apps/tpack/mini.css:
--------------------------------------------------------------------------------
1 | html {
2 | overflow-y: scroll;
3 | }
4 | body {
5 | color: #444;
6 | font-family: Georgia, Palatino, 'Palatino Linotype', Times, 'Times New Roman', serif;
7 | line-height: 1.2;
8 | padding: 1em;
9 | margin: auto;
10 | max-width: 800px;
11 | }
12 | a {
13 | color: #0645ad;
14 | text-decoration: none;
15 | }
16 | a:visited {
17 | color: #0b0080;
18 | }
19 | a:hover {
20 | color: #06e;
21 | }
22 | a:active {
23 | color: #faa700;
24 | }
25 | a:focus {
26 | outline: thin dotted;
27 | }
28 | p {
29 | margin: 0.5em 0;
30 | }
31 | p.date {
32 | text-align: center;
33 | }
34 | img {
35 | max-width: 100%;
36 | }
37 |
38 | h1, h2, h3, h4, h5, h6 {
39 | color: #111;
40 | line-height: 115%;
41 | margin-top: 1em;
42 | font-weight: normal;
43 | }
44 | h1 {
45 | text-align: center;
46 | font-size: 120%;
47 | }
48 | p.author, p.date {
49 | font-size: 110%;
50 | }
51 |
52 | h2 {
53 | text-transform: uppercase;
54 | }
55 | pre, blockquote pre {
56 | border-top: 0.1em #9ac solid;
57 | background: #e9f6ff;
58 | padding: 10px;
59 | border-bottom: 0.1em #9ac solid;
60 | }
61 |
62 | blockquote {
63 | margin: 0;
64 | padding-left: 3em;
65 | }
66 |
67 | hr {
68 | display: block;
69 | height: 2px;
70 | border: 0;
71 | border-top: 1px solid #aaa;
72 | border-bottom: 1px solid #eee;
73 | margin: 1em 0;
74 | padding: 0;
75 | }
76 |
77 | pre, code, kbd, samp {
78 | color: #000;
79 | font-family: Monaco, 'courier new', monospace;
80 | font-size: 90%;
81 | }
82 | code.r {
83 | color: #770000;
84 | }
85 | pre {
86 | white-space: pre;
87 | white-space: pre-wrap;
88 | word-wrap: break-word;
89 | }
90 | /* fix, do not like bold for every keyword */
91 | code span.kw { color: #007020; font-weight: normal; } /* Keyword */
92 | pre.sourceCode {
93 | background: #fff6f6;
94 | }
95 | figure, p.author {
96 | text-align: center;
97 | }
98 | table {
99 | border-collapse: collapse;
100 | border-bottom: 2px solid;
101 |
102 |
103 | }
104 | table thead tr th {
105 | background-color: #fde9d9;
106 | text-align: left;
107 | padding: 10px;
108 | border-top: 2px solid;
109 | border-bottom: 2px solid;
110 | }
111 | table td {
112 | background-color: #fff9e9;
113 |
114 | text-align: left;
115 | padding: 10px;
116 | }
117 |
--------------------------------------------------------------------------------
/apps/tpack/tpack-sample.zip:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mittelmark/DGTcl/22b7cfc904010871af024dd348f8cb2b7d30b662/apps/tpack/tpack-sample.zip
--------------------------------------------------------------------------------
/bin/README.md:
--------------------------------------------------------------------------------
1 | ## Tcl Applications
2 |
3 | This directory contains standalone executables where required libraries are
4 | added directly to the Tcl application using concatanation.
5 |
6 | To install them, just rename them removing the version number and then bin
7 | extension on Unix systems. Here an example in case that you have in your home
8 | directory a bin folder which is in your path:
9 |
10 | ```
11 | mv mkdoc-0.4.bin ~/bin/mkdoc
12 | chmod 755 ~/bin/mkdoc
13 | ```
14 |
--------------------------------------------------------------------------------
/bin/mkdoc-0.4.bin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mittelmark/DGTcl/22b7cfc904010871af024dd348f8cb2b7d30b662/bin/mkdoc-0.4.bin
--------------------------------------------------------------------------------
/bin/mkdoc-0.6.bin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mittelmark/DGTcl/22b7cfc904010871af024dd348f8cb2b7d30b662/bin/mkdoc-0.6.bin
--------------------------------------------------------------------------------
/lib/README.md:
--------------------------------------------------------------------------------
1 | # DGTcl - Project
2 |
3 | This repository contains the following Tcl packages and Pandoc filters written in the Tcl programming language:
4 |
5 | ## Pandoc filters
6 |
7 | The [Pandoc](https://pandoc.org) application is a great document converter and processing tool.
8 | The pandoc-tcl-filter folder contains two Pandoc filters for Tcl code and for Graphviz dot files. To know more about Pandoc filters have a look at Pandocs manual pages [https://pandoc.org/filters.html](https://pandoc.org/filters.html).
9 | These filter allow you to directly embed Tcl code and Dot file code into your documents and produce code output or figures using these code chunks.
10 |
11 | * [pandoc-tcl-filter Readme](http://htmlpreview.github.io/?https://github.com/mittelmark/DGTcl/blob/master/pandoc-tcl-filter/Readme.html)
12 | * [pandoc-tcl-filter Manual](http://htmlpreview.github.io/?https://github.com/mittelmark/DGTcl/blob/master/pandoc-tcl-filter/pandoc-tcl-filter.html)
13 | * [Gitdown-Download](https://downgit.github.io/#/home?url=https://github.com/mittelmark/DGTcl/tree/master/pandoc-tcl-filter).
14 |
15 | _Please note, that for the installation of this package you need as well the Tcl package [rl_json](https://github.com/RubyLane/rl_json) from Ruby Lane. I will try to make some binaries of this package available for Windows, Linux and OSX._
16 |
17 | For other filters have a look at the Pandoc topic list [https://github.com/topics/pandoc-filter](https://github.com/topics/pandoc-filter).
18 |
19 | ## Tk Widgets
20 |
21 | * [dgw](http://htmlpreview.github.io/?https://github.com/mittelmark/DGTcl/blob/master/lib/dgw/dgw.html) -
22 | collection of various snit widgets and snit widget adaptors,
23 | [Gitdown-Download](https://downgit.github.io/#/home?url=https://github.com/mittelmark/DGTcl/tree/master/lib/dgw).
24 | * [chesschart](http://htmlpreview.github.io/?https://github.com/mittelmark/DGTcl/blob/master/lib/chesschart/chesschart.html) -
25 | a pure Tcl/Tk widget to make flowcharts using the chess coordinate system.
26 | Here the link to the [chesschart tutorial](http://htmlpreview.github.io/?https://github.com/mittelmark/DGTcl/blob/master/lib/chesschart/doc/intro.html) and the
27 | [Gitdown-Download](https://downgit.github.io/#/home?url=https://github.com/mittelmark/DGTcl/tree/master/lib/chesschart).
28 | * [shtmlview::shtmlview](http://htmlpreview.github.io/?https://github.com/mittelmark/DGTcl/blob/master/lib/shtmlview/shtmlview.html) -
29 | a pure Tcl/Tk widget to render a reasonable subset of html, [Gitdown-Download](https://downgit.github.io/#/home?url=https://github.com/mittelmark/DGTcl/tree/master/lib/shtmlview).
30 |
31 | ## Tcl Libraries / Applications
32 |
33 | * tdot - the Thingy DOT writer. Create DOT files and images for DOT graphs with ease. Syntax is very close to the Graphviz DOT language.
34 | * [tdot manual](http://htmlpreview.github.io/?https://github.com/mittelmark/DGTcl/blob/master/lib/tdot/tdot.html)
35 | * [Gitdown-Download](https://downgit.github.io/#/home?url=https://github.com/mittelmark/DGTcl/tree/master/lib/tdot)
36 |
37 | * tpack - deployment system for Tcl 8.4+ using uncompressed tar file format.
38 | * [tpack manual](http://htmlpreview.github.io/?https://github.com/mittelmark/DGTcl/blob/master/apps/tpack/tpack.html)
39 | * [Gitdown-Download](https://downgit.github.io/#/home?url=https://github.com/mittelmark/DGTcl/tree/master/apps/tpack)
40 |
41 | * mkdoc - extract Markdown documentation from source code files and produce HTML files
42 | * [mkdoc manual](http://htmlpreview.github.io/?https://github.com/mittelmark/DGTcl/blob/master/lib/mkdoc/mkdoc.html) - Markdown based source code documentation
43 | * [Gitdown-Download](https://downgit.github.io/#/home?url=https://github.com/mittelmark/DGTcl/tree/master/lib/mkdoc)
44 |
45 | * tmdoc - embed and execute Tcl code in Markdown or LaTex documents
46 | * [tmdoc manual](http://htmlpreview.github.io/?https://github.com/mittelmark/DGTcl/blob/master/lib/tmdoc/tmdoc.html) - literate programming using Tcl for embedding Tcl code into Markdown and LaTeX documents.
47 | * [tmdoc Markdown based tutorial](http://htmlpreview.github.io/?https://github.com/mittelmark/DGTcl/blob/master/lib/tmdoc/tutorial/tmd.html) - Tutorial about on how to use the package.
48 | * [tmdoc LaTeX based tutorial](https://github.com/mittelmark/DGTcl/blob/master/lib/tmdoc/latex/tmdoc-template.pdf)
49 | * [Gitdown-Download](https://downgit.github.io/#/home?url=https://github.com/mittelmark/DGTcl/tree/master/lib/tmdoc)
50 |
51 | * tsvg - the Thingy SVG writer. Create SVG files with ease. Either using a Tclish or a SVGish syntax.
52 | * [tsvg manual](http://htmlpreview.github.io/?https://github.com/mittelmark/DGTcl/blob/master/pandoc-tcl-filter/lib/tsvg/tsvg.html)
53 | * [Gitdown-Download](https://downgit.github.io/#/home?url=https://github.com/mittelmark/DGTcl/tree/master/pandoc-tcl-filter/lib/tsvg)
54 |
55 |
56 |
57 | * dgtools - various small snit objects, some are required by the dgw package
58 | * [argvparse manual](http://htmlpreview.github.io/?https://github.com/mittelmark/DGTcl/blob/master/lib/dgtools/argvparse.html) - command line argument parser
59 | * [dgtutils manual](http://htmlpreview.github.io/?https://github.com/mittelmark/DGTcl/blob/master/lib/dgtools/dgtutils.html) - command line tools for the dgtools package
60 | * [recover manual](http://htmlpreview.github.io/?https://github.com/mittelmark/DGTcl/blob/master/lib/dgtools/recover.html) - debugging tool
61 | * [repo manual](http://htmlpreview.github.io/?https://github.com/mittelmark/DGTcl/blob/master/lib/dgtools/repo.html) - install Tcl package from github or chiselapp
62 | * [shistory manual](http://htmlpreview.github.io/?https://github.com/mittelmark/DGTcl/blob/master/lib/dgtools/shistory.html) - snit history type to manage lists with history
63 | * [Gitdown-Download](https://downgit.github.io/#/home?url=https://github.com/mittelmark/DGTcl/tree/master/lib/dgtools)
64 |
65 | ## Download
66 |
67 | Currently there is no version based individual download for the different packages.
68 | You can download the entire project using the github project-zip feature at this link:
69 |
70 | * [https://github.com/mittelmark/DGTcl/archive/master.zip](https://github.com/mittelmark/DGTcl/archive/master.zip)
71 |
72 | If the project size starts exceeding 1MB I will create individual packages.
73 |
--------------------------------------------------------------------------------
/lib/chesschart/chesschart-example.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mittelmark/DGTcl/22b7cfc904010871af024dd348f8cb2b7d30b662/lib/chesschart/chesschart-example.png
--------------------------------------------------------------------------------
/lib/chesschart/dgw.css:
--------------------------------------------------------------------------------
1 | body {
2 | margin-left: 5%; margin-right: 5%;
3 | font-family: Palatino, "Palatino Linotype", "Palatino LT STD", "Book Antiqua", Georgia, serif;
4 | }
5 | pre {
6 | padding-top: 1.4ex;
7 | padding-bottom: 1ex;
8 | padding-left: 2ex;
9 | padding-right: 1ex;
10 | color: black;
11 | background: #fbfbfb;
12 | border-top: 1px solid #6A6A6A;
13 | border-bottom: 1px solid #6A6A6A;
14 |
15 | font-family: Consolas, "Liberation Mono", Menlo, Courier, monospace;
16 | }
17 | pre.synopsis {
18 | background: #ddefff;
19 | }
20 |
21 | pre.tclcode {
22 | background: #ffefdf;
23 | }
24 |
25 |
26 | pre.tclout {
27 | background: #efffff;
28 | }
29 |
30 |
31 | pre.tclerr {
32 | background: #ffdfdf;
33 | }
34 |
35 | pre.std {
36 | background: #fbfbfb;
37 | }
38 |
39 | code {
40 | font-family: Consolas, "Liberation Mono", Menlo, Courier, monospace;
41 | }
42 | pre.r {
43 | background: #efffef;
44 | }
45 | div.sourceCode + pre {
46 | background: #eeffff;
47 | }
48 |
49 | h1 {
50 | font-family: sans-serif;
51 | font-size: 130%;
52 | background: transparent;
53 | text-align: center;
54 | }
55 | p.author, p.date {
56 | font-family: sans-serif;
57 | font-size: 110%;
58 | background: transparent;
59 | text-align: center;
60 | }
61 | h3 {
62 | font-family: sans-serif;
63 | font-size: 115%;
64 | background: transparent;
65 | text-align: center;
66 | }
67 | h2 {
68 | margin-top: 1em;
69 | font-family: sans-serif;
70 | font-size: 120%;
71 | color: #005A9C;
72 | text-align: left;
73 |
74 | }
75 |
--------------------------------------------------------------------------------
/lib/chesschart/doc/intro-arrows.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mittelmark/DGTcl/22b7cfc904010871af024dd348f8cb2b7d30b662/lib/chesschart/doc/intro-arrows.png
--------------------------------------------------------------------------------
/lib/chesschart/doc/intro-background.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mittelmark/DGTcl/22b7cfc904010871af024dd348f8cb2b7d30b662/lib/chesschart/doc/intro-background.png
--------------------------------------------------------------------------------
/lib/chesschart/doc/intro-background2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mittelmark/DGTcl/22b7cfc904010871af024dd348f8cb2b7d30b662/lib/chesschart/doc/intro-background2.png
--------------------------------------------------------------------------------
/lib/chesschart/doc/intro-background3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mittelmark/DGTcl/22b7cfc904010871af024dd348f8cb2b7d30b662/lib/chesschart/doc/intro-background3.png
--------------------------------------------------------------------------------
/lib/chesschart/doc/intro-chessboard.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mittelmark/DGTcl/22b7cfc904010871af024dd348f8cb2b7d30b662/lib/chesschart/doc/intro-chessboard.png
--------------------------------------------------------------------------------
/lib/chesschart/doc/intro-coord.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mittelmark/DGTcl/22b7cfc904010871af024dd348f8cb2b7d30b662/lib/chesschart/doc/intro-coord.png
--------------------------------------------------------------------------------
/lib/chesschart/doc/intro-font.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mittelmark/DGTcl/22b7cfc904010871af024dd348f8cb2b7d30b662/lib/chesschart/doc/intro-font.png
--------------------------------------------------------------------------------
/lib/chesschart/doc/intro-hello.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mittelmark/DGTcl/22b7cfc904010871af024dd348f8cb2b7d30b662/lib/chesschart/doc/intro-hello.png
--------------------------------------------------------------------------------
/lib/chesschart/doc/intro-shapes.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mittelmark/DGTcl/22b7cfc904010871af024dd348f8cb2b7d30b662/lib/chesschart/doc/intro-shapes.png
--------------------------------------------------------------------------------
/lib/chesschart/doc/intro-spline.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mittelmark/DGTcl/22b7cfc904010871af024dd348f8cb2b7d30b662/lib/chesschart/doc/intro-spline.png
--------------------------------------------------------------------------------
/lib/chesschart/doc/pandoc.css:
--------------------------------------------------------------------------------
1 | /*
2 | * I add this to html files generated with pandoc.
3 | */
4 |
5 | html {
6 | font-size: 100%;
7 | overflow-y: scroll;
8 | -webkit-text-size-adjust: 100%;
9 | -ms-text-size-adjust: 100%;
10 | }
11 |
12 | body {
13 | color: #444;
14 | font-family: Georgia, Palatino, 'Palatino Linotype', Times, 'Times New Roman', serif;
15 | font-size: 12px;
16 | line-height: 1.7;
17 | padding: 1em;
18 | margin: auto;
19 | max-width: 42em;
20 | background: #fefefe;
21 | }
22 | nav ul {
23 | list-style-type: none;
24 | }
25 | a {
26 | color: #0645ad;
27 | text-decoration: none;
28 | }
29 |
30 | a:visited {
31 | color: #0b0080;
32 | }
33 |
34 | a:hover {
35 | color: #06e;
36 | }
37 |
38 | a:active {
39 | color: #faa700;
40 | }
41 |
42 | a:focus {
43 | outline: thin dotted;
44 | }
45 |
46 | *::-moz-selection {
47 | background: rgba(255, 255, 0, 0.3);
48 | color: #000;
49 | }
50 |
51 | *::selection {
52 | background: rgba(255, 255, 0, 0.3);
53 | color: #000;
54 | }
55 |
56 | a::-moz-selection {
57 | background: rgba(255, 255, 0, 0.3);
58 | color: #0645ad;
59 | }
60 |
61 | a::selection {
62 | background: rgba(255, 255, 0, 0.3);
63 | color: #0645ad;
64 | }
65 |
66 | p {
67 | margin: 1em 0;
68 | }
69 |
70 | p.date {
71 | text-align: center;
72 | }
73 | img {
74 | max-width: 100%;
75 | }
76 |
77 | h1, h2, h3, h4, h5, h6 {
78 | color: #111;
79 | line-height: 125%;
80 | margin-top: 2em;
81 | font-weight: normal;
82 | }
83 |
84 | h4, h5, h6 {
85 | font-weight: bold;
86 | }
87 |
88 | h1 {
89 | text-align: center;
90 | font-size: 2.5em;
91 | }
92 |
93 | h2 {
94 | font-size: 2em;
95 | }
96 |
97 | h3 {
98 | font-size: 1.5em;
99 | }
100 |
101 | h4 {
102 | font-size: 1.2em;
103 | }
104 |
105 | h5 {
106 | font-size: 1em;
107 | }
108 |
109 | h6 {
110 | font-size: 0.9em;
111 | }
112 |
113 | blockquote {
114 | color: #666666;
115 | margin: 0;
116 | padding-left: 3em;
117 | border-left: 0.5em #EEE solid;
118 | }
119 |
120 | hr {
121 | display: block;
122 | height: 2px;
123 | border: 0;
124 | border-top: 1px solid #aaa;
125 | border-bottom: 1px solid #eee;
126 | margin: 1em 0;
127 | padding: 0;
128 | }
129 |
130 | pre, code, kbd, samp {
131 | color: #000;
132 | font-family: monospace, monospace;
133 | _font-family: 'courier new', monospace;
134 | font-size: 0.98em;
135 | }
136 |
137 | pre {
138 | white-space: pre;
139 | white-space: pre-wrap;
140 | word-wrap: break-word;
141 | }
142 |
143 | b, strong {
144 | font-weight: bold;
145 | }
146 |
147 | dfn {
148 | font-style: italic;
149 | }
150 |
151 | ins {
152 | background: #ff9;
153 | color: #000;
154 | text-decoration: none;
155 | }
156 |
157 | mark {
158 | background: #ff0;
159 | color: #000;
160 | font-style: italic;
161 | font-weight: bold;
162 | }
163 |
164 | sub, sup {
165 | font-size: 75%;
166 | line-height: 0;
167 | position: relative;
168 | vertical-align: baseline;
169 | }
170 |
171 | sup {
172 | top: -0.5em;
173 | }
174 |
175 | sub {
176 | bottom: -0.25em;
177 | }
178 |
179 | ul, ol {
180 | margin: 1em 0;
181 | padding: 0 0 0 2em;
182 | }
183 |
184 | li p:last-child {
185 | margin-bottom: 0;
186 | }
187 |
188 | ul ul, ol ol {
189 | margin: .3em 0;
190 | }
191 |
192 | dl {
193 | margin-bottom: 1em;
194 | }
195 |
196 | dt {
197 | font-weight: bold;
198 | margin-bottom: .8em;
199 | }
200 |
201 | dd {
202 | margin: 0 0 .8em 2em;
203 | }
204 |
205 | dd:last-child {
206 | margin-bottom: 0;
207 | }
208 |
209 | img {
210 | border: 0;
211 | -ms-interpolation-mode: bicubic;
212 | vertical-align: middle;
213 | }
214 |
215 | figure {
216 | display: block;
217 | text-align: center;
218 | margin: 1em 0;
219 | }
220 |
221 | figure img {
222 | border: none;
223 | margin: 0 auto;
224 | }
225 |
226 | figcaption {
227 | font-size: 0.8em;
228 | font-style: italic;
229 | margin: 0 0 .8em;
230 | }
231 |
232 | table {
233 | margin-bottom: 2em;
234 | border-bottom: 1px solid #ddd;
235 | border-right: 1px solid #ddd;
236 | border-spacing: 0;
237 | border-collapse: collapse;
238 | }
239 |
240 | table th {
241 | padding: .2em 1em;
242 | background-color: #eee;
243 | border-top: 1px solid #ddd;
244 | border-left: 1px solid #ddd;
245 | }
246 |
247 | table td {
248 | padding: .2em 1em;
249 | border-top: 1px solid #ddd;
250 | border-left: 1px solid #ddd;
251 | vertical-align: top;
252 | }
253 |
254 | .author {
255 | font-size: 1.2em;
256 | text-align: center;
257 | }
258 |
259 | @media only screen and (min-width: 480px) {
260 | body {
261 | font-size: 14px;
262 | }
263 | }
264 | @media only screen and (min-width: 768px) {
265 | body {
266 | font-size: 16px;
267 | }
268 | }
269 | @media print {
270 | * {
271 | background: transparent !important;
272 | color: black !important;
273 | filter: none !important;
274 | -ms-filter: none !important;
275 | }
276 |
277 | body {
278 | font-size: 12pt;
279 | max-width: 100%;
280 | }
281 |
282 | a, a:visited {
283 | text-decoration: underline;
284 | }
285 |
286 | hr {
287 | height: 1px;
288 | border: 0;
289 | border-bottom: 1px solid black;
290 | }
291 |
292 | a[href]:after {
293 | content: " (" attr(href) ")";
294 | }
295 |
296 | abbr[title]:after {
297 | content: " (" attr(title) ")";
298 | }
299 |
300 | .ir a:after, a[href^="javascript:"]:after, a[href^="#"]:after {
301 | content: "";
302 | }
303 |
304 | pre, blockquote {
305 | border: 1px solid #999;
306 | padding-right: 1em;
307 | page-break-inside: avoid;
308 | }
309 |
310 | tr, img {
311 | page-break-inside: avoid;
312 | }
313 |
314 | img {
315 | max-width: 100% !important;
316 | }
317 |
318 | @page :left {
319 | margin: 15mm 20mm 15mm 10mm;
320 | }
321 |
322 | @page :right {
323 | margin: 15mm 10mm 15mm 20mm;
324 | }
325 |
326 | p, h2, h3 {
327 | orphans: 3;
328 | widows: 3;
329 | }
330 |
331 | h2, h3 {
332 | page-break-after: avoid;
333 | }
334 | }
335 |
--------------------------------------------------------------------------------
/lib/chesschart/pkgIndex.tcl:
--------------------------------------------------------------------------------
1 | package ifneeded chesschart 0.2 [list source [file join $dir chesschart.tcl]]
2 |
--------------------------------------------------------------------------------
/lib/dgtools/autoPather.tcl:
--------------------------------------------------------------------------------
1 | #!/bin/env tclsh
2 | # file: autoPather.tcl
3 | if {[info exists argv0] && $argv0 eq [info script]} {
4 | if {[llength $argv] == 0} {
5 | puts "Usage: [info script] pathname app.tcl ?other args?"
6 | exit 0
7 | }
8 | lappend auto_path [lindex $argv 0]
9 | set ::argv0 [lindex $argv 1]
10 | set ::argv [lrange $argv 2 end]
11 | source $argv0
12 | }
13 |
14 |
--------------------------------------------------------------------------------
/lib/dgtools/dgtutils.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 | dgtools::dgtutils 0.1
10 |
54 |
55 |
56 |
dgtools::dgtutils 0.1
57 |
Detlef Groth, Schwielowsee, Germany
58 |
2020-03-21
59 |
60 | NAME
61 |
62 | dgtools::dgtutils - internal helper procedures for the dgtools package
63 |
64 | TABLE OF CONTENTS
65 |
66 |
75 |
76 |
77 |
78 | package require dgtools::dgtutils
79 | dgtools::getVersion filename
80 | dgtools::install filename
81 | dgtools::manual mode filename
82 | dgtools::runExample filename boolean
83 |
84 |
85 |
86 |
87 | The dgtools::dgtutils package provide a few helper commands for other packages
88 | in the dgtools package to format the documentation, to extract the help pages and to show and run example code
89 | embedded within the package documentation.
90 |
91 | COMMANDS
92 |
93 | dgtools::getVersion filename
94 |
95 |
96 | Returns the package version of a given file. Please note, that the package must have the same name as the file basename.
97 |
98 |
99 | dgtools::install filename
100 |
101 |
102 | Installs the fiven file as Tcl module within the Tcl module path.
103 | Please note, that the package must have the same name as the file basename.
104 |
105 |
106 | dgtools::manual mode filename
107 |
108 |
109 | Extracts and formats the embedded documentation. Option mode can bei either -html , -man or -markdown .
110 | -man is pandoc markdown, an extended version for the pandoc document converter.
111 | Documentation in Markdown must be prefix with a #'
comment sign.
112 |
113 |
114 | dgtools::runExample filename ?eval:boolean?
115 |
116 |
117 | Extracts and executes the code of the example section in the Markdown formatted
118 | documentation. Documentation must be prefixed with a #'
comment indicator
119 | and must be followed directly the example section header after two '##' signs. If the option eval is set to false the code is only returned.
120 |
121 |
122 |
123 |
124 | The script contains embedded the documentation in Markdown format.
125 | To extract the documentation you should use the following command line:
126 |
127 | $ tclsh recover.tcl --man
128 |
129 |
130 | The output of this command can be used to create a markdown document for conversion into a markdown
131 | document that can be converted thereafter into a html or pdf document. If, for instance, you have pandoc installed you could execute the following commands:
132 |
133 | tclsh recover.tcl --man > recover.md
134 | pandoc -i recover.md -s -o recover.html
135 | pandoc -i recover.md -s -o recover.tex
136 | pdflatex recover.tex
137 |
138 |
139 | Alternatively if the Markdown package of tcllib is available you can convert the documentation as well directly to html using the --html flag:
140 |
141 | $ tclsh recover.tcl --html
142 |
143 |
144 |
145 |
146 | The dgtools::recover command was written Detlef Groth, Schwielowsee, Germany.
147 |
148 |
149 |
150 | Copyright (c) 2020 Dr. Detlef Groth, E-mail: detlef(at)dgroth(dot)de
151 |
152 |
153 |
154 | dgtools::dgtutils package 0.1 - private procedures to be used within the dgtools packages.
155 |
156 | Copyright (c) 2020 Dr. Detlef Groth, E-mail: detlef(at)dgroth(dot)de
157 |
158 | This library is free software; you can use, modify, and redistribute it
159 | for any purpose, provided that existing copyright notices are retained
160 | in all copies and that this notice is included verbatim in any
161 | distributions.
162 |
163 | This software is distributed WITHOUT ANY WARRANTY; without even the
164 | implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
165 |
166 |
167 |
168 |
--------------------------------------------------------------------------------
/lib/dgtools/pkgIndex.tcl:
--------------------------------------------------------------------------------
1 | package ifneeded dgtools::dgtutils 0.1 [list source [file join $dir dgtutils-0.1.tm]]
2 | package ifneeded dgtools::argvparse 0.2 [list source [file join $dir argvparse-0.2.tm]]
3 | package ifneeded dgtools::shistory 0.2 [list source [file join $dir shistory-0.2.tm]]
4 | package ifneeded dgtools::repo 0.1 [list source [file join $dir repo-0.1.tm]]
5 | package ifneeded dgtools::recover 0.1 [list source [file join $dir recover-0.1.tm]]
6 |
--------------------------------------------------------------------------------
/lib/dgtools/recover.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 | dgtools::recover 0.1
10 |
54 |
55 |
56 |
dgtools::recover 0.1
57 |
Detlef Groth, Schwielowsee, Germany
58 |
2020-03-22
59 |
60 | NAME
61 |
62 | dgtools::recover - debugging command
63 |
64 | TABLE OF CONTENTS
65 |
66 |
78 |
79 |
80 |
81 | package require dgtools::recover
82 | dgtools::recover
83 | dgtools::recover_onerror
84 | dgtools::recover_stop
85 |
86 |
87 |
88 |
89 | The dgtools::recover command allows to debug interactively errors pr problems in
90 | Tcl terminal programs in the same spirit as the R recover command.
91 |
92 | COMMANDS
93 |
94 | dgtools::recover
95 |
96 |
97 | Manually jumps in debugging mode. This command can be placed into critical code fragments and then you can jump directly during debugging in this procedure. See the following example:
98 |
99 | proc test {x} {
100 | set y $x
101 | incr y
102 | dgtools::recover
103 | incr x
104 | return $y
105 | }
106 | test 5
107 |
108 |
109 | dgtools::recover_onerror
110 |
111 |
112 | This replaces the error command, instead of reporting the error there will be an interactive terminal
113 | where you can debug all variables in the current procedure or method.
114 |
115 |
116 | dgtools::recover_stop
117 |
118 |
119 | This resets the error handling by the recover command to the normal error command.
120 |
121 |
122 |
123 |
124 | The following example shows how you can jump into your own error calls in your code.
125 | As you normally report critical parts of your code with such error calls it allows you to jump directly into those places and debug them.
126 | Unfortunately, I don't know how to jump automatically into the error call of Tcl.
127 |
128 | package require dgtools::recover
129 | ::dgtools::recover_onerror
130 | proc test {x} {
131 | set y $x
132 | # the next line with the error
133 | # will jump into the recover moce
134 | error "z does not exists"
135 | return $z
136 | }
137 | test 6
138 |
139 |
140 |
141 |
142 | The script contains embedded the documentation in Markdown format.
143 | To extract the documentation you should use the following command line:
144 |
145 | $ tclsh recover.tcl --man
146 |
147 |
148 | The output of this command can be used to create a markdown document for conversion into a markdown
149 | document that can be converted thereafter into a html or pdf document. If, for instance, you have pandoc installed you could execute the following commands:
150 |
151 | tclsh recover.tcl --man > recover.md
152 | pandoc -i recover.md -s -o recover.html
153 | pandoc -i recover.md -s -o recover.tex
154 | pdflatex recover.tex
155 |
156 |
157 | Alternatively if the Markdown package of tcllib is available you can convert the documentation as well directly to html using the --html flag:
158 |
159 | $ tclsh recover.tcl --html
160 |
161 |
162 |
163 |
164 | The dgtools::recover command was written Detlef Groth, Schwielowsee, Germany.
165 |
166 |
167 |
168 | Copyright (c) 2020 Dr. Detlef Groth, E-mail: detlef(at)dgroth(dot)de
169 |
170 |
171 |
172 | dgtools:recover package - debugging tool in spirit of R's recover function.
173 |
174 | Copyright (c) 2020 Dr. Detlef Groth, E-mail: detlef(at)dgroth(dot)de
175 |
176 | This library is free software; you can use, modify, and redistribute it
177 | for any purpose, provided that existing copyright notices are retained
178 | in all copies and that this notice is included verbatim in any
179 | distributions.
180 |
181 | This software is distributed WITHOUT ANY WARRANTY; without even the
182 | implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
183 |
184 |
185 |
186 |
--------------------------------------------------------------------------------
/lib/dgw/Makefile:
--------------------------------------------------------------------------------
1 | ##-*- makefile -*-############################################################
2 | # Created By : Dr. Detlef Groth
3 | # Created : Fri Aug 20 08:46:11 2021
4 | # Last Modified : <210822.0703>
5 | #
6 | # Description
7 | #
8 | # Notes
9 | #
10 | # History
11 | #
12 | # $Log$
13 | #
14 | ##############################################################################
15 | #
16 | # Copyright (c) 2021 Dr. Detlef Groth.
17 | #
18 | ##############################################################################
19 |
20 | DGWPACKAGES=dgw basegui combobox dgwutils drawcanvas hyperhelp sbuttonbar seditor sfilebrowser sfinddialog sqlview statusbar tablelist tlistbox tvmixins txmixins
21 | pkg=dgw
22 | tclsh=~/tcl8.7/bin/tclsh8.7
23 | # tclsh=tclsh
24 | header:
25 | -rm header.md
26 | for file in $(DGWPACKAGES) ; do [[ "dgwutils" != "$${file}" ]] && echo -e "[$${file}]($${file}.html) - " >> header.md ; done
27 | perl -i -pe 's/(.+txmixins.+) -/$$1/' header.md
28 | doc:
29 | $(tclsh) ../dgtools/autoPather.tcl .. ../mkdoc/mkdoc.tcl $(pkg).tcl temp.md
30 | cat header.md temp.md > $(pkg).md
31 | $(tclsh) ../dgtools/autoPather.tcl .. ../mkdoc/mkdoc.tcl $(pkg).md $(pkg).html
32 | #$(tclsh) ../dgtools/autoPather.tcl .. $(pkg).tcl --man | pandoc -s -f markdown -t man - > dgw_$(pkg).n
33 | dgw: header
34 | for file in $(DGWPACKAGES) ; do make --no-print-directory $${file}.md $${file}.html ; done
35 | -rm temp.md
36 | demos:
37 | for file in $(DGWPACKAGES) ; do $(tclsh) ../dgtools/autoPather.tcl .. $${file}.tcl --demo ; done
38 | %.md: %.tcl
39 | $(tclsh) ../dgtools/autoPather.tcl .. ../mkdoc/mkdoc.tcl $< temp.md
40 | cat header.md temp.md > `basename $< .tcl`.md
41 | -rm temp.md
42 | %.html: %.md %.tcl
43 | $(tclsh) ../dgtools/autoPather.tcl .. ../mkdoc/mkdoc.tcl `basename $< .md`.md `basename $< .md`.html
44 |
45 |
--------------------------------------------------------------------------------
/lib/dgw/dgwutils.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 | Documentation dgwutils
10 |
11 |
80 |
81 |
82 |
83 |
84 | dgw -
85 | basegui -
86 | combobox -
87 | drawcanvas -
88 | hyperhelp -
89 | sbuttonbar -
90 | seditor -
91 | sfilebrowser -
92 | sfinddialog -
93 | sqlview -
94 | statusbar -
95 | tablelist -
96 | tlistbox -
97 | tvmixins -
98 | txmixins
99 |
100 | $document(title)
101 |
102 | $document(author)
103 |
104 | $document(date)
105 |
106 |
107 |
108 |
--------------------------------------------------------------------------------
/lib/dgw/dgwutils.md:
--------------------------------------------------------------------------------
1 | [dgw](dgw.html) -
2 | [basegui](basegui.html) -
3 | [combobox](combobox.html) -
4 | [drawcanvas](drawcanvas.html) -
5 | [hyperhelp](hyperhelp.html) -
6 | [sbuttonbar](sbuttonbar.html) -
7 | [seditor](seditor.html) -
8 | [sfilebrowser](sfilebrowser.html) -
9 | [sfinddialog](sfinddialog.html) -
10 | [sqlview](sqlview.html) -
11 | [statusbar](statusbar.html) -
12 | [tablelist](tablelist.html) -
13 | [tlistbox](tlistbox.html) -
14 | [tvmixins](tvmixins.html) -
15 | [txmixins](txmixins.html)
16 |
17 | # $document(title)
18 |
19 | ### $document(author)
20 |
21 | ### $document(date)
22 |
23 |
24 |
--------------------------------------------------------------------------------
/lib/dgw/documentation.md:
--------------------------------------------------------------------------------
1 | ## DOCUMENTATION
2 |
3 | The script contains embedded the documentation in Markdown format. To extract the documentation you should use the following command line:
4 |
5 | ```
6 | $ tclsh __BASENAME__.tcl --markdown
7 | ```
8 |
9 | This will extract the embedded manual pages in standard Markdown format. You can as well use this markdown output directly to create html pages for the documentation by using the *--html* flag.
10 |
11 | ```
12 | $ tclsh __BASENAME__.tcl --html
13 | ```
14 |
15 | If the tcllib Markdown package is installed, this will directly create a HTML page `__BASENAME__.html`
16 | which contains the formatted documentation.
17 |
18 | Github-Markdown can be extracted by using the *--man* switch:
19 |
20 | ```
21 | $ tclsh __BASENAME__.tcl --man
22 | ```
23 |
24 | The output of this command can be used to feed a Markdown processor for conversion into a
25 | html, docx or pdf document. If you have pandoc installed for instance, you could execute the following commands:
26 |
27 | ```
28 | tclsh ../__BASENAME__.tcl --man > __BASENAME__.md
29 | pandoc -i __BASENAME__.md -s -o __BASENAME__.html
30 | pandoc -i __BASENAME__.md -s -o __BASENAME__.tex
31 | pdflatex __BASENAME__.tex
32 | ```
33 |
--------------------------------------------------------------------------------
/lib/dgw/drawcanvas.md:
--------------------------------------------------------------------------------
1 | [dgw](dgw.html) -
2 | [basegui](basegui.html) -
3 | [combobox](combobox.html) -
4 | [drawcanvas](drawcanvas.html) -
5 | [hyperhelp](hyperhelp.html) -
6 | [sbuttonbar](sbuttonbar.html) -
7 | [seditor](seditor.html) -
8 | [sfilebrowser](sfilebrowser.html) -
9 | [sfinddialog](sfinddialog.html) -
10 | [sqlview](sqlview.html) -
11 | [statusbar](statusbar.html) -
12 | [tablelist](tablelist.html) -
13 | [tlistbox](tlistbox.html) -
14 | [tvmixins](tvmixins.html) -
15 | [txmixins](txmixins.html)
16 |
17 | # dgw::drawcanvas 0.1
18 |
19 | ### Detlef Groth, Schwielowsee, Germany
20 |
21 | ### 2021-08-23
22 |
23 |
24 | ## NAME
25 |
26 | **dgw::drawcanvas** - simple drawing tool to sketch some text, lines, rectangles ovals on the fly.
27 |
28 | ## TABLE OF CONTENTS
29 |
30 | - [SYNOPSIS](#synopsis)
31 | - [DESCRIPTION](#description)
32 | - [COMMAND](#command)
33 | - [WIDGET OPTIONS](#options)
34 | - [WIDGET COMMANDS](#commands)
35 | - [KEY BINDINGS](#bindings)
36 | - [EXAMPLE](#example)
37 | - [INSTALLATION](#install)
38 | - [DEMO](#demo)
39 | - [DOCUMENTATION](#docu)
40 | - [SEE ALSO](#see)
41 | - [CHANGES](#changes)
42 | - [TODO](#todo)
43 | - [AUTHORS](#authors)
44 | - [COPYRIGHT](#copyright)
45 | - [LICENSE](#license)
46 |
47 | ## SYNOPSIS
48 |
49 |
50 | package require Tk
51 | package require snit
52 | package require dgw::drawcanvas
53 |
54 |
55 | ## DESCRIPTION
56 |
57 | The widget **dgw::drawcanvas** provides a simple drawing surface to place, lines, rextangles, ovales and text
58 | in different in a fast manner on a canvas. It is based on code in the Tclers Wiki:
59 |
60 | ## COMMAND
61 |
62 | **dgw::drawcanvas** *pathName ?-option value ...?*
63 |
64 | > Creates and configures the **dgw::drawcanvas** widget using the Tk window id _pathName_ and the given *options*.
65 |
66 | ## WIDGET OPTIONS
67 |
68 | As the **dgw::drawcanvas** is an extension of the standard Tk canvas widget
69 | it supports all method and options of this widget.
70 | The following option(s) are added by the *dgw::drawcanvas* widget:
71 |
72 | __-colors__ _colorList_
73 |
74 | > List of colors which can be used to fill ovals and rectangles. Those colors are a set of pastel like colors.
75 |
76 | ## WIDGET COMMANDS
77 |
78 | Each **dgw::drawcanvas** widget supports all usual methods of the Tk canvas widget and it adds the follwing method(s):
79 |
80 | *pathName* **eraseAll** *?ask?*
81 |
82 | > Deletes all items in the widget, if ask is true (default), then the user will get a message box to agree on deleting all items.
83 |
84 | *pathName* **saveCanvas** *?fileName?*
85 |
86 | > Saves the content of the canvas either as ps or if the ghostscript
87 | interpreter is available as well as pdf file using the given filename. If the filename is not given
88 | the user will be asked for one.
89 |
90 | ## EXAMPLE
91 |
92 | In the example below we create a Markdown markup aware text editor.
93 |
94 |
95 | package require dgw::drawcanvas
96 | dgw::drawcanvas .dc
97 | pack .dc -side top -fill both -expand true
98 |
99 |
100 | ## INSTALLATION
101 |
102 | Installation is easy you can install and use the **dgw::drawcanvas** package if you have a working install of:
103 |
104 | - the snit package which can be found in [tcllib - https://core.tcl-lang.org/tcllib](https://core.tcl-lang.org/tcllib)
105 |
106 | For installation you copy the complete *dgw* folder into a path
107 | of your *auto_path* list of Tcl or you append the *auto_path* list with the parent dir of the *dgw* directory.
108 | Alternatively you can install the package as a Tcl module by creating a file dgw/drawcanvas-0.1.tm in your Tcl module path.
109 | The latter in many cases can be achieved by using the _--install_ option of drawcanvas.tcl.
110 | Try "tclsh drawcanvas.tcl --install" for this purpose.
111 |
112 | ## DEMO
113 |
114 | Example code for this package can be executed by running this file using the following command line:
115 |
116 |
117 | $ wish drawcanvas.tcl --demo
118 |
119 | The example code used for this demo can be seen in the terminal by using the following command line:
120 |
121 |
122 | $ tclsh drawcanvas.tcl --code
123 |
124 | ## DOCUMENTATION
125 |
126 | The script contains embedded the documentation in Markdown format. To extract the documentation you should use the following command line:
127 |
128 |
129 | $ tclsh drawcanvas.tcl --markdown
130 |
131 |
132 | This will extract the embedded manual pages in standard Markdown format. You can as well use this markdown output directly to create html pages for the documentation by using the *--html* flag.
133 |
134 |
135 | $ tclsh drawcanvas.tcl --html
136 |
137 |
138 | If the tcllib Markdown package is installed, this will directly create a HTML page `drawcanvas.html`
139 | which contains the formatted documentation.
140 |
141 | Github-Markdown can be extracted by using the *--man* switch:
142 |
143 |
144 | $ tclsh drawcanvas.tcl --man
145 |
146 |
147 | The output of this command can be used to feed a Markdown processor for conversion into a
148 | html, docx or pdf document. If you have pandoc installed for instance, you could execute the following commands:
149 |
150 |
151 | tclsh ../drawcanvas.tcl --man > drawcanvas.md
152 | pandoc -i drawcanvas.md -s -o drawcanvas.html
153 | pandoc -i drawcanvas.md -s -o drawcanvas.tex
154 | pdflatex drawcanvas.tex
155 |
156 |
157 | ## SEE ALSO
158 |
159 | - [dgw package homepage](https://chiselapp.com/user/dgroth/repository/tclcode/index) - various useful widgets
160 |
161 |
162 | ## CHANGES
163 |
164 | * 2020-03-27 - version 0.1 started
165 |
166 | ## TODO
167 |
168 | * github url
169 |
170 | ## AUTHORS
171 |
172 | The dgw::**dgw::drawcanvas** widget was written by Detlef Groth, Schwielowsee, Germany.
173 |
174 | ## Copyright
175 |
176 | Copyright (c) 2020 Dr. Detlef Groth, E-mail: detlef(at)dgroth(dot)de
177 |
178 | ## LICENSE
179 |
180 | dgw::drawcanvas package, version 0.1.
181 |
182 | Copyright (c) 2019-2021 Dr. Detlef Groth, E-mail: detlef(at)dgroth(dot)de
183 |
184 | This library is free software; you can use, modify, and redistribute it
185 | for any purpose, provided that existing copyright notices are retained
186 | in all copies and that this notice is included verbatim in any
187 | distributions.
188 |
189 | This software is distributed WITHOUT ANY WARRANTY; without even the
190 | implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
191 |
192 |
193 |
194 |
--------------------------------------------------------------------------------
/lib/dgw/header.md:
--------------------------------------------------------------------------------
1 | [dgw](dgw.html) -
2 | [basegui](basegui.html) -
3 | [combobox](combobox.html) -
4 | [drawcanvas](drawcanvas.html) -
5 | [hyperhelp](hyperhelp.html) -
6 | [sbuttonbar](sbuttonbar.html) -
7 | [seditor](seditor.html) -
8 | [sfilebrowser](sfilebrowser.html) -
9 | [sfinddialog](sfinddialog.html) -
10 | [sqlview](sqlview.html) -
11 | [statusbar](statusbar.html) -
12 | [tablelist](tablelist.html) -
13 | [tlistbox](tlistbox.html) -
14 | [tvmixins](tvmixins.html) -
15 | [txmixins](txmixins.html)
16 |
--------------------------------------------------------------------------------
/lib/dgw/hyperhelp-markdown-sample.md:
--------------------------------------------------------------------------------
1 | ---
2 | title: Markdown sample page
3 | author: Detlef Groth, Schwielowsee, Germany
4 | date: 2021-08-20
5 | geometry:
6 | - top=20mm
7 | - bottom=20mm
8 | - left=20mm
9 | ---
10 |
11 | ## Table of Contents
12 |
13 | * [Table of Contents](#toc)
14 | * [Home](#home)
15 | * [Sections](#sections)
16 | * [List examples](#lists)
17 | * [Emphasis examples](#emph)
18 | * [Code examples](#code)
19 | * [Indentation examples](#indent)
20 | * Images and Links
21 | * [Images](#images)
22 | * [Links](#links)
23 | * [Summary](#summary)
24 |
25 | -----
26 |
27 | ## Home
28 |
29 | In the following the Markdown markup subset is described which can be used to
30 | create from the same source, both the help page, as well as valid Markdown
31 | very close to the help page. Sometimes it is nessessary to avoid direct
32 | interpretation of the markup to put a dot in front of the source code which
33 | should be removed during writing.
34 |
35 | -----
36 |
37 | ## Sections
38 |
39 | Sections or pages are created after a line starting with 5 hyphens and an
40 | empty line. Thereafter the title of the page and an alias should be set using
41 | standard html/Markdown code like shown here:
42 |
43 | -----
44 |
45 | ## Sections
46 |
47 | Is the header for this page. Please note, that four, and only four(!) hyphens will be used to display a horizontal text line in the hyperhelp viewer.
48 |
49 | So:
50 |
51 | ----
52 |
53 | produces:
54 |
55 | ----
56 |
57 | 5 hyphens are used to separate the different pages from each other.
58 |
59 | -----
60 |
61 | ## List examples
62 |
63 | Here is the code for a nested unumbered list (leading dots should be ignored):
64 |
65 | .* list item 1
66 | .* list item 2
67 | .* list item 3
68 | . * subitem 3.1
69 | .* list item 4
70 | .* ...
71 |
72 | This results in the folling list:
73 |
74 | * list item 1
75 | * list item 2
76 | * list item 3
77 | * subitem 3.1
78 | * list item 4
79 | * subitem 4.1
80 | * subitem 4.2
81 | * list item 5
82 |
83 | Also numbered lists are possible, but the nesting is not cross compatible between Help and Markdown mode.
84 |
85 | 1. numbered item 1
86 | 2. numbered item 2
87 | 3. numbered item 3
88 | 4. numbered item 4
89 |
90 | -----
91 |
92 | ## Emphasis examples
93 |
94 | The code:
95 |
96 | Let's write mixed **bold** and *italic* and `typewriter text` in one line.
97 |
98 | Produces:
99 |
100 | Let's write mixed **bold** and *italic* and `typewriter text` in one lines.
101 |
102 | -----
103 |
104 | ## Indentation examples
105 |
106 | ### Paragraph indentation
107 |
108 | Paragraph indentation is done using the greater sign as shown below:
109 |
110 | .> text, indentation continues up to the next empty line.
111 |
112 | Here an example:
113 |
114 | > Lorem ipsum dolor sit amet consectetur adipiscing elit sollicitudin, odio
115 | varius nam ridiculus taciti penatibus risus vivamus,
116 | dignissim vestibulum luctus mus arcu lectus donec. Fermentum maecenas taciti purus netus posuere,
117 | nam morbi quam porttitor congue, habitasse vulputate faucibus dis. Vel gravida mattis aliquet
118 | sagittis taciti porttitor ullamcorper dapibus tortor pulvinar platea lobortis,
119 | lacus a placerat proin erat per ornare iaculis eleifend netus.
120 |
121 | > *Hendrerit morbi egestas cras rhoncus pellentesque diam sociosqu aptent,
122 | netus tellus interdum odio per ultricies luctus nostra, varius arcu sem
123 | tempor facilisi et molestie. Orci augue fermentum sagittis conubia accumsan
124 | ad congue convallis, enim nibh aliquam nostra mi iaculis ultricies laoreet gravida,
125 | mollis auctor quisque feugiat morbi platea leo. Massa sociosqu tempor nisl hendrerit
126 | sociis suscipit ligula pellentesque, sapien ultrices commodo sollicitudin faucibus
127 | placerat diam, a porta vivamus in phasellus eget erat.*
128 |
129 | ### List indentation
130 |
131 | Is as well possible if the first list element is prefixed with a greater sign
132 | like here - the dot just inhibts interpretation as list:
133 |
134 | . > - list item 1 indented
135 | . - list item 2 indented
136 | . - list item 3 indented
137 |
138 | Produces this:
139 |
140 | > - list item 1 indented
141 | - list item 2 indented
142 | - list item 3 indented
143 |
144 | -----
145 |
146 | ## Code examples
147 |
148 | Source code blocks are done using at least three whitespaces at the beginning
149 | of the lines.
150 |
151 | Here is a short code example:
152 |
153 | if {$x == 1} {
154 | puts "x is 1"
155 | }
156 |
157 |
158 | A special problem are code lines starting with hyphens, plus or star symbols.
159 | Currently you should preceed those lines with a dot character as before the
160 | actual symbol itself.
161 |
162 | .* indented list as source code
163 | .* second item
164 |
165 | -----
166 |
167 | ## Images
168 |
169 | Images can be inlined using standard Markdown syntax like here:
170 |
171 | . 
172 |
173 |
174 | 
175 |
176 | -----
177 |
178 | ## Links
179 |
180 | Only links to internal pages are supported:
181 |
182 | . [Table of Contents](#toc)(#toc)
183 |
184 |
185 | * [Table of Contents](#toc)
186 | * [Summary](#summary)
187 |
188 |
189 | -----
190 |
191 | ## Summary
192 |
193 | As those examples show, with the basic set of Markdown commands we can
194 | create documents which can be used at the same time as help pages for the
195 | hyperhelp viewer. As we have valid Markdown, this document can be given into
196 | other tools, for instance pandoc, to produce html or even pdf documents.
197 |
198 |
--------------------------------------------------------------------------------
/lib/dgw/hyperhelp-minimal.txt:
--------------------------------------------------------------------------------
1 | ---
2 | title: Hyperhelp template
3 | author: Marc Musterman, Mustercity, Mustercountry
4 | date: 2020-MM-DD
5 | geometry:
6 | - top=20mm
7 | - bottom=20mm
8 | - left=20mm
9 | ---
10 |
11 | ## Table of Contents
12 |
13 | * [Home](#home)
14 | * Markup samples
15 | * [Structure](#structure)
16 | * [Emphasis](#emph)
17 | * [Code](#code)
18 | * [Images and Links](#links)
19 | * [Substitutions](#subst)
20 | * [Table of Contents](#toc)
21 | -----
22 |
23 | ## Home
24 |
25 | This is a small starting template for the hyperhelp::package.
26 |
27 | -----
28 |
29 | ## Structure
30 |
31 | ### Header level 3
32 |
33 | horizontal row:
34 |
35 | ----
36 |
37 | List examples:
38 |
39 | * list item 1
40 | * list item 2
41 | * list item 3
42 | * subitem 3.1
43 | * subitem 3.2
44 | * list item 4
45 |
46 | 1. numbered item 1
47 | 2. numbered item 2
48 | 3. numbered item 3
49 | 4. numbered item 4
50 |
51 | Paragraph indentation:
52 |
53 | > some text which can be continued without linebreak in the output
54 | here.
55 |
56 | List indentation:
57 |
58 | > * item 1
59 | * item 2
60 | * item 3
61 |
62 | -----
63 |
64 | ## Emphasis
65 |
66 | Let's write mixed **bold** and *italic* and `typewriter text` in one line.
67 |
68 |
69 | -----
70 |
71 | ## Code
72 |
73 | Source code blocks are done using at least three whitespaces at the beginning
74 | of the lines.
75 |
76 | if {$x == 1} {
77 | puts "x is 1"
78 | }
79 |
80 |
81 | Show lines start with list symbols by preceeding them with a dot.
82 |
83 | .* first list item as source code
84 | .* second itemlist item as source code
85 |
86 | -----
87 |
88 | ## Images and Links
89 |
90 | Image:
91 |
92 | 
93 |
94 | Link to [Table of Contents](#toc)
95 |
96 |
97 | -----
98 |
99 | ## Substitutions
100 |
101 | We use:
102 | * Tcl/Tk $::tcl_patchLevel
103 | * dgw::hyperhelp [[package present dgw::hyperhelp]]
104 |
--------------------------------------------------------------------------------
/lib/dgw/hyperhelp-notoc-sample.txt:
--------------------------------------------------------------------------------
1 | title: Double Help Example
2 | alias: Start
3 |
4 | This is a simple help page consisting only of a single page.
5 |
6 | It's based on **A Little Hypertext System** so it includes:
7 | * Hyperlinks to other help pages
8 | * Simple searching ability
9 | * History
10 | * Simple wiki formatting
11 | * and many other features
12 |
13 | Continue here [Page 2]
14 |
15 | -------
16 |
17 | title: Page 2
18 |
19 | * item 1
20 | * item 2
21 | * item 3
22 |
23 |
24 | Continue here [Page 3]
25 |
26 |
27 | -------
28 |
29 | title: Page 3
30 |
31 | * item 1
32 | * item 2
33 | * item 3
34 |
35 |
36 | Back to start [Start]
37 |
--------------------------------------------------------------------------------
/lib/dgw/hyperhelp-onepage-sample.txt:
--------------------------------------------------------------------------------
1 | title: Simple Help Site
2 |
3 | This is a simple help page consisting only of a single page.
4 |
5 | It's based on **A Little Hypertext System** so it includes:
6 | * Hyperlinks to other help pages
7 | * Simple searching ability
8 | * History
9 | * Simple wiki formatting
10 | * and many other features
11 |
12 | Here follows an example for an indentation ...
13 |
14 | > - item 1
15 | - item 2
16 | - item 3
17 | -- subitem 3.1
18 | -- subitem 3.2
19 | -item 4
20 |
21 | Here an example for an code block
22 |
23 | set x 5
24 | puts \$x
25 |
26 | Finally a longer lipsum fragment which is indented ...
27 |
28 | > *Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor
29 | incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis
30 | nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
31 | Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore
32 | eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt
33 | in culpa qui officia deserunt mollit anim id est laborum.*
34 |
35 |
36 | > * item indented 1
37 | * item indented 2
38 | -- subitem indented 2.1
39 | -- subitem indented 2.2
40 | * item indented 4
41 |
42 | End of indentation
43 |
44 | * standard item 1
45 | * standard item 2
46 | * standard item 3
47 | ** subitem 3.1
48 | ** subitem 3.3
49 | * standard item 4
50 |
51 | **Header line**
52 |
53 | ### Header line
54 |
55 |
56 |
--------------------------------------------------------------------------------
/lib/dgw/hyperhelp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mittelmark/DGTcl/22b7cfc904010871af024dd348f8cb2b7d30b662/lib/dgw/hyperhelp.png
--------------------------------------------------------------------------------
/lib/dgw/hyperhelp.tcl:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mittelmark/DGTcl/22b7cfc904010871af024dd348f8cb2b7d30b662/lib/dgw/hyperhelp.tcl
--------------------------------------------------------------------------------
/lib/dgw/license.md:
--------------------------------------------------------------------------------
1 | ## LICENSE
2 |
3 | __PKGNAME__ package, version __PKGVERSION__.
4 |
5 | Copyright (c) 2019-2021 Dr. Detlef Groth, E-mail: detlef(at)dgroth(dot)de
6 |
7 | This library is free software; you can use, modify, and redistribute it
8 | for any purpose, provided that existing copyright notices are retained
9 | in all copies and that this notice is included verbatim in any
10 | distributions.
11 |
12 | This software is distributed WITHOUT ANY WARRANTY; without even the
13 | implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14 |
15 |
--------------------------------------------------------------------------------
/lib/dgw/pkgIndex.tcl:
--------------------------------------------------------------------------------
1 | # pkgIndex.tcl
2 | # mandatory packages
3 | package ifneeded dgw::dgw 0.7.0 [list source [file join $dir dgw.tcl]]
4 | package ifneeded dgw 0.7.0 [list source [file join $dir dgw.tcl]]
5 | package ifneeded dgw::basegui 0.3 [list source [file join $dir basegui.tcl]]
6 | package ifneeded dgw::combobox 0.2 [list source [file join $dir combobox.tcl]]
7 | package ifneeded dgw::dgwutils 0.3 [list source [file join $dir dgwutils.tcl]]
8 | package ifneeded dgw::drawcanvas 0.1 [list source [file join $dir drawcanvas.tcl]]
9 | package ifneeded dgw::sbuttonbar 0.6 [list source [file join $dir sbuttonbar.tcl]]
10 | package ifneeded dgw::seditor 0.3 [list source [file join $dir seditor.tcl]]
11 | package ifneeded dgw::sfinddialog 0.4 [list source [file join $dir sfinddialog.tcl]]
12 | package ifneeded dgw::statusbar 0.2 [list source [file join $dir statusbar.tcl]]
13 | package ifneeded dgw::tvmixins 0.3 [list source [file join $dir tvmixins.tcl]]
14 | package ifneeded dgw::txmixins 0.2.0 [list source [file join $dir txmixins.tcl]]
15 |
16 | # require tdbc::sqlite3
17 | package ifneeded dgw::sqlview 0.6 [list source [file join $dir sqlview.tcl]]
18 |
19 | # require tablelist::tablelist
20 | package ifneeded dgw::sfilebrowser 0.2 [list source [file join $dir sfilebrowser.tcl]]
21 | package ifneeded dgw::tablelist 0.2 [list source [file join $dir tablelist.tcl]]
22 | package ifneeded dgw::tlistbox 0.2 [list source [file join $dir tlistbox.tcl]]
23 |
24 | # require dgtools::shistory
25 | package ifneeded dgw::hyperhelp 0.8.3 [list source [file join $dir hyperhelp.tcl]]
26 |
27 |
--------------------------------------------------------------------------------
/lib/dgw/seditor.ini:
--------------------------------------------------------------------------------
1 | # file seditor.ini
2 | [Python]
3 | extension=*.py *.pyw
4 | package=^(import|from).+
5 | string=["'].+?["']
6 | method=^\s*(def|class)\s+[A-Z0-9_a-z]+
7 | keyword=(^| )(self|False|True|for|if|elif|else|try|and|as)
8 | comment=#.+
9 |
--------------------------------------------------------------------------------
/lib/dgw/statusbar.tcl:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mittelmark/DGTcl/22b7cfc904010871af024dd348f8cb2b7d30b662/lib/dgw/statusbar.tcl
--------------------------------------------------------------------------------
/lib/dgw/test.md:
--------------------------------------------------------------------------------
1 | # Header example
2 |
3 | _keyword_ example
4 |
5 | Some not hilighted text
6 |
7 | > some markdown quote text
8 |
9 | ## Subheader
10 |
11 | Some more standard text with two "strings" which are "inside!"
12 | {{All Files} * } {{Markdown Files} {.md}} {{Perl files} {*.pl *.pm}} {{Python files} {*.py *.pyw}} {{SQL Files} {.sql} } {{Text Files} {.txt} }
13 |
14 |
15 | ## Tcl
16 |
17 | Tcl be with you!
18 |
19 | ## EOF
20 |
21 | The End
22 |
23 |
--------------------------------------------------------------------------------
/lib/kroki4tcl/Makefile:
--------------------------------------------------------------------------------
1 | default:
2 | pandoc-tcl-filter.tapp README.md README.html -s --css mini.css
3 | htmlark README.html -o README-out.html
4 | mv README-out.html README.html
5 |
--------------------------------------------------------------------------------
/lib/kroki4tcl/README.md:
--------------------------------------------------------------------------------
1 | ---
2 | title: kroki4tcl - README
3 | author: Detlef Groth, Schwielowsee, Germany
4 | date: 2022-02-23
5 | ---
6 |
7 | ## kroki4tcl - README
8 |
9 | The HTML version of this README is here: [README.html](https://htmlpreview.github.io/?https://github.com/mittelmark/DGTcl/blob/master/lib/kroki4tcl/README.html)
10 |
11 | [Kroki](https://kroki.io/) is a webservice provides a unified API with support for BlockDiag
12 | (BlockDiag, SeqDiag, ActDiag, NwDiag, PacketDiag, RackDiag), BPMN, Bytefield,
13 | C4 (with PlantUML), Ditaa, Erd, Excalidraw, GraphViz, Mermaid, Nomnoml,
14 | Pikchr, PlantUML, SvgBob and other diagram tools.
15 |
16 | *kroki4tcl* is Tcl package which provides facilities to convert diagram code
17 | into URL's which can be embedded into any website or Markdown document. The
18 | package further has a graphical user interface where you can edit single
19 | diagram files or Markdown files containing multiple code chunks for the
20 | diagram tools which can be edited and previewed. And lastly *kroki4tcl* can be
21 | used as terminal application to convert diagram code saved to files to images.
22 |
23 | ## Usage
24 |
25 | ### Package
26 |
27 | Two main functions can be used:
28 |
29 | * **kroki4tcl::dia2kroki** *diagramtext ?diatype? ?fileformat?*
30 |
31 | Convert a diagram text to an embeddedable URL.
32 |
33 | > - diagramtext - the diagram text
34 | - diatype - the diagram type such as graphviz, ditaa, svgbob etc, default: graphviz
35 | - fileformat - the requested file format such as svg, png or pdf, default: svg
36 |
37 | > Example:
38 |
39 | > ```{.tcl}
40 | source kroki4tcl.tcl
41 | set url [kroki4tcl::dia2kroki "
42 | +-----------+ +-----------+
43 | | cFCE | | cCFE |
44 | | Hello |--->| World! |
45 | | | | |
46 | +-----------+ +-----------+
47 | " ditaa png]
48 | puts $url
49 | > ```
50 |
51 | > This URL can be embedded into any webpage. Here is the resulting image.
52 |
53 | > 
54 |
55 | * **kroki4tcl::kroki2dia** *url*
56 |
57 | > Convert a given URL back to diagram text.
58 |
59 | > - url - a kroki URL
60 |
61 | > Example:
62 |
63 | > ```{.tcl}
64 | puts [::kroki4tcl::kroki2dia https://kroki.io//ditaa/png/eJzj0tZFAG0FIEAR4KoBCSW7ObsCKTAbRCQ7u7nC2ApgJR6pOTn5IBGgJjuQQHh-UU6KIlAAYgIUwE2AC3ARsB8A0f4exQ]
65 | > ```
66 |
67 | ### GUI
68 |
69 | You can start the graphical user interface using the --gui command line
70 | argument. The GUI application needs an installed wget to download the images
71 | from the server. The application allows you to edit single diagrams in one
72 | source code file or multiple graphics embedded within code chunks of a
73 | Markdown document. To check this out, just use the help file using the help
74 | button in the upper right. Place the cursor in a code chunk and press Ctrl-s
75 | to save the file. In the label widget on the right the current diagram code
76 | will be translated to an image. See below for an example:
77 |
78 | 
79 |
80 | ### Command line application
81 |
82 |
83 | Usage (conversion): `kroki4tcl.tcl infile outfile`
84 |
85 | Usage (URL): `kroki4tcl.tcl infile` (shows the kroki URL on the terminal
86 |
87 | Possible input file extensions are:
88 |
89 | - adia ([ActDiag](http://blockdiag.com/en/))
90 | - bdia ([BlockDiag](http://blockdiag.com/en/))
91 | - ditaa ([Ditaa](http://ditaa.sourceforge.net/))
92 | - dot ([GraphViz](https://www.graphviz.org/))
93 | - erd ([ERD](https://github.com/BurntSushi/erd))
94 | - mmd ([Mermaid](https://mermaid-js.github.io/mermaid/#/))
95 | - nml ([Nomnoml](https://www.nomnoml.com/))
96 | - ndia ([NwDiag](http://blockdiag.com/en/))
97 | - pik ([Pikchr](https://pikchr.org/home/doc/trunk/homepage.md))
98 | - puml ([PlantUML](https://github.com/plantuml/plantuml))
99 | - sbob ([Svgbob](https://ivanceras.github.io/svgbob-editor/))
100 | - sdia ([SeqDiag](http://blockdiag.com/en/))
101 |
102 | Possible output file extensions are: svg, png or pdf, the latter two might
103 | require an installation of the `cairosvg` package which can be achieved on
104 | Unix platforms like this `pip3 install cairosvg --user`..
105 |
106 | ## ChangeLog
107 |
108 | - 2022-02-23 - first version 0.2.0
109 | - 2022-02-25 - 0.3.0 some fixes for Markdown mode
110 |
111 | ## License
112 |
113 | MIT
114 |
115 |
116 |
117 |
118 |
119 |
--------------------------------------------------------------------------------
/lib/kroki4tcl/examples/gui.ditaa:
--------------------------------------------------------------------------------
1 | +---------------------------------------------+
2 | | File | Help cEEE |
3 | +---------------+-----------------------------+
4 | | | |
5 | | tk.Listbox | tk.Listbox |
6 | | | |
7 | | UniProtIds | |
8 | | | |
9 | | | (UniProt-Entry) |
10 | | <+> |
11 | | | |
12 | | | |
13 | | | |
14 | | | |
15 | | | |
16 | +---------------+---------------------------+-+
17 | | |
18 | | +--- SeqSearch (labelframe) --------+ |
19 | | | /---------\ /-----------\ cFEE| |
20 | | | |ttk.Entry| | ttk.Button| | |
21 | | | \---------/ \-----------/ | |
22 | | +-----------------------------------+ |
23 | | |
24 | +-------------------------------------------+-+
25 | | ttk.Label (Fileinfo) cEFF| ttk.Progressbar |
26 | +-------------------------+-------------------+
27 |
28 | A\x2822\u00E4 ---> A₁ ---> A₂ ---> A₃ ---> A₄
29 | | | | | |
30 | | f₀ | f₁ | f₂ | f₃ | f₄
31 | | | | | |
32 | v v v v v
33 | B₀ ---> B₁ ---> B₂ ---> B₃ ---> B₄
34 |
35 |
36 |
--------------------------------------------------------------------------------
/lib/kroki4tcl/examples/sample-markdown-gui.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mittelmark/DGTcl/22b7cfc904010871af024dd348f8cb2b7d30b662/lib/kroki4tcl/examples/sample-markdown-gui.png
--------------------------------------------------------------------------------
/lib/kroki4tcl/examples/sample-sbob-gui.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mittelmark/DGTcl/22b7cfc904010871af024dd348f8cb2b7d30b662/lib/kroki4tcl/examples/sample-sbob-gui.png
--------------------------------------------------------------------------------
/lib/kroki4tcl/examples/sample-sbob.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mittelmark/DGTcl/22b7cfc904010871af024dd348f8cb2b7d30b662/lib/kroki4tcl/examples/sample-sbob.png
--------------------------------------------------------------------------------
/lib/kroki4tcl/examples/sample-sbob.sbob:
--------------------------------------------------------------------------------
1 | .---. .-------.
2 | /-o-/-- \ \ #
3 | .-/ / /-> .----' \ /
4 | ( * \/ \ '---'
5 | '-. \ \
6 | \ / \
7 | ' V
8 | .---------. .------------.
9 | | Hello | *----> |-----> #------> | World {r1}|
10 | '---------' '------------'
11 |
12 | O O
13 | +--+--+--+
14 | | | # |
15 | +--+--+--+
16 | # | | |
17 | +--+--+--+
18 | | |x | |
19 | +--+--+--+
20 | | | | |
21 | +--+--+--+
22 |
23 |
24 | # Legend:
25 | r1 = {
26 | fill: salmon;
27 | }
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/lib/kroki4tcl/mini.css:
--------------------------------------------------------------------------------
1 | html {
2 | overflow-y: scroll;
3 | }
4 | body {
5 | color: #444;
6 | font-family: Georgia, Palatino, 'Palatino Linotype', Times, 'Times New Roman', serif;
7 | line-height: 1.2;
8 | padding: 1em;
9 | margin: auto;
10 | max-width: 900px;
11 | }
12 | a {
13 | color: #0645ad;
14 | text-decoration: none;
15 | }
16 | a:visited {
17 | color: #0b0080;
18 | }
19 | a:hover {
20 | color: #06e;
21 | }
22 | a:active {
23 | color: #faa700;
24 | }
25 | a:focus {
26 | outline: thin dotted;
27 | }
28 | p {
29 | margin: 0.5em 0;
30 | }
31 | p.date {
32 | text-align: center;
33 | }
34 | img {
35 | max-width: 100%;
36 | }
37 |
38 | h1, h2, h3, h4, h5, h6 {
39 | color: #111;
40 | line-height: 115%;
41 | margin-top: 1em;
42 | font-weight: normal;
43 | }
44 | h1 {
45 | text-align: center;
46 | font-size: 120%;
47 | }
48 | p.author, p.date {
49 | font-size: 110%;
50 | }
51 |
52 | /* h2 {
53 | text-transform: uppercase;
54 | }
55 | */
56 | pre, blockquote pre {
57 | border-top: 0.1em #9ac solid;
58 | background: #e9f6ff;
59 | padding: 10px;
60 | border-bottom: 0.1em #9ac solid;
61 | }
62 |
63 | blockquote {
64 | margin: 0;
65 | padding-left: 3em;
66 | }
67 |
68 | hr {
69 | display: block;
70 | height: 2px;
71 | border: 0;
72 | border-top: 1px solid #aaa;
73 | border-bottom: 1px solid #eee;
74 | margin: 1em 0;
75 | padding: 0;
76 | }
77 |
78 | pre, code, kbd, samp {
79 | color: #000;
80 | font-family: Monaco, 'courier new', monospace;
81 | font-size: 90%;
82 | }
83 | code.r {
84 | color: #770000;
85 | }
86 | pre {
87 | white-space: pre;
88 | white-space: pre-wrap;
89 | word-wrap: break-word;
90 | }
91 | /* fix, do not like bold for every keyword */
92 | code span.kw { color: #007020; font-weight: normal; } /* Keyword */
93 | pre.sourceCode {
94 | background: #fff6f6;
95 | }
96 | figure, p.author {
97 | text-align: center;
98 | }
99 | table {
100 | border-collapse: collapse;
101 | border-bottom: 2px solid;
102 | border-spacing: 5px;
103 | min-width: 400px;
104 | }
105 | table thead tr th {
106 | background-color: #fde9d9;
107 | text-align: left;
108 | padding: 10px;
109 | border-top: 2px solid;
110 | border-bottom: 2px solid;
111 | }
112 | table td {
113 | background-color: #fff9e9;
114 |
115 | text-align: left;
116 | padding: 10px;
117 | }
118 |
--------------------------------------------------------------------------------
/lib/kroki4tcl/pkgIndex.tcl:
--------------------------------------------------------------------------------
1 | package ifneeded kroki4tcl 0.3.0 [list source [file join $dir kroki4tcl.tcl]]
2 |
3 |
--------------------------------------------------------------------------------
/lib/mkdoc/pkgIndex.tcl:
--------------------------------------------------------------------------------
1 | package ifneeded mkdoc 0.6.0 [list source [file join $dir mkdoc.tcl]]
2 | package ifneeded mkdoc::mkdoc 0.6.0 [list source [file join $dir mkdoc.tcl]]
3 |
--------------------------------------------------------------------------------
/lib/shtmlview/LICENSE:
--------------------------------------------------------------------------------
1 | BSD 2-Clause License
2 |
3 | Copyright (c) 2022, mittelmark
4 | All rights reserved.
5 |
6 | Redistribution and use in source and binary forms, with or without
7 | modification, are permitted provided that the following conditions are met:
8 |
9 | 1. Redistributions of source code must retain the above copyright notice, this
10 | list of conditions and the following disclaimer.
11 |
12 | 2. Redistributions in binary form must reproduce the above copyright notice,
13 | this list of conditions and the following disclaimer in the documentation
14 | and/or other materials provided with the distribution.
15 |
16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
17 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
20 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
22 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
23 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 |
--------------------------------------------------------------------------------
/lib/shtmlview/README.md:
--------------------------------------------------------------------------------
1 | ## shtmlview
2 |
3 | ### Description
4 |
5 | The `shtmlview` package provides a pure Tcl/Tk widget to display basic HTML and
6 | Markdown files. An installation of the Tcllib package *snit* is required. To
7 | display Markdown files the Tcllib *Markdown* package has to be installed as
8 | well. The package *TkImg* is required to support the display of JPEG images.
9 |
10 | This widget is not a web browser. It will not work with http(s) addresses and
11 | only relative filenames for images and links should be used. The widget supports
12 | base64 encoded images embedded directly into HTML pages.
13 |
14 | * [Manual](http://htmlpreview.github.io/?https://github.com/mittelmark/shtmlview/blob/master/shtmlview/shtmlview.html)
15 | * [Download Git Latest 1.1.0](https://downgit.github.io/#/home?url=https://github.com/mittelmark/shtmlview/tree/main/shtmlview)
16 | * [Download Git Stable 1.0.0](https://github.com/mittelmark/shtmlview/archive/refs/tags/v1.0.0.zip)
17 |
18 | ### Standalone Application
19 |
20 | The file `shtmlview.tcl` is not only a Tcl package but also a standalone
21 | application for the direct viewing of Markdown and HTML files.
22 |
23 | To display a HTML file invoke it as
24 |
25 | ```
26 | tclsh shtmlview.tcl filename.html
27 | ```
28 |
29 | The image below is a screen shot from when the standalone application was used
30 | to browse the Tcl/Tk core documentation:
31 |
32 | 
33 |
34 | Invoke `tclsh shtmlview.tcl --help` in your terminal to see the embedded
35 | documentation explaining more options.
36 |
37 | ### See also
38 |
39 | * [Wikipage on Tclers Wiki](https://wiki.tcl-lang.org/page/shtmlview)
40 | * [tkhtml(1)](https://github.com/wjoye/tkhtml1)
41 | * [tkhtml3](http://tkhtml.tcl.tk/index.html)
42 |
43 | ### TODO's
44 |
45 | * [x] svg file and inline data support using svgconvert [https://github.com/mittelmark/svgconvert/](https://github.com/mittelmark/svgconvert/) !
46 | * [x] more investigations into the existing css functionality, keept it or throw it a away (thrown away, we should keep it minimal)
47 | * [x] removal of forms part (thrown away - no chance to implement a web browser)
48 | * [x] edit/view mode using Ctrl-Shift-e to switch between view and edit mode to directly edit and save for instance a Markdown document
49 | * [ ] help megawidget with TOC and index search such as dgHelpBrowser (new megawidget)
50 |
--------------------------------------------------------------------------------
/lib/shtmlview/pkgIndex.tcl:
--------------------------------------------------------------------------------
1 | package ifneeded shtmlview::shtmlview 1.1.0 [list source [file join $dir shtmlview.tcl]]
2 | package ifneeded shtmlview::doctools 0.1 [list source [file join $dir shtmlview-doctools.tcl]]
3 | package ifneeded shtmlview::mkdoc 0.1 [list source [file join $dir shtmlview-mkdoc.tcl]]
4 |
--------------------------------------------------------------------------------
/lib/shtmlview/shtmlview-doctools.man:
--------------------------------------------------------------------------------
1 | [vset VERSION 0.1]
2 | [comment {-*- mode: tcl; fill-column: 80 -*- doctools manpage}]
3 | [manpage_begin shtmlview_doctools n [vset VERSION]]
4 | [see_also shtmlview doctools]
5 | [keywords doctools html]
6 | [copyright {2022, Detlef Groth }]
7 |
8 | [moddesc {Basic HTML and Markdown viewer widget}]
9 | [titledesc {shtmlview extension adding support for doctools markup}]
10 | [require dtplite]
11 | [require shtmlview::shtmlview]
12 |
13 | [description]
14 |
15 | The [package shtmlview::doctools] package extends
16 | [package shtmlview::shtmlview] widgets with support for rendering of
17 | [term doctools]-formatted documents.
18 |
19 | [para]
20 |
21 | Simply loading the package registers the support.
22 |
23 | [para]
24 |
25 | The package does not export any kind of command, class, etc.
26 |
27 | [section CHANGELOG]
28 |
29 | [list_begin definitions]
30 |
31 | [def {2022-04-07 version 0.1}]
32 |
33 | [list_begin itemized]
34 | [item] Initial implementation
35 | [list_end]
36 |
37 | [list_end][comment --definitions]
38 |
39 | [section "Bugs, Ideas, Feedback"]
40 |
41 | This document, and the package it describes, will undoubtedly contain
42 | bugs and other problems. Please report such to the author of this
43 | package. Please also report any ideas for enhancements you may have
44 | for either package and/or documentation.
45 |
46 | [section "Code Copyright"]
47 |
48 | BSD License type:
49 |
50 | [para]
51 |
52 | Sun Microsystems, Inc.
53 |
54 | The following terms apply to all files associated with the software
55 | unless explicitly disclaimed in individual files.
56 |
57 | [para]
58 |
59 | The authors hereby grant permission to use, copy, modify, distribute,
60 | and license this software and its documentation for any purpose,
61 | provided that existing copyright notices are retained in all copies
62 | and that this notice is included verbatim in any distributions.
63 |
64 | No written agreement, license, or royalty fee is required for any of
65 | the authorized uses.
66 |
67 | Modifications to this software may be copyrighted by their authors and
68 | need not follow the licensing terms described here, provided that the
69 | new terms are clearly indicated on the first page of each file where
70 | they apply.
71 |
72 | [para]
73 |
74 | In no event shall the authors or distributors be liable to any party
75 | for direct, indirect, special, incidental, or consequential damages
76 | arising out of the use of this software, its documentation, or any
77 | derivatives thereof, even if the authors have been advised of the
78 | possibility of such damage.
79 |
80 | [para]
81 |
82 | The authors and distributors specifically disclaim any warranties,
83 | including, but not limited to, the implied warranties of
84 | merchantability, fitness for a particular purpose, and
85 | non-infringement.
86 |
87 | This software is provided on an "as is" basis, and the authors and
88 | distributors have no obligation to provide maintenance, support,
89 | updates, enhancements, or modifications.
90 |
91 | [para]
92 |
93 | RESTRICTED RIGHTS: Use, duplication or disclosure by the government is
94 | subject to the restrictions as set forth in subparagraph (c) (1) (ii)
95 | of the Rights in Technical Data and Computer Software Clause as DFARS
96 | 252.227-7013 and FAR 52.227-19.
97 |
98 | [vset CATEGORY shtmlview]
99 |
100 | [manpage_end]
101 |
102 |
--------------------------------------------------------------------------------
/lib/shtmlview/shtmlview-doctools.tcl:
--------------------------------------------------------------------------------
1 | # -*- tcl -*-
2 | ##
3 | ## (C) 2022 Dr. Detlef Groth, Germany
4 | ##
5 | ## shtmlview extension adding support for doctools markup
6 |
7 | # #############################################################
8 | ## Requirements - Viewer widget, and easy doctools conversion
9 |
10 | package require shtmlview::shtmlview
11 | package require dtplite
12 |
13 | # #############################################################
14 | ## Register the new converter
15 |
16 | ::shtmlview::converter .man {Doctools files} ::shtmlview::doctools
17 |
18 | # #############################################################
19 | ## Exported API
20 |
21 | proc ::shtmlview::doctools {url} {
22 |
23 | close [file tempfile htmltemp .html]
24 |
25 | ::dtplite::do [list -o $htmltemp html $url]
26 |
27 | if {[catch {
28 | open $htmltemp r
29 | } result]} {
30 | # result :: string, error message
31 | return -code error "Cannot open $url: $result"
32 | }
33 | # result :: channel handle
34 |
35 | set html [read $result]
36 | close $result
37 | file delete $htmltemp
38 |
39 | return $html
40 | }
41 |
42 | # #############################################################
43 | ## Publish package to Tcl
44 |
45 | package provide shtmlview::doctools 0.1
46 | return
47 |
--------------------------------------------------------------------------------
/lib/shtmlview/shtmlview-man.tcl:
--------------------------------------------------------------------------------
1 | package require shtmlview::shtmlview
2 | package provide shtmlview::man2html 0.1
3 | catch {
4 | package require dtplite
5 | }
6 | if {[info commands ::dtplite::do] eq ""} {
7 | return
8 | }
9 |
10 | lappend ::shtmlview::filetypes {{Tcl man files} {.man}}
11 |
12 | proc ::shtmlview::man2html {url {clean true}} {
13 | #package require dtplite
14 | set tempfile [file tempfile].html
15 | # why not dtplite -o .... (command does not exists)
16 | ::dtplite::do [list -o $tempfile html $url]
17 | if {[catch {open $tempfile r} infh]} {
18 | error "Cannot open $url: $infh"
19 | } else {
20 | # perform some cleanups for better display
21 | if {$clean} {
22 | set html [shtmlview::cleanHTML [read $infh]]
23 | } else {
24 | # for source view real HTML should be shown
25 | set html [read $infh]
26 | }
27 | close $infh
28 | file delete $tempfile
29 | return $html
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/lib/shtmlview/shtmlview-mkdoc.man:
--------------------------------------------------------------------------------
1 | [vset VERSION 0.1]
2 | [comment {-*- mode: tcl; fill-column: 80 -*- doctools manpage}]
3 | [manpage_begin shtmlview_mkdoc n [vset VERSION]]
4 | [see_also shtmlview mkdoc]
5 | [keywords mkdoc html]
6 | [copyright {2022, Detlef Groth }]
7 |
8 | [moddesc {Basic HTML and Markdown viewer widget}]
9 | [titledesc {shtmlview extension adding support for mkdoc markup}]
10 | [require mkdoc::mkdoc]
11 | [require shtmlview::shtmlview]
12 |
13 | [description]
14 |
15 | The [package shtmlview::mkdoc] package extends
16 | [package shtmlview::shtmlview] widgets with support for rendering of
17 | [term mkdoc]-formatted documents.
18 |
19 | [para]
20 |
21 | Simply loading the package registers the support.
22 |
23 | [para]
24 |
25 | The package does not export any kind of command, class, etc.
26 |
27 | [section CHANGELOG]
28 |
29 | [list_begin definitions]
30 |
31 | [def {2022-04-07 version 0.1}]
32 |
33 | [list_begin itemized]
34 | [item] Initial implementation
35 | [list_end]
36 |
37 | [list_end][comment --definitions]
38 |
39 | [section "Bugs, Ideas, Feedback"]
40 |
41 | This document, and the package it describes, will undoubtedly contain
42 | bugs and other problems. Please report such to the author of this
43 | package. Please also report any ideas for enhancements you may have
44 | for either package and/or documentation.
45 |
46 | [section "Code Copyright"]
47 |
48 | BSD License type:
49 |
50 | [para]
51 |
52 | Sun Microsystems, Inc.
53 |
54 | The following terms apply to all files associated with the software
55 | unless explicitly disclaimed in individual files.
56 |
57 | [para]
58 |
59 | The authors hereby grant permission to use, copy, modify, distribute,
60 | and license this software and its documentation for any purpose,
61 | provided that existing copyright notices are retained in all copies
62 | and that this notice is included verbatim in any distributions.
63 |
64 | No written agreement, license, or royalty fee is required for any of
65 | the authorized uses.
66 |
67 | Modifications to this software may be copyrighted by their authors and
68 | need not follow the licensing terms described here, provided that the
69 | new terms are clearly indicated on the first page of each file where
70 | they apply.
71 |
72 | [para]
73 |
74 | In no event shall the authors or distributors be liable to any party
75 | for direct, indirect, special, incidental, or consequential damages
76 | arising out of the use of this software, its documentation, or any
77 | derivatives thereof, even if the authors have been advised of the
78 | possibility of such damage.
79 |
80 | [para]
81 |
82 | The authors and distributors specifically disclaim any warranties,
83 | including, but not limited to, the implied warranties of
84 | merchantability, fitness for a particular purpose, and
85 | non-infringement.
86 |
87 | This software is provided on an "as is" basis, and the authors and
88 | distributors have no obligation to provide maintenance, support,
89 | updates, enhancements, or modifications.
90 |
91 | [para]
92 |
93 | RESTRICTED RIGHTS: Use, duplication or disclosure by the government is
94 | subject to the restrictions as set forth in subparagraph (c) (1) (ii)
95 | of the Rights in Technical Data and Computer Software Clause as DFARS
96 | 252.227-7013 and FAR 52.227-19.
97 |
98 | [vset CATEGORY shtmlview]
99 |
100 | [manpage_end]
101 |
102 |
--------------------------------------------------------------------------------
/lib/shtmlview/shtmlview-mkdoc.tcl:
--------------------------------------------------------------------------------
1 | # -*- tcl -*-
2 | ##
3 | ## (C) 2022 Dr. Detlef Groth, Germany, Andreas Kupries
4 | ##
5 | ## shtmlview extension adding support for mkdoc markup
6 |
7 | # #############################################################
8 | ## Requirements - Viewer widget, and easy mkdoc conversion
9 |
10 | package require shtmlview::shtmlview
11 | package require mkdoc::mkdoc
12 |
13 | # #############################################################
14 | ## Register the new converter
15 |
16 | ::shtmlview::converter .tcl {Tcl+mkdoc files} ::shtmlview::mkdoc
17 | ::shtmlview::converter .tm {Tcl+mkdoc modules} ::shtmlview::mkdoc
18 |
19 | # #############################################################
20 | ## Exported API
21 |
22 | proc ::shtmlview::mkdoc {url} {
23 |
24 | close [file tempfile htmltemp .html]
25 |
26 | mkdoc::mkdoc $url $htmltemp -html
27 |
28 | if {[catch {
29 | open $htmltemp r
30 | } result]} {
31 | # result :: string, error message
32 | return -code error "Cannot open $url: $result"
33 | }
34 | # result :: channel handle
35 |
36 | set html [read $result]
37 | close $result
38 | file delete $htmltemp
39 |
40 | return $html
41 | }
42 |
43 | # #############################################################
44 | ## Publish package to Tcl
45 |
46 | package provide shtmlview::mkdoc 0.1
47 | return
48 |
--------------------------------------------------------------------------------
/lib/tdot/mini.css:
--------------------------------------------------------------------------------
1 | html {
2 | overflow-y: scroll;
3 | }
4 | body {
5 | color: #444;
6 | font-family: Georgia, Palatino, 'Palatino Linotype', Times, 'Times New Roman', serif;
7 | line-height: 1.2;
8 | padding: 1em;
9 | margin: auto;
10 | max-width: 900px;
11 | }
12 | a {
13 | color: #0645ad;
14 | text-decoration: none;
15 | }
16 | a:visited {
17 | color: #0b0080;
18 | }
19 | a:hover {
20 | color: #06e;
21 | }
22 | a:active {
23 | color: #faa700;
24 | }
25 | a:focus {
26 | outline: thin dotted;
27 | }
28 | p {
29 | margin: 0.5em 0;
30 | }
31 | p.date {
32 | text-align: center;
33 | }
34 | img {
35 | max-width: 100%;
36 | }
37 |
38 | h1, h2, h3, h4, h5, h6 {
39 | color: #111;
40 | line-height: 115%;
41 | margin-top: 1em;
42 | font-weight: normal;
43 | }
44 | h1 {
45 | text-align: center;
46 | font-size: 120%;
47 | }
48 | p.author, p.date {
49 | font-size: 110%;
50 | }
51 |
52 | pre, blockquote pre {
53 | border-top: 0.1em #9ac solid;
54 | background: #e9f6ff;
55 | padding: 10px;
56 | border-bottom: 0.1em #9ac solid;
57 | }
58 |
59 | blockquote {
60 | margin: 0;
61 | padding-left: 3em;
62 | }
63 |
64 | hr {
65 | display: block;
66 | height: 2px;
67 | border: 0;
68 | border-top: 1px solid #aaa;
69 | border-bottom: 1px solid #eee;
70 | margin: 1em 0;
71 | padding: 0;
72 | }
73 |
74 | pre, code, kbd, samp {
75 | color: #000;
76 | font-family: Monaco, 'courier new', monospace;
77 | font-size: 90%;
78 | }
79 | code.r {
80 | color: #770000;
81 | }
82 | pre {
83 | white-space: pre;
84 | white-space: pre-wrap;
85 | word-wrap: break-word;
86 | }
87 | /* fix, do not like bold for every keyword */
88 | code span.kw { color: #007020; font-weight: normal; } /* Keyword */
89 | pre.sourceCode {
90 | background: #fff6f6;
91 | }
92 | figure, p.author {
93 | text-align: center;
94 | }
95 | table {
96 | border-collapse: collapse;
97 | border-bottom: 2px solid;
98 | min-width: 300px;
99 |
100 | }
101 | table thead tr th {
102 | background-color: #fde9d9;
103 | text-align: left;
104 | padding: 10px;
105 | border-top: 2px solid;
106 | border-bottom: 2px solid;
107 | }
108 | table td {
109 | background-color: #fff9e9;
110 |
111 | text-align: left;
112 | padding: 10px;
113 | }
114 |
--------------------------------------------------------------------------------
/lib/tdot/pkgIndex.tcl:
--------------------------------------------------------------------------------
1 | package ifneeded tdot 0.3.1 [list source [file join $dir tdot.tcl]]
2 |
--------------------------------------------------------------------------------
/lib/tmdoc/dgw.css:
--------------------------------------------------------------------------------
1 | body {
2 | margin-left: 5%; margin-right: 5%;
3 | font-family: Palatino, "Palatino Linotype", "Palatino LT STD", "Book Antiqua", Georgia, serif;
4 | }
5 | pre {
6 | padding-top: 1.4ex;
7 | padding-bottom: 1ex;
8 | padding-left: 2ex;
9 | padding-right: 1ex;
10 | color: black;
11 | background: #fbfbfb;
12 | border-top: 1px solid #6A6A6A;
13 | border-bottom: 1px solid #6A6A6A;
14 |
15 | font-family: Consolas, "Liberation Mono", Menlo, Courier, monospace;
16 | }
17 | pre.synopsis {
18 | background: #ddefff;
19 | }
20 |
21 | pre.tclcode {
22 | background: #ffefdf;
23 | }
24 |
25 |
26 | pre.tclout {
27 | background: #efffff;
28 | }
29 |
30 |
31 | pre.tclerr {
32 | background: #ffdfdf;
33 | }
34 |
35 | pre.std {
36 | background: #fbfbfb;
37 | }
38 |
39 | code {
40 | font-family: Consolas, "Liberation Mono", Menlo, Courier, monospace;
41 | }
42 | pre.r {
43 | background: #efffef;
44 | }
45 | div.sourceCode + pre {
46 | background: #eeffff;
47 | }
48 |
49 | h1 {
50 | font-family: sans-serif;
51 | font-size: 130%;
52 | background: transparent;
53 | text-align: center;
54 | }
55 | p.author, p.date {
56 | font-family: sans-serif;
57 | font-size: 110%;
58 | background: transparent;
59 | text-align: center;
60 | }
61 | h3 {
62 | font-family: sans-serif;
63 | font-size: 115%;
64 | background: transparent;
65 | text-align: center;
66 | }
67 | h2 {
68 | margin-top: 1em;
69 | font-family: sans-serif;
70 | font-size: 120%;
71 | color: #005A9C;
72 | text-align: left;
73 |
74 | }
75 |
--------------------------------------------------------------------------------
/lib/tmdoc/latex/tmdoc-template.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mittelmark/DGTcl/22b7cfc904010871af024dd348f8cb2b7d30b662/lib/tmdoc/latex/tmdoc-template.pdf
--------------------------------------------------------------------------------
/lib/tmdoc/latex/tmdoc.sty:
--------------------------------------------------------------------------------
1 | \usepackage{graphicx}
2 | \usepackage{tcolorbox}
3 | \usepackage{fancyvrb,xcolor}
4 | \usepackage{url}
5 |
6 | \definecolor{dverbbg}{rgb}{0.95,0.8,0.8}
7 | \definecolor{darkred}{rgb}{0.8,0.2,0.2}
8 | \definecolor{cverbbg}{gray}{0.85}
9 | \definecolor{rverbbg}{rgb}{0.9,0.5,0.5}
10 | \definecolor{bverbbg}{rgb}{0.8,0.9,0.95}
11 |
12 | \newenvironment{dverbatim}
13 | {\SaveVerbatim{cverb}}
14 | {\endSaveVerbatim
15 | \flushleft\fboxrule=0pt\fboxsep=.5em
16 | \colorbox{dverbbg}{%
17 | \makebox[\dimexpr\linewidth-2\fboxsep][l]{\BUseVerbatim{cverb}}%
18 | }
19 | \endflushleft
20 | }
21 |
22 | \newenvironment{cverbatim}
23 | {\SaveVerbatim{cverb}}
24 | {\endSaveVerbatim
25 | \flushleft\fboxrule=0pt\fboxsep=.5em
26 | \colorbox{cverbbg}{\BUseVerbatim{cverb}}%
27 | \endflushleft
28 | }
29 | \newenvironment{lcverbatim}
30 | {\SaveVerbatim{cverb}}
31 | {\endSaveVerbatim
32 | \flushleft\fboxrule=0pt\fboxsep=.5em
33 | \colorbox{cverbbg}{%
34 | \makebox[\dimexpr\linewidth-2\fboxsep][l]{\BUseVerbatim{cverb}}%
35 | }
36 | \endflushleft
37 | }
38 |
39 | \newenvironment{lrverbatim}
40 | {\SaveVerbatim{cverb}}
41 | {\endSaveVerbatim
42 | \flushleft\fboxrule=0pt\fboxsep=.5em
43 | \colorbox{rverbbg}{%
44 | \makebox[\dimexpr\linewidth-2\fboxsep][l]{\BUseVerbatim{cverb}}%
45 | }
46 | \endflushleft
47 | }
48 | \newenvironment{lbverbatim}
49 | {\SaveVerbatim{cverb}}
50 | {\endSaveVerbatim
51 | \flushleft\fboxrule=0pt\fboxsep=.5em
52 | \colorbox{bverbbg}{%
53 | \makebox[\dimexpr\linewidth-2\fboxsep][l]{\BUseVerbatim{cverb}}%
54 | }
55 | \endflushleft
56 | }
57 | \newcommand{\btick}{\texttt{`}}
58 |
--------------------------------------------------------------------------------
/lib/tmdoc/pkgIndex.tcl:
--------------------------------------------------------------------------------
1 | package ifneeded tmdoc::tmdoc 0.4 [list source [file join $dir tmdoc.tcl]]
2 | package ifneeded tmdoc 0.4 [list source [file join $dir tmdoc.tcl]]
3 |
--------------------------------------------------------------------------------
/lib/tmdoc/tutorial/canvas.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mittelmark/DGTcl/22b7cfc904010871af024dd348f8cb2b7d30b662/lib/tmdoc/tutorial/canvas.png
--------------------------------------------------------------------------------
/lib/tmdoc/tutorial/out.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mittelmark/DGTcl/22b7cfc904010871af024dd348f8cb2b7d30b662/lib/tmdoc/tutorial/out.png
--------------------------------------------------------------------------------
/lib/tmdoc/tutorial/out2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mittelmark/DGTcl/22b7cfc904010871af024dd348f8cb2b7d30b662/lib/tmdoc/tutorial/out2.png
--------------------------------------------------------------------------------
/lib/tmdoc/tutorial/tmdoc-example-chunk-13.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mittelmark/DGTcl/22b7cfc904010871af024dd348f8cb2b7d30b662/lib/tmdoc/tutorial/tmdoc-example-chunk-13.png
--------------------------------------------------------------------------------
/lib/tmdoc/tutorial/tmdoc-example-chunk-17.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mittelmark/DGTcl/22b7cfc904010871af024dd348f8cb2b7d30b662/lib/tmdoc/tutorial/tmdoc-example-chunk-17.png
--------------------------------------------------------------------------------
/lib/tmdoc/tutorial/tmdoc-example-myfig.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mittelmark/DGTcl/22b7cfc904010871af024dd348f8cb2b7d30b662/lib/tmdoc/tutorial/tmdoc-example-myfig.png
--------------------------------------------------------------------------------
/lib/tmdoc/tutorial/tmdoc-example-rect.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mittelmark/DGTcl/22b7cfc904010871af024dd348f8cb2b7d30b662/lib/tmdoc/tutorial/tmdoc-example-rect.png
--------------------------------------------------------------------------------
/lib/tmdoc/tutorial/tmdoc-example-ukaz1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mittelmark/DGTcl/22b7cfc904010871af024dd348f8cb2b7d30b662/lib/tmdoc/tutorial/tmdoc-example-ukaz1.png
--------------------------------------------------------------------------------
/lib/tmdoc/tutorial/tmdoc-example-ukaz2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mittelmark/DGTcl/22b7cfc904010871af024dd348f8cb2b7d30b662/lib/tmdoc/tutorial/tmdoc-example-ukaz2.png
--------------------------------------------------------------------------------
/log/README.md:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mittelmark/DGTcl/22b7cfc904010871af024dd348f8cb2b7d30b662/log/README.md
--------------------------------------------------------------------------------
/log/test.txt:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | apps
3 | bin
4 | dgw
5 | lib
6 | LICENSE
7 | log
8 | Makefile
9 | Makefile~
10 | pandoc-tcl-filter
11 | README.md
12 | README.md~
13 | releases
14 | Operating System
15 | tcl_platform(byteOrder) = littleEndian
16 | tcl_platform(engine) = Tcl
17 | tcl_platform(machine) = x86_64
18 | tcl_platform(os) = Linux
19 | tcl_platform(osVersion) = 5.14.13-100.fc33.x86_64
20 | tcl_platform(pathSeparator) = :
21 | tcl_platform(platform) = unix
22 | tcl_platform(pointerSize) = 8
23 | tcl_platform(threaded) = 1
24 | tcl_platform(user) = groth
25 | tcl_platform(wordSize) = 8
26 |
--------------------------------------------------------------------------------
/pandoc-tcl-filter/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2021 Dr. Detlef Groth, Caputh-Schwielowsee, Germany
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
23 |
--------------------------------------------------------------------------------
/pandoc-tcl-filter/Makefile:
--------------------------------------------------------------------------------
1 | ##-*- makefile -*-############################################################
2 | #
3 | # Created By : Dr. Detlef Groth
4 | # Created : Tue Aug 24 08:52:58 2021
5 | # Last Modified : <220208.0638>
6 | #
7 | # Description - Makefile for pandoc-tcl-filter
8 | #
9 | # Copyright (c) 2021 Dr. Detlef Groth.
10 | #
11 | ##############################################################################
12 |
13 | Readme.html : Readme.md mini.css header.md
14 | pandoc-tcl-filter.tapp Readme.md Readme.html --css mini.css -s \
15 | --lua-filter=filter/smallcaps.lua
16 | htmlark -o Readme-ark.html Readme.html
17 | mv Readme-ark.html Readme.html
18 |
19 | pandoc-tcl-filter.html: pandoc-tcl-filter.tcl
20 | pandoc-tcl-filter.tapp pandoc-tcl-filter.tcl pandoc-tcl-filter-out.html --css mini.css -s
21 | htmlark -o pandoc-tcl-filter.html pandoc-tcl-filter-out.html
22 | filter-view.html: filter-view.tcl
23 | pandoc-tcl-filter.tapp filter-view.tcl filter-view-out.html --css mini.css -s
24 | htmlark -o filter-view.html filter-view-out.html
25 |
26 | filter/filter-dot.html: filter/filter-dot.tcl
27 | perl -ne "s/^#' ?(.*)/\$$1/ and print " filter/filter-dot.tcl > filter/filter-dot.md
28 | pandoc filter/filter-dot.md -s \
29 | --metadata title="filter-dot.tcl documentation" \
30 | -o filter/filter-dot.html --filter pandoc-tcl-filter.tcl \
31 | --css mini.css -M date="`date "+%B %e, %Y %H:%M"`"
32 | tsvg-docu:
33 | perl -ne "s/^#' ?(.*)/\$$1/ and print " lib/tsvg/tsvg.tcl > tsvg.md
34 | pandoc tsvg.md -s \
35 | --metadata title="tsvg package documentation" \
36 | -o tsvg.html --filter pandoc-tcl-filter.tcl \
37 | --css mini.css --toc
38 | htmlark -o lib/tsvg/tsvg.html tsvg.html
39 | cp tsvg.md lib/tsvg/
40 |
41 | tdot-docu:
42 | perl -ne "s/^#' ?(.*)/\$$1/ and print " lib/tdot/tdot.tcl > tdot.md
43 | pandoc tdot.md -s \
44 | --metadata title="tdot package documentation" \
45 | -o tdot.html --filter pandoc-tcl-filter.tcl \
46 | --css mini.css --toc
47 | htmlark -o lib/tdot/tdot.html tdot.html
48 | cp tdot.md lib/tdot/
49 | tcl-filter.tapp:
50 | if [ ! -d pandoc-tapp ] ; then mkdir pandoc-tapp ; fi
51 | cp pandoc-tcl-filter.tcl pandoc-tapp/
52 | if [ ! -d pandoc-tapp/pandoc-tcl-filter.vfs ] ; then mkdir pandoc-tapp/pandoc-tcl-filter.vfs ; fi
53 | echo "lappend auto_path [file normalize [file join [file dirname [info script]] lib]]" > pandoc-tapp/pandoc-tcl-filter.vfs/main.tcl
54 | cp -r lib pandoc-tapp/pandoc-tcl-filter.vfs/
55 | -rm -rf pandoc-tapp/pandoc-tcl-filter.vfs/lib/tclfilters
56 | mkdir pandoc-tapp/pandoc-tcl-filter.vfs/lib/tclfilters
57 | cp -r filter/*.tcl pandoc-tapp/pandoc-tcl-filter.vfs/lib/tclfilters
58 | -rm -f pandoc-tapp/pandoc-tcl-filter.vfs/lib/*/*~
59 | -rm -f pandoc-tapp/pandoc-tcl-filter.vfs/lib/*/*md
60 | -rm -f pandoc-tapp/pandoc-tcl-filter.vfs/lib/*/*lua
61 | -rm -f pandoc-tapp/pandoc-tcl-filter.vfs/lib/*/*.n
62 | -rm -f pandoc-tapp/pandoc-tcl-filter.vfs/lib/*/*.dot
63 | -rm -f pandoc-tapp/pandoc-tcl-filter.vfs/lib/*/*html
64 | -rm -f pandoc-tapp/pandoc-tcl-filter.vfs/lib/*/*png
65 | -rm -rf pandoc-tapp/pandoc-tcl-filter.vfs/lib/tclfilters/figures
66 | -rm -rf pandoc-tapp/pandoc-tcl-filter.vfs/lib/tclfilters/images
67 | -rm -rf pandoc-tapp/pandoc-tcl-filter.vfs/lib/tclfilters/nfigures
68 | cd pandoc-tapp && tclsh ../../bin/tpack.tcl wrap pandoc-tcl-filter.tapp
69 | cd pandoc-tapp && cp pandoc-tcl-filter.tapp ..
70 | tests-folder:
71 | tclsh pandoc-tcl-filter.tcl tests/table.md tests/table.html -s --css mini.css
72 | htmlark tests/table.html -o tests/table-out.html
73 | cp tests/table-out.html tests/table.html
74 |
75 |
76 |
--------------------------------------------------------------------------------
/pandoc-tcl-filter/doc/Groth-S-and-T-2021.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mittelmark/DGTcl/22b7cfc904010871af024dd348f8cb2b7d30b662/pandoc-tcl-filter/doc/Groth-S-and-T-2021.pdf
--------------------------------------------------------------------------------
/pandoc-tcl-filter/examples/Makefile:
--------------------------------------------------------------------------------
1 | ##-*- makefile -*-############################################################
2 | #
3 | # Created By : Detlef Groth
4 | # Created : Fri Nov 26 17:28:19 2021
5 | # Last Modified : <211129.1945>
6 | #
7 | # Description : Makefile for pandoc-tcl-filter examples
8 | #
9 | ##############################################################################
10 |
11 |
12 | default: example-dot.html \
13 | example-mtex.html \
14 | example-pik.html \
15 | example-pic.html \
16 | example-tcl.html \
17 | example-tsvg.html \
18 | example-rplot.html
19 |
20 | %.html: %.md ghpandoc.css
21 | pandoc header.md -o header.html
22 | pandoc -s -o temp.html -B header.html --css ghpandoc.css \
23 | -M date="`date +"%b %d, %Y"`" \
24 | --filter pandoc-tcl-filter.tapp $<
25 | htmlark temp.html -o `basename $< .md`.html
26 |
27 |
--------------------------------------------------------------------------------
/pandoc-tcl-filter/examples/example-dot.md:
--------------------------------------------------------------------------------
1 | ---
2 | title: "pandoc-tcl-filter example - dot filter"
3 | author:
4 | - Detlef Groth
5 | date: Fri Nov 26 2021
6 | abstract: >
7 | Some abstract ...
8 | on several lines...
9 | ---
10 |
11 | ## Introduction
12 |
13 | Below are a few samples for embedding code for the GraphViz tools dot and
14 | neato into Markdown documents. The examples should work as well in other text
15 | markup languages like LaTeX, Asciidoc etc. This filter requires a installation of the command line tools of the GraphViz tools.
16 |
17 | Links:
18 |
19 | * GraphViz Homepage: [https://graphviz.org/](https://graphviz.org/)
20 | * Dot guide: [https://graphviz.org/pdf/dotguide.pdf](https://graphviz.org/pdf/dotguide.pdf)
21 | * Neato guide: [https://graphviz.org/pdf/neatoguide.pdf](https://graphviz.org/pdf/neatoguide.pdf)
22 |
23 | ## Dot graph
24 |
25 | ```
26 | ```{.dot label=digraph echo=true}
27 | digraph G {
28 | main -> parse -> execute;
29 | main -> init [dir=none];
30 | main -> cleanup;
31 | execute -> make_string;
32 | execute -> printf
33 | init -> make_string;
34 | main -> printf;
35 | execute -> compare;
36 | }
37 | ```
38 | ```
39 |
40 | Which will produce the following output:
41 |
42 | ```{.dot label=digraph echo=true}
43 | digraph G {
44 | main -> parse -> execute;
45 | main -> init [dir=none];
46 | main -> cleanup;
47 | execute -> make_string;
48 | execute -> printf
49 | init -> make_string;
50 | main -> printf;
51 | execute -> compare;
52 | }
53 | ```
54 |
55 | ## Neato graphs
56 |
57 | By using the argument `app=neato` in the code chunk header you can as well
58 | create *neato* graphs. Here an example:
59 |
60 | ```
61 | ```{.dot label=neato-sample app=neato}
62 | graph G {
63 | node [shape=box,style=filled,fillcolor=skyblue,
64 | color=black,width=0.4,height=0.4];
65 | n0 -- n1 -- n2 -- n3 -- n0;
66 | }
67 | ```
68 | ```
69 |
70 | Here the output.
71 |
72 | ```{.dot label=neato-sample app=neato}
73 | graph G {
74 | node [shape=box,style=filled,fillcolor=skyblue,
75 | color=black,width=0.4,height=0.4];
76 | n0 -- n1 -- n2 -- n3 -- n0;
77 | }
78 | ```
79 |
80 | ## Document creation
81 |
82 | Assuming that the file pandoc-tcl-filter.tapp is in your PATH,
83 | this document can be converted into an HTML file using the command line:
84 |
85 | ```
86 | pandoc -s -o sample-dot.html --filter pandoc-tcl-filter.tapp sample.md
87 | ## you can as well specify a style sheet to beautify the output
88 | pandoc -s -o sample-dot.html --css ghpandoc.css \
89 | --filter pandoc-tcl-filter.tapp sample.md
90 | ```
91 |
92 |
93 |
94 | ## EOF
95 |
96 |
97 |
98 |
--------------------------------------------------------------------------------
/pandoc-tcl-filter/examples/example-mtex.md:
--------------------------------------------------------------------------------
1 | ---
2 | title: "pandoc-tcl-filter example - mtex filter"
3 | author:
4 | - Detlef Groth
5 | date: Fri Nov 26 2021
6 | ---
7 |
8 | ## Introduction
9 |
10 | Below are a few samples for embedding LaTeX equations into Markdown documents.
11 | The examples should work as well in other text markup languages like LaTeX,
12 | Asciidoc etc. This filter requires a installation of the LaTeX command line tools and of the *varwidth* LaTeX package.
13 |
14 | Links:
15 |
16 | * LaTeX Homepage: [https://www.latex-project.org/](https://www.latex-project.org/)
17 | * LaTeX tutorial: [https://ftp.gwdg.de/pub/ctan/info/lshort/english/lshort-a5.pdf](https://ftp.gwdg.de/pub/ctan/info/lshort/english/lshort-a5.pdf)
18 |
19 | Here a famous example:
20 |
21 | ```{.mtex fontsize=LARGE}
22 | E = m \times c^2
23 | ```
24 |
25 | And here the second example:
26 |
27 | ```{.mtex fontsize=LARGE}
28 | F(x) = \int^a_b \frac{1}{3}x^3
29 | ```
30 |
31 | And here the code for the two examples:
32 |
33 | ```
34 | ```{.mtex fontsize=LARGE}
35 | E = m \times c^2
36 | ```
37 |
38 | text ...
39 |
40 | ```{.mtex fontsize=LARGE}
41 | F(x) = \int^a_b \frac{1}{3}x^3
42 | ```
43 | ```
44 |
45 | ## Document creation
46 |
47 | Assuming that the file pandoc-tcl-filter.tapp is in your PATH,
48 | this document can be converted into an HTML file using the command line:
49 |
50 | ```
51 | pandoc -s -o sample-mtex.html --filter pandoc-tcl-filter.tapp sample.md
52 | ## you can as well specify a style sheet to beautify the output
53 | pandoc -s -o sample-mtex.html --css ghpandoc.css \
54 | --filter pandoc-tcl-filter.tapp sample.md
55 | ```
56 |
57 |
58 |
59 | ## EOF
60 |
61 |
62 |
63 |
--------------------------------------------------------------------------------
/pandoc-tcl-filter/examples/example-pic.md:
--------------------------------------------------------------------------------
1 | ---
2 | title: "pandoc-tcl-filter example - PIC/EQN filter"
3 | author:
4 | - Detlef Groth
5 | date: Fri Nov 26 2021
6 | ---
7 |
8 | ## Introduction
9 |
10 | Below are a few samples for embedding code for the PIC diagram language and
11 | for the EQN equation language into kdown documents. The examples should work
12 | as well in other text markup languages like LaTeX, Asciidoc etc. This filter
13 | requires a installation of the groff command line tools where the required
14 | command line applications *pic2graph* and *eqn2graph* are as well installed.
15 |
16 | Links:
17 |
18 | * Groff Homepage: [https://www.gnu.org/software/groff/](https://www.gnu.org/software/groff)
19 | * Unix Text Processing Book: [https://www.oreilly.com/openbook/utp/](https://www.oreilly.com/openbook/utp/)
20 |
21 | ## PIC diagrams
22 |
23 | Here a code example for PIC diagrams. The indentation at the beginning must be
24 | removed. It is just here to avoid interpretation.
25 |
26 | ```{.pic ext=png}
27 | circle "circle" rad 0.5 fill 0.3; arrow ;
28 | ellipse "ellipse" wid 1.4 ht 1 fill 0.1 ; line;
29 | box wid 1 ht 1 fill 0.05 "A";
30 | spline;
31 | box wid 0.4 ht 0.4 fill 0.05 "B";
32 | arc;
33 | box wid 0.2 ht 0.2 fill 0.05 "C";
34 | ```
35 |
36 | Please note, that there exists the [Pikchr](https://pikchr.org) diagram processor which is a modern update on the PIC language with many more features. See here the example documentation for the [pikchr-filter](example-pik.html).
37 |
38 |
39 | ## EQN equations
40 |
41 | This is an old possibilty to create images out of equations.
42 | Here the input code where we have to tweak the image size.
43 |
44 | The code (the indentation of five spaces is just to avoid interpretation):
45 |
46 | ```
47 | ```{.eqn echo=false}
48 | x = {-b +- sqrt{b sup 2 - 4ac}} over 2a
49 | ```
50 | ```
51 |
52 | And here the output:
53 |
54 | ```{.eqn echo=false}
55 | x = {-b +- sqrt{b sup 2 - 4ac}} over 2a
56 | ```
57 |
58 | As the standard figure size is quite large we have to modify the code slightly:
59 |
60 | ```
61 | ```{.eqn label=eqnsam include=false echo=false}
62 | x = {-b +- sqrt{b sup 2 - 4ac}} over 2a
63 | ```
64 |
65 | {#id width=130}
66 | ```
67 |
68 | By using `echo=false` we avoid automatic embedding, below we manually display
69 | the image and decrease the width.
70 |
71 | Here the output:
72 |
73 | ```{.eqn label=eqnsam include=false echo=false}
74 | x = {-b +- sqrt{b sup 2 - 4ac}} over 2a
75 | ```
76 |
77 | {#id width=150}
78 |
79 |
80 | ## Document creation
81 |
82 | Assuming that the file pandoc-tcl-filter.tapp is in your PATH,
83 | this document can be converted into an HTML file using the command line:
84 |
85 | ```
86 | pandoc -s -o sample-dot.html --filter pandoc-tcl-filter.tapp sample.md
87 | ## you can as well specify a style sheet to beautify the output
88 | pandoc -s -o sample-dot.html --css ghpandoc.css \
89 | --filter pandoc-tcl-filter.tapp sample.md
90 | ```
91 |
92 |
93 |
94 | ## EOF
95 |
96 |
97 |
98 |
--------------------------------------------------------------------------------
/pandoc-tcl-filter/examples/example-pik.md:
--------------------------------------------------------------------------------
1 | ---
2 | title: "pandoc-tcl-filter example - Pikchr filter"
3 | author:
4 | - Detlef Groth
5 | date: Fri Nov 26 2021
6 | ---
7 |
8 | ## Introduction
9 |
10 | Below are a few samples for embedding code for the Pikchr diagram language
11 | which is an extension of the PIC diagram language. Pikchr is embedded in recent
12 | releases of the *fossil* software versioning system as subcommand `fossil pikchr`
13 | The examples below should work as well in other text markup languages like LaTeX, Asciidoc etc. This filter
14 | requires a installation of the *fossil* software or the standalone *pikchr* command.
15 |
16 | Links:
17 |
18 | * Fossil Homepage: [https://fossil-scm.org](https://fossil-scm.org)
19 | * Pikchr Homepage: [https://pikchr.org](https://pikchr.org)
20 | * Pikchr Manual: [https://pikchr.org/home/doc/trunk/doc/userman.md](https://pikchr.org/home/doc/trunk/doc/userman.md)
21 | * Pikchr Grammar: [https://pikchr.org/home/doc/trunk/doc/grammar.md](https://pikchr.org/home/doc/trunk/doc/grammar.md)
22 |
23 | ## Pikchr diagrams
24 |
25 | Here a code example for Pikchr diagrams. The indentation at the beginning must
26 | be removed. It is just here to avoid interpretation. To use a new downloaded
27 | version of the fossil application like *fossil-2.17* you could change the app
28 | option *app=fossil-2.17* for instance. Alternatively you could as well add
29 | *app=pikchr* if you have commpiled the *pikchr* command line application
30 | yourself.
31 |
32 | Here the code for a sample diagram (leading 5 character whitespaces must be removed):
33 |
34 | ```
35 | ```{.pikchr app=fossil}
36 | box "box"
37 | circle "circle" fill cornsilk at 1 right of previous
38 | ellipse "ellipse" at 1 right of previous
39 | oval "oval" at .8 below first box
40 | cylinder "cylinder" at 1 right of previous
41 | file "file" at 1 right of previous
42 | ```
43 | ```
44 |
45 | Here the output:
46 |
47 | ```{.pikchr app=fossil}
48 | box "box"
49 | circle "circle" fill cornsilk at 1 right of previous
50 | ellipse "ellipse" at 1 right of previous
51 | oval "oval" at .8 below first box
52 | cylinder "cylinder" at 1 right of previous
53 | file "file" at 1 right of previous
54 | ```
55 |
56 | We can resize as well the image by removing the automatic inclusion. Below an
57 | example.
58 |
59 | ```
60 | ```{.pikchr label=pikchr app=fossil include=false}
61 | box "box"
62 | circle "circle" fill cornsilk at 1 right of previous
63 | ellipse "ellipse" at 1 right of previous
64 | oval "oval" at .8 below first box
65 | cylinder "cylinder" at 1 right of previous
66 | file "file" at 1 right of previous
67 | ```
68 | {#id width=400}
69 | ```
70 |
71 | And here the resulting output:
72 |
73 | ```{.pikchr label=pikchr app=fossil include=false}
74 | box "box"
75 | circle "circle" fill cornsilk at 1 right of previous
76 | ellipse "ellipse" at 1 right of previous
77 | oval "oval" at .8 below first box
78 | cylinder "cylinder" at 1 right of previous
79 | file "file" at 1 right of previous
80 | ```
81 |
82 | {#id width=400}
83 |
84 | ## Hiding the Code
85 |
86 | To avoid that the reader sees the diagram code just add the option
87 | `echo=false` to the code chunk options.
88 |
89 | ```{.pikchr app=fossil ext=svg echo=false}
90 | arrow right 200% "Markdown" "Source"
91 | box rad 10px "Markdown" "Formatter" "(markdown.c)" fill beige fit
92 | arrow right 200% "HTML+SVG" "Output"
93 | arrow <-> down 70% from last box.s
94 | box same "Pikchr" "Formatter" "(pikchr.c)" fit
95 | ```
96 |
97 | The code to create this document was:
98 |
99 | ```
100 | ```{.pikchr app=fossil ext=svg echo=false}
101 | arrow right 200% "Markdown" "Source"
102 | box rad 10px "Markdown" "Formatter" "(markdown.c)" fill beige fit
103 | arrow right 200% "HTML+SVG" "Output"
104 | arrow <-> down 70% from last box.s
105 | box same "Pikchr" "Formatter" "(pikchr.c)" fit
106 | ```
107 | ```
108 |
109 | ## Document creation
110 |
111 |
112 | Download the file
113 | [pandoc-tcl-filter.tapp](https://github.com/mittelmark/DGTcl/releases/download/latest/pandoc-tcl-filter.tapp),
114 | make it executable and place it in a directory belonging to your `PATH`
115 | variable. The file contains the required libraries and the example filters.
116 | Shared library for th required *rl_json* library for Linux and Windows (Windows is currently untested).
117 |
118 | Further you need either the *fossil* application or the *pikchr* application,
119 | the easiest is to Download a precompiled *fossil* binary for your platform
120 | from the *fossil* homepage at
121 | [https://fossil-scm.org/home/uv/download.html](https://fossil-scm.org/home/uv/download.html),
122 | download it and place it a directory belonging to your `PATH`. If you install
123 | it using your package manager, make sure that it is at least version 2.13.
124 |
125 | Assuming then that the file *pandoc-tcl-filter.tapp* and the application *fossil* is in your `PATH`,
126 | this document can be converted into an HTML file using the command line:
127 |
128 | ```
129 | pandoc -s -o sample-pik.html --filter pandoc-tcl-filter.tapp sample.md
130 | ## you can as well specify a style sheet to beautify the output
131 | pandoc -s -o sample-pik.html --css ghpandoc.css \
132 | --filter pandoc-tcl-filter.tapp sample.md
133 | ```
134 |
135 |
136 | ## EOF
137 |
138 |
139 |
140 |
--------------------------------------------------------------------------------
/pandoc-tcl-filter/examples/example-rplot.md:
--------------------------------------------------------------------------------
1 | ---
2 | title: "pandoc-tcl-filter example - rplot filter"
3 | author:
4 | - Detlef Groth
5 | date: Fri Nov 29 2021
6 | abstract: >
7 | Some abstract ...
8 | on several lines...
9 | ---
10 |
11 | ## Introduction
12 |
13 | Below are a few samples for embedding R plotting code into Markdown documents.
14 | The examples should work as well in other text markup languages like LaTeX,
15 | Asciidoc etc. This filter requires a installation of the R software
16 | environment for statistical computing and graphics. The command Rscript must
17 | be in the PATH.
18 |
19 | Links:
20 |
21 | * R-Project page: [https://www.r-project.org]
22 |
23 | ## R plot example
24 |
25 | ```
26 | ```{.rplot label=iris echo=true}
27 | data(iris)
28 | pairs(iris[,1:3],pch=19,col=as.numeric(iris$Species)+1)
29 | ```
30 | ```
31 |
32 | Which will produce the following output:
33 |
34 | ```{.rplot label=iris echo=true}
35 | data(iris)
36 | pairs(iris[,1:3],pch=19,col=as.numeric(iris$Species)+1)
37 | ```
38 |
39 |
40 | ## Document creation
41 |
42 | Assuming that the file pandoc-tcl-filter.tapp is in your PATH,
43 | this document can be converted into an HTML file using the command line:
44 |
45 | ```
46 | pandoc -s -o sample-rplot.html --filter pandoc-tcl-filter.tapp sample.md
47 | ## you can as well specify a style sheet to beautify the output
48 | pandoc -s -o sample-rplot.html --css ghpandoc.css \
49 | --filter pandoc-tcl-filter.tapp sample.md
50 | ```
51 |
52 | ## EOF
53 |
54 |
55 |
56 |
--------------------------------------------------------------------------------
/pandoc-tcl-filter/examples/example-tcl.md:
--------------------------------------------------------------------------------
1 | ---
2 | title: "pandoc-tcl-filter example - tcl filter"
3 | author:
4 | - Detlef Groth
5 | date: Fri Nov 26 2021
6 | ---
7 |
8 | ## Introduction
9 |
10 | Below are a few samples for embedding Tcl code
11 | into Markdown documents. The examples should work as well in other text
12 | markup languages like LaTeX, Asciidoc etc. This filter requires no additional
13 | software installations, just a working Tcl installation.
14 |
15 | Links:
16 |
17 | * Tcl/Tk Homepage: [https://www.tcl.tk/](https://www.tcl.tk/)
18 | * Tcl filter documentation: [../filter/filter-tcl.html]
19 |
20 | ## Tcl examples
21 |
22 | Tcl code can be embedded either within single backtick marks where the first
23 | backtick is immediately followed by the string tcl and the the tcl code such
24 | as in the following example:
25 |
26 | ```
27 | The variable is now `tcl set x 5` or five times three is `tcl expr {3*5}`.
28 |
29 | This document was processed using Tcl `tcl package provide Tcl`.
30 |
31 | ```
32 |
33 | Here the output:
34 |
35 | The variable is now `tcl set x 5` or five times three is `tcl expr {3*5}`.
36 |
37 | This document was processed using Tcl `tcl package provide Tcl`.
38 |
39 |
40 | The results from the code execution will be directly embedded in the text and will replace the Tcl code.
41 | Such inline statements should be short and concise and should not break over
42 | several lines.
43 |
44 | Larger chunks of code can be placed within triple backticks such as in the example below.
45 |
46 | ```
47 | ` ``{.tcl}
48 | # please remove the space after the first backtick above
49 | set x 3
50 | proc add {x y} {
51 | return [expr {$x+$y}]
52 | }
53 | add $x 7
54 | # please remove the space after the first backtick below
55 | ` ``
56 | ```
57 |
58 | In the code above a space was added to avoid confusing the pandoc interpreter
59 | by nesteding triple tickmarks, remove those spaces in your code.
60 |
61 | And here the output:
62 |
63 | ```{.tcl}
64 | set x 3
65 | proc add {x y} {
66 | return [expr {$x+$y}]
67 | }
68 | add $x 7
69 | ```
70 |
71 | ## Table examples
72 |
73 | Since version 0.5.0 the Tcl filter contains a prcedure *list2mdtab* which can
74 | be used to display easily nested and unnested lists. The function get's two
75 | arguments, first the column headers, second the values. Here two examples:
76 | First a unnested list:
77 |
78 | ```{.tcl results="asis"}
79 | list2mdtab [list Col1 Col2 Col3] [list 1 2 3 4 5 6 7 8 9]
80 | ```
81 |
82 | Thereafter let's show a nested list example.
83 |
84 | ```{.tcl results="asis"}
85 | list2mdtab [list Col1 Col2 Col3] [list [list 11 12 13] [list 14 15 16] [list 17 18 19]]
86 | ```
87 |
88 |
89 | ## Document creation
90 |
91 | Assuming that the file pandoc-tcl-filter.tapp is in your PATH,
92 | this document can be converted into an HTML file using the command line:
93 |
94 | ```
95 | pandoc -s -o sample-tcl.html --filter pandoc-tcl-filter.tapp sample.md
96 | ## you can as well specify a style sheet to beautify the output
97 | pandoc -s -o sample-tcl.html --css ghpandoc.css \
98 | --filter pandoc-tcl-filter.tapp sample.md
99 | ```
100 |
101 |
102 |
103 | ## EOF
104 |
105 |
106 |
107 |
--------------------------------------------------------------------------------
/pandoc-tcl-filter/examples/example-tdot.md:
--------------------------------------------------------------------------------
1 | ---
2 | title: "pandoc-tcl-filter example - tsvg filter"
3 | author:
4 | - Detlef Groth
5 | date: Fri Nov 26 17:12:38 2021
6 | ---
7 |
8 | ## Introduction
9 |
10 | Below are a few samples for embedding code for the Tcl *tsvg* package
11 | into Markdown documents. The examples should work as well in other text
12 | markup languages like LaTeX, Asciidoc etc. This filter requires no additonal
13 | software installations as the package and the filter are directly included in the
14 | *pandoc-tcl-filter* release.
15 |
16 | Links:
17 |
18 | * DGTcl Homepage: [https://github.com/mittelmark/DGTcl](https://github.com/mittelmark/DGTcl)
19 | * tsvg guide: [http://htmlpreview.github.io/?https://github.com/mittelmark/DGTcl/blob/master/pandoc-tcl-filter/lib/tsvg/tsvg.html](http://htmlpreview.github.io/?https://github.com/mittelmark/DGTcl/blob/master/pandoc-tcl-filter/lib/tsvg/tsvg.html)
20 |
21 | ## Dot graph
22 |
23 | ```
24 | ` ``{.tsvg label=tsvg-hello-world results=hide echo=false}
25 | tsvg circle cx 50 cy 50 r 45 stroke black stroke-width 2 fill salmon
26 | tsvg text x 29 y 45 Hello
27 | tsvg text x 26 y 65 World!
28 | ` ```
29 | ```
30 |
31 | Will produce this:
32 |
33 | ```{.tsvg fig=true label=tsvg-hello-world results=hide echo=true}
34 | tsvg circle cx 50 cy 50 r 45 stroke black stroke-width 2 fill salmon
35 | tsvg text x 29 y 45 Hello
36 | tsvg text x 26 y 65 World!
37 | ```
38 |
39 | ## Document creation
40 |
41 | Assuming that the file pandoc-tcl-filter.tapp is in your PATH,
42 | this document can be converted into an HTML file using the command line:
43 |
44 | ```
45 | pandoc -s -o sample-dot.html --filter pandoc-tcl-filter.tapp sample.md
46 | ## you can as well specify a style sheet to beatify the output
47 | pandoc -s -o sample-dot.html --css ghpandoc.css \
48 | --filter pandoc-tcl-filter.tapp sample.md
49 | ```
50 |
51 |
52 |
53 | ## EOF
54 |
55 |
56 |
57 |
--------------------------------------------------------------------------------
/pandoc-tcl-filter/examples/example-tsvg.md:
--------------------------------------------------------------------------------
1 | ---
2 | title: "pandoc-tcl-filter example - tsvg filter"
3 | author:
4 | - Detlef Groth
5 | date: Fri Nov 26 2021
6 | ---
7 |
8 | ## Introduction
9 |
10 | Below are a few samples for embedding code for the Tcl tsvg package into
11 | Markdown documents. The examples should work as well in other text markup
12 | languages like LaTeX, Asciidoc etc. This filter requires no additional
13 | software installations as the package and the filter are directly included in
14 | the pandoc-tcl-filter release.
15 |
16 | Links:
17 |
18 | * DGTcl Homepage: [https://github.com/mittelmark/DGTcl](https://github.com/mittelmark/DGTcl)
19 | * tsvg guide: [http://htmlpreview.github.io/?https://github.com/mittelmark/DGTcl/blob/master/pandoc-tcl-filter/lib/tsvg/tsvg.html](http://htmlpreview.github.io/?https://github.com/mittelmark/DGTcl/blob/master/pandoc-tcl-filter/lib/tsvg/tsvg.html)
20 |
21 | ## tsvg graphics
22 |
23 | ```
24 | ` ``{.tsvg label=tsvg-hello-world results=hide echo=false}
25 | tsvg circle cx 50 cy 50 r 45 stroke black stroke-width 2 fill salmon
26 | tsvg text x 29 y 45 Hello
27 | tsvg text x 26 y 65 World!
28 | ` ```
29 | ```
30 |
31 | Will produce this:
32 |
33 | ```{.tsvg fig=true label=tsvg-hello-world results=hide echo=true}
34 | tsvg circle cx 50 cy 50 r 45 stroke black stroke-width 2 fill salmon
35 | tsvg text x 29 y 45 Hello
36 | tsvg text x 26 y 65 World!
37 | ```
38 |
39 | ## Document creation
40 |
41 | Assuming that the file pandoc-tcl-filter.tapp is in your PATH,
42 | this document can be converted into an HTML file using the command line:
43 |
44 | ```
45 | pandoc -s -o sample-tsvg.html --filter pandoc-tcl-filter.tapp sample.md
46 | ## you can as well specify a style sheet to beautify the output
47 | pandoc -s -o sample-tsvg.html --css ghpandoc.css \
48 | --filter pandoc-tcl-filter.tapp sample.md
49 | ```
50 |
51 |
52 |
53 | ## EOF
54 |
55 |
56 |
57 |
--------------------------------------------------------------------------------
/pandoc-tcl-filter/examples/header.html:
--------------------------------------------------------------------------------
1 |
2 | Documentation:
3 | filter-abc - filter-cmd - filter-dot - filter-eqn - filter-mmd - filter-mtex - filter-pic - filter-pik - filter-pipe filter-puml - filter-rplot - filter-sqlite - filter-tcrd - filter-tcl - filter-tdot - filter-tsvg
4 | Other Examples: dot - mtex - pic - pikchr - rplot - tcl - tsvg
5 | Filter documentation:
6 | pandoc-tcl-filter - Readme
7 |
8 |
--------------------------------------------------------------------------------
/pandoc-tcl-filter/examples/header.md:
--------------------------------------------------------------------------------
1 |
2 | Documentation:
3 |
4 | [filter-abc](../filter/filter-abc.html) -
5 | [filter-cmd](../filter/filter-cmd.html) -
6 | [filter-dot](../filter/filter-dot.html) -
7 | [filter-eqn](../filter/filter-eqn.html) -
8 | [filter-mmd](../filter/filter-mmd.html) -
9 | [filter-mtex](../filter/filter-mtex.html) -
10 | [filter-pic](../filter/filter-pic.html) -
11 | [filter-pik](../filter/filter-pik.html) -
12 | [filter-pipe](../filter/filter-pipe.html)
13 | [filter-puml](../filter/filter-puml.html) -
14 | [filter-rplot](../filter/filter-rplot.html) -
15 | [filter-sqlite](../filter/filter-sqlite.html) -
16 | [filter-tcrd](../filter/filter-tcrd.html) -
17 | [filter-tcl](../filter/filter-tcl.html) -
18 | [filter-tdot](../filter/filter-tdot.html) -
19 | [filter-tsvg](../filter/filter-tsvg.html)
20 |
21 | Other Examples:
22 | [dot](example-dot.html) -
23 | [mtex](example-mtex.html) -
24 | [pic](example-pic.html) -
25 | [pikchr](example-pik.html) -
26 | [rplot](example-rplot.html) -
27 | [tcl](example-tcl.html) -
28 | [tsvg](example-tsvg.html)
29 |
30 | Filter documentation:
31 | [pandoc-tcl-filter](../pandoc-tcl-filter.html) -
32 | [Readme](../Readme.html)
33 |
34 |
--------------------------------------------------------------------------------
/pandoc-tcl-filter/figsample.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/pandoc-tcl-filter/filter/Makefile:
--------------------------------------------------------------------------------
1 |
2 | filter-docs: filter-abc.html \
3 | filter-cmd.html \
4 | filter-dot.html \
5 | filter-eqn.html \
6 | filter-kroki.html \
7 | filter-mmd.html \
8 | filter-mtex.html \
9 | filter-pic.html \
10 | filter-pik.html \
11 | filter-pipe.html \
12 | filter-puml.html \
13 | filter-rplot.html \
14 | filter-sqlite.html \
15 | filter-tcl.html \
16 | filter-tcrd.html \
17 | filter-tdot.html \
18 | filter-tsvg.html
19 |
20 | %.html: %.tcl mini.css
21 | pandoc header.md -o header.html
22 | # -B header.html.md
23 | pandoc-tcl-filter.tapp $< temp.html -s --css mini.css \
24 | -M date="`date +"%b %d, %Y"`"
25 | htmlark temp.html -o `basename $< .tcl`.html
26 | rm temp.html
27 |
--------------------------------------------------------------------------------
/pandoc-tcl-filter/filter/filter-abc.tcl:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mittelmark/DGTcl/22b7cfc904010871af024dd348f8cb2b7d30b662/pandoc-tcl-filter/filter/filter-abc.tcl
--------------------------------------------------------------------------------
/pandoc-tcl-filter/filter/filter-eqn.tcl:
--------------------------------------------------------------------------------
1 | #' ---
2 | #' title: "filter-eqn.tcl documentation"
3 | #' author: "Detlef Groth, Caputh-Schwielowsee, Germany"
4 | #' date: 2021-11-20
5 | #' pik:
6 | #' app: eqn2graph
7 | #' imagepath: images
8 | #' ext: png
9 | #' ---
10 | # a simple pandoc filter using Tcl
11 | # the script pandoc-tcl-filter.tcl
12 | # must be in the in the parent directory of the filter directory
13 | #'
14 | #' ------
15 | #'
16 | #' ```{.tcl results="asis" echo=false}
17 | #' include header.md
18 | #' ```
19 | #'
20 | #' ------
21 | #'
22 | #' ## Name
23 | #'
24 | #' _filter-eqn.tcl_ - Filter which can be used to render eqn data within a Pandoc processed
25 | #' document using the Tcl filter driver `pandoc-tcl-filter.tcl`.
26 | #'
27 | #' ## Usage
28 | #'
29 | #' The conversion of the Markdown documents via Pandoc should be done as follows:
30 | #'
31 | #' ```
32 | #' pandoc input.md --filter pandoc-tcl-filter.tcl -s -o output.html
33 | #' ```
34 | #'
35 | #' The file `filter-eqn.tcl` is not used directly but sourced automatically by the `pandoc-tcl-filter.tcl` file.
36 | #' If code blocks with the `.eqn` marker are found, the contents in the code block is processed
37 | #' via the *eqn2graph* equation tool [https://man7.org/linux/man-pages/man1/eqn2graph.1.html](https://man7.org/linux/man-pages/man1/eqn2graph.1.html) which converts
38 | #' convert an eqn equation into a cropped PGN image, see [https://en.wikipedia.org/wiki/Eqn_(software)](https://en.wikipedia.org/wiki/Eqn_(software)) into some graphics format like png or other file formats which can be converted by the the ImageMagick tool *convert*.
39 | #'
40 | #' The following options can be given via code chunks or in the YAML header.
41 | #'
42 | #' - app - the application to process the eqn code, default: eqn2graph
43 | #' - ext - file file extension, can be png or pdf, default: png
44 | #' - imagepath - output imagepath, default: images
45 | #' - include - should the created image be automatically included, default: true
46 | #' - results - should the output of the command line application been shown, should be show or hide, default: hide
47 | #' - eval - should the code in the code block be evaluated, default: true
48 | #' - fig - should a figure be created, default: true
49 | #'
50 | #' To change the defaults the YAML header can be used. Here an example to change the
51 | #' default the image output path to nfigures
52 | #'
53 | #' ```
54 | #' ----
55 | #' title: "filter-eqn example"
56 | #' author: "Detlef Groth, Caputh-Schwielowsee, Germany"
57 | #' date: 2021-11-20
58 | #' eqn:
59 | #' imagepath: nfigures
60 | #' ----
61 | #' ```
62 | #'
63 | #' ## Examples
64 | #'
65 | #' Here an example for a simple neat undirected graph:
66 | #'
67 | #' ```{.eqn}
68 | #' x = {-b +- sqrt{b sup 2 - 4ac}} over 2a
69 | #' ```
70 | #'
71 | #' Here some more simple examples:
72 | #'
73 | #' ```{.eqn}
74 | #' x = 1 over 2
75 | #' ```
76 | #'
77 | #' ```{.eqn}
78 | #' y = 2 x sup 2 + 4x - 2
79 | #' ```
80 | #'
81 | #' ```{.eqn}
82 | #' y = 4 times sin(x) - cos sup 2 (x)
83 | #' ```
84 | #'
85 | #' Size can be changed using density: {.eqn density=144}:
86 | #'
87 | #' ```{.eqn density=144}
88 | #' s = sqrt { { sum from i=1 to inf ( x sub i - x bar ) sup 2 } over { N - 1 } }
89 | #' ```
90 | #'
91 | #' Higher density: {.eqn density=300}:
92 | #'
93 | #' ```{.eqn density=300}
94 | #' s = sqrt { { sum from i=1 to inf ( x sub i - x bar ) sup 2 } over { N - 1 } }
95 | #' ```
96 | #'
97 | #' Slightly vetter quality can be achieved by using high density and rescaling the image using Markdown syntax rescaling back to a smaller figure:
98 | #'
99 | #' ```
100 | #' ```{.eqn label=highq density=600 include=false}
101 | #' s = sqrt { { sum from i=1 to inf ( x sub i - x bar ) sup 2 } over { N - 1 } }
102 | #' ```
103 | #'
104 | #' {#id width=200px}
105 | #' ```
106 | #'
107 | #' Here the results:
108 | #'
109 | #' ```{.eqn label=highq density=600 include=false}
110 | #' s = sqrt { { sum from i=1 to inf ( x sub i - x bar ) sup 2 } over { N - 1 } }
111 | #' ```
112 | #'
113 | #' {#id width=200px}
114 | #'
115 | #' ## See also:
116 | #'
117 | #' * [pandoc-tcl-filter Readme](../Readme.html)
118 | #' * [pandoc-tcl-filter documentation](../pandoc-tcl-filter.html)
119 | #' * [Unix Text Processing - EQN chapter](https://www.oreilly.com/library/view/unix-text-processing/9780810462915/Chapter09.html#ch9)
120 | #' * [PIC filter](filter-pic.html)
121 | #' * [LaTeX Math filter](filter-mtex.html)
122 | #'
123 |
124 |
125 | proc filter-eqn {cont dict} {
126 | global n
127 | incr n
128 | set def [dict create results show eval true fig true width 0 height 0 \
129 | include true imagepath images app eqn2graph label null ext png \
130 | border 15 density 300 background white]
131 | set dict [dict merge $def $dict]
132 | if {[auto_execok eqn2graph] eq ""} {
133 | return [list "Error: This filter requires the command line tool eqn2graph, please install it!" ""]
134 | }
135 | set ret ""
136 | set owd [pwd]
137 | if {[dict get $dict label] eq "null"} {
138 | set fname [file join $owd [dict get $dict imagepath] eqn-$n]
139 | } else {
140 | set fname [file join $owd [dict get $dict imagepath] [dict get $dict label]]
141 | }
142 | if {![file exists [file join $owd [dict get $dict imagepath]]]} {
143 | file mkdir [file join $owd [dict get $dict imagepath]]
144 | }
145 | set out [open $fname.eqn w 0600]
146 | puts $out $cont
147 | close $out
148 | # TODO: error catching
149 | set res [exec cat $fname.eqn | [dict get $dict app] -density [dict get $dict density] \
150 | -format [dict get $dict ext] -background [dict get $dict background] \
151 | -bordercolor [dict get $dict background] -alpha off -colorspace RGB \
152 | -border [dict get $dict border] > $fname.[dict get $dict ext]]
153 | if {[dict get $dict results] eq "show"} {
154 | # should be usually empty
155 | set res $res
156 | } else {
157 | set res ""
158 | }
159 | if {[dict get $dict ext] ni [list "pdf" "png"]} {
160 | return [list "Error: unkown extension name '[dict get $dict ext]', valid values are pdf, png" ""]
161 | }
162 | set img ""
163 | if {[dict get $dict fig]} {
164 | if {[dict get $dict include]} {
165 | set img $fname.[dict get $dict ext]
166 | }
167 | }
168 | return [list $res $img]
169 | }
170 |
--------------------------------------------------------------------------------
/pandoc-tcl-filter/filter/filter-mmd.tcl:
--------------------------------------------------------------------------------
1 | #' ---
2 | #' title: "filter-mmd.tcl documentation"
3 | #' author: "Detlef Groth, Caputh-Schwielowsee, Germany"
4 | #' date: 2021-12-11
5 | #' mmd:
6 | #' app: mmdc
7 | #' imagepath: images
8 | #' ext: png
9 | #' ---
10 | # a simple pandoc filter using Tcl
11 | # the script pandoc-tcl-filter.tcl
12 | # must be in the in the parent directory of the filter directory
13 | #'
14 | #' ------
15 | #'
16 | #' ```{.tcl results="asis" echo=false}
17 | #' include header.md
18 | #' ```
19 | #'
20 | #' ------
21 | #'
22 | #' ## Name
23 | #'
24 | #' _filter-mmd.tcl_ - Filter which can be used to display [Mermaid](https://mermaid-js.github.io)
25 | #' diagram files within a Pandoc processed document using the Tcl filter driver `pandoc-tcl-filter.tcl`.
26 | #'
27 | #' ## Usage
28 | #'
29 | #' The conversion of the Markdown documents via Pandoc should be done as follows:
30 | #'
31 | #' ```
32 | #' pandoc input.md --filter pandoc-tcl-filter.tcl -s -o output.html
33 | #' ```
34 | #'
35 | #' The file `filter-mmd.tcl` is not used directly but sourced automatically by the `pandoc-tcl-filter.tcl` file.
36 | #' If code blocks with the `.mmd` marker are found, the contents in the code block is processed via one of the Mermaid command line tool. To install this command line tool have
37 | #' a look at: [https://github.com/mermaid-js/mermaid-cli](https://github.com/mermaid-js/mermaid-cli)
38 | #'
39 | #' The following options can be given via code chunks or in the YAML header.
40 | #'
41 | #' >
42 | #' - app - the application to be called, such as mmdc, default: mmdc
43 | #' - background - the background color such as transparent, salmon '#ccffff' (only used for png output), default: white
44 | #' - eval - should the code in the code block be evaluated, default: true
45 | #' - ext - file file extension, can be svg, png, pdf, default: svg
46 | #' - fig - should a figure be created, default: true
47 | #' - height - the image height, default: 600
48 | #' - imagepath - output imagepath, default: images
49 | #' - include - should the created image be automatically included, default: true
50 | #' - results - should the output of the command line application been shown, should be show or hide, default: hide
51 | #' - theme - the image them which can be used, should be either default, forest, dark, default: default
52 | #' - width - the image width, default: 800
53 | #'
54 | #' The options fig, results, include should be normally not used, they are here just for
55 | #' compatibility reasons with the other filters.
56 | #'
57 | #' To change the defaults the YAML header can be used. Here an example to change the
58 | #' default command line application to mmdc-8.10 and the image output path to nfigures
59 | #' and the output image format to png.
60 | #'
61 | #' ```
62 | #' ----
63 | #' title: "filter-mmd.tcl documentation"
64 | #' author: "Detlef Groth, Caputh-Schwielowsee, Germany"
65 | #' date: 2021-12-11
66 | #' mmd:
67 | #' app: mmdc-8.10
68 | #' imagepath: nfigures
69 | #' ext: png
70 | #' ----
71 | #' ```
72 | #'
73 | #' ## Examples
74 | #'
75 | #' Here an example for a simple flowchart:
76 | #'
77 | #' ```{.mmd}
78 | #' graph TD;
79 | #' A-->B;
80 | #' A-->C;
81 | #' B-->D;
82 | #' C-->D;
83 | #' ```
84 | #'
85 | #' Next an example for a sequence diagram with the forest theme and cornsilk background:
86 | #'
87 | #' ```{.mmd theme=forest background=cornsilk}
88 | #' sequenceDiagram
89 | #' participant Alice
90 | #' participant Bob
91 | #' Alice->>John: Hello John, how are you?
92 | #' loop Healthcheck
93 | #' John->>John: Fight against hypochondria
94 | #' end
95 | #' Note right of John: Rational thoughts prevail!
96 | #' John-->>Alice: Great!
97 | #' John->>Bob: How about you?
98 | #' Bob-->>John: Jolly good!
99 | #' ```
100 | #'
101 | #' ## See also:
102 | #'
103 | #' * [pandoc-tcl-filter Readme](../Readme.html)
104 | #' * [GraphViz Filter](filter-dot.html)
105 | #' * [Pikchr Filter](filter-pik.html)
106 | #' * [PlantUML filter](filter-puml.html)
107 | #'
108 |
109 |
110 | proc filter-mmd {cont dict} {
111 | global n
112 | incr n
113 | set def [dict create results show eval true fig true width 800 height 600 \
114 | include true imagepath images app mmdc label null ext svg theme default background white]
115 | set dict [dict merge $def $dict]
116 | set ret ""
117 | if {[auto_execok [dict get $dict app]] == ""} {
118 | return [list "Error: Command line tool [dict get $dict app] is not installed!" ""]
119 | }
120 | set owd [pwd]
121 | if {[dict get $dict label] eq "null"} {
122 | set fname [file join $owd [dict get $dict imagepath] mmd-$n]
123 | } else {
124 | set fname [file join $owd [dict get $dict imagepath] [dict get $dict label]]
125 | }
126 | if {![file exists [file join $owd [dict get $dict imagepath]]]} {
127 | file mkdir [file join $owd [dict get $dict imagepath]]
128 | }
129 | set out [open $fname.mmd w 0600]
130 | puts $out $cont
131 | close $out
132 | # TODO: error catching
133 | set res [exec [dict get $dict app] -i $fname.mmd -o $fname.[dict get $dict ext] \
134 | -w [dict get $dict width] -H [dict get $dict height] -t [dict get $dict theme] \
135 | -b [dict get $dict background]]
136 | if {[dict get $dict results] eq "show"} {
137 | # should be usually empty
138 | set res $res
139 | } else {
140 | set res ""
141 | }
142 | set img ""
143 | if {[dict get $dict fig]} {
144 | if {[dict get $dict include]} {
145 | set img $fname.[dict get $dict ext]
146 | }
147 | }
148 | return [list $res $img]
149 | }
150 |
--------------------------------------------------------------------------------
/pandoc-tcl-filter/filter/filter-rplot.tcl:
--------------------------------------------------------------------------------
1 | #' ---
2 | #' title: "filter-rplot.tcl documentation"
3 | #' author: "Detlef Groth, Caputh-Schwielowsee, Germany"
4 | #' date: 2021-11-29
5 | #' rplot:
6 | #' app: Rscript
7 | #' imagepath: figures
8 | #' ext: png
9 | #' ---
10 | #'
11 | #' ------
12 | #'
13 | #' ```{.tcl results="asis" echo=false}
14 | #' include header.md
15 | #' ```
16 | #'
17 | #' ------
18 | #'
19 | #' ## Name
20 | #'
21 | #' _filter-rplot.tcl_ - Filter which can be used to display R plots
22 | #' within a Pandoc processed document using the Tcl filter driver
23 | #' `pandoc-tcl-filter.tcl`.
24 | #'
25 | #' ## Usage
26 | #'
27 | #' The conversion of the Markdown documents via Pandoc should be done as follows:
28 | #'
29 | #' ```
30 | #' pandoc input.md --filter pandoc-tcl-filter.tcl -s -o output.html
31 | #' ```
32 | #'
33 | #' The file `filter-rplot.tcl` is not used directly but sourced automatically by the `pandoc-tcl-filter.tcl` file.
34 | #' If code blocks with the `.rplot` marker are found, the contents in the code block is
35 | #' processed via the Rscript interpreter which must be executable directly. If the interpreter is not in the PATH
36 | #' you might add the application path in your yaml header as shown below.
37 | #'
38 | #'
39 | #' The following options can be given via code chunks options or as defaults in the YAML header.
40 | #'
41 | #' > - app - the application to be called, default: Rscript
42 | #' - eval - should the code in the code block be evaluated, default: true
43 | #' - ext - file file extension, can be png or pdf, default: png
44 | #' - fig - should a figure be created, default: true
45 | #' - imagepath - output imagepath, default: images
46 | #' - include - should the created image be automatically included, default: true
47 | #' - label - the code chunk label used as well for the image name, default: null
48 | #' - results - should the output of the command line application been shown, should be show or hide, default: hide
49 | #'
50 | #' To change the defaults the YAML header can be used. Here an example to change the
51 | #' default Rscript interpreter, the image output path to nfigures and the file extension to pdf
52 | #' (useful for Pdf output of the document).
53 | #'
54 | #' ```
55 | #' ----
56 | #' title: "filter-rplot.tcl documentation"
57 | #' author: "Detlef Groth, Caputh-Schwielowsee, Germany"
58 | #' date: 2021-11-29
59 | #' rplot:
60 | #' app: /path/to/Rscript
61 | #' imagepath: nfigures
62 | #' ext: pdf
63 | #' ----
64 | #' ```
65 | #'
66 | #' ## Examples
67 | #'
68 | #' Here an example for a pairsplot graph:
69 | #'
70 | #' ```
71 | #' ```{.rplot}
72 | #' data(iris)
73 | #' pairs(iris[,1:3],col=as.numeric(iris$Species)+1,pch=19)
74 | #' ```
75 | #' ```
76 | #'
77 | #' And here is the output:
78 | #'
79 | #' ```{.rplot}
80 | #' data(iris)
81 | #' pairs(iris[,1:3],col=as.numeric(iris$Species)+1,pch=19)
82 | #' ```
83 | #'
84 | #' To supress the message line you can add results="hide" as chunk option like this: `{.rplot results="hide"}`
85 | #'
86 | #' ```{.rplot results="hide"}
87 | #' boxplot(iris$Sepal.Length ~ iris$Species,col=2:4)
88 | #' ```
89 | #'
90 | #' ## See also:
91 | #'
92 | #' * [pandoc-tcl-filter Readme](../Readme.html)
93 | #'
94 |
95 |
96 | proc filter-rplot {cont dict} {
97 | global n
98 | global rplotx
99 | if {[info exists rplotx]} {
100 | incr rplotx
101 | } else {
102 | set rplotx 0
103 | }
104 | incr n
105 | set def [dict create results show eval true fig true width 600 height 600 \
106 | include true imagepath images app Rscript label null ext png]
107 | set dict [dict merge $def $dict]
108 | set ret ""
109 | set owd [pwd]
110 | if {[dict get $dict label] eq "null"} {
111 | set fname [file join $owd [dict get $dict imagepath] rplot-$n]
112 | } else {
113 | set fname [file join $owd [dict get $dict imagepath] [dict get $dict label]]
114 | }
115 | if {![file exists [file join $owd [dict get $dict imagepath]]]} {
116 | file mkdir [file join $owd [dict get $dict imagepath]]
117 | }
118 | set out [open ${fname}.R w 0600]
119 | if {$rplotx == 0} {
120 | if {[file exists ".RData"]} {
121 | file delete .RData
122 | }
123 | }
124 | if {[file exists .RData]} {
125 | puts $out "load('.RData')"
126 | }
127 | if {[dict get $dict fig]} {
128 | set imgfile ${fname}.[dict get $dict ext]
129 | puts $out "[dict get $dict ext]('$imgfile' , width=[dict get $dict width] , height=[dict get $dict height]);"
130 | puts $out $cont
131 | puts $out "dev.off()"
132 | } else {
133 | puts $out $cont
134 | }
135 | puts $out "save.image(file='.RData')"
136 | close $out
137 | # TODO: error catching
138 | if {[dict get $dict eval]} {
139 | set res [exec [dict get $dict app] ${fname}.R]
140 | } else {
141 | set res ""
142 | }
143 | if {[dict get $dict results] eq "show"} {
144 | set res $res
145 | } else {
146 | set res ""
147 | }
148 | set img ""
149 | if {[dict get $dict fig]} {
150 | if {[dict get $dict include]} {
151 | set img $imgfile
152 | }
153 | }
154 | return [list $res $img]
155 | }
156 |
--------------------------------------------------------------------------------
/pandoc-tcl-filter/filter/filter-sqlite.tcl:
--------------------------------------------------------------------------------
1 | #' ---
2 | #' title: "filter-sqlite.tcl documentation"
3 | #' author: "Detlef Groth, Caputh-Schwielowsee, Germany"
4 | #' date: 2021-12-12
5 | #' sqlite:
6 | #' app: sqlite3
7 | #' mode: markdown
8 | #' ---
9 | #'
10 | # a simple pandoc filter using Tcl the script pandoc-tcl-filter.tcl
11 | # must be in the in the parent directory of the filter directory
12 | #'
13 | #' ------
14 | #'
15 | #' ```{.tcl results="asis" echo=false}
16 | #' include header.md
17 | #' ```
18 | #'
19 | #' ------
20 | #'
21 | #' ## Name
22 | #'
23 | #' _filter-sqlite.tcl_ - Filter which can be used to execute SQLite3 statements within a Pandoc processed
24 | #' document using the Tcl filter driver `pandoc-tcl-filter.tcl` and showing the output.
25 | #'
26 | #' ## Usage
27 | #'
28 | #' The conversion of the Markdown documents via Pandoc should be done as follows:
29 | #'
30 | #' ```
31 | #' pandoc input.md --filter pandoc-tcl-filter.tcl -s -o output.html
32 | #' ```
33 | #'
34 | #' The file `filter-sqlite.tcl` is not used directly but sourced automatically by the `pandoc-tcl-filter.tcl` file.
35 | #' If code blocks with the `.sqlite` marker are found, the contents in the code block is processed via the sqlite3
36 | #' command line application which must be in the path.
37 | #'
38 | #' The following options can be given via code chunks or in the YAML header.
39 | #'
40 | #' > - app - the application to be called, such as sqlite3, default: sqlite3
41 | #' - results - should the output of the command line application been shown, should be asis, show or hide, default: asis
42 | #' - eval - should the code in the code block be evaluated, default: true
43 | #' - mode - the output mode, default: markdown
44 | #'
45 | #' To change the defaults the YAML header can be used. Here an example to change the
46 | #' default command line application to sqlite3-35
47 | #'
48 | #' ```
49 | #' ----
50 | #' title: "filter-sqlite.tcl documentation"
51 | #' author: "Detlef Groth, Caputh-Schwielowsee, Germany"
52 | #' date: 2021-12-12
53 | #' sqlite:
54 | #' app: sqlite3-35
55 | #' ----
56 | #' ```
57 | #'
58 | #' ## Examples
59 | #'
60 | #' Here an example for a new database created on the fly and the we check for the created table ({.sqlite results="asis"}).
61 | #'
62 | #' ```{.sqlite results="asis"}
63 | #' CREATE TABLE contacts (
64 | #' contact_id INTEGER PRIMARY KEY,
65 | #' first_name TEXT NOT NULL,
66 | #' last_name TEXT NOT NULL,
67 | #' email TEXT NOT NULL UNIQUE,
68 | #' phone TEXT NOT NULL UNIQUE
69 | #' );
70 | #' INSERT INTO contacts (contact_id, first_name, last_name, email, phone)
71 | #' VALUES (1, "Max", "Musterman", "musterm@mail.de","1234");
72 | #' INSERT INTO contacts (contact_id, first_name, last_name, email, phone)
73 | #' VALUES (2, "Maxi", "Musterwoman", "musterw@mail.de","1235");
74 | #' select * from contacts;
75 | #' ```
76 | #'
77 | #' And here an example for a existing database ({.sqlite results="asis" file="uni.sqlite"}):
78 | #'
79 | #' ```{.sqlite results="asis" file="uni.sqlite"}
80 | #' select type,name from sqlite_master;
81 | #' ```
82 | #'
83 | #' Let's query the Student table ({.sqlite results="asis" file="uni.sqlite"}):
84 | #'
85 | #' ```{.sqlite results="asis" file="uni.sqlite"}
86 | #' select * from Student limit 5;
87 | #' ```
88 |
89 | #' ## See also:
90 | #'
91 | #' * [pandoc-tcl-filter Readme](../Readme.html)
92 | #' * [Pikchr filter](filter-pik.html)
93 | #' * [PlantUML filter](filter-puml.html)
94 | #'
95 |
96 |
97 | proc filter-sqlite {cont dict} {
98 | global n
99 | incr n
100 | set def [dict create results asis eval true file null \
101 | include true app sqlite3 label null mode markdown]
102 | set dict [dict merge $def $dict]
103 | set ret ""
104 | set owd [pwd]
105 | if {[auto_execok [dict get $dict app]] eq ""} {
106 | return [list "Error: [dict get $dict app] is not installed, please install it!" ""]
107 | }
108 | set version [exec [dict get $dict app] --version]
109 | if {[regexp {^3.[12]} $version] || [regexp {^3.3[0-2]} $version]} {
110 | return [list "Error: You need at least sqlite3 version 3.33 which supports Markdown mode!" ""]
111 | }
112 | if {[dict get $dict label] eq "null"} {
113 | set fname [file join $owd sqlite-$n]
114 | } else {
115 | set fname [file join $owd [dict get $dict label]]
116 | }
117 | set out [open $fname.sqlite w 0600]
118 | puts $out $cont
119 | close $out
120 |
121 | if {[dict get $dict file] eq "null"} {
122 | # TODO: error catching
123 | set res [exec cat $fname.sqlite | [dict get $dict app] -[dict get $dict mode]]
124 | } else {
125 | set res [exec cat $fname.sqlite | [dict get $dict app] [dict get $dict file] -[dict get $dict mode]]
126 | }
127 | if {[dict get $dict results] in [list show asis]} {
128 | # should be usually empty
129 | set res $res
130 | } else {
131 | set res ""
132 | }
133 | #puts stderr $res
134 | return [list $res ""]
135 | }
136 |
--------------------------------------------------------------------------------
/pandoc-tcl-filter/filter/filter-tdot.tcl:
--------------------------------------------------------------------------------
1 | #' ---
2 | #' title: "filter-tdot.tcl documentation"
3 | #' author: "Detlef Groth, Caputh-Schwielowsee, Germany"
4 | #' date: 2021-12-15
5 | #' tdot:
6 | #' imagepath: images
7 | #' ext: svg
8 | #' results: hide
9 | #' ---
10 | #'
11 | #' ------
12 | #'
13 | #' ```{.tcl results="asis" echo=false}
14 | #' include header.md
15 | #' ```
16 | #'
17 | #' ------
18 | #'
19 | #' ## Name
20 | #'
21 | #' _filter-tdot.tcl_ - Filter which can be used to display dot/neato diagrams
22 | #' within a Pandoc processed document using the Tcl library [tdot](https://github.com/mittelmark/DGTcl).
23 | #' together with the pandoc-tcl-filter application.
24 | #'
25 | #' ## Usage
26 | #'
27 | #' The conversion of the Markdown documents via Pandoc should be done as follows:
28 | #'
29 | #' ```
30 | #' pandoc input.md --filter pandoc-tcl-filter.tcl -s -o output.html
31 | #' ```
32 | #'
33 | #' The file `filter-tdot.tcl` is not used directly but sourced automatically by the `pandoc-tcl-filter.tcl` file.
34 | #' If code blocks with the `.tdot` marker are found, the contents in the code block is
35 | #' processed via the Tcl interpreter using the embedded tdot library.
36 | #' The filter requires the installation of the GraphViz command line tools dot and neato. See here:
37 | #'
38 | #' The following options can be given via code chunks options or as defaults in the YAML header.
39 | #'
40 | #' > - eval - should the code in the code block be evaluated, default: true
41 | #' - ext - file file extension, can be svg, png or pdf, default: svg
42 | #' - fig - should a figure be created, default: true
43 | #' - imagepath - output imagepath, default: images
44 | #' - include - should the created image be automatically included, default: true
45 | #' - label - the code chunk label used as well for the image name, default: null
46 | #' - results - should the output of the command line application been shown, should be show or hide, default: hide
47 | #'
48 | #' To change the defaults the YAML header can be used. Here an example to change the
49 | #' the image output path to nfigures and the file extension to pdf
50 | #' (useful for Pdf output of the document as in LaTeX mode of pandoc). You should usually always change the
51 | #' options results: to hide.
52 | #'
53 | #' ```
54 | #' ----
55 | #' title: "filter-tdot.tcl documentation"
56 | #' author: "Detlef Groth, Caputh-Schwielowsee, Germany"
57 | #' date: 2021-12-15
58 | #' tdot:
59 | #' imagepath: nfigures
60 | #' ext: pdf
61 | #' results: hide
62 | #' ----
63 | #' ```
64 | #'
65 | #' ## Examples
66 | #'
67 | #' Here an example for a simple hello world image:
68 | #'
69 | #' ```
70 | #' ```{.tdot}
71 | #' tdot set type "strict digraph G"
72 | #' tdot graph margin=0.2
73 | #' tdot node width=1 height=0.7 style=filled fillcolor=salmon shape=box
74 | #' tdot block rank=same Hello World
75 | #' tdot addEdge Hello -> World
76 | #' ```
77 | #' ```
78 | #'
79 | #' And here is the output:
80 | #'
81 | #' ```{.tdot}
82 | #' tdot set type "strict digraph G"
83 | #' tdot graph margin=0.2
84 | #' tdot node width=1 height=0.7 style=filled fillcolor=salmon shape=box
85 | #' tdot block rank=same Hello World
86 | #' tdot addEdge Hello -> World
87 | #' ```
88 | #'
89 | #' Creating a new image needs cleanup of the current image using `tdot set code ""`,
90 | #' below we include a font which is only available on our local machine
91 | #' so we set the filetype to png like this: `{.tdot ext=png}`
92 | #'
93 | #' ```{.tdot}
94 | #' tdot set code ""
95 | #' tdot graph margin=0.2
96 | #' tdot node width=1 height=0.7
97 | #' tdot addEdge A -> B
98 | #' ```
99 | #'
100 | #' You might argue what is the advantage of the tdot package in contrast to writing directly dot code.
101 | #' The reason to use tdot would be to create dynamically your graphs using Tcl as the scripting language to do so.
102 | #' Here is an example:
103 | #'
104 | #' ```{.tdot}
105 | #' package require tdot
106 | #' tdot set code ""
107 | #' tdot set type "strict graph G"
108 | #'
109 | #' tdot graph margin=0.2
110 | #' tdot node width=0.5 height=0.5 \
111 | #' style=filled fillcolor=salmon shape=circle
112 | #' tdot node Hello fillcolor=salmon
113 | #' tdot node fillcolor=skyblue
114 | #' foreach a [list A B C D E F] {
115 | #' tdot addEdge Hello -- $a
116 | #' foreach b [list a b c] {
117 | #' tdot node $a$b fillcolor=cornsilk
118 | #' tdot addEdge $a -- $a$b
119 | #' }
120 | #' }
121 | #' ```
122 | #'
123 | #' Image you would to have the dot-code by hand ...
124 | #'
125 | #' ## See also:
126 | #'
127 | #' * [dot filter](filter-dot.html)
128 | #' * [pandoc-tcl-filter Readme](../Readme.html)
129 | #' * [pandoc-tcl-filter docu](../pandoc-tcl-filter.html)
130 | #' * [filter-view docu](../filter-view.html)
131 | #'
132 |
133 | package require tdot
134 | interp create tdoti
135 | set apath [tdoti eval { set auto_path } ]
136 | foreach d $auto_path {
137 | if {[lsearch $apath $d] == -1} {
138 | tdoti eval "lappend auto_path $d"
139 | }
140 | }
141 | tdoti eval "package require tdot"
142 | proc filter-tdot {cont dict} {
143 | global n
144 | incr n
145 | set def [dict create results hide eval true fig true width 100 height 100 \
146 | include true label null imagepath images ext svg]
147 | set dict [dict merge $def $dict]
148 | set ret ""
149 | set owd [pwd]
150 | if {[dict get $dict label] eq "null"} {
151 | set fname [file join $owd [dict get $dict imagepath] tdot-$n]
152 | } else {
153 | set fname [file join $owd [dict get $dict imagepath] [dict get $dict label]]
154 | }
155 | if {![file exists [file join $owd [dict get $dict imagepath]]]} {
156 | file mkdir [file join $owd [dict get $dict imagepath]]
157 | }
158 | # protect semicolons in attributes for ending a command
159 | set code [regsub -all {([^ ]);} $cont "\\1\\\\;"]
160 | if {[catch {
161 | set res2 [tdoti eval $code]
162 | }]} {
163 | set res2 "Error: [regsub {\n +invoked.+} $::errorInfo {}]"
164 | }
165 |
166 | if {[dict get $dict results] eq "show" && $res2 ne ""} {
167 | set res2 $res2
168 | } else {
169 | set res2 ""
170 | }
171 | set img ""
172 | set imgfile ${fname}.[dict get $dict ext]
173 | if {[dict get $dict fig]} {
174 | tdoti eval "tdot write $imgfile"
175 | if {[dict get $dict include]} {
176 | set img $imgfile
177 | } else {
178 | set img ""
179 | }
180 | }
181 | return [list $res2 $img]
182 | }
183 |
184 |
185 |
186 |
--------------------------------------------------------------------------------
/pandoc-tcl-filter/filter/filter-tsvg.tcl:
--------------------------------------------------------------------------------
1 | #' ---
2 | #' title: "filter-tsvg.tcl documentation"
3 | #' author: "Detlef Groth, Caputh-Schwielowsee, Germany"
4 | #' date: 2021-12-12
5 | #' tsvg:
6 | #' imagepath: images
7 | #' ext: svg
8 | #' results: hide
9 | #' ---
10 | #'
11 | #' ------
12 | #'
13 | #' ```{.tcl results="asis" echo=false}
14 | #' include header.md
15 | #' ```
16 | #'
17 | #' ------
18 | #'
19 | #' ## Name
20 | #'
21 | #' _filter-tsvg.tcl_ - Filter which can be used to display SVG graphics
22 | #' within a Pandoc processed document using the Tcl library [tsvg](https://github.com/mittelmark/DGTcl).
23 | #' together with the pandoc-tcl-filter application.
24 | #'
25 | #' ## Usage
26 | #'
27 | #' The conversion of the Markdown documents via Pandoc should be done as follows:
28 | #'
29 | #' ```
30 | #' pandoc input.md --filter pandoc-tcl-filter.tcl -s -o output.html
31 | #' ```
32 | #'
33 | #' The file `filter-tsvg.tcl` is not used directly but sourced automatically by the `pandoc-tcl-filter.tcl` file.
34 | #' If code blocks with the `.tsvg` marker are found, the contents in the code block is
35 | #' processed via the Tcl interpreter using the embedded tsvg library.
36 | #'
37 | #' The following options can be given via code chunks options or as defaults in the YAML header.
38 | #'
39 | #' > - eval - should the code in the code block be evaluated, default: true
40 | #' - ext - file file extension, can be svg, png or pdf, teh latter two require the command application
41 | #' cairsvg to be installed default: svg
42 | #' - fig - should a figure be created, default: true
43 | #' - imagepath - output imagepath, default: images
44 | #' - include - should the created image be automatically included, default: true
45 | #' - label - the code chunk label used as well for the image name, default: null
46 | #' - results - should the output of the command line application been shown, should be show or hide, default: show
47 | #'
48 | #' To change the defaults the YAML header can be used. Here an example to change the
49 | #' the image output path to nfigures and the file extension to pdf
50 | #' (useful for Pdf output of the document as in LaTeX mode of pandoc). You should usually always change the
51 | #' options results: to hide.
52 | #'
53 | #' ```
54 | #' ----
55 | #' title: "filter-tsvg.tcl documentation"
56 | #' author: "Detlef Groth, Caputh-Schwielowsee, Germany"
57 | #' date: 2021-12-12
58 | #' tsvg:
59 | #' imagepath: nfigures
60 | #' ext: pdf
61 | #' results: hide
62 | #' ----
63 | #' ```
64 | #'
65 | #' ## Examples
66 | #'
67 | #' Here an example for a simple hello world image:
68 | #'
69 | #' ```
70 | #' ```{.tsvg}
71 | #' tsvg set code "" ;# clear
72 | #' tsvg circle -cx 50 -cy 50 -r 45 -stroke black -stroke-width 2 -fill green
73 | #' tsvg text -x 29 -y 45 Hello
74 | #' tsvg text -x 27 -y 65 World!
75 | # ```
76 | #' ```
77 | #'
78 | #' And here is the output:
79 | #'
80 | #' ```{.tsvg}
81 | #' tsvg set code "" ;# clear
82 | #' tsvg circle -cx 50 -cy 50 -r 45 -stroke black -stroke-width 2 -fill green
83 | #' tsvg text -x 29 -y 45 Hello
84 | #' tsvg text -x 27 -y 65 World!
85 | #' ```
86 | #'
87 | #' Creating a new image needs cleanup of the current image using `tsvg set code ""`,
88 | #' below we include a font which is only available on our local machine
89 | #' so we set the filetype to png like this: `{.tsvg ext=png}`
90 | #'
91 | #' ```{.tsvg ext=png}
92 | #' tsvg set code ""
93 | #' tsvg set width 100
94 | #' tsvg set height 60
95 | #' tsvg rect -x 0 -y 0 -width 100 -height 100 -fill #F64935
96 | #' tsvg text -x 20 -y 40 -style "font-size:24px;fill:blue;font-family: Alegreya;" tSVG
97 | #' ```
98 | #'
99 | #' ## See also:
100 | #'
101 | #' * [pandoc-tcl-filter Readme](../Readme.html)
102 | #'
103 |
104 | package require tsvg
105 | interp create tsvgi
106 | set apath [tsvgi eval { set auto_path } ]
107 | foreach d $auto_path {
108 | if {[lsearch $apath $d] == -1} {
109 | tsvgi eval "lappend auto_path $d"
110 | }
111 | }
112 | tsvgi eval "package require tsvg"
113 | proc filter-tsvg {cont dict} {
114 | global n
115 | incr n
116 | set def [dict create results hide eval true fig true width 100 height 100 \
117 | include true label null imagepath images ext svg]
118 | set dict [dict merge $def $dict]
119 | set ret ""
120 | set owd [pwd]
121 | if {[dict get $dict label] eq "null"} {
122 | set fname [file join $owd [dict get $dict imagepath] tsvg-$n]
123 | } else {
124 | set fname [file join $owd [dict get $dict imagepath] [dict get $dict label]]
125 | }
126 | if {![file exists [file join $owd [dict get $dict imagepath]]]} {
127 | file mkdir [file join $owd [dict get $dict imagepath]]
128 | }
129 | # protect semicolons in attributes for ending a command
130 | set code [regsub -all {([^ ]);} $cont "\\1\\\\;"]
131 | if {[catch {
132 | set res2 [tsvgi eval $code]
133 | }]} {
134 | set res2 "Error: [regsub {\n +invoked.+} $::errorInfo {}]"
135 | }
136 |
137 | if {[dict get $dict results] eq "show" && $res2 ne ""} {
138 | set res2 $res2
139 | } else {
140 | set res2 ""
141 | }
142 | if {[dict get $dict ext] ni [list "pdf" "png" "svg"]} {
143 | return [list "Error: unkown extension name '[dict get $dict ext]', valid values are svg, pdf, png" ""]
144 | }
145 | if {[dict get $dict ext] in [list "pdf" "png"]} {
146 | if {[auto_execok cairosvg] eq ""} {
147 | return [list "Error: pdf and png conversion needs cairosvg, please install cairosvg https://www.cairosvg.org !" ""]
148 | }
149 | }
150 | set img ""
151 | set imgfile ${fname}.[dict get $dict ext]
152 | if {[dict get $dict fig]} {
153 | tsvgi eval "tsvg write $imgfile"
154 | if {[dict get $dict include]} {
155 | set img $imgfile
156 | } else {
157 | set img ""
158 | }
159 | }
160 | return [list $res2 $img]
161 | }
162 |
163 |
164 |
165 |
--------------------------------------------------------------------------------
/pandoc-tcl-filter/filter/header.md:
--------------------------------------------------------------------------------
1 |
2 | [filter-abc](filter-abc.html) -
3 | [filter-cmd](filter-cmd.html) -
4 | [filter-dot](filter-dot.html) -
5 | [filter-eqn](filter-eqn.html) -
6 | [filter-kroki](filter-mmd.html) -
7 | [filter-mmd](filter-mmd.html) -
8 | [filter-mtex](filter-mtex.html) -
9 | [filter-pic/dpic](filter-pic.html) -
10 | [filter-pik](filter-pik.html)
11 | [filter-pipe](filter-pipe.html) -
12 | [filter-puml](filter-puml.html) -
13 | [filter-rplot](filter-rplot.html) -
14 | [filter-sqlite](filter-sqlite.html) -
15 | [filter-tcl](filter-tcl.html) -
16 | [filter-tcrd](filter-tcrd.html) -
17 | [filter-tdot](filter-tdot.html) -
18 | [filter-tsvg](filter-tsvg.html)
19 |
20 | More examples:
21 | [dot](../examples/example-dot.html) -
22 | [mtex](../examples/example-mtex.html) -
23 | [pic](../examples/example-pic.html) -
24 | [pikchr](../examples/example-pik.html) -
25 | [rplot](../examples/example-rplot.html) -
26 | [tcl](../examples/example-tcl.html) -
27 | [tsvg](../examples/example-tsvg.html)
28 |
29 | Documentation: [Readme.html](../Readme.html) - [pandoc-tcl-filter.html](../pandoc-tcl-filter.html) - [filter-view.html](../filter-view.html)
30 |
31 |
32 |
33 |
--------------------------------------------------------------------------------
/pandoc-tcl-filter/filter/mini.css:
--------------------------------------------------------------------------------
1 | html {
2 | overflow-y: scroll;
3 | }
4 | body {
5 | color: #444;
6 | font-family: Georgia, Palatino, 'Palatino Linotype', Times,
7 | 'Times New Roman', serif;
8 | line-height: 1.2;
9 | padding: 1em;
10 | margin: auto;
11 | max-width: 1200px;
12 | }
13 | a {
14 | color: #0645ad;
15 | text-decoration: none;
16 | }
17 | a:visited {
18 | color: #0b0080;
19 | }
20 | a:hover {
21 | color: #06e;
22 | }
23 | a:active {
24 | color: #faa700;
25 | }
26 | a:focus {
27 | outline: thin dotted;
28 | }
29 | p {
30 | margin: 0.5em 0;
31 | }
32 | p.date {
33 | text-align: center;
34 | }
35 | img {
36 | max-width: 100%;
37 | }
38 |
39 | h1, h2, h3, h4, h5, h6 {
40 | color: #111;
41 | line-height: 115%;
42 | margin-top: 1em;
43 | font-weight: normal;
44 | }
45 | h1 {
46 | text-align: center;
47 | }
48 |
49 | h2 {
50 | text-transform: uppercase;
51 | }
52 | pre, blockquote pre {
53 | border-top: 0.1em #9ac solid;
54 | background: #e9f6ff;
55 | padding: 10px;
56 | border-bottom: 0.1em #9ac solid;
57 | }
58 |
59 | blockquote {
60 | margin: 0;
61 | padding-left: 3em;
62 | }
63 |
64 | hr {
65 | display: block;
66 | height: 2px;
67 | border: 0;
68 | border-top: 1px solid #aaa;
69 | border-bottom: 1px solid #eee;
70 | margin: 1em 0;
71 | padding: 0;
72 | }
73 |
74 | pre, code, kbd, samp {
75 | color: #000;
76 | font-family: Monaco, 'courier new', monospace;
77 | font-size: 90%;
78 | }
79 |
80 | pre {
81 | white-space: pre;
82 | white-space: pre-wrap;
83 | word-wrap: break-word;
84 | }
85 | /* fix, do not like bold for every keyword */
86 | code span.kw { color: #007020; font-weight: normal; } /* Keyword */
87 | pre.sourceCode {
88 | background: #fff6f6;
89 | }
90 | figure, p.author {
91 | text-align: center;
92 | }
93 | table {
94 | min-width: 300px;
95 | border-spacing: 0;
96 | border-collapse: collapse;
97 | cell-padding: 0px;
98 | cell-spacing: 0px;
99 | border-top: 2px solid black;
100 | border-bottom: 2px solid black;
101 | }
102 | tr.header {
103 | background: #dddddd;
104 | text-align: center;
105 | }
106 | tr.even {
107 | background: #ddeeff;
108 | }
109 | td, th {
110 | padding: 8px;
111 | text-align: center;
112 | }
113 |
--------------------------------------------------------------------------------
/pandoc-tcl-filter/filter/pkgIndex.tcl:
--------------------------------------------------------------------------------
1 | package ifneeded tclfilters 0.5.0 [list source [file join $dir tclfilters.tcl]]
2 |
--------------------------------------------------------------------------------
/pandoc-tcl-filter/filter/smallcaps.lua:
--------------------------------------------------------------------------------
1 | function Strong(elem)
2 | return pandoc.SmallCaps(elem.c)
3 | end
4 |
5 |
--------------------------------------------------------------------------------
/pandoc-tcl-filter/filter/tclfilters.tcl:
--------------------------------------------------------------------------------
1 | package require Tcl
2 |
3 | package provide tclfilters 0.5.0
4 |
5 | source [file join [file dirname [info script]] utils.tcl]
6 | source [file join [file dirname [info script]] filter-tcl.tcl]
7 | source [file join [file dirname [info script]] filter-abc.tcl]
8 | source [file join [file dirname [info script]] filter-cmd.tcl]
9 | source [file join [file dirname [info script]] filter-dot.tcl]
10 | source [file join [file dirname [info script]] filter-eqn.tcl]
11 | source [file join [file dirname [info script]] filter-kroki.tcl]
12 | source [file join [file dirname [info script]] filter-mmd.tcl]
13 | source [file join [file dirname [info script]] filter-mtex.tcl]
14 | source [file join [file dirname [info script]] filter-pic.tcl]
15 | source [file join [file dirname [info script]] filter-pik.tcl]
16 | source [file join [file dirname [info script]] filter-pipe.tcl]
17 | source [file join [file dirname [info script]] filter-puml.tcl]
18 | source [file join [file dirname [info script]] filter-rplot.tcl]
19 | source [file join [file dirname [info script]] filter-sqlite.tcl]
20 | source [file join [file dirname [info script]] filter-tcrd.tcl]
21 | source [file join [file dirname [info script]] filter-tdot.tcl]
22 | source [file join [file dirname [info script]] filter-tsvg.tcl]
23 |
24 |
--------------------------------------------------------------------------------
/pandoc-tcl-filter/filter/tikz-tree.tex:
--------------------------------------------------------------------------------
1 | \tikzset{
2 | treenode/.style = {shape=rectangle, rounded corners,
3 | draw, align=center,
4 | top color=white, bottom color=blue!20},
5 | root/.style = {treenode, font=\Large, bottom color=red!30},
6 | env/.style = {treenode, font=\ttfamily\normalsize},
7 | dummy/.style = {circle,draw}
8 | }
9 |
--------------------------------------------------------------------------------
/pandoc-tcl-filter/filter/utils.tcl:
--------------------------------------------------------------------------------
1 | proc getTempDir {} {
2 | if {[file exists /tmp]} {
3 | # standard UNIX
4 | return /tmp
5 | } elseif {[info exists ::env(TMP)]} {
6 | # Windows
7 | return $::env(TMP)
8 | } elseif {[info exists ::env(TEMP)]} {
9 | # Windows
10 | return $::env(TEMP)
11 | } elseif {[info exists ::env(TMPDIR)]} {
12 | # OSX
13 | return $::env(TMPDIR)
14 | }
15 | }
16 | # convert a chunk start to a dictionary
17 | # ```{.mtex packages="sudoku"}
18 | proc chunk2dict {line} {
19 | set dchunk [dict create]
20 | set ind ""
21 | regexp {```\{\.([a-zA-Z0-9]+)\s*(.*).*\}.*} $line -> filt options
22 | foreach {op} [split $options " "] {
23 | foreach {key val} [split $op "="] {
24 | set val [regsub -all {"} $val ""] ;#"
25 | dict set dchunk $key $val
26 | }
27 | }
28 | return $dchunk
29 | }
30 |
31 |
32 |
--------------------------------------------------------------------------------
/pandoc-tcl-filter/filter/xkcd.tex:
--------------------------------------------------------------------------------
1 | \usepackage{fontspec}
2 | \setmainfont{Humor Sans}
3 | \usepackage{tikz}
4 | \usetikzlibrary{calc,decorations,patterns,arrows,decorations.pathmorphing}
5 | \definecolor{pltblue}{HTML}{1F77B4}
6 |
7 | \makeatletter
8 | \pgfset{
9 | /pgf/decoration/randomness/.initial=2,
10 | /pgf/decoration/wavelength/.initial=100
11 | }
12 | \pgfdeclaredecoration{sketch}{init}{
13 | \state{init}[width=0pt,next state=draw,persistent precomputation={
14 | \pgfmathsetmacro\pgf@lib@dec@sketch@t0
15 | }]{}
16 | \state{draw}[width=\pgfdecorationsegmentlength,
17 | auto corner on length=\pgfdecorationsegmentlength,
18 | persistent precomputation={
19 | \pgfmathsetmacro\pgf@lib@dec@sketch@t{mod(\pgf@lib@dec@sketch@t+pow(\pgfkeysvalueof{/pgf/decoration/randomness},rand),\pgfkeysvalueof{/pgf/decoration/wavelength})}
20 | }]{
21 | \pgfmathparse{sin(2*\pgf@lib@dec@sketch@t*pi/\pgfkeysvalueof{/pgf/decoration/wavelength} r)}
22 | \pgfpathlineto{\pgfqpoint{\pgfdecorationsegmentlength}{\pgfmathresult\pgfdecorationsegmentamplitude}}
23 | }
24 | \state{final}{}
25 | }
26 | \tikzset{xkcd/.style={decorate,decoration={sketch,segment length=0.5pt,amplitude=0.5pt}}}
27 | \makeatother
28 |
29 | \pgfmathsetseed{1}
30 |
31 | \pagestyle{empty}
32 |
33 |
--------------------------------------------------------------------------------
/pandoc-tcl-filter/hello-world.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Hello
8 |
9 |
10 |
11 | World!
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/pandoc-tcl-filter/json-pretty.tcl:
--------------------------------------------------------------------------------
1 | ##############################################################################
2 | #
3 | # System :
4 | # Module :
5 | # Object Name : $RCSfile$
6 | # Revision : $Revision$
7 | # Date : $Date$
8 | # Author : $Author$
9 | # Created By : Dr. Detlef Groth
10 | # Created : Tue Aug 24 07:48:52 2021
11 | # Last Modified : <210824.0754>
12 | #
13 | # Description
14 | #
15 | # Notes
16 | #
17 | # History
18 | #
19 | ##############################################################################
20 | #
21 | # Copyright (c) 2021 Dr. Detlef Groth.
22 | #
23 | # All Rights Reserved.
24 | #
25 | # This document may not, in whole or in part, be copied, photocopied,
26 | # reproduced, translated, or reduced to any electronic medium or machine
27 | # readable form without prior written consent from Dr. Detlef Groth.
28 | #
29 | ##############################################################################
30 |
31 |
32 | lappend auto_path /home/groth/workspace/delfgroth/mytcl/libs
33 | package require rl_json
34 | # pandoc -s -t json dgtools/test.md > dgtools/test.json
35 | # tclsh dgtools/json-pretty.tcl < dgtools/test.json | less
36 | # cat dgtools/test.json | tclsh dgtools/filter.tcl | tclsh dgtools/json-pretty.tcl
37 | # pandoc dgtools/test.md -s --metadata title="test run with tcl filter" -o dgtools.html --filter dgtools/filter.tcl
38 | # read the JSON AST from stdin
39 | set jsonData {}
40 | while {[gets stdin line] > 0} {
41 | append jsonData $line
42 | }
43 |
44 | puts [rl_json::json pretty $jsonData]
45 |
--------------------------------------------------------------------------------
/pandoc-tcl-filter/lib/cmdline/pkgIndex.tcl:
--------------------------------------------------------------------------------
1 | if {![package vsatisfies [package provide Tcl] 8.2]} {return}
2 | package ifneeded cmdline 1.5 [list source [file join $dir cmdline.tcl]]
3 |
--------------------------------------------------------------------------------
/pandoc-tcl-filter/lib/dgw/pkgIndex.tcl:
--------------------------------------------------------------------------------
1 | # pkgIndex.tcl
2 | # mandatory packages
3 | package ifneeded dgw::dgw 0.7.0 [list source [file join $dir dgw.tcl]]
4 | package ifneeded dgw 0.7.0 [list source [file join $dir dgw.tcl]]
5 | package ifneeded dgw::basegui 0.3 [list source [file join $dir basegui.tcl]]
6 | package ifneeded dgw::combobox 0.2 [list source [file join $dir combobox.tcl]]
7 | package ifneeded dgw::dgwutils 0.3 [list source [file join $dir dgwutils.tcl]]
8 | package ifneeded dgw::drawcanvas 0.1 [list source [file join $dir drawcanvas.tcl]]
9 | package ifneeded dgw::sbuttonbar 0.6 [list source [file join $dir sbuttonbar.tcl]]
10 | package ifneeded dgw::seditor 0.3 [list source [file join $dir seditor.tcl]]
11 | package ifneeded dgw::sfinddialog 0.4 [list source [file join $dir sfinddialog.tcl]]
12 | package ifneeded dgw::statusbar 0.2 [list source [file join $dir statusbar.tcl]]
13 | package ifneeded dgw::tvmixins 0.3 [list source [file join $dir tvmixins.tcl]]
14 | package ifneeded dgw::txmixins 0.2.0 [list source [file join $dir txmixins.tcl]]
15 |
16 |
17 |
--------------------------------------------------------------------------------
/pandoc-tcl-filter/lib/dgw/statusbar.tcl:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mittelmark/DGTcl/22b7cfc904010871af024dd348f8cb2b7d30b662/pandoc-tcl-filter/lib/dgw/statusbar.tcl
--------------------------------------------------------------------------------
/pandoc-tcl-filter/lib/fview/pkgIndex.tcl:
--------------------------------------------------------------------------------
1 | package ifneeded fview 0.2 [list source [file join $dir filter-view.tcl]]
2 |
--------------------------------------------------------------------------------
/pandoc-tcl-filter/lib/markdown/pkgIndex.tcl:
--------------------------------------------------------------------------------
1 | package ifneeded Markdown 1.1 [list source [file join $dir markdown.tcl]]
2 |
--------------------------------------------------------------------------------
/pandoc-tcl-filter/lib/mkdoc/pkgIndex.tcl:
--------------------------------------------------------------------------------
1 | package ifneeded mkdoc 0.6.0 [list source [file join $dir mkdoc.tcl]]
2 | package ifneeded mkdoc::mkdoc 0.6.0 [list source [file join $dir mkdoc.tcl]]
3 |
--------------------------------------------------------------------------------
/pandoc-tcl-filter/lib/rl_json/librl_json0.11.0.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mittelmark/DGTcl/22b7cfc904010871af024dd348f8cb2b7d30b662/pandoc-tcl-filter/lib/rl_json/librl_json0.11.0.dll
--------------------------------------------------------------------------------
/pandoc-tcl-filter/lib/rl_json/librl_json0.11.0.so:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mittelmark/DGTcl/22b7cfc904010871af024dd348f8cb2b7d30b662/pandoc-tcl-filter/lib/rl_json/librl_json0.11.0.so
--------------------------------------------------------------------------------
/pandoc-tcl-filter/lib/rl_json/librl_json0.11.1.dylib:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mittelmark/DGTcl/22b7cfc904010871af024dd348f8cb2b7d30b662/pandoc-tcl-filter/lib/rl_json/librl_json0.11.1.dylib
--------------------------------------------------------------------------------
/pandoc-tcl-filter/lib/rl_json/mini.css:
--------------------------------------------------------------------------------
1 | html {
2 | overflow-y: scroll;
3 | }
4 | body {
5 | color: #444;
6 | font-family: Georgia, Palatino, 'Palatino Linotype', Times, 'Times New Roman', serif;
7 | line-height: 1.2;
8 | padding: 1em;
9 | margin: auto;
10 | max-width: 1200px;
11 | }
12 | a {
13 | color: #0645ad;
14 | text-decoration: none;
15 | }
16 | a:visited {
17 | color: #0b0080;
18 | }
19 | a:hover {
20 | color: #06e;
21 | }
22 | a:active {
23 | color: #faa700;
24 | }
25 | a:focus {
26 | outline: thin dotted;
27 | }
28 | p {
29 | margin: 0.5em 0;
30 | }
31 | p.date {
32 | text-align: center;
33 | }
34 | img {
35 | max-width: 100%;
36 | }
37 |
38 | h1, h2, h3, h4, h5, h6 {
39 | color: #111;
40 | line-height: 115%;
41 | margin-top: 1em;
42 | font-weight: normal;
43 | }
44 | h1 {
45 | text-align: center;
46 | }
47 |
48 | h2 {
49 | text-transform: uppercase;
50 | }
51 | pre, blockquote pre {
52 | border-top: 0.1em #9ac solid;
53 | background: #e9f6ff;
54 | padding: 10px;
55 | border-bottom: 0.1em #9ac solid;
56 | }
57 |
58 | blockquote {
59 | margin: 0;
60 | padding-left: 3em;
61 | }
62 |
63 | hr {
64 | display: block;
65 | height: 2px;
66 | border: 0;
67 | border-top: 1px solid #aaa;
68 | border-bottom: 1px solid #eee;
69 | margin: 1em 0;
70 | padding: 0;
71 | }
72 |
73 | pre, code, kbd, samp {
74 | color: #000;
75 | font-family: Monaco, 'courier new', monospace;
76 | font-size: 90%;
77 | }
78 |
79 | pre {
80 | white-space: pre;
81 | white-space: pre-wrap;
82 | word-wrap: break-word;
83 | }
84 | /* fix, do not like bold for every keyword */
85 | code span.kw { color: #007020; font-weight: normal; } /* Keyword */
86 | pre.sourceCode {
87 | background: #fff6f6;
88 | }
89 | figure, p.author {
90 | text-align: center;
91 | }
92 | table {
93 | min-width: 300px;
94 | border-spacing: 0;
95 | border-collapse: collapse;
96 | cell-padding: 0px;
97 | cell-spacing: 0px;
98 | }
99 | tr.header {
100 | background: #dddddd;
101 | text-align: center;
102 | }
103 | tr.even {
104 | background: #ddeeff;
105 | }
106 | td, th {
107 | padding: 3px;
108 | text-align: center;
109 | }
110 |
--------------------------------------------------------------------------------
/pandoc-tcl-filter/lib/rl_json/pkgIndex.tcl:
--------------------------------------------------------------------------------
1 | #
2 | # Tcl package index file
3 | #
4 | package ifneeded rl_json 0.11.0 \
5 | [list load [file join $dir librl_json0.11.0[info shared]] rl_json]
6 |
--------------------------------------------------------------------------------
/pandoc-tcl-filter/lib/snit/pkgIndex.tcl:
--------------------------------------------------------------------------------
1 | if {[package vsatisfies [package provide Tcl] 8.5]} {
2 | package ifneeded snit 2.3.2 \
3 | [list source [file join $dir snit2.tcl]]
4 | }
5 |
6 | package ifneeded snit 1.4.2 [list source [file join $dir snit.tcl]]
7 |
--------------------------------------------------------------------------------
/pandoc-tcl-filter/lib/snit/snit2.tcl:
--------------------------------------------------------------------------------
1 |
2 | package require Tcl 8.5
3 |
4 |
5 | namespace eval ::snit:: {
6 | set library [file dirname [info script]]
7 | }
8 |
9 | source [file join $::snit::library main2.tcl]
10 |
11 | source [file join $::snit::library validate.tcl]
12 |
13 | package provide snit 2.3.2
14 |
--------------------------------------------------------------------------------
/pandoc-tcl-filter/lib/tdot/pkgIndex.tcl:
--------------------------------------------------------------------------------
1 | package ifneeded tdot 0.3.1 [list source [file join $dir tdot.tcl]]
2 |
--------------------------------------------------------------------------------
/pandoc-tcl-filter/lib/textutil/pkgIndex.tcl:
--------------------------------------------------------------------------------
1 | if {![package vsatisfies [package provide Tcl] 8.2]} {
2 | # FRINK: nocheck
3 | return
4 | }
5 | package ifneeded textutil 0.8 [list source [file join $dir textutil.tcl]]
6 | package ifneeded textutil::adjust 0.7.3 [list source [file join $dir adjust.tcl]]
7 | package ifneeded textutil::split 0.8 [list source [file join $dir split.tcl]]
8 | package ifneeded textutil::trim 0.7 [list source [file join $dir trim.tcl]]
9 | package ifneeded textutil::tabify 0.7 [list source [file join $dir tabify.tcl]]
10 | package ifneeded textutil::repeat 0.7 [list source [file join $dir repeat.tcl]]
11 | package ifneeded textutil::string 0.8 [list source [file join $dir string.tcl]]
12 | package ifneeded textutil::expander 1.3.1 [list source [file join $dir expander.tcl]]
13 |
--------------------------------------------------------------------------------
/pandoc-tcl-filter/lib/textutil/repeat.tcl:
--------------------------------------------------------------------------------
1 | # repeat.tcl --
2 | #
3 | # Emulation of string repeat for older
4 | # revisions of Tcl.
5 | #
6 | # Copyright (c) 2000 by Ajuba Solutions.
7 | # Copyright (c) 2001-2006 by Andreas Kupries
8 | #
9 | # See the file "license.terms" for information on usage and redistribution
10 | # of this file, and for a DISCLAIMER OF ALL WARRANTIES.
11 | #
12 | # RCS: @(#) $Id: repeat.tcl,v 1.1 2006/04/21 04:42:28 andreas_kupries Exp $
13 |
14 | # ### ### ### ######### ######### #########
15 | ## Requirements
16 |
17 | package require Tcl 8.2
18 |
19 | namespace eval ::textutil::repeat {}
20 |
21 | # ### ### ### ######### ######### #########
22 |
23 | namespace eval ::textutil::repeat {
24 | variable HaveBuiltin [expr {![catch {string repeat a 1}]}]
25 | }
26 |
27 | if {0} {
28 | # Problems with the deactivated code:
29 | # - Linear in 'num'.
30 | # - Tests for 'string repeat' in every call!
31 | # (Ok, just the variable, still a test every call)
32 | # - Fails for 'num == 0' because of undefined 'str'.
33 |
34 | proc textutil::repeat::StrRepeat { char num } {
35 | variable HaveBuiltin
36 | if { $HaveBuiltin == 0 } then {
37 | for { set i 0 } { $i < $num } { incr i } {
38 | append str $char
39 | }
40 | } else {
41 | set str [ string repeat $char $num ]
42 | }
43 | return $str
44 | }
45 | }
46 |
47 | if {$::textutil::repeat::HaveBuiltin} {
48 | proc ::textutil::repeat::strRepeat {char num} {
49 | return [string repeat $char $num]
50 | }
51 |
52 | proc ::textutil::repeat::blank {n} {
53 | return [string repeat " " $n]
54 | }
55 | } else {
56 | proc ::textutil::repeat::strRepeat {char num} {
57 | if {$num <= 0} {
58 | # No replication required
59 | return ""
60 | } elseif {$num == 1} {
61 | # Quick exit for recursion
62 | return $char
63 | } elseif {$num == 2} {
64 | # Another quick exit for recursion
65 | return $char$char
66 | } elseif {0 == ($num % 2)} {
67 | # Halving the problem results in O (log n) complexity.
68 | set result [strRepeat $char [expr {$num / 2}]]
69 | return "$result$result"
70 | } else {
71 | # Uneven length, reduce problem by one
72 | return "$char[strRepeat $char [incr num -1]]"
73 | }
74 | }
75 |
76 | proc ::textutil::repeat::blank {n} {
77 | return [strRepeat " " $n]
78 | }
79 | }
80 |
81 | # ### ### ### ######### ######### #########
82 | ## Data structures
83 |
84 | namespace eval ::textutil::repeat {
85 | namespace export strRepeat blank
86 | }
87 |
88 | # ### ### ### ######### ######### #########
89 | ## Ready
90 |
91 | package provide textutil::repeat 0.7
92 |
--------------------------------------------------------------------------------
/pandoc-tcl-filter/lib/textutil/split.tcl:
--------------------------------------------------------------------------------
1 | # split.tcl --
2 | #
3 | # Various ways of splitting a string.
4 | #
5 | # Copyright (c) 2000 by Ajuba Solutions.
6 | # Copyright (c) 2000 by Eric Melski
7 | # Copyright (c) 2001 by Reinhard Max
8 | # Copyright (c) 2003 by Pat Thoyts
9 | # Copyright (c) 2001-2006 by Andreas Kupries
10 | #
11 | # See the file "license.terms" for information on usage and redistribution
12 | # of this file, and for a DISCLAIMER OF ALL WARRANTIES.
13 | #
14 | # RCS: @(#) $Id: split.tcl,v 1.7 2006/04/21 04:42:28 andreas_kupries Exp $
15 |
16 | # ### ### ### ######### ######### #########
17 | ## Requirements
18 |
19 | package require Tcl 8.2
20 |
21 | namespace eval ::textutil::split {}
22 |
23 | ########################################################################
24 | # This one was written by Bob Techentin (RWT in Tcl'ers Wiki):
25 | # http://www.techentin.net
26 | # mailto:techentin.robert@mayo.edu
27 | #
28 | # Later, he send me an email stated that I can use it anywhere, because
29 | # no copyright was added, so the code is defacto in the public domain.
30 | #
31 | # You can found it in the Tcl'ers Wiki here:
32 | # http://mini.net/cgi-bin/wikit/460.html
33 | #
34 | # Bob wrote:
35 | # If you need to split string into list using some more complicated rule
36 | # than builtin split command allows, use following function. It mimics
37 | # Perl split operator which allows regexp as element separator, but,
38 | # like builtin split, it expects string to split as first arg and regexp
39 | # as second (optional) By default, it splits by any amount of whitespace.
40 | # Note that if you add parenthesis into regexp, parenthesed part of separator
41 | # would be added into list as additional element. Just like in Perl. -- cary
42 | #
43 | # Speed improvement by Reinhard Max:
44 | # Instead of repeatedly copying around the not yet matched part of the
45 | # string, I use [regexp]'s -start option to restrict the match to that
46 | # part. This reduces the complexity from something like O(n^1.5) to
47 | # O(n). My test case for that was:
48 | #
49 | # foreach i {1 10 100 1000 10000} {
50 | # set s [string repeat x $i]
51 | # puts [time {splitx $s .}]
52 | # }
53 | #
54 |
55 | if {[package vsatisfies [package provide Tcl] 8.3]} {
56 |
57 | proc ::textutil::split::splitx {str {regexp {[\t \r\n]+}}} {
58 | # Bugfix 476988
59 | if {[string length $str] == 0} {
60 | return {}
61 | }
62 | if {[string length $regexp] == 0} {
63 | return [::split $str ""]
64 | }
65 | if {[regexp $regexp {}]} {
66 | return -code error \
67 | "splitting on regexp \"$regexp\" would cause infinite loop"
68 | }
69 |
70 | set list {}
71 | set start 0
72 | while {[regexp -start $start -indices -- $regexp $str match submatch]} {
73 | foreach {subStart subEnd} $submatch break
74 | foreach {matchStart matchEnd} $match break
75 | incr matchStart -1
76 | incr matchEnd
77 | lappend list [string range $str $start $matchStart]
78 | if {$subStart >= $start} {
79 | lappend list [string range $str $subStart $subEnd]
80 | }
81 | set start $matchEnd
82 | }
83 | lappend list [string range $str $start end]
84 | return $list
85 | }
86 |
87 | } else {
88 | # For tcl <= 8.2 we do not have regexp -start...
89 | proc ::textutil::split::splitx [list str [list regexp "\[\t \r\n\]+"]] {
90 |
91 | if {[string length $str] == 0} {
92 | return {}
93 | }
94 | if {[string length $regexp] == 0} {
95 | return [::split $str {}]
96 | }
97 | if {[regexp $regexp {}]} {
98 | return -code error \
99 | "splitting on regexp \"$regexp\" would cause infinite loop"
100 | }
101 |
102 | set list {}
103 | while {[regexp -indices -- $regexp $str match submatch]} {
104 | lappend list [string range $str 0 [expr {[lindex $match 0] -1}]]
105 | if {[lindex $submatch 0] >= 0} {
106 | lappend list [string range $str [lindex $submatch 0] \
107 | [lindex $submatch 1]]
108 | }
109 | set str [string range $str [expr {[lindex $match 1]+1}] end]
110 | }
111 | lappend list $str
112 | return $list
113 | }
114 |
115 | }
116 |
117 | #
118 | # splitn --
119 | #
120 | # splitn splits the string $str into chunks of length $len. These
121 | # chunks are returned as a list.
122 | #
123 | # If $str really contains a ByteArray object (as retrieved from binary
124 | # encoded channels) splitn must honor this by splitting the string
125 | # into chunks of $len bytes.
126 | #
127 | # It is an error to call splitn with a nonpositive $len.
128 | #
129 | # If splitn is called with an empty string, it returns the empty list.
130 | #
131 | # If the length of $str is not an entire multiple of the chunk length,
132 | # the last chunk in the generated list will be shorter than $len.
133 | #
134 | # The implementation presented here was given by Bryan Oakley, as
135 | # part of a ``contest'' I staged on c.l.t in July 2004. I selected
136 | # this version, as it does not rely on runtime generated code, is
137 | # very fast for chunk size one, not too bad in all the other cases,
138 | # and uses [split] or [string range] which have been around for quite
139 | # some time.
140 | #
141 | # -- Robert Suetterlin (robert@mpe.mpg.de)
142 | #
143 | proc ::textutil::split::splitn {str {len 1}} {
144 |
145 | if {$len <= 0} {
146 | return -code error "len must be > 0"
147 | }
148 |
149 | if {$len == 1} {
150 | return [split $str {}]
151 | }
152 |
153 | set result [list]
154 | set max [string length $str]
155 | set i 0
156 | set j [expr {$len -1}]
157 | while {$i < $max} {
158 | lappend result [string range $str $i $j]
159 | incr i $len
160 | incr j $len
161 | }
162 |
163 | return $result
164 | }
165 |
166 | # ### ### ### ######### ######### #########
167 | ## Data structures
168 |
169 | namespace eval ::textutil::split {
170 | namespace export splitx splitn
171 | }
172 |
173 | # ### ### ### ######### ######### #########
174 | ## Ready
175 |
176 | package provide textutil::split 0.8
177 |
--------------------------------------------------------------------------------
/pandoc-tcl-filter/lib/textutil/string.tcl:
--------------------------------------------------------------------------------
1 | # string.tcl --
2 | #
3 | # Utilities for manipulating strings, words, single lines,
4 | # paragraphs, ...
5 | #
6 | # Copyright (c) 2000 by Ajuba Solutions.
7 | # Copyright (c) 2000 by Eric Melski
8 | # Copyright (c) 2002 by Joe English
9 | # Copyright (c) 2001-2014 by Andreas Kupries
10 | #
11 | # See the file "license.terms" for information on usage and redistribution
12 | # of this file, and for a DISCLAIMER OF ALL WARRANTIES.
13 | #
14 | # RCS: @(#) $Id: string.tcl,v 1.2 2008/03/22 16:03:11 mic42 Exp $
15 |
16 | # ### ### ### ######### ######### #########
17 | ## Requirements
18 |
19 | package require Tcl 8.2
20 |
21 | namespace eval ::textutil::string {}
22 |
23 | # ### ### ### ######### ######### #########
24 | ## API implementation
25 |
26 | # @c Removes the last character from the given .
27 | #
28 | # @a string: The string to manipulate.
29 | #
30 | # @r The without its last character.
31 | #
32 | # @i chopping
33 |
34 | proc ::textutil::string::chop {string} {
35 | return [string range $string 0 [expr {[string length $string]-2}]]
36 | }
37 |
38 | # @c Removes the first character from the given .
39 | # @c Convenience procedure.
40 | #
41 | # @a string: string to manipulate.
42 | #
43 | # @r The without its first character.
44 | #
45 | # @i tail
46 |
47 | proc ::textutil::string::tail {string} {
48 | return [string range $string 1 end]
49 | }
50 |
51 | # @c Capitalizes first character of the given .
52 | # @c Complementary procedure to .
53 | #
54 | # @a string: string to manipulate.
55 | #
56 | # @r The with its first character capitalized.
57 | #
58 | # @i capitalize
59 |
60 | proc ::textutil::string::cap {string} {
61 | return [string toupper [string index $string 0]][string range $string 1 end]
62 | }
63 |
64 | # @c unCapitalizes first character of the given .
65 | # @c Complementary procedure to .
66 | #
67 | # @a string: string to manipulate.
68 | #
69 | # @r The with its first character uncapitalized.
70 | #
71 | # @i uncapitalize
72 |
73 | proc ::textutil::string::uncap {string} {
74 | return [string tolower [string index $string 0]][string range $string 1 end]
75 | }
76 |
77 | # @c Capitalizes first character of each word of the given .
78 | #
79 | # @a sentence: string to manipulate.
80 | #
81 | # @r The with the first character of each word capitalized.
82 | #
83 | # @i capitalize
84 |
85 | proc ::textutil::string::capEachWord {sentence} {
86 | regsub -all {\S+} [string map {\\ \\\\ \$ \\$} $sentence] {[string toupper [string index & 0]][string range & 1 end]} cmd
87 | return [subst -nobackslashes -novariables $cmd]
88 | }
89 |
90 | # Compute the longest string which is common to all strings given to
91 | # the command, and at the beginning of said strings, i.e. a prefix. If
92 | # only one argument is specified it is treated as a list of the
93 | # strings to look at. If more than one argument is specified these
94 | # arguments are the strings to be looked at. If only one string is
95 | # given, in either form, the string is returned, as it is its own
96 | # longest common prefix.
97 |
98 | proc ::textutil::string::longestCommonPrefix {args} {
99 | return [longestCommonPrefixList $args]
100 | }
101 |
102 | proc ::textutil::string::longestCommonPrefixList {list} {
103 | if {[llength $list] <= 1} {
104 | return [lindex $list 0]
105 | }
106 |
107 | set list [lsort $list]
108 | set min [lindex $list 0]
109 | set max [lindex $list end]
110 |
111 | # Min and max are the two strings which are most different. If
112 | # they have a common prefix, it will also be the common prefix for
113 | # all of them.
114 |
115 | # Fast bailouts for common cases.
116 |
117 | set n [string length $min]
118 | if {$n == 0} {return ""}
119 | if {0 == [string compare $min $max]} {return $min}
120 |
121 | set prefix ""
122 | set i 0
123 | while {[string index $min $i] == [string index $max $i]} {
124 | append prefix [string index $min $i]
125 | if {[incr i] > $n} {break}
126 | }
127 | set prefix
128 | }
129 |
130 | # ### ### ### ######### ######### #########
131 | ## Data structures
132 |
133 | namespace eval ::textutil::string {
134 | # Export the imported commands
135 |
136 | namespace export chop tail cap uncap capEachWord
137 | namespace export longestCommonPrefix
138 | namespace export longestCommonPrefixList
139 | }
140 |
141 | # ### ### ### ######### ######### #########
142 | ## Ready
143 |
144 | package provide textutil::string 0.8
145 |
--------------------------------------------------------------------------------
/pandoc-tcl-filter/lib/textutil/textutil.tcl:
--------------------------------------------------------------------------------
1 | # textutil.tcl --
2 | #
3 | # Utilities for manipulating strings, words, single lines,
4 | # paragraphs, ...
5 | #
6 | # Copyright (c) 2000 by Ajuba Solutions.
7 | # Copyright (c) 2000 by Eric Melski
8 | # Copyright (c) 2002 by Joe English
9 | # Copyright (c) 2001-2006 by Andreas Kupries
10 | #
11 | # See the file "license.terms" for information on usage and redistribution
12 | # of this file, and for a DISCLAIMER OF ALL WARRANTIES.
13 | #
14 | # RCS: @(#) $Id: textutil.tcl,v 1.17 2006/09/21 06:46:24 andreas_kupries Exp $
15 |
16 | # ### ### ### ######### ######### #########
17 | ## Requirements
18 |
19 | package require Tcl 8.2
20 |
21 | namespace eval ::textutil {}
22 |
23 | # ### ### ### ######### ######### #########
24 | ## API implementation
25 | ## All through sub-packages imported here.
26 |
27 | package require textutil::string
28 | package require textutil::repeat
29 | package require textutil::adjust
30 | package require textutil::split
31 | package require textutil::tabify
32 | package require textutil::trim
33 |
34 | namespace eval ::textutil {
35 | # Import the miscellaneous string command for public export
36 |
37 | namespace import -force string::chop string::tail
38 | namespace import -force string::cap string::uncap string::capEachWord
39 | namespace import -force string::longestCommonPrefix
40 | namespace import -force string::longestCommonPrefixList
41 |
42 | # Import the repeat commands for public export
43 |
44 | namespace import -force repeat::strRepeat repeat::blank
45 |
46 | # Import the adjust commands for public export
47 |
48 | namespace import -force adjust::adjust adjust::indent adjust::undent
49 |
50 | # Import the split commands for public export
51 |
52 | namespace import -force split::splitx split::splitn
53 |
54 | # Import the trim commands for public export
55 |
56 | namespace import -force trim::trim trim::trimleft trim::trimright
57 | namespace import -force trim::trimPrefix trim::trimEmptyHeading
58 |
59 | # Import the tabify commands for public export
60 |
61 | namespace import -force tabify::tabify tabify::untabify
62 | namespace import -force tabify::tabify2 tabify::untabify2
63 |
64 | # Re-export all the imported commands
65 |
66 | namespace export chop tail cap uncap capEachWord
67 | namespace export longestCommonPrefix longestCommonPrefixList
68 | namespace export strRepeat blank
69 | namespace export adjust indent undent
70 | namespace export splitx splitn
71 | namespace export trim trimleft trimright trimPrefix trimEmptyHeading
72 | namespace export tabify untabify tabify2 untabify2
73 | }
74 |
75 |
76 | # ### ### ### ######### ######### #########
77 | ## Ready
78 |
79 | package provide textutil 0.8
80 |
--------------------------------------------------------------------------------
/pandoc-tcl-filter/lib/textutil/trim.tcl:
--------------------------------------------------------------------------------
1 | # trim.tcl --
2 | #
3 | # Various ways of trimming a string.
4 | #
5 | # Copyright (c) 2000 by Ajuba Solutions.
6 | # Copyright (c) 2000 by Eric Melski
7 | # Copyright (c) 2001-2006 by Andreas Kupries
8 | #
9 | # See the file "license.terms" for information on usage and redistribution
10 | # of this file, and for a DISCLAIMER OF ALL WARRANTIES.
11 | #
12 | # RCS: @(#) $Id: trim.tcl,v 1.5 2006/04/21 04:42:28 andreas_kupries Exp $
13 |
14 | # ### ### ### ######### ######### #########
15 | ## Requirements
16 |
17 | package require Tcl 8.2
18 |
19 | namespace eval ::textutil::trim {}
20 |
21 | # ### ### ### ######### ######### #########
22 | ## API implementation
23 |
24 | proc ::textutil::trim::trimleft {text {trim "[ \t]+"}} {
25 | regsub -line -all -- [MakeStr $trim left] $text {} text
26 | return $text
27 | }
28 |
29 | proc ::textutil::trim::trimright {text {trim "[ \t]+"}} {
30 | regsub -line -all -- [MakeStr $trim right] $text {} text
31 | return $text
32 | }
33 |
34 | proc ::textutil::trim::trim {text {trim "[ \t]+"}} {
35 | regsub -line -all -- [MakeStr $trim left] $text {} text
36 | regsub -line -all -- [MakeStr $trim right] $text {} text
37 | return $text
38 | }
39 |
40 |
41 |
42 | # @c Strips from , if found at its start.
43 | #
44 | # @a text: The string to check for .
45 | # @a prefix: The string to remove from .
46 | #
47 | # @r The , but without .
48 | #
49 | # @i remove, prefix
50 |
51 | proc ::textutil::trim::trimPrefix {text prefix} {
52 | if {[string first $prefix $text] == 0} {
53 | return [string range $text [string length $prefix] end]
54 | } else {
55 | return $text
56 | }
57 | }
58 |
59 |
60 | # @c Removes the Heading Empty Lines of .
61 | #
62 | # @a text: The text block to manipulate.
63 | #
64 | # @r The , but without heading empty lines.
65 | #
66 | # @i remove, empty lines
67 |
68 | proc ::textutil::trim::trimEmptyHeading {text} {
69 | regsub -- "^(\[ \t\]*\n)*" $text {} text
70 | return $text
71 | }
72 |
73 | # ### ### ### ######### ######### #########
74 | ## Helper commands. Internal
75 |
76 | proc ::textutil::trim::MakeStr { string pos } {
77 | variable StrU
78 | variable StrR
79 | variable StrL
80 |
81 | if { "$string" != "$StrU" } {
82 | set StrU $string
83 | set StrR "(${StrU})\$"
84 | set StrL "^(${StrU})"
85 | }
86 | if { "$pos" == "left" } {
87 | return $StrL
88 | }
89 | if { "$pos" == "right" } {
90 | return $StrR
91 | }
92 |
93 | return -code error "Panic, illegal position key \"$pos\""
94 | }
95 |
96 | # ### ### ### ######### ######### #########
97 | ## Data structures
98 |
99 | namespace eval ::textutil::trim {
100 | variable StrU "\[ \t\]+"
101 | variable StrR "(${StrU})\$"
102 | variable StrL "^(${StrU})"
103 |
104 | namespace export \
105 | trim trimright trimleft \
106 | trimPrefix trimEmptyHeading
107 | }
108 |
109 | # ### ### ### ######### ######### #########
110 | ## Ready
111 |
112 | package provide textutil::trim 0.7
113 |
--------------------------------------------------------------------------------
/pandoc-tcl-filter/lib/tsvg/pkgIndex.tcl:
--------------------------------------------------------------------------------
1 | package ifneeded tsvg 0.3.0 [list source [file join $dir tsvg.tcl]]
2 |
--------------------------------------------------------------------------------
/pandoc-tcl-filter/lib/yaml/pkgIndex.tcl:
--------------------------------------------------------------------------------
1 |
2 | if {![package vsatisfies [package provide Tcl] 8.5]} {return}
3 |
4 | package ifneeded yaml 0.4.1 [list source [file join $dir yaml.tcl]]
5 | package ifneeded huddle 0.3 [list source [file join $dir huddle.tcl]]
6 | package ifneeded huddle::json 0.1 [list source [file join $dir json2huddle.tcl]]
7 |
--------------------------------------------------------------------------------
/pandoc-tcl-filter/lib/yaml/yaml.tcl:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mittelmark/DGTcl/22b7cfc904010871af024dd348f8cb2b7d30b662/pandoc-tcl-filter/lib/yaml/yaml.tcl
--------------------------------------------------------------------------------
/pandoc-tcl-filter/mini.css:
--------------------------------------------------------------------------------
1 | html {
2 | overflow-y: scroll;
3 | }
4 | body {
5 | color: #444;
6 | font-family: Georgia, Palatino, 'Palatino Linotype', Times, 'Times New Roman', serif;
7 | line-height: 1.2;
8 | padding: 1em;
9 | margin: auto;
10 | max-width: 900px;
11 | }
12 | a {
13 | color: #0645ad;
14 | text-decoration: none;
15 | }
16 | a:visited {
17 | color: #0b0080;
18 | }
19 | a:hover {
20 | color: #06e;
21 | }
22 | a:active {
23 | color: #faa700;
24 | }
25 | a:focus {
26 | outline: thin dotted;
27 | }
28 | p {
29 | margin: 0.5em 0;
30 | }
31 | p.date {
32 | text-align: center;
33 | }
34 | img {
35 | max-width: 100%;
36 | }
37 |
38 | h1, h2, h3, h4, h5, h6 {
39 | color: #111;
40 | line-height: 115%;
41 | margin-top: 1em;
42 | font-weight: normal;
43 | }
44 | h1 {
45 | text-align: center;
46 | font-size: 120%;
47 | }
48 | p.author, p.date {
49 | font-size: 110%;
50 | }
51 |
52 | /* h2 {
53 | text-transform: uppercase;
54 | }
55 | */
56 | pre, blockquote pre {
57 | border-top: 0.1em #9ac solid;
58 | background: #e9f6ff;
59 | padding: 10px;
60 | border-bottom: 0.1em #9ac solid;
61 | }
62 |
63 | blockquote {
64 | margin: 0;
65 | padding-left: 3em;
66 | }
67 |
68 | hr {
69 | display: block;
70 | height: 2px;
71 | border: 0;
72 | border-top: 1px solid #aaa;
73 | border-bottom: 1px solid #eee;
74 | margin: 1em 0;
75 | padding: 0;
76 | }
77 |
78 | pre, code, kbd, samp {
79 | color: #000;
80 | font-family: Monaco, 'courier new', monospace;
81 | font-size: 90%;
82 | }
83 | code.r {
84 | color: #770000;
85 | }
86 | pre {
87 | white-space: pre;
88 | white-space: pre-wrap;
89 | word-wrap: break-word;
90 | }
91 | /* fix, do not like bold for every keyword */
92 | code span.kw { color: #007020; font-weight: normal; } /* Keyword */
93 | pre.sourceCode {
94 | background: #fff6f6;
95 | }
96 | figure, p.author {
97 | text-align: center;
98 | }
99 | table {
100 | border-collapse: collapse;
101 | border-bottom: 2px solid;
102 | border-spacing: 5px;
103 | min-width: 400px;
104 | }
105 | table thead tr th {
106 | background-color: #fde9d9;
107 | text-align: left;
108 | padding: 10px;
109 | border-top: 2px solid;
110 | border-bottom: 2px solid;
111 | }
112 | table td {
113 | background-color: #fff9e9;
114 |
115 | text-align: left;
116 | padding: 10px;
117 | }
118 |
--------------------------------------------------------------------------------
/pandoc-tcl-filter/pkgIndex.tcl:
--------------------------------------------------------------------------------
1 | package ifneeded pandoc 0.8.2 [list source [file join $dir pandoc-tcl-filter.tcl]]
2 |
--------------------------------------------------------------------------------
/pandoc-tcl-filter/tests/asis.md:
--------------------------------------------------------------------------------
1 | ---
2 | title: "Tests for asis chunks"
3 | author: Detlef Groth
4 | date: Dec 14, 2021
5 | ---
6 |
7 | ## Introduction
8 |
9 | This document contains tests for code chunks with the results="asis" option.
10 |
11 | ## Headers
12 |
13 | Using puts:
14 |
15 | ``` {.tcl results="asis"}
16 |
17 | puts {## huhu 1}
18 |
19 | ```
20 |
21 | Using as last statement (return)
22 |
23 | ``` {.tcl results="asis"}
24 | return {## huhu 2}
25 | ```
26 |
27 | ## Bold and Italic
28 |
29 | ```{.tcl results="asis"}
30 | return "**this is bold** and _this is italic_ text!"
31 | ```
32 |
33 | ## Tables
34 |
35 | ```{.tcl results="asis"}
36 | list2mdtab [list Col1 Col2 Col3] [list 1 2 3 4 5 6 7 8 9 10 11 12]
37 | ```
38 |
39 | ## EOF
40 |
41 |
42 |
--------------------------------------------------------------------------------
/pandoc-tcl-filter/tests/inc.md:
--------------------------------------------------------------------------------
1 |
2 | ## This is file inc.md
3 |
4 | Containing some useless text!
5 |
6 | ## last header
7 |
8 | This is **bold text** and some other text.
9 |
--------------------------------------------------------------------------------
/pandoc-tcl-filter/tests/table.md:
--------------------------------------------------------------------------------
1 | ---
2 | title: Table tests for pandoc-tcl-filter
3 | author: Detlef Groth, Caputh-Schwielowsee, Germany
4 | date: 2021-12-10
5 | ---
6 |
7 | ## Test normal table given in text
8 |
9 | A Markdown table written directly in Markdown:
10 |
11 | ***
12 | | Col1 | Col2 |
13 | | ------------- | ------------- |
14 | | cell 1,1 | cell 1,2 |
15 | | cell 2,1 | cell 2,2 |
16 |
17 | **Table 1:** Markdown table
18 |
19 | ***
20 |
21 | This is some text.
22 |
23 | ## Test normal Tcl code
24 |
25 | ```{.tcl}
26 | set x 1
27 | puts $x
28 | ```
29 |
30 | ## Test results="asis" with normal Tcl code
31 |
32 | ```{.tcl results="asis"}
33 | set y 2
34 | puts $y
35 | ```
36 |
37 | ## Test results="asis" with Tcl code creating a Markdown table
38 |
39 | Let's now create our own table in Tcl:
40 |
41 | ```{.tcl results="asis"}
42 | set tab {
43 | | Col1 | Col2 | Col3 | Col4 |
44 | | ------------- | ------------- | ------------- | ------------- |
45 | }
46 | foreach i [list 1 2 3 4 5] {
47 | append tab "| cell $i,1 | cell $i,2 | cell $i,3 | cell $i,3 |\n"
48 | }
49 | set tab
50 | ```
51 | **Table 2:** Table created with Tcl
52 |
53 | And the table is displayed!
54 |
55 |
56 | ## Test results="asis" with Tcl code creating a Markdown table and echo=false
57 |
58 | ```{.tcl results="asis" echo=false}
59 | foreach i [list 6 7 8 9] {
60 | append tab "| cell $i,1 | cell $i,2 | cell $i,3 | cell $i,3 |\n"
61 | }
62 | set tab
63 | ```
64 | **Table 3:** Table extended with Tcl
65 |
66 | The table above was extended by invisible Tcl code.
67 |
68 | ## list2table example
69 |
70 | Below a method list2table method which can visualize flat and nested lists. Let's start with a flat list:
71 |
72 | ```{.tcl results="asis"}
73 | proc list2table {header values} {
74 | set ncol [llength $header]
75 | set nval [llength $values]
76 | if {[llength [lindex $values 0]] > 1 && [llength [lindex $values 0]] != [llength $header]} {
77 | error "Error: list2table - number of values if first row is not a multiple of columns!"
78 | } elseif {[expr {int(fmod($nval,$ncol))}] != 0} {
79 | error "Error: list2table - number of values is not a multiple of columns!"
80 | }
81 | set res "|"
82 | foreach h $header {
83 | append res " $h |"
84 | }
85 | append res "\n|"
86 | foreach h $header {
87 | append res " ---- |"
88 | }
89 | append res "\n"
90 | set c 0
91 | foreach val $values {
92 | if {[llength $val] > 1} {
93 | # nested list
94 | append res "| "
95 | foreach v $val {
96 | append res " $v |"
97 | }
98 | append res "\n"
99 | } else {
100 | if {[expr {int(fmod($c,$ncol))}] == 0} {
101 | append res "| "
102 | }
103 | append res " $val |"
104 | incr c
105 | if {[expr {int(fmod($c,$ncol))}] == 0} {
106 | append res "\n"
107 | }
108 | }
109 | }
110 | return $res
111 | }
112 |
113 | list2table [list A B C] [list 1 2 3 4 5 6 7 8 9]
114 | ```
115 | **Table 4:** list2table flat list example
116 |
117 | ****
118 |
119 | Nested list:
120 |
121 | ```{.tcl results="asis"}
122 | list2table [list A B C] [list [list 10 11 12] [list 13 14 15] [list 16 17 18]]
123 | ```
124 | **Table 5:** list2table nested list example
125 |
126 | ***
127 |
128 | ## Creating tables using list2mdtab
129 |
130 | The Tcl filter contains the function shown above already predefined as
131 | *list2mdtab*. So there is no need to define your own. Here an example:
132 |
133 | ```{.tcl results="asis"}
134 | list2mdtab [list Col1 Col2 Col3] [list 21 22 23 24 25 26 27 28 29]
135 | ```
136 | **Table 6:** list2mdtab example
137 |
138 |
139 | ## Document processing
140 |
141 | This document was created from the file *table.md* using the following terminal command line:
142 |
143 | ```
144 | $ tclsh pandoc-tcl-filter.tcl tests/table.md table.html -s --css mini.css
145 | ```
146 |
147 | ## End of file
148 |
--------------------------------------------------------------------------------
/pandoc-tcl-filter/tsvg-hello-world.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Hello
8 |
9 |
10 |
11 | World!
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/releases/README.md:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mittelmark/DGTcl/22b7cfc904010871af024dd348f8cb2b7d30b662/releases/README.md
--------------------------------------------------------------------------------