1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-11-27 03:57:21 +00:00

Rename "shadow" tiddlers to "system" tiddlers

What we have at the moment isn't really the same as TiddlyWiki
classic's shadow tiddlers, it's a much simpler system for excluding
tiddlers. We'll use the term "shadow" instead to refer to the way that
tiddlers in plugins behave, which is exactly like TiddlyWiki classic's
shadow tiddlers.
This commit is contained in:
Jeremy Ruston 2013-03-15 22:00:19 +00:00
parent e5443e27cb
commit 623a3ec8f8
30 changed files with 76 additions and 76 deletions

2
bld.sh
View File

@ -35,7 +35,7 @@ node ./tiddlywiki.js \
--savetiddler $:/core/templates/tiddlywiki5.template.html $TW5_BUILD_OUTPUT/index.html text/plain \
--savetiddler $:/core/templates/static.template.html $TW5_BUILD_OUTPUT/static.html text/plain \
--savetiddler $:/core/templates/static.template.css $TW5_BUILD_OUTPUT/static/static.css text/plain \
--savetiddlers [!is[shadow]] $:/core/templates/static.tiddler.html $TW5_BUILD_OUTPUT/static text/plain \
--savetiddlers [!is[system]] $:/core/templates/static.tiddler.html $TW5_BUILD_OUTPUT/static text/plain \
|| exit 1
# Second, encrypted.html: a version of the main file encrypted with the password "password"

View File

