mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2026-01-24 03:44:41 +00:00
Compare commits
153 Commits
v5.0.12-be
...
v5.0.13-be
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0cca9092ef | ||
|
|
b594eb5b36 | ||
|
|
917c4404e5 | ||
|
|
6f3e31abe5 | ||
|
|
5962600cb6 | ||
|
|
cf3f11a4c0 | ||
|
|
bcf37c765f | ||
|
|
248029b53a | ||
|
|
57c534b97d | ||
|
|
6d1eaeb0fc | ||
|
|
680fe41ed7 | ||
|
|
32a1da7673 | ||
|
|
8d78336e9b | ||
|
|
9987e6de22 | ||
|
|
38530f14f2 | ||
|
|
0fae9ee992 | ||
|
|
12b5ebb946 | ||
|
|
5120a1b32b | ||
|
|
9a2d650868 | ||
|
|
ad74877dad | ||
|
|
b77ad3061d | ||
|
|
31b1e073a6 | ||
|
|
5d88f19ec6 | ||
|
|
133c24e9c7 | ||
|
|
f15eba66fe | ||
|
|
911a64221a | ||
|
|
424c0737a2 | ||
|
|
0b38cd640c | ||
|
|
32099b85d3 | ||
|
|
71aa2bbe5f | ||
|
|
fb5c44a875 | ||
|
|
f12d7bb6c0 | ||
|
|
665e490d33 | ||
|
|
76f637d57a | ||
|
|
2ccc13b936 | ||
|
|
0206358a1c | ||
|
|
f3a466ee86 | ||
|
|
0c48502e8e | ||
|
|
19061650de | ||
|
|
c2b08b43b5 | ||
|
|
a2ec4c55e3 | ||
|
|
5eae2f0fb6 | ||
|
|
b8aedf2ca3 | ||
|
|
2d24d05f61 | ||
|
|
44cb3bc100 | ||
|
|
0cf4e5514c | ||
|
|
1717c93d00 | ||
|
|
0bdc5b5c70 | ||
|
|
1945af0b2d | ||
|
|
e6b783154f | ||
|
|
d2d0b09235 | ||
|
|
e28c2e8b06 | ||
|
|
2e2d30bae9 | ||
|
|
a9b7df96c2 | ||
|
|
b2e48d00e9 | ||
|
|
9147cadd3c | ||
|
|
4951a53063 | ||
|
|
36556b817f | ||
|
|
8bd19c4e6a | ||
|
|
34e4166dc5 | ||
|
|
617963bd88 | ||
|
|
346b2f8611 | ||
|
|
6f859c8d44 | ||
|
|
325a93f3c3 | ||
|
|
06b0f9adb7 | ||
|
|
401349a1d6 | ||
|
|
bc9b67cbc3 | ||
|
|
6fb992690d | ||
|
|
57f3eb0b2c | ||
|
|
bf2f88ba8b | ||
|
|
00d041b778 | ||
|
|
eeedcb6d94 | ||
|
|
b4ddaccd1d | ||
|
|
d83c26fe3b | ||
|
|
1c484f59bd | ||
|
|
149ca0fc63 | ||
|
|
f467ae288b | ||
|
|
457764077b | ||
|
|
892900c9c5 | ||
|
|
d880cb135a | ||
|
|
a858329742 | ||
|
|
e44450edc4 | ||
|
|
f09d69d1b7 | ||
|
|
eee3a0cf8e | ||
|
|
4238af2a40 | ||
|
|
f54f0d1c3e | ||
|
|
ca34cc437c | ||
|
|
71c886e3a1 | ||
|
|
db147e3673 | ||
|
|
525613750b | ||
|
|
f751e2ecb4 | ||
|
|
ea5989048c | ||
|
|
eec849c69e | ||
|
|
666f243a82 | ||
|
|
4e5fa2c6e6 | ||
|
|
9ab0c84140 | ||
|
|
9261bdaa43 | ||
|
|
0e09fbf46a | ||
|
|
9547a1f01c | ||
|
|
0e4afc3986 | ||
|
|
10fa72d15e | ||
|
|
f131c37893 | ||
|
|
d2796d0c9c | ||
|
|
460f476aef | ||
|
|
2989c9b133 | ||
|
|
3105afe6e8 | ||
|
|
a03a15e7de | ||
|
|
305617b632 | ||
|
|
b446ef5d4e | ||
|
|
8dd30e97ac | ||
|
|
fc6d96672d | ||
|
|
78791192c3 | ||
|
|
9b576f2a8d | ||
|
|
08ed0017af | ||
|
|
450c646c31 | ||
|
|
0c6c5002c1 | ||
|
|
9b3b08a176 | ||
|
|
6386bf84a5 | ||
|
|
c3dfa3f27e | ||
|
|
50223562ea | ||
|
|
85c7da95bb | ||
|
|
c8e98c1567 | ||
|
|
13463a47c5 | ||
|
|
ffd9df670d | ||
|
|
d2edd9291e | ||
|
|
247eb04b11 | ||
|
|
954946352a | ||
|
|
0ccaedd7d2 | ||
|
|
3182a2d599 | ||
|
|
f999b2e931 | ||
|
|
4d70d5780e | ||
|
|
a330cb543e | ||
|
|
64a6544b02 | ||
|
|
3f25db0abe | ||
|
|
412cde6f53 | ||
|
|
f7b8813a27 | ||
|
|
62c602e9d2 | ||
|
|
d8a142fed5 | ||
|
|
1b37d660ea | ||
|
|
da273be054 | ||
|
|
a463859a28 | ||
|
|
9aaa000d3f | ||
|
|
f14ecf4eb8 | ||
|
|
128ad01866 | ||
|
|
ecbda326cb | ||
|
|
e24600f9bb | ||
|
|
6436dc22a7 | ||
|
|
f44f2b33ed | ||
|
|
86d182fd51 | ||
|
|
3fa4b00ede | ||
|
|
d30cb0f11d | ||
|
|
906d2db57e | ||
|
|
3e6de03f15 |
17
bld.cmd
17
bld.cmd
@@ -35,19 +35,9 @@ node .\tiddlywiki.js ^
|
||||
.\editions\tw5.com ^
|
||||
--verbose ^
|
||||
--output . ^
|
||||
--rendertiddler ReadMe .\readme.md text/html ^
|
||||
--rendertiddler ContributingTemplate .\contributing.md text/html ^
|
||||
--rendertiddler $:/core/copyright.txt .\licenses\copyright.md text/plain ^
|
||||
--build readmes ^
|
||||
--output %TW5_BUILD_OUTPUT% ^
|
||||
--rendertiddler $:/core/save/all index.html text/plain ^
|
||||
--savetiddler $:/favicon.ico favicon.ico ^
|
||||
--rendertiddler $:/editions/tw5.com/download-empty empty.html text/plain ^
|
||||
--rendertiddler $:/editions/tw5.com/download-empty empty.hta text/plain ^
|
||||
--savetiddler $:/green_favicon.ico %TW5_BUILD_OUTPUT%/static/favicon.ico ^
|
||||
--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 ^
|
||||
--build favicon empty static index ^
|
||||
|| exit 1
|
||||
|
||||
rem encrypted.html: a version of the main file encrypted with the password "password"
|
||||
@@ -56,8 +46,7 @@ node .\tiddlywiki.js ^
|
||||
.\editions\tw5.com ^
|
||||
--verbose ^
|
||||
--output %TW5_BUILD_OUTPUT% ^
|
||||
--password password ^
|
||||
--rendertiddler $:/core/save/all encrypted.html text/plain ^
|
||||
--build encrypted ^
|
||||
|| exit 1
|
||||
|
||||
rem tahoelafs.html: empty wiki with plugin for Tahoe-LAFS
|
||||
|
||||
17
bld.sh
17
bld.sh
@@ -36,19 +36,9 @@ node ./tiddlywiki.js \
|
||||
./editions/tw5.com \
|
||||
--verbose \
|
||||
--output . \
|
||||
--rendertiddler ReadMe ./readme.md text/html \
|
||||
--rendertiddler ContributingTemplate ./contributing.md text/html \
|
||||
--rendertiddler $:/core/copyright.txt ./licenses/copyright.md text/plain \
|
||||
--build readmes \
|
||||
--output $TW5_BUILD_OUTPUT \
|
||||
--rendertiddler $:/core/save/all index.html text/plain \
|
||||
--savetiddler $:/favicon.ico favicon.ico \
|
||||
--rendertiddler $:/editions/tw5.com/download-empty empty.html text/plain \
|
||||
--rendertiddler $:/editions/tw5.com/download-empty empty.hta text/plain \
|
||||
--savetiddler $:/green_favicon.ico static/favicon.ico \
|
||||
--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 \
|
||||
--build favicon empty static index \
|
||||
|| exit 1
|
||||
|
||||
# encrypted.html: a version of the main file encrypted with the password "password"
|
||||
@@ -57,8 +47,7 @@ node ./tiddlywiki.js \
|
||||
./editions/tw5.com \
|
||||
--verbose \
|
||||
--output $TW5_BUILD_OUTPUT \
|
||||
--password password \
|
||||
--rendertiddler $:/core/save/all encrypted.html text/plain \
|
||||
--build encrypted \
|
||||
|| exit 1
|
||||
|
||||
# tahoelafs.html: empty wiki with plugin for Tahoe-LAFS
|
||||
|
||||
202
boot/boot.js
202
boot/boot.js
@@ -187,7 +187,7 @@ $tw.utils.deepDefaults = function(object /*, sourceObjectList */) {
|
||||
$tw.utils.each(Array.prototype.slice.call(arguments,1),function(source) {
|
||||
if(source) {
|
||||
for (var p in source) {
|
||||
if(object[p] == null) {
|
||||
if(object[p] === null || object[p] === undefined) {
|
||||
object[p] = source[p];
|
||||
}
|
||||
if(typeof object[p] === "object" && typeof source[p] === "object") {
|
||||
@@ -565,7 +565,7 @@ Crypto helper object for encrypted content. It maintains the password text in a
|
||||
the password, and to encrypt/decrypt a block of text
|
||||
*/
|
||||
$tw.utils.Crypto = function() {
|
||||
var sjcl = $tw.browser ? window.sjcl : require("./sjcl.js"),
|
||||
var sjcl = $tw.node ? require("./sjcl.js") : window.sjcl,
|
||||
currentPassword = null,
|
||||
callSjcl = function(method,inputText,password) {
|
||||
password = password || currentPassword;
|
||||
@@ -1425,7 +1425,7 @@ $tw.loadTiddlersFromPath = function(filepath,excludeRegExp) {
|
||||
} else {
|
||||
// If not, read all the files in the directory
|
||||
$tw.utils.each(files,function(file) {
|
||||
if(!excludeRegExp.test(file)) {
|
||||
if(!excludeRegExp.test(file) && file !== "plugin.info") {
|
||||
tiddlers.push.apply(tiddlers,$tw.loadTiddlersFromPath(filepath + path.sep + file,excludeRegExp));
|
||||
}
|
||||
});
|
||||
@@ -1442,53 +1442,102 @@ Load the tiddlers from a plugin folder, and package them up into a proper JSON p
|
||||
*/
|
||||
$tw.loadPluginFolder = function(filepath,excludeRegExp) {
|
||||
excludeRegExp = excludeRegExp || $tw.boot.excludeRegExp;
|
||||
var stat, files, pluginInfo, pluginTiddlers = [], f, file, titlePrefix, t;
|
||||
if(fs.existsSync(filepath)) {
|
||||
stat = fs.statSync(filepath);
|
||||
if(stat.isDirectory()) {
|
||||
// Read the plugin information
|
||||
pluginInfo = JSON.parse(fs.readFileSync(filepath + path.sep + "plugin.info","utf8"));
|
||||
// Read the plugin files
|
||||
files = fs.readdirSync(filepath);
|
||||
for(f=0; f<files.length; f++) {
|
||||
file = files[f];
|
||||
if(!excludeRegExp.test(file) && file !== "plugin.info" && file !== "tiddlywiki.files") {
|
||||
var tiddlerFiles = $tw.loadTiddlersFromPath(filepath + path.sep + file,excludeRegExp);
|
||||
$tw.utils.each(tiddlerFiles,function(tiddlerFile) {
|
||||
pluginTiddlers.push.apply(pluginTiddlers,tiddlerFile.tiddlers);
|
||||
});
|
||||
}
|
||||
}
|
||||
// Save the plugin tiddlers into the plugin info
|
||||
pluginInfo.tiddlers = pluginInfo.tiddlers || Object.create(null);
|
||||
for(t=0; t<pluginTiddlers.length; t++) {
|
||||
if(pluginTiddlers[t].title) {
|
||||
pluginInfo.tiddlers[pluginTiddlers[t].title] = pluginTiddlers[t];
|
||||
if(fs.existsSync(filepath) && fs.statSync(filepath).isDirectory()) {
|
||||
// Read the plugin information
|
||||
var pluginInfo = JSON.parse(fs.readFileSync(filepath + path.sep + "plugin.info","utf8"));
|
||||
// Read the plugin files
|
||||
var pluginFiles = $tw.loadTiddlersFromPath(filepath,excludeRegExp);
|
||||
// Save the plugin tiddlers into the plugin info
|
||||
pluginInfo.tiddlers = pluginInfo.tiddlers || Object.create(null);
|
||||
for(var f=0; f<pluginFiles.length; f++) {
|
||||
var tiddlers = pluginFiles[f].tiddlers;
|
||||
for(var t=0; t<tiddlers.length; t++) {
|
||||
var tiddler= tiddlers[t];
|
||||
if(tiddler.title) {
|
||||
pluginInfo.tiddlers[tiddler.title] = tiddler;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// Give the plugin the same version number as the core if it doesn't have one
|
||||
if(pluginInfo && !("version" in pluginInfo)) {
|
||||
pluginInfo.version = $tw.packageInfo.version;
|
||||
}
|
||||
// Save the plugin tiddler
|
||||
if(pluginInfo) {
|
||||
var fields = {
|
||||
title: pluginInfo.title,
|
||||
type: "application/json",
|
||||
text: JSON.stringify({tiddlers: pluginInfo.tiddlers},null,4),
|
||||
"plugin-priority": pluginInfo["plugin-priority"],
|
||||
"name": pluginInfo["name"],
|
||||
"version": pluginInfo["version"],
|
||||
"thumbnail": pluginInfo["thumbnail"],
|
||||
"description": pluginInfo["description"],
|
||||
"plugin-type": pluginInfo["plugin-type"] || "plugin",
|
||||
"dependents": $tw.utils.stringifyList(pluginInfo["dependents"] || [])
|
||||
// Give the plugin the same version number as the core if it doesn't have one
|
||||
if(!("version" in pluginInfo)) {
|
||||
pluginInfo.version = $tw.packageInfo.version;
|
||||
}
|
||||
return fields;
|
||||
// Use "plugin" as the plugin-type if we don't have one
|
||||
if(!("plugin-type" in pluginInfo)) {
|
||||
pluginInfo["plugin-type"] = "plugin";
|
||||
}
|
||||
pluginInfo.dependents = pluginInfo.dependents || [];
|
||||
pluginInfo.type = "application/json";
|
||||
// Set plugin text
|
||||
pluginInfo.text = JSON.stringify({tiddlers: pluginInfo.tiddlers},null,4);
|
||||
delete pluginInfo.tiddlers;
|
||||
// Deserialise array fields (currently required for the dependents field)
|
||||
for(var field in pluginInfo) {
|
||||
if($tw.utils.isArray(pluginInfo[field])) {
|
||||
pluginInfo[field] = $tw.utils.stringifyList(pluginInfo[field]);
|
||||
}
|
||||
}
|
||||
return pluginInfo;
|
||||
} else {
|
||||
return null;
|
||||
return null;
|
||||
}
|
||||
};
|
||||
|
||||
/*
|
||||
name: Name of the plugin to find
|
||||
paths: array of file paths to search for it
|
||||
Returns the path of the plugin folder
|
||||
*/
|
||||
$tw.findLibraryItem = function(name,paths) {
|
||||
var pathIndex = 0;
|
||||
do {
|
||||
var pluginPath = path.resolve(paths[pathIndex],"./" + name)
|
||||
if(fs.existsSync(pluginPath) && fs.statSync(pluginPath).isDirectory()) {
|
||||
return pluginPath;
|
||||
}
|
||||
} while(++pathIndex < paths.length);
|
||||
return null;
|
||||
};
|
||||
|
||||
/*
|
||||
name: Name of the plugin to load
|
||||
paths: array of file paths to search for it
|
||||
*/
|
||||
$tw.loadPlugin = function(name,paths) {
|
||||
var pluginPath = $tw.findLibraryItem(name,paths);
|
||||
if(pluginPath) {
|
||||
var pluginFields = $tw.loadPluginFolder(pluginPath);
|
||||
if(pluginFields) {
|
||||
$tw.wiki.addTiddler(pluginFields);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/*
|
||||
libraryPath: Path of library folder for these plugins (relative to core path)
|
||||
envVar: Environment variable name for these plugins
|
||||
Returns an array of search paths
|
||||
*/
|
||||
$tw.getLibraryItemSearchPaths = function(libraryPath,envVar) {
|
||||
var pluginPaths = [path.resolve($tw.boot.corePath,libraryPath)],
|
||||
env = process.env[envVar];
|
||||
if(env) {
|
||||
Array.prototype.push.apply(pluginPaths,env.split(":"));
|
||||
}
|
||||
return pluginPaths;
|
||||
};
|
||||
|
||||
/*
|
||||
plugins: Array of names of plugins (eg, "tiddlywiki/filesystemadaptor")
|
||||
libraryPath: Path of library folder for these plugins (relative to core path)
|
||||
envVar: Environment variable name for these plugins
|
||||
*/
|
||||
$tw.loadPlugins = function(plugins,libraryPath,envVar) {
|
||||
if(plugins) {
|
||||
var pluginPaths = $tw.getLibraryItemSearchPaths(libraryPath,envVar);
|
||||
for(var t=0; t<plugins.length; t++) {
|
||||
$tw.loadPlugin(plugins[t],pluginPaths);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1520,36 +1569,10 @@ $tw.loadWikiTiddlers = function(wikiPath,parentPaths) {
|
||||
}
|
||||
});
|
||||
}
|
||||
// Load any plugins listed in the wiki info file
|
||||
if(wikiInfo.plugins) {
|
||||
var pluginBasePath = path.resolve($tw.boot.corePath,$tw.config.pluginsPath);
|
||||
for(var t=0; t<wikiInfo.plugins.length; t++) {
|
||||
pluginFields = $tw.loadPluginFolder(path.resolve(pluginBasePath,"./" + wikiInfo.plugins[t]));
|
||||
if(pluginFields) {
|
||||
$tw.wiki.addTiddler(pluginFields);
|
||||
}
|
||||
}
|
||||
}
|
||||
// Load any themes listed in the wiki info file
|
||||
if(wikiInfo.themes) {
|
||||
var themesBasePath = path.resolve($tw.boot.corePath,$tw.config.themesPath);
|
||||
for(var t=0; t<wikiInfo.themes.length; t++) {
|
||||
pluginFields = $tw.loadPluginFolder(path.resolve(themesBasePath,"./" + wikiInfo.themes[t]));
|
||||
if(pluginFields) {
|
||||
$tw.wiki.addTiddler(pluginFields);
|
||||
}
|
||||
}
|
||||
}
|
||||
// Load any languages listed in the wiki info file
|
||||
if(wikiInfo.languages) {
|
||||
var languagesBasePath = path.resolve($tw.boot.corePath,$tw.config.languagesPath);
|
||||
for(var t=0; t<wikiInfo.languages.length; t++) {
|
||||
pluginFields = $tw.loadPluginFolder(path.resolve(languagesBasePath,"./" + wikiInfo.languages[t]));
|
||||
if(pluginFields) {
|
||||
$tw.wiki.addTiddler(pluginFields);
|
||||
}
|
||||
}
|
||||
}
|
||||
// Load any plugins, themes and languages listed in the wiki info file
|
||||
$tw.loadPlugins(wikiInfo.plugins,$tw.config.pluginsPath,$tw.config.pluginsEnvVar);
|
||||
$tw.loadPlugins(wikiInfo.themes,$tw.config.themesPath,$tw.config.themesEnvVar);
|
||||
$tw.loadPlugins(wikiInfo.languages,$tw.config.languagesPath,$tw.config.languagesEnvVar);
|
||||
// Load the wiki files, registering them as writable
|
||||
var resolvedWikiPath = path.resolve(wikiPath,$tw.config.wikiTiddlersSubDir);
|
||||
$tw.utils.each($tw.loadTiddlersFromPath(resolvedWikiPath),function(tiddlerFile) {
|
||||
@@ -1578,7 +1601,7 @@ $tw.loadWikiTiddlers = function(wikiPath,parentPaths) {
|
||||
var wikiPluginsPath = path.resolve(wikiPath,$tw.config.wikiPluginsSubDir);
|
||||
if(fs.existsSync(wikiPluginsPath)) {
|
||||
var pluginFolders = fs.readdirSync(wikiPluginsPath);
|
||||
for(t=0; t<pluginFolders.length; t++) {
|
||||
for(var t=0; t<pluginFolders.length; t++) {
|
||||
pluginFields = $tw.loadPluginFolder(path.resolve(wikiPluginsPath,"./" + pluginFolders[t]));
|
||||
if(pluginFields) {
|
||||
$tw.wiki.addTiddler(pluginFields);
|
||||
@@ -1589,7 +1612,7 @@ $tw.loadWikiTiddlers = function(wikiPath,parentPaths) {
|
||||
var wikiThemesPath = path.resolve(wikiPath,$tw.config.wikiThemesSubDir);
|
||||
if(fs.existsSync(wikiThemesPath)) {
|
||||
var themeFolders = fs.readdirSync(wikiThemesPath);
|
||||
for(t=0; t<themeFolders.length; t++) {
|
||||
for(var t=0; t<themeFolders.length; t++) {
|
||||
pluginFields = $tw.loadPluginFolder(path.resolve(wikiThemesPath,"./" + themeFolders[t]));
|
||||
if(pluginFields) {
|
||||
$tw.wiki.addTiddler(pluginFields);
|
||||
@@ -1600,7 +1623,7 @@ $tw.loadWikiTiddlers = function(wikiPath,parentPaths) {
|
||||
var wikiLanguagesPath = path.resolve(wikiPath,$tw.config.wikiLanguagesSubDir);
|
||||
if(fs.existsSync(wikiLanguagesPath)) {
|
||||
var languageFolders = fs.readdirSync(wikiLanguagesPath);
|
||||
for(t=0; t<languageFolders.length; t++) {
|
||||
for(var t=0; t<languageFolders.length; t++) {
|
||||
pluginFields = $tw.loadPluginFolder(path.resolve(wikiLanguagesPath,"./" + languageFolders[t]));
|
||||
if(pluginFields) {
|
||||
$tw.wiki.addTiddler(pluginFields);
|
||||
@@ -1661,7 +1684,11 @@ $tw.boot.startup = function(options) {
|
||||
wikiOutputSubDir: "./output",
|
||||
jsModuleHeaderRegExpString: "^\\/\\*\\\\(?:\\r?\\n)((?:^[^\\r\\n]*(?:\\r?\\n))+?)(^\\\\\\*\\/$(?:\\r?\\n)?)",
|
||||
fileExtensionInfo: Object.create(null), // Map file extension to {type:}
|
||||
contentTypeInfo: Object.create(null) // Map type to {encoding:,extension:}
|
||||
contentTypeInfo: Object.create(null), // Map type to {encoding:,extension:}
|
||||
pluginsEnvVar: "TIDDLYWIKI_PLUGIN_PATH",
|
||||
themesEnvVar: "TIDDLYWIKI_THEME_PATH",
|
||||
languagesEnvVar: "TIDDLYWIKI_LANGUAGE_PATH",
|
||||
editionsEnvVar: "TIDDLYWIKI_EDITION_PATH"
|
||||
}
|
||||
});
|
||||
if(!$tw.boot.tasks.readBrowserTiddlers) {
|
||||
@@ -1757,9 +1784,15 @@ Execute the remaining eligible startup tasks
|
||||
*/
|
||||
$tw.boot.executeNextStartupTask = function() {
|
||||
// Find the next eligible task
|
||||
var taskIndex = 0;
|
||||
var taskIndex = 0, task,
|
||||
asyncTaskCallback = function() {
|
||||
if(task.name) {
|
||||
$tw.boot.executedStartupModules[task.name] = true;
|
||||
}
|
||||
return $tw.boot.executeNextStartupTask();
|
||||
};
|
||||
while(taskIndex < $tw.boot.remainingStartupModules.length) {
|
||||
var task = $tw.boot.remainingStartupModules[taskIndex];
|
||||
task = $tw.boot.remainingStartupModules[taskIndex];
|
||||
if($tw.boot.isStartupTaskEligible(task)) {
|
||||
// Remove this task from the list
|
||||
$tw.boot.remainingStartupModules.splice(taskIndex,1);
|
||||
@@ -1783,12 +1816,7 @@ $tw.boot.executeNextStartupTask = function() {
|
||||
}
|
||||
return $tw.boot.executeNextStartupTask();
|
||||
} else {
|
||||
task.startup(function() {
|
||||
if(task.name) {
|
||||
$tw.boot.executedStartupModules[task.name] = true;
|
||||
}
|
||||
return $tw.boot.executeNextStartupTask();
|
||||
});
|
||||
task.startup(asyncTaskCallback);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because one or more lines are too long
4
core/images/right-arrow.tid
Normal file
4
core/images/right-arrow.tid
Normal file
@@ -0,0 +1,4 @@
|
||||
title: $:/core/images/right-arrow
|
||||
tags: $:/tags/Image
|
||||
|
||||
<svg class="tw-image-right-arrow tw-image-button" width="22pt" height="22pt" viewBox="0 0 128 128"><path d="M72.7982405,98.6541105 L127.184015,43.9832042 C130.938662,40.2089635 130.938662,34.0896964 127.184015,30.3154557 C123.429583,26.5412364 117.342116,26.5412364 113.587684,30.3154557 L66.0000107,78.152522 L18.4123803,30.3154557 C14.6578195,26.5412364 8.57048132,26.5412364 4.81592057,30.3154557 C1.06135981,34.0896964 1.06135981,40.2089635 4.81592057,43.9832042 L59.2017595,98.6541105 C62.9563202,102.428351 69.0436798,102.428351 72.7982405,98.6541126 L72.7982405,98.6541105 Z" transform="translate(66.000000, 64.484791) rotate(-90.000000) translate(-66.000000, -64.484791) "/></svg>
|
||||
26
core/language/en-GB/Buttons.multids
Normal file
26
core/language/en-GB/Buttons.multids
Normal file
@@ -0,0 +1,26 @@
|
||||
title: $:/language/Buttons/
|
||||
|
||||
AdvancedSearch/Caption: advanced search
|
||||
AdvancedSearch/Hint: Advanced search
|
||||
Cancel/Caption: cancel
|
||||
Cancel/Hint: Cancel editing this tiddler
|
||||
Close/Caption: close
|
||||
Close/Hint: Close this tiddler
|
||||
ControlPanel/Caption: control panel
|
||||
ControlPanel/Hint: Open control panel
|
||||
Delete/Caption: delete
|
||||
Delete/Hint: Delete this tiddler
|
||||
Edit/Caption: edit
|
||||
Edit/Hint: Edit this tiddler
|
||||
Info/Caption: info
|
||||
Info/Hint: Show information for this tiddler
|
||||
NewTiddler/Caption: new tiddler
|
||||
NewTiddler/Hint: Create a new tiddler
|
||||
Save/Caption: save
|
||||
Save/Hint: Save this tiddler
|
||||
SaveWiki/Caption: save changes
|
||||
SaveWiki/Hint: Save changes
|
||||
HideSideBar/Caption: hide sidebar
|
||||
HideSideBar/Hint: Hide sidebar
|
||||
ShowSideBar/Caption: show sidebar
|
||||
ShowSideBar/Hint: Show sidebar
|
||||
@@ -1,6 +1,10 @@
|
||||
title: $:/language/ControlPanel/
|
||||
|
||||
Advanced/Caption: Advanced
|
||||
Advanced/EditorTypes/Caption: Editor Types
|
||||
Advanced/EditorTypes/Editor/Caption: Editor
|
||||
Advanced/EditorTypes/Hint: These tiddlers determine which editor is used to edit specific tiddler types.
|
||||
Advanced/EditorTypes/Type/Caption: Type
|
||||
Advanced/Hint: Internal information about this TiddlyWiki
|
||||
Advanced/LoadedModules/Caption: Loaded Modules
|
||||
Advanced/LoadedModules/Hint: These are the currently loaded tiddler modules linked to their source tiddlers. Any italicised modules lack a source tiddler, typically because they were setup during the boot process.
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
title: $:/language/EditTemplate/
|
||||
|
||||
Body/External/Hint: This is an external tiddler stored outside of the main TiddlyWiki file. You can edit the tags and fields but cannot directly edit the content itself
|
||||
Body/Hint: Use [[wiki text|http://tiddlywiki.com/static/WikiText.html]] to add formatting, images, and dynamic features
|
||||
Body/Placeholder: Type the text for this tiddler
|
||||
Body/Preview/Button/Hide: hide preview
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
title: $:/language/Docs/Fields/
|
||||
|
||||
_canonical_uri: The full URI of an external image tiddler
|
||||
bag: The name of the bag from which a tiddler came
|
||||
caption: The text to be displayed on a tab or button
|
||||
color: The CSS color value associated with a tiddler
|
||||
|
||||
12
core/language/en-GB/Help/savetiddlers.tid
Normal file
12
core/language/en-GB/Help/savetiddlers.tid
Normal file
@@ -0,0 +1,12 @@
|
||||
title: $:/language/Help/savetiddlers
|
||||
description: Saves a group of raw tiddlers to a directory
|
||||
|
||||
Saves a group of tiddlers in their raw text or binary format to the specified directory.
|
||||
|
||||
```
|
||||
--savetiddlers <filter> <pathname>
|
||||
```
|
||||
|
||||
By default, the pathname is resolved relative to the `output` subdirectory of the edition directory. The `--output` command can be used to direct output to a different directory.
|
||||
|
||||
Any missing directories in the pathname are automatically created.
|
||||
@@ -6,7 +6,7 @@ The server built in to TiddlyWiki5 is very simple. Although compatible with Tidd
|
||||
At the root, it serves a rendering of a specified tiddler. Away from the root, it serves individual tiddlers encoded in JSON, and supports the basic HTTP operations for `GET`, `PUT` and `DELETE`.
|
||||
|
||||
```
|
||||
--server <port> <roottiddler> <rendertype> <servetype> <username> <password> <host>
|
||||
--server <port> <roottiddler> <rendertype> <servetype> <username> <password> <host> <pathprefix>
|
||||
```
|
||||
|
||||
The parameters are:
|
||||
@@ -18,6 +18,7 @@ The parameters are:
|
||||
* ''username'' - the default username for signing edits
|
||||
* ''password'' - optional password for basic authentication
|
||||
* ''host'' - optional hostname to serve from (defaults to "127.0.0.1" aka "localhost")
|
||||
* ''pathprefix'' - optional prefix for paths
|
||||
|
||||
If the password parameter is specified then the browser will prompt the user for the username and password. Note that the password is transmitted in plain text so this implementation isn't suitable for general use.
|
||||
|
||||
|
||||
18
core/language/en-GB/Help/setfield.tid
Normal file
18
core/language/en-GB/Help/setfield.tid
Normal file
@@ -0,0 +1,18 @@
|
||||
title: $:/language/Help/setfield
|
||||
description: Prepares external tiddlers for use
|
||||
|
||||
//Note that this command is experimental and may change or be replaced during the TiddlyWiki version 5 beta//
|
||||
|
||||
Sets the specified field of a group of tiddlers to the result of wikifying a template tiddler with the `currentTiddler` variable set to the tiddler.
|
||||
|
||||
```
|
||||
--setfield <filter> <fieldname> <templatetitle> <rendertype>
|
||||
```
|
||||
|
||||
The parameters are:
|
||||
|
||||
* ''filter'' - filter identifying the tiddlers to be affected
|
||||
* ''fieldname'' - the field to modify (defaults to "text")
|
||||
* ''templatetitle'' - the tiddler to wikify into the specified field. If blank or missing then the specified field is deleted
|
||||
* ''type'' - the text type to render (defaults to "text/plain"; "text/html" can be used to include HTML tags)
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
title: $:/language/SideBar/
|
||||
|
||||
All/Caption: All
|
||||
Contents/Caption: Contents
|
||||
Drafts/Caption: Drafts
|
||||
Missing/Caption: Missing
|
||||
More/Caption: More
|
||||
|
||||
4
core/language/en-GB/Types/application_javascript.tid
Normal file
4
core/language/en-GB/Types/application_javascript.tid
Normal file
@@ -0,0 +1,4 @@
|
||||
title: $:/language/Docs/Types/application/javascript
|
||||
description: JavaScript code
|
||||
name: application/javascript
|
||||
group: Developer
|
||||
@@ -1,3 +1,4 @@
|
||||
title: $:/language/Docs/Types/application/json
|
||||
description: JSON data
|
||||
name: application/json
|
||||
group: Developer
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
title: $:/language/Docs/Types/application/x-tiddler-dictionary
|
||||
description: Data dictionary
|
||||
name: application/x-tiddler-dictionary
|
||||
group: Developer
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
title: $:/language/Docs/Types/image/gif
|
||||
description: GIF image
|
||||
name: image/gif
|
||||
group: Image
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
title: $:/language/Docs/Types/image/jpeg
|
||||
description: JPEG image
|
||||
name: image/jpeg
|
||||
group: Image
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
title: $:/language/Docs/Types/image/png
|
||||
description: PNG image
|
||||
name: image/png
|
||||
group: Image
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
title: $:/language/Docs/Types/image/svg+xml
|
||||
description: Structured Vector Graphics image
|
||||
name: image/svg+xml
|
||||
group: Image
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
title: $:/language/Docs/Types/image/x-icon
|
||||
description: ICO format icon file
|
||||
name: image/x-icon
|
||||
group: Image
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
title: $:/language/Docs/Types/text/css
|
||||
description: Static stylesheet
|
||||
name: text/css
|
||||
group: Developer
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
title: $:/language/Docs/Types/text/html
|
||||
description: HTML markup
|
||||
name: text/html
|
||||
group: Text
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
title: $:/language/Docs/Types/text/plain
|
||||
description: Plain text
|
||||
name: text/plain
|
||||
group: Text
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
title: $:/language/Docs/Types/text/vnd.tiddlywiki
|
||||
description: TiddlyWiki version 5 wikitext
|
||||
description: TiddlyWiki 5
|
||||
name: text/vnd.tiddlywiki
|
||||
group: Text
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
title: $:/language/Docs/Types/text/x-tiddlywiki
|
||||
description: TiddlyWiki Classic wikitext
|
||||
description: TiddlyWiki Classic
|
||||
name: text/x-tiddlywiki
|
||||
group: Text
|
||||
|
||||
@@ -34,7 +34,7 @@ Command.prototype.execute = function() {
|
||||
for(var editionIndex=0; editionIndex<editions.length; editionIndex++) {
|
||||
var editionName = editions[editionIndex];
|
||||
// Check the edition exists
|
||||
var editionPath = path.resolve($tw.boot.corePath,$tw.config.editionsPath) + path.sep + editionName;
|
||||
var editionPath = $tw.findLibraryItem(editionName,$tw.getLibraryItemSearchPaths($tw.config.editionsPath,$tw.config.editionsEnvVar));
|
||||
if(!$tw.utils.isDirectory(editionPath)) {
|
||||
return "Edition '" + editionName + "' not found";
|
||||
}
|
||||
|
||||
53
core/modules/commands/savetiddlers.js
Normal file
53
core/modules/commands/savetiddlers.js
Normal file
@@ -0,0 +1,53 @@
|
||||
/*\
|
||||
title: $:/core/modules/commands/savetiddlers.js
|
||||
type: application/javascript
|
||||
module-type: command
|
||||
|
||||
Command to save several tiddlers to a folder of files
|
||||
|
||||
\*/
|
||||
(function(){
|
||||
|
||||
/*jslint node: true, browser: true */
|
||||
/*global $tw: false */
|
||||
"use strict";
|
||||
|
||||
var widget = require("$:/core/modules/widgets/widget.js");
|
||||
|
||||
exports.info = {
|
||||
name: "savetiddlers",
|
||||
synchronous: true
|
||||
};
|
||||
|
||||
var Command = function(params,commander,callback) {
|
||||
this.params = params;
|
||||
this.commander = commander;
|
||||
this.callback = callback;
|
||||
};
|
||||
|
||||
Command.prototype.execute = function() {
|
||||
if(this.params.length < 1) {
|
||||
return "Missing filename";
|
||||
}
|
||||
var self = this,
|
||||
fs = require("fs"),
|
||||
path = require("path"),
|
||||
wiki = this.commander.wiki,
|
||||
filter = this.params[0],
|
||||
pathname = path.resolve(this.commander.outputPath,this.params[1]),
|
||||
tiddlers = wiki.filterTiddlers(filter);
|
||||
$tw.utils.deleteDirectory(pathname);
|
||||
$tw.utils.createDirectory(pathname);
|
||||
$tw.utils.each(tiddlers,function(title) {
|
||||
var tiddler = self.commander.wiki.getTiddler(title),
|
||||
type = tiddler.fields.type || "text/vnd.tiddlywiki",
|
||||
contentTypeInfo = $tw.config.contentTypeInfo[type] || {encoding: "utf8"},
|
||||
filename = path.resolve(pathname,encodeURIComponent(title));
|
||||
fs.writeFileSync(filename,tiddler.fields.text,contentTypeInfo.encoding);
|
||||
});
|
||||
return null;
|
||||
};
|
||||
|
||||
exports.Command = Command;
|
||||
|
||||
})();
|
||||
@@ -50,10 +50,22 @@ SimpleServer.prototype.addRoute = function(route) {
|
||||
};
|
||||
|
||||
SimpleServer.prototype.findMatchingRoute = function(request,state) {
|
||||
var pathprefix = this.get("pathprefix") || "";
|
||||
for(var t=0; t<this.routes.length; t++) {
|
||||
var potentialRoute = this.routes[t],
|
||||
pathRegExp = potentialRoute.path,
|
||||
match = potentialRoute.path.exec(state.urlInfo.pathname);
|
||||
pathname = state.urlInfo.pathname,
|
||||
match;
|
||||
if(pathprefix) {
|
||||
if(pathname.substr(0,pathprefix.length) === pathprefix) {
|
||||
pathname = pathname.substr(pathprefix.length);
|
||||
match = potentialRoute.path.exec(pathname);
|
||||
} else {
|
||||
match = false;
|
||||
}
|
||||
} else {
|
||||
match = potentialRoute.path.exec(pathname);
|
||||
}
|
||||
if(match && request.method === potentialRoute.method) {
|
||||
state.params = [];
|
||||
for(var p=1; p<match.length; p++) {
|
||||
@@ -161,7 +173,8 @@ var Command = function(params,commander,callback) {
|
||||
state.wiki.addTiddler(new $tw.Tiddler(state.wiki.getCreationFields(),fields,{title: title}));
|
||||
var changeCount = state.wiki.getChangeCount(title).toString();
|
||||
response.writeHead(204, "OK",{
|
||||
Etag: "\"default/" + encodeURIComponent(title) + "/" + changeCount + ":\""
|
||||
Etag: "\"default/" + encodeURIComponent(title) + "/" + changeCount + ":\"",
|
||||
"Content-Type": "text/plain"
|
||||
});
|
||||
response.end();
|
||||
}
|
||||
@@ -172,7 +185,9 @@ var Command = function(params,commander,callback) {
|
||||
handler: function(request,response,state) {
|
||||
var title = decodeURIComponent(state.params[0]);
|
||||
state.wiki.deleteTiddler(title);
|
||||
response.writeHead(204, "OK");
|
||||
response.writeHead(204, "OK", {
|
||||
"Content-Type": "text/plain"
|
||||
});
|
||||
response.end();
|
||||
}
|
||||
});
|
||||
@@ -269,13 +284,15 @@ Command.prototype.execute = function() {
|
||||
serveType = this.params[3] || "text/html",
|
||||
username = this.params[4],
|
||||
password = this.params[5],
|
||||
host = this.params[6] || "127.0.0.1";
|
||||
host = this.params[6] || "127.0.0.1",
|
||||
pathprefix = this.params[7];
|
||||
this.server.set({
|
||||
rootTiddler: rootTiddler,
|
||||
renderType: renderType,
|
||||
serveType: serveType,
|
||||
username: username,
|
||||
password: password
|
||||
password: password,
|
||||
pathprefix: pathprefix
|
||||
});
|
||||
this.server.listen(port,host);
|
||||
console.log("Serving on " + host + ":" + port);
|
||||
|
||||
58
core/modules/commands/setfield.js
Normal file
58
core/modules/commands/setfield.js
Normal file
@@ -0,0 +1,58 @@
|
||||
/*\
|
||||
title: $:/core/modules/commands/setfield.js
|
||||
type: application/javascript
|
||||
module-type: command
|
||||
|
||||
Command to modify selected tiddlers to set a field to the text of a template tiddler that has been wikified with the selected tiddler as the current tiddler.
|
||||
|
||||
\*/
|
||||
(function(){
|
||||
|
||||
/*jslint node: true, browser: true */
|
||||
/*global $tw: false */
|
||||
"use strict";
|
||||
|
||||
var widget = require("$:/core/modules/widgets/widget.js");
|
||||
|
||||
exports.info = {
|
||||
name: "setfield",
|
||||
synchronous: true
|
||||
};
|
||||
|
||||
var Command = function(params,commander,callback) {
|
||||
this.params = params;
|
||||
this.commander = commander;
|
||||
this.callback = callback;
|
||||
};
|
||||
|
||||
Command.prototype.execute = function() {
|
||||
if(this.params.length < 4) {
|
||||
return "Missing parameters";
|
||||
}
|
||||
var self = this,
|
||||
wiki = this.commander.wiki,
|
||||
filter = this.params[0],
|
||||
fieldname = this.params[1] || "text",
|
||||
templatetitle = this.params[2],
|
||||
rendertype = this.params[3] || "text/plain",
|
||||
tiddlers = wiki.filterTiddlers(filter);
|
||||
$tw.utils.each(tiddlers,function(title) {
|
||||
var parser = wiki.parseTiddler(templatetitle),
|
||||
newFields = {},
|
||||
tiddler = wiki.getTiddler(title);
|
||||
if(parser) {
|
||||
var widgetNode = wiki.makeWidget(parser,{variables: {currentTiddler: title}});
|
||||
var container = $tw.fakeDocument.createElement("div");
|
||||
widgetNode.render(container,null);
|
||||
newFields[fieldname] = rendertype === "text/html" ? container.innerHTML : container.textContent;
|
||||
} else {
|
||||
newFields[fieldname] = undefined;
|
||||
}
|
||||
wiki.addTiddler(new $tw.Tiddler(tiddler,newFields));
|
||||
});
|
||||
return null;
|
||||
};
|
||||
|
||||
exports.Command = Command;
|
||||
|
||||
})();
|
||||
@@ -57,7 +57,7 @@ var parseTiddlerDiv = function(text /* [,fields] */) {
|
||||
attrMatch = attrRegExp.exec(match[1]);
|
||||
if(attrMatch) {
|
||||
var name = attrMatch[1];
|
||||
var value = attrMatch[2] || attrMatch[3];
|
||||
var value = attrMatch[2] !== undefined ? attrMatch[2] : attrMatch[3];
|
||||
result[name] = value;
|
||||
}
|
||||
} while(attrMatch);
|
||||
|
||||
@@ -16,9 +16,10 @@ Filter operator returning all tiddlers that have the selected tiddlers in a list
|
||||
Export our filter function
|
||||
*/
|
||||
exports.listed = function(source,operator,options) {
|
||||
var results = [];
|
||||
var field = operator.operand || "list",
|
||||
results = [];
|
||||
source(function(tiddler,title) {
|
||||
$tw.utils.pushTop(results,options.wiki.findListingsOfTiddler(title));
|
||||
$tw.utils.pushTop(results,options.wiki.findListingsOfTiddler(title,field));
|
||||
});
|
||||
return results;
|
||||
};
|
||||
|
||||
@@ -13,9 +13,18 @@ The HTML parser displays text as raw HTML
|
||||
"use strict";
|
||||
|
||||
var HtmlParser = function(type,text,options) {
|
||||
var src;
|
||||
if(options._canonical_uri) {
|
||||
src = options._canonical_uri;
|
||||
} else if(text) {
|
||||
src = "data:text/html," + encodeURIComponent(text);
|
||||
}
|
||||
this.tree = [{
|
||||
type: "raw",
|
||||
html: text
|
||||
type: "element",
|
||||
tag: "iframe",
|
||||
attributes: {
|
||||
src: {type: "string", value: src}
|
||||
}
|
||||
}];
|
||||
};
|
||||
|
||||
|
||||
@@ -19,7 +19,12 @@ var ImageParser = function(type,text,options) {
|
||||
attributes: {}
|
||||
},
|
||||
src;
|
||||
if(text) {
|
||||
if(options._canonical_uri) {
|
||||
element.attributes.src = {type: "string", value: options._canonical_uri};
|
||||
if(type === "application/pdf" || type === ".pdf") {
|
||||
element.tag = "embed";
|
||||
}
|
||||
} else if(text) {
|
||||
if(type === "application/pdf" || type === ".pdf") {
|
||||
element.attributes.src = {type: "string", value: "data:application/pdf;base64," + text};
|
||||
element.tag = "embed";
|
||||
|
||||
@@ -99,11 +99,13 @@ exports.parseStringLiteral = function(source,pos) {
|
||||
type: "string",
|
||||
start: pos
|
||||
};
|
||||
var reString = /(?:"([^"]*)")|(?:'([^']*)')/g;
|
||||
var reString = /(?:"""([\s\S]*?)"""|"([^"]*)")|(?:'([^']*)')/g;
|
||||
reString.lastIndex = pos;
|
||||
var match = reString.exec(source);
|
||||
if(match && match.index === pos) {
|
||||
node.value = match[1] === undefined ? match[2] : match[1];
|
||||
node.value = match[1] !== undefined ? match[1] :(
|
||||
match[2] !== undefined ? match[2] : match[3]
|
||||
);
|
||||
node.end = pos + match[0].length;
|
||||
return node;
|
||||
} else {
|
||||
@@ -120,7 +122,7 @@ exports.parseMacroParameter = function(source,pos) {
|
||||
start: pos
|
||||
};
|
||||
// Define our regexp
|
||||
var reMacroParameter = /(?:([A-Za-z0-9\-_]+)\s*:)?(?:\s*(?:"([^"]*)"|'([^']*)'|\[\[([^\]]*)\]\]|([^\s>"'=]+)))/g;
|
||||
var reMacroParameter = /(?:([A-Za-z0-9\-_]+)\s*:)?(?:\s*(?:"""([\s\S]*?)"""|"([^"]*)"|'([^']*)'|\[\[([^\]]*)\]\]|([^\s>"'=]+)))/g;
|
||||
// Skip whitespace
|
||||
pos = $tw.utils.skipWhiteSpace(source,pos);
|
||||
// Look for the parameter
|
||||
@@ -134,7 +136,9 @@ exports.parseMacroParameter = function(source,pos) {
|
||||
token.match[3] !== undefined ? token.match[3] : (
|
||||
token.match[4] !== undefined ? token.match[4] : (
|
||||
token.match[5] !== undefined ? token.match[5] : (
|
||||
""
|
||||
token.match[6] !== undefined ? token.match[6] : (
|
||||
""
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
@@ -35,12 +35,12 @@ exports.parse = function() {
|
||||
// Move past the macro call
|
||||
this.parser.pos = this.matchRegExp.lastIndex;
|
||||
var params = [],
|
||||
reParam = /\s*(?:([A-Za-z0-9\-_]+)\s*:)?(?:\s*(?:"([^"]*)"|'([^']*)'|\[\[([^\]]*)\]\]|([^"'\s]+)))/mg,
|
||||
reParam = /\s*(?:([A-Za-z0-9\-_]+)\s*:)?(?:\s*(?:"""([\s\S]*?)"""|"([^"]*)"|'([^']*)'|\[\[([^\]]*)\]\]|([^"'\s]+)))/mg,
|
||||
paramMatch = reParam.exec(paramString);
|
||||
while(paramMatch) {
|
||||
// Process this parameter
|
||||
var paramInfo = {
|
||||
value: paramMatch[2] || paramMatch[3] || paramMatch[4] || paramMatch[5]
|
||||
value: paramMatch[2] || paramMatch[3] || paramMatch[4] || paramMatch[5] || paramMatch[6]
|
||||
};
|
||||
if(paramMatch[1]) {
|
||||
paramInfo.name = paramMatch[1];
|
||||
|
||||
@@ -35,12 +35,12 @@ exports.parse = function() {
|
||||
// Move past the macro call
|
||||
this.parser.pos = this.matchRegExp.lastIndex;
|
||||
var params = [],
|
||||
reParam = /\s*(?:([A-Za-z0-9\-_]+)\s*:)?(?:\s*(?:"([^"]*)"|'([^']*)'|\[\[([^\]]*)\]\]|([^"'\s]+)))/mg,
|
||||
reParam = /\s*(?:([A-Za-z0-9\-_]+)\s*:)?(?:\s*(?:"""([\s\S]*?)"""|"([^"]*)"|'([^']*)'|\[\[([^\]]*)\]\]|([^"'\s]+)))/mg,
|
||||
paramMatch = reParam.exec(paramString);
|
||||
while(paramMatch) {
|
||||
// Process this parameter
|
||||
var paramInfo = {
|
||||
value: paramMatch[2] || paramMatch[3] || paramMatch[4] || paramMatch[5]
|
||||
value: paramMatch[2] || paramMatch[3] || paramMatch[4] || paramMatch[5]|| paramMatch[6]
|
||||
};
|
||||
if(paramMatch[1]) {
|
||||
paramInfo.name = paramMatch[1];
|
||||
|
||||
@@ -40,12 +40,12 @@ exports.parse = function() {
|
||||
var paramString = this.match[2],
|
||||
params = [];
|
||||
if(paramString !== "") {
|
||||
var reParam = /\s*([A-Za-z0-9\-_]+)(?:\s*:\s*(?:"([^"]*)"|'([^']*)'|\[\[([^\]]*)\]\]|([^"'\s]+)))?/mg,
|
||||
var reParam = /\s*([A-Za-z0-9\-_]+)(?:\s*:\s*(?:"""([\s\S]*?)"""|"([^"]*)"|'([^']*)'|\[\[([^\]]*)\]\]|([^"'\s]+)))?/mg,
|
||||
paramMatch = reParam.exec(paramString);
|
||||
while(paramMatch) {
|
||||
// Save the parameter details
|
||||
var paramInfo = {name: paramMatch[1]},
|
||||
defaultValue = paramMatch[2] || paramMatch[3] || paramMatch[4] || paramMatch[5];
|
||||
defaultValue = paramMatch[2] || paramMatch[3] || paramMatch[4] || paramMatch[5] || paramMatch[6];
|
||||
if(defaultValue) {
|
||||
paramInfo["default"] = defaultValue;
|
||||
}
|
||||
|
||||
@@ -72,7 +72,9 @@ exports.parseLink = function(source,pos) {
|
||||
type: "element",
|
||||
tag: "a",
|
||||
start: pos,
|
||||
attributes: {},
|
||||
attributes: {
|
||||
"class": {type: "string", value: "tw-tiddlylink-external"},
|
||||
},
|
||||
children: [textNode]
|
||||
};
|
||||
// Skip whitespace
|
||||
|
||||
@@ -21,7 +21,7 @@ exports.synchronous = true;
|
||||
// Default story and history lists
|
||||
var PAGE_TITLE_TITLE = "$:/core/wiki/title"
|
||||
var PAGE_STYLESHEET_TITLE = "$:/core/ui/PageStylesheet";
|
||||
var PAGE_TEMPLATE_TITLE = "$:/core/ui/PageMacros";
|
||||
var PAGE_TEMPLATE_TITLE = "$:/core/ui/PageTemplate";
|
||||
|
||||
// Time (in ms) that we defer refreshing changes to draft tiddlers
|
||||
var DRAFT_TIDDLER_TIMEOUT = 400;
|
||||
@@ -49,7 +49,7 @@ exports.startup = function() {
|
||||
$tw.styleElement.innerHTML = $tw.styleContainer.textContent;
|
||||
}
|
||||
}));
|
||||
// Display the $:/core/ui/PageMacros tiddler to kick off the display
|
||||
// Display the $:/core/ui/PageTemplate tiddler to kick off the display
|
||||
$tw.perf.report("mainRender",function() {
|
||||
$tw.pageWidgetNode = $tw.wiki.makeTranscludeWidget(PAGE_TEMPLATE_TITLE,{document: document, parentWidget: $tw.rootWidget});
|
||||
$tw.pageContainer = document.createElement("div");
|
||||
|
||||
@@ -61,9 +61,9 @@ defaultToCurrentStory: If true, the current story is retained as the default, in
|
||||
*/
|
||||
function openStartupTiddlers(options) {
|
||||
options = options || {};
|
||||
// Decode the hash portion of our URL
|
||||
var target,
|
||||
storyFilter;
|
||||
// Work out the target tiddler and the story filter. "null" means "unspecified"
|
||||
var target = null,
|
||||
storyFilter = null;
|
||||
if($tw.locationHash.length > 1) {
|
||||
var hash = $tw.locationHash.substr(1),
|
||||
split = hash.indexOf(":");
|
||||
@@ -74,23 +74,20 @@ function openStartupTiddlers(options) {
|
||||
storyFilter = decodeURIComponent(hash.substr(split + 1).trim());
|
||||
}
|
||||
}
|
||||
// If a target tiddler was specified add it to the history stack
|
||||
if(target && target !== "") {
|
||||
// The target tiddler doesn't need double square brackets, but we'll silently remove them if they're present
|
||||
if(target.indexOf("[[") === 0 && target.substr(-2) === "]]") {
|
||||
target = target.substr(2,target.length - 4);
|
||||
}
|
||||
$tw.wiki.addToHistory(target);
|
||||
}
|
||||
// Use the story filter specified in the hash, or the default tiddlers
|
||||
if(!storyFilter || storyFilter === "") {
|
||||
// If the story wasn't specified use the current tiddlers or a blank story
|
||||
if(storyFilter === null) {
|
||||
if(options.defaultToCurrentStory) {
|
||||
var currStoryList = $tw.wiki.getTiddlerList(DEFAULT_STORY_TITLE);
|
||||
storyFilter = $tw.utils.stringifyList(currStoryList);
|
||||
} else {
|
||||
storyFilter = $tw.wiki.getTiddlerText(DEFAULT_TIDDLERS_TITLE);
|
||||
if(target && target !== "") {
|
||||
storyFilter = "";
|
||||
} else {
|
||||
storyFilter = $tw.wiki.getTiddlerText(DEFAULT_TIDDLERS_TITLE);
|
||||
}
|
||||
}
|
||||
}
|
||||
// Process the story filter to get the story list
|
||||
var storyList = $tw.wiki.filterTiddlers(storyFilter);
|
||||
// If the target tiddler isn't included then splice it in at the top
|
||||
if(target && storyList.indexOf(target) === -1) {
|
||||
@@ -98,6 +95,16 @@ function openStartupTiddlers(options) {
|
||||
}
|
||||
// Save the story list
|
||||
$tw.wiki.addTiddler({title: DEFAULT_STORY_TITLE, text: "", list: storyList},$tw.wiki.getModificationFields());
|
||||
// If a target tiddler was specified add it to the history stack
|
||||
if(target && target !== "") {
|
||||
// The target tiddler doesn't need double square brackets, but we'll silently remove them if they're present
|
||||
if(target.indexOf("[[") === 0 && target.substr(-2) === "]]") {
|
||||
target = target.substr(2,target.length - 4);
|
||||
}
|
||||
$tw.wiki.addToHistory(target);
|
||||
} else if(storyList.length > 0) {
|
||||
$tw.wiki.addToHistory(storyList[0]);
|
||||
}
|
||||
}
|
||||
|
||||
function updateLocationHash() {
|
||||
|
||||
@@ -18,7 +18,7 @@ exports.hasTag = function(tag) {
|
||||
|
||||
exports.isPlugin = function() {
|
||||
return this.fields.type === "application/json" && this.hasField("plugin-type");
|
||||
}
|
||||
};
|
||||
|
||||
exports.isDraft = function() {
|
||||
return this.hasField("draft.of");
|
||||
@@ -57,4 +57,52 @@ exports.getFieldStringBlock = function(options) {
|
||||
return fields.join("\n");
|
||||
};
|
||||
|
||||
/*
|
||||
Compare two tiddlers for equality
|
||||
tiddler: the tiddler to compare
|
||||
excludeFields: array of field names to exclude from the comparison
|
||||
*/
|
||||
exports.isEqual = function(tiddler,excludeFields) {
|
||||
excludeFields = excludeFields || [];
|
||||
var self = this,
|
||||
differences = []; // Fields that have differences
|
||||
// Add to the differences array
|
||||
function addDifference(fieldName) {
|
||||
// Check for this field being excluded
|
||||
if(excludeFields.indexOf(fieldName) === -1) {
|
||||
// Save the field as a difference
|
||||
$tw.utils.pushTop(differences,fieldName);
|
||||
}
|
||||
}
|
||||
// Returns true if the two values of this field are equal
|
||||
function isFieldValueEqual(fieldName) {
|
||||
var valueA = self.fields[fieldName],
|
||||
valueB = tiddler.fields[fieldName];
|
||||
// Check for identical string values
|
||||
if(typeof(valueA) === "string" && typeof(valueB) === "string" && valueA === valueB) {
|
||||
return true;
|
||||
}
|
||||
// Check for identical array values
|
||||
if($tw.utils.isArray(valueA) && $tw.utils.isArray(valueB) && $tw.utils.isArrayEqual(valueA,valueB)) {
|
||||
return true;
|
||||
}
|
||||
// Otherwise the fields must be different
|
||||
return false;
|
||||
}
|
||||
// Compare our fields
|
||||
for(var fieldName in this.fields) {
|
||||
if(!isFieldValueEqual(fieldName)) {
|
||||
addDifference(fieldName);
|
||||
}
|
||||
}
|
||||
// There's a difference for every field in the other tiddler that we don't have
|
||||
for(fieldName in tiddler.fields) {
|
||||
if(!(fieldName in this.fields)) {
|
||||
addDifference(fieldName);
|
||||
}
|
||||
}
|
||||
// Return whether there were any differences
|
||||
return differences.length === 0;
|
||||
};
|
||||
|
||||
})();
|
||||
|
||||
@@ -46,10 +46,16 @@ ButtonWidget.prototype.render = function(parent,nextSibling) {
|
||||
}
|
||||
}
|
||||
domNode.className = classes.join(" ");
|
||||
// Assign classes
|
||||
// Assign other attributes
|
||||
if(this.style) {
|
||||
domNode.setAttribute("style",this.style);
|
||||
}
|
||||
if(this.title) {
|
||||
domNode.setAttribute("title",this.title);
|
||||
}
|
||||
if(this["aria-label"]) {
|
||||
domNode.setAttribute("aria-label",this["aria-label"]);
|
||||
}
|
||||
// Add a click event handler
|
||||
domNode.addEventListener("click",function (event) {
|
||||
var handled = false;
|
||||
@@ -134,6 +140,8 @@ ButtonWidget.prototype.execute = function() {
|
||||
this.popup = this.getAttribute("popup");
|
||||
this.hover = this.getAttribute("hover");
|
||||
this["class"] = this.getAttribute("class","");
|
||||
this["aria-label"] = this.getAttribute("aria-label");
|
||||
this.title = this.getAttribute("title");
|
||||
this.style = this.getAttribute("style");
|
||||
this.selectedClass = this.getAttribute("selectedClass");
|
||||
this.defaultSetValue = this.getAttribute("default");
|
||||
|
||||
@@ -192,10 +192,12 @@ DropZoneWidget.prototype.handlePasteEvent = function(event) {
|
||||
});
|
||||
} else if(item.kind === "string") {
|
||||
// Create tiddlers from string items
|
||||
var type = item.type;
|
||||
item.getAsString(function(str) {
|
||||
var tiddlerFields = {
|
||||
title: self.wiki.generateNewTitle("Untitled"),
|
||||
text: str
|
||||
text: str,
|
||||
type: type
|
||||
};
|
||||
self.dispatchEvent({type: "tw-import-tiddlers", param: JSON.stringify([tiddlerFields])});
|
||||
});
|
||||
|
||||
@@ -56,20 +56,37 @@ ImageWidget.prototype.render = function(parent,nextSibling) {
|
||||
} else {
|
||||
// Check if it is an image tiddler
|
||||
if(this.wiki.isImageTiddler(this.imageSource)) {
|
||||
// Render the appropriate element for the image type
|
||||
var type = tiddler.fields.type,
|
||||
text = tiddler.fields.text;
|
||||
switch(type) {
|
||||
case "application/pdf":
|
||||
tag = "embed";
|
||||
src = "data:application/pdf;base64," + text;
|
||||
break;
|
||||
case "image/svg+xml":
|
||||
src = "data:image/svg+xml," + encodeURIComponent(text);
|
||||
break;
|
||||
default:
|
||||
src = "data:" + type + ";base64," + text;
|
||||
break;
|
||||
text = tiddler.fields.text,
|
||||
_canonical_uri = tiddler.fields._canonical_uri;
|
||||
// If the tiddler has body text then it doesn't need to be lazily loaded
|
||||
if(text) {
|
||||
// Render the appropriate element for the image type
|
||||
switch(type) {
|
||||
case "application/pdf":
|
||||
tag = "embed";
|
||||
src = "data:application/pdf;base64," + text;
|
||||
break;
|
||||
case "image/svg+xml":
|
||||
src = "data:image/svg+xml," + encodeURIComponent(text);
|
||||
break;
|
||||
default:
|
||||
src = "data:" + type + ";base64," + text;
|
||||
break;
|
||||
}
|
||||
} else if(_canonical_uri) {
|
||||
switch(type) {
|
||||
case "application/pdf":
|
||||
tag = "embed";
|
||||
src = _canonical_uri;
|
||||
break;
|
||||
case "image/svg+xml":
|
||||
src = _canonical_uri;
|
||||
break;
|
||||
default:
|
||||
src = _canonical_uri;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
114
core/modules/widgets/importvariables.js
Normal file
114
core/modules/widgets/importvariables.js
Normal file
@@ -0,0 +1,114 @@
|
||||
/*\
|
||||
title: $:/core/modules/widgets/importvariables.js
|
||||
type: application/javascript
|
||||
module-type: widget
|
||||
|
||||
Import variable definitions from other tiddlers
|
||||
|
||||
\*/
|
||||
(function(){
|
||||
|
||||
/*jslint node: true, browser: true */
|
||||
/*global $tw: false */
|
||||
"use strict";
|
||||
|
||||
var Widget = require("$:/core/modules/widgets/widget.js").widget;
|
||||
|
||||
var ImportVariablesWidget = function(parseTreeNode,options) {
|
||||
this.initialise(parseTreeNode,options);
|
||||
};
|
||||
|
||||
/*
|
||||
Inherit from the base widget class
|
||||
*/
|
||||
ImportVariablesWidget.prototype = new Widget();
|
||||
|
||||
/*
|
||||
Render this widget into the DOM
|
||||
*/
|
||||
ImportVariablesWidget.prototype.render = function(parent,nextSibling) {
|
||||
this.parentDomNode = parent;
|
||||
this.computeAttributes();
|
||||
this.execute();
|
||||
this.renderChildren(parent,nextSibling);
|
||||
};
|
||||
|
||||
/*
|
||||
Compute the internal state of the widget
|
||||
*/
|
||||
ImportVariablesWidget.prototype.execute = function(tiddlerList) {
|
||||
var self = this;
|
||||
// Get our parameters
|
||||
this.filter = this.getAttribute("filter");
|
||||
// Compute the filter
|
||||
this.tiddlerList = tiddlerList || this.wiki.filterTiddlers(this.filter,this);
|
||||
// Accumulate the <$set> widgets from each tiddler
|
||||
var widgetStackStart,widgetStackEnd;
|
||||
function addWidgetNode(widgetNode) {
|
||||
if(widgetNode) {
|
||||
if(!widgetStackStart && !widgetStackEnd) {
|
||||
widgetStackStart = widgetNode;
|
||||
widgetStackEnd = widgetNode;
|
||||
} else {
|
||||
widgetStackEnd.children = [widgetNode];
|
||||
widgetStackEnd = widgetNode;
|
||||
}
|
||||
}
|
||||
}
|
||||
$tw.utils.each(this.tiddlerList,function(title) {
|
||||
var parser = self.wiki.parseTiddler(title);
|
||||
if(parser) {
|
||||
var parseTreeNode = parser.tree[0];
|
||||
while(parseTreeNode && parseTreeNode.type === "set") {
|
||||
addWidgetNode({
|
||||
type: "set",
|
||||
attributes: parseTreeNode.attributes,
|
||||
params: parseTreeNode.params
|
||||
});
|
||||
parseTreeNode = parseTreeNode.children[0];
|
||||
}
|
||||
}
|
||||
});
|
||||
// Add our own children to the end of the pile
|
||||
var parseTreeNodes;
|
||||
if(widgetStackStart && widgetStackEnd) {
|
||||
parseTreeNodes = [widgetStackStart];
|
||||
widgetStackEnd.children = this.parseTreeNode.children;
|
||||
} else {
|
||||
parseTreeNodes = this.parseTreeNode.children;
|
||||
}
|
||||
// Construct the child widgets
|
||||
this.makeChildWidgets(parseTreeNodes);
|
||||
};
|
||||
|
||||
/*
|
||||
Selectively refreshes the widget if needed. Returns true if the widget or any of its children needed re-rendering
|
||||
*/
|
||||
ImportVariablesWidget.prototype.refresh = function(changedTiddlers) {
|
||||
// Recompute our attributes and the filter list
|
||||
var changedAttributes = this.computeAttributes(),
|
||||
tiddlerList = this.wiki.filterTiddlers(this.getAttribute("filter"),this);
|
||||
// Refresh if the filter has changed, or the list of tiddlers has changed, or any of the tiddlers in the list has changed
|
||||
function haveListedTiddlersChanged() {
|
||||
var changed = false;
|
||||
tiddlerList.forEach(function(title) {
|
||||
if(changedTiddlers[title]) {
|
||||
changed = true;
|
||||
}
|
||||
});
|
||||
return changed;
|
||||
}
|
||||
if(changedAttributes.filter || !$tw.utils.isArrayEqual(this.tiddlerList,tiddlerList) || haveListedTiddlersChanged()) {
|
||||
// Compute the filter
|
||||
this.removeChildDomNodes();
|
||||
this.execute(tiddlerList);
|
||||
this.renderChildren(this.parentDomNode,this.findNextSiblingDomNode());
|
||||
return true;
|
||||
} else {
|
||||
return this.refreshChildren(changedTiddlers);
|
||||
}
|
||||
};
|
||||
|
||||
exports.importvariables = ImportVariablesWidget;
|
||||
|
||||
})();
|
||||
@@ -87,6 +87,9 @@ LinkWidget.prototype.renderLink = function(parent,nextSibling) {
|
||||
});
|
||||
domNode.setAttribute("title",tooltipText);
|
||||
}
|
||||
if(this["aria-label"]) {
|
||||
domNode.setAttribute("aria-label",this["aria-label"]);
|
||||
}
|
||||
// Add a click event handler
|
||||
$tw.utils.addEventListeners(domNode,[
|
||||
{name: "click", handlerObject: this, handlerMethod: "handleClickEvent"},
|
||||
@@ -176,8 +179,9 @@ Compute the internal state of the widget
|
||||
LinkWidget.prototype.execute = function() {
|
||||
// Get the target tiddler title
|
||||
this.to = this.getAttribute("to",this.getVariable("currentTiddler"));
|
||||
// Get the link title
|
||||
// Get the link title and aria label
|
||||
this.tooltip = this.getAttribute("tooltip");
|
||||
this["aria-label"] = this.getAttribute("aria-label");
|
||||
// Determine the link characteristics
|
||||
this.isMissing = !this.wiki.tiddlerExists(this.to);
|
||||
this.isShadow = this.wiki.isShadowTiddler(this.to);
|
||||
@@ -190,7 +194,7 @@ Selectively refreshes the widget if needed. Returns true if the widget or any of
|
||||
*/
|
||||
LinkWidget.prototype.refresh = function(changedTiddlers) {
|
||||
var changedAttributes = this.computeAttributes();
|
||||
if(changedAttributes.to || changedTiddlers[this.to] || changedAttributes.tooltip) {
|
||||
if(changedAttributes.to || changedTiddlers[this.to] || changedAttributes["aria-label"] || changedAttributes.tooltip) {
|
||||
this.refreshSelf();
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -307,7 +307,8 @@ NavigatorWidget.prototype.handleSaveTiddlerEvent = function(event) {
|
||||
{title: draftTitle}
|
||||
}
|
||||
));
|
||||
} else if(!this.wiki.isDraftModified(title)) {
|
||||
}
|
||||
if(!isRename && !this.wiki.isDraftModified(title)) {
|
||||
event.type = "tw-cancel-tiddler";
|
||||
this.dispatchEvent(event);
|
||||
} else if(isConfirmed) {
|
||||
|
||||
@@ -95,7 +95,7 @@ Compute the internal state of the widget
|
||||
RadioWidget.prototype.execute = function() {
|
||||
// Get the parameters from the attributes
|
||||
this.radioTitle = this.getAttribute("tiddler",this.getVariable("currentTiddler"));
|
||||
this.radioField = this.getAttribute("field");
|
||||
this.radioField = this.getAttribute("field","text");
|
||||
this.radioValue = this.getAttribute("value");
|
||||
this.radioClass = this.getAttribute("class","");
|
||||
if(this.radioClass !== "") {
|
||||
|
||||
139
core/modules/widgets/select.js
Normal file
139
core/modules/widgets/select.js
Normal file
@@ -0,0 +1,139 @@
|
||||
/*\
|
||||
title: $:/core/modules/widgets/select.js
|
||||
type: application/javascript
|
||||
module-type: widget
|
||||
|
||||
Select widget:
|
||||
|
||||
```
|
||||
<$select tiddler="MyTiddler" field="text">
|
||||
<$list filter="[tag[chapter]]">
|
||||
<option value=<<currentTiddler>>>
|
||||
<$view field="description"/>
|
||||
</option>
|
||||
</$list>
|
||||
</$select>
|
||||
```
|
||||
|
||||
\*/
|
||||
(function(){
|
||||
|
||||
/*jslint node: true, browser: true */
|
||||
/*global $tw: false */
|
||||
"use strict";
|
||||
|
||||
var Widget = require("$:/core/modules/widgets/widget.js").widget;
|
||||
|
||||
var SelectWidget = function(parseTreeNode,options) {
|
||||
this.initialise(parseTreeNode,options);
|
||||
};
|
||||
|
||||
/*
|
||||
Inherit from the base widget class
|
||||
*/
|
||||
SelectWidget.prototype = new Widget();
|
||||
|
||||
/*
|
||||
Render this widget into the DOM
|
||||
*/
|
||||
SelectWidget.prototype.render = function(parent,nextSibling) {
|
||||
this.parentDomNode = parent;
|
||||
this.computeAttributes();
|
||||
this.execute();
|
||||
this.renderChildren(parent,nextSibling);
|
||||
this.setSelectValue();
|
||||
$tw.utils.addEventListeners(this.getSelectDomNode(),[
|
||||
{name: "change", handlerObject: this, handlerMethod: "handleChangeEvent"}
|
||||
]);
|
||||
};
|
||||
|
||||
/*
|
||||
Handle a change event
|
||||
*/
|
||||
SelectWidget.prototype.handleChangeEvent = function(event) {
|
||||
var value = this.getSelectDomNode().value;
|
||||
this.wiki.setText(this.selectTitle,this.selectField,this.selectIndex,value);
|
||||
};
|
||||
|
||||
/*
|
||||
If necessary, set the value of the select element to the current value
|
||||
*/
|
||||
SelectWidget.prototype.setSelectValue = function() {
|
||||
var value = this.selectDefault;
|
||||
// Get the value
|
||||
if(this.selectIndex) {
|
||||
value = this.wiki.extractTiddlerDataItem(this.selectTitle,this.selectIndex);
|
||||
} else {
|
||||
var tiddler = this.wiki.getTiddler(this.selectTitle);
|
||||
if(tiddler) {
|
||||
if(this.selectField === "text") {
|
||||
// Calling getTiddlerText() triggers lazy loading of skinny tiddlers
|
||||
value = this.wiki.getTiddlerText(this.selectTitle);
|
||||
} else {
|
||||
if($tw.utils.hop(tiddler.fields,this.selectField)) {
|
||||
value = tiddler.getFieldString(this.selectField);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if(this.selectField === "title") {
|
||||
value = this.selectTitle;
|
||||
}
|
||||
}
|
||||
}
|
||||
// Assign it to the select element if it's different than the current value
|
||||
var domNode = this.getSelectDomNode();
|
||||
if(domNode.value !== value) {
|
||||
domNode.value = value;
|
||||
}
|
||||
};
|
||||
|
||||
/*
|
||||
Get the DOM node of the select element
|
||||
*/
|
||||
SelectWidget.prototype.getSelectDomNode = function() {
|
||||
return this.children[0].domNodes[0];
|
||||
};
|
||||
|
||||
/*
|
||||
Compute the internal state of the widget
|
||||
*/
|
||||
SelectWidget.prototype.execute = function() {
|
||||
// Get our parameters
|
||||
this.selectTitle = this.getAttribute("tiddler",this.getVariable("currentTiddler"));
|
||||
this.selectField = this.getAttribute("field","text");
|
||||
this.selectIndex = this.getAttribute("index");
|
||||
this.selectClass = this.getAttribute("class");
|
||||
this.selectDefault = this.getAttribute("default");
|
||||
// Make the child widgets
|
||||
var selectNode = {
|
||||
type: "element",
|
||||
tag: "select",
|
||||
children: this.parseTreeNode.children
|
||||
};
|
||||
if(this.selectClass) {
|
||||
$tw.utils.addAttributeToParseTreeNode(selectNode,"class",this.selectClass);
|
||||
}
|
||||
this.makeChildWidgets([selectNode]);
|
||||
};
|
||||
|
||||
/*
|
||||
Selectively refreshes the widget if needed. Returns true if the widget or any of its children needed re-rendering
|
||||
*/
|
||||
SelectWidget.prototype.refresh = function(changedTiddlers) {
|
||||
var changedAttributes = this.computeAttributes();
|
||||
// If we're using a different tiddler/field/index then completely refresh ourselves
|
||||
if(changedAttributes.selectTitle || changedAttributes.selectField || changedAttributes.selectIndex) {
|
||||
this.refreshSelf();
|
||||
return true;
|
||||
// If the target tiddler value has changed, just update setting and refresh the children
|
||||
} else {
|
||||
if(changedTiddlers[this.selectTitle]) {
|
||||
this.setSelectValue();
|
||||
}
|
||||
return this.refreshChildren(changedTiddlers);
|
||||
}
|
||||
};
|
||||
|
||||
exports.select = SelectWidget;
|
||||
|
||||
})();
|
||||
@@ -47,7 +47,13 @@ TextNodeWidget.prototype.execute = function() {
|
||||
Selectively refreshes the widget if needed. Returns true if the widget or any of its children needed re-rendering
|
||||
*/
|
||||
TextNodeWidget.prototype.refresh = function(changedTiddlers) {
|
||||
return false;
|
||||
var changedAttributes = this.computeAttributes();
|
||||
if(changedAttributes.text) {
|
||||
this.refreshSelf();
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
exports.text = TextNodeWidget;
|
||||
|
||||
@@ -43,7 +43,7 @@ TranscludeWidget.prototype.execute = function() {
|
||||
this.transcludeIndex = this.getAttribute("index");
|
||||
this.transcludeMode = this.getAttribute("mode");
|
||||
// Check for recursion
|
||||
var recursionMarker = this.makeRecursionMarker();;
|
||||
var recursionMarker = this.makeRecursionMarker();
|
||||
if(this.parentWidget && this.parentWidget.hasVariable("transclusion",recursionMarker)) {
|
||||
this.makeChildWidgets([{type: "text", text: "Recursive transclusion error in transclude widget"}]);
|
||||
return;
|
||||
|
||||
@@ -55,15 +55,19 @@ exports.getTextReference = function(textRef,defaultText,currTiddlerTitle) {
|
||||
exports.setTextReference = function(textRef,value,currTiddlerTitle) {
|
||||
var tr = $tw.utils.parseTextReference(textRef),
|
||||
title = tr.title || currTiddlerTitle;
|
||||
this.setText(title,tr.field,tr.index,value);
|
||||
};
|
||||
|
||||
exports.setText = function(title,field,index,value) {
|
||||
// Check if it is a reference to a tiddler field
|
||||
if(tr.index) {
|
||||
if(index) {
|
||||
var data = this.getTiddlerData(title,Object.create(null));
|
||||
data[tr.index] = value;
|
||||
data[index] = value;
|
||||
this.setTiddlerData(title,data,this.getModificationFields());
|
||||
} else {
|
||||
var tiddler = this.getTiddler(title),
|
||||
fields = {title: title};
|
||||
fields[tr.field || "text"] = value;
|
||||
fields[field || "text"] = value;
|
||||
this.addTiddler(new $tw.Tiddler(tiddler,fields,this.getModificationFields()));
|
||||
}
|
||||
};
|
||||
@@ -476,13 +480,14 @@ exports.getTagMap = function() {
|
||||
};
|
||||
|
||||
/*
|
||||
Lookup a given tiddler and return a list of all the tiddlers that include it in their list
|
||||
Lookup a given tiddler and return a list of all the tiddlers that include it in the specified list field
|
||||
*/
|
||||
exports.findListingsOfTiddler = function(targetTitle) {
|
||||
// Get the list associated with the tag
|
||||
exports.findListingsOfTiddler = function(targetTitle,fieldName) {
|
||||
fieldName = fieldName || "list";
|
||||
var titles = [];
|
||||
this.each(function(tiddler,title) {
|
||||
if($tw.utils.isArray(tiddler.fields.list) && tiddler.fields.list.indexOf(targetTitle) !== -1) {
|
||||
var list = $tw.utils.parseStringArray(tiddler.fields[fieldName]);
|
||||
if(list && list.indexOf(targetTitle) !== -1) {
|
||||
titles.push(title);
|
||||
}
|
||||
});
|
||||
@@ -707,6 +712,7 @@ Parse a block of text of a specified MIME type
|
||||
options: see below
|
||||
Options include:
|
||||
parseAsInline: if true, the text of the tiddler will be parsed as an inline run
|
||||
_canonical_uri: optional string of the canonical URI of this content
|
||||
*/
|
||||
exports.old_parseText = function(type,text,options) {
|
||||
options = options || {};
|
||||
@@ -724,7 +730,8 @@ exports.old_parseText = function(type,text,options) {
|
||||
// Return the parser instance
|
||||
return new Parser(type,text,{
|
||||
parseAsInline: options.parseAsInline,
|
||||
wiki: this
|
||||
wiki: this,
|
||||
_canonical_uri: options._canonical_uri
|
||||
});
|
||||
};
|
||||
|
||||
@@ -732,11 +739,14 @@ exports.old_parseText = function(type,text,options) {
|
||||
Parse a tiddler according to its MIME type
|
||||
*/
|
||||
exports.old_parseTiddler = function(title,options) {
|
||||
options = options || {};
|
||||
options = $tw.utils.extend({},options);
|
||||
var cacheType = options.parseAsInline ? "newInlineParseTree" : "newBlockParseTree",
|
||||
tiddler = this.getTiddler(title),
|
||||
self = this;
|
||||
return tiddler ? this.getCacheForTiddler(title,cacheType,function() {
|
||||
if(tiddler.hasField("_canonical_uri")) {
|
||||
options._canonical_uri = tiddler.fields._canonical_uri;
|
||||
}
|
||||
return self.old_parseText(tiddler.fields.type,tiddler.fields.text,options);
|
||||
}) : null;
|
||||
};
|
||||
@@ -1075,27 +1085,16 @@ exports.readFile = function(file,callback) {
|
||||
Check whether the specified draft tiddler has been modified
|
||||
*/
|
||||
exports.isDraftModified = function(title) {
|
||||
var tiddler = this.getTiddler(title);
|
||||
var tiddler = this.getTiddler(title);
|
||||
if(!tiddler.isDraft()) {
|
||||
return false;
|
||||
}
|
||||
var ignoredFields = ["created", "modified", "title", "draft.title", "draft.of", "tags"],
|
||||
var ignoredFields = ["created", "modified", "title", "draft.title", "draft.of"],
|
||||
origTiddler = this.getTiddler(tiddler.fields["draft.of"]);
|
||||
if(!origTiddler) {
|
||||
return true;
|
||||
}
|
||||
if(tiddler.fields["draft.title"] !== tiddler.fields["draft.of"]) {
|
||||
return true;
|
||||
}
|
||||
if(!$tw.utils.isArrayEqual(tiddler.fields.tags,origTiddler.fields.tags)) {
|
||||
return true;
|
||||
}
|
||||
return !Object.keys(tiddler.fields).every(function(field) {
|
||||
if(ignoredFields.indexOf(field) >= 0) {
|
||||
return true;
|
||||
}
|
||||
return tiddler.fields[field] === origTiddler.fields[field];
|
||||
});
|
||||
return !tiddler.isEqual(origTiddler,ignoredFields);
|
||||
};
|
||||
|
||||
/*
|
||||
|
||||
104
core/palettes/BrightMute.tid
Normal file
104
core/palettes/BrightMute.tid
Normal file
@@ -0,0 +1,104 @@
|
||||
title: $:/palettes/Muted
|
||||
name: Muted
|
||||
description: Bright tiddlers on a muted background
|
||||
tags: $:/tags/Palette
|
||||
type: application/x-tiddler-dictionary
|
||||
|
||||
alert-background: #ffe476
|
||||
alert-border: #b99e2f
|
||||
alert-highlight: #881122
|
||||
alert-muted-foreground: #b99e2f
|
||||
background: #ffffff
|
||||
blockquote-bar: <<colour muted-foreground>>
|
||||
code-background: #f7f7f9
|
||||
code-border: #e1e1e8
|
||||
code-foreground: #dd1144
|
||||
download-background: #34c734
|
||||
download-foreground: <<colour background>>
|
||||
dragger-background: <<colour foreground>>
|
||||
dragger-foreground: <<colour background>>
|
||||
dropdown-background: <<colour background>>
|
||||
dropdown-border: <<colour muted-foreground>>
|
||||
dropdown-tab-background-selected: #fff
|
||||
dropdown-tab-background: #ececec
|
||||
dropzone-background: rgba(0,200,0,0.7)
|
||||
external-link-background-hover:
|
||||
external-link-background-visited:
|
||||
external-link-background:
|
||||
external-link-foreground-hover:
|
||||
external-link-foreground-visited: #0000aa
|
||||
external-link-foreground: #0000ee
|
||||
foreground: #333333
|
||||
message-background: #ecf2ff
|
||||
message-border: #cfd6e6
|
||||
message-foreground: #547599
|
||||
modal-backdrop: <<colour foreground>>
|
||||
modal-background: <<colour background>>
|
||||
modal-border: #999999
|
||||
modal-footer-background: #f5f5f5
|
||||
modal-footer-border: #dddddd
|
||||
modal-header-border: #eeeeee
|
||||
muted-foreground: #bbb
|
||||
notification-background: #ffffdd
|
||||
notification-border: #999999
|
||||
page-background: #6f6f70
|
||||
pre-background: #f5f5f5
|
||||
pre-border: #cccccc
|
||||
primary: #29a6ee
|
||||
sidebar-button-foreground: <<colour foreground>>
|
||||
sidebar-controls-foreground-hover: #000000
|
||||
sidebar-controls-foreground: #c2c1c2
|
||||
sidebar-foreground-shadow: rgba(255,255,255,0)
|
||||
sidebar-foreground: #d3d2d4
|
||||
sidebar-muted-foreground-hover: #444444
|
||||
sidebar-muted-foreground: #c0c0c0
|
||||
sidebar-tab-background-selected: #6f6f70
|
||||
sidebar-tab-background: #666667
|
||||
sidebar-tab-border-selected: #999
|
||||
sidebar-tab-border: #515151
|
||||
sidebar-tab-divider: #999
|
||||
sidebar-tab-foreground-selected:
|
||||
sidebar-tab-foreground: #999
|
||||
sidebar-tiddler-link-foreground-hover: #444444
|
||||
sidebar-tiddler-link-foreground: #d1d0d2
|
||||
static-alert-foreground: #aaaaaa
|
||||
tab-background-selected: #ffffff
|
||||
tab-background: #d8d8d8
|
||||
tab-border-selected: #d8d8d8
|
||||
tab-border: #cccccc
|
||||
tab-divider: #d8d8d8
|
||||
tab-foreground-selected: <<colour tab-foreground>>
|
||||
tab-foreground: #666666
|
||||
table-border: #dddddd
|
||||
table-footer-background: #a8a8a8
|
||||
table-header-background: #f0f0f0
|
||||
tag-background: #d5ad34
|
||||
tag-foreground: #ffffff
|
||||
tiddler-background: <<colour background>>
|
||||
tiddler-border: <<colour background>>
|
||||
tiddler-controls-foreground-hover: #888888
|
||||
tiddler-controls-foreground-selected: #444444
|
||||
tiddler-controls-foreground: #cccccc
|
||||
tiddler-editor-background: #f8f8f8
|
||||
tiddler-editor-border-image: #ffffff
|
||||
tiddler-editor-border: #cccccc
|
||||
tiddler-editor-fields-even: #e0e8e0
|
||||
tiddler-editor-fields-odd: #f0f4f0
|
||||
tiddler-info-background: #f8f8f8
|
||||
tiddler-info-border: #dddddd
|
||||
tiddler-info-tab-background: #f8f8f8
|
||||
tiddler-link-background: <<colour background>>
|
||||
tiddler-link-foreground: <<colour primary>>
|
||||
tiddler-subtitle-foreground: #c0c0c0
|
||||
tiddler-title-foreground: #182955
|
||||
toolbar-new-button:
|
||||
toolbar-options-button:
|
||||
toolbar-save-button:
|
||||
toolbar-info-button:
|
||||
toolbar-edit-button:
|
||||
toolbar-close-button:
|
||||
toolbar-delete-button:
|
||||
toolbar-cancel-button:
|
||||
toolbar-done-button:
|
||||
untagged-background: #999999
|
||||
very-muted-foreground: #888888
|
||||
10
core/templates/canonical-uri-external-image.tid
Normal file
10
core/templates/canonical-uri-external-image.tid
Normal file
@@ -0,0 +1,10 @@
|
||||
title: $:/core/templates/canonical-uri-external-image
|
||||
|
||||
<!--
|
||||
|
||||
This template is used to assign the ''_canonical_uri'' field to external images.
|
||||
|
||||
Change the `./images/` part to a different base URI. The URI can be relative or absolute.
|
||||
|
||||
-->
|
||||
./images/<$view field="title" format="doubleurlencoded"/>
|
||||
@@ -1,6 +1,6 @@
|
||||
title: $:/core/save/all
|
||||
|
||||
\define saveTiddlerFilter()
|
||||
[is[tiddler]] -[[$:/boot/boot.css]] -[type[application/javascript]library[yes]] -[[$:/boot/boot.js]] -[[$:/boot/bootprefix.js]] +[sort[title]]
|
||||
[is[tiddler]] -[prefix[$:/state/popup/]] -[[$:/boot/boot.css]] -[type[application/javascript]library[yes]] -[[$:/boot/boot.js]] -[[$:/boot/bootprefix.js]] +[sort[title]]
|
||||
\end
|
||||
{{$:/core/templates/tiddlywiki5.html}}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
title: $:/core/save/empty
|
||||
|
||||
\define saveTiddlerFilter()
|
||||
[is[system]] -[[$:/boot/boot.css]] -[type[application/javascript]library[yes]] -[[$:/boot/boot.js]] -[[$:/boot/bootprefix.js]] +[sort[title]]
|
||||
[is[system]] -[prefix[$:/state/popup/]] -[[$:/boot/boot.css]] -[type[application/javascript]library[yes]] -[[$:/boot/boot.js]] -[[$:/boot/bootprefix.js]] +[sort[title]]
|
||||
\end
|
||||
{{$:/core/templates/tiddlywiki5.html}}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
title: $:/core/save/lazy-images
|
||||
|
||||
\define saveTiddlerFilter()
|
||||
[is[tiddler]] -[[$:/boot/boot.css]] -[type[application/javascript]library[yes]] -[[$:/boot/boot.js]] -[[$:/boot/bootprefix.js]] -[!is[system]is[image]] +[sort[title]]
|
||||
[is[tiddler]] -[prefix[$:/state/popup/]] -[[$:/boot/boot.css]] -[type[application/javascript]library[yes]] -[[$:/boot/boot.js]] -[[$:/boot/bootprefix.js]] -[!is[system]is[image]] +[sort[title]]
|
||||
\end
|
||||
{{$:/core/templates/tiddlywiki5.html}}
|
||||
|
||||
@@ -21,6 +21,6 @@ type: text/vnd.tiddlywiki-html
|
||||
</head>
|
||||
<body class="tw-body">
|
||||
{{$:/StaticBanner||$:/core/templates/html-tiddler}}
|
||||
{{$:/core/ui/PageMacros||$:/core/templates/html-tiddler}}
|
||||
{{$:/core/ui/PageTemplate||$:/core/templates/html-tiddler}}
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -15,7 +15,9 @@ title: $:/core/templates/static.tiddler.html
|
||||
<body class="tw-body">
|
||||
`{{$:/StaticBanner||$:/core/templates/html-tiddler}}`
|
||||
<section class="story-river">
|
||||
`<$view tiddler="$:/core/ui/ViewTemplate" format="htmlwikified"/>`
|
||||
`<$importvariables filter="[[$:/core/ui/PageMacros]] [all[shadows+tiddlers]tag[$:/tags/Macro]!has[draft.of]]">
|
||||
<$view tiddler="$:/core/ui/ViewTemplate" format="htmlwikified"/>
|
||||
</$importvariables>`
|
||||
</section>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -19,7 +19,7 @@ title: $:/core/templates/tiddlywiki5.html
|
||||
<!--~~ 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}}}
|
||||
{{{ [all[shadows+tiddlers]tag[$:/core/wiki/rawmarkup]] [all[shadows+tiddlers]tag[$:/tags/RawMarkup]] ||$:/core/templates/plain-text-tiddler}}}
|
||||
</head>
|
||||
<body class="tw-body">
|
||||
<!--~~ Static styles ~~-->
|
||||
|
||||
30
core/ui/ControlPanel/Advanced/EditorTypes.tid
Normal file
30
core/ui/ControlPanel/Advanced/EditorTypes.tid
Normal file
@@ -0,0 +1,30 @@
|
||||
title: $:/core/ui/ControlPanel/Advanced/EditorTypes
|
||||
tags: $:/tags/ControlPanel/Advanced
|
||||
caption: {{$:/language/ControlPanel/Advanced/EditorTypes/Caption}}
|
||||
|
||||
\define lingo-base() $:/language/ControlPanel/Advanced/EditorTypes/
|
||||
|
||||
<<lingo Hint>>
|
||||
|
||||
<table>
|
||||
<tbody>
|
||||
<tr>
|
||||
<th><<lingo Type/Caption>></th>
|
||||
<th><<lingo Editor/Caption>></th>
|
||||
</tr>
|
||||
<$list filter="[all[shadows+tiddlers]prefix[$:/config/EditorTypeMappings/]sort[title]]">
|
||||
<tr>
|
||||
<td>
|
||||
<$link>
|
||||
<$list filter="[all[current]removeprefix[$:/config/EditorTypeMappings/]]">
|
||||
<$text text={{!!title}}/>
|
||||
</$list>
|
||||
</$link>
|
||||
</td>
|
||||
<td>
|
||||
<$view field="text"/>
|
||||
</td>
|
||||
</tr>
|
||||
</$list>
|
||||
</tbody>
|
||||
</table>
|
||||
@@ -3,28 +3,11 @@ tags: $:/tags/ControlPanel/Advanced/Settings
|
||||
caption: {{$:/language/ControlPanel/Advanced/Settings/NavigationAddressBar/Caption}}
|
||||
|
||||
\define lingo-base() $:/language/ControlPanel/Advanced/Settings/NavigationAddressBar/
|
||||
<<lingo Hint>>
|
||||
<$button popup=<<qualify "$:/state/navaddressbarpopup">> class="btn-invisible btn-dropdown">
|
||||
<$view tiddler="$:/config/Navigation/UpdateAddressBar" field="text"/>:
|
||||
<$reveal state="$:/config/Navigation/UpdateAddressBar" type="match" text="no">
|
||||
''<<lingo No/Description>>''
|
||||
</$reveal>
|
||||
<$reveal state="$:/config/Navigation/UpdateAddressBar" type="match" text="permalink">
|
||||
''<<lingo Permalink/Description>>''
|
||||
</$reveal>
|
||||
<$reveal state="$:/config/Navigation/UpdateAddressBar" type="match" text="permaview">
|
||||
''<<lingo Permaview/Description>>''
|
||||
</$reveal>
|
||||
{{$:/core/images/down-arrow}}
|
||||
</$button>
|
||||
<$reveal state=<<qualify "$:/state/navaddressbarpopup">> type="popup" position="below" animate="yes" default="">
|
||||
<$linkcatcher to="$:/config/Navigation/UpdateAddressBar">
|
||||
<div class="tw-drop-down tw-edit-type-dropdown">
|
||||
<$list filter="no permalink permaview">
|
||||
<$link to={{!!title}}>
|
||||
<$view field="title"/>
|
||||
</$link>
|
||||
</$list>
|
||||
</div>
|
||||
</$linkcatcher>
|
||||
</$reveal>
|
||||
|
||||
<$link to="$:/config/Navigation/UpdateAddressBar"><<lingo Hint>></$link>
|
||||
|
||||
<$radio tiddler="$:/config/Navigation/UpdateAddressBar" value="permaview"> <<lingo Permaview/Description>> </$radio>
|
||||
|
||||
<$radio tiddler="$:/config/Navigation/UpdateAddressBar" value="permalink"> <<lingo Permalink/Description>> </$radio>
|
||||
|
||||
<$radio tiddler="$:/config/Navigation/UpdateAddressBar" value="no"> <<lingo No/Description>> </$radio>
|
||||
|
||||
@@ -3,25 +3,8 @@ tags: $:/tags/ControlPanel/Advanced/Settings
|
||||
caption: {{$:/language/ControlPanel/Advanced/Settings/NavigationHistory/Caption}}
|
||||
|
||||
\define lingo-base() $:/language/ControlPanel/Advanced/Settings/NavigationHistory/
|
||||
<<lingo Hint>>
|
||||
<$button popup=<<qualify "$:/state/navhistorypopup">> class="btn-invisible btn-dropdown">
|
||||
<$view tiddler="$:/config/Navigation/UpdateHistory" field="text"/>:
|
||||
<$reveal state="$:/config/Navigation/UpdateHistory" type="match" text="no">
|
||||
''<<lingo No/Description>>''
|
||||
</$reveal>
|
||||
<$reveal state="$:/config/Navigation/UpdateHistory" type="match" text="yes">
|
||||
''<<lingo Yes/Description>>''
|
||||
</$reveal>
|
||||
{{$:/core/images/down-arrow}}
|
||||
</$button>
|
||||
<$reveal state=<<qualify "$:/state/navhistorypopup">> type="popup" position="below" animate="yes" default="">
|
||||
<$linkcatcher to="$:/config/Navigation/UpdateHistory">
|
||||
<div class="tw-drop-down tw-edit-type-dropdown">
|
||||
<$list filter="no yes">
|
||||
<$link to={{!!title}}>
|
||||
<$view field="title"/>
|
||||
</$link>
|
||||
</$list>
|
||||
</div>
|
||||
</$linkcatcher>
|
||||
</$reveal>
|
||||
<$link to="$:/config/Navigation/UpdateHistory"><<lingo Hint>></$link>
|
||||
|
||||
<$radio tiddler="$:/config/Navigation/UpdateHistory" value="yes"> <<lingo Yes/Description>> </$radio>
|
||||
|
||||
<$radio tiddler="$:/config/Navigation/UpdateHistory" value="no"> <<lingo No/Description>> </$radio>
|
||||
|
||||
@@ -5,10 +5,12 @@ tw-tiddler-frame tw-tiddler-edit-frame $(missingTiddlerClass)$ $(shadowTiddlerCl
|
||||
\end
|
||||
<div class=<<frame-classes>>>
|
||||
<$set name="storyTiddler" value=<<currentTiddler>>>
|
||||
<$keyboard key="escape" message="tw-cancel-tiddler">
|
||||
<$keyboard key="ctrl+enter" message="tw-save-tiddler">
|
||||
<$list filter="[all[shadows+tiddlers]tag[$:/tags/EditTemplate]!has[draft.of]]" variable="listItem">
|
||||
<$transclude tiddler=<<listItem>>/>
|
||||
</$list>
|
||||
</$keyboard>
|
||||
</$keyboard>
|
||||
</$set>
|
||||
</div>
|
||||
|
||||
@@ -1,10 +1,26 @@
|
||||
title: $:/core/ui/EditTemplate/body
|
||||
tags: $:/tags/EditTemplate
|
||||
|
||||
\define lingo-base() $:/language/EditTemplate/
|
||||
\define lingo-base() $:/language/EditTemplate/Body/
|
||||
<$list filter="[is[current]has[_canonical_uri]]">
|
||||
|
||||
<div class="tw-message-box">
|
||||
|
||||
<<lingo External/Hint>>
|
||||
|
||||
<a href={{!!_canonical_uri}}><$text text={{!!_canonical_uri}}/></a>
|
||||
|
||||
<$edit-text field="_canonical_uri" class="tw-edit-fields"></$edit-text>
|
||||
|
||||
</div>
|
||||
|
||||
</$list>
|
||||
|
||||
<$list filter="[is[current]!has[_canonical_uri]]">
|
||||
|
||||
<$reveal state="$:/state/showeditpreview" type="match" text="yes">
|
||||
|
||||
<em class="tw-edit"><<lingo Body/Hint>></em> <$button type="set" set="$:/state/showeditpreview" setTo="no"><<lingo Body/Preview/Button/Hide>></$button>
|
||||
<em class="tw-edit"><<lingo Hint>></em> <$button type="set" set="$:/state/showeditpreview" setTo="no"><<lingo Preview/Button/Hide>></$button>
|
||||
|
||||
<div class="tw-tiddler-preview">
|
||||
<div class="tw-tiddler-preview-preview">
|
||||
@@ -24,7 +40,9 @@ tags: $:/tags/EditTemplate
|
||||
|
||||
<$reveal state="$:/state/showeditpreview" type="nomatch" text="yes">
|
||||
|
||||
<em class="tw-edit"><<lingo Body/Hint>></em> <$button type="set" set="$:/state/showeditpreview" setTo="yes"><<lingo Body/Preview/Button/Show>></$button>
|
||||
<em class="tw-edit"><<lingo Hint>></em> <$button type="set" set="$:/state/showeditpreview" setTo="yes"><<lingo Preview/Button/Show>></$button>
|
||||
<$edit field="text" class="tw-edit-texteditor" placeholder={{$:/language/EditTemplate/Body/Placeholder}}/>
|
||||
|
||||
</$reveal>
|
||||
|
||||
</$list>
|
||||
|
||||
@@ -15,8 +15,8 @@ background-color:$(backgroundColor)$;
|
||||
|
||||
<div class="tw-edit-add-tag">
|
||||
<span class="tw-add-tag-name">
|
||||
<$edit-text tiddler="$:/temp/NewTagName" tag="input" default="" placeholder={{$:/language/EditTemplate/Tags/Add/Placeholder}} focusPopup=<<qualify "$:/state/tagsAutoComplete">> class="tw-edit-texteditor"/>
|
||||
</span> <$button popup=<<qualify "$:/state/tagsAutoComplete">> class="btn-invisible btn-dropdown">{{$:/core/images/down-arrow}}</$button> <span class="tw-add-tag-button">
|
||||
<$edit-text tiddler="$:/temp/NewTagName" tag="input" default="" placeholder={{$:/language/EditTemplate/Tags/Add/Placeholder}} focusPopup=<<qualify "$:/state/popup/tags-auto-complete">> class="tw-edit-texteditor"/>
|
||||
</span> <$button popup=<<qualify "$:/state/popup/tags-auto-complete">> class="btn-invisible btn-dropdown">{{$:/core/images/down-arrow}}</$button> <span class="tw-add-tag-button">
|
||||
<$button message="tw-add-tag" param={{$:/temp/NewTagName}} set="$:/temp/NewTagName" setTo="" class="">
|
||||
<<lingo Tags/Add/Button>>
|
||||
</$button>
|
||||
@@ -25,7 +25,7 @@ background-color:$(backgroundColor)$;
|
||||
|
||||
<div class="tw-block-dropdown-wrapper">
|
||||
|
||||
<$reveal state=<<qualify "$:/state/tagsAutoComplete">> type="nomatch" text="" default="">
|
||||
<$reveal state=<<qualify "$:/state/popup/tags-auto-complete">> type="nomatch" text="" default="">
|
||||
|
||||
<div class="tw-block-dropdown">
|
||||
|
||||
|
||||
@@ -2,13 +2,18 @@ title: $:/core/ui/EditTemplate/type
|
||||
tags: $:/tags/EditTemplate
|
||||
|
||||
\define lingo-base() $:/language/EditTemplate/
|
||||
<p><$fieldmangler><em class="tw-edit"><<lingo Type/Prompt>></em> <$edit-text field="type" tag="input" default="" placeholder={{$:/language/EditTemplate/Type/Placeholder}} focusPopup=<<qualify "$:/state/typeDropdown">> class="tw-edit-typeeditor"/> <$button popup=<<qualify "$:/state/typeDropdown">> class="btn-invisible btn-dropdown">{{$:/core/images/down-arrow}}</$button> <$button message="tw-remove-field" param="type" class="btn-invisible btn-icon">{{$:/core/images/delete-button}}</$button></$fieldmangler></p>
|
||||
<p><$fieldmangler><em class="tw-edit"><<lingo Type/Prompt>></em> <$edit-text field="type" tag="input" default="" placeholder={{$:/language/EditTemplate/Type/Placeholder}} focusPopup=<<qualify "$:/state/popup/type-dropdown">> class="tw-edit-typeeditor"/> <$button popup=<<qualify "$:/state/popup/type-dropdown">> class="btn-invisible btn-dropdown">{{$:/core/images/down-arrow}}</$button> <$button message="tw-remove-field" param="type" class="btn-invisible btn-icon">{{$:/core/images/delete-button}}</$button></$fieldmangler></p>
|
||||
|
||||
<div class="tw-block-dropdown-wrapper">
|
||||
<$reveal state=<<qualify "$:/state/typeDropdown">> type="nomatch" text="" default="">
|
||||
<$reveal state=<<qualify "$:/state/popup/type-dropdown">> type="nomatch" text="" default="">
|
||||
<div class="tw-block-dropdown tw-edit-type-dropdown">
|
||||
<$linkcatcher to="!!type">
|
||||
<$list filter="[all[shadows+tiddlers]prefix[$:/language/Docs/Types/]] +[sort[description]]"><$link to={{!!name}}><$view field="description"/> (<$view field="name"/>)</$link>
|
||||
<$list filter='[all[shadows+tiddlers]prefix[$:/language/Docs/Types/]each[group]sort[group]]'>
|
||||
<div class="tw-dropdown-item">
|
||||
<$text text={{!!group}}/>
|
||||
</div>
|
||||
<$list filter="[all[shadows+tiddlers]prefix[$:/language/Docs/Types/]group{!!group}] +[sort[description]]"><$link to={{!!name}}><$view field="description"/> (<$view field="name"/>)</$link>
|
||||
</$list>
|
||||
</$list>
|
||||
</$linkcatcher>
|
||||
</div>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
title: $:/core/ui/EditToolbar/cancel
|
||||
tags: $:/tags/EditToolbar
|
||||
|
||||
<$button message="tw-cancel-tiddler" class="btn-invisible">{{$:/core/images/cancel-button}}</$button>
|
||||
<$button message="tw-cancel-tiddler" title={{$:/language/Buttons/Cancel/Hint}} aria-label={{$:/language/Buttons/Cancel/Caption}} class="btn-invisible">{{$:/core/images/cancel-button}}</$button>
|
||||
@@ -1,4 +1,4 @@
|
||||
title: $:/core/ui/EditToolbar/delete
|
||||
tags: $:/tags/EditToolbar
|
||||
|
||||
<$button message="tw-delete-tiddler" class="btn-invisible">{{$:/core/images/delete-button}}</$button>
|
||||
<$button message="tw-delete-tiddler" title={{$:/language/Buttons/Delete/Hint}} aria-label={{$:/language/Buttons/Delete/Caption}} class="btn-invisible">{{$:/core/images/delete-button}}</$button>
|
||||
@@ -1,4 +1,4 @@
|
||||
title: $:/core/ui/EditToolbar/save
|
||||
tags: $:/tags/EditToolbar
|
||||
|
||||
<$button message="tw-save-tiddler" class="btn-invisible">{{$:/core/images/done-button}}</$button>
|
||||
<$button message="tw-save-tiddler" title={{$:/language/Buttons/Save/Hint}} aria-label={{$:/language/Buttons/Save/Caption}} class="btn-invisible">{{$:/core/images/done-button}}</$button>
|
||||
@@ -1,10 +1,10 @@
|
||||
title: $:/core/ui/MissingTemplate
|
||||
|
||||
<div class="tw-tiddler-missing">
|
||||
<$button popup=<<qualify "$:/state/missingpopup">> class="btn-invisible tw-missing-tiddler-label">
|
||||
<$button popup=<<qualify "$:/state/popup/missing">> class="btn-invisible tw-missing-tiddler-label">
|
||||
<$view field="title" format="text" />
|
||||
</$button>
|
||||
<$reveal state=<<qualify "$:/state/missingpopup">> type="popup" position="below" animate="yes">
|
||||
<$reveal state=<<qualify "$:/state/popup/missing">> type="popup" position="below" animate="yes">
|
||||
<div class="tw-drop-down">
|
||||
<$transclude tiddler="$:/core/ui/ListItemTemplate"/>
|
||||
<hr>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
title: $:/core/ui/PageControls/control-panel
|
||||
tags: $:/tags/PageControls
|
||||
|
||||
<$button to="$:/ControlPanel" class="btn-invisible">{{$:/core/images/options-button}}</$button>
|
||||
<$button to="$:/ControlPanel" title={{$:/language/Buttons/ControlPanel/Hint}} aria-label={{$:/language/Buttons/ControlPanel/Caption}} class="btn-invisible">{{$:/core/images/options-button}}</$button>
|
||||
@@ -1,4 +1,4 @@
|
||||
title: $:/core/ui/PageControls/new-tiddler
|
||||
tags: $:/tags/PageControls
|
||||
|
||||
<$button message="tw-new-tiddler" class="btn-invisible">{{$:/core/images/new-button}}</$button>
|
||||
<$button message="tw-new-tiddler" title={{$:/language/Buttons/NewTiddler/Hint}} aria-label={{$:/language/Buttons/NewTiddler/Caption}} class="btn-invisible">{{$:/core/images/new-button}}</$button>
|
||||
@@ -1,4 +1,4 @@
|
||||
title: $:/core/ui/PageControls/save-wiki
|
||||
tags: $:/tags/PageControls
|
||||
|
||||
<$button message="tw-save-wiki" class="btn-invisible">{{$:/core/images/save-button}}</$button>
|
||||
<$button message="tw-save-wiki" title={{$:/language/Buttons/SaveWiki/Hint}} aria-label={{$:/language/Buttons/SaveWiki/Caption}} class="btn-invisible">{{$:/core/images/save-button}}</$button>
|
||||
@@ -1,66 +0,0 @@
|
||||
title: $:/core/ui/PageMacros
|
||||
|
||||
\define colour(name)
|
||||
<$transclude tiddler={{$:/palette}} index="$name$"/>
|
||||
\end
|
||||
|
||||
\define color(name)
|
||||
<<colour $name$>>
|
||||
\end
|
||||
|
||||
\define tabs(tabsList,default,state:"$:/state/tab",class)
|
||||
<div class="tw-tab-set $class$">
|
||||
<div class="tw-tab-buttons $class$">
|
||||
<$list filter="$tabsList$" variable="currentTab">
|
||||
<$button set=<<qualify "$state$">> setTo=<<currentTab>> default="$default$" selectedClass="tw-tab-selected">
|
||||
<$transclude tiddler=<<currentTab>> field="caption">
|
||||
<$macrocall $name="currentTab" $type="text/plain" $output="text/plain"/>
|
||||
</$transclude>
|
||||
</$button>
|
||||
</$list>
|
||||
</div><div class="tw-tab-divider $class$"/><div class="tw-tab-content $class$">
|
||||
<$list filter="$tabsList$" variable="currentTab">
|
||||
<$reveal type="match" state=<<qualify "$state$">> text=<<currentTab>> default="$default$">
|
||||
<$transclude tiddler=<<currentTab>> mode="block"/>
|
||||
</$reveal>
|
||||
</$list>
|
||||
</div>
|
||||
</div>
|
||||
\end
|
||||
|
||||
\define wikitext-example(src)
|
||||
```
|
||||
$src$
|
||||
```
|
||||
|
||||
Renders as:
|
||||
|
||||
$src$
|
||||
|
||||
In HTML:
|
||||
|
||||
$$$text/vnd.tiddlywiki>text/html
|
||||
$src$
|
||||
$$$
|
||||
|
||||
\end
|
||||
|
||||
\define wikitext-example-without-html(src)
|
||||
```
|
||||
$src$
|
||||
```
|
||||
|
||||
Renders as:
|
||||
|
||||
$src$
|
||||
|
||||
\end
|
||||
|
||||
\define lingo-base()
|
||||
$:/lingo/
|
||||
\end
|
||||
|
||||
\define lingo(title)
|
||||
{{$(lingo-base)$$title$}}
|
||||
\end
|
||||
{{$:/core/ui/PageTemplate}}
|
||||
@@ -4,12 +4,16 @@ title: $:/core/ui/PageTemplate
|
||||
tw-page-container tw-page-view-$(themeTitle)$ tw-language-$(languageTitle)$
|
||||
\end
|
||||
|
||||
<$importvariables filter="[[$:/core/ui/PageMacros]] [all[shadows+tiddlers]tag[$:/tags/Macro]!has[draft.of]]">
|
||||
|
||||
<$set name="themeTitle" value={{$:/view}}>
|
||||
|
||||
<$set name="currentTiddler" value={{$:/language}}>
|
||||
|
||||
<$set name="languageTitle" value={{!!name}}>
|
||||
|
||||
<$set name="currentTiddler" value="">
|
||||
|
||||
<div class=<<containerClasses>>>
|
||||
|
||||
<$navigator story="$:/StoryList" history="$:/HistoryList">
|
||||
@@ -33,3 +37,7 @@ tw-page-container tw-page-view-$(themeTitle)$ tw-language-$(languageTitle)$
|
||||
</$set>
|
||||
|
||||
</$set>
|
||||
|
||||
</$set>
|
||||
|
||||
</$importvariables>
|
||||
|
||||
@@ -7,11 +7,11 @@ tags: $:/tags/PageTemplate
|
||||
|
||||
<$reveal state="$:/state/sidebar" type="match" text="yes" default="yes" retain="yes">
|
||||
|
||||
<div class="tw-site-title">
|
||||
<h1 class="tw-site-title">
|
||||
|
||||
<$transclude tiddler="$:/SiteTitle" mode="inline"/>
|
||||
|
||||
</div>
|
||||
</h1>
|
||||
|
||||
<div class="tw-site-subtitle">
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ caption: {{$:/language/SideBar/Open/Caption}}
|
||||
\define lingo-base() $:/language/CloseAll/
|
||||
<$list filter="[list[$:/StoryList]]" history="$:/HistoryList" storyview="pop">
|
||||
|
||||
<$button message="tw-close-tiddler" class="btn-invisible btn-mini">×</$button> <$link to={{!!title}}><$view field="title"/></$link>
|
||||
<$button message="tw-close-tiddler" title={{$:/language/Buttons/Close/Hint}} aria-label={{$:/language/Buttons/Close/Caption}} class="btn-invisible btn-mini">×</$button> <$link to={{!!title}}><$view field="title"/></$link>
|
||||
|
||||
</$list>
|
||||
|
||||
|
||||
@@ -1,23 +1,34 @@
|
||||
title: $:/core/ui/SideBarLists
|
||||
|
||||
<div class="tw-sidebar-lists">
|
||||
<div class="tw-search">
|
||||
<$edit-text tiddler="$:/temp/search" type="search" tag="input"/>
|
||||
<$reveal state="$:/temp/search" type="nomatch" text="">
|
||||
<$linkcatcher to="$:/temp/search">
|
||||
<$link to="" class="btn-invisible">{{$:/core/images/close-button}}</$link>
|
||||
</$linkcatcher>
|
||||
</$reveal>
|
||||
<$reveal state="$:/temp/search" type="match" text=""> <$link to="$:/AdvancedSearch" class="btn-invisible">…</$link>
|
||||
</$reveal>
|
||||
</div>
|
||||
<$reveal state="$:/temp/search" type="nomatch" text="">
|
||||
<div class="tw-search-results">
|
||||
{{$:/language/Search/Matches}}
|
||||
<$list filter="[!is[system]search{$:/temp/search}sort[title]limit[250]]" template="$:/core/ui/ListItemTemplate"/>
|
||||
</div>
|
||||
</$reveal>
|
||||
<$reveal state="$:/temp/search" type="match" text="">
|
||||
<<tabs "[all[shadows+tiddlers]tag[$:/tags/SideBar]!has[draft.of]]" "$:/core/ui/SideBar/Open" "$:/state/tab/sidebar">>
|
||||
</$reveal>
|
||||
|
||||
<div class="tw-search">
|
||||
<$edit-text tiddler="$:/temp/search" type="search" tag="input"/>
|
||||
<$reveal state="$:/temp/search" type="nomatch" text="">
|
||||
<$linkcatcher to="$:/temp/search">
|
||||
<$link to="" class="btn-invisible">{{$:/core/images/close-button}}</$link>
|
||||
</$linkcatcher>
|
||||
</$reveal>
|
||||
<$reveal state="$:/temp/search" type="match" text=""> <$link to="$:/AdvancedSearch" tooltip={{$:/language/Buttons/AdvancedSearch/Hint}} aria-label={{$:/language/Buttons/AdvancedSearch/Caption}} class="btn-invisible">…</$link>
|
||||
</$reveal>
|
||||
</div>
|
||||
|
||||
<$reveal state="$:/temp/search" type="nomatch" text="">
|
||||
|
||||
<div class="tw-search-results">
|
||||
|
||||
{{$:/language/Search/Matches}}
|
||||
|
||||
<$list filter="[!is[system]search{$:/temp/search}sort[title]limit[250]]" template="$:/core/ui/ListItemTemplate"/>
|
||||
|
||||
</div>
|
||||
|
||||
</$reveal>
|
||||
|
||||
<$reveal state="$:/temp/search" type="match" text="">
|
||||
|
||||
<<tabs "[all[shadows+tiddlers]tag[$:/tags/SideBar]!has[draft.of]]" "$:/core/ui/SideBar/Open" "$:/state/tab/sidebar">>
|
||||
|
||||
</$reveal>
|
||||
|
||||
</div>
|
||||
|
||||
@@ -2,9 +2,9 @@ title: $:/TagManager
|
||||
|
||||
\define lingo-base() $:/language/TagManager/
|
||||
\define iconEditor(title)
|
||||
<$edit-text field="icon" tag="input" size="20"/> <$button popup=<<qualify "$:/state/iconDropdown/$title$">> class="btn-invisible btn-dropdown">{{$:/core/images/down-arrow}}</$button>
|
||||
<$edit-text field="icon" tag="input" size="20"/> <$button popup=<<qualify "$:/state/popup/icon/$title$">> class="btn-invisible btn-dropdown">{{$:/core/images/down-arrow}}</$button>
|
||||
<div class="tw-block-dropdown-wrapper">
|
||||
<$reveal state=<<qualify "$:/state/iconDropdown/$title$">> type="nomatch" text="" default="">
|
||||
<$reveal state=<<qualify "$:/state/popup/icon/$title$">> type="nomatch" text="" default="">
|
||||
<$linkcatcher to="$title$!!icon">
|
||||
<div class="tw-block-dropdown tw-edit-type-dropdown">
|
||||
<$list filter="[all[shadows+tiddlers]is[image]] [all[shadows+tiddlers]tag[$:/tags/Image]] +[sort[title]]">
|
||||
|
||||
@@ -5,11 +5,11 @@ background-color:$(backgroundColor)$;
|
||||
\end
|
||||
<span class="tw-tag-list-item">
|
||||
<$set name="backgroundColor" value={{!!color}}>
|
||||
<$button popup=<<qualify "$:/state/tagpopup">> class="btn-invisible tw-tag-label" style=<<tag-styles>>>
|
||||
<$button popup=<<qualify "$:/state/popup/tag">> class="btn-invisible tw-tag-label" style=<<tag-styles>>>
|
||||
<$transclude tiddler={{!!icon}}/> <$view field="title" format="text" />
|
||||
</$button>
|
||||
</$set>
|
||||
<$reveal state=<<qualify "$:/state/tagpopup">> type="popup" position="below" animate="yes"><div class="tw-drop-down"><$transclude tiddler="$:/core/ui/ListItemTemplate"/>
|
||||
<$reveal state=<<qualify "$:/state/popup/tag">> type="popup" position="below" animate="yes"><div class="tw-drop-down"><$transclude tiddler="$:/core/ui/ListItemTemplate"/>
|
||||
<hr>
|
||||
<$list filter="[all[current]tagging[]]" template="$:/core/ui/ListItemTemplate"/>
|
||||
</div>
|
||||
|
||||
@@ -2,8 +2,8 @@ title: $:/core/ui/TopBar/menu
|
||||
tags: $:/tags/TopRightBar
|
||||
|
||||
<$reveal state="$:/state/sidebar" type="nomatch" text="no">
|
||||
<$button set="$:/state/sidebar" setTo="no" class="btn-invisible">{{$:/core/images/chevron-right}}</$button>
|
||||
<$button set="$:/state/sidebar" setTo="no" title={{$:/language/Buttons/HideSideBar/Hint}} aria-label={{$:/language/Buttons/HideSideBar/Caption}} class="btn-invisible">{{$:/core/images/chevron-right}}</$button>
|
||||
</$reveal>
|
||||
<$reveal state="$:/state/sidebar" type="match" text="no">
|
||||
<$button set="$:/state/sidebar" setTo="yes" class="btn-invisible">{{$:/core/images/chevron-left}}</$button>
|
||||
<$button set="$:/state/sidebar" setTo="yes" title={{$:/language/Buttons/ShowSideBar/Hint}} aria-label={{$:/language/Buttons/ShowSideBar/Caption}} class="btn-invisible">{{$:/core/images/chevron-left}}</$button>
|
||||
</$reveal>
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
title: $:/core/ui/UntaggedTemplate
|
||||
|
||||
\define lingo-base() $:/language/SideBar/
|
||||
<$button popup=<<qualify "$:/state/tagpopup">> class="btn-invisible tw-untagged-label tw-tag-label">
|
||||
<$button popup=<<qualify "$:/state/popup/tag">> class="btn-invisible tw-untagged-label tw-tag-label">
|
||||
<<lingo Tags/Untagged/Caption>>
|
||||
</$button>
|
||||
<$reveal state=<<qualify "$:/state/tagpopup">> type="popup" position="below">
|
||||
<$reveal state=<<qualify "$:/state/popup/tag">> type="popup" position="below">
|
||||
<div class="tw-drop-down">
|
||||
<$list filter="[untagged[]!is[system]] -[tags[]] +[sort[title]]" template="$:/core/ui/ListItemTemplate"/>
|
||||
</div>
|
||||
|
||||
@@ -3,6 +3,6 @@ title: $:/core/ui/ViewTemplate
|
||||
\define frame-classes()
|
||||
tw-tiddler-frame tw-tiddler-view-frame $(missingTiddlerClass)$ $(shadowTiddlerClass)$ $(systemTiddlerClass)$
|
||||
\end
|
||||
<$set name="storyTiddler" value=<<currentTiddler>>><$set name="tiddlerInfoState" value=<<qualify "$:/state/tiddlerInfo">>><$tiddler tiddler=<<currentTiddler>>><div class=<<frame-classes>>><$list filter="[all[shadows+tiddlers]tag[$:/tags/ViewTemplate]!has[draft.of]]" variable="listItem"><$transclude tiddler=<<listItem>>/></$list>
|
||||
<$set name="storyTiddler" value=<<currentTiddler>>><$set name="tiddlerInfoState" value=<<qualify "$:/state/popup/tiddler-info">>><$tiddler tiddler=<<currentTiddler>>><div class=<<frame-classes>>><$list filter="[all[shadows+tiddlers]tag[$:/tags/ViewTemplate]!has[draft.of]]" variable="listItem"><$transclude tiddler=<<listItem>>/></$list>
|
||||
</div>
|
||||
</$tiddler></$set></$set>
|
||||
|
||||
@@ -5,7 +5,7 @@ tags: $:/tags/ViewTemplate
|
||||
fill:$(foregroundColor)$;
|
||||
\end
|
||||
<div class="tw-tiddler-title">
|
||||
<div class="titlebar">
|
||||
<h2 class="titlebar">
|
||||
<span class="tw-tiddler-controls">
|
||||
<$list filter="[all[shadows+tiddlers]tag[$:/tags/ViewToolbar]!has[draft.of]]" variable="listItem"><$transclude tiddler=<<listItem>>/></$list>
|
||||
</span>
|
||||
@@ -24,7 +24,7 @@ fill:$(foregroundColor)$;
|
||||
<$view field="title"/>
|
||||
</span>
|
||||
</$list>
|
||||
</div>
|
||||
</h2>
|
||||
|
||||
<$reveal type="nomatch" text="" default="" state=<<tiddlerInfoState>> class="tw-tiddler-info tw-popup" animate="yes" retain="yes">
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
title: $:/core/ui/ViewToolbar/close
|
||||
tags: $:/tags/ViewToolbar
|
||||
|
||||
<$button message="tw-close-tiddler" class="btn-invisible">{{$:/core/images/close-button}}</$button>
|
||||
<$button message="tw-close-tiddler" title={{$:/language/Buttons/Close/Hint}} aria-label={{$:/language/Buttons/Close/Caption}} class="btn-invisible">{{$:/core/images/close-button}}</$button>
|
||||
@@ -1,4 +1,4 @@
|
||||
title: $:/core/ui/ViewToolbar/edit
|
||||
tags: $:/tags/ViewToolbar
|
||||
|
||||
<$button message="tw-edit-tiddler" class="btn-invisible">{{$:/core/images/edit-button}}</$button>
|
||||
<$button message="tw-edit-tiddler" title={{$:/language/Buttons/Edit/Hint}} aria-label={{$:/language/Buttons/Edit/Caption}} class="btn-invisible">{{$:/core/images/edit-button}}</$button>
|
||||
@@ -1,4 +1,4 @@
|
||||
title: $:/core/ui/ViewToolbar/info
|
||||
tags: $:/tags/ViewToolbar
|
||||
|
||||
<$button popup=<<tiddlerInfoState>> class="btn-invisible" selectedClass="tw-selected">{{$:/core/images/info-button}}</$button>
|
||||
<$button popup=<<tiddlerInfoState>> title={{$:/language/Buttons/Info/Hint}} aria-label={{$:/language/Buttons/Info/Caption}} class="btn-invisible" selectedClass="tw-selected">{{$:/core/images/info-button}}</$button>
|
||||
@@ -1,8 +1,7 @@
|
||||
title: $:/snippets/languageswitcher
|
||||
|
||||
{{$:/language/ControlPanel/Basics/Language/Prompt}} <$view tiddler={{$:/language}} field="description" format="text"><$view tiddler={{$:/language}} field="name" format="text"><$view tiddler={{$:/language}} field="title" format="text"/></$view></$view>
|
||||
|
||||
<$linkcatcher to="$:/language">
|
||||
<$list filter="[[$:/languages/en-GB]] [plugin-type[language]sort[title]]"><div><$reveal state="$:/language" type="match" text={{!!title}}>•</$reveal><$reveal state="$:/language" type="nomatch" text={{!!title}}> </$reveal> <$link to={{!!title}}><$view field="description" format="text"><$view field="name" format="text"><$view field="title" format="text"/></$view></$view></$link></div>
|
||||
{{$:/language/ControlPanel/Basics/Language/Prompt}} <$select tiddler="$:/language">
|
||||
<$list filter="[[$:/languages/en-GB]] [plugin-type[language]sort[title]]">
|
||||
<option value=<<currentTiddler>>><$view field="description"><$view field="name"><$view field="title"/></$view></$view></option>
|
||||
</$list>
|
||||
</$linkcatcher>
|
||||
</$select>
|
||||
10
core/wiki/macros/CSS.tid
Normal file
10
core/wiki/macros/CSS.tid
Normal file
@@ -0,0 +1,10 @@
|
||||
title: $:/core/macros/CSS
|
||||
tags: $:/tags/Macro
|
||||
|
||||
\define colour(name)
|
||||
<$transclude tiddler={{$:/palette}} index="$name$"/>
|
||||
\end
|
||||
|
||||
\define color(name)
|
||||
<<colour $name$>>
|
||||
\end
|
||||
10
core/wiki/macros/lingo.tid
Normal file
10
core/wiki/macros/lingo.tid
Normal file
@@ -0,0 +1,10 @@
|
||||
title: $:/core/macros/lingo
|
||||
tags: $:/tags/Macro
|
||||
|
||||
\define lingo-base()
|
||||
$:/language/
|
||||
\end
|
||||
|
||||
\define lingo(title)
|
||||
{{$(lingo-base)$$title$}}
|
||||
\end
|
||||
26
core/wiki/macros/tabs.tid
Normal file
26
core/wiki/macros/tabs.tid
Normal file
@@ -0,0 +1,26 @@
|
||||
title: $:/core/macros/tabs
|
||||
tags: $:/tags/Macro
|
||||
|
||||
\define tabs(tabsList,default,state:"$:/state/tab",class)
|
||||
<div class="tw-tab-set $class$">
|
||||
<div class="tw-tab-buttons $class$">
|
||||
<$list filter="$tabsList$" variable="currentTab">
|
||||
<$button set=<<qualify "$state$">> setTo=<<currentTab>> default="$default$" selectedClass="tw-tab-selected">
|
||||
<$transclude tiddler=<<currentTab>> field="caption">
|
||||
<$macrocall $name="currentTab" $type="text/plain" $output="text/plain"/>
|
||||
</$transclude>
|
||||
</$button>
|
||||
</$list>
|
||||
</div><div class="tw-tab-divider $class$"/><div class="tw-tab-content $class$">
|
||||
<$list filter="$tabsList$" variable="currentTab">
|
||||
|
||||
<$reveal type="match" state=<<qualify "$state$">> text=<<currentTab>> default="$default$">
|
||||
|
||||
<$transclude tiddler=<<currentTab>> mode="block"/>
|
||||
|
||||
</$reveal>
|
||||
|
||||
</$list>
|
||||
</div>
|
||||
</div>
|
||||
\end
|
||||
@@ -1,6 +1,7 @@
|
||||
title: $:/snippets/minilanguageswitcher
|
||||
|
||||
<$linkcatcher to="$:/language">
|
||||
<$list filter="[[$:/languages/en-GB]] [plugin-type[language]sort[title]]"><div><$reveal state="$:/language" type="match" text={{!!title}}>•</$reveal><$reveal state="$:/language" type="nomatch" text={{!!title}}> </$reveal> <$link to={{!!title}}><$view field="description" format="text"><$view field="name" format="text"><$view field="title" format="text"/></$view></$view></$link></div>
|
||||
<$select tiddler="$:/language">
|
||||
<$list filter="[[$:/languages/en-GB]] [plugin-type[language]sort[title]]">
|
||||
<option value=<<currentTiddler>>><$view field="description"><$view field="name"><$view field="title"/></$view></$view></option>
|
||||
</$list>
|
||||
</$linkcatcher>
|
||||
</$select>
|
||||
@@ -1,9 +1,8 @@
|
||||
title: $:/snippets/minithemeswitcher
|
||||
|
||||
\define lingo-base() $:/language/ControlPanel/Appearance/Theme/
|
||||
<<lingo Prompt>> <$view tiddler={{$:/theme}} field="name"/>
|
||||
|
||||
<$linkcatcher to="$:/theme">
|
||||
<$list filter="[plugin-type[theme]sort[title]]"><div><$reveal state="$:/theme" type="match" text={{!!title}}>•</$reveal><$reveal state="$:/theme" type="nomatch" text={{!!title}}> </$reveal> <$link to={{!!title}}><$view field="name" format="text"/></$link></div>
|
||||
<<lingo Prompt>> <$select tiddler="$:/theme">
|
||||
<$list filter="[plugin-type[theme]sort[title]]">
|
||||
<option value=<<currentTiddler>>><$view field="name"><$view field="title"/></$view></option>
|
||||
</$list>
|
||||
</$linkcatcher>
|
||||
</$select>
|
||||
@@ -1,9 +1,8 @@
|
||||
title: $:/snippets/viewswitcher
|
||||
|
||||
\define lingo-base() $:/language/ControlPanel/Appearance/StoryView/
|
||||
<<lingo Prompt>> {{$:/view}}
|
||||
|
||||
<$linkcatcher to="$:/view"><$list filter="[storyviews[]]"><div><$reveal state="$:/view" type="match" text={{!!title}}>•</$reveal><$reveal state="$:/view" type="nomatch" text={{!!title}}> </$reveal> <$link to={{!!title}}><$view field="title"/></$link>
|
||||
</div>
|
||||
<<lingo Prompt>> <$select tiddler="$:/view">
|
||||
<$list filter="[storyviews[]]">
|
||||
<option><$view field="title"/></option>
|
||||
</$list>
|
||||
</$linkcatcher>
|
||||
</$select>
|
||||
@@ -9,6 +9,11 @@
|
||||
"build": {
|
||||
"index": [
|
||||
"--rendertiddler","$:/core/save/all","index.html","text/plain"],
|
||||
"externalimages": [
|
||||
"--savetiddlers","[is[image]]","images",
|
||||
"--setfield","[is[image]]","_canonical_uri","$:/core/templates/canonical-uri-external-image","text/plain",
|
||||
"--setfield","[is[image]]","text","","text/plain",
|
||||
"--rendertiddler","$:/core/save/all","externalimages.html","text/plain"],
|
||||
"static": [
|
||||
"--rendertiddler","$:/core/templates/static.template.html","static.html","text/plain",
|
||||
"--rendertiddler","$:/core/templates/alltiddlers.template.html","alltiddlers.html","text/plain",
|
||||
|
||||
@@ -8,6 +8,14 @@ The MarkdownExample tiddler below is written in Markdown. Create wiki links with
|
||||
[link text](#TiddlerTitle)
|
||||
```
|
||||
|
||||
Markdown image syntax can be used to reference images by tiddler title or an external URI. For example:
|
||||
|
||||
```
|
||||

|
||||
|
||||

|
||||
```
|
||||
|
||||
To add the plugin to your own TiddlyWiki5, just drag this link to the browser window:
|
||||
|
||||
[[$:/plugins/tiddlywiki/markdown]]
|
||||
|
||||
137
editions/test/tiddlers/tests/test-tiddler.js
Normal file
137
editions/test/tiddlers/tests/test-tiddler.js
Normal file
@@ -0,0 +1,137 @@
|
||||
/*\
|
||||
title: test-tiddlers.js
|
||||
type: application/javascript
|
||||
tags: [[$:/tags/test-spec]]
|
||||
|
||||
Tests the tiddler object
|
||||
|
||||
\*/
|
||||
(function(){
|
||||
|
||||
/*jslint node: true, browser: true */
|
||||
/*global $tw: false */
|
||||
"use strict";
|
||||
|
||||
describe("Tiddler tests", function() {
|
||||
|
||||
function compareTiddlers(fieldsA,fieldsB,excludeFields) {
|
||||
var tiddlerA = new $tw.Tiddler(fieldsA),
|
||||
tiddlerB = new $tw.Tiddler(fieldsB);
|
||||
return tiddlerA.isEqual(tiddlerB,excludeFields);
|
||||
}
|
||||
|
||||
// Our tests
|
||||
|
||||
it("should compare identical tiddlers", function() {
|
||||
expect(compareTiddlers({
|
||||
title: "HelloThere",
|
||||
text: "one",
|
||||
tags: ["one","two","three"]
|
||||
},{
|
||||
title: "HelloThere",
|
||||
text: "one",
|
||||
tags: ["one","two","three"]
|
||||
})).toEqual(true);
|
||||
});
|
||||
|
||||
it("should compare different tiddlers", function() {
|
||||
expect(compareTiddlers({
|
||||
title: "HelloThere2",
|
||||
text: "one",
|
||||
tags: ["one","two","three"]
|
||||
},{
|
||||
title: "HelloThere",
|
||||
text: "one",
|
||||
tags: ["one","two","three"]
|
||||
})).toEqual(false);
|
||||
expect(compareTiddlers({
|
||||
title: "HelloThere",
|
||||
text: "one",
|
||||
tags: ["one","three"]
|
||||
},{
|
||||
title: "HelloThere",
|
||||
text: "one",
|
||||
tags: ["one","two","three"]
|
||||
})).toEqual(false);
|
||||
expect(compareTiddlers({
|
||||
title: "HelloThere",
|
||||
text: "one",
|
||||
tags: ["one","two","three"],
|
||||
caption: "Test"
|
||||
},{
|
||||
title: "HelloThere",
|
||||
text: "one",
|
||||
tags: ["one","two","three"]
|
||||
})).toEqual(false);
|
||||
expect(compareTiddlers({
|
||||
title: "HelloThere",
|
||||
text: "one",
|
||||
tags: ["one","two","three"]
|
||||
},{
|
||||
title: "HelloThere",
|
||||
text: "one",
|
||||
tags: ["one","two","three"],
|
||||
caption: "Test"
|
||||
})).toEqual(false);
|
||||
expect(compareTiddlers({
|
||||
title: "HelloThere",
|
||||
text: "one",
|
||||
tags: ["one","two","three"]
|
||||
},{
|
||||
title: "HelloThere",
|
||||
text: "one"
|
||||
})).toEqual(false);
|
||||
});
|
||||
|
||||
it("should compare different tiddlers with exclusions", function() {
|
||||
expect(compareTiddlers({
|
||||
title: "HelloThere2",
|
||||
text: "one",
|
||||
tags: ["one","two","three"]
|
||||
},{
|
||||
title: "HelloThere",
|
||||
text: "one",
|
||||
tags: ["one","two","three"]
|
||||
},["title"])).toEqual(true);
|
||||
expect(compareTiddlers({
|
||||
title: "HelloThere",
|
||||
text: "one",
|
||||
tags: ["one","three"]
|
||||
},{
|
||||
title: "HelloThere",
|
||||
text: "one",
|
||||
tags: ["one","two","three"]
|
||||
},["tags"])).toEqual(true);
|
||||
expect(compareTiddlers({
|
||||
title: "HelloThere",
|
||||
text: "one",
|
||||
tags: ["one","two","three"],
|
||||
caption: "Test"
|
||||
},{
|
||||
title: "HelloThere",
|
||||
text: "one",
|
||||
tags: ["one","two","three"]
|
||||
},["caption"])).toEqual(true);
|
||||
expect(compareTiddlers({
|
||||
title: "HelloThere",
|
||||
text: "one",
|
||||
tags: ["one","two","three"]
|
||||
},{
|
||||
title: "HelloThere",
|
||||
text: "one",
|
||||
tags: ["one","two","three"],
|
||||
caption: "Test"
|
||||
},["caption"])).toEqual(true);
|
||||
expect(compareTiddlers({
|
||||
title: "HelloThere",
|
||||
text: "one",
|
||||
tags: ["one","two","three"]
|
||||
},{
|
||||
title: "HelloThere",
|
||||
text: "one"
|
||||
},["tags"])).toEqual(true);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
})();
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user