mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-11-26 19:47:20 +00:00
Refine the way that we support serialised external tiddler files
The old way was sufficiently backwards compatible that it was impossible to use TiddlyWiki 5.1.9 to build the tw5.com edition.
This commit is contained in:
parent
273daa9613
commit
73210a7b8c
@ -1464,9 +1464,9 @@ $tw.loadTiddlersFromPath = function(filepath,excludeRegExp) {
|
||||
$tw.utils.each(filesInfo.tiddlers,function(tidInfo) {
|
||||
var type = tidInfo.fields.type || "text/plain",
|
||||
typeInfo = $tw.config.contentTypeInfo[type],
|
||||
pathname = path.resolve(filepath,tidInfo.file || tidInfo.tiddlerFile),
|
||||
pathname = path.resolve(filepath,tidInfo.file),
|
||||
text = fs.readFileSync(pathname,typeInfo ? typeInfo.encoding : "utf8");
|
||||
if(tidInfo.tiddlerFile) {
|
||||
if(tidInfo.isTiddlerFile) {
|
||||
var fileTiddlers = $tw.wiki.deserializeTiddlers(path.extname(pathname),text) || [];
|
||||
$tw.utils.each(fileTiddlers,function(tiddler) {
|
||||
$tw.utils.extend(tiddler,tidInfo.fields);
|
||||
|
@ -1,5 +1,5 @@
|
||||
created: 20130825214200000
|
||||
modified: 20150718104424501
|
||||
modified: 20150728104424501
|
||||
tags: [[TiddlyWiki on Node.js]]
|
||||
title: TiddlyWikiFolders
|
||||
type: text/vnd.tiddlywiki
|
||||
@ -100,7 +100,8 @@ Sub-folders within the `tiddlers` folder can also be given a `tiddlywiki.files`
|
||||
}
|
||||
},
|
||||
{
|
||||
"tiddlerFile": "local/mytiddler.tid",
|
||||
"file": "local/mytiddler.tid",
|
||||
"isTiddlerFile": true,
|
||||
"fields": {
|
||||
"title": "A different title"
|
||||
}
|
||||
@ -112,7 +113,7 @@ Sub-folders within the `tiddlers` folder can also be given a `tiddlywiki.files`
|
||||
The JSON data consists of an object with a `tiddlers` property that contains an array of information about each tiddler to be loaded into the wiki. That information consists of:
|
||||
|
||||
* The relative or absolute path to the file to include as either:
|
||||
** `file`: a plain file that will not be deserialised
|
||||
** `tiddlerFile`: a tiddler file that will be deserialised to extract the tiddlers
|
||||
** `file`: the file containing the tiddler
|
||||
** `isTiddlerFile`: if `true`, the file will be deserialised to extract the tiddlers. Otherwise, the raw content of the file is assigned to the `text` field without any parsing
|
||||
* `fields`: an object containing fields that override any provided in the tiddler file
|
||||
* `prefix` & `suffix`: (optional) specify strings to be prefixed and suffixed to the tiddler file text content
|
||||
|
@ -1,7 +1,8 @@
|
||||
{
|
||||
"tiddlers": [
|
||||
{
|
||||
"tiddlerFile": "../../../../../languages/ca-ES/icon.tid",
|
||||
"file": "../../../../../languages/ca-ES/icon.tid",
|
||||
"isTiddlerFile": true,
|
||||
"fields": {
|
||||
"title": "Language Icon: ca-ES",
|
||||
"language": "ca-ES",
|
||||
@ -9,7 +10,8 @@
|
||||
}
|
||||
},
|
||||
{
|
||||
"tiddlerFile": "../../../../../languages/cs-CZ/icon.tid",
|
||||
"file": "../../../../../languages/cs-CZ/icon.tid",
|
||||
"isTiddlerFile": true,
|
||||
"fields": {
|
||||
"title": "Language Icon: cs-CZ",
|
||||
"language": "cs-CZ",
|
||||
@ -17,7 +19,8 @@
|
||||
}
|
||||
},
|
||||
{
|
||||
"tiddlerFile": "../../../../../languages/da-DK/icon.tid",
|
||||
"file": "../../../../../languages/da-DK/icon.tid",
|
||||
"isTiddlerFile": true,
|
||||
"fields": {
|
||||
"title": "Language Icon: da-DK",
|
||||
"language": "da-DK",
|
||||
@ -25,7 +28,8 @@
|
||||
}
|
||||
},
|
||||
{
|
||||
"tiddlerFile": "../../../../../languages/de-AT/icon.tid",
|
||||
"file": "../../../../../languages/de-AT/icon.tid",
|
||||
"isTiddlerFile": true,
|
||||
"fields": {
|
||||
"title": "Language Icon: de-AT",
|
||||
"language": "de-AT",
|
||||
@ -33,7 +37,8 @@
|
||||
}
|
||||
},
|
||||
{
|
||||
"tiddlerFile": "../../../../../languages/de-DE/icon.tid",
|
||||
"file": "../../../../../languages/de-DE/icon.tid",
|
||||
"isTiddlerFile": true,
|
||||
"fields": {
|
||||
"title": "Language Icon: de-DE",
|
||||
"language": "de-DE",
|
||||
@ -41,7 +46,8 @@
|
||||
}
|
||||
},
|
||||
{
|
||||
"tiddlerFile": "../../../../../languages/el-GR/icon.tid",
|
||||
"file": "../../../../../languages/el-GR/icon.tid",
|
||||
"isTiddlerFile": true,
|
||||
"fields": {
|
||||
"title": "Language Icon: el-GR",
|
||||
"language": "el-GR",
|
||||
@ -49,7 +55,8 @@
|
||||
}
|
||||
},
|
||||
{
|
||||
"tiddlerFile": "../../../../../languages/es-ES/icon.tid",
|
||||
"file": "../../../../../languages/es-ES/icon.tid",
|
||||
"isTiddlerFile": true,
|
||||
"fields": {
|
||||
"title": "Language Icon: es-ES",
|
||||
"language": "es-ES",
|
||||
@ -57,7 +64,8 @@
|
||||
}
|
||||
},
|
||||
{
|
||||
"tiddlerFile": "../../../../../languages/fr-FR/icon.tid",
|
||||
"file": "../../../../../languages/fr-FR/icon.tid",
|
||||
"isTiddlerFile": true,
|
||||
"fields": {
|
||||
"title": "Language Icon: fr-FR",
|
||||
"language": "fr-FR",
|
||||
@ -65,7 +73,8 @@
|
||||
}
|
||||
},
|
||||
{
|
||||
"tiddlerFile": "../../../../../languages/hi-IN/icon.tid",
|
||||
"file": "../../../../../languages/hi-IN/icon.tid",
|
||||
"isTiddlerFile": true,
|
||||
"fields": {
|
||||
"title": "Language Icon: hi-IN",
|
||||
"language": "hi-IN",
|
||||
@ -73,7 +82,8 @@
|
||||
}
|
||||
},
|
||||
{
|
||||
"tiddlerFile": "../../../../../languages/ia-IA/icon.tid",
|
||||
"file": "../../../../../languages/ia-IA/icon.tid",
|
||||
"isTiddlerFile": true,
|
||||
"fields": {
|
||||
"title": "Language Icon: ia-IA",
|
||||
"language": "ia-IA",
|
||||
@ -81,7 +91,8 @@
|
||||
}
|
||||
},
|
||||
{
|
||||
"tiddlerFile": "../../../../../languages/it-IT/icon.tid",
|
||||
"file": "../../../../../languages/it-IT/icon.tid",
|
||||
"isTiddlerFile": true,
|
||||
"fields": {
|
||||
"title": "Language Icon: it-IT",
|
||||
"language": "it-IT",
|
||||
@ -89,7 +100,8 @@
|
||||
}
|
||||
},
|
||||
{
|
||||
"tiddlerFile": "../../../../../languages/ja-JP/icon.tid",
|
||||
"file": "../../../../../languages/ja-JP/icon.tid",
|
||||
"isTiddlerFile": true,
|
||||
"fields": {
|
||||
"title": "Language Icon: ja-JP",
|
||||
"language": "ja-JP",
|
||||
@ -97,7 +109,8 @@
|
||||
}
|
||||
},
|
||||
{
|
||||
"tiddlerFile": "../../../../../languages/nl-NL/icon.tid",
|
||||
"file": "../../../../../languages/nl-NL/icon.tid",
|
||||
"isTiddlerFile": true,
|
||||
"fields": {
|
||||
"title": "Language Icon: nl-NL",
|
||||
"language": "nl-NL",
|
||||
@ -105,7 +118,8 @@
|
||||
}
|
||||
},
|
||||
{
|
||||
"tiddlerFile": "../../../../../languages/pa-IN/icon.tid",
|
||||
"file": "../../../../../languages/pa-IN/icon.tid",
|
||||
"isTiddlerFile": true,
|
||||
"fields": {
|
||||
"title": "Language Icon: pa-IN",
|
||||
"language": "pa-IN",
|
||||
@ -113,7 +127,8 @@
|
||||
}
|
||||
},
|
||||
{
|
||||
"tiddlerFile": "../../../../../languages/pt-PT/icon.tid",
|
||||
"file": "../../../../../languages/pt-PT/icon.tid",
|
||||
"isTiddlerFile": true,
|
||||
"fields": {
|
||||
"title": "Language Icon: pt-PT",
|
||||
"language": "pt-PT",
|
||||
@ -121,7 +136,8 @@
|
||||
}
|
||||
},
|
||||
{
|
||||
"tiddlerFile": "../../../../../languages/ru-RU/icon.tid",
|
||||
"file": "../../../../../languages/ru-RU/icon.tid",
|
||||
"isTiddlerFile": true,
|
||||
"fields": {
|
||||
"title": "Language Icon: ru-RU",
|
||||
"language": "ru-RU",
|
||||
@ -129,7 +145,8 @@
|
||||
}
|
||||
},
|
||||
{
|
||||
"tiddlerFile": "../../../../../languages/sk-SK/icon.tid",
|
||||
"file": "../../../../../languages/sk-SK/icon.tid",
|
||||
"isTiddlerFile": true,
|
||||
"fields": {
|
||||
"title": "Language Icon: sk-SK",
|
||||
"language": "sk-SK",
|
||||
@ -137,7 +154,8 @@
|
||||
}
|
||||
},
|
||||
{
|
||||
"tiddlerFile": "../../../../../languages/zh-Hans/icon.tid",
|
||||
"file": "../../../../../languages/zh-Hans/icon.tid",
|
||||
"isTiddlerFile": true,
|
||||
"fields": {
|
||||
"title": "Language Icon: zh-Hans",
|
||||
"language": "zh-Hans",
|
||||
@ -145,7 +163,8 @@
|
||||
}
|
||||
},
|
||||
{
|
||||
"tiddlerFile": "../../../../../languages/zh-Hant/icon.tid",
|
||||
"file": "../../../../../languages/zh-Hant/icon.tid",
|
||||
"isTiddlerFile": true,
|
||||
"fields": {
|
||||
"title": "Language Icon: zh-Hant",
|
||||
"language": "zh-Hant",
|
||||
|
Loading…
Reference in New Issue
Block a user