1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-12-23 16:40:28 +00:00

Improve output directory handling

This change is likely to break most existing scripts that call
TiddlyWiki.

TL;DR - output paths are now relative to the editions/output folder,
rather than to the current folder

See [[Notes for upgrading to 5.0.11-beta]] for details.
This commit is contained in:
Jermolene 2014-04-27 08:28:21 +01:00
parent 649f68288a
commit e9557b578e
23 changed files with 151 additions and 92 deletions

View File

@ -2,22 +2,13 @@
rem build TiddlyWiki 2.x
rem create a temporary directory if it doesn't already exist
setlocal enableextensions
mkdir tmp\tw2
setlocal disableextensions
rem Delete any existing content
del /q /s tmp\tw2
echo.
rem Prepare the readme file from the revelant content in the tw5.com wiki
node .\tiddlywiki.js ^
editions\tw5.com ^
--verbose ^
--rendertiddler TiddlyWiki2ReadMe editions\tw2\readme.md text/html ^
--output editions\tw2 ^
--rendertiddler TiddlyWiki2ReadMe readme.md text/html ^
|| exit 1
rem cook the TiddlyWiki 2.x.x index file
@ -25,8 +16,9 @@ rem cook the TiddlyWiki 2.x.x index file
node .\tiddlywiki.js ^
editions\tw2 ^
--verbose ^
--output tmp\tw2 ^
--load editions\tw2\source\tiddlywiki.com\index.html.recipe ^
--rendertiddler $:/core/templates/tiddlywiki2.template.html .\tmp\tw2\index.html text/plain ^
--rendertiddler $:/core/templates/tiddlywiki2.template.html index.html text/plain ^
|| exit 1
fc tmp\tw2\index.html editions\tw2\target\prebuilt.html

10
2bld.sh
View File

@ -2,16 +2,13 @@
# build TiddlyWiki 2.x
# create a temporary directory if it doesn't already exist
mkdir -p tmp
mkdir -p tmp/tw2
# Prepare the readme file from the revelant content in the tw5.com wiki
node ./tiddlywiki.js \
editions/tw5.com \
--verbose \
--rendertiddler TiddlyWiki2ReadMe editions/tw2/readme.md text/html \
--output editions/tw2 \
--rendertiddler TiddlyWiki2ReadMe readme.md text/html \
|| exit 1
# cook the TiddlyWiki 2.x.x index file
@ -19,8 +16,9 @@ node ./tiddlywiki.js \
node ./tiddlywiki.js \
editions/tw2 \
--verbose \
--output tmp/tw2 \
--load editions/tw2/source/tiddlywiki.com/index.html.recipe \
--rendertiddler $:/core/templates/tiddlywiki2.template.html ./tmp/tw2/index.html text/plain \
--rendertiddler $:/core/templates/tiddlywiki2.template.html index.html text/plain \
|| exit 1
diff -q tmp/tw2/index.html editions/tw2/target/prebuilt.html

View File

