From 37823f64e96809df16884c605b062f8da2453635 Mon Sep 17 00:00:00 2001 From: nome Date: Sun, 3 Apr 2016 21:22:11 +0200 Subject: [PATCH] Add build targets to server edition Define for the server edition the same build targets as for the empty edition, but using the correct template so that the "offline" version (target "index") works correctly when accessed via HTTP. With this, `tiddlywiki --build index` is equivalent to the save button. While the process of setting up TiddlyWiki on Node.js is well documented and easy enough, the options for publishing such a wiki to an offline version (scriptably, e.g. for push-to-deploy setups) are decidedly non-obvious. With the added build steps, the user only needs to know three simple commands: tiddlywiki --init server tiddlywiki --server tiddlywiki --build index and optionally tiddlywiki --build static --- editions/server/tiddlywiki.info | 16 +++++++++++++++- .../nodejs/Installing TiddlyWiki on Node.js.tid | 6 +++++- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/editions/server/tiddlywiki.info b/editions/server/tiddlywiki.info index 53951b8d1..ac7bd0aad 100644 --- a/editions/server/tiddlywiki.info +++ b/editions/server/tiddlywiki.info @@ -8,5 +8,19 @@ "themes": [ "tiddlywiki/vanilla", "tiddlywiki/snowwhite" - ] + ], + "build": { + "index": [ + "--rendertiddler","$:/plugins/tiddlywiki/tiddlyweb/save/offline","index.html","text/plain"], + "externalimages": [ + "--savetiddlers","[is[image]]","images", + "--setfield","[is[image]]","_canonical_uri","$:/core/templates/canonical-uri-external-image","text/plain", + "--setfield","[is[image]]","text","","text/plain", + "--rendertiddler","$:/plugins/tiddlywiki/tiddlyweb/save/offline","externalimages.html","text/plain"], + "static": [ + "--rendertiddler","$:/core/templates/static.template.html","static.html","text/plain", + "--rendertiddler","$:/core/templates/alltiddlers.template.html","alltiddlers.html","text/plain", + "--rendertiddler","$:/core/templates/static.template.css","static/static.css","text/plain", + "--rendertiddlers","[!is[system]]","$:/core/templates/static.tiddler.html","static","text/plain"] + } } diff --git a/editions/tw5.com/tiddlers/nodejs/Installing TiddlyWiki on Node.js.tid b/editions/tw5.com/tiddlers/nodejs/Installing TiddlyWiki on Node.js.tid index 9f51cc4bb..951123221 100644 --- a/editions/tw5.com/tiddlers/nodejs/Installing TiddlyWiki on Node.js.tid +++ b/editions/tw5.com/tiddlers/nodejs/Installing TiddlyWiki on Node.js.tid @@ -17,9 +17,13 @@ type: text/vnd.tiddlywiki ## `tiddlywiki mynewwiki --server` to start TiddlyWiki ## Visit http://127.0.0.1:8080/ in your browser ## Try editing and creating tiddlers +# Optionally, make an offline copy: +#* click the {{$:/core/images/save-button}} ''Save changes'' button in the sidebar, ''OR'' +#* `tiddlywiki --build index` + The `-g` flag causes TiddlyWiki to be installed globally. Without it, TiddlyWiki will only be available in the directory where you installed it. If you are using Debian or Debian-based Linux and you are reciving a `node: command not found` error though node.js package is installed, you may need to create a symbolic link between `nodejs` and `node`. Consult your distro's manual and `whereis` to correctly create a link. See github [[issue 1434|http://github.com/Jermolene/TiddlyWiki5/issues/1434]] -Example Debian v8.0: `sudo ln -s /usr/bin/nodejs /usr/bin/node` \ No newline at end of file +Example Debian v8.0: `sudo ln -s /usr/bin/nodejs /usr/bin/node`