1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-06-26 15:23:15 +00:00

Added templates and temporary command for building TiddlyWiki with the new parser

This commit is contained in:
Jeremy Ruston 2012-12-26 19:38:39 +00:00
parent 750389bf6f
commit 90a09c0a42
10 changed files with 158 additions and 0 deletions

1
bld.sh
View File

@ -12,6 +12,7 @@ node ../../tiddlywiki.js \
--verbose \
--password password \
--savetiddler ReadMe ../../readme.md text/html \
--newsavetiddler $:/core/templates/new.tiddlywiki5.template.html ../../../jermolene.github.com/new.index.html text/plain \
--savetiddler $:/core/templates/tiddlywiki5.template.html ../../../jermolene.github.com/index.html text/plain \
--savetiddler $:/core/templates/tiddlywiki5.encrypted.template.html ../../../jermolene.github.com/encrypted.html text/plain \
--savetiddler $:/core/templates/static.template.html ../../../jermolene.github.com/static.html text/plain \

View File

@ -0,0 +1,51 @@
/*\
title: $:/core/modules/commands/newsavetiddler.js
type: application/javascript
module-type: command
Command to save a tiddler to a file
\*/
(function(){
/*jslint node: true, browser: true */
/*global $tw: false */
"use strict";
exports.info = {
name: "newsavetiddler",
synchronous: false
};
var Command = function(params,commander,callback) {
this.params = params;
this.commander = commander;
this.callback = callback;
};
Command.prototype.execute = function() {
if(this.params.length < 2) {
return "Missing filename";
}
if(!this.commander.wiki.vocabulary) {
this.commander.wiki.new_initParsers();
}
var self = this,
fs = require("fs"),
path = require("path"),
title = this.params[0],
filename = this.params[1],
type = this.params[2] || "text/html";
fs.writeFile(filename,this.commander.wiki.new_renderTiddler(type,title),"utf8",function(err) {
self.callback(err);
});
return null;
};
exports.Command = Command;
})();

View File

@ -0,0 +1,7 @@
title: $:/templates/NewStaticContent
type: text/vnd.tiddlywiki
<!-- For Google, and people without JavaScript-->
<_list filter="[!is[shadow]sort[title]]" >
<_view field="title" format="text"></_view>
</_list>

View File

@ -0,0 +1,7 @@
title: $:/core/templates/css-tiddler
<!--
This template is used for saving CSS tiddlers as a style tag with data attributes representing the tiddler fields.
-->`<style`<_fields template=' data-tiddler-$name$="$encoded_value$"'></_fields>` type="text/css">`<_view field="text" format="text" />`</style>`

View File

@ -0,0 +1,9 @@
title: $:/core/templates/html-div-tiddler
<!--
This template is used for saving tiddlers as an HTML DIV tag with attributes representing the tiddler fields.
-->`<div`<_fields template=' $name$="$encoded_value$"'></_fields>`>
<pre>`<_view field="text" format="htmlencoded" />`</pre>
</div>`

View File

@ -0,0 +1,7 @@
title: $:/core/templates/html-tiddler
<!--
This template is used for saving tiddlers as raw HTML
--><_view field="text" format="htmlwikified" />

View File

@ -0,0 +1,7 @@
title: $:/core/templates/javascript-tiddler
<!--
This template is used for saving JavaScript tiddlers as a script tag with data attributes representing the tiddler fields.
-->`<script`<_fields template=' data-tiddler-$name$="$encoded_value$"'></_fields>` type="text/javascript">`<_view field="text" format="text" />`</script>`

View File

@ -0,0 +1,8 @@
title: $:/core/templates/module-tiddler
<!--
This template is used for saving JavaScript tiddlers as a script tag with data attributes representing the tiddler fields. The body of the tiddler is wrapped in a call to the `$tw.modules.define` function in order to define the body of the tiddler as a module
-->`<script`<_fields template=' data-tiddler-$name$="$encoded_value$"'></_fields>` type="text/javascript" data-module="yes">$tw.modules.define("`<_view field="title" format="jsencoded" />`","`<_view field="module-type" format="jsencoded" />`",function(module,exports,require) {`<_view field="text" format="text" />`});
</script>`

View File

@ -0,0 +1,58 @@
title: $:/core/templates/new.tiddlywiki5.template.html
\rules only filteredtranscludeinline transcludeinline
<!doctype html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<meta name="application-name" content="TiddlyWiki" />
<meta name="generator" content="TiddlyWiki" />
<meta name="tiddlywiki-version" content="{{version}}" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
<meta name="format-detection" content="telephone=no">
<meta name="copyright" content="{{$:/core/copyright.txt}}" />
<title>{{$:/core/wiki/title}}</title>
<!----------- This is a Tiddlywiki file. The points of interest in the file are marked with this pattern ----------->
<!----------- Raw markup ----------->
{{{ [tag[$:/core/wiki/rawmarkup]] ||$:/core/templates/plain-text-tiddler}}}
</head>
<body>
<!----------- Static styles ----------->
<div id="styleArea">
{{{ [is[shadow]type[text/css]] ||$:/core/templates/css-tiddler}}}
</div>
<!----------- Static content for Google and browsers without JavaScript ----------->
<noscript>
<div id="splashArea">
{{$:/templates/NewStaticContent||$:/core/templates/html-tiddler}}
</div>
</noscript>
<!----------- Miscellaneous shadow tiddlers ----------->
<div id="shadowArea" style="display:none;">
{{{ [is[shadow]] -[type[text/css]] -[type[application/javascript]has[module-type]] -[type[application/javascript]library[yes]] -[[$:/core/boot.js]] -[[$:/core/bootprefix.js]] ||$:/core/templates/html-div-tiddler}}}
</div>
<!----------- Ordinary tiddlers ----------->
<div id="storeArea" style="display:none;">
{{{ [!is[shadow]] ||$:/core/templates/html-div-tiddler}}}
</div>
<!----------- Library modules ----------->
<div id="libraryModules" style="display:none;">
{{$:/core/lib/jquery.min.js||$:/core/templates/javascript-tiddler}}
{{{ [is[shadow]type[application/javascript]library[yes]] -[[$:/core/lib/jquery.min.js]] ||$:/core/templates/javascript-tiddler}}}
</div>
<!----------- Boot kernel prologue ----------->
<div id="bootKernelPrefix" style="display:none;">
{{ $:/core/bootprefix.js ||$:/core/templates/javascript-tiddler}}
</div>
<!----------- Plugin modules ----------->
<div id="modules" style="display:none;">
{{{ [is[shadow]type[application/javascript]has[module-type]] ||$:/core/templates/module-tiddler}}}
</div>
<!----------- Boot kernel ----------->
<div id="bootKernel" style="display:none;">
{{ $:/core/boot.js ||$:/core/templates/javascript-tiddler}}
</div>
</body>
</html>

View File

@ -0,0 +1,3 @@
title: $:/core/templates/plain-text-tiddler
<_view field="text" format="text" />