1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2025-07-06 12:02:49 +00:00

Some delayed JSHint obeisance

This commit is contained in:
Jeremy Ruston 2012-05-04 18:49:04 +01:00
parent afc4824307
commit fa0e16eef5
48 changed files with 131 additions and 74 deletions

View File

@ -24,8 +24,8 @@ In practice, each module is wrapped in a separate script block.
\*/ \*/
(function() { (function() {
/*jslint node: true */ /*jslint node: true, browser: true */
/*global modules: false */ /*global modules: false, $tw: false */
"use strict"; "use strict";
/////////////////////////// Setting up $tw /////////////////////////// Setting up $tw
@ -40,7 +40,7 @@ $tw.boot = {};
// Modules store registers all the modules the system has seen // Modules store registers all the modules the system has seen
$tw.modules = $tw.modules || {}; $tw.modules = $tw.modules || {};
$tw.modules.titles = $tw.modules.titles || {} // hashmap by module title of {fn:, exports:, moduleType:} $tw.modules.titles = $tw.modules.titles || {}; // hashmap by module title of {fn:, exports:, moduleType:}
// Plugins store organises module exports by module type // Plugins store organises module exports by module type
$tw.plugins = $tw.plugins || {}; $tw.plugins = $tw.plugins || {};
@ -75,7 +75,7 @@ Determine if a value is an array
*/ */
$tw.utils.isArray = function(value) { $tw.utils.isArray = function(value) {
return Object.prototype.toString.call(value) == "[object Array]"; return Object.prototype.toString.call(value) == "[object Array]";
} };
// Convert "&amp;" to &, "&lt;" to <, "&gt;" to > and "&quot;" to " // Convert "&amp;" to &, "&lt;" to <, "&gt;" to > and "&quot;" to "
$tw.utils.htmlDecode = function(s) { $tw.utils.htmlDecode = function(s) {
@ -88,8 +88,9 @@ Pad a string to a given length with "0"s. Length defaults to 2
$tw.utils.pad = function(value,length) { $tw.utils.pad = function(value,length) {
length = length || 2; length = length || 2;
var s = value.toString(); var s = value.toString();
if(s.length < length) if(s.length < length) {
s = "000000000000000000000000000".substr(0,length - s.length) + s; s = "000000000000000000000000000".substr(0,length - s.length) + s;
}
return s; return s;
}; };
@ -367,8 +368,8 @@ $tw.Wiki.prototype.deserializeTiddlers = function(type,text,srcFields) {
deserializer = $tw.Wiki.tiddlerDeserializerPlugins[type]; deserializer = $tw.Wiki.tiddlerDeserializerPlugins[type];
} }
for(var f in srcFields) { for(var f in srcFields) {
fields[f] = srcFields[f] fields[f] = srcFields[f];
}; }
if(deserializer) { if(deserializer) {
return deserializer.call(this,text,fields); return deserializer.call(this,text,fields);
} else { } else {
@ -564,7 +565,7 @@ $tw.plugins.loadPlugins = function(filepath,basetitle,excludeRegExp) {
$tw.plugins.loadTiddlersFromFile(filepath,basetitle); $tw.plugins.loadTiddlersFromFile(filepath,basetitle);
} }
} }
} };
/* /*
Execute the module named 'moduleName'. The name can optionally be relative to the module named 'moduleRoot' Execute the module named 'moduleName'. The name can optionally be relative to the module named 'moduleRoot'
@ -599,7 +600,7 @@ $tw.modules.execute = function(moduleName,moduleRoot) {
} }
// Return the exports of the module // Return the exports of the module
return module.exports; return module.exports;
} };
// Load plugins from the plugins directory // Load plugins from the plugins directory
$tw.plugins.loadPlugins(path.resolve($tw.boot.bootPath,$tw.config.bootModuleSubDir)); $tw.plugins.loadPlugins(path.resolve($tw.boot.bootPath,$tw.config.bootModuleSubDir));

View File

@ -9,6 +9,7 @@ The $tw.Commander class is a command interpreter
(function(){ (function(){
/*jslint node: true, browser: true */ /*jslint node: true, browser: true */
/*global $tw: false */
"use strict"; "use strict";
/* /*

View File

@ -8,13 +8,14 @@ Dump command
\*/ \*/
(function(){ (function(){
/*jslint node: true, browser: true */ /*jshint node: true, browser: true */
/*global $tw: false */
"use strict"; "use strict";
exports.info = { exports.info = {
name: "dump", name: "dump",
synchronous: true synchronous: true
} };
var Command = function(params,commander) { var Command = function(params,commander) {
this.params = params; this.params = params;
@ -32,13 +33,13 @@ Command.prototype.execute = function() {
} else { } else {
return "Unknown subcommand (" + this.params[0] + ") for dump command"; return "Unknown subcommand (" + this.params[0] + ") for dump command";
} }
} };
Command.prototype.subcommands = {}; Command.prototype.subcommands = {};
Command.prototype.subcommands.tiddlers = function() { Command.prototype.subcommands.tiddlers = function() {
var tiddlers = this.commander.wiki.sortTiddlers() var tiddlers = this.commander.wiki.sortTiddlers();
this.output.write("Wiki contains these tiddlers:\n"); this.output.write("Wiki contains these tiddlers:\n");
for(var t=0; t<tiddlers.length; t++) { for(var t=0; t<tiddlers.length; t++) {
this.output.write(tiddlers[t] + "\n"); this.output.write(tiddlers[t] + "\n");
@ -47,7 +48,7 @@ Command.prototype.subcommands.tiddlers = function() {
}; };
Command.prototype.subcommands.shadows = function() { Command.prototype.subcommands.shadows = function() {
var tiddlers = this.commander.wiki.shadows.sortTiddlers() var tiddlers = this.commander.wiki.shadows.sortTiddlers();
this.output.write("Wiki contains these shadow tiddlers:\n"); this.output.write("Wiki contains these shadow tiddlers:\n");
for(var t=0; t<tiddlers.length; t++) { for(var t=0; t<tiddlers.length; t++) {
this.output.write(tiddlers[t] + "\n"); this.output.write(tiddlers[t] + "\n");

View File

@ -9,6 +9,7 @@ Load tiddlers command
(function(){ (function(){
/*jslint node: true, browser: true */ /*jslint node: true, browser: true */
/*global $tw: false */
"use strict"; "use strict";
exports.info = { exports.info = {

View File

@ -9,6 +9,7 @@ Save tiddlers command
(function(){ (function(){
/*jslint node: true, browser: true */ /*jslint node: true, browser: true */
/*global $tw: false */
"use strict"; "use strict";
exports.info = { exports.info = {

View File

@ -9,12 +9,13 @@ Verbose command
(function(){ (function(){
/*jslint node: true, browser: true */ /*jslint node: true, browser: true */
/*global $tw: false */
"use strict"; "use strict";
exports.info = { exports.info = {
name: "verbose", name: "verbose",
synchronous: true synchronous: true
} };
var Command = function(params,commander) { var Command = function(params,commander) {
this.params = params; this.params = params;
@ -24,7 +25,7 @@ var Command = function(params,commander) {
Command.prototype.execute = function() { Command.prototype.execute = function() {
this.commander.verbose = true; this.commander.verbose = true;
return null; // No error return null; // No error
} };
exports.Command = Command; exports.Command = Command;

View File

@ -9,12 +9,13 @@ Version command
(function(){ (function(){
/*jslint node: true, browser: true */ /*jslint node: true, browser: true */
/*global $tw: false */
"use strict"; "use strict";
exports.info = { exports.info = {
name: "version", name: "version",
synchronous: true synchronous: true
} };
var Command = function(params,commander) { var Command = function(params,commander) {
this.params = params; this.params = params;
@ -24,7 +25,7 @@ var Command = function(params,commander) {
Command.prototype.execute = function() { Command.prototype.execute = function() {
this.commander.streams.output.write($tw.utils.getVersionString() + "\n"); this.commander.streams.output.write($tw.utils.getVersionString() + "\n");
return null; // No error return null; // No error
} };
exports.Command = Command; exports.Command = Command;

View File

@ -9,6 +9,7 @@ wikitest command
(function(){ (function(){
/*jslint node: true, browser: true */ /*jslint node: true, browser: true */
/*global $tw: false */
"use strict"; "use strict";
exports.info = { exports.info = {

View File

@ -8,7 +8,8 @@ Core configuration constants
\*/ \*/
(function(){ (function(){
/*jslint node: true */ /*jslint node: true, browser: true */
/*global $tw: false */
"use strict"; "use strict";
exports.dateFormats = { exports.dateFormats = {

View File

@ -12,7 +12,8 @@ Represents the dependencies of a tiddler or a parser node as these fields:
\*/ \*/
(function(){ (function(){
/*jslint node: true */ /*jslint node: true, browser: true */
/*global $tw: false */
"use strict"; "use strict";
var Dependencies = function(skinnyTiddlers,fatTiddlers,dependentAll) { var Dependencies = function(skinnyTiddlers,fatTiddlers,dependentAll) {

View File

@ -12,7 +12,8 @@ Represents the dependencies of a tiddler or a parser node as these fields:
\*/ \*/
(function(){ (function(){
/*jslint node: true */ /*jslint node: true, browser: true */
/*global $tw: false */
"use strict"; "use strict";
exports["text/plain"] = function(text,fields) { exports["text/plain"] = function(text,fields) {

View File

@ -7,6 +7,7 @@ module-type: macro
(function(){ (function(){
/*jslint node: true, browser: true */ /*jslint node: true, browser: true */
/*global $tw: false */
"use strict"; "use strict";
exports.info = { exports.info = {

View File

@ -7,6 +7,7 @@ module-type: macro
(function(){ (function(){
/*jslint node: true, browser: true */ /*jslint node: true, browser: true */
/*global $tw: false */
"use strict"; "use strict";
exports.info = { exports.info = {
@ -48,14 +49,14 @@ exports.select = function(y) {
$tw.utils.addClass(target,"selected"); $tw.utils.addClass(target,"selected");
} }
} }
} };
exports.deselect = function() { exports.deselect = function() {
if(this.selectedNode) { if(this.selectedNode) {
$tw.utils.removeClass(this.selectedNode,"selected"); $tw.utils.removeClass(this.selectedNode,"selected");
this.selectedNode = null; this.selectedNode = null;
} }
} };
exports.action = function() { exports.action = function() {
if(this.selectedNode) { if(this.selectedNode) {
@ -64,7 +65,7 @@ exports.action = function() {
navEvent.navigateTo = this.selectedNode.getAttribute("data-link"); navEvent.navigateTo = this.selectedNode.getAttribute("data-link");
this.domNode.dispatchEvent(navEvent); this.domNode.dispatchEvent(navEvent);
} }
} };
/* /*
Set the position of the chooser panel within its wrapper given a touch/mouse position in screen coordinates Set the position of the chooser panel within its wrapper given a touch/mouse position in screen coordinates
@ -92,7 +93,7 @@ exports.hoverChooser = function(x,y) {
domPanel.style.webkitTransform = domPanel.style.webkitTransform =
domPanel.style.MozTransform = "scale(" + scale + ") translateX(" + translateX + "px) translateY(" + translateY + "px)"; domPanel.style.MozTransform = "scale(" + scale + ") translateX(" + translateX + "px) translateY(" + translateY + "px)";
} }
} };
exports.hideChooser = function() { exports.hideChooser = function() {
if(this.chooserDisplayed) { if(this.chooserDisplayed) {
@ -101,7 +102,7 @@ exports.hideChooser = function() {
this.domNode.removeChild(this.children[0].domNode); this.domNode.removeChild(this.children[0].domNode);
this.children = []; this.children = [];
} }
} };
exports.handleEvent = function(event) { exports.handleEvent = function(event) {
switch(event.type) { switch(event.type) {

View File

@ -6,7 +6,8 @@ module-type: macro
\*/ \*/
(function(){ (function(){
/*jslint node: true */ /*jslint node: true, browser: true */
/*global $tw: false */
"use strict"; "use strict";
exports.info = { exports.info = {

View File

@ -7,6 +7,7 @@ module-type: macro
(function(){ (function(){
/*jslint node: true, browser: true */ /*jslint node: true, browser: true */
/*global $tw: false */
"use strict"; "use strict";
exports.info = { exports.info = {

View File

@ -7,6 +7,7 @@ module-type: editor
(function(){ (function(){
/*jslint node: true, browser: true */ /*jslint node: true, browser: true */
/*global $tw: false */
"use strict"; "use strict";
function BitmapEditor(macroNode) { function BitmapEditor(macroNode) {

View File

@ -7,6 +7,7 @@ module-type: editor
(function(){ (function(){
/*jslint node: true, browser: true */ /*jslint node: true, browser: true */
/*global $tw: false */
"use strict"; "use strict";
function TextEditor(macroNode) { function TextEditor(macroNode) {

View File

@ -6,7 +6,8 @@ module-type: macro
\*/ \*/
(function(){ (function(){
/*jslint node: true */ /*jslint node: true, browser: true */
/*global $tw: false */
"use strict"; "use strict";
exports.info = { exports.info = {

View File

@ -9,6 +9,7 @@ Implements the link macro.
(function(){ (function(){
/*jslint node: true, browser: true */ /*jslint node: true, browser: true */
/*global $tw: false */
"use strict"; "use strict";
var isLinkExternal = function(to) { var isLinkExternal = function(to) {

View File

@ -6,7 +6,8 @@ module-type: macro
\*/ \*/
(function(){ (function(){
/*jslint node: true */ /*jslint node: true, browser: true */
/*global $tw: false */
"use strict"; "use strict";
var handlers = { var handlers = {

View File

@ -35,7 +35,8 @@ The slider is a good study example of a simple interactive macro.
\*/ \*/
(function(){ (function(){
/*jslint node: true */ /*jslint node: true, browser: true */
/*global $tw: false */
"use strict"; "use strict";
exports.info = { exports.info = {

View File

@ -6,7 +6,8 @@ module-type: macro
\*/ \*/
(function(){ (function(){
/*jslint node: true, jquery: true, browser: true */ /*jslint node: true, browser: true */
/*global $tw: false */
"use strict"; "use strict";
function scrollToTop(duration) { function scrollToTop(duration) {
@ -30,9 +31,8 @@ exports.info = {
events: ["tw-navigate","tw-EditTiddler","tw-SaveTiddler"] events: ["tw-navigate","tw-EditTiddler","tw-SaveTiddler"]
}; };
exports.handleEvent = function(event) { exports.handleEvent = function(event) {
var template, storyTiddler, story, storyRecord, tiddler, storyTiddlerModified; var template, storyTiddler, story, storyRecord, tiddler, storyTiddlerModified, t;
switch(event.type) { switch(event.type) {
case "tw-navigate": case "tw-navigate":
// Navigate to a specified tiddler // Navigate to a specified tiddler
@ -55,12 +55,12 @@ exports.handleEvent = function(event) {
if(storyTiddler && storyTiddler.fields.hasOwnProperty("text")) { if(storyTiddler && storyTiddler.fields.hasOwnProperty("text")) {
story = JSON.parse(storyTiddler.fields.text); story = JSON.parse(storyTiddler.fields.text);
} }
for(var t=0; t<story.tiddlers.length; t++) { for(t=0; t<story.tiddlers.length; t++) {
var storyRecord = story.tiddlers[t]; storyRecord = story.tiddlers[t];
if(storyRecord.title === event.tiddlerTitle && storyRecord.template !== template) { if(storyRecord.title === event.tiddlerTitle && storyRecord.template !== template) {
storyRecord.title = "Draft " + (new Date()) + " of " + event.tiddlerTitle; storyRecord.title = "Draft " + (new Date()) + " of " + event.tiddlerTitle;
storyRecord.template = template; storyRecord.template = template;
var tiddler = this.wiki.getTiddler(event.tiddlerTitle); tiddler = this.wiki.getTiddler(event.tiddlerTitle);
this.wiki.addTiddler(new $tw.Tiddler( this.wiki.addTiddler(new $tw.Tiddler(
{ {
text: "Type the text for the tiddler '" + event.tiddlerTitle + "'" text: "Type the text for the tiddler '" + event.tiddlerTitle + "'"
@ -84,10 +84,10 @@ exports.handleEvent = function(event) {
if(storyTiddler && storyTiddler.fields.hasOwnProperty("text")) { if(storyTiddler && storyTiddler.fields.hasOwnProperty("text")) {
story = JSON.parse(storyTiddler.fields.text); story = JSON.parse(storyTiddler.fields.text);
} }
for(var t=0; t<story.tiddlers.length; t++) { for(t=0; t<story.tiddlers.length; t++) {
var storyRecord = story.tiddlers[t]; storyRecord = story.tiddlers[t];
if(storyRecord.title === event.tiddlerTitle && storyRecord.template !== template) { if(storyRecord.title === event.tiddlerTitle && storyRecord.template !== template) {
var tiddler = this.wiki.getTiddler(storyRecord.title); tiddler = this.wiki.getTiddler(storyRecord.title);
if(tiddler && tiddler.fields.hasOwnProperty("draft.title")) { if(tiddler && tiddler.fields.hasOwnProperty("draft.title")) {
// Save the draft tiddler as the real tiddler // Save the draft tiddler as the real tiddler
this.wiki.addTiddler(new $tw.Tiddler(tiddler,{title: tiddler.fields["draft.title"],"draft.title": undefined, "draft.of": undefined})); this.wiki.addTiddler(new $tw.Tiddler(tiddler,{title: tiddler.fields["draft.title"],"draft.title": undefined, "draft.of": undefined}));

View File

@ -41,7 +41,8 @@ the `template` parameter or, if that parameter is missing, the tiddler named in
\*/ \*/
(function(){ (function(){
/*jslint node: true */ /*jslint node: true, browser: true */
/*global $tw: false */
"use strict"; "use strict";
exports.info = { exports.info = {
@ -66,7 +67,7 @@ exports.evaluateDependencies = function() {
dependencies.addDependency(template,true); dependencies.addDependency(template,true);
} }
return dependencies; return dependencies;
} };
exports.executeMacro = function() { exports.executeMacro = function() {
var renderTitle = this.params.target, var renderTitle = this.params.target,
@ -124,7 +125,7 @@ exports.executeMacro = function() {
} }
// Return the children // Return the children
return [$tw.Tree.Element("div",attributes,childrenClone)]; return [$tw.Tree.Element("div",attributes,childrenClone)];
} };
exports.refreshInDom = function(changes) { exports.refreshInDom = function(changes) {
var t; var t;

View File

@ -6,14 +6,15 @@ module-type: macro
\*/ \*/
(function(){ (function(){
/*jslint node: true */ /*jslint node: true, browser: true */
/*global $tw: false */
"use strict"; "use strict";
exports.info = { exports.info = {
name: "version", name: "version",
params: { params: {
} }
} };
exports.executeMacro = function() { exports.executeMacro = function() {
return [$tw.Tree.Text($tw.utils.getVersionString())]; return [$tw.Tree.Text($tw.utils.getVersionString())];

View File

@ -6,7 +6,8 @@ module-type: macro
\*/ \*/
(function(){ (function(){
/*jslint node: true */ /*jslint node: true, browser: true */
/*global $tw: false */
"use strict"; "use strict";
exports.info = { exports.info = {

View File

@ -6,7 +6,8 @@ module-type: macro
\*/ \*/
(function(){ (function(){
/*jslint node: true */ /*jslint node: true, browser: true */
/*global $tw: false */
"use strict"; "use strict";
exports.info = { exports.info = {

View File

@ -7,6 +7,7 @@ module-type: macro
(function(){ (function(){
/*jslint node: true, browser: true */ /*jslint node: true, browser: true */
/*global $tw: false */
"use strict"; "use strict";
exports.info = { exports.info = {
@ -22,7 +23,7 @@ exports.startZoomer = function(x,y) {
this.startX = x; this.startX = x;
this.startY = y; this.startY = y;
$tw.utils.addClass(document.body,"in-zoomer"); $tw.utils.addClass(document.body,"in-zoomer");
} };
exports.stopZoomer = function() { exports.stopZoomer = function() {
var newScrollY = this.yFactor * (this.bodyHeight - this.windowHeight); var newScrollY = this.yFactor * (this.bodyHeight - this.windowHeight);
@ -33,7 +34,7 @@ exports.stopZoomer = function() {
"translateY(" + ((this.windowHeight / this.scale) - this.bodyHeight) * this.yFactor * this.xFactor + "px)"; "translateY(" + ((this.windowHeight / this.scale) - this.bodyHeight) * this.yFactor * this.xFactor + "px)";
$tw.utils.removeClass(document.body,"in-zoomer"); $tw.utils.removeClass(document.body,"in-zoomer");
document.body.style.webkitTransform = "translateY(0) scale(1) translateY(0)"; document.body.style.webkitTransform = "translateY(0) scale(1) translateY(0)";
} };
/* /*
Zoom the body element given a touch/mouse position in screen coordinates Zoom the body element given a touch/mouse position in screen coordinates

View File

@ -8,7 +8,8 @@ Parses an image into a parse tree containing an HTML img element
\*/ \*/
(function(){ (function(){
/*jslint node: true */ /*jslint node: true, browser: true */
/*global $tw: false */
"use strict"; "use strict";
var ImageParser = function(options) { var ImageParser = function(options) {

View File

@ -8,7 +8,8 @@ Parses a JSON object into a parse tree
\*/ \*/
(function(){ (function(){
/*jslint node: true */ /*jslint node: true, browser: true */
/*global $tw: false */
"use strict"; "use strict";
var renderObject = function(obj) { var renderObject = function(obj) {
@ -41,7 +42,7 @@ var JSONParser = function(options) {
}; };
JSONParser.prototype.parse = function(type,text) { JSONParser.prototype.parse = function(type,text) {
return new $tw.Renderer([renderObject(JSON.parse(text))],new Dependencies()); return new $tw.Renderer([renderObject(JSON.parse(text))],new $tw.Dependencies());
}; };
exports["application/json"] = JSONParser; exports["application/json"] = JSONParser;

View File

@ -8,7 +8,8 @@ Renders plain text tiddlers
\*/ \*/
(function(){ (function(){
/*jslint node: true */ /*jslint node: true, browser: true */
/*global $tw: false */
"use strict"; "use strict";
var PlainTextParser = function(options) { var PlainTextParser = function(options) {

View File

@ -16,7 +16,8 @@ The syntax for macros is:
\*/ \*/
(function(){ (function(){
/*jslint node: true */ /*jslint node: true, browser: true */
/*global $tw: false */
"use strict"; "use strict";
var TiddlyTextParser = function(options) { var TiddlyTextParser = function(options) {

View File

@ -6,7 +6,8 @@ module-type: wikitextrule
\*/ \*/
(function(){ (function(){
/*jslint node: true */ /*jslint node: true, browser: true */
/*global $tw: false */
"use strict"; "use strict";
var textPrimitives = { var textPrimitives = {

View File

@ -30,7 +30,8 @@ HTML nodes look like this:
\*/ \*/
(function(){ (function(){
/*jslint node: true */ /*jslint node: true, browser: true */
/*global $tw: false */
"use strict"; "use strict";
/* /*

View File

@ -8,7 +8,8 @@ Represents a parse tree and associated data
\*/ \*/
(function(){ (function(){
/*jslint node: true */ /*jslint node: true, browser: true */
/*global $tw: false */
"use strict"; "use strict";
var Renderer = function(tree,dependencies) { var Renderer = function(tree,dependencies) {

View File

@ -9,6 +9,7 @@ This is the main application logic for both the client and server
(function(){ (function(){
/*jslint node: true, browser: true */ /*jslint node: true, browser: true */
/*global $tw: false */
"use strict"; "use strict";
exports.startup = function() { exports.startup = function() {
@ -56,6 +57,6 @@ if($tw.isBrowser) {
commander.execute(); commander.execute();
} }
} };
})(); })();

View File

@ -8,7 +8,8 @@ Extension methods for the $tw.Tiddler object
\*/ \*/
(function(){ (function(){
/*jslint node: true */ /*jslint node: true, browser: true */
/*global $tw: false */
"use strict"; "use strict";
exports.hasTag = function(tag) { exports.hasTag = function(tag) {

View File

@ -19,7 +19,8 @@ themselves with `new` when required.
\*/ \*/
(function(){ (function(){
/*jshint node: true, browser: true */ /*jslint node: true, browser: true */
/*global $tw: false */
"use strict"; "use strict";
exports.Tree = {}; exports.Tree = {};

View File

@ -8,7 +8,8 @@ Static utility methods for the $tw.Tree class
\*/ \*/
(function(){ (function(){
/*jshint node: true, browser: true */ /*jslint node: true, browser: true */
/*global $tw: false */
"use strict"; "use strict";
/* /*
@ -18,7 +19,7 @@ exports.errorNode = function(text) {
return $tw.Tree.Element("span",{ return $tw.Tree.Element("span",{
"class": ["label","label-important"] "class": ["label","label-important"]
},[ },[
new TextNode(text) new $tw.Tree.Text(text)
]); ]);
}; };

View File

@ -8,7 +8,8 @@ Element nodes
\*/ \*/
(function(){ (function(){
/*jshint node: true, browser: true */ /*jslint node: true, browser: true */
/*global $tw: false */
"use strict"; "use strict";
var Node = require("./node.js").Node; var Node = require("./node.js").Node;

View File

@ -8,7 +8,8 @@ Entity nodes
\*/ \*/
(function(){ (function(){
/*jshint node: true, browser: true */ /*jslint node: true, browser: true */
/*global $tw: false */
"use strict"; "use strict";
var Node = require("./node.js").Node; var Node = require("./node.js").Node;

View File

@ -9,6 +9,7 @@ Macro node, used as the base class for macros
(function(){ (function(){
/*jshint node: true, browser: true */ /*jshint node: true, browser: true */
/*global $tw: false */
"use strict"; "use strict";
var Node = require("./node.js").Node; var Node = require("./node.js").Node;
@ -46,8 +47,7 @@ var Macro = function(macroName,srcParams,content,wiki,dependencies) {
this.info = MacroClass.prototype.info; this.info = MacroClass.prototype.info;
} }
} else { } else {
// If Macro() has been called without new then lookup the macro class to instantiate // If Macro() has been called without 'new' then instantiate the right macro class
var MacroClass = wiki.macros[macroName];
return new MacroClass(macroName,srcParams,content,wiki,dependencies); return new MacroClass(macroName,srcParams,content,wiki,dependencies);
} }
}; };
@ -123,7 +123,7 @@ Macro.prototype.cloneContent = function() {
contentClones.push(this.content[t].clone()); contentClones.push(this.content[t].clone());
} }
return contentClones; return contentClones;
} };
Macro.prototype.clone = function() { Macro.prototype.clone = function() {
return new this.MacroClass(this.macroName,this.srcParams,this.cloneContent(),this.wiki,this.dependencies); return new this.MacroClass(this.macroName,this.srcParams,this.cloneContent(),this.wiki,this.dependencies);

View File

@ -8,7 +8,8 @@ Base class for all other tree nodes
\*/ \*/
(function(){ (function(){
/*jshint node: true, browser: true */ /*jslint node: true, browser: true */
/*global $tw: false */
"use strict"; "use strict";
/* /*

View File

@ -8,7 +8,8 @@ Raw, unparsed HTML nodes
\*/ \*/
(function(){ (function(){
/*jshint node: true, browser: true */ /*jslint node: true, browser: true */
/*global $tw: false */
"use strict"; "use strict";
var Node = require("./node.js").Node; var Node = require("./node.js").Node;

View File

@ -8,7 +8,8 @@ Text nodes
\*/ \*/
(function(){ (function(){
/*jshint node: true, browser: true */ /*jslint node: true, browser: true */
/*global $tw: false */
"use strict"; "use strict";
var Node = require("./node.js").Node; var Node = require("./node.js").Node;

View File

@ -23,7 +23,8 @@ Options and their defaults are:
\*/ \*/
(function(){ (function(){
/*jslint node: true */ /*jslint node: true, browser: true */
/*global $tw: false */
"use strict"; "use strict";
var ArgParser = function(argString,options) { var ArgParser = function(argString,options) {

View File

@ -10,7 +10,8 @@ This file is a bit of a dumping ground; the expectation is that most of these fu
\*/ \*/
(function(){ (function(){
/*jslint node: true */ /*jslint node: true, browser: true */
/*global $tw: false */
"use strict"; "use strict";
exports.deepCopy = function(object) { exports.deepCopy = function(object) {
@ -33,7 +34,7 @@ exports.deepCopy = function(object) {
exports.extendDeepCopy = function(object,extendedProperties) { exports.extendDeepCopy = function(object,extendedProperties) {
var result = $tw.utils.deepCopy(object),t; var result = $tw.utils.deepCopy(object),t;
for(var t in extendedProperties) { for(t in extendedProperties) {
if(object[t] !== undefined) { if(object[t] !== undefined) {
result[t] = $tw.utils.deepCopy(object[t]); result[t] = $tw.utils.deepCopy(object[t]);
} }

View File

@ -21,7 +21,8 @@ last dispatched. Each entry is a hashmap containing two fields:
\*/ \*/
(function(){ (function(){
/*jslint node: true */ /*jslint node: true, browser: true */
/*global $tw: false */
"use strict"; "use strict";
exports.getTiddlerText = function(title,defaultText) { exports.getTiddlerText = function(title,defaultText) {
@ -124,7 +125,7 @@ exports.sortTiddlers = function(sortField,excludeTag) {
sortField = sortField || "title"; sortField = sortField || "title";
var tiddlers = [], t, titles = []; var tiddlers = [], t, titles = [];
for(t in this.tiddlers) { for(t in this.tiddlers) {
tiddlers.push(this.tiddlers[t]) tiddlers.push(this.tiddlers[t]);
} }
tiddlers.sort(function(a,b) { tiddlers.sort(function(a,b) {
var aa = a.fields[sortField] || 0, var aa = a.fields[sortField] || 0,

View File

@ -3,3 +3,15 @@
# run TiddlyWiki5 # run TiddlyWiki5
node ../core/boot.js --verbose --wikitest ../../test/wikitests/ --dump shadows || exit 1 node ../core/boot.js --verbose --wikitest ../../test/wikitests/ --dump shadows || exit 1
# run jshint
jshint ../core/*.js
jshint ../core/modules/*.js
jshint ../core/modules/commands/*.js
jshint ../core/modules/macros/*.js
jshint ../core/modules/macros/edit/*.js
jshint ../core/modules/macros/edit/editors/*.js
jshint ../core/modules/parsers/*.js
jshint ../core/modules/parsers/wikitextparser/*.js
jshint ../core/modules/parsers/wikitextparser/rules/*.js
jshint ../core/modules/treenodes/*.js