1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-11-27 03:57:21 +00:00

Reorganise the main file saving templates

We’re introducing a mechanism that allows us to decide which tiddlers
get saved. Using `$:/core/save/all` gives all tiddlers, as before.
Using `$:/core/save/empty` gives an empty wiki. Saving an empty wiki
from tw5.com isn’t the same as the empty wiki cooked from
editions/empty because the two editions have different plugins and
other system tiddlers.
This commit is contained in:
Jermolene 2013-11-25 21:16:27 +00:00
parent b33a3293fe
commit b805633dc9
17 changed files with 58 additions and 38 deletions

14
bld.cmd
View File

@ -31,7 +31,7 @@ node .\tiddlywiki.js ^
--verbose ^
--rendertiddler ReadMe .\readme.md text/html ^
--rendertiddler ContributingTemplate .\contributing.md text/html ^
--rendertiddler $:/core/templates/tiddlywiki5.template.html %TW5_BUILD_OUTPUT%\index.html text/plain ^
--rendertiddler $:/core/save/all %TW5_BUILD_OUTPUT%\index.html text/plain ^
--rendertiddler $:/core/templates/static.template.html %TW5_BUILD_OUTPUT%\static.html text/plain ^
--rendertiddler $:/core/templates/static.template.css %TW5_BUILD_OUTPUT%\static\static.css text/plain ^
--rendertiddlers [!is[system]] $:/core/templates/static.tiddler.html %TW5_BUILD_OUTPUT%\static text/plain ^
@ -43,7 +43,7 @@ node .\tiddlywiki.js ^
.\editions\tw5.com ^
--verbose ^
--password password ^
--rendertiddler $:/core/templates/tiddlywiki5.template.html %TW5_BUILD_OUTPUT%\encrypted.html text/plain ^
--rendertiddler $:/core/save/all %TW5_BUILD_OUTPUT%\encrypted.html text/plain ^
|| exit 1
rem Third, empty.html: empty wiki for reuse
@ -51,7 +51,7 @@ rem Third, empty.html: empty wiki for reuse
node .\tiddlywiki.js ^
.\editions\empty ^
--verbose ^
--rendertiddler $:/core/templates/tiddlywiki5.template.html %TW5_BUILD_OUTPUT%\empty.html text/plain ^
--rendertiddler $:/core/save/all %TW5_BUILD_OUTPUT%\empty.html text/plain ^
|| exit 1
rem Fourth, tahoelafs.html: empty wiki with plugin for Tahoe-LAFS
@ -59,7 +59,7 @@ rem Fourth, tahoelafs.html: empty wiki with plugin for Tahoe-LAFS
node .\tiddlywiki.js ^
.\editions\tahoelafs ^
--verbose ^
--rendertiddler $:/core/templates/tiddlywiki5.template.html %TW5_BUILD_OUTPUT%\tahoelafs.html text/plain ^
--rendertiddler $:/core/save/all %TW5_BUILD_OUTPUT%\tahoelafs.html text/plain ^
|| exit 1
rem Fifth, d3demo.html: wiki to demo d3 plugin
@ -67,7 +67,7 @@ rem Fifth, d3demo.html: wiki to demo d3 plugin
node .\tiddlywiki.js ^
.\editions\d3demo ^
--verbose ^
--rendertiddler $:/core/templates/tiddlywiki5.template.html %TW5_BUILD_OUTPUT%\d3demo.html text/plain ^
--rendertiddler $:/core/save/all %TW5_BUILD_OUTPUT%\d3demo.html text/plain ^
|| exit 1
rem Sixth, codemirrordemo.html: wiki to demo codemirror plugin
@ -75,7 +75,7 @@ rem Sixth, codemirrordemo.html: wiki to demo codemirror plugin
node .\tiddlywiki.js ^
.\editions\codemirrordemo ^
--verbose ^
--rendertiddler $:/core/templates/tiddlywiki5.template.html %TW5_BUILD_OUTPUT%\codemirrordemo.html text/plain ^
--rendertiddler $:/core/save/all %TW5_BUILD_OUTPUT%\codemirrordemo.html text/plain ^
|| exit 1
rem Seventh, codemirrordemo.html: wiki to demo codemirror plugin
@ -83,7 +83,7 @@ rem Seventh, codemirrordemo.html: wiki to demo codemirror plugin
node .\tiddlywiki.js ^
.\editions\markdowndemo ^
--verbose ^
--rendertiddler $:/core/templates/tiddlywiki5.template.html %TW5_BUILD_OUTPUT%\markdowndemo.html text/plain ^
--rendertiddler $:/core/save/all %TW5_BUILD_OUTPUT%\markdowndemo.html text/plain ^
|| exit 1

