Get TiddlyWiki5 in the Sky for TiddlyWeb working again

This commit is contained in:
Jeremy Ruston 2013-03-06 16:45:13 +00:00
parent 06c5308c4b
commit 4f711efa5d
4 changed files with 50 additions and 24 deletions

View File

@ -0,0 +1,23 @@
title: TiddlyWiki5 in the Sky for TiddlyWeb
modifier: JeremyRuston
tags: edition docs
The TiddlyWiki5 in the Sky for TiddlyWeb allows content to be synchronised between TiddlyWiki5 running in the browser and a TiddlyWeb (or TiddlySpace) server. Features include:
* Lazy loading
* Two way synchronisation between the browser and the server
** Synchronising from the server is accomplished by polling (currently every 60 seconds)
* Throttling so that rapidly changing tiddlers don't overwhelm the server
The implementation is somewhat experimental, and includes these limitations:
* Only works with tiddlers written in TiddlyWiki5 WikiText. Tiddlers in the old syntax will be parsed as TiddlyWiki5 syntax
* New tiddlers are not saved to the server
* No way to delete tiddlers
To try out TiddlyWiki5 in the Sky for TiddlyWeb:
# If necessary, create an account at http://tiddlyspace.com/
# Create a new space, eg `myspace`
# Include the space `tw5tiddlyweb`
# Visit `http://myspace.tiddlyspace.com/tw5`

View File

@ -1,3 +1,3 @@
title: TiddlerListTemplate
<<view title link>> <small><<view type>></small>
<$view field="title" format="link"/> <small><$view field="type"/></small>

View File

@ -20,19 +20,17 @@ Current [[login status|$:/plugins/tiddlyweb/IsLoggedIn]]: {{$:/plugins/tiddlyweb
Current [[username|$:/plugins/tiddlyweb/UserName]]: {{$:/plugins/tiddlyweb/UserName}}
----
<<reveal state:[[$:/plugins/tiddlyweb/IsLoggedIn]] type:nomatch text:yes><
Log in to ~TiddlyWeb: <<button message:login class:"btn btn-info"><Login>>
>>
<<reveal state:[[$:/plugins/tiddlyweb/IsLoggedIn]] type:match text:yes><
Log out of ~TiddlyWeb: <<button message:logout class:"btn btn-warning"><Logout>>
>>
<$reveal state="$:/plugins/tiddlyweb/IsLoggedIn" type="nomatch" text="yes">
Log in to ~TiddlyWeb: <$button message="tw-login" class="btn btn-info">Login</$button>
</$reveal>
<$reveal state="$:/plugins/tiddlyweb/IsLoggedIn" type="match" text="yes">
Log out of ~TiddlyWeb: <$button message="tw-logout" class="btn btn-warning">Logout</$button>
</$reveal>
----
All tiddlers:
<<list all template:TiddlerListTemplate>>
<$list type="all" template="TiddlerListTemplate"/>

33
wbld.sh
View File

@ -1,24 +1,29 @@
#!/bin/bash
# build the TiddlyWeb edition of TiddlyWiki5 and upload to TiddlySpace
# build the TiddlyWeb edition of TiddlyWiki5 and upload it to TiddlySpace. Requires the TiddlySpace credentials
# of a member of the tw5tiddlyweb space
# usage:
# ./wbld.sh <tiddlyspace username> <tiddlyspace password>
pushd editions/tw5tiddlyweb > /dev/null
node ../../tiddlywiki.js \
--verbose \
--savetiddler $:/core/templates/tiddlywiki5.template.html ../../../jermolene.github.com/tiddlyweb.html text/plain \
|| exit 1
popd > /dev/null
# Create the tmp directory if needed
mkdir -p tmp
echo "type: text/html" > tmp/tmp.txt
echo "" >> tmp/tmp.txt
cat ../jermolene.github.com/tiddlyweb.html >> tmp/tmp.txt
curl -u $1:$2 -X PUT -H "content-type: text/plain" http://tw5tiddlyweb.tiddlyspace.com/bags/tw5tiddlyweb_public/tiddlers/tw5 --data-binary @tmp/tmp.txt
# Open the tw5tiddlyweb edition in TW5 and save the template for the main HTML file
rm tmp/tmp.txt
node ./tiddlywiki.js \
editions/tw5tiddlyweb \
--verbose \
--savetiddler $:/core/templates/tiddlywiki5.template.html tmp/tiddlyweb.html text/plain \
|| exit 1
# Prepend the type information that TiddlyWeb needs to turn the .html file into a .tid file
echo "type: text/html" > tmp/tiddlerforupload.txt
echo "" >> tmp/tiddlerforupload.txt
cat tmp/tiddlyweb.html >> tmp/tiddlerforupload.txt
# Upload the tiddler file
curl -u $1:$2 -X PUT -H "content-type: text/plain" http://tw5tiddlyweb.tiddlyspace.com/bags/tw5tiddlyweb_public/tiddlers/tw5 --data-binary @tmp/tiddlerforupload.txt