mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2026-01-22 10:54:46 +00:00
Compare commits
77 Commits
v5.0.2-bet
...
v5.0.4-bet
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1c17cfb0ff | ||
|
|
912c26f848 | ||
|
|
a5de1cf7fb | ||
|
|
84e0dc9d1a | ||
|
|
39743b4758 | ||
|
|
6091b41960 | ||
|
|
2d1d53893a | ||
|
|
861e350444 | ||
|
|
9a15cb0516 | ||
|
|
74fd683a22 | ||
|
|
8cc10d87d4 | ||
|
|
ce13548884 | ||
|
|
ffcc5a09f2 | ||
|
|
7f5a8fc937 | ||
|
|
c740792105 | ||
|
|
bd80bf4acc | ||
|
|
e66fb948c1 | ||
|
|
79046c52b4 | ||
|
|
062c4e5400 | ||
|
|
8538d69dc1 | ||
|
|
274c52005d | ||
|
|
99dd029816 | ||
|
|
1c529ddcd4 | ||
|
|
1491c261f5 | ||
|
|
3bcaab513d | ||
|
|
04077549ca | ||
|
|
6c1489fc2f | ||
|
|
1336058336 | ||
|
|
b659c65959 | ||
|
|
e8f16c1c97 | ||
|
|
6b51a51609 | ||
|
|
a4d063e884 | ||
|
|
42ba6852d1 | ||
|
|
638c8b2070 | ||
|
|
cc39686693 | ||
|
|
2b72e48a3a | ||
|
|
0ec2224757 | ||
|
|
218b9c967e | ||
|
|
a4e4b6797a | ||
|
|
a4e3f66809 | ||
|
|
07dd524016 | ||
|
|
f3b2788ed1 | ||
|
|
a389f9bc8c | ||
|
|
1144504bb3 | ||
|
|
72f07947ea | ||
|
|
e8549cba4b | ||
|
|
a5aa2c08b2 | ||
|
|
14b98f5966 | ||
|
|
7ec516a746 | ||
|
|
886b069dce | ||
|
|
b50eb8da30 | ||
|
|
4ece301a97 | ||
|
|
810167bc7b | ||
|
|
1b2a5fe130 | ||
|
|
88d483a2c8 | ||
|
|
db85bfe513 | ||
|
|
066a4d9fbc | ||
|
|
3e2f475324 | ||
|
|
a5f33d875b | ||
|
|
6d09db5608 | ||
|
|
23b2f74e94 | ||
|
|
37a46adac8 | ||
|
|
65e3780cc1 | ||
|
|
7d33dd71a2 | ||
|
|
d03728ea71 | ||
|
|
9396d52b42 | ||
|
|
7dc7559b90 | ||
|
|
5ac5b2c76d | ||
|
|
d4d8cdf9a4 | ||
|
|
9e5e08a7d3 | ||
|
|
41c592b758 | ||
|
|
84ad161eab | ||
|
|
4ab431bb93 | ||
|
|
f6bea8f58b | ||
|
|
0984e9322f | ||
|
|
80e0714c0d | ||
|
|
5e743262d4 |
5
bld.cmd
5
bld.cmd
@@ -1,6 +1,6 @@
|
||||
@echo off
|
||||
|
||||
rem build TiddlyWiki5 for five.tiddlywiki.com
|
||||
rem build TiddlyWiki5 for tiddlywiki.com
|
||||
|
||||
rem Set up the build output directory
|
||||
|
||||
@@ -35,6 +35,7 @@ node .\tiddlywiki.js ^
|
||||
.\editions\tw5.com ^
|
||||
--verbose ^
|
||||
--rendertiddler $:/core/save/all %TW5_BUILD_OUTPUT%\index.html text/plain ^
|
||||
--savetiddler $:/favicon.ico %TW5_BUILD_OUTPUT%\favicon.ico ^
|
||||
--rendertiddler ReadMe .\readme.md text/html ^
|
||||
--rendertiddler ContributingTemplate .\contributing.md text/html ^
|
||||
--rendertiddler $:/editions/tw5.com/download-empty %TW5_BUILD_OUTPUT%\empty.html text/plain ^
|
||||
@@ -88,7 +89,7 @@ node .\tiddlywiki.js ^
|
||||
|
||||
rem Make the CNAME file that GitHub Pages requires
|
||||
|
||||
echo five.tiddlywiki.com > %TW5_BUILD_OUTPUT%\CNAME
|
||||
echo tiddlywiki.com > %TW5_BUILD_OUTPUT%\CNAME
|
||||
|
||||
rem Run the test edition to run the Node.js tests and to generate test.html for tests in the browser
|
||||
|
||||
|
||||
5
bld.sh
5
bld.sh
@@ -1,6 +1,6 @@
|
||||
#!/bin/bash
|
||||
|
||||
# build TiddlyWiki5 for five.tiddlywiki.com
|
||||
# build TiddlyWiki5 for tiddlywiki.com
|
||||
|
||||
# Set up the build output directory
|
||||
|
||||
@@ -17,7 +17,7 @@ echo "Using TW5_BUILD_OUTPUT as [$TW5_BUILD_OUTPUT]"
|
||||
|
||||
# Make the CNAME file that GitHub Pages requires
|
||||
|
||||
echo "five.tiddlywiki.com" > $TW5_BUILD_OUTPUT/CNAME
|
||||
echo "tiddlywiki.com" > $TW5_BUILD_OUTPUT/CNAME
|
||||
|
||||
# Create the `static` directories if necessary
|
||||
|
||||
@@ -36,6 +36,7 @@ node ./tiddlywiki.js \
|
||||
./editions/tw5.com \
|
||||
--verbose \
|
||||
--rendertiddler $:/core/save/all $TW5_BUILD_OUTPUT/index.html text/plain \
|
||||
--savetiddler $:/favicon.ico $TW5_BUILD_OUTPUT/favicon.ico \
|
||||
--rendertiddler ReadMe ./readme.md text/html \
|
||||
--rendertiddler ContributingTemplate ./contributing.md text/html \
|
||||
--rendertiddler $:/editions/tw5.com/download-empty $TW5_BUILD_OUTPUT/empty.html text/plain \
|
||||
|
||||
37
boot/boot.js
37
boot/boot.js
@@ -269,7 +269,7 @@ $tw.utils.stringifyList = function(value) {
|
||||
// Parse a string array from a bracketted list. For example "OneTiddler [[Another Tiddler]] LastOne"
|
||||
$tw.utils.parseStringArray = function(value) {
|
||||
if(typeof value === "string") {
|
||||
var memberRegExp = /(?:\[\[([^\]]+)\]\])|([^\s]+)/mg,
|
||||
var memberRegExp = /(?:^|\s)(?:\[\[(.*?)\]\])(?=\s|$)|(\S+)/mg,
|
||||
results = [],
|
||||
match;
|
||||
do {
|
||||
@@ -1152,11 +1152,18 @@ $tw.loadTiddlersFromFile = function(filepath,fields) {
|
||||
return {filepath: filepath, type: type, tiddlers: tiddlers, hasMetaFile: !!metadata};
|
||||
};
|
||||
|
||||
/*
|
||||
A default set of files for TiddlyWiki to ignore during load.
|
||||
This matches what NPM ignores, and adds "*.meta" to ignore tiddler
|
||||
metadata files.
|
||||
*/
|
||||
$tw.boot.excludeRegExp = /^\.DS_Store$|^.*\.meta$|^\..*\.swp$|^\._.*$|^\.git$|^\.hg$|^\.lock-wscript$|^\.svn$|^\.wafpickle-.*$|^CVS$|^npm-debug\.log$/;
|
||||
|
||||
/*
|
||||
Load all the tiddlers recursively from a directory, including honouring `tiddlywiki.files` files for drawing in external files. Returns an array of {filepath:,type:,tiddlers: [{..fields...}],hasMetaFile:}. Note that no file information is returned for externally loaded tiddlers, just the `tiddlers` property.
|
||||
*/
|
||||
$tw.loadTiddlersFromPath = function(filepath,excludeRegExp) {
|
||||
excludeRegExp = excludeRegExp || /^\.DS_Store$|.meta$/;
|
||||
excludeRegExp = excludeRegExp || $tw.boot.excludeRegExp;
|
||||
var tiddlers = [];
|
||||
if(fs.existsSync(filepath)) {
|
||||
var stat = fs.statSync(filepath);
|
||||
@@ -1198,7 +1205,7 @@ $tw.loadTiddlersFromPath = function(filepath,excludeRegExp) {
|
||||
Load the tiddlers from a plugin folder, and package them up into a proper JSON plugin tiddler
|
||||
*/
|
||||
$tw.loadPluginFolder = function(filepath,excludeRegExp) {
|
||||
excludeRegExp = excludeRegExp || /^\.DS_Store$|.meta$/;
|
||||
excludeRegExp = excludeRegExp || $tw.boot.excludeRegExp;
|
||||
var stat, files, pluginInfo, pluginTiddlers = [], f, file, titlePrefix, t;
|
||||
if(fs.existsSync(filepath)) {
|
||||
stat = fs.statSync(filepath);
|
||||
@@ -1247,6 +1254,20 @@ $tw.loadPluginFolder = function(filepath,excludeRegExp) {
|
||||
}
|
||||
};
|
||||
|
||||
/*
|
||||
Fallback tiddlywiki.info content
|
||||
*/
|
||||
$tw.boot.defaultWikiInfo = {
|
||||
"plugins": [
|
||||
"tiddlywiki/tiddlyweb",
|
||||
"tiddlywiki/filesystem"
|
||||
],
|
||||
"themes": [
|
||||
"tiddlywiki/vanilla",
|
||||
"tiddlywiki/snowwhite"
|
||||
]
|
||||
};
|
||||
|
||||
/*
|
||||
path: path of wiki directory
|
||||
parentPaths: array of parent paths that we mustn't recurse into
|
||||
@@ -1254,13 +1275,14 @@ parentPaths: array of parent paths that we mustn't recurse into
|
||||
$tw.loadWikiTiddlers = function(wikiPath,parentPaths) {
|
||||
parentPaths = parentPaths || [];
|
||||
var wikiInfoPath = path.resolve(wikiPath,$tw.config.wikiInfo),
|
||||
wikiInfo = {},
|
||||
wikiInfo,
|
||||
pluginFields;
|
||||
// Bail if we don't have a wiki info file
|
||||
if(!fs.existsSync(wikiInfoPath)) {
|
||||
$tw.utils.error("Missing tiddlywiki.info file at " + wikiPath);
|
||||
if(fs.existsSync(wikiInfoPath)) {
|
||||
wikiInfo = JSON.parse(fs.readFileSync(wikiInfoPath,"utf8"));
|
||||
} else {
|
||||
wikiInfo = $tw.boot.defaultWikiInfo;
|
||||
}
|
||||
wikiInfo = JSON.parse(fs.readFileSync(wikiInfoPath,"utf8"));
|
||||
// Load any parent wikis
|
||||
if(wikiInfo.includeWikis) {
|
||||
parentPaths = parentPaths.slice(0);
|
||||
@@ -1412,6 +1434,7 @@ $tw.boot.startup = function() {
|
||||
$tw.utils.registerFileType("image/png","base64",".png");
|
||||
$tw.utils.registerFileType("image/gif","base64",".gif");
|
||||
$tw.utils.registerFileType("image/svg+xml","utf8",".svg");
|
||||
$tw.utils.registerFileType("image/x-icon","base64",".ico");
|
||||
$tw.utils.registerFileType("application/font-woff","base64",".woff");
|
||||
// Create the wiki store for the app
|
||||
$tw.wiki = new $tw.Wiki();
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
<h1 class=''>Contributing to <a class=' tw-tiddlylink tw-tiddlylink-resolves' href='http://five.tiddlywiki.com/static/TiddlyWiki5.html'>TiddlyWiki5</a></h1><p><a class=' tw-tiddlylink tw-tiddlylink-resolves' href='http://five.tiddlywiki.com/static/TiddlyWiki5.html'>TiddlyWiki5</a> welcomes contributions to its code and documentation via <a class='tw-tiddlylink-external' href='https://github.com/Jermolene/TiddlyWiki5' target='_blank'>GitHub</a>. Please take a moment to read these notes to help make the process as smooth as possible.</p><h2 class=''>Bug Reports</h2><p>From the perspective of the developers, a bug report that says little more than "it doesn't work" can be frustrating. For effective debugging, we need as much information as possible. At a minimum, please try to include:</p><ul><li>A descriptive title</li><li>A summary</li><li>Steps to reproduce</li><li>Expected behaviour</li><li>Context (OS, browser etc.)</li></ul><p>There's a lot of good material on the web about bug reports:</p><ul><li><a class='tw-tiddlylink-external' href='http://mhay68.tumblr.com/post/1648223018/what-makes-a-good-bug-report' target='_blank'>http://mhay68.tumblr.com/post/1648223018/what-makes-a-good-bug-report</a></li><li><a class='tw-tiddlylink-external' href='http://www.chiark.greenend.org.uk/~sgtatham/bugs.html' target='_blank'>http://www.chiark.greenend.org.uk/~sgtatham/bugs.html</a></li></ul><h2 class=''>Pull Requests</h2><p>Like other <a class=' tw-tiddlylink tw-tiddlylink-resolves' href='http://five.tiddlywiki.com/static/OpenSource.html'>OpenSource</a> projects, <a class=' tw-tiddlylink tw-tiddlylink-resolves' href='http://five.tiddlywiki.com/static/TiddlyWiki5.html'>TiddlyWiki5</a> needs a signed contributor license agreement from individual contributors before contributions of code can be accepted. This is a legal agreement that allows contributors to assert that they own the copyright of their contribution, and that they agree to license it to the <a class=' tw-tiddlylink tw-tiddlylink-missing' href='http://five.tiddlywiki.com/static/UnaMesa.html'>UnaMesa</a> Association (the legal entity that owns <a class=' tw-tiddlylink tw-tiddlylink-resolves' href='http://five.tiddlywiki.com/static/TiddlyWiki.html'>TiddlyWiki</a> on behalf of the community).</p><ul><li>For individuals use: <a class='tw-tiddlylink-external' href='https://github.com/Jermolene/TiddlyWiki5/tree/master/licenses/cla-individual.md' target='_blank'>licenses/CLA-individual</a></li><li>For entities use: <a class='tw-tiddlylink-external' href='https://github.com/Jermolene/TiddlyWiki5/tree/master/licenses/cla-entity.md' target='_blank'>licenses/CLA-entity</a></li></ul><p><em>This is a first pass at a CLA for <a class=' tw-tiddlylink tw-tiddlylink-resolves' href='http://five.tiddlywiki.com/static/TiddlyWiki.html'>TiddlyWiki</a>. Please let us know if we missed something important. If we do have to make essential changes to the CLA, there is a possibility that all contributors will need to sign it again</em></p><h3 class=''>How to sign the CLA</h3><pre>git clone https://github.com/Jermolene/TiddlyWiki5.git TiddlyWiki5
|
||||
<h1 class=''>Contributing to <a class=' tw-tiddlylink tw-tiddlylink-resolves' href='http://tiddlywiki.com/static/TiddlyWiki5.html'>TiddlyWiki5</a></h1><p><a class=' tw-tiddlylink tw-tiddlylink-resolves' href='http://tiddlywiki.com/static/TiddlyWiki5.html'>TiddlyWiki5</a> welcomes contributions to its code and documentation via <a class='tw-tiddlylink-external' href='https://github.com/Jermolene/TiddlyWiki5' target='_blank'>GitHub</a>. Please take a moment to read these notes to help make the process as smooth as possible.</p><h2 class=''>Bug Reports</h2><p>For effective debugging, we need as much information as possible. At a minimum, please try to include:</p><ul><li>A descriptive title</li><li>A summary</li><li>Steps to reproduce</li><li>Expected behaviour</li><li>Context (OS, browser etc.)</li></ul><p>Consider also adding screenshots if it makes things clearer.</p><p>There's a lot of good material on the web about bug reports:</p><ul><li><a class='tw-tiddlylink-external' href='http://mhay68.tumblr.com/post/1648223018/what-makes-a-good-bug-report' target='_blank'>http://mhay68.tumblr.com/post/1648223018/what-makes-a-good-bug-report</a></li><li><a class='tw-tiddlylink-external' href='http://www.chiark.greenend.org.uk/~sgtatham/bugs.html' target='_blank'>http://www.chiark.greenend.org.uk/~sgtatham/bugs.html</a></li></ul><h2 class=''>Pull Requests</h2><p>Like other <a class=' tw-tiddlylink tw-tiddlylink-resolves' href='http://tiddlywiki.com/static/OpenSource.html'>OpenSource</a> projects, <a class=' tw-tiddlylink tw-tiddlylink-resolves' href='http://tiddlywiki.com/static/TiddlyWiki5.html'>TiddlyWiki5</a> needs a signed contributor license agreement from individual contributors. This is a legal agreement that allows contributors to assert that they own the copyright of their contribution, and that they agree to license it to the <a class=' tw-tiddlylink tw-tiddlylink-missing' href='http://tiddlywiki.com/static/UnaMesa.html'>UnaMesa</a> Association (the legal entity that owns <a class=' tw-tiddlylink tw-tiddlylink-resolves' href='http://tiddlywiki.com/static/TiddlyWiki.html'>TiddlyWiki</a> on behalf of the community).</p><ul><li>For individuals use: <a class='tw-tiddlylink-external' href='https://github.com/Jermolene/TiddlyWiki5/tree/master/licenses/cla-individual.md' target='_blank'>licenses/CLA-individual</a></li><li>For entities use: <a class='tw-tiddlylink-external' href='https://github.com/Jermolene/TiddlyWiki5/tree/master/licenses/cla-entity.md' target='_blank'>licenses/CLA-entity</a></li></ul><p><em>This is a first pass at a CLA for <a class=' tw-tiddlylink tw-tiddlylink-resolves' href='http://tiddlywiki.com/static/TiddlyWiki.html'>TiddlyWiki</a>. Please let us know if we missed something important. If we do have to make essential changes to the CLA, there is a possibility that all contributors will need to sign it again</em></p><h3 class=''>How to sign the CLA</h3><pre>git clone https://github.com/Jermolene/TiddlyWiki5.git TiddlyWiki5
|
||||
cd TiddlyWiki5
|
||||
git checkout -b sign-cla</pre><p><strong>Add your name and the date to cla-individual.md or cla-entity.md</strong>. Date format (YYYY/MM/DD)
|
||||
eg: <code>Jeremy Ruston, @Jermolene, 2011/11/22</code></p><pre>git add .
|
||||
git commit -m "sign contributor license agreement"
|
||||
git push origin sign-cla</pre><p><strong>Go to your github repo and create a pull request.</strong></p><p><strong>Thank you!</strong></p><h4 class=''>Attribution</h4><p>The CLA documents used for this project where created using <a class='tw-tiddlylink-external' href='http://www.harmonyagreements.org' target='_blank'>Harmony Project Templates</a>. "HA-CLA-I-LIST Version 1.0" for "CLA-individual" and "HA-CLA-E-LIST Version 1.0" for "CLA-entity"
|
||||
</p><p><em>This file was automatically generated by <a class=' tw-tiddlylink tw-tiddlylink-resolves' href='http://five.tiddlywiki.com/static/TiddlyWiki5.html'>TiddlyWiki5</a></em>
|
||||
</p><p><em>This file was automatically generated by <a class=' tw-tiddlylink tw-tiddlylink-resolves' href='http://tiddlywiki.com/static/TiddlyWiki5.html'>TiddlyWiki5</a></em>
|
||||
</p>
|
||||
46
core/modules/commands/savetiddler.js
Normal file
46
core/modules/commands/savetiddler.js
Normal file
@@ -0,0 +1,46 @@
|
||||
/*\
|
||||
title: $:/core/modules/commands/savetiddler.js
|
||||
type: application/javascript
|
||||
module-type: command
|
||||
|
||||
Command to save the content of a tiddler to a file
|
||||
|
||||
\*/
|
||||
(function(){
|
||||
|
||||
/*jslint node: true, browser: true */
|
||||
/*global $tw: false */
|
||||
"use strict";
|
||||
|
||||
exports.info = {
|
||||
name: "savetiddler",
|
||||
synchronous: false
|
||||
};
|
||||
|
||||
var Command = function(params,commander,callback) {
|
||||
this.params = params;
|
||||
this.commander = commander;
|
||||
this.callback = callback;
|
||||
};
|
||||
|
||||
Command.prototype.execute = function() {
|
||||
if(this.params.length < 2) {
|
||||
return "Missing filename";
|
||||
}
|
||||
var self = this,
|
||||
fs = require("fs"),
|
||||
path = require("path"),
|
||||
title = this.params[0],
|
||||
filename = this.params[1],
|
||||
tiddler = this.commander.wiki.getTiddler(title),
|
||||
type = tiddler.fields.type || "text/vnd.tiddlywiki",
|
||||
contentTypeInfo = $tw.config.contentTypeInfo[type] || {encoding: "utf8"};
|
||||
fs.writeFile(filename,tiddler.fields.text,contentTypeInfo.encoding,function(err) {
|
||||
self.callback(err);
|
||||
});
|
||||
return null;
|
||||
};
|
||||
|
||||
exports.Command = Command;
|
||||
|
||||
})();
|
||||
@@ -95,9 +95,8 @@ SimpleServer.prototype.listen = function(port) {
|
||||
if(username && password) {
|
||||
// Check they match
|
||||
if(self.checkCredentials(request,username,password) !== "ALLOWED") {
|
||||
response.setHeader("WWW-Authenticate", 'Basic realm="Admin Area"');
|
||||
response.writeHead(401,"Authentication required",{
|
||||
"WWW-Authenticate": 'Basic realm="TiddlyWiki5"'
|
||||
"WWW-Authenticate": 'Basic realm="Please provide your username and password to login to TiddlyWiki5"'
|
||||
});
|
||||
response.end();
|
||||
return;
|
||||
@@ -197,6 +196,15 @@ var Command = function(params,commander,callback) {
|
||||
response.end(text,"utf8");
|
||||
}
|
||||
});
|
||||
this.server.addRoute({
|
||||
method: "GET",
|
||||
path: /^\/favicon.ico$/,
|
||||
handler: function(request,response,state) {
|
||||
response.writeHead(200, {"Content-Type": "image/x-icon"});
|
||||
var buffer = state.wiki.getTiddlerText("$:/favicon.ico","");
|
||||
response.end(buffer,"base64");
|
||||
}
|
||||
});
|
||||
this.server.addRoute({
|
||||
method: "GET",
|
||||
path: /^\/recipes\/default\/tiddlers.json$/,
|
||||
@@ -265,9 +273,8 @@ Command.prototype.execute = function() {
|
||||
password: password
|
||||
});
|
||||
this.server.listen(port);
|
||||
if(this.commander.verbose) {
|
||||
console.log("Serving on port " + port);
|
||||
}
|
||||
console.log("Serving on port " + port);
|
||||
console.log("(press ctrl-C to exit)");
|
||||
return null;
|
||||
};
|
||||
|
||||
|
||||
@@ -36,8 +36,8 @@ var parseTiddlerDiv = function(text /* [,fields] */) {
|
||||
}
|
||||
}
|
||||
// Parse the DIV body
|
||||
var divRegExp = /^\s*<div\s+([^>]*)>((?:\s|\S)*)<\/div>\s*$/gi,
|
||||
subDivRegExp = /^\s*<pre>((?:\s|\S)*)<\/pre>\s*$/gi,
|
||||
var divRegExp = /^\s*<div\s+([^>]*)>([(?:\s|\S)]*)<\/div>\s*$/gi,
|
||||
subDivRegExp = /^\s*<pre>([(?:\s|\S)]*)<\/pre>\s*$/gi,
|
||||
attrRegExp = /\s*([^=\s]+)\s*=\s*"([^"]*)"/gi,
|
||||
match = divRegExp.exec(text);
|
||||
if(match) {
|
||||
|
||||
@@ -59,13 +59,14 @@ exports.startup = function() {
|
||||
});
|
||||
// Install the animator
|
||||
$tw.anim = new $tw.utils.Animator();
|
||||
// Kick off the stylesheet manager
|
||||
$tw.stylesheetManager = new $tw.utils.StylesheetManager($tw.wiki);
|
||||
// Create a root widget for attaching event handlers. By using it as the parentWidget for another widget tree, one can reuse the event handlers
|
||||
$tw.rootWidget = new widget.widget({type: "widget", children: []},{
|
||||
wiki: $tw.wiki,
|
||||
document: document
|
||||
});
|
||||
$tw.rootWidget = new widget.widget({
|
||||
type: "widget",
|
||||
children: []
|
||||
},{
|
||||
wiki: $tw.wiki,
|
||||
document: document
|
||||
});
|
||||
// Install the modal message mechanism
|
||||
$tw.modal = new $tw.utils.Modal($tw.wiki);
|
||||
$tw.rootWidget.addEventListener("tw-modal",function(event) {
|
||||
@@ -111,6 +112,20 @@ exports.startup = function() {
|
||||
$tw.rootWidget.addEventListener("tw-clear-password",function(event) {
|
||||
$tw.crypto.setPassword(null);
|
||||
});
|
||||
// Set up the styles
|
||||
var styleTemplateTitle = "$:/core/ui/PageStylesheet",
|
||||
styleParser = $tw.wiki.parseTiddler(styleTemplateTitle);
|
||||
$tw.styleWidgetNode = $tw.wiki.makeWidget(styleParser,{document: $tw.document});
|
||||
$tw.styleContainer = $tw.document.createElement("style");
|
||||
$tw.styleWidgetNode.render($tw.styleContainer,null);
|
||||
$tw.styleElement = document.createElement("style");
|
||||
$tw.styleElement.innerHTML = $tw.styleContainer.textContent;
|
||||
document.head.insertBefore($tw.styleElement,document.head.firstChild);
|
||||
$tw.wiki.addEventListener("change",function(changes) {
|
||||
if($tw.styleWidgetNode.refresh(changes,$tw.styleContainer,null)) {
|
||||
$tw.styleElement.innerHTML = $tw.styleContainer.textContent;
|
||||
}
|
||||
});
|
||||
// Display the PageMacros, which includes the PageTemplate
|
||||
var templateTitle = "$:/core/ui/PageMacros",
|
||||
parser = $tw.wiki.parseTiddler(templateTitle);
|
||||
@@ -122,6 +137,9 @@ exports.startup = function() {
|
||||
$tw.wiki.addEventListener("change",function(changes) {
|
||||
$tw.pageWidgetNode.refresh(changes,$tw.pageContainer,null);
|
||||
});
|
||||
// Fix up the link between the root widget and the page container
|
||||
$tw.rootWidget.domNodes = [$tw.pageContainer];
|
||||
$tw.rootWidget.children = [$tw.pageWidgetNode];
|
||||
// If we're being viewed on a data: URI then give instructions for how to save
|
||||
if(document.location.protocol === "data:") {
|
||||
$tw.utils.dispatchCustomEvent(document,"tw-modal",{
|
||||
|
||||
@@ -130,15 +130,7 @@ exports.convertEventName = function(eventName) {
|
||||
|
||||
// Setup constants for the current browser
|
||||
exports.getBrowserInfo = function(info) {
|
||||
info.requestFullScreen = document.body.webkitRequestFullScreen !== undefined ? "webkitRequestFullScreen" :
|
||||
document.body.mozRequestFullScreen !== undefined ? "mozRequestFullScreen" :
|
||||
document.body.requestFullScreen !== undefined ? "requestFullScreen" : "";
|
||||
info.cancelFullScreen = document.webkitCancelFullScreen !== undefined ? "webkitCancelFullScreen" :
|
||||
document.mozCancelFullScreen !== undefined ? "mozCancelFullScreen" :
|
||||
document.cancelFullScreen !== undefined ? "cancelFullScreen" : "";
|
||||
info.isFullScreen = document.webkitIsFullScreen !== undefined ? "webkitIsFullScreen" :
|
||||
document.mozFullScreen !== undefined ? "mozFullScreen" :
|
||||
document.fullScreen !== undefined ? "fullScreen" : "";
|
||||
info.isIE = (/msie|trident/i.test(navigator.userAgent));
|
||||
};
|
||||
|
||||
})();
|
||||
|
||||
@@ -1,75 +0,0 @@
|
||||
/*\
|
||||
title: $:/core/modules/utils/styles.js
|
||||
type: application/javascript
|
||||
module-type: utils
|
||||
|
||||
The stylesheet manager automatically renders any tiddlers tagged "$:/tags/stylesheet" as HTML style elements.
|
||||
|
||||
\*/
|
||||
(function(){
|
||||
|
||||
/*jslint node: true, browser: true */
|
||||
/*global $tw: false */
|
||||
"use strict";
|
||||
|
||||
var STYLESHEET_ID_PREFIX = "tw-tiddler-stylesheet-",
|
||||
STYLESHEET_TAG = "$:/tags/stylesheet";
|
||||
|
||||
function StylesheetManager(wiki) {
|
||||
this.wiki = wiki;
|
||||
this.stylesheets = {}; // Hashmap of currently rendered stylesheets
|
||||
// Apply initial stylesheets
|
||||
var self = this,
|
||||
stylesheetTiddlers = this.wiki.filterTiddlers("[is[shadow]!has[draft.of]tag[" + STYLESHEET_TAG + "]] [!is[shadow]!has[draft.of]tag[" + STYLESHEET_TAG + "]]");
|
||||
$tw.utils.each(stylesheetTiddlers,function(title,index) {
|
||||
self.addStylesheet(title);
|
||||
});
|
||||
// Listen out for changes
|
||||
this.wiki.addEventListener("change",function(changes) {
|
||||
self.handleTiddlerChanges(changes);
|
||||
});
|
||||
}
|
||||
|
||||
StylesheetManager.prototype.addStylesheet = function(title) {
|
||||
// Record the stylesheet in the hashmap
|
||||
this.stylesheets[title] = true;
|
||||
// Parse the tiddler and render as plain text
|
||||
var text = this.wiki.renderTiddler("text/plain",title);
|
||||
// Create a style element and put it in the document
|
||||
var styleNode = document.createElement("style");
|
||||
styleNode.setAttribute("type","text/css");
|
||||
styleNode.setAttribute("id",STYLESHEET_ID_PREFIX + title);
|
||||
styleNode.appendChild(document.createTextNode(text));
|
||||
document.getElementsByTagName("head")[0].appendChild(styleNode);
|
||||
};
|
||||
|
||||
StylesheetManager.prototype.removeStylesheet = function(title) {
|
||||
// Remove the stylesheet from the hashmap
|
||||
if($tw.utils.hop(this.stylesheets,title)) {
|
||||
delete this.stylesheets[title];
|
||||
}
|
||||
// Remove the stylesheet from the document
|
||||
var styleNode = document.getElementById(STYLESHEET_ID_PREFIX + title);
|
||||
if(styleNode) {
|
||||
styleNode.parentNode.removeChild(styleNode);
|
||||
}
|
||||
};
|
||||
|
||||
StylesheetManager.prototype.handleTiddlerChanges = function(changes) {
|
||||
var self = this;
|
||||
$tw.utils.each(changes,function(change,title) {
|
||||
// Remove any existing stylesheet for the changed tiddler
|
||||
if($tw.utils.hop(self.stylesheets,title)) {
|
||||
self.removeStylesheet(title);
|
||||
}
|
||||
// Add the stylesheet if it is tagged and not a draft
|
||||
var tiddler = self.wiki.getTiddler(title);
|
||||
if(tiddler && tiddler.hasTag(STYLESHEET_TAG) && !tiddler.hasField("draft.of")) {
|
||||
self.addStylesheet(title);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
exports.StylesheetManager = StylesheetManager;
|
||||
|
||||
})();
|
||||
@@ -66,6 +66,7 @@ TW_Element.prototype.insertBefore = function(node,nextSibling) {
|
||||
var p = this.children.indexOf(nextSibling);
|
||||
if(p !== -1) {
|
||||
this.children.splice(p,0,node);
|
||||
node.parentNode = this;
|
||||
} else {
|
||||
this.appendChild(node);
|
||||
}
|
||||
|
||||
@@ -100,30 +100,62 @@ DropZoneWidget.prototype.handleDropEvent = function(event) {
|
||||
};
|
||||
|
||||
DropZoneWidget.prototype.importData = function(dataTransfer) {
|
||||
// Try each provided data type in turn
|
||||
for(var t=0; t<this.importDataTypes.length; t++) {
|
||||
var dataType = this.importDataTypes[t];
|
||||
var data = dataTransfer.getData(dataType.type);
|
||||
if(data !== "") {
|
||||
var tiddlerFields = dataType.convertToFields(data);
|
||||
if(!tiddlerFields.title) {
|
||||
tiddlerFields.title = this.wiki.generateNewTitle("Untitled");
|
||||
if(!$tw.browser.isIE || this.importDataTypes[t].IECompatible) {
|
||||
// Get the data
|
||||
var dataType = this.importDataTypes[t];
|
||||
var data = dataTransfer.getData(dataType.type);
|
||||
// Import the tiddlers in the data
|
||||
if(data !== "" && data !== null) {
|
||||
var tiddlerFields = dataType.convertToFields(data);
|
||||
if(!tiddlerFields.title) {
|
||||
tiddlerFields.title = this.wiki.generateNewTitle("Untitled");
|
||||
}
|
||||
this.dispatchEvent({type: "tw-import-tiddlers", param: JSON.stringify([tiddlerFields])});
|
||||
return;
|
||||
}
|
||||
this.dispatchEvent({type: "tw-import-tiddlers", param: JSON.stringify([tiddlerFields])});
|
||||
return;
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
DropZoneWidget.prototype.importDataTypes = [
|
||||
{type: "text/vnd.tiddler", convertToFields: function(data) {
|
||||
{type: "text/vnd.tiddler", IECompatible: false, convertToFields: function(data) {
|
||||
return JSON.parse(data);
|
||||
}},
|
||||
{type: "text/plain", convertToFields: function(data) {
|
||||
{type: "URL", IECompatible: true, convertToFields: function(data) {
|
||||
// Check for tiddler data URI
|
||||
var match = decodeURI(data).match(/^data\:text\/vnd\.tiddler,(.*)/i);
|
||||
if(match) {
|
||||
return JSON.parse(match[1]);
|
||||
} else {
|
||||
return { // As URL string
|
||||
text: data
|
||||
};
|
||||
}
|
||||
}},
|
||||
{type: "text/x-moz-url", IECompatible: false, convertToFields: function(data) {
|
||||
// Check for tiddler data URI
|
||||
var match = decodeURI(data).match(/^data\:text\/vnd\.tiddler,(.*)/i);
|
||||
if(match) {
|
||||
return JSON.parse(match[1]);
|
||||
} else {
|
||||
return { // As URL string
|
||||
text: data
|
||||
};
|
||||
}
|
||||
}},
|
||||
{type: "text/plain", IECompatible: false, convertToFields: function(data) {
|
||||
return {
|
||||
text: data
|
||||
};
|
||||
}},
|
||||
{type: "text/uri-list", convertToFields: function(data) {
|
||||
{type: "Text", IECompatible: true, convertToFields: function(data) {
|
||||
return {
|
||||
text: data
|
||||
};
|
||||
}},
|
||||
{type: "text/uri-list", IECompatible: false, convertToFields: function(data) {
|
||||
return {
|
||||
text: data
|
||||
};
|
||||
|
||||
@@ -53,6 +53,7 @@ EditWidget.prototype.execute = function() {
|
||||
this.editField = this.getAttribute("field","text");
|
||||
this.editIndex = this.getAttribute("index");
|
||||
this.editClass = this.getAttribute("class");
|
||||
this.editPlaceholder = this.getAttribute("placeholder");
|
||||
// Get the content type of the thing we're editing
|
||||
var type;
|
||||
if(this.editField === "text") {
|
||||
@@ -71,7 +72,8 @@ EditWidget.prototype.execute = function() {
|
||||
tiddler: {type: "string", value: this.editTitle},
|
||||
field: {type: "string", value: this.editField},
|
||||
index: {type: "string", value: this.editIndex},
|
||||
"class": {type: "string", value: this.editClass}
|
||||
"class": {type: "string", value: this.editClass},
|
||||
"placeholder": {type: "string", value: this.editPlaceholder}
|
||||
}
|
||||
}]);
|
||||
};
|
||||
|
||||
@@ -75,7 +75,7 @@ FieldManglerWidget.prototype.handleAddFieldEvent = function(event) {
|
||||
if(tiddler && typeof event.param === "string") {
|
||||
var name = event.param.toLowerCase();
|
||||
if(name !== "" && !$tw.utils.hop(tiddler.fields,name)) {
|
||||
var addition = {};
|
||||
var addition = this.wiki.getModificationFields();
|
||||
addition[name] = "";
|
||||
this.wiki.addTiddler(new $tw.Tiddler(tiddler,addition));
|
||||
}
|
||||
@@ -88,7 +88,7 @@ FieldManglerWidget.prototype.handleRemoveTagEvent = function(event) {
|
||||
if(tiddler && tiddler.fields.tags) {
|
||||
var p = tiddler.fields.tags.indexOf(event.param);
|
||||
if(p !== -1) {
|
||||
var modification = {};
|
||||
var modification = this.wiki.getModificationFields();
|
||||
modification.tags = (tiddler.fields.tags || []).slice(0);
|
||||
modification.tags.splice(p,1);
|
||||
this.wiki.addTiddler(new $tw.Tiddler(tiddler,modification));
|
||||
@@ -100,7 +100,7 @@ FieldManglerWidget.prototype.handleRemoveTagEvent = function(event) {
|
||||
FieldManglerWidget.prototype.handleAddTagEvent = function(event) {
|
||||
var tiddler = this.wiki.getTiddler(this.mangleTitle);
|
||||
if(tiddler && typeof event.param === "string" && event.param !== "") {
|
||||
var modification = {};
|
||||
var modification = this.wiki.getModificationFields();
|
||||
modification.tags = (tiddler.fields.tags || []).slice(0);
|
||||
$tw.utils.pushTop(modification.tags,event.param);
|
||||
this.wiki.addTiddler(new $tw.Tiddler(tiddler,modification));
|
||||
|
||||
@@ -91,7 +91,7 @@ LinkWidget.prototype.handleClickEvent = function (event) {
|
||||
this.dispatchEvent({
|
||||
type: "tw-navigate",
|
||||
navigateTo: this.to,
|
||||
navigateFromTitle: this.getVariable("currentTiddler"),
|
||||
navigateFromTitle: this.getVariable("storyTiddler"),
|
||||
navigateFromNode: this,
|
||||
navigateFromClientRect: { top: bounds.top, left: bounds.left, width: bounds.width, right: bounds.right, bottom: bounds.bottom, height: bounds.height
|
||||
}
|
||||
@@ -114,21 +114,32 @@ LinkWidget.prototype.handleDragStartEvent = function(event) {
|
||||
this.dragImage.appendChild(inner);
|
||||
this.document.body.appendChild(this.dragImage);
|
||||
// Astoundingly, we need to cover the dragger up: http://www.kryogenix.org/code/browser/custom-drag-image.html
|
||||
var bounds = this.dragImage.firstChild.getBoundingClientRect(),
|
||||
cover = this.document.createElement("div");
|
||||
var cover = this.document.createElement("div");
|
||||
cover.className = "tw-tiddler-dragger-cover";
|
||||
cover.style.left = (bounds.left - 16) + "px";
|
||||
cover.style.top = (bounds.top - 16) + "px";
|
||||
cover.style.width = (bounds.width + 32) + "px";
|
||||
cover.style.height = (bounds.height + 32) + "px";
|
||||
cover.style.left = (inner.offsetLeft - 16) + "px";
|
||||
cover.style.top = (inner.offsetTop - 16) + "px";
|
||||
cover.style.width = (inner.offsetWidth + 32) + "px";
|
||||
cover.style.height = (inner.offsetHeight + 32) + "px";
|
||||
this.dragImage.appendChild(cover);
|
||||
// Set the data transfer properties
|
||||
var dataTransfer = event.dataTransfer;
|
||||
// First the image
|
||||
dataTransfer.effectAllowed = "copy";
|
||||
dataTransfer.setDragImage(this.dragImage.firstChild,-16,-16);
|
||||
if(dataTransfer.setDragImage) {
|
||||
dataTransfer.setDragImage(this.dragImage.firstChild,-16,-16);
|
||||
}
|
||||
// Then the data
|
||||
dataTransfer.clearData();
|
||||
dataTransfer.setData("text/vnd.tiddler",this.wiki.getTiddlerAsJson(this.to));
|
||||
dataTransfer.setData("text/plain",this.wiki.getTiddlerText(this.to,""));
|
||||
var jsonData = this.wiki.getTiddlerAsJson(this.to),
|
||||
textData = this.wiki.getTiddlerText(this.to,"");
|
||||
// IE doesn't like these content types
|
||||
if(!$tw.browser.isIE) {
|
||||
dataTransfer.setData("text/vnd.tiddler",jsonData);
|
||||
dataTransfer.setData("text/plain",textData);
|
||||
dataTransfer.setData("text/x-moz-url","data:text/vnd.tiddler," + encodeURI(jsonData));
|
||||
}
|
||||
dataTransfer.setData("URL","data:text/vnd.tiddler," + encodeURI(jsonData));
|
||||
dataTransfer.setData("Text",textData);
|
||||
event.stopPropagation();
|
||||
} else {
|
||||
event.preventDefault();
|
||||
|
||||
@@ -320,14 +320,7 @@ NavigatorWidget.prototype.handleNewTiddlerEvent = function(event) {
|
||||
// Get the template tiddler if there is one
|
||||
var templateTiddler = this.wiki.getTiddler(event.param);
|
||||
// Create the new tiddler
|
||||
var baseTitle = (templateTiddler && templateTiddler.fields.title) || "New Tiddler",
|
||||
title;
|
||||
for(var t=0; true; t++) {
|
||||
title = baseTitle + (t ? " " + t : "");
|
||||
if(!this.wiki.tiddlerExists(title)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
var title = this.wiki.generateNewTitle((templateTiddler && templateTiddler.fields.title) || "New Tiddler");
|
||||
var tiddler = new $tw.Tiddler(this.wiki.getCreationFields(),{
|
||||
text: "Newly created tiddler",
|
||||
title: title
|
||||
@@ -336,7 +329,7 @@ NavigatorWidget.prototype.handleNewTiddlerEvent = function(event) {
|
||||
// Create the draft tiddler
|
||||
var draftTitle = this.generateDraftTitle(title),
|
||||
draftTiddler = new $tw.Tiddler({
|
||||
text: "Type the text for the new tiddler"
|
||||
text: ""
|
||||
},templateTiddler,{
|
||||
title: draftTitle,
|
||||
"draft.title": title,
|
||||
|
||||
@@ -98,7 +98,7 @@ RadioWidget.prototype.execute = function() {
|
||||
this.radioField = this.getAttribute("field");
|
||||
this.radioValue = this.getAttribute("value");
|
||||
this.radioClass = this.getAttribute("class","");
|
||||
if (this.radioClass !== "") {
|
||||
if(this.radioClass !== "") {
|
||||
this.radioClass += " ";
|
||||
}
|
||||
this.radioClass += "tw-radio";
|
||||
@@ -117,7 +117,7 @@ RadioWidget.prototype.refresh = function(changedTiddlers) {
|
||||
} else {
|
||||
var refreshed = false;
|
||||
if(changedTiddlers[this.radioTitle]) {
|
||||
this.inputDomNode.checked = this.getValue();
|
||||
this.inputDomNode.checked = this.getValue() === this.radioValue;
|
||||
refreshed = true;
|
||||
}
|
||||
return this.refreshChildren(changedTiddlers) || refreshed;
|
||||
|
||||
53
core/modules/widgets/raw.js
Normal file
53
core/modules/widgets/raw.js
Normal file
@@ -0,0 +1,53 @@
|
||||
/*\
|
||||
title: $:/core/modules/widgets/raw.js
|
||||
type: application/javascript
|
||||
module-type: widget
|
||||
|
||||
Raw widget
|
||||
|
||||
\*/
|
||||
(function(){
|
||||
|
||||
/*jslint node: true, browser: true */
|
||||
/*global $tw: false */
|
||||
"use strict";
|
||||
|
||||
var Widget = require("$:/core/modules/widgets/widget.js").widget;
|
||||
|
||||
var RawWidget = function(parseTreeNode,options) {
|
||||
this.initialise(parseTreeNode,options);
|
||||
};
|
||||
|
||||
/*
|
||||
Inherit from the base widget class
|
||||
*/
|
||||
RawWidget.prototype = new Widget();
|
||||
|
||||
/*
|
||||
Render this widget into the DOM
|
||||
*/
|
||||
RawWidget.prototype.render = function(parent,nextSibling) {
|
||||
this.parentDomNode = parent;
|
||||
this.execute();
|
||||
var div = this.document.createElement("div");
|
||||
div.innerHTML=this.parseTreeNode.html;
|
||||
parent.insertBefore(div,nextSibling);
|
||||
this.domNodes.push(div);
|
||||
};
|
||||
|
||||
/*
|
||||
Compute the internal state of the widget
|
||||
*/
|
||||
RawWidget.prototype.execute = function() {
|
||||
};
|
||||
|
||||
/*
|
||||
Selectively refreshes the widget if needed. Returns true if the widget or any of its children needed re-rendering
|
||||
*/
|
||||
RawWidget.prototype.refresh = function(changedTiddlers) {
|
||||
return false;
|
||||
};
|
||||
|
||||
exports.raw = RawWidget;
|
||||
|
||||
})();
|
||||
@@ -173,11 +173,11 @@ exports.tiddlerExists = function(title) {
|
||||
Generate an unused title from the specified base
|
||||
*/
|
||||
exports.generateNewTitle = function(baseTitle) {
|
||||
var c = 0;
|
||||
do {
|
||||
var title = baseTitle + (c ? " " + (c + 1) : "");
|
||||
c++;
|
||||
} while(this.tiddlerExists(title));
|
||||
var c = 0,
|
||||
title = baseTitle;
|
||||
while(this.tiddlerExists(title)) {
|
||||
title = baseTitle + " " + (++c);
|
||||
};
|
||||
return title;
|
||||
};
|
||||
|
||||
@@ -940,7 +940,7 @@ exports.search = function(text,options) {
|
||||
searchTermsRegExps = [new RegExp("(" + $tw.utils.escapeRegExp(text) + ")",flags)];
|
||||
}
|
||||
} else {
|
||||
terms = text.replace(/( +)/g," ").split(" ");
|
||||
terms = text.split(/ +/);
|
||||
if(terms.length === 1 && terms[0] === "") {
|
||||
searchTermsRegExps = null;
|
||||
} else {
|
||||
|
||||
@@ -20,6 +20,6 @@ type: text/vnd.tiddlywiki-html
|
||||
</head>
|
||||
<body class="tw-body">
|
||||
{{$:/StaticBanner||$:/core/templates/html-tiddler}}
|
||||
{{$:/core/ui/PageTemplate||$:/core/templates/html-tiddler}}
|
||||
{{$:/core/ui/PageMacros||$:/core/templates/html-tiddler}}
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -6,7 +6,7 @@ title: $:/core/templates/store.area.template.html
|
||||
`</div>`
|
||||
</$reveal>
|
||||
<$reveal type="match" state="$:/isEncrypted" text="yes">
|
||||
`<!------------- Encrypted tiddlers --------->`
|
||||
`<!--~~ Encrypted tiddlers ~~-->`
|
||||
`<pre id="encryptedStoreArea" type="text/plain" style="display:none;">`
|
||||
<$encrypt filter=<<saveTiddlerFilter>>/>
|
||||
`</pre>`
|
||||
|
||||
@@ -14,38 +14,39 @@ title: $:/core/templates/tiddlywiki5.html
|
||||
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
|
||||
<meta name="format-detection" content="telephone=no" />
|
||||
<meta name="copyright" content="{{$:/core/copyright.txt}}" />
|
||||
<link rel="shortcut icon" href="favicon.ico">
|
||||
<title>{{$:/core/wiki/title}}</title>
|
||||
<!----------- This is a Tiddlywiki file. The points of interest in the file are marked with this pattern ----------->
|
||||
<!--~~ This is a Tiddlywiki file. The points of interest in the file are marked with this pattern ~~-->
|
||||
|
||||
<!----------- Raw markup ----------->
|
||||
<!--~~ Raw markup ~~-->
|
||||
{{{ [tag[$:/core/wiki/rawmarkup]] ||$:/core/templates/plain-text-tiddler}}}
|
||||
</head>
|
||||
<body class="tw-body">
|
||||
<!----------- Static styles ----------->
|
||||
<!--~~ Static styles ~~-->
|
||||
<div id="styleArea">
|
||||
{{{ [is[system]type[text/css]] ||$:/core/templates/css-tiddler}}}
|
||||
</div>
|
||||
<!----------- Static content for Google and browsers without JavaScript ----------->
|
||||
<!--~~ Static content for Google and browsers without JavaScript ~~-->
|
||||
<noscript>
|
||||
<div id="splashArea">
|
||||
{{$:/core/templates/static.area}}
|
||||
</div>
|
||||
</noscript>
|
||||
<!----------- Ordinary tiddlers ----------->
|
||||
<!--~~ Ordinary tiddlers ~~-->
|
||||
{{$:/core/templates/store.area.template.html}}
|
||||
<!----------- Library modules ----------->
|
||||
<!--~~ Library modules ~~-->
|
||||
<div id="libraryModules" style="display:none;">
|
||||
{{{ [is[system]type[application/javascript]library[yes]] ||$:/core/templates/javascript-tiddler}}}
|
||||
</div>
|
||||
<!----------- Boot kernel prologue ----------->
|
||||
<!--~~ Boot kernel prologue ~~-->
|
||||
<div id="bootKernelPrefix" style="display:none;">
|
||||
{{ $:/boot/bootprefix.js ||$:/core/templates/javascript-tiddler}}
|
||||
</div>
|
||||
<!----------- Plugin modules ----------->
|
||||
<!--~~ Plugin modules ~~-->
|
||||
<div id="modules" style="display:none;">
|
||||
{{{ [is[system]type[application/javascript]has[module-type]] ||$:/core/templates/module-tiddler}}}
|
||||
</div>
|
||||
<!----------- Boot kernel ----------->
|
||||
<!--~~ Boot kernel ~~-->
|
||||
<div id="bootKernel" style="display:none;">
|
||||
{{ $:/boot/boot.js ||$:/core/templates/javascript-tiddler}}
|
||||
</div>
|
||||
|
||||
@@ -3,4 +3,4 @@ title: $:/core/ui/EditTemplate
|
||||
\define frame-classes()
|
||||
tw-tiddler-frame tw-tiddler-edit-frame $(missingTiddlerClass)$ $(shadowTiddlerClass)$ $(systemTiddlerClass)$
|
||||
\end
|
||||
<div class=<<frame-classes>>><$list filter="[is[shadow]!has[draft.of]tag[$:/tags/EditTemplate]] [!is[shadow]!has[draft.of]tag[$:/tags/EditTemplate]] +[tag[$:/tags/EditTemplate]]" variable="listItem"><$transclude tiddler=<<listItem>>/></$list></div>
|
||||
<$set name="storyTiddler" value=<<currentTiddler>>><div class=<<frame-classes>>><$list filter="[is[shadow]!has[draft.of]tag[$:/tags/EditTemplate]] [!is[shadow]!has[draft.of]tag[$:/tags/EditTemplate]] +[tag[$:/tags/EditTemplate]]" variable="listItem"><$transclude tiddler=<<listItem>>/></$list></div></$set>
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
title: $:/core/ui/EditTemplate/body
|
||||
tags: $:/tags/EditTemplate
|
||||
|
||||
\define prompt()
|
||||
Type the text for this tiddler
|
||||
\end
|
||||
<$reveal state="$:/ShowEditPreview" type="match" text="yes">
|
||||
//<$transclude tiddler="$:/core/ui/EditorHint"/>// <$button type="set" set="$:/ShowEditPreview" setTo="no">hide preview</$button>
|
||||
<div class="tw-tiddler-preview">
|
||||
@@ -8,11 +11,11 @@ tags: $:/tags/EditTemplate
|
||||
<$transclude />
|
||||
</div>
|
||||
<div class="tw-tiddler-preview-edit">
|
||||
<$edit field="text" class="tw-edit-texteditor"/>
|
||||
<$edit field="text" class="tw-edit-texteditor" placeholder=<<prompt>>/>
|
||||
</div>
|
||||
</div>
|
||||
</$reveal>
|
||||
<$reveal state="$:/ShowEditPreview" type="nomatch" text="yes">
|
||||
//<$transclude tiddler="$:/core/ui/EditorHint"/>// <$button type="set" set="$:/ShowEditPreview" setTo="yes">show preview</$button>
|
||||
<$edit field="text" class="tw-edit-texteditor"/>
|
||||
<$edit field="text" class="tw-edit-texteditor" placeholder=<<prompt>>/>
|
||||
</$reveal>
|
||||
|
||||
5
core/ui/PageStylesheet.tid
Normal file
5
core/ui/PageStylesheet.tid
Normal file
@@ -0,0 +1,5 @@
|
||||
title: $:/core/ui/PageStylesheet
|
||||
|
||||
<$list filter="[is[shadow]tag[$:/tags/stylesheet]] [!is[shadow]tag[$:/tags/stylesheet]]">
|
||||
<$transclude/>
|
||||
</$list>
|
||||
@@ -3,6 +3,6 @@ title: $:/core/ui/ViewTemplate
|
||||
\define frame-classes()
|
||||
tw-tiddler-frame $(missingTiddlerClass)$ $(shadowTiddlerClass)$ $(systemTiddlerClass)$
|
||||
\end
|
||||
<$set name="tiddlerInfoState" value=<<qualify "$:/state/tiddlerInfo">>><$tiddler tiddler=<<currentTiddler>>><div class=<<frame-classes>>><$list filter="[is[shadow]!has[draft.of]tag[$:/tags/ViewTemplate]] [!is[shadow]!has[draft.of]tag[$:/tags/ViewTemplate]] +[tag[$:/tags/ViewTemplate]]" variable="listItem"><$transclude tiddler=<<listItem>>/></$list>
|
||||
<$set name="storyTiddler" value=<<currentTiddler>>><$set name="tiddlerInfoState" value=<<qualify "$:/state/tiddlerInfo">>><$tiddler tiddler=<<currentTiddler>>><div class=<<frame-classes>>><$list filter="[is[shadow]!has[draft.of]tag[$:/tags/ViewTemplate]] [!is[shadow]!has[draft.of]tag[$:/tags/ViewTemplate]] +[tag[$:/tags/ViewTemplate]]" variable="listItem"><$transclude tiddler=<<listItem>>/></$list>
|
||||
</div>
|
||||
</$tiddler></$set>
|
||||
</$tiddler></$set></$set>
|
||||
|
||||
@@ -2,7 +2,7 @@ title: GettingStarted
|
||||
|
||||
Welcome to TiddlyWiki, the non-linear personal web notebook.
|
||||
|
||||
To get started, first verify that you can save changes successfully - see http://five.tiddlywiki.com/ for detailed instructions.
|
||||
To get started, first verify that you can save changes successfully - see http://tiddlywiki.com/ for detailed instructions.
|
||||
|
||||
Then you can:
|
||||
|
||||
@@ -10,4 +10,4 @@ Then you can:
|
||||
* Save changes using the 'download' button in the sidebar
|
||||
* Edit [[DefaultTiddlers|$:/DefaultTiddlers]] to determine which tiddlers appear when you open this wiki
|
||||
* Edit the SiteTitle and SiteSubtitle
|
||||
* Learn more about [[WikiText|http://five.tiddlywiki.com/static/WikiText.html]]
|
||||
* Learn more about [[WikiText|http://tiddlywiki.com/static/WikiText.html]]
|
||||
|
||||
BIN
editions/clientserver/tiddlers/system/favicon.ico
Normal file
BIN
editions/clientserver/tiddlers/system/favicon.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 6.4 KiB |
2
editions/clientserver/tiddlers/system/favicon.ico.meta
Normal file
2
editions/clientserver/tiddlers/system/favicon.ico.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
title: $:/favicon.ico
|
||||
type: image/x-icon
|
||||
@@ -1,5 +1,5 @@
|
||||
title: HelloThere
|
||||
|
||||
This is TiddlyWiki5's browser-based test runner. See the bottom of this page for the test results.
|
||||
This is TiddlyWiki's browser-based test runner for version <<version>>. See the bottom of this page for the test results.
|
||||
|
||||
http://five.tiddlywiki.com/
|
||||
http://tiddlywiki.com/
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
created: 20130909151600000
|
||||
modified: 20131211130139832
|
||||
modified: 20131218094207015
|
||||
tags: community
|
||||
title: Community
|
||||
type: text/vnd.tiddlywiki
|
||||
@@ -24,6 +24,8 @@ The TiddlyWiki discussion groups are mailing lists for talking about TiddlyWiki:
|
||||
* A new theme from [[BobRobison|http://tw5gray.tiddlyspot.com]]
|
||||
* [[Bestrew|http://nocategories.net/tiddlywiki/bestrew.html]] -- DylanKinnett's adaptation of TiddlyWiki5 as a writers manuscript submission tracker
|
||||
* [[tw5-zh|http://tw5-zh.tiddlyspot.com]], a Chinese translation of TiddlyWiki5 by BramChen
|
||||
* [[Coding for TiddlyWiki5|http://cjhunt.github.io]], an introduction to developing extensions and plugins from ChrisHunt
|
||||
* [[Hosting TiddlyWiki5 on GoogleDrive|https://googledrive.com/host/0B51gSXixfJ2Qb0I4R2M4MWJVMlU]] from TonyChing
|
||||
|
||||
! Blog posts and articles about TiddlyWiki5
|
||||
|
||||
|
||||
@@ -1,13 +1,14 @@
|
||||
created: 201311011114
|
||||
modified: 201311301614
|
||||
created: 20131101111400000
|
||||
modified: 20131218121606089
|
||||
tags: introduction
|
||||
title: Contributing
|
||||
type: text/vnd.tiddlywiki
|
||||
|
||||
TiddlyWiki5 welcomes contributions to its code and documentation via [[GitHub|https://github.com/Jermolene/TiddlyWiki5]]. Please take a moment to read these notes to help make the process as smooth as possible.
|
||||
|
||||
!! Bug Reports
|
||||
|
||||
From the perspective of the developers, a bug report that says little more than "it doesn't work" can be frustrating. For effective debugging, we need as much information as possible. At a minimum, please try to include:
|
||||
For effective debugging, we need as much information as possible. At a minimum, please try to include:
|
||||
|
||||
* A descriptive title
|
||||
* A summary
|
||||
@@ -15,6 +16,8 @@ From the perspective of the developers, a bug report that says little more than
|
||||
* Expected behaviour
|
||||
* Context (OS, browser etc.)
|
||||
|
||||
Consider also adding screenshots if it makes things clearer.
|
||||
|
||||
There's a lot of good material on the web about bug reports:
|
||||
|
||||
* http://mhay68.tumblr.com/post/1648223018/what-makes-a-good-bug-report
|
||||
@@ -22,7 +25,7 @@ There's a lot of good material on the web about bug reports:
|
||||
|
||||
!! Pull Requests
|
||||
|
||||
Like other OpenSource projects, TiddlyWiki5 needs a signed contributor license agreement from individual contributors before contributions of code can be accepted. This is a legal agreement that allows contributors to assert that they own the copyright of their contribution, and that they agree to license it to the UnaMesa Association (the legal entity that owns TiddlyWiki on behalf of the community).
|
||||
Like other OpenSource projects, TiddlyWiki5 needs a signed contributor license agreement from individual contributors. This is a legal agreement that allows contributors to assert that they own the copyright of their contribution, and that they agree to license it to the UnaMesa Association (the legal entity that owns TiddlyWiki on behalf of the community).
|
||||
|
||||
* For individuals use: [[licenses/CLA-individual|https://github.com/Jermolene/TiddlyWiki5/tree/master/licenses/cla-individual.md]]
|
||||
* For entities use: [[licenses/CLA-entity|https://github.com/Jermolene/TiddlyWiki5/tree/master/licenses/cla-entity.md]]
|
||||
|
||||
@@ -14,14 +14,14 @@ type: text/vnd.tiddlywiki
|
||||
* Clone existing tiddlers (for example, <$button message="tw-new-tiddler" param=<<currentTiddler>>>clone this tiddler</$button>)
|
||||
* TiddlyWiki is [[surprisingly scalable|Scalability]] to many thousands of tiddlers and megabytes of content
|
||||
* Try out the <$button message="tw-full-screen">full screen support</$button>
|
||||
* Explore the [[D3.js visualisation plugin|http://five.tiddlywiki.com/d3demo.html]]
|
||||
* [[CodeMirror support via a plugin|http://five.tiddlywiki.com/codemirrordemo.html]]
|
||||
* [[Markdown support via a plugin|http://five.tiddlywiki.com/markdowndemo.html]]
|
||||
* Explore the [[D3.js visualisation plugin|http://tiddlywiki.com/d3demo.html]]
|
||||
* [[CodeMirror support via a plugin|http://tiddlywiki.com/codemirrordemo.html]]
|
||||
* [[Markdown support via a plugin|http://tiddlywiki.com/markdowndemo.html]]
|
||||
* Many internal improvements:
|
||||
** TiddlyWiki can now be run under [[Node.js]] as well as in the browser, allowing it to be used as a personal web server
|
||||
** An elegant [[microkernel architecture|PluginMechanism]], that allows infinite customisation by replacing and augmenting the core modules
|
||||
** TiddlyWiki version 5 can directly build both itself and previous (2.x.x) versions of TiddlyWiki from their constituent separate files, without needing external tools
|
||||
** Run the TiddlyWiki [[test suite|TestingMechanism]] from http://five.tiddlywiki.com/test.html
|
||||
** Run the TiddlyWiki [[test suite|TestingMechanism]] from http://tiddlywiki.com/test.html
|
||||
* Last but not least, TiddlyWiki is a rare example of a practical [[quine|Quine]]
|
||||
|
||||
The deep internal changes mean that TiddlyWiki version 5 is not compatible with previous versions, using different plugins, themes and so on. Content prepared for previous versions of TiddlyWiki will need massaging to work properly. When asking or searching for help be sure to specify TiddlyWiki5 (or TW5).
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
created: 20131129090249275
|
||||
modified: 20131212222628625
|
||||
modified: 20131215165204528
|
||||
tags: introduction
|
||||
title: GettingStarted
|
||||
type: text/vnd.tiddlywiki
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
created: 20130822170200000
|
||||
modified: 20131213101007165
|
||||
modified: 20131221173550176
|
||||
tags: introduction
|
||||
title: HelloThere
|
||||
type: text/vnd.tiddlywiki
|
||||
@@ -8,14 +8,14 @@ Welcome to TiddlyWiki, a complete interactive wiki in JavaScript. It can be used
|
||||
|
||||
This is version <<version>> of TiddlyWiki, a major reboot designed [[for the next 25 years|Future of TiddlyWiki]]. It is currently in beta (see the detailed ReleaseHistory). There is a RoadMap for moving to the full release. It is a great time to get involved and support the future development of TiddlyWiki.
|
||||
|
||||
//TiddlyWiki is a free, open source project that depends on [[your love and support|HelpingTiddlyWiki]] for their survival//.
|
||||
//TiddlyWiki is a free, open source project that depends on [[your love and support|HelpingTiddlyWiki]] for its survival//.
|
||||
|
||||
<div class="tw-message-box">
|
||||
<a class="tw-message-icon" href="http://tiddlywiki.com/" target="_blank">{{TiddlyWiki Classic.png}}</a>
|
||||
|
||||
!! TiddlyWikiClassic - http://classic.tiddlywiki.com
|
||||
|
||||
On this site, unless noted otherwise, "~TiddlyWiki" refers to the new version 5, and ~TiddlyWikiClassic is used to identify the older version.
|
||||
On this site, unless noted otherwise, "~TiddlyWiki" refers to the new version 5, and "~TiddlyWikiClassic" is used to identify the older version.
|
||||
|
||||
The deep internal improvements mean that the new version of TiddlyWiki is not fully compatible with TiddlyWikiClassic. Existing content will need massaging, while plugins and themes will have to be completely rewritten. The upgrade path will get smoother as the new version matures.
|
||||
</div>
|
||||
|
||||
@@ -3,6 +3,7 @@ modified: 20131215142414174
|
||||
tags: releasenote
|
||||
title: Release 5.0.2-beta
|
||||
type: text/vnd.tiddlywiki
|
||||
released: 201312151436
|
||||
|
||||
//[[See GitHub for detailed change history of this release|https://github.com/Jermolene/TiddlyWiki5/compare/v5.0.1-alpha...v5.0.2-beta]]//
|
||||
|
||||
|
||||
10
editions/tw5.com/tiddlers/Release 5.0.3beta.tid
Normal file
10
editions/tw5.com/tiddlers/Release 5.0.3beta.tid
Normal file
@@ -0,0 +1,10 @@
|
||||
created: 201312151700
|
||||
modified: 201312151700
|
||||
tags: releasenote
|
||||
title: Release 5.0.3-beta
|
||||
type: text/vnd.tiddlywiki
|
||||
released: 201312151700
|
||||
|
||||
//[[See GitHub for detailed change history of this release|https://github.com/Jermolene/TiddlyWiki5/compare/v5.0.2-beta...v5.0.3-beta]]//
|
||||
|
||||
This release includes minor bug fixes and documentation updates.
|
||||
30
editions/tw5.com/tiddlers/Release 5.0.4beta.tid
Normal file
30
editions/tw5.com/tiddlers/Release 5.0.4beta.tid
Normal file
@@ -0,0 +1,30 @@
|
||||
created: 20131216100000000
|
||||
modified: 20131221205551616
|
||||
tags: releasenote
|
||||
title: Release 5.0.4-prerelease
|
||||
type: text/vnd.tiddlywiki
|
||||
released: 201312221544
|
||||
|
||||
//[[See GitHub for detailed change history of this release|https://github.com/Jermolene/TiddlyWiki5/compare/v5.0.3-beta...v5.0.4-beta]]//
|
||||
|
||||
!! Improvements
|
||||
|
||||
* Switched to using an HTML5 placeholder for the default text of a new tiddler
|
||||
* Refactored stylesheet handling so that theme tweaks are now applied immediately, and some ordering issues have been resolved
|
||||
* Several improvements for running [[TiddlyWiki on Node.js]]:
|
||||
** The `tiddlywiki.info` file in the root of [[wiki folder|TiddlyWikiFolders]] file is now optional, falling back to a default configuration suitable for serverside use ([[commit|https://github.com/Jermolene/TiddlyWiki5/commit/0ec2224757dd07f009246ec9ea97cd859d077e72]])
|
||||
** The file system plugin now automatically creates the `tiddlers` subfolder in the [[wiki folder|TiddlyWikiFolders]]
|
||||
* Added [[favicon.ico support|Using favicons]]
|
||||
* Added SaveTiddlerCommand
|
||||
|
||||
!! Bug Fixes
|
||||
|
||||
* Fixed problem with tiddlers sometimes wrongly opening at the top of the story ([[commit|https://github.com/Jermolene/TiddlyWiki5/commit/b50eb8da302431cdfa7c37ac9ef1414a33d00292]])
|
||||
* Fixed problem with refreshing RadioWidget
|
||||
* Fixed problem with the dragger image being visible in some circumstances
|
||||
* Fixed drag and drop support on InternetExplorer, contributed by DavidJade (@davidjade on GitHub)
|
||||
* Fixed crash on modifying page template ([[commit|https://github.com/Jermolene/TiddlyWiki5/commit/a5f33d875b1339b08838203a4885f8a3a7d10353]])
|
||||
* Updated fullscreen plugin to latest version of the API ([[commit|https://github.com/Jermolene/TiddlyWiki5/commit/638c8b207033f8cb01ac9efdca104d282fd4cffe]])
|
||||
* Improved handling of double square brackets within tags (thanks to StephanHradek)
|
||||
|
||||
This release includes minor bug fixes and documentation updates.
|
||||
@@ -1,16 +1,16 @@
|
||||
created: 20131202102427114
|
||||
modified: 20131212094500689
|
||||
modified: 20131219100250559
|
||||
tags: howto
|
||||
title: Upgrading
|
||||
type: text/vnd.tiddlywiki
|
||||
|
||||
There are several methods for upgrading an existing TiddlyWiki document to a new release.
|
||||
There are several methods for upgrading an existing TiddlyWiki document to a new release. There is a [[different procedure|Upgrading TiddlyWiki on Node.js]] for upgrading [[TiddlyWiki on Node.js]].
|
||||
|
||||
! Online upgrading
|
||||
|
||||
Note that none of your personal data leaves your browser with this process.
|
||||
|
||||
# Visit http://five.tiddlywiki.com/empty.html
|
||||
# Visit http://tiddlywiki.com/empty.html
|
||||
# Drag your old TiddlyWiki HTML file into the browser window
|
||||
#* Your tiddlers should be imported
|
||||
# Save changes to save the new version.
|
||||
@@ -22,13 +22,13 @@ This will download a file called ''empty.html'' to your computer. This file is t
|
||||
># Open the control panel to the ''Plugins'' tab in your upgraded wiki
|
||||
># Check the version numbers of the plugins you are using; any plugins with an older version than the version of [[$:/core]] will probably need updating
|
||||
># Locate a wiki with the plugins you need to update and open the control panel ''Plugins'' tab
|
||||
>#* http://five.tiddlywiki.com/d3demo.html for the D3 plugin
|
||||
>#* http://five.tiddlywiki.com/codemirrordemo.html for the CodeMirror plugin
|
||||
>#* http://five.tiddlywiki.com/markdowndemo.html for the MarkDown plugin
|
||||
>#* http://five.tiddlywiki.com/ for most of the others
|
||||
>#* http://tiddlywiki.com/d3demo.html for the D3 plugin
|
||||
>#* http://tiddlywiki.com/codemirrordemo.html for the CodeMirror plugin
|
||||
>#* http://tiddlywiki.com/markdowndemo.html for the MarkDown plugin
|
||||
>#* http://tiddlywiki.com/ for most of the others
|
||||
># Drag the plugin links one by one back to your own wiki. You should see the version numbers update in the control panel
|
||||
># Save your wiki
|
||||
|
||||
! Offline upgrading
|
||||
|
||||
You can also download http://five.tiddlywiki.com/empty.html locally and perform the same drag-and-drop procedure to upgrade your files.
|
||||
You can also download http://tiddlywiki.com/empty.html locally and perform the same drag-and-drop procedure to upgrade your files.
|
||||
|
||||
10
editions/tw5.com/tiddlers/commands/SaveTiddlerCommand.tid
Normal file
10
editions/tw5.com/tiddlers/commands/SaveTiddlerCommand.tid
Normal file
@@ -0,0 +1,10 @@
|
||||
title: SaveTiddlerCommand
|
||||
tags: command
|
||||
created: 20131218121606089
|
||||
modified: 20131218121606089
|
||||
|
||||
Saves an individual tiddler in its raw text or binary format to the specified filename.
|
||||
|
||||
```
|
||||
--savetiddler <title> <filename>
|
||||
```
|
||||
@@ -1,7 +1,10 @@
|
||||
title: ServerCommand
|
||||
created: 20131219163923630
|
||||
modified: 20131222150651114
|
||||
tags: command
|
||||
title: ServerCommand
|
||||
type: text/vnd.tiddlywiki
|
||||
|
||||
The server built in to TiddlyWiki5 is very simple. Although compatible with TiddlyWeb it doesn't support many of the features needed for robust Internet-facing usage - in particular, TiddlyWiki5 is an old-school wiki in the sense that it offers no authentication.
|
||||
The server built in to TiddlyWiki5 is very simple. Although compatible with TiddlyWeb it doesn't support many of the features needed for robust Internet-facing usage.
|
||||
|
||||
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`.
|
||||
|
||||
@@ -12,7 +15,7 @@ At the root, it serves a rendering of a specified tiddler. Away from the root, i
|
||||
The parameters are:
|
||||
|
||||
* ''port'' - port number to serve from (defaults to "8080")
|
||||
* ''roottiddler'' - the tiddler to serve at the root (defaults to "$:/core/tiddlywiki5.template.html")
|
||||
* ''roottiddler'' - the tiddler to serve at the root (defaults to "$:/core/save/all")
|
||||
* ''rendertype'' - the content type to which the root tiddler should be rendered (defaults to "text/plain")
|
||||
* ''servetype'' - the content type with which the root tiddler should be served (defaults to "text/html")
|
||||
* ''username'' - the default username for signing edits
|
||||
@@ -23,5 +26,7 @@ If the password parameter is specified then the browser will prompt the user for
|
||||
For example:
|
||||
|
||||
```
|
||||
--server 8080 $:/core/tiddlywiki5.template.html text/plain text/html MyUserName
|
||||
--server 8080 $:/core/save/all text/plain text/html MyUserName passw0rd
|
||||
```
|
||||
|
||||
To run multiple TiddlyWiki servers at the same time you'll need to put each one on a different port.
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
created: 20131222152210279
|
||||
modified: 20131222153004673
|
||||
tags: definitions
|
||||
title: TiddlyWikiClassic
|
||||
type: text/vnd.tiddlywiki
|
||||
|
||||
"~TiddlyWiki Classic" refers to versions prior to 5.0, when TiddlyWiki was completely rewritten from the ground up. TiddlyWiki Classic is still being maintained at:
|
||||
|
||||
http://classic.tiddlywiki.com/
|
||||
@@ -0,0 +1,24 @@
|
||||
created: 20131219100608529
|
||||
modified: 20131219163547622
|
||||
tags: howto
|
||||
title: Installing TiddlyWiki on Node.js
|
||||
type: text/vnd.tiddlywiki
|
||||
|
||||
# Install [[Node.js]] from http://npmjs.org
|
||||
# Open a command line terminal and type:
|
||||
#> `npm -g install tiddlywiki`
|
||||
#> If it fails with an error you may need to re-run the command as an administrator:
|
||||
#> `sudo npm -g install tiddlywiki`
|
||||
# Check TiddlyWiki is installed by typing:
|
||||
#> `tiddlywiki --version`
|
||||
# In response, you should see TiddlyWiki report its current version (eg `5.0.4-beta`; you may also see other debugging information reported)
|
||||
# Try it out:
|
||||
## `mkdir mywiki` to create a folder for a new wiki
|
||||
## `cd mywiki` to move into the new folder
|
||||
## `tiddlywiki --server` to start TiddlyWiki
|
||||
## Visit http://0.0.0.0:8080/ in your browser
|
||||
## Try editing and creating tiddlers
|
||||
|
||||
The `-g` flag causes TiddlyWiki to be installed globally. Without it, TiddlyWiki will only be available in the directory where you installed it.
|
||||
|
||||
A slightly different method for installation is recommended if you plan on forking the source code in order to study it or contribute to it. See [[Working with the TiddlyWiki5 repository]].
|
||||
@@ -0,0 +1,61 @@
|
||||
created: 20131219100637788
|
||||
modified: 20131219100657540
|
||||
tags: howto dev
|
||||
title: Scripts for TiddlyWiki on Node.js
|
||||
type: text/vnd.tiddlywiki
|
||||
|
||||
! Script Files
|
||||
|
||||
The TiddlyWiki5 repo contains several scripts that are used to build and deploy TiddlyWiki5 (.sh for *nix and .cmd for Windows). They can serve as a useful starting point for your own scripts.
|
||||
|
||||
!! `bld`: builds tw5.com
|
||||
|
||||
This script builds several variants of TiddlyWiki5 for deployment on tiddlywiki.com.
|
||||
|
||||
By default, files are output to a folder called `jermolene.github.com`, sibling to the TiddlyWiki5 repo directory. For example:
|
||||
|
||||
```
|
||||
/TiddlyWork/ - Directory for working with TiddlyWiki5
|
||||
/TiddlyWiki5/ - Directory containing the TiddlyWiki5 repo from GitHub
|
||||
/jermolene.github.com/ - Directory for output files
|
||||
```
|
||||
|
||||
You can override the build output directory by defining the environment variable `TW5_BUILD_OUTPUT`. The easiest way to do this is to create a personal batch file to invoke TiddlyWiki5 that first sets the environment variable and then invokes `bld`.
|
||||
|
||||
The files output by `bld` are:
|
||||
|
||||
* `readme.md` main readme file, output to the TiddlyWiki5 directory
|
||||
* `index.html` TiddlyWiki5 standalone HTML file with content from the `tw5.com` edition
|
||||
* `empty.html` TiddlyWiki5 standalone HTML file with no content
|
||||
* `encrypted.html` TiddlyWiki5 standalone HTML file encrypted with the password `password`
|
||||
* `test.html` TiddlyWiki5 browser-based test suite (see TestingMechanism)
|
||||
* `static.html` static HTML version of the DefaultTiddlers of the `tw5.com` edition
|
||||
* `static/*.html` and `static/static.css` static HTML versions of individual tiddlers
|
||||
|
||||
`bld` also runs the TiddlyWiki5 Node.js-based test suite (see TestingMechanism)
|
||||
|
||||
!! `serve`: serves tw5.com
|
||||
|
||||
```
|
||||
serve.sh <username> [<password>]
|
||||
```
|
||||
|
||||
Or:
|
||||
|
||||
```
|
||||
serve.cmd <username> [<password>]
|
||||
```
|
||||
|
||||
This script starts TiddlyWiki5 running as an HTTP server with the content from the `clientserver` edition. By default, the Node.js serves on port 8080. If the optional `username` parameter is provided, it is used for signing edits. If the `password` is provided then HTTP basic authentication is used.
|
||||
|
||||
To experiment with this configuration, run the script and then visit `http://0.0.0.0:8080` in a browser.
|
||||
|
||||
Changes made in the browser propagate to the server over HTTP (use the browser developer console to see these requests). The server then syncs changes to the file system (and logs each change to the screen).
|
||||
|
||||
!! `wbld`: builds TiddlyWiki5 for TiddlyWeb
|
||||
|
||||
This script builds and deploys the code for [[TiddlyWiki5 in the Sky for TiddlyWeb]]. If you want to experiment with your own builds of TiddlyWiki5 for TiddlyWeb you could use this batch file as a base.
|
||||
|
||||
!! `2bld`: builds TiddlyWiki 2.6.5
|
||||
|
||||
This script builds TiddlyWiki 2.6.5 from the original source and then displays the differences between them (`diff` is used for *nix, `fc` for Windows).
|
||||
@@ -1,18 +1,28 @@
|
||||
created: 20131129094353704
|
||||
modified: 20131212094217023
|
||||
modified: 20131219100410583
|
||||
title: TiddlyWiki on Node.js
|
||||
type: text/vnd.tiddlywiki
|
||||
|
||||
Running TiddlyWiki on [[Node.js]] brings several important benefits over and above the single file version:
|
||||
|
||||
* You can edit your content on any suitably compatible HTML5 browser, including smartphones and tablets
|
||||
* Individual tiddlers are stored in separate files, which you can organise as you wish
|
||||
* The ability to build multiple wikis that blend different combinations of shared and unique content
|
||||
|
||||
! Installation
|
||||
|
||||
For working on the command line with Node.js, you can install TiddlyWiki via [[npm|http://npmjs.org]]:
|
||||
{{Installing TiddlyWiki on Node.js}}
|
||||
|
||||
```
|
||||
npm -g install tiddlywiki
|
||||
```
|
||||
! Usage
|
||||
|
||||
The `-g` flag causes TiddlyWiki to be installed globally.
|
||||
{{Using TiddlyWiki on Node.js}}
|
||||
|
||||
! Working with the TiddlyWiki5 repository
|
||||
! Upgrading
|
||||
|
||||
[[Working with the TiddlyWiki5 repository]] is recommended if you plan on forking the TiddlyWiki5 source code.
|
||||
{{Upgrading TiddlyWiki on Node.js}}
|
||||
|
||||
! Commands
|
||||
|
||||
The following commands are available:
|
||||
|
||||
<ul><$list filter="[tag[command]]"><li><$link to={{!!title}}><$view field="title"/></$link></li></$list></ul>
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
created: 20131219100544073
|
||||
modified: 20131219100558017
|
||||
tags: howto
|
||||
title: Upgrading TiddlyWiki on Node.js
|
||||
type: text/vnd.tiddlywiki
|
||||
|
||||
If you've installed [[TiddlyWiki on Node.js]] on the usual way, when a new version is released you can upgrade it with this command:
|
||||
|
||||
```
|
||||
sudo npm -g upgrade tiddlywiki
|
||||
```
|
||||
@@ -0,0 +1,27 @@
|
||||
created: 20131219100520659
|
||||
modified: 20131219163807594
|
||||
tags: howto
|
||||
title: Using TiddlyWiki on Node.js
|
||||
type: text/vnd.tiddlywiki
|
||||
|
||||
TiddlyWiki5 can be used on the command line to perform an extensive set of operations based on TiddlyWikiFolders, TiddlerFiles and TiddlyWikiFiles.
|
||||
|
||||
For example, the following command loads the tiddlers from a TiddlyWiki HTML file and then saves one of them in static HTML:
|
||||
|
||||
```
|
||||
tiddlywiki --verbose --load mywiki.html --rendertiddler ReadMe ./readme.html
|
||||
```
|
||||
|
||||
Running `tiddlywiki` from the command line boots the TiddlyWiki kernel, loads the core plugins and establishes an empty wiki store. It then sequentially processes the command line arguments from left to right. The arguments are separated with spaces.
|
||||
|
||||
The first argument is the optional path to the [[TiddlyWikiFolder|TiddlyWikiFolders]] to be loaded. If not present, then the current directory is used.
|
||||
|
||||
The commands and their individual arguments follow, each command being identified by the prefix `--`.
|
||||
|
||||
```
|
||||
tiddlywiki [<wikipath>] [--<command> [<arg>[,<arg>]]]
|
||||
```
|
||||
|
||||
The available commands are:
|
||||
|
||||
<ul><$list filter="[tag[command]]"><li><$link to={{!!title}}><$view field="title"/></$link></li></$list></ul>
|
||||
@@ -1,80 +1,18 @@
|
||||
created: 20130825214500000
|
||||
modified: 20131129095206930
|
||||
tags: edition
|
||||
created: 20131219100444289
|
||||
modified: 20131219163213430
|
||||
tags: dev howto
|
||||
title: Working with the TiddlyWiki5 repository
|
||||
type: text/vnd.tiddlywiki
|
||||
|
||||
TiddlyWiki5 can be used on the command line to perform an extensive set of operations based on tiddlers, TiddlyWikiFolders, TiddlerFiles and TiddlyWikiFiles. For example, the following command loads the tiddlers from a TiddlyWiki HTML file and then saves one of them in HTML:
|
||||
! Setting Up
|
||||
|
||||
```
|
||||
node tiddlywiki.js --verbose --load mywiki.html --rendertiddler ReadMe ./readme.html
|
||||
```
|
||||
If you plan on working with the TiddlyWiki5 source code then follow these steps:
|
||||
|
||||
In order to use TiddlyWiki5 on the command line you must first install node.js from http://nodejs.org/
|
||||
# Fork the TiddlyWiki5 GitHub repository from https://github.com/Jermolene/TiddlyWiki5
|
||||
# Clone a local copy of your fork
|
||||
# Open a command line terminal and change the current working directory to the root of the repo
|
||||
# Type `sudo npm link` to tell [[npm]] to use this copy of the repo as the globally installed one
|
||||
|
||||
!!Usage
|
||||
After this procedure you can work with TiddlyWiki5 via [[npm]] as though it were installed in the usual way with `npm -g install tiddlywiki`.
|
||||
|
||||
Running `tiddlywiki.js` from the command line boots the TiddlyWiki kernel, loads the core plugins and establishes an empty wiki store. It then sequentially processes the command line arguments from left to right. The arguments are separated with spaces.
|
||||
|
||||
The first argument is the optional path to the [[TiddlyWikiFolder|TiddlyWikiFolders]] to be loaded. If not present, then the current directory is used.
|
||||
|
||||
The commands and their individual arguments follow, each command being identified by the prefix `--`.
|
||||
|
||||
```
|
||||
node tiddlywiki.js [<wikipath>] [--<command> [<arg>[,<arg>]]]
|
||||
```
|
||||
|
||||
!! Script Files
|
||||
|
||||
For trying TiddlyWiki5 out under Node.js, several scripts are provided (.sh for *nix and .cmd for Windows):
|
||||
|
||||
!!! `bld`: builds tw5.com
|
||||
|
||||
This script builds several variants of TiddlyWiki5 for deployment on tiddlywiki.com.
|
||||
|
||||
By default, files are output to a folder called `jermolene.github.com`, sibling to the TiddlyWiki5 source directory. For example:
|
||||
|
||||
```
|
||||
/TiddlyWork/ - Directory for working with TiddlyWiki5
|
||||
/TiddlyWiki5/ - Directory containing the TiddlyWiki5 repo from GitHub
|
||||
/jermolene.github.com/ - Directory for output files
|
||||
```
|
||||
|
||||
You can override the build output directory by defining the environment variable `TW5_BUILD_OUTPUT`. The easiest way to do this is to create a personal batch file to invoke TiddlyWiki5 that first sets the environment variable and then invokes `bld`.
|
||||
|
||||
The files output by `bld` are:
|
||||
|
||||
* `readme.md` main readme file, output to the TiddlyWiki5 directory
|
||||
* `index.html` TiddlyWiki5 standalone HTML file with content from the `tw5.com` edition
|
||||
* `empty.html` TiddlyWiki5 standalone HTML file with no content
|
||||
* `encrypted.html` TiddlyWiki5 standalone HTML file encrypted with the password `password`
|
||||
* `test.html` TiddlyWiki5 browser-based test suite (see TestingMechanism)
|
||||
* `static.html` static HTML version of the DefaultTiddlers of the `tw5.com` edition
|
||||
* `static/*.html` and `static/static.css` static HTML versions of individual tiddlers
|
||||
|
||||
`bld` also runs the TiddlyWiki5 Node.js-based test suite (see TestingMechanism)
|
||||
|
||||
!!! `serve.sh <username>` or `serve.cmd <username>`: serves tw5.com
|
||||
|
||||
This script starts TiddlyWiki5 running as an HTTP server with the content from the `clientserver` edition. By default, the Node.js serves on port 8080. If the optional `username` parameter is provided, it is used for signing edits.
|
||||
|
||||
To experiment with this configuration, run the script and then visit `http://0.0.0.0:8080` in a browser.
|
||||
|
||||
Changes made in the browser propagate to the server over HTTP (use the browser developer console to see these requests). The server then syncs changes to the file system (and logs each change to the screen).
|
||||
|
||||
!!! `wbld`: builds TiddlyWiki5 for TiddlyWeb
|
||||
|
||||
This script builds and deploys the code for [[TiddlyWiki5 in the Sky for TiddlyWeb]]. If you want to experiment with your own builds of TiddlyWiki5 for TiddlyWeb you could use this batch file as a base.
|
||||
|
||||
!!! `2bld`: builds TiddlyWiki 2.6.5
|
||||
|
||||
This script builds TiddlyWiki 2.6.5 from the original source and then displays the differences between them (`diff` is used for *nix, `fc` for Windows).
|
||||
|
||||
!!Commands
|
||||
|
||||
The following commands are available:
|
||||
|
||||
<$list filter="[tag[command]sort[title]]">
|
||||
!!! <$view field="title" format="link"/>
|
||||
<$transclude />
|
||||
</$list>
|
||||
See also [[Scripts for TiddlyWiki on Node.js]].
|
||||
@@ -20,7 +20,7 @@ It saves the tiddler ReadMe to the file `./readme.md` in the `text/html` format.
|
||||
By default, tiddler links will be rendered as `<a>` links to a relative URI consisting of the title of the tiddler. This behaviour can be overridden by defining the macro `tw-wikilink-template`, as is done at the top of the tiddler ReadMe:
|
||||
|
||||
```
|
||||
\define tw-wikilink-template() http://five.tiddlywiki.com/static/$uri_encoded$.html
|
||||
\define tw-wikilink-template() http://tiddlywiki.com/static/$uri_encoded$.html
|
||||
```
|
||||
|
||||
See the LinkWidget for more details.
|
||||
|
||||
BIN
editions/tw5.com/tiddlers/images/favicon.ico
Normal file
BIN
editions/tw5.com/tiddlers/images/favicon.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 6.4 KiB |
2
editions/tw5.com/tiddlers/images/favicon.ico.meta
Normal file
2
editions/tw5.com/tiddlers/images/favicon.ico.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
title: $:/favicon.ico
|
||||
type: image/x-icon
|
||||
@@ -33,4 +33,4 @@ node ./tiddlywiki.js \
|
||||
|
||||
Then, open the `test.html` file in the browser to see the test results. There is a prebuilt version of `test.html` at:
|
||||
|
||||
http://five.tiddlywiki.com/test.html
|
||||
http://tiddlywiki.com/test.html
|
||||
|
||||
@@ -2,7 +2,7 @@ created: 201308251449
|
||||
modified: 201308251449
|
||||
title: ContributingTemplate
|
||||
|
||||
\define tw-wikilink-template() http://five.tiddlywiki.com/static/$uri_encoded$.html
|
||||
\define tw-wikilink-template() http://tiddlywiki.com/static/$uri_encoded$.html
|
||||
! Contributing to TiddlyWiki5
|
||||
|
||||
{{Contributing}}
|
||||
|
||||
@@ -3,7 +3,7 @@ modified: 20131129094808390
|
||||
title: ReadMe
|
||||
type: text/vnd.tiddlywiki
|
||||
|
||||
\define tw-wikilink-template() http://five.tiddlywiki.com/static/$uri_encoded$.html
|
||||
\define tw-wikilink-template() http://tiddlywiki.com/static/$uri_encoded$.html
|
||||
! Welcome to TiddlyWiki5
|
||||
|
||||
{{HelloThere}}
|
||||
|
||||
@@ -9,7 +9,7 @@ TiddlySpot is a free hosting service for TiddlyWiki documents from Simon and Dan
|
||||
TiddlyWiki5 isn't yet built in to TiddlySpot but you can use it by following these steps:
|
||||
|
||||
# Sign up for a new wiki at http://tiddlyspot.com/, and remember the wiki name and password
|
||||
# Open TiddlyWiki5 in your browser from http://five.tiddlywiki.com/empty.html
|
||||
# Open TiddlyWiki5 in your browser from http://tiddlywiki.com/empty.html
|
||||
# Fill in the TiddlySpot wikiname and password in the control panel
|
||||
# Click the "Save Changes" button. You should get a confirmation notification at the top right saying ''Saved wiki''. Saving can take several seconds if you're on a slow connection or working with a large wiki.
|
||||
#* //This step won't work in Firefox thanks to its default security policy. Google Chrome works fine//
|
||||
|
||||
@@ -11,7 +11,7 @@ Instructions for use:
|
||||
# Open TWEdit
|
||||
# Touch the title in the centre of the toolbar in order
|
||||
#* A text box should appear allowing you to enter a URL
|
||||
# Enter the URL `http://five.tiddlywiki.com/empty.html`
|
||||
# Enter the URL `http://tiddlywiki.com/empty.html`
|
||||
# When the empty TiddlyWiki5 has loaded, touch the ''save'' icon (it's the second icon from the right on the top toolbar)
|
||||
#* An alert box should appear allowing you to enter a local filename
|
||||
# Enter the filename you wish to use for the document (ending with `.html`)
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
created: 20131129092753119
|
||||
modified: 20131205151815248
|
||||
created: 20131221085742684
|
||||
modified: 20131221091154254
|
||||
tags: howto
|
||||
title: Saving with TiddlyFox
|
||||
type: text/vnd.tiddlywiki
|
||||
|
||||
# Ensure you have the latest version of [[Firefox]]
|
||||
# Install the TiddlyFox extension from:
|
||||
# Install the latest release of the TiddlyFox extension from:
|
||||
#* https://addons.mozilla.org/en-US/firefox/addon/tiddlyfox/
|
||||
# Restart [[Firefox]]
|
||||
# [[Download]] an empty TiddlyWiki by clicking this button:
|
||||
@@ -19,3 +19,9 @@ type: text/vnd.tiddlywiki
|
||||
# Save your changes by clicking the {{$:/core/images/save-button}} ''download'' button in the sidebar
|
||||
#* Look for the yellow notification ''Saved wiki'' at the top right of the window
|
||||
# Refresh the browser window to verify that your changes have been saved correctly
|
||||
|
||||
You can also install the latest development version of TiddlyFox direct from GitHub:
|
||||
|
||||
https://github.com/TiddlyWiki/TiddlyFox/raw/master/tiddlyfox.xpi
|
||||
|
||||
In case of difficulties downloading the empty wiki, you can download this [[direct link to empty.html|http://tiddlywiki.com/empty.html]].
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
title: $:/StaticBanner
|
||||
|
||||
<div class="tw-static-alert"><div class="tw-static-alert-inner">This page is part of a static HTML representation of the ~TiddlyWiki at http://five.tiddlywiki.com/</div></div>
|
||||
<div class="tw-static-alert"><div class="tw-static-alert-inner">This page is part of a static HTML representation of the ~TiddlyWiki at http://tiddlywiki.com/</div></div>
|
||||
|
||||
@@ -3,7 +3,7 @@ tags: $:/tags/TiddlerInfo
|
||||
caption: Static Link
|
||||
|
||||
\define makeLink()
|
||||
http://five.tiddlywiki.com/static/<$view tiddler=<<currentTiddler>> field="title" format="doubleurlencoded"/>.html
|
||||
http://tiddlywiki.com/static/<$view tiddler=<<currentTiddler>> field="title" format="doubleurlencoded"/>.html
|
||||
\end
|
||||
\define outerMakeLink()
|
||||
<$macrocall $name="makeLink" $output="text/plain"/>
|
||||
|
||||
@@ -9,7 +9,7 @@ A key capability of WikiText is the ability to make links to other tiddlers or t
|
||||
* To link to a tiddler by title: `[[Tiddler Title]]`
|
||||
* To link to a tiddler and specify the text of the link: `[[Displayed Link Title|Tiddler Title]]`
|
||||
* For tiddler titles that match the CamelCase rules, just typing the title will automatically create a link
|
||||
* To link to an external website, type the full URL of the site: `http://five.tiddlywiki.com/` or `[[TW5|http://five.tiddlywiki.com/]]`
|
||||
* To link to an external website, type the full URL of the site: `http://tiddlywiki.com/` or `[[TW5|http://tiddlywiki.com/]]`
|
||||
|
||||
You can suppress a link from being recognised by preceding it with `~`. For example:
|
||||
|
||||
|
||||
@@ -124,3 +124,5 @@ David Jade, @davidjade, 2013/11/30
|
||||
Stephan Hradek, @Skeeve, 2013/11/30
|
||||
|
||||
Brian Shaver, @shakerlxxv, 2013/12/07
|
||||
|
||||
Paul Bond, @willover, 2013/12/17
|
||||
|
||||
1
node_modules/.bin/md2html
generated
vendored
1
node_modules/.bin/md2html
generated
vendored
@@ -1 +0,0 @@
|
||||
../markdown/bin/md2html.js
|
||||
2
node_modules/markdown/.npmignore
generated
vendored
2
node_modules/markdown/.npmignore
generated
vendored
@@ -1,2 +0,0 @@
|
||||
.seed.yml
|
||||
test
|
||||
7
node_modules/markdown/.travis.yml
generated
vendored
7
node_modules/markdown/.travis.yml
generated
vendored
@@ -1,7 +0,0 @@
|
||||
language: node_js
|
||||
node_js:
|
||||
- "0.6"
|
||||
- "0.8"
|
||||
- "0.9"
|
||||
- "0.10"
|
||||
- "0.11"
|
||||
35
node_modules/markdown/Changes.markdown
generated
vendored
35
node_modules/markdown/Changes.markdown
generated
vendored
@@ -1,35 +0,0 @@
|
||||
# Changelog for markdown
|
||||
|
||||
## v0.5.0 - 2013-07-26
|
||||
|
||||
There might be other bug fixes then the ones listed - I've been a bit lax at
|
||||
updating the changes file, sorry :(
|
||||
|
||||
- Fix 'undefined' appearing in output for some cases with blockquotes
|
||||
- Fix (multiple) global variable leaks. Ooops
|
||||
- Fix IE8 issues (#68, #74, #97)
|
||||
- Fix IE8 issue (#86)
|
||||
- Handle windows line endings (#58)
|
||||
- Allow spaces in img/link paths (#48)
|
||||
- Add explicit text of the license to the readme (#74)
|
||||
- Style tweaks by Xhmikosr (#83, #81, #82)
|
||||
- Build now tested by TravisCI thanks to sebs (#85)
|
||||
- Fix 'cuddled' header parsing (#94)
|
||||
- Fix images inside links mistakenly requiring a title attribute to parse
|
||||
correctly (#71)
|
||||
|
||||
|
||||
## v0.4.0 - 2012-06-09
|
||||
|
||||
- Fix for anchors enclosed by parenthesis (issue #46)
|
||||
- `npm test` will now run the entire test suite cleanly. (switch tests over to
|
||||
node-tap). (#21)
|
||||
- Allow inline elements to appear inside link text (#27)
|
||||
- Improve link parsing when link is inside parenthesis (#38)
|
||||
- Actually render image references (#36)
|
||||
- Improve link parsing when multiple on a line (#5)
|
||||
- Make it work in IE7/8 (#37)
|
||||
- Fix blockquote merging/implicit conversion between string/String (#44, #24)
|
||||
- md2html can now process stdin (#43)
|
||||
- Fix jslint warnings (#42)
|
||||
- Fix to correctly render self-closing tags (#40, #35, #28)
|
||||
185
node_modules/markdown/README.markdown
generated
vendored
185
node_modules/markdown/README.markdown
generated
vendored
@@ -1,185 +0,0 @@
|
||||
# markdown-js
|
||||
|
||||
Yet another markdown parser, this time for JavaScript. There's a few
|
||||
options that precede this project but they all treat markdown to HTML
|
||||
conversion as a single step process. You pass markdown in and get HTML
|
||||
out, end of story. We had some pretty particular views on how the
|
||||
process should actually look, which include:
|
||||
|
||||
* producing well-formed HTML. This means that `em` and `strong` nesting
|
||||
is important, as is the ability to output as both HTML and XHTML
|
||||
|
||||
* having an intermediate representation to allow processing of parsed
|
||||
data (we in fact have two, both [JsonML]: a markdown tree and an HTML tree)
|
||||
|
||||
* being easily extensible to add new dialects without having to
|
||||
rewrite the entire parsing mechanics
|
||||
|
||||
* having a good test suite. The only test suites we could find tested
|
||||
massive blocks of input, and passing depended on outputting the HTML
|
||||
with exactly the same whitespace as the original implementation
|
||||
|
||||
[JsonML]: http://jsonml.org/ "JSON Markup Language"
|
||||
|
||||
## Installation
|
||||
|
||||
Just the `markdown` library:
|
||||
|
||||
npm install markdown
|
||||
|
||||
Optionally, install `md2html` into your path
|
||||
|
||||
npm install -g markdown
|
||||
|
||||
## Usage
|
||||
|
||||
### Node
|
||||
|
||||
The simple way to use it with node is:
|
||||
|
||||
```js
|
||||
var markdown = require( "markdown" ).markdown;
|
||||
console.log( markdown.toHTML( "Hello *World*!" ) );
|
||||
```
|
||||
|
||||
### Browser
|
||||
|
||||
It also works in a browser; here is a complete example:
|
||||
|
||||
```html
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<body>
|
||||
<textarea id="text-input" oninput="this.editor.update()"
|
||||
rows="6" cols="60">Type **Markdown** here.</textarea>
|
||||
<div id="preview"> </div>
|
||||
<script src="lib/markdown.js"></script>
|
||||
<script>
|
||||
function Editor(input, preview) {
|
||||
this.update = function () {
|
||||
preview.innerHTML = markdown.toHTML(input.value);
|
||||
};
|
||||
input.editor = this;
|
||||
this.update();
|
||||
}
|
||||
var $ = function (id) { return document.getElementById(id); };
|
||||
new Editor($("text-input"), $("preview"));
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
```
|
||||
|
||||
### Command line
|
||||
|
||||
Assuming you've installed the `md2html` script (see Installation,
|
||||
above), you can convert markdown to html:
|
||||
|
||||
```bash
|
||||
# read from a file
|
||||
md2html /path/to/doc.md > /path/to/doc.html
|
||||
|
||||
# or from stdin
|
||||
echo 'Hello *World*!' | md2html
|
||||
```
|
||||
|
||||
### More options
|
||||
|
||||
If you want more control check out the documentation in
|
||||
[lib/markdown.js] which details all the methods and parameters
|
||||
available (including examples!). One day we'll get the docs generated
|
||||
and hosted somewhere for nicer browsing.
|
||||
|
||||
[lib/markdown.js]: http://github.com/evilstreak/markdown-js/blob/master/lib/markdown.js
|
||||
|
||||
Meanwhile, here's an example of using the multi-step processing to
|
||||
make wiki-style linking work by filling in missing link references:
|
||||
|
||||
```js
|
||||
var md = require( "markdown" ).markdown,
|
||||
text = "[Markdown] is a simple text-based [markup language]\n" +
|
||||
"created by [John Gruber]\n\n" +
|
||||
"[John Gruber]: http://daringfireball.net";
|
||||
|
||||
// parse the markdown into a tree and grab the link references
|
||||
var tree = md.parse( text ),
|
||||
refs = tree[ 1 ].references;
|
||||
|
||||
// iterate through the tree finding link references
|
||||
( function find_link_refs( jsonml ) {
|
||||
if ( jsonml[ 0 ] === "link_ref" ) {
|
||||
var ref = jsonml[ 1 ].ref;
|
||||
|
||||
// if there's no reference, define a wiki link
|
||||
if ( !refs[ ref ] ) {
|
||||
refs[ ref ] = {
|
||||
href: "http://en.wikipedia.org/wiki/" + ref.replace(/\s+/, "_" )
|
||||
};
|
||||
}
|
||||
}
|
||||
else if ( Array.isArray( jsonml[ 1 ] ) ) {
|
||||
jsonml[ 1 ].forEach( find_link_refs );
|
||||
}
|
||||
else if ( Array.isArray( jsonml[ 2 ] ) ) {
|
||||
jsonml[ 2 ].forEach( find_link_refs );
|
||||
}
|
||||
} )( tree );
|
||||
|
||||
// convert the tree into html
|
||||
var html = md.renderJsonML( md.toHTMLTree( tree ) );
|
||||
console.log( html );
|
||||
```
|
||||
|
||||
## Intermediate Representation
|
||||
|
||||
Internally the process to convert a chunk of markdown into a chunk of
|
||||
HTML has three steps:
|
||||
|
||||
1. Parse the markdown into a JsonML tree. Any references found in the
|
||||
parsing are stored in the attribute hash of the root node under the
|
||||
key `references`.
|
||||
|
||||
2. Convert the markdown tree into an HTML tree. Rename any nodes that
|
||||
need it (`bulletlist` to `ul` for example) and lookup any references
|
||||
used by links or images. Remove the references attribute once done.
|
||||
|
||||
3. Stringify the HTML tree being careful not to wreck whitespace where
|
||||
whitespace is important (surrounding inline elements for example).
|
||||
|
||||
Each step of this process can be called individually if you need to do
|
||||
some processing or modification of the data at an intermediate stage.
|
||||
For example, you may want to grab a list of all URLs linked to in the
|
||||
document before rendering it to HTML which you could do by recursing
|
||||
through the HTML tree looking for `a` nodes.
|
||||
|
||||
## Running tests
|
||||
|
||||
To run the tests under node you will need tap installed (it's listed as a
|
||||
`devDependencies` so `npm install` from the checkout should be enough), then do
|
||||
|
||||
$ npm test
|
||||
|
||||
## Contributing
|
||||
|
||||
Do the usual github fork and pull request dance. Add yourself to the
|
||||
contributors section of [package.json](/package.json) too if you want to.
|
||||
|
||||
## License
|
||||
|
||||
Released under the MIT license.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
52
node_modules/markdown/bin/md2html.js
generated
vendored
52
node_modules/markdown/bin/md2html.js
generated
vendored
@@ -1,52 +0,0 @@
|
||||
#!/usr/bin/env node
|
||||
(function () {
|
||||
"use strict";
|
||||
|
||||
var fs = require("fs")
|
||||
, markdown = require("markdown").markdown
|
||||
, nopt = require("nopt")
|
||||
, stream
|
||||
, opts
|
||||
, buffer = ""
|
||||
;
|
||||
|
||||
opts = nopt(
|
||||
{ "dialect": [ "Gruber", "Maruku"]
|
||||
, "help": Boolean
|
||||
}
|
||||
);
|
||||
|
||||
if (opts.help) {
|
||||
var name = process.argv[1].split("/").pop()
|
||||
console.warn( require("util").format(
|
||||
"usage: %s [--dialect=DIALECT] FILE\n\nValid dialects are Gruber (the default) or Maruku",
|
||||
name
|
||||
) );
|
||||
process.exit(0);
|
||||
}
|
||||
|
||||
var fullpath = opts.argv.remain[0];
|
||||
|
||||
if (fullpath && fullpath !== "-") {
|
||||
stream = fs.createReadStream(fullpath);
|
||||
} else {
|
||||
stream = process.stdin;
|
||||
}
|
||||
stream.resume();
|
||||
stream.setEncoding("utf8");
|
||||
|
||||
stream.on("error", function(error) {
|
||||
console.error(error.toString());
|
||||
process.exit(1);
|
||||
});
|
||||
|
||||
stream.on("data", function(data) {
|
||||
buffer += data;
|
||||
});
|
||||
|
||||
stream.on("end", function() {
|
||||
var html = markdown.toHTML(buffer, opts.dialect);
|
||||
console.log(html);
|
||||
});
|
||||
|
||||
}())
|
||||
3
node_modules/markdown/lib/index.js
generated
vendored
3
node_modules/markdown/lib/index.js
generated
vendored
@@ -1,3 +0,0 @@
|
||||
// super simple module for the most common nodejs use case.
|
||||
exports.markdown = require("./markdown");
|
||||
exports.parse = exports.markdown.toHTML;
|
||||
10
node_modules/markdown/markdown-js.sublime-project
generated
vendored
10
node_modules/markdown/markdown-js.sublime-project
generated
vendored
@@ -1,10 +0,0 @@
|
||||
{
|
||||
"folders":
|
||||
[
|
||||
{
|
||||
"path": "/Users/ash/code/js/markdown-js",
|
||||
"folder_exclude_patterns": ["node_modules"],
|
||||
"file_exclude_patterns": ["*.sublime-*"]
|
||||
}
|
||||
]
|
||||
}
|
||||
1993
node_modules/markdown/markdown-js.sublime-workspace
generated
vendored
1993
node_modules/markdown/markdown-js.sublime-workspace
generated
vendored
File diff suppressed because it is too large
Load Diff
1
node_modules/markdown/node_modules/.bin/nopt
generated
vendored
1
node_modules/markdown/node_modules/.bin/nopt
generated
vendored
@@ -1 +0,0 @@
|
||||
../nopt/bin/nopt.js
|
||||
1
node_modules/markdown/node_modules/nopt/.npmignore
generated
vendored
1
node_modules/markdown/node_modules/nopt/.npmignore
generated
vendored
@@ -1 +0,0 @@
|
||||
node_modules
|
||||
23
node_modules/markdown/node_modules/nopt/LICENSE
generated
vendored
23
node_modules/markdown/node_modules/nopt/LICENSE
generated
vendored
@@ -1,23 +0,0 @@
|
||||
Copyright 2009, 2010, 2011 Isaac Z. Schlueter.
|
||||
All rights reserved.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person
|
||||
obtaining a copy of this software and associated documentation
|
||||
files (the "Software"), to deal in the Software without
|
||||
restriction, including without limitation the rights to use,
|
||||
copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the
|
||||
Software is furnished to do so, subject to the following
|
||||
conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
OTHER DEALINGS IN THE SOFTWARE.
|
||||
210
node_modules/markdown/node_modules/nopt/README.md
generated
vendored
210
node_modules/markdown/node_modules/nopt/README.md
generated
vendored
@@ -1,210 +0,0 @@
|
||||
If you want to write an option parser, and have it be good, there are
|
||||
two ways to do it. The Right Way, and the Wrong Way.
|
||||
|
||||
The Wrong Way is to sit down and write an option parser. We've all done
|
||||
that.
|
||||
|
||||
The Right Way is to write some complex configurable program with so many
|
||||
options that you go half-insane just trying to manage them all, and put
|
||||
it off with duct-tape solutions until you see exactly to the core of the
|
||||
problem, and finally snap and write an awesome option parser.
|
||||
|
||||
If you want to write an option parser, don't write an option parser.
|
||||
Write a package manager, or a source control system, or a service
|
||||
restarter, or an operating system. You probably won't end up with a
|
||||
good one of those, but if you don't give up, and you are relentless and
|
||||
diligent enough in your procrastination, you may just end up with a very
|
||||
nice option parser.
|
||||
|
||||
## USAGE
|
||||
|
||||
// my-program.js
|
||||
var nopt = require("nopt")
|
||||
, Stream = require("stream").Stream
|
||||
, path = require("path")
|
||||
, knownOpts = { "foo" : [String, null]
|
||||
, "bar" : [Stream, Number]
|
||||
, "baz" : path
|
||||
, "bloo" : [ "big", "medium", "small" ]
|
||||
, "flag" : Boolean
|
||||
, "pick" : Boolean
|
||||
, "many" : [String, Array]
|
||||
}
|
||||
, shortHands = { "foofoo" : ["--foo", "Mr. Foo"]
|
||||
, "b7" : ["--bar", "7"]
|
||||
, "m" : ["--bloo", "medium"]
|
||||
, "p" : ["--pick"]
|
||||
, "f" : ["--flag"]
|
||||
}
|
||||
// everything is optional.
|
||||
// knownOpts and shorthands default to {}
|
||||
// arg list defaults to process.argv
|
||||
// slice defaults to 2
|
||||
, parsed = nopt(knownOpts, shortHands, process.argv, 2)
|
||||
console.log(parsed)
|
||||
|
||||
This would give you support for any of the following:
|
||||
|
||||
```bash
|
||||
$ node my-program.js --foo "blerp" --no-flag
|
||||
{ "foo" : "blerp", "flag" : false }
|
||||
|
||||
$ node my-program.js ---bar 7 --foo "Mr. Hand" --flag
|
||||
{ bar: 7, foo: "Mr. Hand", flag: true }
|
||||
|
||||
$ node my-program.js --foo "blerp" -f -----p
|
||||
{ foo: "blerp", flag: true, pick: true }
|
||||
|
||||
$ node my-program.js -fp --foofoo
|
||||
{ foo: "Mr. Foo", flag: true, pick: true }
|
||||
|
||||
$ node my-program.js --foofoo -- -fp # -- stops the flag parsing.
|
||||
{ foo: "Mr. Foo", argv: { remain: ["-fp"] } }
|
||||
|
||||
$ node my-program.js --blatzk 1000 -fp # unknown opts are ok.
|
||||
{ blatzk: 1000, flag: true, pick: true }
|
||||
|
||||
$ node my-program.js --blatzk true -fp # but they need a value
|
||||
{ blatzk: true, flag: true, pick: true }
|
||||
|
||||
$ node my-program.js --no-blatzk -fp # unless they start with "no-"
|
||||
{ blatzk: false, flag: true, pick: true }
|
||||
|
||||
$ node my-program.js --baz b/a/z # known paths are resolved.
|
||||
{ baz: "/Users/isaacs/b/a/z" }
|
||||
|
||||
# if Array is one of the types, then it can take many
|
||||
# values, and will always be an array. The other types provided
|
||||
# specify what types are allowed in the list.
|
||||
|
||||
$ node my-program.js --many 1 --many null --many foo
|
||||
{ many: ["1", "null", "foo"] }
|
||||
|
||||
$ node my-program.js --many foo
|
||||
{ many: ["foo"] }
|
||||
```
|
||||
|
||||
Read the tests at the bottom of `lib/nopt.js` for more examples of
|
||||
what this puppy can do.
|
||||
|
||||
## Types
|
||||
|
||||
The following types are supported, and defined on `nopt.typeDefs`
|
||||
|
||||
* String: A normal string. No parsing is done.
|
||||
* path: A file system path. Gets resolved against cwd if not absolute.
|
||||
* url: A url. If it doesn't parse, it isn't accepted.
|
||||
* Number: Must be numeric.
|
||||
* Date: Must parse as a date. If it does, and `Date` is one of the options,
|
||||
then it will return a Date object, not a string.
|
||||
* Boolean: Must be either `true` or `false`. If an option is a boolean,
|
||||
then it does not need a value, and its presence will imply `true` as
|
||||
the value. To negate boolean flags, do `--no-whatever` or `--whatever
|
||||
false`
|
||||
* NaN: Means that the option is strictly not allowed. Any value will
|
||||
fail.
|
||||
* Stream: An object matching the "Stream" class in node. Valuable
|
||||
for use when validating programmatically. (npm uses this to let you
|
||||
supply any WriteStream on the `outfd` and `logfd` config options.)
|
||||
* Array: If `Array` is specified as one of the types, then the value
|
||||
will be parsed as a list of options. This means that multiple values
|
||||
can be specified, and that the value will always be an array.
|
||||
|
||||
If a type is an array of values not on this list, then those are
|
||||
considered valid values. For instance, in the example above, the
|
||||
`--bloo` option can only be one of `"big"`, `"medium"`, or `"small"`,
|
||||
and any other value will be rejected.
|
||||
|
||||
When parsing unknown fields, `"true"`, `"false"`, and `"null"` will be
|
||||
interpreted as their JavaScript equivalents, and numeric values will be
|
||||
interpreted as a number.
|
||||
|
||||
You can also mix types and values, or multiple types, in a list. For
|
||||
instance `{ blah: [Number, null] }` would allow a value to be set to
|
||||
either a Number or null. When types are ordered, this implies a
|
||||
preference, and the first type that can be used to properly interpret
|
||||
the value will be used.
|
||||
|
||||
To define a new type, add it to `nopt.typeDefs`. Each item in that
|
||||
hash is an object with a `type` member and a `validate` method. The
|
||||
`type` member is an object that matches what goes in the type list. The
|
||||
`validate` method is a function that gets called with `validate(data,
|
||||
key, val)`. Validate methods should assign `data[key]` to the valid
|
||||
value of `val` if it can be handled properly, or return boolean
|
||||
`false` if it cannot.
|
||||
|
||||
You can also call `nopt.clean(data, types, typeDefs)` to clean up a
|
||||
config object and remove its invalid properties.
|
||||
|
||||
## Error Handling
|
||||
|
||||
By default, nopt outputs a warning to standard error when invalid
|
||||
options are found. You can change this behavior by assigning a method
|
||||
to `nopt.invalidHandler`. This method will be called with
|
||||
the offending `nopt.invalidHandler(key, val, types)`.
|
||||
|
||||
If no `nopt.invalidHandler` is assigned, then it will console.error
|
||||
its whining. If it is assigned to boolean `false` then the warning is
|
||||
suppressed.
|
||||
|
||||
## Abbreviations
|
||||
|
||||
Yes, they are supported. If you define options like this:
|
||||
|
||||
```javascript
|
||||
{ "foolhardyelephants" : Boolean
|
||||
, "pileofmonkeys" : Boolean }
|
||||
```
|
||||
|
||||
Then this will work:
|
||||
|
||||
```bash
|
||||
node program.js --foolhar --pil
|
||||
node program.js --no-f --pileofmon
|
||||
# etc.
|
||||
```
|
||||
|
||||
## Shorthands
|
||||
|
||||
Shorthands are a hash of shorter option names to a snippet of args that
|
||||
they expand to.
|
||||
|
||||
If multiple one-character shorthands are all combined, and the
|
||||
combination does not unambiguously match any other option or shorthand,
|
||||
then they will be broken up into their constituent parts. For example:
|
||||
|
||||
```json
|
||||
{ "s" : ["--loglevel", "silent"]
|
||||
, "g" : "--global"
|
||||
, "f" : "--force"
|
||||
, "p" : "--parseable"
|
||||
, "l" : "--long"
|
||||
}
|
||||
```
|
||||
|
||||
```bash
|
||||
npm ls -sgflp
|
||||
# just like doing this:
|
||||
npm ls --loglevel silent --global --force --long --parseable
|
||||
```
|
||||
|
||||
## The Rest of the args
|
||||
|
||||
The config object returned by nopt is given a special member called
|
||||
`argv`, which is an object with the following fields:
|
||||
|
||||
* `remain`: The remaining args after all the parsing has occurred.
|
||||
* `original`: The args as they originally appeared.
|
||||
* `cooked`: The args after flags and shorthands are expanded.
|
||||
|
||||
## Slicing
|
||||
|
||||
Node programs are called with more or less the exact argv as it appears
|
||||
in C land, after the v8 and node-specific options have been plucked off.
|
||||
As such, `argv[0]` is always `node` and `argv[1]` is always the
|
||||
JavaScript program being run.
|
||||
|
||||
That's usually not very useful to you. So they're sliced off by
|
||||
default. If you want them, then you can pass in `0` as the last
|
||||
argument, or any other number that you'd like to slice off the start of
|
||||
the list.
|
||||
51
node_modules/markdown/node_modules/nopt/bin/nopt.js
generated
vendored
51
node_modules/markdown/node_modules/nopt/bin/nopt.js
generated
vendored
@@ -1,51 +0,0 @@
|
||||
#!/usr/bin/env node
|
||||
var nopt = require("../lib/nopt")
|
||||
, types = { num: Number
|
||||
, bool: Boolean
|
||||
, help: Boolean
|
||||
, list: Array
|
||||
, "num-list": [Number, Array]
|
||||
, "str-list": [String, Array]
|
||||
, "bool-list": [Boolean, Array]
|
||||
, str: String
|
||||
, clear: Boolean
|
||||
, config: Boolean
|
||||
, length: Number
|
||||
}
|
||||
, shorthands = { s: [ "--str", "astring" ]
|
||||
, b: [ "--bool" ]
|
||||
, nb: [ "--no-bool" ]
|
||||
, tft: [ "--bool-list", "--no-bool-list", "--bool-list", "true" ]
|
||||
, "?": ["--help"]
|
||||
, h: ["--help"]
|
||||
, H: ["--help"]
|
||||
, n: [ "--num", "125" ]
|
||||
, c: ["--config"]
|
||||
, l: ["--length"]
|
||||
}
|
||||
, parsed = nopt( types
|
||||
, shorthands
|
||||
, process.argv
|
||||
, 2 )
|
||||
|
||||
console.log("parsed", parsed)
|
||||
|
||||
if (parsed.help) {
|
||||
console.log("")
|
||||
console.log("nopt cli tester")
|
||||
console.log("")
|
||||
console.log("types")
|
||||
console.log(Object.keys(types).map(function M (t) {
|
||||
var type = types[t]
|
||||
if (Array.isArray(type)) {
|
||||
return [t, type.map(function (type) { return type.name })]
|
||||
}
|
||||
return [t, type && type.name]
|
||||
}).reduce(function (s, i) {
|
||||
s[i[0]] = i[1]
|
||||
return s
|
||||
}, {}))
|
||||
console.log("")
|
||||
console.log("shorthands")
|
||||
console.log(shorthands)
|
||||
}
|
||||
30
node_modules/markdown/node_modules/nopt/examples/my-program.js
generated
vendored
30
node_modules/markdown/node_modules/nopt/examples/my-program.js
generated
vendored
@@ -1,30 +0,0 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
//process.env.DEBUG_NOPT = 1
|
||||
|
||||
// my-program.js
|
||||
var nopt = require("../lib/nopt")
|
||||
, Stream = require("stream").Stream
|
||||
, path = require("path")
|
||||
, knownOpts = { "foo" : [String, null]
|
||||
, "bar" : [Stream, Number]
|
||||
, "baz" : path
|
||||
, "bloo" : [ "big", "medium", "small" ]
|
||||
, "flag" : Boolean
|
||||
, "pick" : Boolean
|
||||
}
|
||||
, shortHands = { "foofoo" : ["--foo", "Mr. Foo"]
|
||||
, "b7" : ["--bar", "7"]
|
||||
, "m" : ["--bloo", "medium"]
|
||||
, "p" : ["--pick"]
|
||||
, "f" : ["--flag", "true"]
|
||||
, "g" : ["--flag"]
|
||||
, "s" : "--flag"
|
||||
}
|
||||
// everything is optional.
|
||||
// knownOpts and shorthands default to {}
|
||||
// arg list defaults to process.argv
|
||||
// slice defaults to 2
|
||||
, parsed = nopt(knownOpts, shortHands, process.argv, 2)
|
||||
|
||||
console.log("parsed =\n"+ require("util").inspect(parsed))
|
||||
612
node_modules/markdown/node_modules/nopt/lib/nopt.js
generated
vendored
612
node_modules/markdown/node_modules/nopt/lib/nopt.js
generated
vendored
@@ -1,612 +0,0 @@
|
||||
// info about each config option.
|
||||
|
||||
var debug = process.env.DEBUG_NOPT || process.env.NOPT_DEBUG
|
||||
? function () { console.error.apply(console, arguments) }
|
||||
: function () {}
|
||||
|
||||
var url = require("url")
|
||||
, path = require("path")
|
||||
, Stream = require("stream").Stream
|
||||
, abbrev = require("abbrev")
|
||||
|
||||
module.exports = exports = nopt
|
||||
exports.clean = clean
|
||||
|
||||
exports.typeDefs =
|
||||
{ String : { type: String, validate: validateString }
|
||||
, Boolean : { type: Boolean, validate: validateBoolean }
|
||||
, url : { type: url, validate: validateUrl }
|
||||
, Number : { type: Number, validate: validateNumber }
|
||||
, path : { type: path, validate: validatePath }
|
||||
, Stream : { type: Stream, validate: validateStream }
|
||||
, Date : { type: Date, validate: validateDate }
|
||||
}
|
||||
|
||||
function nopt (types, shorthands, args, slice) {
|
||||
args = args || process.argv
|
||||
types = types || {}
|
||||
shorthands = shorthands || {}
|
||||
if (typeof slice !== "number") slice = 2
|
||||
|
||||
debug(types, shorthands, args, slice)
|
||||
|
||||
args = args.slice(slice)
|
||||
var data = {}
|
||||
, key
|
||||
, remain = []
|
||||
, cooked = args
|
||||
, original = args.slice(0)
|
||||
|
||||
parse(args, data, remain, types, shorthands)
|
||||
// now data is full
|
||||
clean(data, types, exports.typeDefs)
|
||||
data.argv = {remain:remain,cooked:cooked,original:original}
|
||||
Object.defineProperty(data.argv, 'toString', { value: function () {
|
||||
return this.original.map(JSON.stringify).join(" ")
|
||||
}, enumerable: false })
|
||||
return data
|
||||
}
|
||||
|
||||
function clean (data, types, typeDefs) {
|
||||
typeDefs = typeDefs || exports.typeDefs
|
||||
var remove = {}
|
||||
, typeDefault = [false, true, null, String, Number, Array]
|
||||
|
||||
Object.keys(data).forEach(function (k) {
|
||||
if (k === "argv") return
|
||||
var val = data[k]
|
||||
, isArray = Array.isArray(val)
|
||||
, type = types[k]
|
||||
if (!isArray) val = [val]
|
||||
if (!type) type = typeDefault
|
||||
if (type === Array) type = typeDefault.concat(Array)
|
||||
if (!Array.isArray(type)) type = [type]
|
||||
|
||||
debug("val=%j", val)
|
||||
debug("types=", type)
|
||||
val = val.map(function (val) {
|
||||
// if it's an unknown value, then parse false/true/null/numbers/dates
|
||||
if (typeof val === "string") {
|
||||
debug("string %j", val)
|
||||
val = val.trim()
|
||||
if ((val === "null" && ~type.indexOf(null))
|
||||
|| (val === "true" &&
|
||||
(~type.indexOf(true) || ~type.indexOf(Boolean)))
|
||||
|| (val === "false" &&
|
||||
(~type.indexOf(false) || ~type.indexOf(Boolean)))) {
|
||||
val = JSON.parse(val)
|
||||
debug("jsonable %j", val)
|
||||
} else if (~type.indexOf(Number) && !isNaN(val)) {
|
||||
debug("convert to number", val)
|
||||
val = +val
|
||||
} else if (~type.indexOf(Date) && !isNaN(Date.parse(val))) {
|
||||
debug("convert to date", val)
|
||||
val = new Date(val)
|
||||
}
|
||||
}
|
||||
|
||||
if (!types.hasOwnProperty(k)) {
|
||||
return val
|
||||
}
|
||||
|
||||
// allow `--no-blah` to set 'blah' to null if null is allowed
|
||||
if (val === false && ~type.indexOf(null) &&
|
||||
!(~type.indexOf(false) || ~type.indexOf(Boolean))) {
|
||||
val = null
|
||||
}
|
||||
|
||||
var d = {}
|
||||
d[k] = val
|
||||
debug("prevalidated val", d, val, types[k])
|
||||
if (!validate(d, k, val, types[k], typeDefs)) {
|
||||
if (exports.invalidHandler) {
|
||||
exports.invalidHandler(k, val, types[k], data)
|
||||
} else if (exports.invalidHandler !== false) {
|
||||
debug("invalid: "+k+"="+val, types[k])
|
||||
}
|
||||
return remove
|
||||
}
|
||||
debug("validated val", d, val, types[k])
|
||||
return d[k]
|
||||
}).filter(function (val) { return val !== remove })
|
||||
|
||||
if (!val.length) delete data[k]
|
||||
else if (isArray) {
|
||||
debug(isArray, data[k], val)
|
||||
data[k] = val
|
||||
} else data[k] = val[0]
|
||||
|
||||
debug("k=%s val=%j", k, val, data[k])
|
||||
})
|
||||
}
|
||||
|
||||
function validateString (data, k, val) {
|
||||
data[k] = String(val)
|
||||
}
|
||||
|
||||
function validatePath (data, k, val) {
|
||||
data[k] = path.resolve(String(val))
|
||||
return true
|
||||
}
|
||||
|
||||
function validateNumber (data, k, val) {
|
||||
debug("validate Number %j %j %j", k, val, isNaN(val))
|
||||
if (isNaN(val)) return false
|
||||
data[k] = +val
|
||||
}
|
||||
|
||||
function validateDate (data, k, val) {
|
||||
debug("validate Date %j %j %j", k, val, Date.parse(val))
|
||||
var s = Date.parse(val)
|
||||
if (isNaN(s)) return false
|
||||
data[k] = new Date(val)
|
||||
}
|
||||
|
||||
function validateBoolean (data, k, val) {
|
||||
if (val instanceof Boolean) val = val.valueOf()
|
||||
else if (typeof val === "string") {
|
||||
if (!isNaN(val)) val = !!(+val)
|
||||
else if (val === "null" || val === "false") val = false
|
||||
else val = true
|
||||
} else val = !!val
|
||||
data[k] = val
|
||||
}
|
||||
|
||||
function validateUrl (data, k, val) {
|
||||
val = url.parse(String(val))
|
||||
if (!val.host) return false
|
||||
data[k] = val.href
|
||||
}
|
||||
|
||||
function validateStream (data, k, val) {
|
||||
if (!(val instanceof Stream)) return false
|
||||
data[k] = val
|
||||
}
|
||||
|
||||
function validate (data, k, val, type, typeDefs) {
|
||||
// arrays are lists of types.
|
||||
if (Array.isArray(type)) {
|
||||
for (var i = 0, l = type.length; i < l; i ++) {
|
||||
if (type[i] === Array) continue
|
||||
if (validate(data, k, val, type[i], typeDefs)) return true
|
||||
}
|
||||
delete data[k]
|
||||
return false
|
||||
}
|
||||
|
||||
// an array of anything?
|
||||
if (type === Array) return true
|
||||
|
||||
// NaN is poisonous. Means that something is not allowed.
|
||||
if (type !== type) {
|
||||
debug("Poison NaN", k, val, type)
|
||||
delete data[k]
|
||||
return false
|
||||
}
|
||||
|
||||
// explicit list of values
|
||||
if (val === type) {
|
||||
debug("Explicitly allowed %j", val)
|
||||
// if (isArray) (data[k] = data[k] || []).push(val)
|
||||
// else data[k] = val
|
||||
data[k] = val
|
||||
return true
|
||||
}
|
||||
|
||||
// now go through the list of typeDefs, validate against each one.
|
||||
var ok = false
|
||||
, types = Object.keys(typeDefs)
|
||||
for (var i = 0, l = types.length; i < l; i ++) {
|
||||
debug("test type %j %j %j", k, val, types[i])
|
||||
var t = typeDefs[types[i]]
|
||||
if (t && type === t.type) {
|
||||
var d = {}
|
||||
ok = false !== t.validate(d, k, val)
|
||||
val = d[k]
|
||||
if (ok) {
|
||||
// if (isArray) (data[k] = data[k] || []).push(val)
|
||||
// else data[k] = val
|
||||
data[k] = val
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
debug("OK? %j (%j %j %j)", ok, k, val, types[i])
|
||||
|
||||
if (!ok) delete data[k]
|
||||
return ok
|
||||
}
|
||||
|
||||
function parse (args, data, remain, types, shorthands) {
|
||||
debug("parse", args, data, remain)
|
||||
|
||||
var key = null
|
||||
, abbrevs = abbrev(Object.keys(types))
|
||||
, shortAbbr = abbrev(Object.keys(shorthands))
|
||||
|
||||
for (var i = 0; i < args.length; i ++) {
|
||||
var arg = args[i]
|
||||
debug("arg", arg)
|
||||
|
||||
if (arg.match(/^-{2,}$/)) {
|
||||
// done with keys.
|
||||
// the rest are args.
|
||||
remain.push.apply(remain, args.slice(i + 1))
|
||||
args[i] = "--"
|
||||
break
|
||||
}
|
||||
var hadEq = false
|
||||
if (arg.charAt(0) === "-" && arg.length > 1) {
|
||||
if (arg.indexOf("=") !== -1) {
|
||||
hadEq = true
|
||||
var v = arg.split("=")
|
||||
arg = v.shift()
|
||||
v = v.join("=")
|
||||
args.splice.apply(args, [i, 1].concat([arg, v]))
|
||||
}
|
||||
|
||||
// see if it's a shorthand
|
||||
// if so, splice and back up to re-parse it.
|
||||
var shRes = resolveShort(arg, shorthands, shortAbbr, abbrevs)
|
||||
debug("arg=%j shRes=%j", arg, shRes)
|
||||
if (shRes) {
|
||||
debug(arg, shRes)
|
||||
args.splice.apply(args, [i, 1].concat(shRes))
|
||||
if (arg !== shRes[0]) {
|
||||
i --
|
||||
continue
|
||||
}
|
||||
}
|
||||
arg = arg.replace(/^-+/, "")
|
||||
var no = null
|
||||
while (arg.toLowerCase().indexOf("no-") === 0) {
|
||||
no = !no
|
||||
arg = arg.substr(3)
|
||||
}
|
||||
|
||||
if (abbrevs[arg]) arg = abbrevs[arg]
|
||||
|
||||
var isArray = types[arg] === Array ||
|
||||
Array.isArray(types[arg]) && types[arg].indexOf(Array) !== -1
|
||||
|
||||
// allow unknown things to be arrays if specified multiple times.
|
||||
if (!types.hasOwnProperty(arg) && data.hasOwnProperty(arg)) {
|
||||
if (!Array.isArray(data[arg]))
|
||||
data[arg] = [data[arg]]
|
||||
isArray = true
|
||||
}
|
||||
|
||||
var val
|
||||
, la = args[i + 1]
|
||||
|
||||
var isBool = typeof no === 'boolean' ||
|
||||
types[arg] === Boolean ||
|
||||
Array.isArray(types[arg]) && types[arg].indexOf(Boolean) !== -1 ||
|
||||
(typeof types[arg] === 'undefined' && !hadEq) ||
|
||||
(la === "false" &&
|
||||
(types[arg] === null ||
|
||||
Array.isArray(types[arg]) && ~types[arg].indexOf(null)))
|
||||
|
||||
if (isBool) {
|
||||
// just set and move along
|
||||
val = !no
|
||||
// however, also support --bool true or --bool false
|
||||
if (la === "true" || la === "false") {
|
||||
val = JSON.parse(la)
|
||||
la = null
|
||||
if (no) val = !val
|
||||
i ++
|
||||
}
|
||||
|
||||
// also support "foo":[Boolean, "bar"] and "--foo bar"
|
||||
if (Array.isArray(types[arg]) && la) {
|
||||
if (~types[arg].indexOf(la)) {
|
||||
// an explicit type
|
||||
val = la
|
||||
i ++
|
||||
} else if ( la === "null" && ~types[arg].indexOf(null) ) {
|
||||
// null allowed
|
||||
val = null
|
||||
i ++
|
||||
} else if ( !la.match(/^-{2,}[^-]/) &&
|
||||
!isNaN(la) &&
|
||||
~types[arg].indexOf(Number) ) {
|
||||
// number
|
||||
val = +la
|
||||
i ++
|
||||
} else if ( !la.match(/^-[^-]/) && ~types[arg].indexOf(String) ) {
|
||||
// string
|
||||
val = la
|
||||
i ++
|
||||
}
|
||||
}
|
||||
|
||||
if (isArray) (data[arg] = data[arg] || []).push(val)
|
||||
else data[arg] = val
|
||||
|
||||
continue
|
||||
}
|
||||
|
||||
if (la && la.match(/^-{2,}$/)) {
|
||||
la = undefined
|
||||
i --
|
||||
}
|
||||
|
||||
val = la === undefined ? true : la
|
||||
if (isArray) (data[arg] = data[arg] || []).push(val)
|
||||
else data[arg] = val
|
||||
|
||||
i ++
|
||||
continue
|
||||
}
|
||||
remain.push(arg)
|
||||
}
|
||||
}
|
||||
|
||||
function resolveShort (arg, shorthands, shortAbbr, abbrevs) {
|
||||
// handle single-char shorthands glommed together, like
|
||||
// npm ls -glp, but only if there is one dash, and only if
|
||||
// all of the chars are single-char shorthands, and it's
|
||||
// not a match to some other abbrev.
|
||||
arg = arg.replace(/^-+/, '')
|
||||
|
||||
// if it's an exact known option, then don't go any further
|
||||
if (abbrevs[arg] === arg)
|
||||
return null
|
||||
|
||||
// if it's an exact known shortopt, same deal
|
||||
if (shorthands[arg]) {
|
||||
// make it an array, if it's a list of words
|
||||
if (shorthands[arg] && !Array.isArray(shorthands[arg]))
|
||||
shorthands[arg] = shorthands[arg].split(/\s+/)
|
||||
|
||||
return shorthands[arg]
|
||||
}
|
||||
|
||||
// first check to see if this arg is a set of single-char shorthands
|
||||
var singles = shorthands.___singles
|
||||
if (!singles) {
|
||||
singles = Object.keys(shorthands).filter(function (s) {
|
||||
return s.length === 1
|
||||
}).reduce(function (l,r) {
|
||||
l[r] = true
|
||||
return l
|
||||
}, {})
|
||||
shorthands.___singles = singles
|
||||
debug('shorthand singles', singles)
|
||||
}
|
||||
|
||||
var chrs = arg.split("").filter(function (c) {
|
||||
return singles[c]
|
||||
})
|
||||
|
||||
if (chrs.join("") === arg) return chrs.map(function (c) {
|
||||
return shorthands[c]
|
||||
}).reduce(function (l, r) {
|
||||
return l.concat(r)
|
||||
}, [])
|
||||
|
||||
|
||||
// if it's an arg abbrev, and not a literal shorthand, then prefer the arg
|
||||
if (abbrevs[arg] && !shorthands[arg])
|
||||
return null
|
||||
|
||||
// if it's an abbr for a shorthand, then use that
|
||||
if (shortAbbr[arg])
|
||||
arg = shortAbbr[arg]
|
||||
|
||||
// make it an array, if it's a list of words
|
||||
if (shorthands[arg] && !Array.isArray(shorthands[arg]))
|
||||
shorthands[arg] = shorthands[arg].split(/\s+/)
|
||||
|
||||
return shorthands[arg]
|
||||
}
|
||||
|
||||
if (module === require.main) {
|
||||
var assert = require("assert")
|
||||
, util = require("util")
|
||||
|
||||
, shorthands =
|
||||
{ s : ["--loglevel", "silent"]
|
||||
, d : ["--loglevel", "info"]
|
||||
, dd : ["--loglevel", "verbose"]
|
||||
, ddd : ["--loglevel", "silly"]
|
||||
, noreg : ["--no-registry"]
|
||||
, reg : ["--registry"]
|
||||
, "no-reg" : ["--no-registry"]
|
||||
, silent : ["--loglevel", "silent"]
|
||||
, verbose : ["--loglevel", "verbose"]
|
||||
, h : ["--usage"]
|
||||
, H : ["--usage"]
|
||||
, "?" : ["--usage"]
|
||||
, help : ["--usage"]
|
||||
, v : ["--version"]
|
||||
, f : ["--force"]
|
||||
, desc : ["--description"]
|
||||
, "no-desc" : ["--no-description"]
|
||||
, "local" : ["--no-global"]
|
||||
, l : ["--long"]
|
||||
, p : ["--parseable"]
|
||||
, porcelain : ["--parseable"]
|
||||
, g : ["--global"]
|
||||
}
|
||||
|
||||
, types =
|
||||
{ aoa: Array
|
||||
, nullstream: [null, Stream]
|
||||
, date: Date
|
||||
, str: String
|
||||
, browser : String
|
||||
, cache : path
|
||||
, color : ["always", Boolean]
|
||||
, depth : Number
|
||||
, description : Boolean
|
||||
, dev : Boolean
|
||||
, editor : path
|
||||
, force : Boolean
|
||||
, global : Boolean
|
||||
, globalconfig : path
|
||||
, group : [String, Number]
|
||||
, gzipbin : String
|
||||
, logfd : [Number, Stream]
|
||||
, loglevel : ["silent","win","error","warn","info","verbose","silly"]
|
||||
, long : Boolean
|
||||
, "node-version" : [false, String]
|
||||
, npaturl : url
|
||||
, npat : Boolean
|
||||
, "onload-script" : [false, String]
|
||||
, outfd : [Number, Stream]
|
||||
, parseable : Boolean
|
||||
, pre: Boolean
|
||||
, prefix: path
|
||||
, proxy : url
|
||||
, "rebuild-bundle" : Boolean
|
||||
, registry : url
|
||||
, searchopts : String
|
||||
, searchexclude: [null, String]
|
||||
, shell : path
|
||||
, t: [Array, String]
|
||||
, tag : String
|
||||
, tar : String
|
||||
, tmp : path
|
||||
, "unsafe-perm" : Boolean
|
||||
, usage : Boolean
|
||||
, user : String
|
||||
, username : String
|
||||
, userconfig : path
|
||||
, version : Boolean
|
||||
, viewer: path
|
||||
, _exit : Boolean
|
||||
}
|
||||
|
||||
; [["-v", {version:true}, []]
|
||||
,["---v", {version:true}, []]
|
||||
,["ls -s --no-reg connect -d",
|
||||
{loglevel:"info",registry:null},["ls","connect"]]
|
||||
,["ls ---s foo",{loglevel:"silent"},["ls","foo"]]
|
||||
,["ls --registry blargle", {}, ["ls"]]
|
||||
,["--no-registry", {registry:null}, []]
|
||||
,["--no-color true", {color:false}, []]
|
||||
,["--no-color false", {color:true}, []]
|
||||
,["--no-color", {color:false}, []]
|
||||
,["--color false", {color:false}, []]
|
||||
,["--color --logfd 7", {logfd:7,color:true}, []]
|
||||
,["--color=true", {color:true}, []]
|
||||
,["--logfd=10", {logfd:10}, []]
|
||||
,["--tmp=/tmp -tar=gtar",{tmp:"/tmp",tar:"gtar"},[]]
|
||||
,["--tmp=tmp -tar=gtar",
|
||||
{tmp:path.resolve(process.cwd(), "tmp"),tar:"gtar"},[]]
|
||||
,["--logfd x", {}, []]
|
||||
,["a -true -- -no-false", {true:true},["a","-no-false"]]
|
||||
,["a -no-false", {false:false},["a"]]
|
||||
,["a -no-no-true", {true:true}, ["a"]]
|
||||
,["a -no-no-no-false", {false:false}, ["a"]]
|
||||
,["---NO-no-No-no-no-no-nO-no-no"+
|
||||
"-No-no-no-no-no-no-no-no-no"+
|
||||
"-no-no-no-no-NO-NO-no-no-no-no-no-no"+
|
||||
"-no-body-can-do-the-boogaloo-like-I-do"
|
||||
,{"body-can-do-the-boogaloo-like-I-do":false}, []]
|
||||
,["we are -no-strangers-to-love "+
|
||||
"--you-know=the-rules --and=so-do-i "+
|
||||
"---im-thinking-of=a-full-commitment "+
|
||||
"--no-you-would-get-this-from-any-other-guy "+
|
||||
"--no-gonna-give-you-up "+
|
||||
"-no-gonna-let-you-down=true "+
|
||||
"--no-no-gonna-run-around false "+
|
||||
"--desert-you=false "+
|
||||
"--make-you-cry false "+
|
||||
"--no-tell-a-lie "+
|
||||
"--no-no-and-hurt-you false"
|
||||
,{"strangers-to-love":false
|
||||
,"you-know":"the-rules"
|
||||
,"and":"so-do-i"
|
||||
,"you-would-get-this-from-any-other-guy":false
|
||||
,"gonna-give-you-up":false
|
||||
,"gonna-let-you-down":false
|
||||
,"gonna-run-around":false
|
||||
,"desert-you":false
|
||||
,"make-you-cry":false
|
||||
,"tell-a-lie":false
|
||||
,"and-hurt-you":false
|
||||
},["we", "are"]]
|
||||
,["-t one -t two -t three"
|
||||
,{t: ["one", "two", "three"]}
|
||||
,[]]
|
||||
,["-t one -t null -t three four five null"
|
||||
,{t: ["one", "null", "three"]}
|
||||
,["four", "five", "null"]]
|
||||
,["-t foo"
|
||||
,{t:["foo"]}
|
||||
,[]]
|
||||
,["--no-t"
|
||||
,{t:["false"]}
|
||||
,[]]
|
||||
,["-no-no-t"
|
||||
,{t:["true"]}
|
||||
,[]]
|
||||
,["-aoa one -aoa null -aoa 100"
|
||||
,{aoa:["one", null, 100]}
|
||||
,[]]
|
||||
,["-str 100"
|
||||
,{str:"100"}
|
||||
,[]]
|
||||
,["--color always"
|
||||
,{color:"always"}
|
||||
,[]]
|
||||
,["--no-nullstream"
|
||||
,{nullstream:null}
|
||||
,[]]
|
||||
,["--nullstream false"
|
||||
,{nullstream:null}
|
||||
,[]]
|
||||
,["--notadate=2011-01-25"
|
||||
,{notadate: "2011-01-25"}
|
||||
,[]]
|
||||
,["--date 2011-01-25"
|
||||
,{date: new Date("2011-01-25")}
|
||||
,[]]
|
||||
,["-cl 1"
|
||||
,{config: true, length: 1}
|
||||
,[]
|
||||
,{config: Boolean, length: Number, clear: Boolean}
|
||||
,{c: "--config", l: "--length"}]
|
||||
,["--acount bla"
|
||||
,{"acount":true}
|
||||
,["bla"]
|
||||
,{account: Boolean, credentials: Boolean, options: String}
|
||||
,{a:"--account", c:"--credentials",o:"--options"}]
|
||||
,["--clear"
|
||||
,{clear:true}
|
||||
,[]
|
||||
,{clear:Boolean,con:Boolean,len:Boolean,exp:Boolean,add:Boolean,rep:Boolean}
|
||||
,{c:"--con",l:"--len",e:"--exp",a:"--add",r:"--rep"}]
|
||||
,["--file -"
|
||||
,{"file":"-"}
|
||||
,[]
|
||||
,{file:String}
|
||||
,{}]
|
||||
,["--file -"
|
||||
,{"file":true}
|
||||
,["-"]
|
||||
,{file:Boolean}
|
||||
,{}]
|
||||
].forEach(function (test) {
|
||||
var argv = test[0].split(/\s+/)
|
||||
, opts = test[1]
|
||||
, rem = test[2]
|
||||
, actual = nopt(test[3] || types, test[4] || shorthands, argv, 0)
|
||||
, parsed = actual.argv
|
||||
delete actual.argv
|
||||
console.log(util.inspect(actual, false, 2, true), parsed.remain)
|
||||
for (var i in opts) {
|
||||
var e = JSON.stringify(opts[i])
|
||||
, a = JSON.stringify(actual[i] === undefined ? null : actual[i])
|
||||
if (e && typeof e === "object") {
|
||||
assert.deepEqual(e, a)
|
||||
} else {
|
||||
assert.equal(e, a)
|
||||
}
|
||||
}
|
||||
assert.deepEqual(rem, parsed.remain)
|
||||
})
|
||||
}
|
||||
23
node_modules/markdown/node_modules/nopt/node_modules/abbrev/LICENSE
generated
vendored
23
node_modules/markdown/node_modules/nopt/node_modules/abbrev/LICENSE
generated
vendored
@@ -1,23 +0,0 @@
|
||||
Copyright 2009, 2010, 2011 Isaac Z. Schlueter.
|
||||
All rights reserved.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person
|
||||
obtaining a copy of this software and associated documentation
|
||||
files (the "Software"), to deal in the Software without
|
||||
restriction, including without limitation the rights to use,
|
||||
copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the
|
||||
Software is furnished to do so, subject to the following
|
||||
conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
OTHER DEALINGS IN THE SOFTWARE.
|
||||
23
node_modules/markdown/node_modules/nopt/node_modules/abbrev/README.md
generated
vendored
23
node_modules/markdown/node_modules/nopt/node_modules/abbrev/README.md
generated
vendored
@@ -1,23 +0,0 @@
|
||||
# abbrev-js
|
||||
|
||||
Just like [ruby's Abbrev](http://apidock.com/ruby/Abbrev).
|
||||
|
||||
Usage:
|
||||
|
||||
var abbrev = require("abbrev");
|
||||
abbrev("foo", "fool", "folding", "flop");
|
||||
|
||||
// returns:
|
||||
{ fl: 'flop'
|
||||
, flo: 'flop'
|
||||
, flop: 'flop'
|
||||
, fol: 'folding'
|
||||
, fold: 'folding'
|
||||
, foldi: 'folding'
|
||||
, foldin: 'folding'
|
||||
, folding: 'folding'
|
||||
, foo: 'foo'
|
||||
, fool: 'fool'
|
||||
}
|
||||
|
||||
This is handy for command-line scripts, or other cases where you want to be able to accept shorthands.
|
||||
111
node_modules/markdown/node_modules/nopt/node_modules/abbrev/lib/abbrev.js
generated
vendored
111
node_modules/markdown/node_modules/nopt/node_modules/abbrev/lib/abbrev.js
generated
vendored
@@ -1,111 +0,0 @@
|
||||
|
||||
module.exports = exports = abbrev.abbrev = abbrev
|
||||
|
||||
abbrev.monkeyPatch = monkeyPatch
|
||||
|
||||
function monkeyPatch () {
|
||||
Object.defineProperty(Array.prototype, 'abbrev', {
|
||||
value: function () { return abbrev(this) },
|
||||
enumerable: false, configurable: true, writable: true
|
||||
})
|
||||
|
||||
Object.defineProperty(Object.prototype, 'abbrev', {
|
||||
value: function () { return abbrev(Object.keys(this)) },
|
||||
enumerable: false, configurable: true, writable: true
|
||||
})
|
||||
}
|
||||
|
||||
function abbrev (list) {
|
||||
if (arguments.length !== 1 || !Array.isArray(list)) {
|
||||
list = Array.prototype.slice.call(arguments, 0)
|
||||
}
|
||||
for (var i = 0, l = list.length, args = [] ; i < l ; i ++) {
|
||||
args[i] = typeof list[i] === "string" ? list[i] : String(list[i])
|
||||
}
|
||||
|
||||
// sort them lexicographically, so that they're next to their nearest kin
|
||||
args = args.sort(lexSort)
|
||||
|
||||
// walk through each, seeing how much it has in common with the next and previous
|
||||
var abbrevs = {}
|
||||
, prev = ""
|
||||
for (var i = 0, l = args.length ; i < l ; i ++) {
|
||||
var current = args[i]
|
||||
, next = args[i + 1] || ""
|
||||
, nextMatches = true
|
||||
, prevMatches = true
|
||||
if (current === next) continue
|
||||
for (var j = 0, cl = current.length ; j < cl ; j ++) {
|
||||
var curChar = current.charAt(j)
|
||||
nextMatches = nextMatches && curChar === next.charAt(j)
|
||||
prevMatches = prevMatches && curChar === prev.charAt(j)
|
||||
if (!nextMatches && !prevMatches) {
|
||||
j ++
|
||||
break
|
||||
}
|
||||
}
|
||||
prev = current
|
||||
if (j === cl) {
|
||||
abbrevs[current] = current
|
||||
continue
|
||||
}
|
||||
for (var a = current.substr(0, j) ; j <= cl ; j ++) {
|
||||
abbrevs[a] = current
|
||||
a += current.charAt(j)
|
||||
}
|
||||
}
|
||||
return abbrevs
|
||||
}
|
||||
|
||||
function lexSort (a, b) {
|
||||
return a === b ? 0 : a > b ? 1 : -1
|
||||
}
|
||||
|
||||
|
||||
// tests
|
||||
if (module === require.main) {
|
||||
|
||||
var assert = require("assert")
|
||||
var util = require("util")
|
||||
|
||||
console.log("running tests")
|
||||
function test (list, expect) {
|
||||
var actual = abbrev(list)
|
||||
assert.deepEqual(actual, expect,
|
||||
"abbrev("+util.inspect(list)+") === " + util.inspect(expect) + "\n"+
|
||||
"actual: "+util.inspect(actual))
|
||||
actual = abbrev.apply(exports, list)
|
||||
assert.deepEqual(abbrev.apply(exports, list), expect,
|
||||
"abbrev("+list.map(JSON.stringify).join(",")+") === " + util.inspect(expect) + "\n"+
|
||||
"actual: "+util.inspect(actual))
|
||||
}
|
||||
|
||||
test([ "ruby", "ruby", "rules", "rules", "rules" ],
|
||||
{ rub: 'ruby'
|
||||
, ruby: 'ruby'
|
||||
, rul: 'rules'
|
||||
, rule: 'rules'
|
||||
, rules: 'rules'
|
||||
})
|
||||
test(["fool", "foom", "pool", "pope"],
|
||||
{ fool: 'fool'
|
||||
, foom: 'foom'
|
||||
, poo: 'pool'
|
||||
, pool: 'pool'
|
||||
, pop: 'pope'
|
||||
, pope: 'pope'
|
||||
})
|
||||
test(["a", "ab", "abc", "abcd", "abcde", "acde"],
|
||||
{ a: 'a'
|
||||
, ab: 'ab'
|
||||
, abc: 'abc'
|
||||
, abcd: 'abcd'
|
||||
, abcde: 'abcde'
|
||||
, ac: 'acde'
|
||||
, acd: 'acde'
|
||||
, acde: 'acde'
|
||||
})
|
||||
|
||||
console.log("pass")
|
||||
|
||||
}
|
||||
28
node_modules/markdown/node_modules/nopt/node_modules/abbrev/package.json
generated
vendored
28
node_modules/markdown/node_modules/nopt/node_modules/abbrev/package.json
generated
vendored
@@ -1,28 +0,0 @@
|
||||
{
|
||||
"name": "abbrev",
|
||||
"version": "1.0.4",
|
||||
"description": "Like ruby's abbrev module, but in js",
|
||||
"author": {
|
||||
"name": "Isaac Z. Schlueter",
|
||||
"email": "i@izs.me"
|
||||
},
|
||||
"main": "./lib/abbrev.js",
|
||||
"scripts": {
|
||||
"test": "node lib/abbrev.js"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "http://github.com/isaacs/abbrev-js"
|
||||
},
|
||||
"license": {
|
||||
"type": "MIT",
|
||||
"url": "https://github.com/isaacs/abbrev-js/raw/master/LICENSE"
|
||||
},
|
||||
"readme": "# abbrev-js\n\nJust like [ruby's Abbrev](http://apidock.com/ruby/Abbrev).\n\nUsage:\n\n var abbrev = require(\"abbrev\");\n abbrev(\"foo\", \"fool\", \"folding\", \"flop\");\n \n // returns:\n { fl: 'flop'\n , flo: 'flop'\n , flop: 'flop'\n , fol: 'folding'\n , fold: 'folding'\n , foldi: 'folding'\n , foldin: 'folding'\n , folding: 'folding'\n , foo: 'foo'\n , fool: 'fool'\n }\n\nThis is handy for command-line scripts, or other cases where you want to be able to accept shorthands.\n",
|
||||
"readmeFilename": "README.md",
|
||||
"bugs": {
|
||||
"url": "https://github.com/isaacs/abbrev-js/issues"
|
||||
},
|
||||
"_id": "abbrev@1.0.4",
|
||||
"_from": "abbrev@1"
|
||||
}
|
||||
35
node_modules/markdown/node_modules/nopt/package.json
generated
vendored
35
node_modules/markdown/node_modules/nopt/package.json
generated
vendored
File diff suppressed because one or more lines are too long
64
node_modules/markdown/package.json
generated
vendored
64
node_modules/markdown/package.json
generated
vendored
File diff suppressed because one or more lines are too long
5
node_modules/markdown/seed.yml
generated
vendored
5
node_modules/markdown/seed.yml
generated
vendored
@@ -1,5 +0,0 @@
|
||||
---
|
||||
name: markdown-js
|
||||
description: JavaScript implementation of Markdown
|
||||
tags: markdown parser
|
||||
version: 0.1.2
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "tiddlywiki",
|
||||
"preferGlobal": "true",
|
||||
"version": "5.0.2-beta",
|
||||
"version": "5.0.4-beta",
|
||||
"author": "Jeremy Ruston <jeremy@jermolene.com>",
|
||||
"description": "a non-linear personal web notebook",
|
||||
"contributors": [
|
||||
|
||||
@@ -38,11 +38,15 @@ function FileSystemAdaptor(syncer) {
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
for(var f in $tw.boot.files) {
|
||||
var fileInfo = $tw.boot.files[f];
|
||||
this.setwatcher(fileInfo.filepath, f);
|
||||
}
|
||||
// Create the <wiki>/tiddlers folder if it doesn't exist
|
||||
// TODO: we should create the path recursively
|
||||
if(!fs.existsSync($tw.boot.wikiTiddlersPath)) {
|
||||
fs.mkdirSync($tw.boot.wikiTiddlersPath);
|
||||
}
|
||||
}
|
||||
|
||||
FileSystemAdaptor.prototype.getTiddlerInfo = function(tiddler) {
|
||||
|
||||
@@ -12,18 +12,33 @@ Message handler for full screen mode
|
||||
/*global $tw: false, Element: false */
|
||||
"use strict";
|
||||
|
||||
var toggleFullScreen = function() {
|
||||
if(document[$tw.browser.isFullScreen]) {
|
||||
document[$tw.browser.cancelFullScreen]();
|
||||
var d = document,
|
||||
db = d.body,
|
||||
_requestFullscreen = db.webkitRequestFullscreen !== undefined ? "webkitRequestFullscreen" :
|
||||
db.mozRequestFullScreen !== undefined ? "mozRequestFullScreen" :
|
||||
db.msRequestFullscreen !== undefined ? "msRequestFullscreen" :
|
||||
db.requestFullscreen !== undefined ? "requestFullscreen" : "",
|
||||
_exitFullscreen = d.webkitExitFullscreen !== undefined ? "webkitExitFullscreen" :
|
||||
d.mozCancelFullScreen !== undefined ? "mozCancelFullScreen" :
|
||||
d.msExitFullscreen !== undefined ? "msExitFullscreen" :
|
||||
d.exitFullscreen !== undefined ? "exitFullscreen" : "",
|
||||
_fullscreenElement = d.webkitFullscreenElement !== undefined ? "webkitFullscreenElement" :
|
||||
d.mozFullScreenElement !== undefined ? "mozFullScreenElement" :
|
||||
d.msFullscreenElement !== undefined ? "msFullscreenElement" :
|
||||
d.fullscreenElement !== undefined ? "fullscreenElement" : "";
|
||||
|
||||
var toggleFullscreen = function() {
|
||||
if(document[_fullscreenElement]) {
|
||||
document[_exitFullscreen]();
|
||||
} else {
|
||||
document.documentElement[$tw.browser.requestFullScreen](Element.ALLOW_KEYBOARD_INPUT);
|
||||
document.documentElement[_requestFullscreen](Element.ALLOW_KEYBOARD_INPUT);
|
||||
}
|
||||
};
|
||||
|
||||
exports.startup = function() {
|
||||
// Install the full screen handler
|
||||
$tw.rootWidget.addEventListener("tw-full-screen",function(event) {
|
||||
toggleFullScreen();
|
||||
toggleFullscreen();
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"title": "$:/plugins/tiddlywiki/github-fork-ribbon",
|
||||
"description": "Codemirror plugin",
|
||||
"description": "GitHub-style ribbon in pure CSS",
|
||||
"author": "Simon Whitaker, adapted for TiddlyWiki by JeremyRuston"
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"tiddlers": [
|
||||
{
|
||||
"file": "../../../../node_modules/markdown/lib/markdown.js",
|
||||
"file": "markdown.js",
|
||||
"fields": {
|
||||
"type": "application/javascript",
|
||||
"title": "$:/plugins/tiddlywiki/markdown/markdown.js",
|
||||
|
||||
@@ -9,8 +9,18 @@ Log in to ~TiddlyWeb: <$button message="tw-login" class="btn btn-info">Login</$b
|
||||
Logged in as {{$:/status/UserName}} <$button message="tw-logout" class="btn btn-warning">Logout</$button>
|
||||
</$reveal>
|
||||
|
||||
----
|
||||
|
||||
Host configuration: <$edit-text tiddler="$:/config/tiddlyweb/host" tag="input" default=""/>
|
||||
|
||||
<blockquote>//for example, `$protocol$//$host$/folder`, where `$protocol$` is replaced by the protocol (typically `http` or `https`), and `$host$` by the host name//</blockquote>
|
||||
|
||||
----
|
||||
|
||||
<$button message="tw-server-refresh" class="btn btn-warning">Refresh</$button> to fetch changes from the server immediately
|
||||
|
||||
----
|
||||
|
||||
Download an offline copy of this wiki:
|
||||
|
||||
{{$:/editions/clientserver/download-offline-button}}
|
||||
3
plugins/tiddlywiki/tiddlyweb/download-offline-button.tid
Normal file
3
plugins/tiddlywiki/tiddlyweb/download-offline-button.tid
Normal file
@@ -0,0 +1,3 @@
|
||||
title: $:/editions/clientserver/download-offline-button
|
||||
|
||||
<$button message="tw-download-file" param="$:/editions/clientserver/download-offline" class="btn-big-green">Download Offline Snapshot {{$:/core/images/save-button}}</$button>
|
||||
6
plugins/tiddlywiki/tiddlyweb/download-offline.tid
Normal file
6
plugins/tiddlywiki/tiddlyweb/download-offline.tid
Normal file
@@ -0,0 +1,6 @@
|
||||
title: $:/editions/clientserver/download-offline
|
||||
|
||||
\define saveTiddlerFilter()
|
||||
[is[tiddler]] -[type[text/css]] -[type[application/javascript]has[module-type]] -[type[application/javascript]library[yes]] -[[$:/boot/boot.js]] -[[$:/boot/bootprefix.js]] -[[$:/plugins/tiddlywiki/filesystem]] -[[$:/plugins/tiddlywiki/tiddlyweb]] +[sort[title]]
|
||||
\end
|
||||
{{$:/core/templates/tiddlywiki5.html}}
|
||||
27
qbld.cmd
Normal file
27
qbld.cmd
Normal file
@@ -0,0 +1,27 @@
|
||||
@echo off
|
||||
|
||||
rem Abbreviated version of bld.sh for quicker builds
|
||||
|
||||
rem Set up the build output directory
|
||||
|
||||
if "x%TW5_BUILD_OUTPUT%" == "x" (
|
||||
set TW5_BUILD_OUTPUT=..\jermolene.github.com
|
||||
)
|
||||
|
||||
if not exist %TW5_BUILD_OUTPUT%\nul (
|
||||
echo A valid TW5_BUILD_OUTPUT environment variable must be set
|
||||
exit 1
|
||||
)
|
||||
|
||||
echo Using TW5_BUILD_OUTPUT as %TW5_BUILD_OUTPUT%
|
||||
echo.
|
||||
|
||||
rem The tw5.com wiki
|
||||
rem index.html: the main file, including content
|
||||
|
||||
node .\tiddlywiki.js ^
|
||||
.\editions\tw5.com ^
|
||||
--verbose ^
|
||||
--rendertiddler $:/core/save/all %TW5_BUILD_OUTPUT%\index.html text/plain ^
|
||||
--savetiddler $:/favicon.ico %TW5_BUILD_OUTPUT%\favicon.ico ^
|
||||
|| exit 1
|
||||
30
qbld.sh
Executable file
30
qbld.sh
Executable file
@@ -0,0 +1,30 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Abbreviated version of bld.sh for quicker builds
|
||||
|
||||
# Set up the build output directory
|
||||
|
||||
if [ -z "$TW5_BUILD_OUTPUT" ]; then
|
||||
TW5_BUILD_OUTPUT=../jermolene.github.com
|
||||
fi
|
||||
|
||||
if [ ! -d "$TW5_BUILD_OUTPUT" ]; then
|
||||
echo 'A valid TW5_BUILD_OUTPUT environment variable must be set'
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Using TW5_BUILD_OUTPUT as [$TW5_BUILD_OUTPUT]"
|
||||
|
||||
# Make the CNAME file that GitHub Pages requires
|
||||
|
||||
echo "tiddlywiki.com" > $TW5_BUILD_OUTPUT/CNAME
|
||||
|
||||
# The tw5.com wiki
|
||||
# index.html: the main file, including content
|
||||
|
||||
node ./tiddlywiki.js \
|
||||
./editions/tw5.com \
|
||||
--verbose \
|
||||
--rendertiddler $:/core/save/all $TW5_BUILD_OUTPUT/index.html text/plain \
|
||||
--savetiddler $:/favicon.ico $TW5_BUILD_OUTPUT/favicon.ico \
|
||||
|| exit 1
|
||||
2
test.cmd
2
test.cmd
@@ -1,6 +1,6 @@
|
||||
@echo off
|
||||
|
||||
rem test TiddlyWiki5 for five.tiddlywiki.com
|
||||
rem test TiddlyWiki5 for tiddlywiki.com
|
||||
|
||||
rem Set up the build output directory
|
||||
|
||||
|
||||
2
test.sh
2
test.sh
@@ -1,6 +1,6 @@
|
||||
#!/bin/bash
|
||||
|
||||
# test TiddlyWiki5 for five.tiddlywiki.com
|
||||
# test TiddlyWiki5 for tiddlywiki.com
|
||||
|
||||
# Set up the build output directory
|
||||
|
||||
|
||||
@@ -325,7 +325,7 @@ a.tw-tiddlylink-external {
|
||||
fill: #fff;
|
||||
}
|
||||
|
||||
.tw-page-controls svg:hover {
|
||||
.tw-page-controls button:hover svg, .tw-page-controls a:hover svg {
|
||||
fill: #000;
|
||||
}
|
||||
|
||||
@@ -493,7 +493,7 @@ a.tw-tiddlylink-external {
|
||||
fill: #444;
|
||||
}
|
||||
|
||||
.tw-tiddler-controls svg:hover {
|
||||
.tw-tiddler-controls button:hover svg {
|
||||
fill: #888;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
title: $:/themes/tiddlywiki/vanilla/colours
|
||||
type: application/x-tiddler-dictionary
|
||||
|
||||
primary: `#5778D8`
|
||||
background: `#fff`
|
||||
foreground: `#333`
|
||||
pagebackground: `#ececec`
|
||||
medium: `#bbb`
|
||||
primary: #5778D8
|
||||
background: #ffffff
|
||||
foreground: #333333
|
||||
pagebackground: #ececec
|
||||
medium: #bbbbbb
|
||||
|
||||
Reference in New Issue
Block a user