mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2025-09-11 15:26:05 +00:00
Fix problems with building single-file wiki using external-js template
* core/templates/external-js/tiddlywiki5-external-js.html.tid, core/templates/external-js/save-all-external-js.tid, core/templates/external-js/save-offline-external-js.tid core/templates/external-js/load-external-js.tid: Fix #5343. Exclude client-server plugins in tiddler imports and to specify a working URL for loading tiddlywiki5.js from local disk. Mirror save/all and save/offline templates in the regular server edition. Fix #4717 (tiddlywiki5-external-js.html.tid) * core/modules/saver-handler.js: Need the change to make single file autosave work with the external-js template. * editions/server-external-js/tiddlywiki.info: Provide external-js related build targets. * core/language/en-GB/Snippets/ExtJSReadme.tid: Temporary doc to supplement TW5.com's external-js section. Demonstrate that upgrade could be done on single-file wikis with an externalized TW core. * core/language/en-GB/Snippets/GetTiddlyWikiJS.tid: Documentation. Meant to be included in every wiki and to help end users acquire tiddlywiki5.js.
This commit is contained in:
15
core/language/en-GB/Snippets/ExtJSReadme.tid
Normal file
15
core/language/en-GB/Snippets/ExtJSReadme.tid
Normal file
@@ -0,0 +1,15 @@
|
||||
title: $:/language/Snippets/ExtJSReadme
|
||||
|
||||
Additions to ~TiddlyWiki documentation [[Using the external JavaScript template|https://tiddlywiki.com/#Using%20the%20external%20JavaScript%20template]]:
|
||||
|
||||
To ensure that the "save snapshot for offline use" button saves a working wiki, it is also necessary to set the tiddler $:/config/SaveWikiButton/Template to contain <code>~$:/core/save/<b>offline-external-js</b></code>. You must also save a copy of "tiddlywiki5.js" in the same folder as your offline wiki file. See [[How to obtain tiddlywiki5.js|$:/language/Snippets/GetTiddlyWikiJS]] for details.
|
||||
|
||||
!! Upgrading
|
||||
|
||||
Upgrading an offline wiki with an external-js template will be a three-step process:
|
||||
|
||||
# Follow the standalone file ~TiddlyWiki Upgrading process. Your wiki will be converted to a full standalone version.
|
||||
|
||||
# Open $:/language/Snippets/GetTiddlyWikiJS tiddler from your newly upgraded wiki and click the "Export tiddlywiki5.js" button.
|
||||
|
||||
# Verify that $:/config/SaveWikiButton/Template still contains `$:/core/save/offline-external-js`. Save your wiki again and the wiki will be converted to using the external-js template.
|
54
core/language/en-GB/Snippets/GetTiddlyWikiJS.tid
Normal file
54
core/language/en-GB/Snippets/GetTiddlyWikiJS.tid
Normal file
@@ -0,0 +1,54 @@
|
||||
title: $:/language/Snippets/GetTiddlyWikiJS
|
||||
|
||||
To obtain "tiddlywiki5.js" for your offline external-js ~TiddlyWiki, use one of the following methods:
|
||||
<ul>
|
||||
|
||||
<$reveal state="$:/plugins/tiddlywiki/tiddlyweb!!plugin-type" type="match" text="plugin">
|
||||
|
||||
<li>
|
||||
If you are running ~TiddlyWiki on node.js, you can download <a class="tc-tiddlylink" href="%24%3A%2Fcore%2Ftemplates%2Ftiddlywiki5.js" download="tiddlywiki5.js">tiddlywiki5.js</a> from your server.
|
||||
</li>
|
||||
|
||||
</$reveal>
|
||||
<$set name=isButtonOff filter="[[$:/boot/boot.js]is[missing]then[yes]else[no]]">
|
||||
<$set name=cssState filter="""[[$:/boot/boot.js]is[missing]then[background-color:#a9a9a9]]""" select="0">
|
||||
|
||||
<li>
|
||||
|
||||
If this wiki's ~TiddlyWiki core has not been externalized, you can click the following button to export "tiddlywiki5.js" from your own wiki:
|
||||
<div><$button style=<<cssState>> class="tc-btn-big-green" disabled=<<isButtonOff>> >
|
||||
<$wikify name="site-title" text={{$:/config/SaveWikiButton/Filename}}>
|
||||
<$action-sendmessage $message="tm-download-file" $param="$:/core/templates/tiddlywiki5.js" filename="tiddlywiki5.js"/>
|
||||
</$wikify>
|
||||
{{$:/core/images/download-button}} Export tiddlywiki5.js
|
||||
</$button></div>
|
||||
|
||||
</li>
|
||||
|
||||
</$set></$set>
|
||||
|
||||
<li>
|
||||
|
||||
If you have created your wiki from the "server-external-js" edition, then you can run the command:
|
||||
|
||||
```
|
||||
tiddllywiki <your-wiki-folder> --build tiddlywiki5.js
|
||||
```
|
||||
|
||||
File "tiddlywiki5.js" will be saved in the`output` folder within your wiki-folder.
|
||||
|
||||
</li>
|
||||
<li>
|
||||
|
||||
From the command line, run:
|
||||
|
||||
```
|
||||
tiddlywiki <your-wiki-folder> \
|
||||
--rendertiddler '$:/core/templates/tiddlywiki5.js' \
|
||||
tiddlywiki5.js text/plain
|
||||
```
|
||||
|
||||
File "tiddlywiki5.js" will be saved in the`output` folder within your wiki-folder.
|
||||
|
||||
</li>
|
||||
</ul>
|
@@ -157,7 +157,8 @@ SaverHandler.prototype.saveWiki = function(options) {
|
||||
return false;
|
||||
}
|
||||
var variables = options.variables || {},
|
||||
template = options.template || "$:/core/save/all",
|
||||
template = options.template ||
|
||||
this.wiki.getTiddlerText("$:/config/SaveWikiButton/Template", "$:/core/save/all"),
|
||||
downloadType = options.downloadType || "text/plain",
|
||||
text = this.wiki.renderTiddler(downloadType,template,options),
|
||||
callback = function(err) {
|
||||
|
3
core/templates/external-js/load-external-js.tid
Normal file
3
core/templates/external-js/load-external-js.tid
Normal file
@@ -0,0 +1,3 @@
|
||||
title: $:/core/templates/load-external-js
|
||||
|
||||
<script src="<<coreURL>>" onerror="alert('Error: Cannot load tiddlywiki5.js');"></script>
|
@@ -4,4 +4,5 @@ title: $:/core/save/all-external-js
|
||||
\define saveTiddlerFilter()
|
||||
[is[tiddler]] -[prefix[$:/state/popup/]] -[prefix[$:/temp/]] -[prefix[$:/HistoryList]] -[status[pending]plugin-type[import]] -[[$:/core]] -[[$:/boot/boot.css]] -[type[application/javascript]library[yes]] -[[$:/boot/boot.js]] -[[$:/boot/bootprefix.js]] +[sort[title]] $(publishFilter)$
|
||||
\end
|
||||
\define coreURL() %24%3A%2Fcore%2Ftemplates%2Ftiddlywiki5.js
|
||||
{{$:/core/templates/tiddlywiki5-external-js.html}}
|
||||
|
8
core/templates/external-js/save-offline-external-js.tid
Normal file
8
core/templates/external-js/save-offline-external-js.tid
Normal file
@@ -0,0 +1,8 @@
|
||||
title: $:/core/save/offline-external-js
|
||||
|
||||
\import [[$:/core/ui/PageMacros]] [all[shadows+tiddlers]tag[$:/tags/Macro]!has[draft.of]]
|
||||
\define saveTiddlerFilter()
|
||||
[is[tiddler]] -[prefix[$:/state/popup/]] -[prefix[$:/temp/]] -[prefix[$:/HistoryList]] -[status[pending]plugin-type[import]] -[[$:/core]] -[[$:/plugins/tiddlywiki/filesystem]] -[[$:/plugins/tiddlywiki/tiddlyweb]] -[[$:/boot/boot.css]] -[type[application/javascript]library[yes]] -[[$:/boot/boot.js]] -[[$:/boot/bootprefix.js]] +[sort[title]] $(publishFilter)$
|
||||
\end
|
||||
\define coreURL() tiddlywiki5.js
|
||||
{{$:/core/templates/tiddlywiki5-external-js.html}}
|
@@ -2,7 +2,7 @@ title: $:/core/templates/tiddlywiki5-external-js.html
|
||||
|
||||
\rules only filteredtranscludeinline transcludeinline
|
||||
<!doctype html>
|
||||
{{$:/core/templates/MOTW.html}}<html lang="`<$text text={{{ [{$:/language}get[name]] }}}/>`">
|
||||
{{$:/core/templates/MOTW.html}}<html lang="{{{ [{$:/language}get[name]] }}}">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
|
||||
<!--~~ Raw markup for the top of the head section ~~-->
|
||||
@@ -43,5 +43,6 @@ title: $:/core/templates/tiddlywiki5-external-js.html
|
||||
<!--~~ Raw markup for the bottom of the body section ~~-->
|
||||
{{{ [all[shadows+tiddlers]tag[$:/tags/RawMarkupWikified/BottomBody]] ||$:/core/templates/raw-static-tiddler}}}
|
||||
</body>
|
||||
<script src="%24%3A%2Fcore%2Ftemplates%2Ftiddlywiki5.js" onerror="alert('Error: Cannot load tiddlywiki.js');"></script>
|
||||
<!--~~ Load external JS ~~-->
|
||||
{{$:/core/templates/load-external-js}}
|
||||
</html>
|
||||
|
@@ -13,11 +13,14 @@
|
||||
"listen": [
|
||||
"--listen","root-tiddler=$:/core/save/all-external-js"],
|
||||
"index": [
|
||||
"--rendertiddler","$:/plugins/tiddlywiki/tiddlyweb/save/offline","index.html","text/plain"],
|
||||
"--rendertiddler","$:/core/save/offline-external-js","index.html","text/plain",
|
||||
"--rendertiddler","$:/core/templates/tiddlywiki5.js","tiddlywiki5.js","text/plain"],
|
||||
"static": [
|
||||
"--rendertiddler","$:/core/templates/static.template.html","static.html","text/plain",
|
||||
"--rendertiddler","$:/core/templates/alltiddlers.template.html","alltiddlers.html","text/plain",
|
||||
"--rendertiddlers","[!is[system]]","$:/core/templates/static.tiddler.html","static","text/plain",
|
||||
"--rendertiddler","$:/core/templates/static.template.css","static/static.css","text/plain"]
|
||||
"--rendertiddler","$:/core/templates/static.template.css","static/static.css","text/plain"],
|
||||
"tiddlywiki5.js": [
|
||||
"--rendertiddler","$:/core/templates/tiddlywiki5.js","tiddlywiki5.js","text/plain"]
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user