@ -25,28 +25,32 @@ echo "tiddlywiki.com" > $TW5_BUILD_OUTPUT/CNAME
node ./tiddlywiki.js \
./editions/de-AT-DE \
--verbose \
--rendertiddler $:/core/save/all $TW5_BUILD_OUTPUT/de-AT-DE.html text/plain \
--savetiddler $:/favicon.ico $TW5_BUILD_OUTPUT/favicon.ico \
--output $TW5_BUILD_OUTPUT \
--rendertiddler $:/core/save/all de-AT-DE.html text/plain \
--savetiddler $:/favicon.ico favicon.ico \
|| exit 1
node ./tiddlywiki.js \
./editions/zh-Hant \
--verbose \
--rendertiddler $:/core/save/all $TW5_BUILD_OUTPUT/zh-Hant.html text/plain \
--savetiddler $:/favicon.ico $TW5_BUILD_OUTPUT/favicon.ico \
--output $TW5_BUILD_OUTPUT \
--rendertiddler $:/core/save/all zh-Hant.html text/plain \
--savetiddler $:/favicon.ico favicon.ico \
|| exit 1
node ./tiddlywiki.js \
./editions/zh-Hans \
--verbose \
--rendertiddler $:/core/save/all $TW5_BUILD_OUTPUT/zh-Hans.html text/plain \
--savetiddler $:/favicon.ico $TW5_BUILD_OUTPUT/favicon.ico \
--output $TW5_BUILD_OUTPUT \
--rendertiddler $:/core/save/all zh-Hans.html text/plain \
--savetiddler $:/favicon.ico favicon.ico \
|| exit 1
node ./tiddlywiki.js \
./editions/fr-FR \
--verbose \
--rendertiddler $:/core/save/all $TW5_BUILD_OUTPUT/fr-FR.html text/plain \
--savetiddler $:/favicon.ico $TW5_BUILD_OUTPUT/favicon.ico \
--output $TW5_BUILD_OUTPUT \
--rendertiddler $:/core/save/all fr-FR.html text/plain \
--savetiddler $:/favicon.ico favicon.ico \
|| exit 1

35
bld.cmd
View File

@ -34,18 +34,19 @@ rem static.html: the static version of the default tiddlers
node .\tiddlywiki.js ^
.\editions\tw5.com ^
--verbose ^
--rendertiddler $:/core/save/all %TW5_BUILD_OUTPUT%\index.html text/plain ^
--savetiddler $:/favicon.ico %TW5_BUILD_OUTPUT%\favicon.ico ^
--output %TW5_BUILD_OUTPUT% ^
--rendertiddler $:/core/save/all index.html text/plain ^
--savetiddler $:/favicon.ico favicon.ico ^
--rendertiddler ReadMe .\readme.md text/html ^
--rendertiddler ContributingTemplate .\contributing.md text/html ^
--rendertiddler $:/core/copyright.txt .\licenses\copyright.md text/plain ^
--rendertiddler $:/editions/tw5.com/download-empty %TW5_BUILD_OUTPUT%\empty.html text/plain ^
--rendertiddler $:/editions/tw5.com/download-empty %TW5_BUILD_OUTPUT%\empty.hta text/plain ^
--rendertiddler $:/editions/tw5.com/download-empty empty.html text/plain ^
--rendertiddler $:/editions/tw5.com/download-empty empty.hta text/plain ^
--savetiddler $:/green_favicon.ico %TW5_BUILD_OUTPUT%/static/favicon.ico ^
--rendertiddler $:/core/templates/static.template.html %TW5_BUILD_OUTPUT%\static.html text/plain ^
--rendertiddler $:/core/templates/alltiddlers.template.html %TW5_BUILD_OUTPUT%\alltiddlers.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 ^
--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 ^
|| exit 1
rem encrypted.html: a version of the main file encrypted with the password "password"
@ -53,8 +54,9 @@ rem encrypted.html: a version of the main file encrypted with the password "pass
node .\tiddlywiki.js ^
.\editions\tw5.com ^
--verbose ^
--output %TW5_BUILD_OUTPUT% ^
--password password ^
--rendertiddler $:/core/save/all %TW5_BUILD_OUTPUT%\encrypted.html text/plain ^
--rendertiddler $:/core/save/all encrypted.html text/plain ^
|| exit 1
rem tahoelafs.html: empty wiki with plugin for Tahoe-LAFS
@ -62,7 +64,8 @@ rem tahoelafs.html: empty wiki with plugin for Tahoe-LAFS
node .\tiddlywiki.js ^
.\editions\tahoelafs ^
--verbose ^
--rendertiddler $:/core/save/all %TW5_BUILD_OUTPUT%\tahoelafs.html text/plain ^
--output %TW5_BUILD_OUTPUT% ^
--rendertiddler $:/core/save/all tahoelafs.html text/plain ^
|| exit 1
rem d3demo.html: wiki to demo d3 plugin
@ -70,7 +73,8 @@ rem d3demo.html: wiki to demo d3 plugin
node .\tiddlywiki.js ^
.\editions\d3demo ^
--verbose ^
--rendertiddler $:/core/save/all %TW5_BUILD_OUTPUT%\d3demo.html text/plain ^
--output %TW5_BUILD_OUTPUT% ^
--rendertiddler $:/core/save/all d3demo.html text/plain ^
|| exit 1
rem codemirrordemo.html: wiki to demo codemirror plugin
@ -78,7 +82,8 @@ rem codemirrordemo.html: wiki to demo codemirror plugin
node .\tiddlywiki.js ^
.\editions\codemirrordemo ^
--verbose ^
--rendertiddler $:/core/save/all %TW5_BUILD_OUTPUT%\codemirrordemo.html text/plain ^
--output %TW5_BUILD_OUTPUT% ^
--rendertiddler $:/core/save/all codemirrordemo.html text/plain ^
|| exit 1
rem markdowndemo.html: wiki to demo markdown plugin
@ -86,7 +91,8 @@ rem markdowndemo.html: wiki to demo markdown plugin
node .\tiddlywiki.js ^
.\editions\markdowndemo ^
--verbose ^
--rendertiddler $:/core/save/all %TW5_BUILD_OUTPUT%\markdowndemo.html text/plain ^
--output %TW5_BUILD_OUTPUT% ^
--rendertiddler $:/core/save/all markdowndemo.html text/plain ^
|| exit 1
@ -95,7 +101,8 @@ rem highlightdemo.html: wiki to demo highlight plugin
node .\tiddlywiki.js ^
.\editions\highlightdemo ^
--verbose ^
--rendertiddler $:/core/save/all %TW5_BUILD_OUTPUT%\highlightdemo.html text/plain ^
--output %TW5_BUILD_OUTPUT% ^
--rendertiddler $:/core/save/all highlightdemo.html text/plain ^
|| exit 1
rem Make the CNAME file that GitHub Pages requires