14
bld.sh
View File

@ -37,7 +37,7 @@ node ./tiddlywiki.js \
--verbose \
--rendertiddler ReadMe ./readme.md text/html \
--rendertiddler ContributingTemplate ./contributing.md text/html \
--rendertiddler $:/core/templates/tiddlywiki5.template.html $TW5_BUILD_OUTPUT/index.html text/plain \
--rendertiddler $:/core/save/all $TW5_BUILD_OUTPUT/index.html text/plain \
--rendertiddler $:/core/templates/static.template.html $TW5_BUILD_OUTPUT/static.html text/plain \
--rendertiddler $:/core/templates/static.template.css $TW5_BUILD_OUTPUT/static/static.css text/plain \
--rendertiddlers [!is[system]] $:/core/templates/static.tiddler.html $TW5_BUILD_OUTPUT/static text/plain \
@ -49,7 +49,7 @@ node ./tiddlywiki.js \
./editions/tw5.com \
--verbose \
--password password \
--rendertiddler $:/core/templates/tiddlywiki5.template.html $TW5_BUILD_OUTPUT/encrypted.html text/plain \
--rendertiddler $:/core/save/all $TW5_BUILD_OUTPUT/encrypted.html text/plain \
|| exit 1
# Third, empty.html: empty wiki for reuse
@ -57,7 +57,7 @@ node ./tiddlywiki.js \
node ./tiddlywiki.js \
./editions/empty \
--verbose \
--rendertiddler $:/core/templates/tiddlywiki5.template.html $TW5_BUILD_OUTPUT/empty.html text/plain \
--rendertiddler $:/core/save/all $TW5_BUILD_OUTPUT/empty.html text/plain \
|| exit 1
# Fourth, tahoelafs.html: empty wiki with plugin for Tahoe-LAFS
@ -65,7 +65,7 @@ node ./tiddlywiki.js \
node ./tiddlywiki.js \
./editions/tahoelafs \
--verbose \
--rendertiddler $:/core/templates/tiddlywiki5.template.html $TW5_BUILD_OUTPUT/tahoelafs.html text/plain \
--rendertiddler $:/core/save/all $TW5_BUILD_OUTPUT/tahoelafs.html text/plain \
|| exit 1
# Fifth, d3demo.html: wiki to demo d3 plugin
@ -73,7 +73,7 @@ node ./tiddlywiki.js \
node ./tiddlywiki.js \
./editions/d3demo \
--verbose \
--rendertiddler $:/core/templates/tiddlywiki5.template.html $TW5_BUILD_OUTPUT/d3demo.html text/plain \
--rendertiddler $:/core/save/all $TW5_BUILD_OUTPUT/d3demo.html text/plain \
|| exit 1
# Sixth, codemirrordemo.html: wiki to demo codemirror plugin
@ -81,7 +81,7 @@ node ./tiddlywiki.js \
node ./tiddlywiki.js \
./editions/codemirrordemo \
--verbose \
--rendertiddler $:/core/templates/tiddlywiki5.template.html $TW5_BUILD_OUTPUT/codemirrordemo.html text/plain \
--rendertiddler $:/core/save/all $TW5_BUILD_OUTPUT/codemirrordemo.html text/plain \
|| exit 1
# Seventh, codemirrordemo.html: wiki to demo codemirror plugin
@ -89,7 +89,7 @@ node ./tiddlywiki.js \
node ./tiddlywiki.js \
./editions/markdowndemo \
--verbose \
--rendertiddler $:/core/templates/tiddlywiki5.template.html $TW5_BUILD_OUTPUT/markdowndemo.html text/plain \
--rendertiddler $:/core/save/all $TW5_BUILD_OUTPUT/markdowndemo.html text/plain \
|| exit 1
# Eighth, run the test edition to run the Node.js tests and to generate test.html for tests in the browser

