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

Add new option to retain tiddler paths

This commit is contained in:
Jermolene 2014-02-27 16:30:05 +00:00
parent 66bb7ad6ba
commit 3994f0dbc6
2 changed files with 21 additions and 3 deletions

View File

@ -1373,7 +1373,6 @@ $tw.loadWikiTiddlers = function(wikiPath,parentPaths) {
// Load the wiki files, registering them as writable
var resolvedWikiPath = path.resolve(wikiPath,$tw.config.wikiTiddlersSubDir);
$tw.utils.each($tw.loadTiddlersFromPath(resolvedWikiPath),function(tiddlerFile) {
$tw.wiki.addTiddlers(tiddlerFile.tiddlers);
if(tiddlerFile.filepath) {
$tw.utils.each(tiddlerFile.tiddlers,function(tiddler) {
$tw.boot.files[tiddler.title] = {
@ -1383,7 +1382,16 @@ $tw.loadWikiTiddlers = function(wikiPath,parentPaths) {
};
});
}
$tw.wiki.addTiddlers(tiddlerFile.tiddlers);
});
// Save the original tiddler file locations if requested
if(wikiInfo.config && wikiInfo.config["retain-original-tiddler-path"]) {
var output = [];
for(var title in $tw.boot.files) {
output.push(title + ": " + path.relative(resolvedWikiPath,$tw.boot.files[title].filepath) + "\n");
}
$tw.wiki.addTiddler({title: "$:/config/OriginalTiddlerPaths", type: "application/x-tiddler-dictionary", text: output.join("")});
}
// Save the path to the tiddlers folder for the filesystemadaptor
$tw.boot.wikiTiddlersPath = path.resolve($tw.boot.wikiPath,$tw.config.wikiTiddlersSubDir);
// Load any plugins within the wiki folder

View File

@ -1,5 +1,5 @@
created: 20130825214200000
modified: 20140206174804112
modified: 20140227162920614
tags: dev
title: TiddlyWikiFolders
type: text/vnd.tiddlywiki
@ -21,7 +21,14 @@ Only the ''tiddlywiki.info'' file is required, the ''tiddlers'' and ''plugins''
The `tiddlywiki.info` file in a wiki folder contains a JSON object comprising the following fields:
* ''plugins'' - an array of plugin names to be included in the wiki
* ''themes'' - an array of theme names to be included in the wiki
* ''languages'' - an array of language names to be included in the wiki
* ''includeWikis'' - an array of relative paths to external wiki folders to be included in the wiki
* ''config'' - an optional hashmap of configuration options (see below)
Configuration options include:
* ''retain-original-tiddler-path'' - If true, the server will generate a tiddler [[$:/config/OriginalTiddlerPaths]] containing the original file paths of each tiddler in the wiki
For example:
@ -33,7 +40,10 @@ For example:
],
"includeWikis": [
"../tw5.com"
]
],
"config": {
"retain-original-tiddler-path": true
}
}
```