37
bld.sh
View File

@ -35,18 +35,19 @@ rm $TW5_BUILD_OUTPUT/static/*
node ./tiddlywiki.js \
./editions/tw5.com \
--verbose \
--rendertiddler $:/core/save/all $TW5_BUILD_OUTPUT/index.html text/plain \
--savetiddler $:/favicon.ico $TW5_BUILD_OUTPUT/favicon.ico \
--output $TW5_BUILD_OUTPUT \
--rendertiddler $:/core/save/all index.html text/plain \
--savetiddler $:/favicon.ico favicon.ico \
--rendertiddler ReadMe ./readme.md text/html \
--rendertiddler ContributingTemplate ./contributing.md text/html \
--rendertiddler $:/core/copyright.txt ./licenses/copyright.md text/plain \
--rendertiddler $:/editions/tw5.com/download-empty $TW5_BUILD_OUTPUT/empty.html text/plain \
--rendertiddler $:/editions/tw5.com/download-empty $TW5_BUILD_OUTPUT/empty.hta text/plain \
--savetiddler $:/green_favicon.ico $TW5_BUILD_OUTPUT/static/favicon.ico \
--rendertiddler $:/core/templates/static.template.html $TW5_BUILD_OUTPUT/static.html text/plain \
--rendertiddler $:/core/templates/alltiddlers.template.html $TW5_BUILD_OUTPUT/alltiddlers.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 \
--rendertiddler $:/editions/tw5.com/download-empty empty.html text/plain \
--rendertiddler $:/editions/tw5.com/download-empty empty.hta text/plain \
--savetiddler $:/green_favicon.ico static/favicon.ico \
--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 \
|| exit 1
# encrypted.html: a version of the main file encrypted with the password "password"
@ -54,8 +55,9 @@ node ./tiddlywiki.js \
node ./tiddlywiki.js \
./editions/tw5.com \
--verbose \
--output $TW5_BUILD_OUTPUT \
--password password \
--rendertiddler $:/core/save/all $TW5_BUILD_OUTPUT/encrypted.html text/plain \
--rendertiddler $:/core/save/all encrypted.html text/plain \
|| exit 1
# tahoelafs.html: empty wiki with plugin for Tahoe-LAFS
@ -63,7 +65,8 @@ node ./tiddlywiki.js \
node ./tiddlywiki.js \
./editions/tahoelafs \
--verbose \
--rendertiddler $:/core/save/all $TW5_BUILD_OUTPUT/tahoelafs.html text/plain \
--output $TW5_BUILD_OUTPUT \
--rendertiddler $:/core/save/all tahoelafs.html text/plain \
|| exit 1
# d3demo.html: wiki to demo d3 plugin
@ -71,7 +74,8 @@ node ./tiddlywiki.js \
node ./tiddlywiki.js \
./editions/d3demo \
--verbose \
--rendertiddler $:/core/save/all $TW5_BUILD_OUTPUT/d3demo.html text/plain \
--output $TW5_BUILD_OUTPUT \
--rendertiddler $:/core/save/all d3demo.html text/plain \
|| exit 1
# codemirrordemo.html: wiki to demo codemirror plugin
@ -79,7 +83,8 @@ node ./tiddlywiki.js \
node ./tiddlywiki.js \
./editions/codemirrordemo \
--verbose \
--rendertiddler $:/core/save/all $TW5_BUILD_OUTPUT/codemirrordemo.html text/plain \
--output $TW5_BUILD_OUTPUT \
--rendertiddler $:/core/save/all codemirrordemo.html text/plain \
|| exit 1
# markdowndemo.html: wiki to demo markdown plugin
@ -87,7 +92,8 @@ node ./tiddlywiki.js \
node ./tiddlywiki.js \
./editions/markdowndemo \
--verbose \
--rendertiddler $:/core/save/all $TW5_BUILD_OUTPUT/markdowndemo.html text/plain \
--output $TW5_BUILD_OUTPUT \
--rendertiddler $:/core/save/all markdowndemo.html text/plain \
|| exit 1
# highlightdemo.html: wiki to demo highlight plugin
@ -95,7 +101,8 @@ node ./tiddlywiki.js \
node ./tiddlywiki.js \
./editions/highlightdemo \
--verbose \
--rendertiddler $:/core/save/all $TW5_BUILD_OUTPUT/highlightdemo.html text/plain \
--output $TW5_BUILD_OUTPUT \
--rendertiddler $:/core/save/all highlightdemo.html text/plain \
|| exit 1
# Run the test edition to run the Node.js tests and to generate test.html for tests in the browser

View File

@ -1,10 +1,10 @@
title: $:/language/Help/output
description: Set the base output directory for subsequent commands
Sets the base output directory for subsequent commands. The default output directory is the current working directory.
Sets the base output directory for subsequent commands. The default output directory is the `output` subdirectory of the edition directory.
```
--output <pathname>
```
If the specified pathname is relative then it is resolved relative to the current output directory.
If the specified pathname is relative then it is resolved relative to the current working directory.

View File

@ -7,4 +7,6 @@ Render an individual tiddler as a specified ContentType, defaults to `text/html`
--rendertiddler <title> <filename> [<type>]
```
By default, the filename is resolved relative to the `output` subdirectory of the edition directory. The `--output` command can be used to direct output to a different directory.
Any missing directories in the path to the filename are automatically created.

View File

@ -13,4 +13,6 @@ For example:
--rendertiddlers [!is[system]] $:/core/templates/static.tiddler.html ./static text/plain
```
By default, the pathname is resolved relative to the `output` subdirectory of the edition directory. The `--output` command can be used to direct output to a different directory.
Any files in the target directory are deleted. The target directory is recursively created if it is missing.

View File

@ -7,4 +7,6 @@ Saves an individual tiddler in its raw text or binary format to the specified fi
--savetiddler <title> <filename>
```
By default, the filename is resolved relative to the `output` subdirectory of the edition directory. The `--output` command can be used to direct output to a different directory.
Any missing directories in the path to the filename are automatically created.

View File

@ -26,7 +26,7 @@ var Commander = function(commandTokens,callback,wiki,streams) {
this.callback = callback;
this.wiki = wiki;
this.streams = streams;
this.outputPath = process.cwd();
this.outputPath = path.resolve($tw.boot.wikiPath,$tw.config.wikiOutputSubDir);
};
/*

View File

@ -29,7 +29,7 @@ Command.prototype.execute = function() {
if(this.params.length < 1) {
return "Missing output path";
}
this.commander.outputPath = path.resolve(this.commander.outputPath,this.params[0]);
this.commander.outputPath = path.resolve(process.cwd(),this.params[0]);
return null;
};

View File

@ -0,0 +1,31 @@
created: 20140426170234142
modified: 20140426170234142
tags: releasenote
title: Release 5.0.11-beta
type: text/vnd.tiddlywiki
//[[See GitHub for detailed change history of this release|https://github.com/Jermolene/TiddlyWiki5/compare/v5.0.10-beta...v5.0.11-beta]]//
!! Incompatible Changes
See [[Notes for upgrading to 5.0.11-beta]] for more details of these changes:
* The default output location for command line operations has changed to the `/output` folder within the TiddlyWikiFolder (it used to be current directory).
Commands when [[Using TiddlyWiki on Node.js]]
!! Documentation Improvements
*
!! Usability Improvements
*
!! Hackability Improvements
*
!! Bug Fixes
*

View File

@ -0,0 +1,23 @@
created: 20140426170234142
modified: 20140426170234142
tags: howto
title: Notes for upgrading to 5.0.11-beta
type: text/vnd.tiddlywiki
Version 5.0.11-beta includes some changes that can break content from earlier releases of ~TiddlyWiki 5.
! Command line changes
Previously, commands that generate output files would interpret the specified path to the file as being relative to the current working directory. So, for example, the following command would write `index.html` to the current directory:
```
tiddlywiki mywiki --rendertiddler $:/core/save/all index.html text/plain
```
In 5.0.11-beta this behaviour has changed, and now the specified filename is resolved relative to an `output` folder within the TiddlyWikiFolder. So the command above will now write the file `index.html` to `mywiki/output/index.html`.
You can override this behaviour with the OutputCommand. For example, to generate the `index.html` file within the current directory:
```
tiddlywiki mywiki --output . --rendertiddler $:/core/save/all index.html text/plain
```

View File

@ -2,14 +2,11 @@
rem Split the tiddlers out of a TiddlyWiki file
setlocal enableextensions
mkdir tmp\ginsu
setlocal disableextensions
node .\tiddlywiki.js ^
.\editions\empty ^
--verbose ^
--load %1 ^
--rendertiddler $:/core/templates/split-recipe tmp\ginsu\split.recipe text/plain ^
--rendertiddlers [!is[system]] $:/core/templates/tid-tiddler tmp\ginsu text/plain .tid ^
--output tmp ^
--rendertiddlers [!is[system]] $:/core/templates/tid-tiddler ginsu text/plain .tid ^
--rendertiddler $:/core/templates/split-recipe ginsu\split.recipe text/plain ^
|| exit 1

View File

@ -2,13 +2,11 @@
# Split the tiddlers out of a TiddlyWiki file
mkdir -p tmp
mkdir -p tmp/ginsu
node ./tiddlywiki.js \
./editions/empty \
--verbose \
--load $1 \
--rendertiddler $:/core/templates/split-recipe tmp/ginsu/split.recipe text/plain \
--rendertiddlers [!is[system]] $:/core/templates/tid-tiddler tmp/ginsu text/plain .tid \
--output tmp \
--rendertiddlers [!is[system]] $:/core/templates/tid-tiddler ginsu text/plain .tid \
--rendertiddler $:/core/templates/split-recipe ginsu/split.recipe text/plain \
|| exit 1

View File

@ -22,6 +22,7 @@ rem index.html: the main file, including content
node .\tiddlywiki.js ^
.\editions\tw5.com ^
--verbose ^
--rendertiddler $:/core/save/all %TW5_BUILD_OUTPUT%\index.html text/plain ^
--savetiddler $:/favicon.ico %TW5_BUILD_OUTPUT%\favicon.ico ^
--output %TW5_BUILD_OUTPUT% ^
--rendertiddler $:/core/save/all index.html text/plain ^
--savetiddler $:/favicon.ico favicon.ico ^
|| exit 1

View File

@ -25,6 +25,7 @@ echo "tiddlywiki.com" > $TW5_BUILD_OUTPUT/CNAME
node ./tiddlywiki.js \
./editions/tw5.com \
--verbose \
--rendertiddler $:/core/save/all $TW5_BUILD_OUTPUT/index.html text/plain \
--savetiddler $:/favicon.ico $TW5_BUILD_OUTPUT/favicon.ico \
--output $TW5_BUILD_OUTPUT \
--rendertiddler $:/core/save/all index.html text/plain \
--savetiddler $:/favicon.ico favicon.ico \
|| exit 1

View File

@ -4,16 +4,13 @@ rem build the Tank edition of TiddlyWiki
rem See https://tank.peermore.com
rem Create the tmp directory if needed
mkdir tmp
rem Open the tank edition in TW5 and save the template for the main HTML file
node .\tiddlywiki.js ^
editions\tw5tank ^
--verbose ^
--rendertiddler $:/core/save/all tmp\app.html text/plain ^
--output tmp ^
--rendertiddler $:/core/save/all app.html text/plain ^
|| exit 1
rem Prepend the type information that TiddlyWeb needs to turn the .html file into a .tid file

View File

@ -4,16 +4,13 @@
# See https://tank.peermore.com
# Create the tmp directory if needed
mkdir -p tmp
# Open the tank edition in TW5 and save the template for the main HTML file
node ./tiddlywiki.js \
editions/tw5tank \
--verbose \
--rendertiddler $:/core/save/all tmp/app.html text/plain \
--output tmp \
--rendertiddler $:/core/save/all app.html text/plain \
|| exit 1
# Prepend the type information that TiddlyWeb needs to turn the .html file into a .tid file

View File

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

View File

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

View File

@ -6,16 +6,13 @@ rem of a member of the tw5tiddlyweb space
rem usage:
rem .\wbld.cmd <tiddlyspace username> <tiddlyspace password>
rem Create the tmp directory if needed
mkdir tmp
rem Open the tw5tiddlyweb edition in TW5 and save the template for the main HTML file
node .\tiddlywiki.js ^
editions\tw5tiddlyweb ^
--verbose ^
--rendertiddler $:/core/save/all tmp\tiddlyweb.html text/plain ^
--output tmp ^
--rendertiddler $:/core/save/all tiddlyweb.html text/plain ^
|| exit 1
rem Prepend the type information that TiddlyWeb needs to turn the .html file into a .tid file

View File

@ -15,7 +15,8 @@ mkdir -p tmp
node ./tiddlywiki.js \
editions/tw5tiddlyweb \
--verbose \
--rendertiddler $:/core/save/all tmp/tiddlyweb.html text/plain \
--output tmp \
--rendertiddler $:/core/save/all tiddlyweb.html text/plain \
|| exit 1
# Prepend the type information that TiddlyWeb needs to turn the .html file into a .tid file