@ -57,7 +57,7 @@ $tw.config = $tw.config || {};
$tw.config.pluginsPath = "../plugins/";
$tw.config.wikiInfo = $tw.config.wikiInfo || "./tiddlywiki.info";
$tw.config.wikiPluginsSubDir = $tw.config.wikiPluginsSubDir || "./plugins";
$tw.config.wikiShadowsSubDir = $tw.config.wikiShadowsSubDir || "./wiki";
$tw.config.wikiSystemSubDir = $tw.config.wikiSystemSubDir || "./wiki";
$tw.config.wikiTiddlersSubDir = $tw.config.wikiTiddlersSubDir || "./tiddlers";
$tw.config.jsModuleHeaderRegExpString = "^\\/\\*\\\\\\n((?:^[^\\n]*\\n)+?)(^\\\\\\*\\/$\\n?)";
@ -880,7 +880,7 @@ $tw.loadTiddlers = function() {
"bootKernel",
"styleArea",
"storeArea",
"shadowArea"
"systemArea"
];
for(var t=0; t<containerIds.length; t++) {
$tw.wiki.addTiddlers($tw.wiki.deserializeTiddlers("(DOM)",document.getElementById(containerIds[t])));
@ -1049,7 +1049,7 @@ $tw.loadTiddlers = function() {
// On the server, we load tiddlers from specified folders
var folders = [
$tw.boot.bootPath,
path.resolve($tw.boot.wikiPath,$tw.config.wikiShadowsSubDir),
path.resolve($tw.boot.wikiPath,$tw.config.wikiSystemSubDir),
path.resolve($tw.boot.wikiPath,$tw.config.wikiTiddlersSubDir)
];
for(var t=0; t<folders.length; t++) {

View File

@ -61,9 +61,9 @@ Command.prototype.subcommands.tiddlers = function() {
return null; // No error
};
Command.prototype.subcommands.shadows = function() {
var tiddlers = this.commander.wiki.getShadowTitles();
this.output.write("Wiki contains these shadow tiddlers:\n");
Command.prototype.subcommands.system = function() {
var tiddlers = this.commander.wiki.getSystemTitles();
this.output.write("Wiki contains these system tiddlers:\n");
for(var t=0; t<tiddlers.length; t++) {
this.output.write(tiddlers[t] + "\n");
}

View File

@ -105,8 +105,8 @@ exports.operators = {
return "$tw.utils.pushTop(subResults,currTiddlerTitle);";
}
break;
case "shadow":
return "for(title in source) {if(" + op + "this.getTiddler(title).isShadow()) {$tw.utils.pushTop(subResults,title);}}";
case "system":
return "for(title in source) {if(" + op + "this.getTiddler(title).isSystem()) {$tw.utils.pushTop(subResults,title);}}";
default:
throw "Unknown operand for 'is' filter operator";
}
@ -121,8 +121,8 @@ exports.operators = {
return "r = subResults.indexOf(currTiddlerTitle);\nif(r !== -1) {subResults = [currTiddlerTitle];} else {subResults = [];}";
}
break;
case "shadow":
return "for(r=subResults.length-1; r>=0; r--) {if(" + op + "this.getTiddler(subResults[r]).isShadow()) {subResults.splice(r,1);}}";
case "system":
return "for(r=subResults.length-1; r>=0; r--) {if(" + op + "this.getTiddler(subResults[r]).isSystem()) {subResults.splice(r,1);}}";
default:
throw "Unknown operand for 'is' filter operator";
}

View File

@ -16,11 +16,11 @@ exports.hasTag = function(tag) {
return this.fields.tags && this.fields.tags.indexOf(tag) !== -1;
};
exports.isShadow = function() {
if(!$tw.utils.hop(this,"shadowFlag")) {
this.shadowFlag = this.fields.title.indexOf("$:/") === 0;
exports.isSystem = function() {
if(!$tw.utils.hop(this,"systemFlag")) {
this.systemFlag = this.fields.title.indexOf("$:/") === 0;
}
return this.shadowFlag;
return this.systemFlag;
};
exports.isTemporary = function() {

View File

@ -28,11 +28,11 @@ var ListWidget = function(renderer) {
These types are shorthands for particular filters
*/
var typeMappings = {
all: "[!is[shadow]sort[title]]",
recent: "[!is[shadow]sort[modified]]",
all: "[!is[system]sort[title]]",
recent: "[!is[system]sort[modified]]",
missing: "[is[missing]sort[title]]",
orphans: "[is[orphan]sort[title]]",
shadows: "[is[shadow]sort[title]]"
system: "[is[system]sort[title]]"
};
ListWidget.prototype.generate = function() {
@ -70,7 +70,7 @@ ListWidget.prototype.getTiddlerList = function() {
filter = this.renderer.getAttribute("filter");
}
if(!filter) {
filter = "[!is[shadow]]";
filter = "[!is[system]]";
}
this.list = this.renderer.renderTree.wiki.filterTiddlers(filter,this.renderer.getContextTiddlerTitle());
};

View File

@ -171,13 +171,13 @@ exports.addTiddler = function(tiddler) {
};
/*
Return a sorted array of non-shadow tiddler titles, optionally filtered by a tag
Return a sorted array of non-system tiddler titles, optionally filtered by a tag
*/
exports.getTiddlers = function(sortField,excludeTag) {
sortField = sortField || "title";
var tiddlers = [], t, titles = [];
for(t in this.tiddlers) {
if($tw.utils.hop(this.tiddlers,t) && !this.tiddlers[t].isShadow() && (!excludeTag || !this.tiddlers[t].hasTag(excludeTag))) {
if($tw.utils.hop(this.tiddlers,t) && !this.tiddlers[t].isSystem() && (!excludeTag || !this.tiddlers[t].hasTag(excludeTag))) {
tiddlers.push(this.tiddlers[t]);
}
}
@ -257,10 +257,10 @@ exports.getOrphanTitles = function() {
return []; // Todo
};
exports.getShadowTitles = function() {
exports.getSystemTitles = function() {
var titles = [];
for(var title in this.tiddlers) {
if(this.tiddlers[title].isShadow()) {
if(this.tiddlers[title].isSystem()) {
titles.push(title);
}
}

View File

@ -2,6 +2,6 @@ title: $:/templates/StaticContent
type: text/vnd.tiddlywiki
<!-- For Google, and people without JavaScript-->
<$list filter="[!is[shadow]sort[title]]" >
<$list filter="[!is[system]sort[title]]" >
<$view field="title" format="text"></$view>
</$list>

View File

@ -1,4 +1,4 @@
title: $:/core/templates/static.template.css
{{{ [is[shadow]type[text/css]] ||$:/core/templates/plain-text-tiddler}}}
{{{ [is[system]type[text/css]] ||$:/core/templates/plain-text-tiddler}}}
{{$:/core/styles/base}}

View File

@ -11,7 +11,7 @@ type: text/vnd.tiddlywiki-html
<meta name="format-detection" content="telephone=no">
<title>{{$:/core/wiki/title}}</title>
<div id="styleArea">
{{{ [is[shadow]type[text/css]] ||$:/core/templates/css-tiddler}}}
{{{ [is[system]type[text/css]] ||$:/core/templates/css-tiddler}}}
</div>
<style type="text/css">
{{$:/core/styles/base}}

View File

@ -2,12 +2,12 @@ title: $:/core/templates/store.area.template.html
<$reveal type="nomatch" state="$:/isEncrypted" text="yes">
`<div id="storeArea" style="display:none;">`
{{{ [!is[shadow]] ||$:/core/templates/html-div-tiddler}}}
{{{ [!is[system]] ||$:/core/templates/html-div-tiddler}}}
`</div>`
</$reveal>
<$reveal type="match" state="$:/isEncrypted" text="yes">
`<!------------- Encrypted tiddlers --------->`
`<pre id="encryptedStoreArea" type="text/plain" style="display:none;">`
<$encrypt filter="[!is[shadow]]"/>
<$encrypt filter="[!is[system]]"/>
`</pre>`
</$reveal>

View File

@ -21,7 +21,7 @@ title: $:/core/templates/tiddlywiki5.template.html
<body>
<!----------- Static styles ----------->
<div id="styleArea">
{{{ [is[shadow]type[text/css]] ||$:/core/templates/css-tiddler}}}
{{{ [is[system]type[text/css]] ||$:/core/templates/css-tiddler}}}
</div>
<!----------- Static content for Google and browsers without JavaScript ----------->
<noscript>
@ -29,16 +29,16 @@ title: $:/core/templates/tiddlywiki5.template.html
{{$:/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}}}
<!----------- Miscellaneous system tiddlers ----------->
<div id="systemArea" style="display:none;">
{{{ [is[system]] -[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 ----------->
{{$:/core/templates/store.area.template.html}}
<!----------- 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}}}
{{{ [is[system]type[application/javascript]library[yes]] -[[$:/core/lib/jquery.min.js]] ||$:/core/templates/javascript-tiddler}}}
</div>
<!----------- Boot kernel prologue ----------->
<div id="bootKernelPrefix" style="display:none;">
@ -46,7 +46,7 @@ title: $:/core/templates/tiddlywiki5.template.html
</div>
<!----------- Plugin modules ----------->
<div id="modules" style="display:none;">
{{{ [is[shadow]type[application/javascript]has[module-type]] ||$:/core/templates/module-tiddler}}}
{{{ [is[system]type[application/javascript]has[module-type]] ||$:/core/templates/module-tiddler}}}
</div>
<!----------- Boot kernel ----------->
<div id="bootKernel" style="display:none;">

View File

@ -45,8 +45,8 @@ Welcome to TiddlyWiki created by Jeremy Ruston; Copyright &copy; 2004-2007 Jerem
</div>
<div id="contentWrapper"></div>
<div id="contentStash"></div>
<div id="shadowArea">
{{{ [prefix[{shadow}]] +[sort-case-sensitive[title]] ||$:/core/templates/html-div-tiddler-remove-prefix}}}
<div id="systemArea">
{{{ [prefix[{system}]] +[sort-case-sensitive[title]] ||$:/core/templates/html-div-tiddler-remove-prefix}}}
</div>
<!--POST-SHADOWAREA-->
<div id="storeArea">

View File

@ -5,7 +5,7 @@ Here are a few features of TiddlyWiki that you can explore:
* Invoke a demonstration wizard: <$button message="tw-modal" param="SampleWizard" class="btn btn-inverse">demo</$button> (the text of the wizard is in the tiddler SampleWizard)
* Save this wiki as a static HTML file: <$button message="tw-save-wiki" param="$:/core/templates/static.template.html" class="btn">Save Static</$button>
* Browse the list of AllTiddlers or the ShadowTiddlers
* Browse the list of AllTiddlers or the SystemTiddlers
* Examine the example [[bitmap images|Motovun Jack.jpg]] and [[SVG images|Motovun Jack.svg]]
* Check out the TaskManagementExample

View File

@ -29,7 +29,7 @@ The machinery tying those concepts together includes:
* TiddlerTemplates
* DataTiddlers
* ContentType
* ShadowTiddlers
* SystemTiddlers
* [[Plugins]]
* [[Modules]] and [[ModuleType]]

View File

@ -17,12 +17,12 @@ Dump the fields of an individual tiddler
--dump tiddler <title>
```
!!! dump shadows
!!! dump system
Dump the titles of the shadow tiddlers in the wiki store
Dump the titles of the system tiddlers in the wiki store
```
--dump shadows
--dump systems
```
!!! dump config

View File

@ -10,5 +10,5 @@ Save a set of tiddlers matching a filter as separate files of a specified Conten
For example:
```
--savetiddlers [!is[shadow]] $:/core/templates/static.tiddler.html ./static text/plain
--savetiddlers [!is[system]] $:/core/templates/static.tiddler.html ./static text/plain
```

View File

@ -1,10 +0,0 @@
title: ShadowTiddlers
tags: docs concepts
TiddlyWiki models everything as [[tiddlers|Tiddlers]], including its internal components and configuration.
Thus, even an apparently empty TiddlyWiki actually contains dozens of tiddlers that are necessary to enable it function correctly. To prevent them from confusing or intimidating casual users, these system tiddlers are designated //shadow tiddlers// which means that they remain invisible unless one looks for them directly. They don't show up in lists or search results, but linking to one directly works in the usual way.
The current shadow tiddlers are:
<$list type="shadows" />

View File

@ -0,0 +1,10 @@
title: SystemTiddlers
tags: docs concepts
TiddlyWiki models everything as [[tiddlers|Tiddlers]], including its internal components and configuration.
Thus, even an apparently empty TiddlyWiki actually contains dozens of tiddlers that are necessary to enable it function correctly. To prevent them from confusing casual users, these system tiddlers are hidden from most operations. They don't show up in lists or search results, but linking to one directly works in the usual way.
The current system tiddlers are:
<$list type="system" />

View File

@ -48,7 +48,7 @@ The operator defaults to `title` if omitted, so `[[HelloThere]]` is equivalent t
The operands available with the `is` operator are:
* ''shadow'': selects all shadow tiddlers
* ''system'': selects all system tiddlers
* ''current'': selects the current ContextTiddler
! Runs

View File

@ -12,6 +12,6 @@ The included `bld.sh` script includes these commands that are involved in genera
```
--savetiddler $:/core/templates/static.template.html $TW5_BUILD_OUTPUT/static.html text/plain \
--savetiddler $:/core/templates/static.template.css $TW5_BUILD_OUTPUT/static/static.css text/plain \
--savetiddlers [!is[shadow]] $:/core/templates/static.tiddler.html $TW5_BUILD_OUTPUT/static text/plain \
--savetiddlers [!is[system]] $:/core/templates/static.tiddler.html $TW5_BUILD_OUTPUT/static text/plain \
```
The first SaveTiddlerCommand saves the static version of the DefaulTiddlers, the second saves the stylesheet, and the final SaveTiddlersCommand generates the HTML representations of individual tiddlers.

View File

@ -30,7 +30,7 @@ Each module is an ordinary `node.js`-style module, using the `require()` functio
In the browser, `core/boot.js` is packed into a template HTML file that contains the following elements in order:
* Ordinary and shadow tiddlers, packed as HTML `<DIV>` elements
* Ordinary and system tiddlers, packed as HTML `<DIV>` elements
* `core/bootprefix.js`, containing a few lines to set up the plugin environment
* JavaScript modules, packed as HTML `<SCRIPT>` blocks
* `core/boot.js`, containing the boot kernel

View File

@ -3,4 +3,4 @@ tags: navigation
Current tiddlers:
{{{ [!is[shadow]sort[title]] }} <div><<view title link>></div> }
{{{ [!is[system]sort[title]] }} <div><<view title link>></div> }

View File

@ -20,7 +20,7 @@ type: text/vnd.tiddlywiki-html
<link rel="stylesheet" href="//dl-web.dropbox.com/spa/4f6lw6nhu5zn5pr/TiddlyWiki5/public/styles.css" type="text/css" />
</head>
<body>
<div id="shadowArea" style="display:none;">
<div id="systemArea" style="display:none;">
<<serialize "[[$:/plugins/dropbox/Index]]" application/x-tiddler-html-div>>
</div>
</body>

View File

@ -2,4 +2,4 @@ title: $:/plugins/dropbox/styles.template.css
type: text/vnd.tiddlywiki-html
/* utf8beacon: éçñøåá— */
<<serialize "[is[shadow]type[text/css]]" text/plain>>
<<serialize "[is[system]type[text/css]]" text/plain>>

View File

@ -2,9 +2,9 @@ title: $:/plugins/dropbox/tw5dropbox.template.js
type: text/vnd.tiddlywiki-html
/* utf8beacon: éçñøåá— */
<<serialize "[is[shadow]type[application/javascript]library[yes]] -[[$:/library/sjcl.js]]" text/plain>>
<<serialize "[is[system]type[application/javascript]library[yes]] -[[$:/library/sjcl.js]]" text/plain>>
<<serialize "$:/core/bootprefix.js" text/plain>>
<<serialize "[is[shadow]] -[type[text/css]] -[type[application/javascript]has[module-type]] -[type[application/javascript]library[yes]] -[[$:/core/boot.js]] -[[$:/core/bootprefix.js]]" application/x-tiddler-javascript>>
<<serialize "[is[shadow]type[application/javascript]has[module-type]]" application/x-tiddler-module-plain>>
<<serialize "[is[system]] -[type[text/css]] -[type[application/javascript]has[module-type]] -[type[application/javascript]library[yes]] -[[$:/core/boot.js]] -[[$:/core/bootprefix.js]]" application/x-tiddler-javascript>>
<<serialize "[is[system]type[application/javascript]has[module-type]]" application/x-tiddler-module-plain>>
<<serialize "$:/core/boot.js" text/plain>>

View File

@ -25,7 +25,7 @@ type: text/vnd.tiddlywiki-html
<body>
<!----------- Static styles ----------->
<div id="styleArea">
<<serialize "[is[shadow]type[text/css]]" application/x-tiddler-css>>
<<serialize "[is[system]type[text/css]]" application/x-tiddler-css>>
</div>
<!----------- Static content for Google and browsers without JavaScript ----------->
<noscript>
@ -33,9 +33,9 @@ type: text/vnd.tiddlywiki-html
<<serialize "$:/templates/StaticContent" text/html>>
</div>
</noscript>
<!----------- Miscellaneous shadow tiddlers ----------->
<div id="shadowArea" style="display:none;">
<<serialize "[is[shadow]] -[type[text/css]] -[type[application/javascript]has[module-type]] -[type[application/javascript]library[yes]] -[[$:/core/boot.js]] -[[$:/core/bootprefix.js]]" application/x-tiddler-html-div>>
<!----------- Miscellaneous system tiddlers ----------->
<div id="systemArea" style="display:none;">
<<serialize "[is[system]] -[type[text/css]] -[type[application/javascript]has[module-type]] -[type[application/javascript]library[yes]] -[[$:/core/boot.js]] -[[$:/core/bootprefix.js]]" application/x-tiddler-html-div>>
</div>
<!----------- Ordinary tiddlers ----------->
<div id="storeArea" style="display:none;">
@ -44,7 +44,7 @@ type: text/vnd.tiddlywiki-html
<!----------- Library modules ----------->
<div id="libraryModules" style="display:none;">
<<serialize "[[$:/core/lib/jquery.min.js]]" application/x-tiddler-library>>
<<serialize "[is[shadow]type[application/javascript]library[yes]] -[[$:/core/lib/jquery.min.js]]" application/x-tiddler-library>>
<<serialize "[is[system]type[application/javascript]library[yes]] -[[$:/core/lib/jquery.min.js]]" application/x-tiddler-library>>
</div>
<!----------- Boot kernel prologue ----------->
<div id="bootKernelPrefix" style="display:none;">
@ -52,7 +52,7 @@ type: text/vnd.tiddlywiki-html
</div>
<!----------- Plugin modules ----------->
<div id="modules" style="display:none;">
<<serialize "[is[shadow]type[application/javascript]has[module-type]]" application/x-tiddler-module>>
<<serialize "[is[system]type[application/javascript]has[module-type]]" application/x-tiddler-module>>
</div>
<!----------- Boot kernel ----------->
<div id="bootKernel" style="display:none;">

View File

@ -17,7 +17,7 @@ exports.startup = function(loggedIn) {
var index = $tw.wiki.getTiddlerData($tw.plugins.dropbox.titleTiddlerIndex);
if(index) {
$tw.wiki.addTiddlers(index.tiddlers);
$tw.wiki.addTiddlers(index.shadows,true);
$tw.wiki.addTiddlers(index.systemTiddlers,true);
$tw.plugins.dropbox.fileInfo = index.fileInfo;
}
if(loggedIn) {

View File

@ -26,7 +26,7 @@ $tw.plugins.dropbox = {
client: null, // Dropbox.js client object
fileInfo: {}, // Hashmap of each filename as retrieved from Dropbox (including .meta files): {versionTag:,title:}
titleInfo: {}, // Hashmap of each tiddler title retrieved from Dropbox to filename
// Titles of various shadow tiddlers used by the plugin
// Titles of various system tiddlers used by the plugin
titleIsLoggedIn: "$:/plugins/dropbox/IsLoggedIn",
titleUserName: "$:/plugins/dropbox/UserName",
titlePublicAppUrl: "$:/plugins/dropbox/PublicAppUrl",
@ -385,11 +385,11 @@ Save the index file
*/
$tw.plugins.dropbox.saveTiddlerIndex = function(path,callback) {
// Get the tiddler index information
var index = {tiddlers: [],shadows: [], fileInfo: $tw.plugins.dropbox.fileInfo};
var index = {tiddlers: [],systemTiddlers: [], fileInfo: $tw.plugins.dropbox.fileInfo};
// First all the tiddlers
$tw.wiki.forEachTiddler(function(title,tiddler) {
if(tiddler.isShadow) {
index.shadows.push(tiddler.fields);
if(tiddler.isSystem) {
index.systemTiddlers.push(tiddler.fields);
} else {
index.tiddlers.push(tiddler.fields);
}

View File

@ -71,9 +71,9 @@ Dump the titles of the tiddlers in the wiki store </p><pre>
dump tiddler</h3><p>
Dump the fields of an individual tiddler </p><pre>
--dump tiddler &lt;title&gt;</pre><h3 class=''>
dump shadows</h3><p>
Dump the titles of the shadow tiddlers in the wiki store </p><pre>
--dump shadows</pre><h3 class=''>
dump system</h3><p>
Dump the titles of the system tiddlers in the wiki store </p><pre>
--dump systems</pre><h3 class=''>
dump config</h3><p>
Dump the current core configuration </p><pre>
--dump config</pre></div></div></span></div><div class='tw-list-element'>
@ -115,7 +115,7 @@ text/html</code>) and extension (defaults to <code>
.html</code>).</p><pre>
--savetiddlers &lt;filter&gt; &lt;template&gt; &lt;pathname&gt; [&lt;type&gt;] [&lt;extension&gt;]</pre><p>
For example:</p><pre>
--savetiddlers [!is[shadow]] $:/core/templates/static.tiddler.html ./static text/plain</pre></div></div></span></div><div class='tw-list-element'>
--savetiddlers [!is[system]] $:/core/templates/static.tiddler.html ./static text/plain</pre></div></div></span></div><div class='tw-list-element'>
<span class='tw-transclude'>
<h3 class=''>
<span class='tw-view-link'>