Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| Comment: | Add the 'markdown' command to TH1. |
|---|---|
| Downloads: | Tarball | ZIP archive |
| Timelines: | family | ancestors | descendants | both | trunk |
| Files: | files | file ages | folders |
| SHA1: |
f6d29e9c3d2863c63b1dc401d49441fe |
| User & Date: | mistachkin 2015-07-19 18:34:06.234 |
Context
|
2015-07-19
| ||
| 18:36 | Correct accidental removal of the 'linecount' TH1 command description from the TH1 commands documentation page. ... (check-in: fc19595b98 user: mistachkin tags: trunk) | |
| 18:34 | Add the 'markdown' command to TH1. ... (check-in: f6d29e9c3d user: mistachkin tags: trunk) | |
|
2015-07-16
| ||
| 18:24 | Update the built-in SQLite to the latest 3.8.11 beta. ... (check-in: 82206af110 user: drh tags: trunk) | |
Changes
Changes to src/th_main.c.
| ︙ | ︙ | |||
335 336 337 338 339 340 341 342 343 344 345 346 347 348 |
){
if( argc!=2 ){
return Th_WrongNumArgs(interp, "puts STRING");
}
sendText((char*)argv[1], argl[1], *(unsigned int*)pConvert);
return TH_OK;
}
/*
** TH1 command: decorate STRING
** TH1 command: wiki STRING
**
** Render the input string as wiki. For the decorate command, only links
** are handled.
| > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 |
){
if( argc!=2 ){
return Th_WrongNumArgs(interp, "puts STRING");
}
sendText((char*)argv[1], argl[1], *(unsigned int*)pConvert);
return TH_OK;
}
/*
** TH1 command: markdown STRING
**
** Renders the input string as markdown. The result is a two-element list.
** The first element is the text-only title string. The second element
** contains the body, rendered as HTML.
*/
static int markdownCmd(
Th_Interp *interp,
void *p,
int argc,
const char **argv,
int *argl
){
Blob src, title, body;
char *zValue = 0;
int nValue = 0;
if( argc!=2 ){
return Th_WrongNumArgs(interp, "markdown STRING");
}
blob_zero(&src);
blob_init(&src, (char*)argv[1], argl[1]);
blob_zero(&title); blob_zero(&body);
markdown_to_html(&src, &title, &body);
Th_ListAppend(interp, &zValue, &nValue, blob_str(&title), blob_size(&title));
Th_ListAppend(interp, &zValue, &nValue, blob_str(&body), blob_size(&body));
Th_SetResult(interp, zValue, nValue);
return TH_OK;
}
/*
** TH1 command: decorate STRING
** TH1 command: wiki STRING
**
** Render the input string as wiki. For the decorate command, only links
** are handled.
|
| ︙ | ︙ | |||
1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 |
{"httpize", httpizeCmd, 0},
{"hascap", hascapCmd, (void*)&zeroInt},
{"hasfeature", hasfeatureCmd, 0},
{"html", putsCmd, (void*)&aFlags[0]},
{"htmlize", htmlizeCmd, 0},
{"http", httpCmd, 0},
{"linecount", linecntCmd, 0},
{"puts", putsCmd, (void*)&aFlags[1]},
{"query", queryCmd, 0},
{"randhex", randhexCmd, 0},
{"regexp", regexpCmd, 0},
{"reinitialize", reinitializeCmd, 0},
{"render", renderCmd, 0},
{"repository", repositoryCmd, 0},
| > | 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 |
{"httpize", httpizeCmd, 0},
{"hascap", hascapCmd, (void*)&zeroInt},
{"hasfeature", hasfeatureCmd, 0},
{"html", putsCmd, (void*)&aFlags[0]},
{"htmlize", htmlizeCmd, 0},
{"http", httpCmd, 0},
{"linecount", linecntCmd, 0},
{"markdown", markdownCmd, 0},
{"puts", putsCmd, (void*)&aFlags[1]},
{"query", queryCmd, 0},
{"randhex", randhexCmd, 0},
{"regexp", regexpCmd, 0},
{"reinitialize", reinitializeCmd, 0},
{"render", renderCmd, 0},
{"repository", repositoryCmd, 0},
|
| ︙ | ︙ |
Changes to test/th1.test.
| ︙ | ︙ | |||
14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# http://www.hwaci.com/drh/
#
############################################################################
#
# TH1 Commands
#
fossil test-th-eval --open-config "setting th1-hooks"
set th1Hooks [expr {$RESULT eq "1"}]
###############################################################################
fossil test-th-eval --open-config "setting abc"
test th1-setting-1 {$RESULT eq ""}
| > > > > | 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# http://www.hwaci.com/drh/
#
############################################################################
#
# TH1 Commands
#
set dir [file dirname [info script]]
###############################################################################
fossil test-th-eval --open-config "setting th1-hooks"
set th1Hooks [expr {$RESULT eq "1"}]
###############################################################################
fossil test-th-eval --open-config "setting abc"
test th1-setting-1 {$RESULT eq ""}
|
| ︙ | ︙ | |||
857 858 859 860 861 862 863 |
# NOTE: This test may fail if the command names do not always come
# out in a deterministic order from TH1.
#
fossil test-th-eval "info commands"
test th1-info-commands-1 {$RESULT eq {linecount htmlize date stime\
enable_output uplevel http expr glob_match utime styleFooter catch if\
tclReady searchable reinitialize combobox lindex query html anoncap randhex\
| | | | 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 |
# NOTE: This test may fail if the command names do not always come
# out in a deterministic order from TH1.
#
fossil test-th-eval "info commands"
test th1-info-commands-1 {$RESULT eq {linecount htmlize date stime\
enable_output uplevel http expr glob_match utime styleFooter catch if\
tclReady searchable reinitialize combobox lindex query html anoncap randhex\
llength for set break regexp markdown styleHeader puts return checkout\
decorate artifact trace wiki proc hascap globalState continue getParameter\
hasfeature setting lsearch breakpoint upvar render repository string unset\
setParameter list error info rename anycap httpize}}
###############################################################################
fossil test-th-eval "info vars"
test th1-info-vars-1 {$RESULT eq ""}
|
| ︙ | ︙ | |||
1169 1170 1171 1172 1173 1174 1175 |
fossil test-th-eval {string is integer 0xC0DEF00D}
test th1-string-is-30 {$RESULT eq "1"}
###############################################################################
fossil test-th-eval {string is integer 0xC0DEF00Z}
test th1-string-is-31 {$RESULT eq "0"}
| > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 |
fossil test-th-eval {string is integer 0xC0DEF00D}
test th1-string-is-30 {$RESULT eq "1"}
###############################################################################
fossil test-th-eval {string is integer 0xC0DEF00Z}
test th1-string-is-31 {$RESULT eq "0"}
###############################################################################
fossil test-th-eval {markdown}
test th1-markdown-1 {$RESULT eq \
{TH_ERROR: wrong # args: should be "markdown STRING"}}
###############################################################################
fossil test-th-eval {markdown one two}
test th1-markdown-2 {$RESULT eq \
{TH_ERROR: wrong # args: should be "markdown STRING"}}
###############################################################################
fossil test-th-eval {markdown "*This is a test.*"}
test th1-markdown-3 {[normalize_result] eq {{} {<div class="markdown">
<p><em>This is a test.</em></p>
</div>
}}}
###############################################################################
fossil test-th-eval {markdown "Test1\n=====\n*This is a test.*"}
test th1-markdown-4 {[normalize_result] eq {Test1 {<div class="markdown">
<h1>Test1</h1>
<p><em>This is a test.</em></p>
</div>
}}}
###############################################################################
set markdown [read_file [file join $dir markdown-test1.md]]
fossil test-th-eval [string map \
[list %markdown% $markdown] {markdown {%markdown%}}]
test th1-markdown-5 {[normalize_result] eq \
{{Markdown Formatter Test Document} {<div class="markdown">
<h1>Markdown Formatter Test Document</h1>
<p>This document is designed to test the markdown formatter.</p>
<ul>
<li>A bullet item.
<ul>
<li>A subitem</li>
</ul></li>
<li>Second bullet</li>
</ul>
<p>More text</p>
<ol>
<li>Enumeration
1.1. Subitem 1
1.2. Subitem 2</li>
<li>Second enumeration.</li>
</ol>
<p>Another paragraph.</p>
<h2>Other Features</h2>
<p>Text can show <em>emphasis</em> or <em>emphasis</em> or <strong>strong emphassis</strong>.</p>
</div>
}}}
|
Changes to www/changes.wiki.
1 2 3 4 5 6 7 8 |
<title>Change Log</title>
<h2>Changes for Version 1.34 (2015-??-??)</h2>
* Fix --hard option to mv/rm to enable them to work properly with certain
relative paths.
* Make the clean command undoable for files less than 10MiB.
* Add minimal <nowiki>[lsearch]</nowiki> command to TH1. Only exact
case-sensitive matching is supported.
| | > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
<title>Change Log</title>
<h2>Changes for Version 1.34 (2015-??-??)</h2>
* Fix --hard option to mv/rm to enable them to work properly with certain
relative paths.
* Make the clean command undoable for files less than 10MiB.
* Add minimal <nowiki>[lsearch]</nowiki> command to TH1. Only exact
case-sensitive matching is supported.
* Add the <nowiki>[glob_match]</nowiki> and <nowiki>[markdown]</nowiki>
commands to TH1.
* Add the <nowiki>[tclIsSafe] and [tclMakeSafe]</nowiki> TH1 commands to
the Tcl integration subsystem.
* Add 'double', 'integer', and 'list' classes to the
<nowiki>[string is]</nowiki> command in TH1.
* Update internal Unicode character tables, used in regular expression
handling, from version 7.0 to 8.0.
|
| ︙ | ︙ |
Changes to www/th1.md.
| ︙ | ︙ | |||
137 138 139 140 141 142 143 144 145 146 147 148 149 150 | * hascap * hasfeature * html * htmlize * http * httpize * linecount * puts * query * randhex * regexp * reinitialize * render * repository | > | 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 | * hascap * hasfeature * html * htmlize * http * httpize * linecount * markdown * puts * query * randhex * regexp * reinitialize * render * repository |
| ︙ | ︙ | |||
346 347 348 349 350 351 352 | components. Returns the escaped string. <a name="linecount"></a>TH1 linecount Command --------------------------------------------- * linecount STRING MAX MIN | > > | > | > > > | 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 | components. Returns the escaped string. <a name="linecount"></a>TH1 linecount Command --------------------------------------------- * linecount STRING MAX MIN <a name="markdown"></a>TH1 markdown Command --------------------------------------------- * markdown STRING Renders the input string as markdown. The result is a two-element list. The first element contains the body, rendered as HTML. The second element is the text-only title string. <a name="puts"></a>TH1 puts Command ----------------------------------- * puts STRING Outputs the STRING unchanged. |
| ︙ | ︙ |