View File

@ -221,7 +221,7 @@ var Command = function(params,commander,callback) {
Command.prototype.execute = function() {
var port = this.params[0] || "8080",
rootTiddler = this.params[1] || "$:/core/templates/tiddlywiki5.template.html",
rootTiddler = this.params[1] || "$:/core/save/all",
renderType = this.params[2] || "text/plain",
serveType = this.params[3] || "text/html",
username = this.params[4] || "ANONYMOUS";

View File

@ -871,7 +871,7 @@ Save the wiki contents. Options are:
*/
exports.saveWiki = function(options) {
options = options || {};
var template = options.template || "$:/core/templates/tiddlywiki5.template.html",
var template = options.template || "$:/core/save/all",
downloadType = options.downloadType || "text/plain";
var text = this.renderTiddler(downloadType,template);
this.callSaver("save",text,function(err) {

View File

@ -0,0 +1,6 @@
title: $:/core/save/all
\define saveTiddlerFilter()
[is[tiddler]] -[type[text/css]] -[type[application/javascript]has[module-type]] -[type[application/javascript]library[yes]] -[[$:/boot/boot.js]] -[[$:/boot/bootprefix.js]] +[sort[title]]
\end
{{$:/core/templates/tiddlywiki5.html}}

View File

@ -0,0 +1,6 @@
title: $:/core/save/empty
\define saveTiddlerFilter()
[is[system]] -[type[text/css]] -[type[application/javascript]has[module-type]] -[type[application/javascript]library[yes]] -[[$:/boot/boot.js]] -[[$:/boot/bootprefix.js]] +[sort[title]]
\end
{{$:/core/templates/tiddlywiki5.html}}

View File

@ -0,0 +1,8 @@
title: $:/core/templates/static.area
<$reveal type="nomatch" state="$:/isEncrypted" text="yes">
{{$:/core/templates/static.content||$:/core/templates/html-tiddler}}
</$reveal>
<$reveal type="match" state="$:/isEncrypted" text="yes">
This file contains an encrypted ~TiddlyWiki. Enable ~JavaScript and enter the decryption password when prompted.
</$reveal>

View File

@ -1,12 +1,11 @@
title: $:/core/templates/static.content
type: text/vnd.tiddlywiki
<$reveal type="nomatch" state="$:/isEncrypted" text="yes">
<!-- For Google, and people without JavaScript-->
<$list filter="[!is[system]sort[title]]" >
<$view field="title" format="text"></$view>
This [[TiddlyWiki|http://tiddlywiki.com]] contains the following tiddlers:
<ul>
<$list filter=<<saveTiddlerFilter>>>
<li><$view field="title" format="text"></$view></li>
</$list>
</$reveal>
<$reveal type="match" state="$:/isEncrypted" text="yes">
This file contains an encrypted ~TiddlyWiki. Enable ~JavaScript and enter the decryption password when prompted.
</$reveal>
</ul>

View File

@ -1,16 +1,13 @@
title: $:/core/templates/store.area.template.html
\define saveFilter()
[is[tiddler]] -[type[text/css]] -[type[application/javascript]has[module-type]] -[type[application/javascript]library[yes]] -[[$:/boot/boot.js]] -[[$:/boot/bootprefix.js]]
\end
<$reveal type="nomatch" state="$:/isEncrypted" text="yes">
`<div id="storeArea" style="display:none;">`
<$list filter=<<saveFilter>> template="$:/core/templates/html-div-tiddler"/>
<$list filter=<<saveTiddlerFilter>> template="$:/core/templates/html-div-tiddler"/>
`</div>`
</$reveal>
<$reveal type="match" state="$:/isEncrypted" text="yes">
`<!------------- Encrypted tiddlers --------->`
`<pre id="encryptedStoreArea" type="text/plain" style="display:none;">`
<$encrypt filter=<<saveFilter>>/>
<$encrypt filter=<<saveTiddlerFilter>>/>
`</pre>`
</$reveal>

View File

@ -1,4 +1,4 @@
title: $:/core/templates/tiddlywiki5.template.html
title: $:/core/templates/tiddlywiki5.html
\rules only filteredtranscludeinline transcludeinline
<!doctype html>
@ -27,7 +27,7 @@ title: $:/core/templates/tiddlywiki5.template.html
<!----------- Static content for Google and browsers without JavaScript ----------->
<noscript>
<div id="splashArea">
{{$:/core/templates/static.content||$:/core/templates/html-tiddler}}
{{$:/core/templates/static.area}}
</div>
</noscript>
<!----------- Ordinary tiddlers ----------->

View File

@ -21,4 +21,8 @@ tags: releasenote
* Fixed problem with displaying tiddler titles that contain WikiText syntax
!! Internal changes
* The main HTML file template used for saving TiddlyWiki5 documents has changed from `$:/core/templates/tiddlywiki5.template.html` to `$:/core/save/all`
Contributors to this release include @jermolene.

View File

@ -1,4 +1,4 @@
created: 201308251606
created: 201311242206
creator: JeremyRuston
modified: 201308251607
modifier: JeremyRuston
@ -12,4 +12,4 @@ title: How to build a TiddlyWiki5 from individual tiddlers
##* Alternatively, just copy the `editions/empty` folder from the TiddlyWiki5 repo
# Create individual TiddlerFiles in the `~/MyWiki/tiddlers` directory
# Execute the following command from the TiddlyWiki5 root directory to build a TiddlyWiki5 file from the tiddlers:
## `node ./tiddlywiki.js ~/MyWiki --rendertiddler $:/core/templates/tiddlywiki5.template.html index.html text/plain`
## `node ./tiddlywiki.js ~/MyWiki --rendertiddler $:/core/save/all index.html text/plain`

View File

@ -1,4 +1,4 @@
modified: 201304251659
modified: 201311222159
tags: dev
title: TestingMechanism
@ -28,7 +28,7 @@ To generate a wiki containing the browser tests load up the `test` wiki and save
node ./tiddlywiki.js \
./editions/test \
--verbose \
--rendertiddler $:/core/templates/tiddlywiki5.template.html $TW5_BUILD_OUTPUT/test.html text/plain \
--rendertiddler $:/core/save/all $TW5_BUILD_OUTPUT/test.html text/plain \
```
Then, open the `test.html` file in the browser to see the test results. There is a prebuilt version of `test.html` at:

View File

@ -7,5 +7,5 @@ rem Optional parameter is the username for signing edits
node .\tiddlywiki.js ^
editions\clientserver ^
--verbose ^
--server 8080 $:/core/templates/tiddlywiki5.template.html text/plain text/html %1^
--server 8080 $:/core/save/all text/plain text/html %1^
|| exit 1

View File

@ -7,5 +7,5 @@
node ./tiddlywiki.js \
editions/clientserver \
--verbose \
--server 8080 $:/core/templates/tiddlywiki5.template.html text/plain text/html $1\
--server 8080 $:/core/save/all text/plain text/html $1\
|| exit 1

View File

@ -15,5 +15,5 @@ rem Run the test edition to run the node.js tests and to generate test.html for
node .\tiddlywiki.js ^
.\editions\test ^
--verbose ^
--rendertiddler $:/core/templates/tiddlywiki5.template.html %TW5_BUILD_OUTPUT%\test.html text/plain ^
--rendertiddler $:/core/save/all %TW5_BUILD_OUTPUT%\test.html text/plain ^
|| exit 1

View File

@ -20,5 +20,5 @@ echo "Using TW5_BUILD_OUTPUT as [$TW5_BUILD_OUTPUT]"
node ./tiddlywiki.js \
./editions/test \
--verbose \
--rendertiddler $:/core/templates/tiddlywiki5.template.html $TW5_BUILD_OUTPUT/test.html text/plain \
--rendertiddler $:/core/save/all $TW5_BUILD_OUTPUT/test.html text/plain \
|| exit 1