diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 75c3bb8d3..ed16d707d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -10,12 +10,12 @@ jobs: test: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - uses: actions/setup-node@v1 + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 with: node-version: "${{ env.NODE_VERSION }}" - run: "./bin/ci-test.sh" - - uses: actions/upload-artifact@v3 + - uses: actions/upload-artifact@v4 if: always() with: name: playwright-report @@ -30,8 +30,8 @@ jobs: TW5_BUILD_MAIN_EDITION: "./editions/prerelease" TW5_BUILD_OUTPUT: "./output/prerelease" steps: - - uses: actions/checkout@v2 - - uses: actions/setup-node@v1 + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 with: node-version: "${{ env.NODE_VERSION }}" - run: "./bin/ci-pre-build.sh" @@ -62,8 +62,8 @@ jobs: TW5_BUILD_OUTPUT: "./output" TW5_BUILD_ARCHIVE: "./output" steps: - - uses: actions/checkout@v2 - - uses: actions/setup-node@v1 + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 with: node-version: "${{ env.NODE_VERSION }}" - run: "./bin/ci-pre-build.sh" diff --git a/.github/workflows/pr-check-build-size.yml b/.github/workflows/pr-check-build-size.yml new file mode 100644 index 000000000..77450a71f --- /dev/null +++ b/.github/workflows/pr-check-build-size.yml @@ -0,0 +1,50 @@ +name: Calculate PR build size +on: + pull_request_target: + types: [opened, reopened, synchronize] + +jobs: + calculate-build-size: + runs-on: ubuntu-latest + permissions: + pull-requests: read + contents: read + outputs: + pr_size: ${{ steps.get_sizes.outputs.pr_size }} + base_size: ${{ steps.get_sizes.outputs.base_size }} + steps: + - name: build-size-check + id: get_sizes + uses: TiddlyWiki/cerebrus@v4 + with: + pr_number: ${{ github.event.pull_request.number }} + repo: ${{ github.repository }} + base_ref: ${{ github.base_ref }} + github_token: ${{ secrets.GITHUB_TOKEN }} + mode: size:calc + + dispatch-followup: + needs: calculate-build-size + runs-on: ubuntu-latest + permissions: + actions: write # Required to dispatch another workflow + pull-requests: write + contents: read + steps: + - name: Trigger follow-up workflow + uses: actions/github-script@v6 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + script: | + await github.rest.actions.createWorkflowDispatch({ + owner: context.repo.owner, + repo: context.repo.repo, + workflow_id: 'pr-comment-build-size.yml', + ref: 'master', + inputs: { + pr_number: '${{ github.event.pull_request.number }}', + base_ref: '${{ github.event.pull_request.base.ref }}', + pr_size: '${{ needs.calculate-build-size.outputs.pr_size }}', + base_size: '${{ needs.calculate-build-size.outputs.base_size }}' + } + }); \ No newline at end of file diff --git a/.github/workflows/pr-comment-build-size.yml b/.github/workflows/pr-comment-build-size.yml new file mode 100644 index 000000000..8421d99c8 --- /dev/null +++ b/.github/workflows/pr-comment-build-size.yml @@ -0,0 +1,36 @@ +name: Comment on PR build size (Trusted workflow) + +on: + workflow_dispatch: + inputs: + pr_number: + required: true + type: string + base_ref: + required: true + type: string + pr_size: + required: true + type: string + base_size: + required: true + type: string + +jobs: + comment-on-pr: + runs-on: ubuntu-latest + permissions: + pull-requests: write + contents: read + + steps: + - name: Build and check size + uses: TiddlyWiki/cerebrus@v4 + with: + pr_number: ${{ inputs.pr_number }} + repo: ${{ github.repository }} + base_ref: ${{ inputs.base_ref }} + github_token: ${{ secrets.GITHUB_TOKEN }} + mode: size:comment + pr_size: ${{ inputs.pr_size }} + base_size: ${{ inputs.base_size }} diff --git a/.github/workflows/pr-path-validation.yml b/.github/workflows/pr-path-validation.yml new file mode 100644 index 000000000..674a9115b --- /dev/null +++ b/.github/workflows/pr-path-validation.yml @@ -0,0 +1,18 @@ +name: Validate PR Paths + +on: + pull_request_target: + types: [opened, reopened, synchronize] + +jobs: + validate-pr: + runs-on: ubuntu-latest + + steps: + - name: Validate PR + uses: TiddlyWiki/cerebrus@v4 + with: + pr_number: ${{ github.event.pull_request.number }} + repo: ${{ github.repository }} + base_ref: ${{ github.base_ref }} + github_token: ${{ secrets.GITHUB_TOKEN }} diff --git a/bin/build-site.sh b/bin/build-site.sh index f1fe649e7..40b9b447e 100755 --- a/bin/build-site.sh +++ b/bin/build-site.sh @@ -5,7 +5,7 @@ # Default to the current version number for building the plugin library if [ -z "$TW5_BUILD_VERSION" ]; then - TW5_BUILD_VERSION=v5.3.6 + TW5_BUILD_VERSION=v5.3.7 fi echo "Using TW5_BUILD_VERSION as [$TW5_BUILD_VERSION]" @@ -105,6 +105,7 @@ node $TW5_BUILD_TIDDLYWIKI \ fi # /index.html Main site +# /external-(version).html External core version of main site # /favicon.ico Favicon for main site # /static.html Static rendering of default tiddlers # /alltiddlers.html Static rendering of all tiddlers @@ -117,7 +118,7 @@ node $TW5_BUILD_TIDDLYWIKI \ --version \ --load $TW5_BUILD_OUTPUT/build.tid \ --output $TW5_BUILD_OUTPUT \ - --build favicon static index \ + --build favicon static index external-js \ || exit 1 # /empty.html Empty @@ -155,7 +156,7 @@ node $TW5_BUILD_TIDDLYWIKI \ node $TW5_BUILD_TIDDLYWIKI \ ./editions/tour \ --output $TW5_BUILD_OUTPUT \ - --rendertiddler $:/core/save/all tour.html text/plain \ + --rendertiddler $:/core/save/all-external-js tour.html text/plain \ || exit 1 # /share.html Custom edition for sharing via the URL @@ -194,7 +195,7 @@ node $TW5_BUILD_TIDDLYWIKI \ ./editions/xlsx-utils \ --load $TW5_BUILD_OUTPUT/build.tid \ --output $TW5_BUILD_OUTPUT/editions/xlsx-utils/ \ - --build index \ + --build external \ || exit 1 # /editions/resumebuilder/index.html Resume builder edition @@ -210,7 +211,7 @@ node $TW5_BUILD_TIDDLYWIKI \ ./editions/text-slicer \ --load $TW5_BUILD_OUTPUT/build.tid \ --output $TW5_BUILD_OUTPUT/editions/text-slicer/ \ - --build index \ + --build external \ || exit 1 # /editions/translators/index.html Translators edition @@ -242,7 +243,7 @@ node $TW5_BUILD_TIDDLYWIKI \ ./editions/tw5.com-docs \ --load $TW5_BUILD_OUTPUT/build.tid \ --output $TW5_BUILD_OUTPUT/editions/tw5.com-docs/ \ - --build index \ + --build external \ || exit 1 # /editions/twitter-archivist/index.html Twitter Archivist edition @@ -265,7 +266,7 @@ node $TW5_BUILD_TIDDLYWIKI \ ./editions/innerwikidemo \ --load $TW5_BUILD_OUTPUT/build.tid \ --output $TW5_BUILD_OUTPUT \ - --rendertiddler $:/core/save/all plugins/tiddlywiki/innerwiki/index.html text/plain \ + --rendertiddler $:/core/save/all-external-js plugins/tiddlywiki/innerwiki/index.html text/plain \ || exit 1 # /plugins/tiddlywiki/dynaview/index.html Demo wiki with DynaView plugin @@ -275,7 +276,7 @@ node $TW5_BUILD_TIDDLYWIKI \ ./editions/dynaviewdemo \ --load $TW5_BUILD_OUTPUT/build.tid \ --output $TW5_BUILD_OUTPUT \ - --rendertiddler $:/core/save/all plugins/tiddlywiki/dynaview/index.html text/plain \ + --rendertiddler $:/core/save/all-external-js plugins/tiddlywiki/dynaview/index.html text/plain \ --rendertiddler $:/core/save/empty plugins/tiddlywiki/dynaview/empty.html text/plain \ || exit 1 @@ -289,7 +290,7 @@ node $TW5_BUILD_TIDDLYWIKI \ ./editions/katexdemo \ --load $TW5_BUILD_OUTPUT/build.tid \ --output $TW5_BUILD_OUTPUT \ - --rendertiddler $:/core/save/all plugins/tiddlywiki/katex/index.html text/plain \ + --rendertiddler $:/core/save/all-external-js plugins/tiddlywiki/katex/index.html text/plain \ --rendertiddler $:/core/save/empty plugins/tiddlywiki/katex/empty.html text/plain \ || exit 1 @@ -319,7 +320,7 @@ node $TW5_BUILD_TIDDLYWIKI \ ./editions/codemirrordemo \ --load $TW5_BUILD_OUTPUT/build.tid \ --output $TW5_BUILD_OUTPUT \ - --rendertiddler $:/core/save/all plugins/tiddlywiki/codemirror/index.html text/plain \ + --rendertiddler $:/core/save/all-external-js plugins/tiddlywiki/codemirror/index.html text/plain \ --rendertiddler $:/core/save/empty plugins/tiddlywiki/codemirror/empty.html text/plain \ || exit 1 @@ -329,7 +330,7 @@ node $TW5_BUILD_TIDDLYWIKI \ ./editions/markdowndemo \ --load $TW5_BUILD_OUTPUT/build.tid \ --output $TW5_BUILD_OUTPUT \ - --rendertiddler $:/core/save/all plugins/tiddlywiki/markdown/index.html text/plain \ + --rendertiddler $:/core/save/all-external-js plugins/tiddlywiki/markdown/index.html text/plain \ --rendertiddler $:/core/save/empty plugins/tiddlywiki/markdown/empty.html text/plain \ || exit 1 @@ -339,7 +340,7 @@ node $TW5_BUILD_TIDDLYWIKI \ ./editions/classicparserdemo \ --load $TW5_BUILD_OUTPUT/build.tid \ --output $TW5_BUILD_OUTPUT \ - --rendertiddler $:/core/save/all plugins/tiddlywiki/tw2parser/index.html text/plain \ + --rendertiddler $:/core/save/all-external-js plugins/tiddlywiki/tw2parser/index.html text/plain \ --rendertiddler $:/core/save/empty plugins/tiddlywiki/tw2parser/empty.html text/plain \ || exit 1 @@ -349,7 +350,7 @@ node $TW5_BUILD_TIDDLYWIKI \ ./editions/highlightdemo \ --load $TW5_BUILD_OUTPUT/build.tid \ --output $TW5_BUILD_OUTPUT \ - --rendertiddler $:/core/save/all plugins/tiddlywiki/highlight/index.html text/plain \ + --rendertiddler $:/core/save/all-external-js plugins/tiddlywiki/highlight/index.html text/plain \ --rendertiddler $:/core/save/empty plugins/tiddlywiki/highlight/empty.html text/plain \ || exit 1 @@ -359,7 +360,7 @@ node $TW5_BUILD_TIDDLYWIKI \ ./editions/geospatialdemo \ --load $TW5_BUILD_OUTPUT/build.tid \ --output $TW5_BUILD_OUTPUT \ - --rendertiddler $:/core/save/all plugins/tiddlywiki/geospatial/index.html text/plain \ + --rendertiddler $:/core/save/all-external-js plugins/tiddlywiki/geospatial/index.html text/plain \ --rendertiddler $:/core/save/empty plugins/tiddlywiki/geospatial/empty.html text/plain \ || exit 1 diff --git a/boot/boot.js b/boot/boot.js index b4bdc00f2..20a639731 100644 --- a/boot/boot.js +++ b/boot/boot.js @@ -232,10 +232,10 @@ $tw.utils.error = function(err) { var link = dm("a"), text = JSON.stringify(tiddlers); if(Blob !== undefined) { - var blob = new Blob([text], {type: "text/html"}); + var blob = new Blob([text], {type: "application/json"}); link.setAttribute("href", URL.createObjectURL(blob)); } else { - link.setAttribute("href","data:text/html," + encodeURIComponent(text)); + link.setAttribute("href","data:application/json," + encodeURIComponent(text)); } link.setAttribute("download","emergency-tiddlers-" + (new Date()) + ".json"); document.body.appendChild(link); @@ -1470,17 +1470,15 @@ $tw.Wiki = function(options) { // Unpack the currently registered plugins, creating shadow tiddlers for their constituent tiddlers this.unpackPluginTiddlers = function() { var self = this; - // Sort the plugin titles by the `plugin-priority` field - pluginTiddlers.sort(function(a,b) { - if("plugin-priority" in a.fields && "plugin-priority" in b.fields) { - return a.fields["plugin-priority"] - b.fields["plugin-priority"]; - } else if("plugin-priority" in a.fields) { + // Sort the plugin titles by the `plugin-priority` field, if this field is missing, default to 1 + pluginTiddlers.sort(function(a, b) { + var priorityA = "plugin-priority" in a.fields ? a.fields["plugin-priority"] : 1; + var priorityB = "plugin-priority" in b.fields ? b.fields["plugin-priority"] : 1; + if (priorityA !== priorityB) { + return priorityA - priorityB; + } else if (a.fields.title < b.fields.title) { return -1; - } else if("plugin-priority" in b.fields) { - return +1; - } else if(a.fields.title < b.fields.title) { - return -1; - } else if(a.fields.title === b.fields.title) { + } else if (a.fields.title === b.fields.title) { return 0; } else { return +1; @@ -1904,8 +1902,16 @@ $tw.loadTiddlersFromFile = function(filepath,fields) { extensionInfo = $tw.utils.getFileExtensionInfo(ext), type = extensionInfo ? extensionInfo.type : null, typeInfo = type ? $tw.config.contentTypeInfo[type] : null, - data = fs.readFileSync(filepath,typeInfo ? typeInfo.encoding : "utf8"), - tiddlers = $tw.wiki.deserializeTiddlers(ext,data,fields), + fileSize = fs.statSync(filepath).size, + data; + if(fileSize > $tw.config.maxEditFileSize) { + data = "File " + filepath + "not loaded because it is too large"; + console.log("Warning: " + data); + ext = ".txt"; + } else { + data = fs.readFileSync(filepath,typeInfo ? typeInfo.encoding : "utf8"); + } + var tiddlers = $tw.wiki.deserializeTiddlers(ext,data,fields), metadata = $tw.loadMetadataForFile(filepath); if(metadata) { if(type === "application/json") { @@ -1994,7 +2000,7 @@ $tw.loadTiddlersFromSpecification = function(filepath,excludeRegExp) { var value = tiddler[name]; switch(fieldInfo.source) { case "subdirectories": - value = path.relative(rootPath, filename).split(path.sep).slice(0, -1); + value = $tw.utils.stringifyList(path.relative(rootPath, filename).split(path.sep).slice(0, -1)); break; case "filepath": value = path.relative(rootPath, filename).split(path.sep).join('/'); @@ -2015,10 +2021,10 @@ $tw.loadTiddlersFromSpecification = function(filepath,excludeRegExp) { value = path.extname(filename); break; case "created": - value = new Date(fs.statSync(pathname).birthtime); + value = $tw.utils.stringifyDate(new Date(fs.statSync(pathname).birthtime)); break; case "modified": - value = new Date(fs.statSync(pathname).mtime); + value = $tw.utils.stringifyDate(new Date(fs.statSync(pathname).mtime)); break; } if(fieldInfo.prefix) { @@ -2465,13 +2471,15 @@ $tw.boot.initStartup = function(options) { $tw.utils.registerFileType("image/webp","base64",".webp",{flags:["image"]}); $tw.utils.registerFileType("image/heic","base64",".heic",{flags:["image"]}); $tw.utils.registerFileType("image/heif","base64",".heif",{flags:["image"]}); + $tw.utils.registerFileType("image/avif","base64",".avif",{flags:["image"]}); $tw.utils.registerFileType("image/svg+xml","utf8",".svg",{flags:["image"]}); $tw.utils.registerFileType("image/vnd.microsoft.icon","base64",".ico",{flags:["image"]}); $tw.utils.registerFileType("image/x-icon","base64",".ico",{flags:["image"]}); $tw.utils.registerFileType("application/wasm","base64",".wasm"); - $tw.utils.registerFileType("application/font-woff","base64",".woff"); - $tw.utils.registerFileType("application/x-font-ttf","base64",".woff"); - $tw.utils.registerFileType("application/font-woff2","base64",".woff2"); + $tw.utils.registerFileType("font/woff","base64",".woff"); + $tw.utils.registerFileType("font/woff2","base64",".woff2"); + $tw.utils.registerFileType("font/ttf","base64",".ttf"); + $tw.utils.registerFileType("font/otf","base64",".otf"); $tw.utils.registerFileType("audio/ogg","base64",".ogg"); $tw.utils.registerFileType("audio/mp4","base64",[".mp4",".m4a"]); $tw.utils.registerFileType("video/ogg","base64",[".ogm",".ogv",".ogg"]); diff --git a/boot/bootprefix.js b/boot/bootprefix.js index 4dae1b28f..92785d823 100644 --- a/boot/bootprefix.js +++ b/boot/bootprefix.js @@ -19,6 +19,10 @@ var _bootprefix = (function($tw) { $tw = $tw || Object.create(null); $tw.boot = $tw.boot || Object.create(null); +// Config +$tw.config = $tw.config || Object.create(null); +$tw.config.maxEditFileSize = 100 * 1024 * 1024; // 100MB + // Detect platforms if(!("browser" in $tw)) { $tw.browser = typeof(window) !== "undefined" && typeof(document) !== "undefined" ? {} : null; diff --git a/core/acknowledgements.tid b/core/acknowledgements.tid index cb54e3d23..e1015e2c9 100644 --- a/core/acknowledgements.tid +++ b/core/acknowledgements.tid @@ -5,7 +5,3 @@ TiddlyWiki incorporates code from these fine OpenSource projects: * [[The Stanford Javascript Crypto Library|http://bitwiseshiftleft.github.io/sjcl/]] * [[The Jasmine JavaScript Test Framework|https://jasmine.github.io/]] * [[Normalize.css by Nicolas Gallagher|http://necolas.github.io/normalize.css/]] - -And media from these projects: - -* World flag icons from [[Wikipedia|http://commons.wikimedia.org/wiki/Category:SVG_flags_by_country]] diff --git a/core/copyright.tid b/core/copyright.tid index 3f52380cc..233295ce2 100644 --- a/core/copyright.tid +++ b/core/copyright.tid @@ -4,7 +4,7 @@ type: text/plain TiddlyWiki created by Jeremy Ruston, (jeremy [at] jermolene [dot] com) Copyright (c) 2004-2007, Jeremy Ruston -Copyright (c) 2007-2024, UnaMesa Association +Copyright (c) 2007-2025, UnaMesa Association All rights reserved. Redistribution and use in source and binary forms, with or without diff --git a/core/images/language.tid b/core/images/language.tid new file mode 100644 index 000000000..bb4061495 --- /dev/null +++ b/core/images/language.tid @@ -0,0 +1,5 @@ +title: $:/core/images/language +tags: $:/tags/Image + +\parameters (size:"22pt") +> height=<> class="tc-image-language tc-image-button" viewBox="0 0 92 92"> \ No newline at end of file diff --git a/core/language/en-GB/ControlPanel.multids b/core/language/en-GB/ControlPanel.multids index 2c41f215e..129dab0b4 100644 --- a/core/language/en-GB/ControlPanel.multids +++ b/core/language/en-GB/ControlPanel.multids @@ -206,10 +206,10 @@ Settings/MissingLinks/Hint: Choose whether to link to tiddlers that do not exist Settings/MissingLinks/Description: Enable links to missing tiddlers SocialCard/Caption: Social Media Card SocialCard/Domain/Prompt: Domain name to display for the link (for example, ''tiddlywiki.com'') -SocialCard/Hint: This information is used by social and messaging services to display a preview card for links to this TiddlyWiki when hosted online -SocialCard/PreviewUrl/Prompt: Full URL to preview image for this TiddlyWiki +SocialCard/Hint: This information is used by social and messaging services to display a preview card for links to this ~TiddlyWiki when hosted online +SocialCard/PreviewUrl/Prompt: Full URL to preview image for this ~TiddlyWiki SocialCard/PreviewUrl/Preview: Preview image: -SocialCard/Url/Prompt: Full URL of this TiddlyWiki +SocialCard/Url/Prompt: Full URL of this ~TiddlyWiki StoryTiddler/Caption: Story Tiddler StoryTiddler/Hint: This rule cascade is used to dynamically choose the template for displaying a tiddler in the story river. StoryView/Caption: Story View diff --git a/core/language/en-GB/Fields.multids b/core/language/en-GB/Fields.multids index 9830e96c1..61835821a 100644 --- a/core/language/en-GB/Fields.multids +++ b/core/language/en-GB/Fields.multids @@ -4,12 +4,12 @@ _canonical_uri: The full URI of an external image tiddler author: Name of the author of a plugin bag: The name of the bag from which a tiddler came caption: The text to be displayed on a tab or button -class: The CSS class applied to a tiddler when rendering it - see [[Custom styles by user-class]]. Also used for [[Modals]] +class: The CSS class applied to a tiddler when rendering it. Also used for Modals code-body: The view template will display the tiddler as code if set to ''yes'' color: The CSS color value associated with a tiddler -component: The name of the component responsible for an [[alert tiddler|AlertMechanism]] +component: The name of the component responsible for an alert tiddler core-version: For a plugin, indicates what version of TiddlyWiki with which it is compatible -current-tiddler: Used to cache the top tiddler in a [[history list|HistoryMechanism]] +current-tiddler: Used to cache the top tiddler in a history list created: The date a tiddler was created creator: The name of the person who created a tiddler dependents: For a plugin, lists the dependent plugin titles diff --git a/core/language/en-GB/icon.tid b/core/language/en-GB/icon.tid deleted file mode 100644 index 1967b895f..000000000 --- a/core/language/en-GB/icon.tid +++ /dev/null @@ -1,13 +0,0 @@ -title: $:/languages/en-GB/icon -type: image/svg+xml - - - - - - - - - - - diff --git a/core/modules/commander.js b/core/modules/commander.js index b55679a2e..b73e39b0f 100644 --- a/core/modules/commander.js +++ b/core/modules/commander.js @@ -6,10 +6,7 @@ module-type: global The $tw.Commander class is a command interpreter \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; /* @@ -173,5 +170,3 @@ Commander.initCommands = function(moduleType) { }; exports.Commander = Commander; - -})(); diff --git a/core/modules/commands/build.js b/core/modules/commands/build.js index 60456372d..cbb7663f1 100644 --- a/core/modules/commands/build.js +++ b/core/modules/commands/build.js @@ -6,10 +6,7 @@ module-type: command Command to build a build target \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; exports.info = { @@ -48,5 +45,3 @@ Command.prototype.execute = function() { }; exports.Command = Command; - -})(); diff --git a/core/modules/commands/clearpassword.js b/core/modules/commands/clearpassword.js index 9f714a3ef..915c60d23 100644 --- a/core/modules/commands/clearpassword.js +++ b/core/modules/commands/clearpassword.js @@ -6,10 +6,7 @@ module-type: command Clear password for crypto operations \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; exports.info = { @@ -29,5 +26,3 @@ Command.prototype.execute = function() { }; exports.Command = Command; - -})(); diff --git a/core/modules/commands/commands.js b/core/modules/commands/commands.js index 813f19064..ddaa387db 100644 --- a/core/modules/commands/commands.js +++ b/core/modules/commands/commands.js @@ -7,10 +7,6 @@ Runs the commands returned from a filter \*/ -(function() { - -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; exports.info = { @@ -38,5 +34,3 @@ Command.prototype.execute = function() { }; exports.Command = Command; - -})(); diff --git a/core/modules/commands/deletetiddlers.js b/core/modules/commands/deletetiddlers.js index 3d8b855d9..797a6428a 100644 --- a/core/modules/commands/deletetiddlers.js +++ b/core/modules/commands/deletetiddlers.js @@ -6,10 +6,7 @@ module-type: command Command to delete tiddlers \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; exports.info = { @@ -38,5 +35,3 @@ Command.prototype.execute = function() { }; exports.Command = Command; - -})(); diff --git a/core/modules/commands/editions.js b/core/modules/commands/editions.js index cc802b9f5..c46489d09 100644 --- a/core/modules/commands/editions.js +++ b/core/modules/commands/editions.js @@ -6,10 +6,7 @@ module-type: command Command to list the available editions \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; exports.info = { @@ -35,5 +32,3 @@ Command.prototype.execute = function() { }; exports.Command = Command; - -})(); diff --git a/core/modules/commands/fetch.js b/core/modules/commands/fetch.js index 07cda691c..be076eb3c 100644 --- a/core/modules/commands/fetch.js +++ b/core/modules/commands/fetch.js @@ -6,10 +6,7 @@ module-type: command Commands to fetch external tiddlers \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; exports.info = { @@ -171,5 +168,3 @@ Command.prototype.processBody = function(body,type,options,url) { }; exports.Command = Command; - -})(); diff --git a/core/modules/commands/help.js b/core/modules/commands/help.js index 90c190829..861c8f6d8 100644 --- a/core/modules/commands/help.js +++ b/core/modules/commands/help.js @@ -6,10 +6,7 @@ module-type: command Help command \*/ -(function(){ -/*jshint node: true, browser: true */ -/*global $tw: false */ "use strict"; exports.info = { @@ -37,5 +34,3 @@ Command.prototype.execute = function() { }; exports.Command = Command; - -})(); diff --git a/core/modules/commands/import.js b/core/modules/commands/import.js index 9465c3da1..7c7b6740d 100644 --- a/core/modules/commands/import.js +++ b/core/modules/commands/import.js @@ -6,10 +6,7 @@ module-type: command Command to import tiddlers from a file \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; exports.info = { @@ -44,5 +41,3 @@ Command.prototype.execute = function() { }; exports.Command = Command; - -})(); diff --git a/core/modules/commands/init.js b/core/modules/commands/init.js index 2d053ae3c..ed48a5494 100644 --- a/core/modules/commands/init.js +++ b/core/modules/commands/init.js @@ -6,10 +6,7 @@ module-type: command Command to initialise an empty wiki folder \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; exports.info = { @@ -55,5 +52,3 @@ Command.prototype.execute = function() { }; exports.Command = Command; - -})(); diff --git a/core/modules/commands/listen.js b/core/modules/commands/listen.js index ca6e6e076..80cb18293 100644 --- a/core/modules/commands/listen.js +++ b/core/modules/commands/listen.js @@ -6,10 +6,7 @@ module-type: command Listen for HTTP requests and serve tiddlers \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; var Server = require("$:/core/modules/server/server.js").Server; @@ -44,5 +41,3 @@ Command.prototype.execute = function() { }; exports.Command = Command; - -})(); diff --git a/core/modules/commands/load.js b/core/modules/commands/load.js index 8fd9cba10..e19ecd59a 100644 --- a/core/modules/commands/load.js +++ b/core/modules/commands/load.js @@ -6,10 +6,7 @@ module-type: command Command to load tiddlers from a file or directory \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; exports.info = { @@ -47,5 +44,3 @@ Command.prototype.execute = function() { }; exports.Command = Command; - -})(); diff --git a/core/modules/commands/makelibrary.js b/core/modules/commands/makelibrary.js index 3af2e4943..b8ad2e5b6 100644 --- a/core/modules/commands/makelibrary.js +++ b/core/modules/commands/makelibrary.js @@ -6,10 +6,7 @@ module-type: command Command to pack all of the plugins in the library into a plugin tiddler of type "library" \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; exports.info = { @@ -41,5 +38,3 @@ Command.prototype.execute = function() { }; exports.Command = Command; - -})(); diff --git a/core/modules/commands/output.js b/core/modules/commands/output.js index 0532f58d7..d43eb2596 100644 --- a/core/modules/commands/output.js +++ b/core/modules/commands/output.js @@ -6,10 +6,7 @@ module-type: command Command to set the default output location (defaults to current working directory) \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; exports.info = { @@ -34,5 +31,3 @@ Command.prototype.execute = function() { }; exports.Command = Command; - -})(); diff --git a/core/modules/commands/password.js b/core/modules/commands/password.js index 85d53fa33..27139a9ed 100644 --- a/core/modules/commands/password.js +++ b/core/modules/commands/password.js @@ -6,10 +6,7 @@ module-type: command Save password for crypto operations \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; exports.info = { @@ -32,5 +29,3 @@ Command.prototype.execute = function() { }; exports.Command = Command; - -})(); diff --git a/core/modules/commands/render.js b/core/modules/commands/render.js index bd8b23171..c85feda92 100644 --- a/core/modules/commands/render.js +++ b/core/modules/commands/render.js @@ -6,10 +6,7 @@ module-type: command Render individual tiddlers and save the results to the specified files \*/ -(function(){ - /*jslint node: true, browser: true */ - /*global $tw: false */ "use strict"; var widget = require("$:/core/modules/widgets/widget.js"); @@ -66,6 +63,3 @@ Render individual tiddlers and save the results to the specified files }; exports.Command = Command; - - })(); - \ No newline at end of file diff --git a/core/modules/commands/rendertiddler.js b/core/modules/commands/rendertiddler.js index 41812aea1..2a996c8c1 100755 --- a/core/modules/commands/rendertiddler.js +++ b/core/modules/commands/rendertiddler.js @@ -6,10 +6,7 @@ module-type: command Command to render a tiddler and save it to a file \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; exports.info = { @@ -53,5 +50,3 @@ Command.prototype.execute = function() { }; exports.Command = Command; - -})(); diff --git a/core/modules/commands/rendertiddlers.js b/core/modules/commands/rendertiddlers.js index 78272cc33..f392ba704 100644 --- a/core/modules/commands/rendertiddlers.js +++ b/core/modules/commands/rendertiddlers.js @@ -6,10 +6,7 @@ module-type: command Command to render several tiddlers to a folder of files \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; var widget = require("$:/core/modules/widgets/widget.js"); @@ -65,5 +62,3 @@ Command.prototype.execute = function() { }; exports.Command = Command; - -})(); diff --git a/core/modules/commands/save.js b/core/modules/commands/save.js index 3cb7ef08c..1d9155623 100644 --- a/core/modules/commands/save.js +++ b/core/modules/commands/save.js @@ -6,10 +6,7 @@ module-type: command Saves individual tiddlers in their raw text or binary format to the specified files \*/ -(function(){ - /*jslint node: true, browser: true */ - /*global $tw: false */ "use strict"; exports.info = { @@ -64,6 +61,3 @@ Saves individual tiddlers in their raw text or binary format to the specified fi }; exports.Command = Command; - - })(); - \ No newline at end of file diff --git a/core/modules/commands/savelibrarytiddlers.js b/core/modules/commands/savelibrarytiddlers.js index af42d7c8a..431960edd 100644 --- a/core/modules/commands/savelibrarytiddlers.js +++ b/core/modules/commands/savelibrarytiddlers.js @@ -16,10 +16,7 @@ The pathname specifies the pathname to the folder in which the JSON files should The skinnylisting specifies the title of the tiddler to which a JSON catalogue of the subtiddlers will be saved. The JSON file contains the same data as the bundle tiddler but with the `text` field removed. \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; exports.info = { @@ -94,5 +91,3 @@ Command.prototype.execute = function() { }; exports.Command = Command; - -})(); diff --git a/core/modules/commands/savetiddler.js b/core/modules/commands/savetiddler.js index efc484ec7..492fe9f12 100644 --- a/core/modules/commands/savetiddler.js +++ b/core/modules/commands/savetiddler.js @@ -6,10 +6,7 @@ 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 = { @@ -47,5 +44,3 @@ Command.prototype.execute = function() { }; exports.Command = Command; - -})(); diff --git a/core/modules/commands/savetiddlers.js b/core/modules/commands/savetiddlers.js index 9c750e204..0e15d5edc 100644 --- a/core/modules/commands/savetiddlers.js +++ b/core/modules/commands/savetiddlers.js @@ -6,10 +6,7 @@ module-type: command Command to save several tiddlers to a folder of files \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; var widget = require("$:/core/modules/widgets/widget.js"); @@ -52,5 +49,3 @@ Command.prototype.execute = function() { }; exports.Command = Command; - -})(); diff --git a/core/modules/commands/savewikifolder.js b/core/modules/commands/savewikifolder.js index 461ff6f04..751e0e54e 100644 --- a/core/modules/commands/savewikifolder.js +++ b/core/modules/commands/savewikifolder.js @@ -15,10 +15,7 @@ The following options are supported: Supports backward compatibility with --savewikifolder [] [ [=] ]* \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; exports.info = { @@ -221,5 +218,3 @@ WikiFolderMaker.prototype.saveFile = function(filename,encoding,data) { }; exports.Command = Command; - -})(); diff --git a/core/modules/commands/server.js b/core/modules/commands/server.js index 507d1281d..d1ee487a2 100644 --- a/core/modules/commands/server.js +++ b/core/modules/commands/server.js @@ -6,10 +6,7 @@ module-type: command Deprecated legacy command for serving tiddlers \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; var Server = require("$:/core/modules/server/server.js").Server; @@ -51,5 +48,3 @@ Command.prototype.execute = function() { }; exports.Command = Command; - -})(); diff --git a/core/modules/commands/setfield.js b/core/modules/commands/setfield.js index 3f8ec1d14..7be8cbdca 100644 --- a/core/modules/commands/setfield.js +++ b/core/modules/commands/setfield.js @@ -6,10 +6,7 @@ module-type: command Command to modify selected tiddlers to set a field to the text of a template tiddler that has been wikified with the selected tiddler as the current tiddler. \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; var widget = require("$:/core/modules/widgets/widget.js"); @@ -54,5 +51,3 @@ Command.prototype.execute = function() { }; exports.Command = Command; - -})(); diff --git a/core/modules/commands/unpackplugin.js b/core/modules/commands/unpackplugin.js index 6f85c066f..5e2bd33c0 100644 --- a/core/modules/commands/unpackplugin.js +++ b/core/modules/commands/unpackplugin.js @@ -6,10 +6,7 @@ module-type: command Command to extract the shadow tiddlers from within a plugin \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; exports.info = { @@ -40,5 +37,3 @@ Command.prototype.execute = function() { }; exports.Command = Command; - -})(); diff --git a/core/modules/commands/verbose.js b/core/modules/commands/verbose.js index 6b0117829..23b5303c7 100644 --- a/core/modules/commands/verbose.js +++ b/core/modules/commands/verbose.js @@ -6,10 +6,7 @@ module-type: command Verbose command \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; exports.info = { @@ -30,5 +27,3 @@ Command.prototype.execute = function() { }; exports.Command = Command; - -})(); diff --git a/core/modules/commands/version.js b/core/modules/commands/version.js index 24edc97f7..e14c635de 100644 --- a/core/modules/commands/version.js +++ b/core/modules/commands/version.js @@ -6,10 +6,7 @@ module-type: command Version command \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; exports.info = { @@ -28,5 +25,3 @@ Command.prototype.execute = function() { }; exports.Command = Command; - -})(); diff --git a/core/modules/config.js b/core/modules/config.js index fdcf94d0f..3546a21bc 100644 --- a/core/modules/config.js +++ b/core/modules/config.js @@ -6,10 +6,7 @@ module-type: config Core configuration constants \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; exports.preferences = {}; @@ -37,5 +34,3 @@ exports.htmlVoidElements = "area,base,br,col,command,embed,hr,img,input,keygen,l exports.htmlBlockElements = "address,article,aside,audio,blockquote,canvas,dd,details,div,dl,dt,fieldset,figcaption,figure,footer,form,h1,h2,h3,h4,h5,h6,header,hgroup,hr,li,nav,ol,p,pre,section,summary,table,tfoot,ul,video".split(","); exports.htmlUnsafeElements = "script".split(","); - -})(); diff --git a/core/modules/deserializers.js b/core/modules/deserializers.js index bff4aaea1..972a41bb0 100644 --- a/core/modules/deserializers.js +++ b/core/modules/deserializers.js @@ -6,10 +6,7 @@ module-type: tiddlerdeserializer Functions to deserialise tiddlers from a block of text \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; exports["application/x-tiddler-html-div"] = function(text,fields) { @@ -181,5 +178,3 @@ var deserializeTiddlerDiv = function(text /* [,fields] */) { } return undefined; }; - -})(); diff --git a/core/modules/editor/engines/framed.js b/core/modules/editor/engines/framed.js index 34d11dec7..9b1c8cd81 100644 --- a/core/modules/editor/engines/framed.js +++ b/core/modules/editor/engines/framed.js @@ -6,10 +6,7 @@ module-type: library Text editor engine based on a simple input or textarea within an iframe. This is done so that the selection is preserved even when clicking away from the textarea \*/ -(function(){ -/*jslint node: true,browser: true */ -/*global $tw: false */ "use strict"; var HEIGHT_VALUE_TITLE = "$:/config/TextEditor/EditorHeight/Height"; @@ -273,5 +270,3 @@ FramedEngine.prototype.executeTextOperation = function(operation) { }; exports.FramedEngine = FramedEngine; - -})(); diff --git a/core/modules/editor/engines/simple.js b/core/modules/editor/engines/simple.js index 809dc58ea..93f021522 100644 --- a/core/modules/editor/engines/simple.js +++ b/core/modules/editor/engines/simple.js @@ -6,10 +6,7 @@ module-type: library Text editor engine based on a simple input or textarea tag \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; var HEIGHT_VALUE_TITLE = "$:/config/TextEditor/EditorHeight/Height"; @@ -172,5 +169,3 @@ SimpleEngine.prototype.executeTextOperation = function(operation) { }; exports.SimpleEngine = SimpleEngine; - -})(); diff --git a/core/modules/editor/factory.js b/core/modules/editor/factory.js index 6157ec67f..984cc76ba 100644 --- a/core/modules/editor/factory.js +++ b/core/modules/editor/factory.js @@ -6,10 +6,7 @@ module-type: library Factory for constructing text editor widgets with specified engines for the toolbar and non-toolbar cases \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; var DEFAULT_MIN_TEXT_AREA_HEIGHT = "100px"; // Minimum height of textareas in pixels @@ -386,5 +383,3 @@ function editTextWidgetFactory(toolbarEngine,nonToolbarEngine) { } exports.editTextWidgetFactory = editTextWidgetFactory; - -})(); diff --git a/core/modules/editor/operations/bitmap/clear.js b/core/modules/editor/operations/bitmap/clear.js index cb86b43a1..48d5772d5 100644 --- a/core/modules/editor/operations/bitmap/clear.js +++ b/core/modules/editor/operations/bitmap/clear.js @@ -6,10 +6,7 @@ module-type: bitmapeditoroperation Bitmap editor operation to clear the image \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; exports["clear"] = function(event) { @@ -20,5 +17,3 @@ exports["clear"] = function(event) { // Save changes this.strokeEnd(); }; - -})(); diff --git a/core/modules/editor/operations/bitmap/resize.js b/core/modules/editor/operations/bitmap/resize.js index 12059a5cb..683cfa11a 100644 --- a/core/modules/editor/operations/bitmap/resize.js +++ b/core/modules/editor/operations/bitmap/resize.js @@ -6,10 +6,7 @@ module-type: bitmapeditoroperation Bitmap editor operation to resize the image \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; exports["resize"] = function(event) { @@ -25,5 +22,3 @@ exports["resize"] = function(event) { // Save the image into the tiddler this.saveChanges(); }; - -})(); diff --git a/core/modules/editor/operations/bitmap/rotate-left.js b/core/modules/editor/operations/bitmap/rotate-left.js index 6e1b15d3e..25aa77300 100644 --- a/core/modules/editor/operations/bitmap/rotate-left.js +++ b/core/modules/editor/operations/bitmap/rotate-left.js @@ -6,10 +6,7 @@ module-type: bitmapeditoroperation Bitmap editor operation to rotate the image left by 90 degrees \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; exports["rotate-left"] = function(event) { @@ -20,5 +17,3 @@ exports["rotate-left"] = function(event) { // Save the image into the tiddler this.saveChanges(); }; - -})(); diff --git a/core/modules/editor/operations/text/excise.js b/core/modules/editor/operations/text/excise.js index 0753705c5..c0920cf09 100644 --- a/core/modules/editor/operations/text/excise.js +++ b/core/modules/editor/operations/text/excise.js @@ -6,10 +6,7 @@ module-type: texteditoroperation Text editor operation to excise the selection to a new tiddler \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; function isMarkdown(mediaType) { @@ -53,5 +50,3 @@ exports["excise"] = function(event,operation) { operation.newSelStart = operation.selStart; operation.newSelEnd = operation.selStart + operation.replacement.length; }; - -})(); diff --git a/core/modules/editor/operations/text/focus-editor.js b/core/modules/editor/operations/text/focus-editor.js index 0b36f731c..19e4a8997 100644 --- a/core/modules/editor/operations/text/focus-editor.js +++ b/core/modules/editor/operations/text/focus-editor.js @@ -4,14 +4,9 @@ type: application/javascript module-type: texteditoroperation Simply focus the Text editor \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; exports["focus-editor"] = function(event,operation) { operation = null; }; - -})(); \ No newline at end of file diff --git a/core/modules/editor/operations/text/insert-text.js b/core/modules/editor/operations/text/insert-text.js index 784714968..0e24d7413 100644 --- a/core/modules/editor/operations/text/insert-text.js +++ b/core/modules/editor/operations/text/insert-text.js @@ -6,10 +6,7 @@ module-type: texteditoroperation Text editor operation insert text at the caret position. If there is a selection it is replaced. \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; exports["insert-text"] = function(event,operation) { @@ -19,5 +16,3 @@ exports["insert-text"] = function(event,operation) { operation.newSelStart = operation.selStart + operation.replacement.length; operation.newSelEnd = operation.newSelStart; }; - -})(); diff --git a/core/modules/editor/operations/text/make-link.js b/core/modules/editor/operations/text/make-link.js index e8caf21c5..ca11f34c6 100644 --- a/core/modules/editor/operations/text/make-link.js +++ b/core/modules/editor/operations/text/make-link.js @@ -6,10 +6,7 @@ module-type: texteditoroperation Text editor operation to make a link \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; exports["make-link"] = function(event,operation) { @@ -25,5 +22,3 @@ exports["make-link"] = function(event,operation) { operation.newSelStart = operation.selStart + operation.replacement.length; operation.newSelEnd = operation.newSelStart; }; - -})(); diff --git a/core/modules/editor/operations/text/prefix-lines.js b/core/modules/editor/operations/text/prefix-lines.js index 0a005c96f..0f3412b67 100644 --- a/core/modules/editor/operations/text/prefix-lines.js +++ b/core/modules/editor/operations/text/prefix-lines.js @@ -6,10 +6,7 @@ module-type: texteditoroperation Text editor operation to add a prefix to the selected lines \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; exports["prefix-lines"] = function(event,operation) { @@ -51,5 +48,3 @@ exports["prefix-lines"] = function(event,operation) { operation.newSelEnd = operation.newSelStart + operation.replacement.length; } }; - -})(); diff --git a/core/modules/editor/operations/text/replace-all.js b/core/modules/editor/operations/text/replace-all.js index fc1541935..f6fe0b24c 100644 --- a/core/modules/editor/operations/text/replace-all.js +++ b/core/modules/editor/operations/text/replace-all.js @@ -6,10 +6,7 @@ module-type: texteditoroperation Text editor operation to replace the entire text \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; exports["replace-all"] = function(event,operation) { @@ -19,5 +16,3 @@ exports["replace-all"] = function(event,operation) { operation.newSelStart = 0; operation.newSelEnd = operation.replacement.length; }; - -})(); diff --git a/core/modules/editor/operations/text/replace-selection.js b/core/modules/editor/operations/text/replace-selection.js index 740a41fb1..24ef9c70f 100644 --- a/core/modules/editor/operations/text/replace-selection.js +++ b/core/modules/editor/operations/text/replace-selection.js @@ -6,10 +6,7 @@ module-type: texteditoroperation Text editor operation to replace the selection \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; exports["replace-selection"] = function(event,operation) { @@ -19,5 +16,3 @@ exports["replace-selection"] = function(event,operation) { operation.newSelStart = operation.selStart; operation.newSelEnd = operation.selStart + operation.replacement.length; }; - -})(); diff --git a/core/modules/editor/operations/text/save-selection.js b/core/modules/editor/operations/text/save-selection.js index 484e6ff3c..00b7174b6 100644 --- a/core/modules/editor/operations/text/save-selection.js +++ b/core/modules/editor/operations/text/save-selection.js @@ -6,10 +6,7 @@ module-type: texteditoroperation Text editor operation to save the current selection in a specified tiddler \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; exports["save-selection"] = function(event,operation) { @@ -19,5 +16,3 @@ exports["save-selection"] = function(event,operation) { this.wiki.setText(tiddler,field,null,operation.text.substring(operation.selStart,operation.selEnd)); } }; - -})(); diff --git a/core/modules/editor/operations/text/wrap-lines.js b/core/modules/editor/operations/text/wrap-lines.js index 2e4f22943..9e85d50ca 100644 --- a/core/modules/editor/operations/text/wrap-lines.js +++ b/core/modules/editor/operations/text/wrap-lines.js @@ -6,10 +6,7 @@ module-type: texteditoroperation Text editor operation to wrap the selected lines with a prefix and suffix \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; exports["wrap-lines"] = function(event,operation) { @@ -43,5 +40,3 @@ exports["wrap-lines"] = function(event,operation) { operation.newSelEnd = operation.newSelStart + (operation.cutEnd - operation.cutStart); } }; - -})(); diff --git a/core/modules/editor/operations/text/wrap-selection.js b/core/modules/editor/operations/text/wrap-selection.js index 665d72eb4..4fb463b74 100644 --- a/core/modules/editor/operations/text/wrap-selection.js +++ b/core/modules/editor/operations/text/wrap-selection.js @@ -6,10 +6,7 @@ module-type: texteditoroperation Text editor operation to wrap the selection with the specified prefix and suffix \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; exports["wrap-selection"] = function(event,operation) { @@ -134,5 +131,3 @@ exports["wrap-selection"] = function(event,operation) { addPrefixSuffix(); } }; - -})(); diff --git a/core/modules/filterrunprefixes/all.js b/core/modules/filterrunprefixes/all.js index 652936de0..7d57ce408 100644 --- a/core/modules/filterrunprefixes/all.js +++ b/core/modules/filterrunprefixes/all.js @@ -7,10 +7,7 @@ Union of sets without de-duplication. Equivalent to = filter run prefix. \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; /* @@ -21,5 +18,3 @@ exports.all = function(operationSubFunction) { results.push.apply(results, operationSubFunction(source,widget)); }; }; - -})(); diff --git a/core/modules/filterrunprefixes/and.js b/core/modules/filterrunprefixes/and.js index 309c228e6..c394b243e 100644 --- a/core/modules/filterrunprefixes/and.js +++ b/core/modules/filterrunprefixes/and.js @@ -7,10 +7,7 @@ Intersection of sets. Equivalent to + filter run prefix. \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; /* @@ -24,5 +21,3 @@ exports.and = function(operationSubFunction,options) { results.pushTop(operationSubFunction(source,widget)); }; }; - -})(); diff --git a/core/modules/filterrunprefixes/cascade.js b/core/modules/filterrunprefixes/cascade.js index 486e75f45..98044579c 100644 --- a/core/modules/filterrunprefixes/cascade.js +++ b/core/modules/filterrunprefixes/cascade.js @@ -3,10 +3,7 @@ title: $:/core/modules/filterrunprefixes/cascade.js type: application/javascript module-type: filterrunprefix \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; /* @@ -39,5 +36,3 @@ exports.cascade = function(operationSubFunction,options) { } } }; - -})(); \ No newline at end of file diff --git a/core/modules/filterrunprefixes/else.js b/core/modules/filterrunprefixes/else.js index 6e9ef29b3..89635069c 100644 --- a/core/modules/filterrunprefixes/else.js +++ b/core/modules/filterrunprefixes/else.js @@ -6,10 +6,7 @@ module-type: filterrunprefix Equivalent to ~ filter run prefix. \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; /* @@ -23,5 +20,3 @@ exports.else = function(operationSubFunction) { } }; }; - -})(); diff --git a/core/modules/filterrunprefixes/except.js b/core/modules/filterrunprefixes/except.js index 659f14228..5ebed7fea 100644 --- a/core/modules/filterrunprefixes/except.js +++ b/core/modules/filterrunprefixes/except.js @@ -7,10 +7,7 @@ Difference of sets. Equivalent to - filter run prefix. \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; /* @@ -21,5 +18,3 @@ exports.except = function(operationSubFunction) { results.remove(operationSubFunction(source,widget)); }; }; - -})(); diff --git a/core/modules/filterrunprefixes/filter.js b/core/modules/filterrunprefixes/filter.js index 4ab057109..0c6ed150f 100644 --- a/core/modules/filterrunprefixes/filter.js +++ b/core/modules/filterrunprefixes/filter.js @@ -4,10 +4,7 @@ type: application/javascript module-type: filterrunprefix \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; /* @@ -35,5 +32,3 @@ exports.filter = function(operationSubFunction,options) { } } }; - -})(); diff --git a/core/modules/filterrunprefixes/intersection.js b/core/modules/filterrunprefixes/intersection.js index 34d36066f..ce9ea4546 100644 --- a/core/modules/filterrunprefixes/intersection.js +++ b/core/modules/filterrunprefixes/intersection.js @@ -4,10 +4,7 @@ type: application/javascript module-type: filterrunprefix \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; /* @@ -27,5 +24,3 @@ exports.intersection = function(operationSubFunction) { } }; }; - -})(); diff --git a/core/modules/filterrunprefixes/map.js b/core/modules/filterrunprefixes/map.js index b756d6699..c7f1ae5eb 100644 --- a/core/modules/filterrunprefixes/map.js +++ b/core/modules/filterrunprefixes/map.js @@ -3,10 +3,7 @@ title: $:/core/modules/filterrunprefixes/map.js type: application/javascript module-type: filterrunprefix \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; /* @@ -40,5 +37,3 @@ exports.map = function(operationSubFunction,options) { } } }; - -})(); \ No newline at end of file diff --git a/core/modules/filterrunprefixes/or.js b/core/modules/filterrunprefixes/or.js index 82eff083a..c4ffb2014 100644 --- a/core/modules/filterrunprefixes/or.js +++ b/core/modules/filterrunprefixes/or.js @@ -6,10 +6,7 @@ module-type: filterrunprefix Equivalent to a filter run with no prefix. \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; /* @@ -20,5 +17,3 @@ exports.or = function(operationSubFunction) { results.pushTop(operationSubFunction(source,widget)); }; }; - -})(); diff --git a/core/modules/filterrunprefixes/reduce.js b/core/modules/filterrunprefixes/reduce.js index ee2998837..351d976bd 100644 --- a/core/modules/filterrunprefixes/reduce.js +++ b/core/modules/filterrunprefixes/reduce.js @@ -3,10 +3,7 @@ title: $:/core/modules/filterrunprefixes/reduce.js type: application/javascript module-type: filterrunprefix \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; /* @@ -36,5 +33,3 @@ exports.reduce = function(operationSubFunction,options) { } } }; - -})(); diff --git a/core/modules/filterrunprefixes/sort.js b/core/modules/filterrunprefixes/sort.js index d8d376126..126376887 100644 --- a/core/modules/filterrunprefixes/sort.js +++ b/core/modules/filterrunprefixes/sort.js @@ -4,10 +4,7 @@ type: application/javascript module-type: filterrunprefix \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; /* @@ -48,5 +45,3 @@ exports.sort = function(operationSubFunction,options) { } } }; - -})(); \ No newline at end of file diff --git a/core/modules/filterrunprefixes/then.js b/core/modules/filterrunprefixes/then.js index 9f6d5c76a..0f37fb37f 100644 --- a/core/modules/filterrunprefixes/then.js +++ b/core/modules/filterrunprefixes/then.js @@ -6,10 +6,7 @@ module-type: filterrunprefix Replace results of previous runs unless empty \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; /* @@ -28,5 +25,3 @@ exports.then = function(operationSubFunction) { } }; }; - -})(); diff --git a/core/modules/filters.js b/core/modules/filters.js index aa82a352a..321f5a211 100644 --- a/core/modules/filters.js +++ b/core/modules/filters.js @@ -6,10 +6,7 @@ module-type: wikimethod Adds tiddler filtering methods to the $tw.Wiki object. \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; var widgetClass = require("$:/core/modules/widgets/widget.js").widget; @@ -367,5 +364,3 @@ exports.compileFilter = function(filterString) { this.filterCacheCount++; return fnMeasured; }; - -})(); diff --git a/core/modules/filters/addprefix.js b/core/modules/filters/addprefix.js index d1f0a822b..497af1f3b 100644 --- a/core/modules/filters/addprefix.js +++ b/core/modules/filters/addprefix.js @@ -8,10 +8,7 @@ especially useful in contexts where only a filter expression is allowed and macro substitution isn't available. \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; /* @@ -24,5 +21,3 @@ exports.addprefix = function(source,operator,options) { }); return results; }; - -})(); diff --git a/core/modules/filters/addsuffix.js b/core/modules/filters/addsuffix.js index fb80c2573..27ca659e9 100644 --- a/core/modules/filters/addsuffix.js +++ b/core/modules/filters/addsuffix.js @@ -8,10 +8,7 @@ especially useful in contexts where only a filter expression is allowed and macro substitution isn't available. \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; /* @@ -24,5 +21,3 @@ exports.addsuffix = function(source,operator,options) { }); return results; }; - -})(); diff --git a/core/modules/filters/after.js b/core/modules/filters/after.js index 6e5f3c77c..9840a73fa 100644 --- a/core/modules/filters/after.js +++ b/core/modules/filters/after.js @@ -6,10 +6,7 @@ module-type: filteroperator Filter operator returning the tiddler from the current list that is after the tiddler named in the operand. \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; /* @@ -27,5 +24,3 @@ exports.after = function(source,operator,options) { return [results[index + 1]]; } }; - -})(); diff --git a/core/modules/filters/all.js b/core/modules/filters/all.js index 3554a74b3..790afeca5 100644 --- a/core/modules/filters/all.js +++ b/core/modules/filters/all.js @@ -8,10 +8,7 @@ Filter operator for selecting tiddlers [all[shadows+tiddlers]] \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; var allFilterOperators; @@ -54,5 +51,3 @@ exports.all = function(source,operator,options) { } return results.makeTiddlerIterator(options.wiki); }; - -})(); diff --git a/core/modules/filters/all/current.js b/core/modules/filters/all/current.js index 82ad8cca3..098fa85f0 100644 --- a/core/modules/filters/all/current.js +++ b/core/modules/filters/all/current.js @@ -6,10 +6,7 @@ module-type: allfilteroperator Filter function for [all[current]] \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; /* @@ -23,5 +20,3 @@ exports.current = function(source,prefix,options) { return []; } }; - -})(); diff --git a/core/modules/filters/all/missing.js b/core/modules/filters/all/missing.js index 4ba932089..c87e43c98 100644 --- a/core/modules/filters/all/missing.js +++ b/core/modules/filters/all/missing.js @@ -6,10 +6,7 @@ module-type: allfilteroperator Filter function for [all[missing]] \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; /* @@ -18,5 +15,3 @@ Export our filter function exports.missing = function(source,prefix,options) { return options.wiki.getMissingTitles(); }; - -})(); diff --git a/core/modules/filters/all/orphans.js b/core/modules/filters/all/orphans.js index d5b4fc270..a2e29ba97 100644 --- a/core/modules/filters/all/orphans.js +++ b/core/modules/filters/all/orphans.js @@ -6,10 +6,7 @@ module-type: allfilteroperator Filter function for [all[orphans]] \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; /* @@ -18,5 +15,3 @@ Export our filter function exports.orphans = function(source,prefix,options) { return options.wiki.getOrphanTitles(); }; - -})(); diff --git a/core/modules/filters/all/shadows.js b/core/modules/filters/all/shadows.js index 51654fee2..7946afa73 100644 --- a/core/modules/filters/all/shadows.js +++ b/core/modules/filters/all/shadows.js @@ -6,10 +6,7 @@ module-type: allfilteroperator Filter function for [all[shadows]] \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; /* @@ -18,5 +15,3 @@ Export our filter function exports.shadows = function(source,prefix,options) { return options.wiki.allShadowTitles(); }; - -})(); diff --git a/core/modules/filters/all/tags.js b/core/modules/filters/all/tags.js index 2aaa9dec2..de243453f 100644 --- a/core/modules/filters/all/tags.js +++ b/core/modules/filters/all/tags.js @@ -6,10 +6,7 @@ module-type: allfilteroperator Filter function for [all[tags]] \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; /* @@ -18,5 +15,3 @@ Export our filter function exports.tags = function(source,prefix,options) { return Object.keys(options.wiki.getTagMap()); }; - -})(); diff --git a/core/modules/filters/all/tiddlers.js b/core/modules/filters/all/tiddlers.js index 9a6e43875..4e480bf4d 100644 --- a/core/modules/filters/all/tiddlers.js +++ b/core/modules/filters/all/tiddlers.js @@ -6,10 +6,7 @@ module-type: allfilteroperator Filter function for [all[tiddlers]] \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; /* @@ -18,5 +15,3 @@ Export our filter function exports.tiddlers = function(source,prefix,options) { return options.wiki.allTitles(); }; - -})(); diff --git a/core/modules/filters/backlinks.js b/core/modules/filters/backlinks.js index f066d936a..f8bd4903a 100644 --- a/core/modules/filters/backlinks.js +++ b/core/modules/filters/backlinks.js @@ -6,10 +6,7 @@ module-type: filteroperator Filter operator for returning all the backlinks from a tiddler \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; /* @@ -22,5 +19,3 @@ exports.backlinks = function(source,operator,options) { }); return results.makeTiddlerIterator(options.wiki); }; - -})(); diff --git a/core/modules/filters/backtranscludes.js b/core/modules/filters/backtranscludes.js index 253b9dd7b..07ef9b254 100644 --- a/core/modules/filters/backtranscludes.js +++ b/core/modules/filters/backtranscludes.js @@ -6,10 +6,6 @@ module-type: filteroperator Filter operator for returning all the backtranscludes from a tiddler \*/ -(function(){ - -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; /* @@ -22,5 +18,3 @@ exports.backtranscludes = function(source,operator,options) { }); return results.makeTiddlerIterator(options.wiki); }; - -})(); diff --git a/core/modules/filters/before.js b/core/modules/filters/before.js index 292cc619d..1d3473b69 100644 --- a/core/modules/filters/before.js +++ b/core/modules/filters/before.js @@ -6,10 +6,7 @@ module-type: filteroperator Filter operator returning the tiddler from the current list that is before the tiddler named in the operand. \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; /* @@ -27,5 +24,3 @@ exports.before = function(source,operator,options) { return [results[index - 1]]; } }; - -})(); diff --git a/core/modules/filters/commands.js b/core/modules/filters/commands.js index 5ab575a78..753c8b8db 100644 --- a/core/modules/filters/commands.js +++ b/core/modules/filters/commands.js @@ -6,10 +6,7 @@ module-type: filteroperator Filter operator for returning the names of the commands available in this wiki \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; /* @@ -23,5 +20,3 @@ exports.commands = function(source,operator,options) { results.sort(); return results; }; - -})(); diff --git a/core/modules/filters/compare.js b/core/modules/filters/compare.js index fd509a28e..ac84f8da2 100644 --- a/core/modules/filters/compare.js +++ b/core/modules/filters/compare.js @@ -6,10 +6,7 @@ module-type: filteroperator General purpose comparison operator \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; exports.compare = function(source,operator,options) { @@ -36,5 +33,3 @@ var modes = { "lteq": function(value) {return value <= 0;}, "lt": function(value) {return value < 0;} } - -})(); diff --git a/core/modules/filters/contains.js b/core/modules/filters/contains.js index 918f415cd..910b43a4a 100644 --- a/core/modules/filters/contains.js +++ b/core/modules/filters/contains.js @@ -6,10 +6,7 @@ module-type: filteroperator Filter operator for finding values in array fields \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; /* @@ -41,5 +38,3 @@ exports.contains = function(source,operator,options) { } return results; }; - -})(); diff --git a/core/modules/filters/count.js b/core/modules/filters/count.js index 638b135df..3a7be70ad 100644 --- a/core/modules/filters/count.js +++ b/core/modules/filters/count.js @@ -6,10 +6,7 @@ module-type: filteroperator Filter operator returning the number of entries in the current list. \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; /* @@ -22,5 +19,3 @@ exports.count = function(source,operator,options) { }); return [count + ""]; }; - -})(); diff --git a/core/modules/filters/crypto.js b/core/modules/filters/crypto.js index cfb524d06..8b05220b2 100644 --- a/core/modules/filters/crypto.js +++ b/core/modules/filters/crypto.js @@ -6,10 +6,7 @@ module-type: filteroperator Filter operators for cryptography, using the Stanford JavaScript library \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; exports.sha256 = function(source,operator,options) { @@ -20,5 +17,3 @@ exports.sha256 = function(source,operator,options) { }); return results; }; - -})(); diff --git a/core/modules/filters/days.js b/core/modules/filters/days.js index 318d72567..663416d64 100644 --- a/core/modules/filters/days.js +++ b/core/modules/filters/days.js @@ -6,10 +6,7 @@ module-type: filteroperator Filter operator that selects tiddlers with a specified date field within a specified date interval. \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; /* @@ -46,5 +43,3 @@ exports.days = function(source,operator,options) { } return results; }; - -})(); diff --git a/core/modules/filters/deserialize.js b/core/modules/filters/deserialize.js index 5511f29e8..cebab43d3 100644 --- a/core/modules/filters/deserialize.js +++ b/core/modules/filters/deserialize.js @@ -4,10 +4,7 @@ type: application/javascript module-type: filteroperator Filter operator for deserializing string data into JSON representing tiddlers \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; exports["deserialize"] = function(source,operator,options) { @@ -35,5 +32,3 @@ exports["deserialize"] = function(source,operator,options) { } return results; } - -})(); \ No newline at end of file diff --git a/core/modules/filters/deserializers.js b/core/modules/filters/deserializers.js index ddca998ea..7ab96fbae 100644 --- a/core/modules/filters/deserializers.js +++ b/core/modules/filters/deserializers.js @@ -6,10 +6,7 @@ module-type: filteroperator Filter operator for returning the names of the deserializers in this wiki \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; /* @@ -23,5 +20,3 @@ exports.deserializers = function(source,operator,options) { results.sort(); return results; }; - -})(); \ No newline at end of file diff --git a/core/modules/filters/duplicateslugs.js b/core/modules/filters/duplicateslugs.js index dbd2f23e7..30b6da0a7 100644 --- a/core/modules/filters/duplicateslugs.js +++ b/core/modules/filters/duplicateslugs.js @@ -6,10 +6,7 @@ module-type: filteroperator Filter function for [duplicateslugs[]] \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; /* @@ -32,5 +29,3 @@ exports.duplicateslugs = function(source,operator,options) { }); return results; }; - -})(); diff --git a/core/modules/filters/each.js b/core/modules/filters/each.js index 5c2c29077..0a389b5c3 100644 --- a/core/modules/filters/each.js +++ b/core/modules/filters/each.js @@ -7,10 +7,7 @@ Filter operator that selects one tiddler for each unique value of the specified With suffix "list", selects all tiddlers that are values in a specified list field. \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; /* @@ -63,5 +60,3 @@ exports.each = function(source,operator,options) { } return results; }; - -})(); diff --git a/core/modules/filters/eachday.js b/core/modules/filters/eachday.js index 6fdccf879..86f343e25 100644 --- a/core/modules/filters/eachday.js +++ b/core/modules/filters/eachday.js @@ -6,10 +6,7 @@ module-type: filteroperator Filter operator that selects one tiddler for each unique day covered by the specified date field \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; /* @@ -35,5 +32,3 @@ exports.eachday = function(source,operator,options) { }); return results; }; - -})(); diff --git a/core/modules/filters/editiondescription.js b/core/modules/filters/editiondescription.js index 2ee387163..ce526a9a9 100644 --- a/core/modules/filters/editiondescription.js +++ b/core/modules/filters/editiondescription.js @@ -6,10 +6,7 @@ module-type: filteroperator Filter operator for returning the descriptions of the specified edition names \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; /* @@ -29,5 +26,3 @@ exports.editiondescription = function(source,operator,options) { } return results; }; - -})(); diff --git a/core/modules/filters/editions.js b/core/modules/filters/editions.js index 05ae57c31..919dacfe9 100644 --- a/core/modules/filters/editions.js +++ b/core/modules/filters/editions.js @@ -6,10 +6,7 @@ module-type: filteroperator Filter operator for returning the names of the available editions in this wiki \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; /* @@ -28,5 +25,3 @@ exports.editions = function(source,operator,options) { } return results; }; - -})(); diff --git a/core/modules/filters/else.js b/core/modules/filters/else.js index c3829371e..cffcf33ef 100644 --- a/core/modules/filters/else.js +++ b/core/modules/filters/else.js @@ -6,10 +6,7 @@ module-type: filteroperator Filter operator for replacing an empty input list with a constant, passing a non-empty input list straight through \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; /* @@ -26,5 +23,3 @@ exports.else = function(source,operator,options) { return results; } }; - -})(); diff --git a/core/modules/filters/encodings.js b/core/modules/filters/encodings.js index 231e4d119..ecb0d7289 100644 --- a/core/modules/filters/encodings.js +++ b/core/modules/filters/encodings.js @@ -6,10 +6,7 @@ module-type: filteroperator Filter operator for applying decodeURIComponent() to each item. \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; /* @@ -116,5 +113,3 @@ exports.escapecss = function(source,operator,options) { }); return results; }; - -})(); diff --git a/core/modules/filters/enlist.js b/core/modules/filters/enlist.js index 0baaa9366..69aa9e9e0 100644 --- a/core/modules/filters/enlist.js +++ b/core/modules/filters/enlist.js @@ -6,10 +6,7 @@ module-type: filteroperator Filter operator returning its operand parsed as a list \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; /* @@ -38,5 +35,3 @@ exports.enlist = function(source,operator,options) { return list; } }; - -})(); diff --git a/core/modules/filters/field.js b/core/modules/filters/field.js index 3a07c0c27..8dd608d45 100644 --- a/core/modules/filters/field.js +++ b/core/modules/filters/field.js @@ -6,10 +6,7 @@ module-type: filteroperator Filter operator for comparing fields for equality \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; /* @@ -71,5 +68,3 @@ exports.field = function(source,operator,options) { } return results; }; - -})(); diff --git a/core/modules/filters/fields.js b/core/modules/filters/fields.js index 2f0bf26dc..e569f0e5e 100644 --- a/core/modules/filters/fields.js +++ b/core/modules/filters/fields.js @@ -6,10 +6,7 @@ module-type: filteroperator Filter operator for returning the names of the fields on the selected tiddlers \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; /* @@ -41,5 +38,3 @@ exports.fields = function(source,operator,options) { }); return results; }; - -})(); diff --git a/core/modules/filters/filter.js b/core/modules/filters/filter.js index f15cbefc5..466d43f8b 100644 --- a/core/modules/filters/filter.js +++ b/core/modules/filters/filter.js @@ -6,10 +6,7 @@ module-type: filteroperator Filter operator returning those input titles that pass a subfilter \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; /* @@ -30,5 +27,3 @@ exports.filter = function(source,operator,options) { }); return results; }; - -})(); diff --git a/core/modules/filters/format.js b/core/modules/filters/format.js index 2fc786d88..944007797 100644 --- a/core/modules/filters/format.js +++ b/core/modules/filters/format.js @@ -4,10 +4,7 @@ type: application/javascript module-type: filteroperator Filter operator for formatting strings \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; var formatFilterOperators; @@ -42,5 +39,3 @@ exports.format = function(source,operator,options) { return results; } }; - -})(); \ No newline at end of file diff --git a/core/modules/filters/format/date.js b/core/modules/filters/format/date.js index fcf1a5cad..c74df3444 100644 --- a/core/modules/filters/format/date.js +++ b/core/modules/filters/format/date.js @@ -3,10 +3,7 @@ title: $:/core/modules/filters/format/date.js type: application/javascript module-type: formatfilteroperator \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; /* @@ -22,5 +19,3 @@ exports.date = function(source,operand,options) { }); return results; }; - -})(); \ No newline at end of file diff --git a/core/modules/filters/format/json.js b/core/modules/filters/format/json.js index 2130a76ed..5db3658e7 100644 --- a/core/modules/filters/format/json.js +++ b/core/modules/filters/format/json.js @@ -3,10 +3,7 @@ title: $:/core/modules/filters/format/json.js type: application/javascript module-type: formatfilteroperator \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; /* @@ -31,5 +28,3 @@ exports.json = function(source,operand,options) { }); return results; }; - -})(); \ No newline at end of file diff --git a/core/modules/filters/format/relativedate.js b/core/modules/filters/format/relativedate.js index f771bb339..ab9c02d72 100644 --- a/core/modules/filters/format/relativedate.js +++ b/core/modules/filters/format/relativedate.js @@ -3,10 +3,7 @@ title: $:/core/modules/filters/format/relativedate.js type: application/javascript module-type: formatfilteroperator \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; /* @@ -22,5 +19,3 @@ exports.relativedate = function(source,operand,options) { }); return results; }; - -})(); \ No newline at end of file diff --git a/core/modules/filters/format/timestamp.js b/core/modules/filters/format/timestamp.js index d6f5afe30..9be351c33 100644 --- a/core/modules/filters/format/timestamp.js +++ b/core/modules/filters/format/timestamp.js @@ -3,10 +3,7 @@ title: $:/core/modules/filters/format/timestamp.js type: application/javascript module-type: formatfilteroperator \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; /* @@ -22,4 +19,3 @@ exports.timestamp = function(source,operand,options) { }); return results; }; -})(); \ No newline at end of file diff --git a/core/modules/filters/format/titlelist.js b/core/modules/filters/format/titlelist.js index 47608323d..9e9c827ef 100644 --- a/core/modules/filters/format/titlelist.js +++ b/core/modules/filters/format/titlelist.js @@ -3,10 +3,7 @@ title: $:/core/modules/filters/format/titlelist.js type: application/javascript module-type: formatfilteroperator \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; /* @@ -21,5 +18,3 @@ exports.titlelist = function(source,operand,options) { }); return results; }; - -})(); diff --git a/core/modules/filters/function.js b/core/modules/filters/function.js index 79210fb78..b6f2fa636 100644 --- a/core/modules/filters/function.js +++ b/core/modules/filters/function.js @@ -6,10 +6,7 @@ module-type: filteroperator Filter operator returning those input titles that are returned from a function \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; /* @@ -17,20 +14,23 @@ Export our filter function */ exports.function = function(source,operator,options) { var functionName = operator.operands[0], - params = []; + params = [], + results; $tw.utils.each(operator.operands.slice(1),function(param) { params.push({value: param}); }); + // console.log(`Calling ${functionName} with params ${JSON.stringify(params)}`); var variableInfo = options.widget && options.widget.getVariableInfo && options.widget.getVariableInfo(functionName,{params: params, source: source}); if(variableInfo && variableInfo.srcVariable && variableInfo.srcVariable.isFunctionDefinition) { - return variableInfo.resultList ? variableInfo.resultList : [variableInfo.text]; + results = variableInfo.resultList ? variableInfo.resultList : [variableInfo.text]; } // Return the input list if the function wasn't found - var results = []; - source(function(tiddler,title) { - results.push(title); - }); + if(!results) { + results = []; + source(function(tiddler,title) { + results.push(title); + }); + } + // console.log(`function ${functionName} with params ${JSON.stringify(params)} results: ${JSON.stringify(results)}`); return results; }; - -})(); diff --git a/core/modules/filters/get.js b/core/modules/filters/get.js index feae6684e..8c078ec85 100644 --- a/core/modules/filters/get.js +++ b/core/modules/filters/get.js @@ -6,10 +6,7 @@ module-type: filteroperator Filter operator for replacing tiddler titles by the value of the field specified in the operand. \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; /* @@ -27,5 +24,3 @@ exports.get = function(source,operator,options) { }); return results; }; - -})(); diff --git a/core/modules/filters/getindex.js b/core/modules/filters/getindex.js index b604d4ec8..ce34b3356 100644 --- a/core/modules/filters/getindex.js +++ b/core/modules/filters/getindex.js @@ -6,10 +6,7 @@ module-type: filteroperator returns the value at a given index of datatiddlers \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; /* @@ -28,5 +25,3 @@ exports.getindex = function(source,operator,options) { } return results; }; - -})(); diff --git a/core/modules/filters/getvariable.js b/core/modules/filters/getvariable.js index 43451abed..eab697194 100644 --- a/core/modules/filters/getvariable.js +++ b/core/modules/filters/getvariable.js @@ -6,10 +6,7 @@ module-type: filteroperator Filter operator for replacing input values by the value of the variable with the same name, or blank if the variable is missing \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; /* @@ -22,5 +19,3 @@ exports.getvariable = function(source,operator,options) { }); return results; }; - -})(); diff --git a/core/modules/filters/has.js b/core/modules/filters/has.js index f081809a3..ceb117f9c 100644 --- a/core/modules/filters/has.js +++ b/core/modules/filters/has.js @@ -6,10 +6,7 @@ module-type: filteroperator Filter operator for checking if a tiddler has the specified field or index \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; /* @@ -66,5 +63,3 @@ exports.has = function(source,operator,options) { } return results; }; - -})(); diff --git a/core/modules/filters/haschanged.js b/core/modules/filters/haschanged.js index 4c63b7758..43d660cb9 100644 --- a/core/modules/filters/haschanged.js +++ b/core/modules/filters/haschanged.js @@ -6,10 +6,7 @@ module-type: filteroperator Filter operator returns tiddlers from the list that have a non-zero changecount. \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; /* @@ -32,5 +29,3 @@ exports.haschanged = function(source,operator,options) { } return results; }; - -})(); diff --git a/core/modules/filters/indexes.js b/core/modules/filters/indexes.js index 3bbb22659..1de730217 100644 --- a/core/modules/filters/indexes.js +++ b/core/modules/filters/indexes.js @@ -6,10 +6,7 @@ module-type: filteroperator Filter operator for returning the indexes of a data tiddler \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; /* @@ -26,5 +23,3 @@ exports.indexes = function(source,operator,options) { results.sort(); return results; }; - -})(); diff --git a/core/modules/filters/insertafter.js b/core/modules/filters/insertafter.js index 79c84cb95..a8f1edf12 100644 --- a/core/modules/filters/insertafter.js +++ b/core/modules/filters/insertafter.js @@ -6,10 +6,7 @@ module-type: filteroperator Insert an item after another item in a list \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; /* @@ -42,5 +39,3 @@ exports.insertafter = function(source,operator,options) { } return results; }; - -})(); diff --git a/core/modules/filters/insertbefore.js b/core/modules/filters/insertbefore.js index 4a032daf9..33e41887f 100644 --- a/core/modules/filters/insertbefore.js +++ b/core/modules/filters/insertbefore.js @@ -6,10 +6,7 @@ module-type: filteroperator Insert an item before another item in a list \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; /* @@ -42,5 +39,3 @@ exports.insertbefore = function(source,operator,options) { } return results; }; - -})(); diff --git a/core/modules/filters/is.js b/core/modules/filters/is.js index b75943786..87861a6e9 100644 --- a/core/modules/filters/is.js +++ b/core/modules/filters/is.js @@ -6,10 +6,7 @@ module-type: filteroperator Filter operator for checking tiddler properties \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; var isFilterOperators; @@ -44,5 +41,3 @@ exports.is = function(source,operator,options) { return results; } }; - -})(); \ No newline at end of file diff --git a/core/modules/filters/is/binary.js b/core/modules/filters/is/binary.js index 01b9aabd3..7fb02772e 100644 --- a/core/modules/filters/is/binary.js +++ b/core/modules/filters/is/binary.js @@ -6,10 +6,7 @@ module-type: isfilteroperator Filter function for [is[binary]] \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; /* @@ -32,5 +29,3 @@ exports.binary = function(source,prefix,options) { } return results; }; - -})(); diff --git a/core/modules/filters/is/blank.js b/core/modules/filters/is/blank.js index 8f500da45..274d3eba1 100644 --- a/core/modules/filters/is/blank.js +++ b/core/modules/filters/is/blank.js @@ -6,10 +6,7 @@ module-type: isfilteroperator Filter function for [is[blank]] \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; /* @@ -32,5 +29,3 @@ exports.blank = function(source,prefix,options) { } return results; }; - -})(); diff --git a/core/modules/filters/is/current.js b/core/modules/filters/is/current.js index b5b88f616..1853c5e28 100644 --- a/core/modules/filters/is/current.js +++ b/core/modules/filters/is/current.js @@ -6,10 +6,7 @@ module-type: isfilteroperator Filter function for [is[current]] \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; /* @@ -33,5 +30,3 @@ exports.current = function(source,prefix,options) { } return results; }; - -})(); diff --git a/core/modules/filters/is/draft.js b/core/modules/filters/is/draft.js index 016da3f49..caba7849f 100644 --- a/core/modules/filters/is/draft.js +++ b/core/modules/filters/is/draft.js @@ -6,10 +6,7 @@ module-type: isfilteroperator Filter function for [is[draft]] analagous to [has[draft.of]] \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; /* @@ -32,5 +29,3 @@ exports.draft = function(source,prefix,options) { } return results; }; - -})(); diff --git a/core/modules/filters/is/image.js b/core/modules/filters/is/image.js index 3527540d3..be276c834 100644 --- a/core/modules/filters/is/image.js +++ b/core/modules/filters/is/image.js @@ -6,10 +6,7 @@ module-type: isfilteroperator Filter function for [is[image]] \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; /* @@ -32,5 +29,3 @@ exports.image = function(source,prefix,options) { } return results; }; - -})(); diff --git a/core/modules/filters/is/missing.js b/core/modules/filters/is/missing.js index 8ebf90d41..7720ac472 100644 --- a/core/modules/filters/is/missing.js +++ b/core/modules/filters/is/missing.js @@ -6,10 +6,7 @@ module-type: isfilteroperator Filter function for [is[missing]] \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; /* @@ -32,5 +29,3 @@ exports.missing = function(source,prefix,options) { } return results; }; - -})(); diff --git a/core/modules/filters/is/orphan.js b/core/modules/filters/is/orphan.js index 94d09ad61..8827da4c9 100644 --- a/core/modules/filters/is/orphan.js +++ b/core/modules/filters/is/orphan.js @@ -6,10 +6,7 @@ module-type: isfilteroperator Filter function for [is[orphan]] \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; /* @@ -33,5 +30,3 @@ exports.orphan = function(source,prefix,options) { } return results; }; - -})(); diff --git a/core/modules/filters/is/shadow.js b/core/modules/filters/is/shadow.js index cfb6b926c..4f1335c69 100644 --- a/core/modules/filters/is/shadow.js +++ b/core/modules/filters/is/shadow.js @@ -6,10 +6,7 @@ module-type: isfilteroperator Filter function for [is[shadow]] \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; /* @@ -32,5 +29,3 @@ exports.shadow = function(source,prefix,options) { } return results; }; - -})(); diff --git a/core/modules/filters/is/system.js b/core/modules/filters/is/system.js index 84d0656fd..b27feb392 100644 --- a/core/modules/filters/is/system.js +++ b/core/modules/filters/is/system.js @@ -6,10 +6,7 @@ module-type: isfilteroperator Filter function for [is[system]] \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; /* @@ -32,5 +29,3 @@ exports.system = function(source,prefix,options) { } return results; }; - -})(); diff --git a/core/modules/filters/is/tag.js b/core/modules/filters/is/tag.js index d614029c4..69d1713be 100644 --- a/core/modules/filters/is/tag.js +++ b/core/modules/filters/is/tag.js @@ -6,10 +6,7 @@ module-type: isfilteroperator Filter function for [is[tag]] \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; /* @@ -33,5 +30,3 @@ exports.tag = function(source,prefix,options) { } return results; }; - -})(); diff --git a/core/modules/filters/is/tiddler.js b/core/modules/filters/is/tiddler.js index d97cd7892..24ca5cee2 100644 --- a/core/modules/filters/is/tiddler.js +++ b/core/modules/filters/is/tiddler.js @@ -6,10 +6,7 @@ module-type: isfilteroperator Filter function for [is[tiddler]] \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; /* @@ -32,5 +29,3 @@ exports.tiddler = function(source,prefix,options) { } return results; }; - -})(); diff --git a/core/modules/filters/is/variable.js b/core/modules/filters/is/variable.js index 110d9a7c8..624a179d7 100644 --- a/core/modules/filters/is/variable.js +++ b/core/modules/filters/is/variable.js @@ -6,10 +6,7 @@ module-type: isfilteroperator Filter function for [is[variable]] \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; /* @@ -32,5 +29,3 @@ exports.variable = function(source,prefix,options) { } return results; }; - -})(); diff --git a/core/modules/filters/json-ops.js b/core/modules/filters/json-ops.js index 0c58964eb..8f16ad417 100644 --- a/core/modules/filters/json-ops.js +++ b/core/modules/filters/json-ops.js @@ -6,10 +6,7 @@ module-type: filteroperator Filter operators for JSON operations \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; exports["jsonget"] = function(source,operator,options) { @@ -279,6 +276,3 @@ function setDataItem(data,indexes,value) { } return data; } - -})(); - \ No newline at end of file diff --git a/core/modules/filters/limit.js b/core/modules/filters/limit.js index c878c1ac7..9b440155e 100644 --- a/core/modules/filters/limit.js +++ b/core/modules/filters/limit.js @@ -6,10 +6,7 @@ module-type: filteroperator Filter operator for chopping the results to a specified maximum number of entries \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; /* @@ -30,5 +27,3 @@ exports.limit = function(source,operator,options) { } return results; }; - -})(); diff --git a/core/modules/filters/links.js b/core/modules/filters/links.js index 0305f4b7f..0b56a8871 100644 --- a/core/modules/filters/links.js +++ b/core/modules/filters/links.js @@ -6,10 +6,7 @@ module-type: filteroperator Filter operator for returning all the links from a tiddler \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; /* @@ -22,5 +19,3 @@ exports.links = function(source,operator,options) { }); return results.makeTiddlerIterator(options.wiki); }; - -})(); diff --git a/core/modules/filters/list.js b/core/modules/filters/list.js index 1b23b9382..2a5e7b8bb 100644 --- a/core/modules/filters/list.js +++ b/core/modules/filters/list.js @@ -6,10 +6,7 @@ module-type: filteroperator Filter operator returning the tiddlers whose title is listed in the operand tiddler \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; /* @@ -31,5 +28,3 @@ exports.list = function(source,operator,options) { } return results; }; - -})(); diff --git a/core/modules/filters/listed.js b/core/modules/filters/listed.js index 8cb1c2f68..610305245 100644 --- a/core/modules/filters/listed.js +++ b/core/modules/filters/listed.js @@ -6,10 +6,7 @@ module-type: filteroperator Filter operator returning all tiddlers that have the selected tiddlers in a list \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; /* @@ -23,5 +20,3 @@ exports.listed = function(source,operator,options) { }); return results; }; - -})(); diff --git a/core/modules/filters/listops.js b/core/modules/filters/listops.js index 89bd8eeb7..ccd81b9fe 100644 --- a/core/modules/filters/listops.js +++ b/core/modules/filters/listops.js @@ -6,10 +6,7 @@ module-type: filteroperator Filter operators for manipulating the current selection list \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; /* @@ -116,5 +113,3 @@ exports.zth = function(source,operator,options) { }); return results.slice(count,count + 1); }; - -})(); diff --git a/core/modules/filters/lookup.js b/core/modules/filters/lookup.js index aaf81729d..f500b87dd 100644 --- a/core/modules/filters/lookup.js +++ b/core/modules/filters/lookup.js @@ -12,10 +12,7 @@ field or index value. If the 2nd suffix does not exist, it defaults to field. If the second operand is missing it defaults to "text" for fields, and "0" for indexes \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; /* @@ -49,5 +46,3 @@ exports.lookup = function(source,operator,options) { } return results; }; - -})(); diff --git a/core/modules/filters/match.js b/core/modules/filters/match.js index 34caf487e..ce0b2b9d4 100644 --- a/core/modules/filters/match.js +++ b/core/modules/filters/match.js @@ -6,10 +6,7 @@ module-type: filteroperator Filter operator for checking if a title matches a string \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; /* @@ -49,5 +46,3 @@ exports.match = function(source,operator,options) { } return results; }; - -})(); diff --git a/core/modules/filters/math.js b/core/modules/filters/math.js index ed8e5eed6..4c2a9168a 100644 --- a/core/modules/filters/math.js +++ b/core/modules/filters/math.js @@ -13,10 +13,7 @@ Note that strings are converted to numbers automatically. Trailing non-digits ar * "12kk" converts to 12 \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; exports.negate = makeNumericBinaryOperator( @@ -128,7 +125,7 @@ exports.minall = makeNumericReducingOperator( exports.median = makeNumericArrayOperator( function(values) { var len = values.length, median; - values.sort(); + values.sort(function(a,b) {return a-b}); if(len % 2) { // Odd, return the middle number median = values[(len - 1) / 2]; @@ -243,5 +240,3 @@ function makeNumericArrayOperator(fnCalc) { return results; }; }; - -})(); diff --git a/core/modules/filters/minlength.js b/core/modules/filters/minlength.js index d4e679bef..4428049f8 100644 --- a/core/modules/filters/minlength.js +++ b/core/modules/filters/minlength.js @@ -6,10 +6,7 @@ module-type: filteroperator Filter operator for filtering out titles that don't meet the minimum length in the operand \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; /* @@ -25,5 +22,3 @@ exports.minlength = function(source,operator,options) { }); return results; }; - -})(); diff --git a/core/modules/filters/moduleproperty.js b/core/modules/filters/moduleproperty.js index 8f3559b09..67b994d52 100644 --- a/core/modules/filters/moduleproperty.js +++ b/core/modules/filters/moduleproperty.js @@ -6,10 +6,7 @@ module-type: filteroperator Filter [[module-name]moduleproperty[name]] retrieve a module property \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; /* @@ -18,13 +15,18 @@ Export our filter function exports.moduleproperty = function(source,operator,options) { var results = []; source(function(tiddler,title) { - var value = require(title)[operator.operand || ""]; - if(value !== undefined) { - results.push(value); + try { + var value = require(title)[operator.operand || ""]; + if(value !== undefined) { + if(typeof value !== "string") { + value = JSON.stringify(value); + } + results.push(value); + } + } catch(e) { + // Do nothing. It probably wasn't a module. } }); results.sort(); return results; }; - -})(); diff --git a/core/modules/filters/modules.js b/core/modules/filters/modules.js index a9e185018..b09d8d825 100644 --- a/core/modules/filters/modules.js +++ b/core/modules/filters/modules.js @@ -6,10 +6,7 @@ module-type: filteroperator Filter operator for returning the titles of the modules of a given type in this wiki \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; /* @@ -37,5 +34,3 @@ exports.modules = function(source,operator,options) { results.sort(); return results; }; - -})(); diff --git a/core/modules/filters/moduletypes.js b/core/modules/filters/moduletypes.js index 67321caea..752c383ac 100644 --- a/core/modules/filters/moduletypes.js +++ b/core/modules/filters/moduletypes.js @@ -6,10 +6,7 @@ module-type: filteroperator Filter operator for returning the names of the module types in this wiki \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; /* @@ -23,5 +20,3 @@ exports.moduletypes = function(source,operator,options) { results.sort(); return results; }; - -})(); diff --git a/core/modules/filters/next.js b/core/modules/filters/next.js index c12295bf5..01c7e1f90 100644 --- a/core/modules/filters/next.js +++ b/core/modules/filters/next.js @@ -6,10 +6,7 @@ module-type: filteroperator Filter operator returning the tiddler whose title occurs next in the list supplied in the operand tiddler \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; /* @@ -28,5 +25,3 @@ exports.next = function(source,operator,options) { }); return results; }; - -})(); diff --git a/core/modules/filters/plugintiddlers.js b/core/modules/filters/plugintiddlers.js index 489ec52e5..c56f88a91 100644 --- a/core/modules/filters/plugintiddlers.js +++ b/core/modules/filters/plugintiddlers.js @@ -6,10 +6,7 @@ module-type: filteroperator Filter operator for returning the titles of the shadow tiddlers within a plugin \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; /* @@ -28,5 +25,3 @@ exports.plugintiddlers = function(source,operator,options) { results.sort(); return results; }; - -})(); diff --git a/core/modules/filters/prefix.js b/core/modules/filters/prefix.js index 97dd56f4e..9b53cd78e 100644 --- a/core/modules/filters/prefix.js +++ b/core/modules/filters/prefix.js @@ -6,10 +6,7 @@ module-type: filteroperator Filter operator for checking if a title starts with a prefix \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; /* @@ -50,5 +47,3 @@ exports.prefix = function(source,operator,options) { } return results; }; - -})(); diff --git a/core/modules/filters/previous.js b/core/modules/filters/previous.js index ed975458c..2d76aa59f 100644 --- a/core/modules/filters/previous.js +++ b/core/modules/filters/previous.js @@ -6,10 +6,7 @@ module-type: filteroperator Filter operator returning the tiddler whose title occurs immediately prior in the list supplied in the operand tiddler \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; /* @@ -28,5 +25,3 @@ exports.previous = function(source,operator,options) { }); return results; }; - -})(); diff --git a/core/modules/filters/range.js b/core/modules/filters/range.js index 09b8d0334..7932e8548 100644 --- a/core/modules/filters/range.js +++ b/core/modules/filters/range.js @@ -6,10 +6,7 @@ module-type: filteroperator Filter operator for generating a numeric range. \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; /* @@ -99,5 +96,3 @@ exports.range = function(source,operator,options) { } return results; }; - -})(); diff --git a/core/modules/filters/reduce.js b/core/modules/filters/reduce.js index efe8aea4a..112a927bc 100644 --- a/core/modules/filters/reduce.js +++ b/core/modules/filters/reduce.js @@ -6,10 +6,7 @@ module-type: filteroperator Filter operator evaluates a subfilter for each item, making the running total available in the variable `accumulator`, and the current index available in the variable `index` \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; /* @@ -44,5 +41,3 @@ exports.reduce = function(source,operator,options) { return []; } }; - -})(); diff --git a/core/modules/filters/regexp.js b/core/modules/filters/regexp.js index 837e77575..b9d3e2377 100644 --- a/core/modules/filters/regexp.js +++ b/core/modules/filters/regexp.js @@ -6,10 +6,7 @@ module-type: filteroperator Filter operator for regexp matching \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; /* @@ -68,5 +65,3 @@ exports.regexp = function(source,operator,options) { } return results; }; - -})(); diff --git a/core/modules/filters/removeprefix.js b/core/modules/filters/removeprefix.js index 185e1fc87..5e9e4919e 100644 --- a/core/modules/filters/removeprefix.js +++ b/core/modules/filters/removeprefix.js @@ -6,10 +6,7 @@ module-type: filteroperator Filter operator for removing a prefix from each title in the list. Titles that do not start with the prefix are removed. \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; /* @@ -34,5 +31,3 @@ exports.removeprefix = function(source,operator,options) { } return results; }; - -})(); diff --git a/core/modules/filters/removesuffix.js b/core/modules/filters/removesuffix.js index 76c0c7b35..98f4f9ba5 100644 --- a/core/modules/filters/removesuffix.js +++ b/core/modules/filters/removesuffix.js @@ -6,10 +6,7 @@ module-type: filteroperator Filter operator for removing a suffix from each title in the list. Titles that do not end with the suffix are removed. \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; /* @@ -38,5 +35,3 @@ exports.removesuffix = function(source,operator,options) { } return results; }; - -})(); diff --git a/core/modules/filters/sameday.js b/core/modules/filters/sameday.js index 5dfc35128..91e3e55e3 100644 --- a/core/modules/filters/sameday.js +++ b/core/modules/filters/sameday.js @@ -6,10 +6,7 @@ module-type: filteroperator Filter operator that selects tiddlers with a modified date field on the same day as the provided value. \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; /* @@ -29,5 +26,3 @@ exports.sameday = function(source,operator,options) { }); return results; }; - -})(); diff --git a/core/modules/filters/search.js b/core/modules/filters/search.js index dcb534c07..532cdc839 100644 --- a/core/modules/filters/search.js +++ b/core/modules/filters/search.js @@ -6,10 +6,7 @@ module-type: filteroperator Filter operator for searching for the text in the operand tiddler \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; /* @@ -55,5 +52,3 @@ exports.search = function(source,operator,options) { }); } }; - -})(); diff --git a/core/modules/filters/shadowsource.js b/core/modules/filters/shadowsource.js index f16e2bcc7..279759991 100644 --- a/core/modules/filters/shadowsource.js +++ b/core/modules/filters/shadowsource.js @@ -6,10 +6,7 @@ module-type: filteroperator Filter operator for returning the source plugins for shadow tiddlers \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; /* @@ -26,5 +23,3 @@ exports.shadowsource = function(source,operator,options) { results.sort(); return results; }; - -})(); diff --git a/core/modules/filters/slugify.js b/core/modules/filters/slugify.js index afc12423e..694426d2a 100644 --- a/core/modules/filters/slugify.js +++ b/core/modules/filters/slugify.js @@ -6,10 +6,7 @@ module-type: filteroperator Filter operator for slugifying a tiddler title \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; exports.slugify = function(source,operator,options) { @@ -19,5 +16,3 @@ exports.slugify = function(source,operator,options) { }); return results; }; - -})(); diff --git a/core/modules/filters/sort.js b/core/modules/filters/sort.js index 176cd4740..cdfe79728 100644 --- a/core/modules/filters/sort.js +++ b/core/modules/filters/sort.js @@ -6,10 +6,7 @@ module-type: filteroperator Filter operator for sorting \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; /* @@ -52,5 +49,3 @@ var prepare_results = function (source) { }); return results; }; - -})(); diff --git a/core/modules/filters/sortsub.js b/core/modules/filters/sortsub.js index d328be09c..291829992 100644 --- a/core/modules/filters/sortsub.js +++ b/core/modules/filters/sortsub.js @@ -6,10 +6,7 @@ module-type: filteroperator Filter operator for sorting by a subfilter \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; /* @@ -48,5 +45,3 @@ exports.sortsub = function(source,operator,options) { }); return results; }; - -})(); diff --git a/core/modules/filters/splitbefore.js b/core/modules/filters/splitbefore.js index 071cead3e..c38b5480d 100644 --- a/core/modules/filters/splitbefore.js +++ b/core/modules/filters/splitbefore.js @@ -6,10 +6,7 @@ module-type: filteroperator Filter operator that splits each result on the first occurance of the specified separator and returns the unique values. \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; /* @@ -27,5 +24,3 @@ exports.splitbefore = function(source,operator,options) { }); return results; }; - -})(); diff --git a/core/modules/filters/storyviews.js b/core/modules/filters/storyviews.js index 41fffed92..df097582a 100644 --- a/core/modules/filters/storyviews.js +++ b/core/modules/filters/storyviews.js @@ -6,10 +6,7 @@ module-type: filteroperator Filter operator for returning the names of the story views in this wiki \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; /* @@ -25,5 +22,3 @@ exports.storyviews = function(source,operator,options) { results.sort(); return results; }; - -})(); diff --git a/core/modules/filters/strings.js b/core/modules/filters/strings.js index 11f7634b7..4183bac7f 100644 --- a/core/modules/filters/strings.js +++ b/core/modules/filters/strings.js @@ -8,10 +8,7 @@ Filter operators for strings. Unary/binary operators work on each item in turn, Sum/product/maxall/minall operate on the entire list, returning a single item. \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; exports.length = makeStringBinaryOperator( @@ -293,5 +290,3 @@ exports.charcode = function(source,operator,options) { }); return [chars.join("")]; }; - -})(); \ No newline at end of file diff --git a/core/modules/filters/subfilter.js b/core/modules/filters/subfilter.js index 79ae82777..5e35f7cd1 100644 --- a/core/modules/filters/subfilter.js +++ b/core/modules/filters/subfilter.js @@ -6,10 +6,7 @@ module-type: filteroperator Filter operator returning its operand evaluated as a filter \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; /* @@ -29,5 +26,3 @@ exports.subfilter = function(source,operator,options) { return list; } }; - -})(); diff --git a/core/modules/filters/substitute.js b/core/modules/filters/substitute.js index 655ef7321..925e59286 100644 --- a/core/modules/filters/substitute.js +++ b/core/modules/filters/substitute.js @@ -6,10 +6,7 @@ module-type: filteroperator Filter operator for substituting variables and embedded filter expressions with their corresponding values \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; /* @@ -32,5 +29,3 @@ exports.substitute = function(source,operator,options) { return results; }; -})(); - \ No newline at end of file diff --git a/core/modules/filters/subtiddlerfields.js b/core/modules/filters/subtiddlerfields.js index 681dd243d..d16150706 100644 --- a/core/modules/filters/subtiddlerfields.js +++ b/core/modules/filters/subtiddlerfields.js @@ -6,10 +6,7 @@ module-type: filteroperator Filter operator for returning the names of the fields on the selected subtiddlers of the plugin named in the operand \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; /* @@ -27,5 +24,3 @@ exports.subtiddlerfields = function(source,operator,options) { }); return results; }; - -})(); diff --git a/core/modules/filters/suffix.js b/core/modules/filters/suffix.js index 96b32c4a9..e31d40568 100644 --- a/core/modules/filters/suffix.js +++ b/core/modules/filters/suffix.js @@ -6,10 +6,7 @@ module-type: filteroperator Filter operator for checking if a title ends with a suffix \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; /* @@ -54,5 +51,3 @@ exports.suffix = function(source,operator,options) { } return results; }; - -})(); diff --git a/core/modules/filters/tag.js b/core/modules/filters/tag.js index 951a28c6b..fdb67af79 100644 --- a/core/modules/filters/tag.js +++ b/core/modules/filters/tag.js @@ -6,10 +6,7 @@ module-type: filteroperator Filter operator for checking for the presence of a tag \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; /* @@ -54,5 +51,3 @@ exports.tag = function(source,operator,options) { } return results; }; - -})(); diff --git a/core/modules/filters/tagging.js b/core/modules/filters/tagging.js index a7fea68ec..0efff01ef 100644 --- a/core/modules/filters/tagging.js +++ b/core/modules/filters/tagging.js @@ -6,10 +6,7 @@ module-type: filteroperator Filter operator returning all tiddlers that are tagged with the selected tiddlers \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; /* @@ -22,5 +19,3 @@ exports.tagging = function(source,operator,options) { }); return results; }; - -})(); diff --git a/core/modules/filters/tags.js b/core/modules/filters/tags.js index 4a73fd83f..c4ce719c8 100644 --- a/core/modules/filters/tags.js +++ b/core/modules/filters/tags.js @@ -6,10 +6,7 @@ module-type: filteroperator Filter operator returning all the tags of the selected tiddlers \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; /* @@ -27,5 +24,3 @@ exports.tags = function(source,operator,options) { }); return Object.keys(tags); }; - -})(); diff --git a/core/modules/filters/then.js b/core/modules/filters/then.js index 994775c08..5d9c75a08 100644 --- a/core/modules/filters/then.js +++ b/core/modules/filters/then.js @@ -6,10 +6,7 @@ module-type: filteroperator Filter operator for replacing any titles with a constant \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; /* @@ -22,5 +19,3 @@ exports.then = function(source,operator,options) { }); return results; }; - -})(); diff --git a/core/modules/filters/title.js b/core/modules/filters/title.js index 88ac6f132..a1dff909b 100644 --- a/core/modules/filters/title.js +++ b/core/modules/filters/title.js @@ -6,10 +6,7 @@ module-type: filteroperator Filter operator for comparing title fields for equality \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; /* @@ -28,5 +25,3 @@ exports.title = function(source,operator,options) { } return results; }; - -})(); diff --git a/core/modules/filters/transcludes.js b/core/modules/filters/transcludes.js index 8f42b3bae..5032e4255 100644 --- a/core/modules/filters/transcludes.js +++ b/core/modules/filters/transcludes.js @@ -6,10 +6,6 @@ module-type: filteroperator Filter operator for returning all the transcludes from a tiddler \*/ -(function(){ - -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; /* @@ -22,5 +18,3 @@ exports.transcludes = function(source,operator,options) { }); return results.makeTiddlerIterator(options.wiki); }; - -})(); diff --git a/core/modules/filters/unknown.js b/core/modules/filters/unknown.js index 6ae5baaf0..8fe2a6889 100644 --- a/core/modules/filters/unknown.js +++ b/core/modules/filters/unknown.js @@ -8,10 +8,7 @@ Filter operator for handling unknown filter operators. Not intended to be used directly by end users, hence the square brackets around the name. \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; var fieldFilterOperatorFn = require("$:/core/modules/filters/field.js").field; @@ -45,5 +42,3 @@ exports["[unknown]"] = function(source,operator,options) { // Otherwise, use the "field" operator return fieldFilterOperatorFn(source,operator,options); }; - -})(); diff --git a/core/modules/filters/untagged.js b/core/modules/filters/untagged.js index d16de87f8..22f3f6d0c 100644 --- a/core/modules/filters/untagged.js +++ b/core/modules/filters/untagged.js @@ -6,10 +6,7 @@ module-type: filteroperator Filter operator returning all the selected tiddlers that are untagged \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; /* @@ -25,5 +22,3 @@ exports.untagged = function(source,operator,options) { }); return results; }; - -})(); diff --git a/core/modules/filters/variables.js b/core/modules/filters/variables.js index c92b780d2..f35885cb0 100644 --- a/core/modules/filters/variables.js +++ b/core/modules/filters/variables.js @@ -6,10 +6,7 @@ module-type: filteroperator Filter operator for returning the names of the active variables \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; /* @@ -28,5 +25,3 @@ exports.variables = function(source,operator,options) { } return names.sort(); }; - -})(); diff --git a/core/modules/filters/wikiparserrules.js b/core/modules/filters/wikiparserrules.js index 213298515..5bdbcdfdf 100644 --- a/core/modules/filters/wikiparserrules.js +++ b/core/modules/filters/wikiparserrules.js @@ -6,10 +6,7 @@ module-type: filteroperator Filter operator for returning the names of the wiki parser rules in this wiki \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; /* @@ -27,5 +24,3 @@ exports.wikiparserrules = function(source,operator,options) { results.sort(); return results; }; - -})(); diff --git a/core/modules/filters/x-listops.js b/core/modules/filters/x-listops.js index ae17297a5..2f305d0ca 100644 --- a/core/modules/filters/x-listops.js +++ b/core/modules/filters/x-listops.js @@ -6,10 +6,7 @@ module-type: filteroperator Extended filter operators to manipulate the current list. \*/ -(function () { - /*jslint node: true, browser: true */ - /*global $tw: false */ "use strict"; /* @@ -231,5 +228,3 @@ Extended filter operators to manipulate the current list. } return cycleValueInArray(results,operands,step); } - -})(); diff --git a/core/modules/indexers/field-indexer.js b/core/modules/indexers/field-indexer.js index 3aefc99ac..47e89de34 100644 --- a/core/modules/indexers/field-indexer.js +++ b/core/modules/indexers/field-indexer.js @@ -6,10 +6,7 @@ module-type: indexer Indexes the tiddlers with each field value \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global modules: false */ "use strict"; var DEFAULT_MAXIMUM_INDEXED_VALUE_LENGTH = 128; @@ -139,5 +136,3 @@ FieldIndexer.prototype.lookup = function(name,value) { }; exports.FieldIndexer = FieldIndexer; - -})(); diff --git a/core/modules/indexers/tag-indexer.js b/core/modules/indexers/tag-indexer.js index 4721fea08..7844173c6 100644 --- a/core/modules/indexers/tag-indexer.js +++ b/core/modules/indexers/tag-indexer.js @@ -6,10 +6,7 @@ module-type: indexer Indexes the tiddlers with each tag \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global modules: false */ "use strict"; function TagIndexer(wiki) { @@ -94,5 +91,3 @@ TagSubIndexer.prototype.lookup = function(tag) { exports.TagIndexer = TagIndexer; - -})(); diff --git a/core/modules/info/platform.js b/core/modules/info/platform.js index 0eb0b9ea8..9775b2d6b 100644 --- a/core/modules/info/platform.js +++ b/core/modules/info/platform.js @@ -6,10 +6,7 @@ module-type: info Initialise basic platform $:/info/ tiddlers \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; exports.getInfoTiddlerFields = function(updateInfoTiddlersCallback) { @@ -48,5 +45,3 @@ exports.getInfoTiddlerFields = function(updateInfoTiddlersCallback) { } return infoTiddlerFields; }; - -})(); diff --git a/core/modules/keyboard.js b/core/modules/keyboard.js index 1740ba35b..8adab9e81 100644 --- a/core/modules/keyboard.js +++ b/core/modules/keyboard.js @@ -6,10 +6,7 @@ module-type: global Keyboard handling utilities \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; var namedKeys = { @@ -383,5 +380,3 @@ KeyboardManager.prototype.handleShortcutChanges = function(changedTiddlers) { }; exports.KeyboardManager = KeyboardManager; - -})(); diff --git a/core/modules/language.js b/core/modules/language.js index 5e44d6696..b0409ee4d 100644 --- a/core/modules/language.js +++ b/core/modules/language.js @@ -6,10 +6,7 @@ module-type: global The $tw.Language() manages translateable strings \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; /* @@ -41,5 +38,3 @@ Language.prototype.getRawString = function(title) { }; exports.Language = Language; - -})(); diff --git a/core/modules/macros/changecount.js b/core/modules/macros/changecount.js index 2d0f62e5a..871ce630d 100644 --- a/core/modules/macros/changecount.js +++ b/core/modules/macros/changecount.js @@ -6,10 +6,7 @@ module-type: macro Macro to return the changecount for the current tiddler \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; /* @@ -26,5 +23,3 @@ Run the macro exports.run = function() { return this.wiki.getChangeCount(this.getVariable("currentTiddler")) + ""; }; - -})(); diff --git a/core/modules/macros/contrastcolour.js b/core/modules/macros/contrastcolour.js index eab6f0108..8134bdeff 100644 --- a/core/modules/macros/contrastcolour.js +++ b/core/modules/macros/contrastcolour.js @@ -6,10 +6,7 @@ module-type: macro Macro to choose which of two colours has the highest contrast with a base colour \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; /* @@ -51,5 +48,3 @@ exports.run = function(target,fallbackTarget,colourA,colourB) { brightnessB = rgbColourB[0] * 0.299 + rgbColourB[1] * 0.587 + rgbColourB[2] * 0.114; return Math.abs(brightnessTarget - brightnessA) > Math.abs(brightnessTarget - brightnessB) ? colourA : colourB; }; - -})(); diff --git a/core/modules/macros/csvtiddlers.js b/core/modules/macros/csvtiddlers.js index a492fd81c..e5d2f9137 100644 --- a/core/modules/macros/csvtiddlers.js +++ b/core/modules/macros/csvtiddlers.js @@ -6,10 +6,7 @@ module-type: macro Macro to output tiddlers matching a filter to CSV \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; /* @@ -75,5 +72,3 @@ exports.run = function(filter,format) { function quoteAndEscape(value) { return "\"" + value.replace(/"/mg,"\"\"") + "\""; } - -})(); diff --git a/core/modules/macros/displayshortcuts.js b/core/modules/macros/displayshortcuts.js index b18297238..10f6c7221 100644 --- a/core/modules/macros/displayshortcuts.js +++ b/core/modules/macros/displayshortcuts.js @@ -6,10 +6,7 @@ module-type: macro Macro to display a list of keyboard shortcuts in human readable form. Notably, it resolves named shortcuts like `((bold))` to the underlying keystrokes. \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; /* @@ -41,5 +38,3 @@ exports.run = function(shortcuts,prefix,separator,suffix) { return ""; } }; - -})(); diff --git a/core/modules/macros/jsontiddler.js b/core/modules/macros/jsontiddler.js index 509fd5559..ff5ae3c9b 100644 --- a/core/modules/macros/jsontiddler.js +++ b/core/modules/macros/jsontiddler.js @@ -6,10 +6,7 @@ module-type: macro Macro to output a single tiddler to JSON \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; /* @@ -37,4 +34,3 @@ exports.run = function(title) { return JSON.stringify(fields,null,$tw.config.preferences.jsonSpaces); }; -})(); diff --git a/core/modules/macros/jsontiddlers.js b/core/modules/macros/jsontiddlers.js index eeaf70d3a..25e08f6b9 100644 --- a/core/modules/macros/jsontiddlers.js +++ b/core/modules/macros/jsontiddlers.js @@ -6,10 +6,7 @@ module-type: macro Macro to output tiddlers matching a filter to JSON \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; /* @@ -29,5 +26,3 @@ Run the macro exports.run = function(filter,spaces) { return this.wiki.getTiddlersAsJson(filter,$tw.utils.parseInt(spaces)); }; - -})(); diff --git a/core/modules/macros/makedatauri.js b/core/modules/macros/makedatauri.js index 0ff862df1..db67495e5 100644 --- a/core/modules/macros/makedatauri.js +++ b/core/modules/macros/makedatauri.js @@ -8,10 +8,7 @@ Macro to convert a string of text to a data URI <> \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; /* @@ -32,5 +29,3 @@ Run the macro exports.run = function(text,type,_canonical_uri) { return $tw.utils.makeDataUri(text,type,_canonical_uri); }; - -})(); diff --git a/core/modules/macros/now.js b/core/modules/macros/now.js index d0a15dce2..86513f1b9 100644 --- a/core/modules/macros/now.js +++ b/core/modules/macros/now.js @@ -6,10 +6,7 @@ module-type: macro Macro to return a formatted version of the current time \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; /* @@ -28,5 +25,3 @@ Run the macro exports.run = function(format) { return $tw.utils.formatDateString(new Date(),format || "0hh:0mm, DDth MMM YYYY"); }; - -})(); diff --git a/core/modules/macros/qualify.js b/core/modules/macros/qualify.js index de9dc6c8e..ff6716dd4 100644 --- a/core/modules/macros/qualify.js +++ b/core/modules/macros/qualify.js @@ -6,10 +6,7 @@ module-type: macro Macro to qualify a state tiddler title according \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; /* @@ -28,5 +25,3 @@ Run the macro exports.run = function(title) { return title + "-" + this.getStateQualifier(); }; - -})(); diff --git a/core/modules/macros/resolvepath.js b/core/modules/macros/resolvepath.js index d84d87563..68c2e4d04 100644 --- a/core/modules/macros/resolvepath.js +++ b/core/modules/macros/resolvepath.js @@ -6,10 +6,7 @@ module-type: macro Resolves a relative path for an absolute rootpath. \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; exports.name = "resolvepath"; @@ -25,5 +22,3 @@ Run the macro exports.run = function(source, root) { return $tw.utils.resolvePath(source, root); }; - -})(); diff --git a/core/modules/macros/unusedtitle.js b/core/modules/macros/unusedtitle.js index 8a61c425e..056c713df 100644 --- a/core/modules/macros/unusedtitle.js +++ b/core/modules/macros/unusedtitle.js @@ -5,10 +5,7 @@ module-type: macro Macro to return a new title that is unused in the wiki. It can be given a name as a base. \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; exports.name = "unusedtitle"; @@ -31,7 +28,5 @@ exports.run = function(baseName,separator,template,startCount) { } // $tw.wiki.generateNewTitle = function(baseTitle,options) // options.prefix must be a string! - return this.wiki.generateNewTitle(baseName, {"prefix": separator, "template": template, "startCount": startCount}); + return this.wiki.generateNewTitle(baseName, {"prefix": separator, "template": template, "startCount": startCount}).trim(); }; - -})(); diff --git a/core/modules/macros/version.js b/core/modules/macros/version.js index b0dd0b0d5..0a5315b81 100644 --- a/core/modules/macros/version.js +++ b/core/modules/macros/version.js @@ -6,10 +6,7 @@ module-type: macro Macro to return the TiddlyWiki core version number \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; /* @@ -26,5 +23,3 @@ Run the macro exports.run = function() { return $tw.version; }; - -})(); diff --git a/core/modules/parsers/audioparser.js b/core/modules/parsers/audioparser.js index 5eb2ff985..601de058e 100644 --- a/core/modules/parsers/audioparser.js +++ b/core/modules/parsers/audioparser.js @@ -6,10 +6,7 @@ module-type: parser The audio parser parses an audio tiddler into an embeddable HTML element \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; var AudioParser = function(type,text,options) { @@ -36,6 +33,3 @@ exports["audio/ogg"] = AudioParser; exports["audio/mpeg"] = AudioParser; exports["audio/mp3"] = AudioParser; exports["audio/mp4"] = AudioParser; - -})(); - diff --git a/core/modules/parsers/binaryparser.js b/core/modules/parsers/binaryparser.js index 60e7b5ef0..947d9befa 100644 --- a/core/modules/parsers/binaryparser.js +++ b/core/modules/parsers/binaryparser.js @@ -6,10 +6,7 @@ module-type: parser The binary parser parses a binary tiddler into a warning message and download link \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; var BINARY_WARNING_MESSAGE = "$:/core/ui/BinaryWarning"; @@ -69,6 +66,3 @@ var BinaryParser = function(type,text,options) { }; exports["application/octet-stream"] = BinaryParser; - -})(); - diff --git a/core/modules/parsers/csvparser.js b/core/modules/parsers/csvparser.js index f40b5f0e5..2d32b3a06 100644 --- a/core/modules/parsers/csvparser.js +++ b/core/modules/parsers/csvparser.js @@ -6,10 +6,7 @@ module-type: parser The CSV text parser processes CSV files into a table wrapped in a scrollable widget \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; var CsvParser = function(type,text,options) { @@ -58,6 +55,3 @@ var CsvParser = function(type,text,options) { exports["text/csv"] = CsvParser; exports["text/tab-delimited-values"] = CsvParser; - -})(); - diff --git a/core/modules/parsers/htmlparser.js b/core/modules/parsers/htmlparser.js index 24c9f5d3e..fee869868 100644 --- a/core/modules/parsers/htmlparser.js +++ b/core/modules/parsers/htmlparser.js @@ -6,10 +6,7 @@ module-type: parser The HTML parser displays text as raw HTML \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; var HtmlParser = function(type,text,options) { @@ -34,6 +31,3 @@ var HtmlParser = function(type,text,options) { }; exports["text/html"] = HtmlParser; - -})(); - diff --git a/core/modules/parsers/imageparser.js b/core/modules/parsers/imageparser.js index a964a4ba8..c7201445f 100644 --- a/core/modules/parsers/imageparser.js +++ b/core/modules/parsers/imageparser.js @@ -6,10 +6,7 @@ module-type: parser The image parser parses an image into an embeddable HTML element \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; var ImageParser = function(type,text,options) { @@ -40,8 +37,6 @@ exports["image/gif"] = ImageParser; exports["image/webp"] = ImageParser; exports["image/heic"] = ImageParser; exports["image/heif"] = ImageParser; +exports["image/avif"] = ImageParser; exports["image/x-icon"] = ImageParser; exports["image/vnd.microsoft.icon"] = ImageParser; - -})(); - diff --git a/core/modules/parsers/parseutils.js b/core/modules/parsers/parseutils.js index 2a2e36309..30bc39509 100644 --- a/core/modules/parsers/parseutils.js +++ b/core/modules/parsers/parseutils.js @@ -22,10 +22,7 @@ Most functions have the following pattern: The exception is `skipWhiteSpace`, which just returns the position after the whitespace. \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; /* @@ -384,5 +381,3 @@ exports.parseAttribute = function(source,pos) { node.end = pos; return node; }; - -})(); diff --git a/core/modules/parsers/pdfparser.js b/core/modules/parsers/pdfparser.js index c7830bf69..0551e93fa 100644 --- a/core/modules/parsers/pdfparser.js +++ b/core/modules/parsers/pdfparser.js @@ -6,10 +6,7 @@ module-type: parser The PDF parser embeds a PDF viewer \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; var ImageParser = function(type,text,options) { @@ -30,6 +27,3 @@ var ImageParser = function(type,text,options) { }; exports["application/pdf"] = ImageParser; - -})(); - diff --git a/core/modules/parsers/textparser.js b/core/modules/parsers/textparser.js index 17f9bde10..ca97404ac 100644 --- a/core/modules/parsers/textparser.js +++ b/core/modules/parsers/textparser.js @@ -6,10 +6,7 @@ module-type: parser The plain text parser processes blocks of source text into a degenerate parse tree consisting of a single text node \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; var TextParser = function(type,text,options) { @@ -32,5 +29,3 @@ exports["application/javascript"] = TextParser; exports["application/json"] = TextParser; exports["text/css"] = TextParser; exports["application/x-tiddler-dictionary"] = TextParser; - -})(); diff --git a/core/modules/parsers/videoparser.js b/core/modules/parsers/videoparser.js index 1c8a38bb2..e4406e56a 100644 --- a/core/modules/parsers/videoparser.js +++ b/core/modules/parsers/videoparser.js @@ -6,10 +6,7 @@ module-type: parser The video parser parses a video tiddler into an embeddable HTML element \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; var VideoParser = function(type,text,options) { @@ -36,5 +33,3 @@ exports["video/ogg"] = VideoParser; exports["video/webm"] = VideoParser; exports["video/mp4"] = VideoParser; exports["video/quicktime"] = VideoParser; - -})(); diff --git a/core/modules/parsers/wikiparser/rules/codeblock.js b/core/modules/parsers/wikiparser/rules/codeblock.js index 6c3480566..bdecd65be 100644 --- a/core/modules/parsers/wikiparser/rules/codeblock.js +++ b/core/modules/parsers/wikiparser/rules/codeblock.js @@ -12,10 +12,7 @@ Wiki text rule for code blocks. For example: ``` \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; exports.name = "codeblock"; @@ -56,5 +53,3 @@ exports.parse = function() { } }]; }; - -})(); diff --git a/core/modules/parsers/wikiparser/rules/codeinline.js b/core/modules/parsers/wikiparser/rules/codeinline.js index 048fc051c..5606ba478 100644 --- a/core/modules/parsers/wikiparser/rules/codeinline.js +++ b/core/modules/parsers/wikiparser/rules/codeinline.js @@ -11,10 +11,7 @@ Wiki text inline rule for code runs. For example: ``` \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; exports.name = "codeinline"; @@ -54,5 +51,3 @@ exports.parse = function() { }] }]; }; - -})(); diff --git a/core/modules/parsers/wikiparser/rules/commentblock.js b/core/modules/parsers/wikiparser/rules/commentblock.js index 1c303f38f..96d3deb3d 100644 --- a/core/modules/parsers/wikiparser/rules/commentblock.js +++ b/core/modules/parsers/wikiparser/rules/commentblock.js @@ -18,10 +18,7 @@ xxxx Note that the syntax for comments is simplified to an opening "" sequence -- HTML itself implements a more complex format (see http://ostermiller.org/findhtmlcomment.html) \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; exports.name = "commentblock"; @@ -52,5 +49,3 @@ exports.parse = function() { // Don't return any elements return []; }; - -})(); diff --git a/core/modules/parsers/wikiparser/rules/commentinline.js b/core/modules/parsers/wikiparser/rules/commentinline.js index 671bd79d6..e826b95e6 100644 --- a/core/modules/parsers/wikiparser/rules/commentinline.js +++ b/core/modules/parsers/wikiparser/rules/commentinline.js @@ -12,10 +12,7 @@ Wiki text inline rule for HTML comments. For example: Note that the syntax for comments is simplified to an opening "" sequence -- HTML itself implements a more complex format (see http://ostermiller.org/findhtmlcomment.html) \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; exports.name = "commentinline"; @@ -46,5 +43,3 @@ exports.parse = function() { // Don't return any elements return []; }; - -})(); diff --git a/core/modules/parsers/wikiparser/rules/conditional.js b/core/modules/parsers/wikiparser/rules/conditional.js index c2d6a43b8..3995b90dc 100644 --- a/core/modules/parsers/wikiparser/rules/conditional.js +++ b/core/modules/parsers/wikiparser/rules/conditional.js @@ -10,10 +10,6 @@ This is a <%if [{something}] %>Elephant<%elseif [{else}] %>Pelican<%else%>Crocod ``` \*/ -(function(){ - -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; exports.name = "conditional"; @@ -116,5 +112,3 @@ exports.parseIfClause = function(filterCondition) { // Return the parse tree node return [listWidget]; }; - -})(); diff --git a/core/modules/parsers/wikiparser/rules/dash.js b/core/modules/parsers/wikiparser/rules/dash.js index 45481bf07..02d82baec 100644 --- a/core/modules/parsers/wikiparser/rules/dash.js +++ b/core/modules/parsers/wikiparser/rules/dash.js @@ -12,10 +12,7 @@ This is an em-dash: --- ``` \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; exports.name = "dash"; @@ -36,5 +33,3 @@ exports.parse = function() { entity: dash }]; }; - -})(); diff --git a/core/modules/parsers/wikiparser/rules/emphasis/bold.js b/core/modules/parsers/wikiparser/rules/emphasis/bold.js index 3799feeb5..70f741759 100644 --- a/core/modules/parsers/wikiparser/rules/emphasis/bold.js +++ b/core/modules/parsers/wikiparser/rules/emphasis/bold.js @@ -17,10 +17,7 @@ This wikiparser can be modified using the rules eg: ``` \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; exports.name = "bold"; @@ -46,5 +43,3 @@ exports.parse = function() { children: tree }]; }; - -})(); \ No newline at end of file diff --git a/core/modules/parsers/wikiparser/rules/emphasis/italic.js b/core/modules/parsers/wikiparser/rules/emphasis/italic.js index 3e0744c4d..995e58123 100644 --- a/core/modules/parsers/wikiparser/rules/emphasis/italic.js +++ b/core/modules/parsers/wikiparser/rules/emphasis/italic.js @@ -17,10 +17,7 @@ This wikiparser can be modified using the rules eg: ``` \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; exports.name = "italic"; @@ -46,5 +43,3 @@ exports.parse = function() { children: tree }]; }; - -})(); \ No newline at end of file diff --git a/core/modules/parsers/wikiparser/rules/emphasis/strikethrough.js b/core/modules/parsers/wikiparser/rules/emphasis/strikethrough.js index 0fb34fc52..24380ed11 100644 --- a/core/modules/parsers/wikiparser/rules/emphasis/strikethrough.js +++ b/core/modules/parsers/wikiparser/rules/emphasis/strikethrough.js @@ -17,10 +17,7 @@ This wikiparser can be modified using the rules eg: ``` \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; exports.name = "strikethrough"; @@ -46,5 +43,3 @@ exports.parse = function() { children: tree }]; }; - -})(); diff --git a/core/modules/parsers/wikiparser/rules/emphasis/subscript.js b/core/modules/parsers/wikiparser/rules/emphasis/subscript.js index 12be0fbbc..104ed0294 100644 --- a/core/modules/parsers/wikiparser/rules/emphasis/subscript.js +++ b/core/modules/parsers/wikiparser/rules/emphasis/subscript.js @@ -17,10 +17,7 @@ This wikiparser can be modified using the rules eg: ``` \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; exports.name = "subscript"; @@ -46,5 +43,3 @@ exports.parse = function() { children: tree }]; }; - -})(); diff --git a/core/modules/parsers/wikiparser/rules/emphasis/superscript.js b/core/modules/parsers/wikiparser/rules/emphasis/superscript.js index 5a5330d8c..be7157255 100644 --- a/core/modules/parsers/wikiparser/rules/emphasis/superscript.js +++ b/core/modules/parsers/wikiparser/rules/emphasis/superscript.js @@ -17,10 +17,7 @@ This wikiparser can be modified using the rules eg: ``` \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; exports.name = "superscript"; @@ -46,5 +43,3 @@ exports.parse = function() { children: tree }]; }; - -})(); \ No newline at end of file diff --git a/core/modules/parsers/wikiparser/rules/emphasis/underscore.js b/core/modules/parsers/wikiparser/rules/emphasis/underscore.js index d36bd242d..2c2bf71c3 100644 --- a/core/modules/parsers/wikiparser/rules/emphasis/underscore.js +++ b/core/modules/parsers/wikiparser/rules/emphasis/underscore.js @@ -17,10 +17,7 @@ This wikiparser can be modified using the rules eg: ``` \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; exports.name = "underscore"; @@ -46,5 +43,3 @@ exports.parse = function() { children: tree }]; }; - -})(); \ No newline at end of file diff --git a/core/modules/parsers/wikiparser/rules/entity.js b/core/modules/parsers/wikiparser/rules/entity.js index dc3917daf..df2068b78 100644 --- a/core/modules/parsers/wikiparser/rules/entity.js +++ b/core/modules/parsers/wikiparser/rules/entity.js @@ -10,10 +10,7 @@ Wiki text inline rule for HTML entities. For example: ``` \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; exports.name = "entity"; @@ -36,5 +33,3 @@ exports.parse = function() { // Return the entity return [{type: "entity", entity: this.match[0]}]; }; - -})(); diff --git a/core/modules/parsers/wikiparser/rules/extlink.js b/core/modules/parsers/wikiparser/rules/extlink.js index 5b9f57adf..2678e3873 100644 --- a/core/modules/parsers/wikiparser/rules/extlink.js +++ b/core/modules/parsers/wikiparser/rules/extlink.js @@ -14,10 +14,7 @@ A suppressed external link: ~http://www.tiddlyspace.com/ External links can be suppressed by preceding them with `~`. \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; exports.name = "extlink"; @@ -52,5 +49,3 @@ exports.parse = function() { }]; } }; - -})(); diff --git a/core/modules/parsers/wikiparser/rules/filteredtranscludeblock.js b/core/modules/parsers/wikiparser/rules/filteredtranscludeblock.js index 73bdff813..2fd96183e 100644 --- a/core/modules/parsers/wikiparser/rules/filteredtranscludeblock.js +++ b/core/modules/parsers/wikiparser/rules/filteredtranscludeblock.js @@ -14,10 +14,7 @@ Wiki text rule for block-level filtered transclusion. For example: ``` \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; exports.name = "filteredtranscludeblock"; @@ -70,5 +67,3 @@ exports.parse = function() { } return [node]; }; - -})(); diff --git a/core/modules/parsers/wikiparser/rules/filteredtranscludeinline.js b/core/modules/parsers/wikiparser/rules/filteredtranscludeinline.js index c0b19a941..ee82ff517 100644 --- a/core/modules/parsers/wikiparser/rules/filteredtranscludeinline.js +++ b/core/modules/parsers/wikiparser/rules/filteredtranscludeinline.js @@ -14,10 +14,7 @@ Wiki text rule for inline filtered transclusion. For example: ``` \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; exports.name = "filteredtranscludeinline"; @@ -69,5 +66,3 @@ exports.parse = function() { } return [node]; }; - -})(); diff --git a/core/modules/parsers/wikiparser/rules/fnprocdef.js b/core/modules/parsers/wikiparser/rules/fnprocdef.js index 85bd14d5c..63ae8130f 100644 --- a/core/modules/parsers/wikiparser/rules/fnprocdef.js +++ b/core/modules/parsers/wikiparser/rules/fnprocdef.js @@ -20,10 +20,7 @@ definition text ``` \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; exports.name = "fnprocdef"; @@ -53,7 +50,7 @@ exports.parse = function() { var reEnd; if(this.match[5]) { // If so, it is a multiline definition and the end of the body is marked with \end - reEnd = new RegExp("((:?^|\\r?\\n)[^\\S\\n\\r]*\\\\end[^\\S\\n\\r]*(?:" + $tw.utils.escapeRegExp(this.match[2]) + ")?(?:$|\\r?\\n))","mg"); + reEnd = new RegExp("((:?^|\\r?\\n)[^\\S\\n\\r]*\\\\end[^\\S\\n\\r]*(?:" + $tw.utils.escapeRegExp(this.match[2]) + ")?\\s*?(?:$|\\r?\\n))","mg"); } else { // Otherwise, the end of the definition is marked by the end of the line reEnd = /($|\r?\n)/mg; @@ -92,6 +89,3 @@ exports.parse = function() { } return parseTreeNodes; }; - -})(); - \ No newline at end of file diff --git a/core/modules/parsers/wikiparser/rules/hardlinebreaks.js b/core/modules/parsers/wikiparser/rules/hardlinebreaks.js index 94f517cd4..da28f7808 100644 --- a/core/modules/parsers/wikiparser/rules/hardlinebreaks.js +++ b/core/modules/parsers/wikiparser/rules/hardlinebreaks.js @@ -17,10 +17,7 @@ Not ``` \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; exports.name = "hardlinebreaks"; @@ -56,5 +53,3 @@ exports.parse = function() { // Return the nodes return tree; }; - -})(); diff --git a/core/modules/parsers/wikiparser/rules/heading.js b/core/modules/parsers/wikiparser/rules/heading.js index 7a0ecb9db..af2a6ad12 100644 --- a/core/modules/parsers/wikiparser/rules/heading.js +++ b/core/modules/parsers/wikiparser/rules/heading.js @@ -6,10 +6,7 @@ module-type: wikirule Wiki text block rule for headings \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; exports.name = "heading"; @@ -45,4 +42,3 @@ exports.parse = function() { children: tree }]; }; -})(); diff --git a/core/modules/parsers/wikiparser/rules/horizrule.js b/core/modules/parsers/wikiparser/rules/horizrule.js index bacad06ed..2294add6b 100644 --- a/core/modules/parsers/wikiparser/rules/horizrule.js +++ b/core/modules/parsers/wikiparser/rules/horizrule.js @@ -10,10 +10,7 @@ Wiki text block rule for rules. For example: ``` \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; exports.name = "horizrule"; @@ -30,5 +27,3 @@ exports.parse = function() { this.parser.pos = this.matchRegExp.lastIndex; return [{type: "element", tag: "hr"}]; }; - -})(); diff --git a/core/modules/parsers/wikiparser/rules/html.js b/core/modules/parsers/wikiparser/rules/html.js index 61c4ad9e1..c5f0e86c5 100644 --- a/core/modules/parsers/wikiparser/rules/html.js +++ b/core/modules/parsers/wikiparser/rules/html.js @@ -17,10 +17,7 @@ This is a widget invocation }}} \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; exports.name = "html"; @@ -194,5 +191,3 @@ exports.isLegalTag = function(tag) { return true; } }; - -})(); diff --git a/core/modules/parsers/wikiparser/rules/image.js b/core/modules/parsers/wikiparser/rules/image.js index 6f58225e0..2bc90b80d 100644 --- a/core/modules/parsers/wikiparser/rules/image.js +++ b/core/modules/parsers/wikiparser/rules/image.js @@ -17,10 +17,7 @@ Wiki text inline rule for embedding images. For example: Generates the `<$image>` widget. \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; exports.name = "image"; @@ -129,5 +126,3 @@ exports.parseImage = function(source,pos) { node.end = pos; return node; }; - -})(); diff --git a/core/modules/parsers/wikiparser/rules/import.js b/core/modules/parsers/wikiparser/rules/import.js index bb1832255..52332f0e3 100644 --- a/core/modules/parsers/wikiparser/rules/import.js +++ b/core/modules/parsers/wikiparser/rules/import.js @@ -10,10 +10,7 @@ Wiki pragma rule for importing variable definitions ``` \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; exports.name = "import"; @@ -50,5 +47,3 @@ exports.parse = function() { children: [] }]; }; - -})(); diff --git a/core/modules/parsers/wikiparser/rules/list.js b/core/modules/parsers/wikiparser/rules/list.js index d89c201b9..98cc5540f 100644 --- a/core/modules/parsers/wikiparser/rules/list.js +++ b/core/modules/parsers/wikiparser/rules/list.js @@ -40,10 +40,7 @@ A CSS class can be applied to a list item as follows: ``` \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; exports.name = "list"; @@ -152,5 +149,3 @@ exports.parse = function() { // Return the root element of the list return [listStack[0]]; }; - -})(); diff --git a/core/modules/parsers/wikiparser/rules/macrocallblock.js b/core/modules/parsers/wikiparser/rules/macrocallblock.js index a2c10e04a..3793d563d 100644 --- a/core/modules/parsers/wikiparser/rules/macrocallblock.js +++ b/core/modules/parsers/wikiparser/rules/macrocallblock.js @@ -10,10 +10,7 @@ Wiki rule for block macro calls ``` \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; exports.name = "macrocallblock"; @@ -52,5 +49,3 @@ exports.parse = function() { this.parser.pos = call.end; return [call]; }; - -})(); diff --git a/core/modules/parsers/wikiparser/rules/macrocallinline.js b/core/modules/parsers/wikiparser/rules/macrocallinline.js index e9f79f09e..bd6e777bb 100644 --- a/core/modules/parsers/wikiparser/rules/macrocallinline.js +++ b/core/modules/parsers/wikiparser/rules/macrocallinline.js @@ -10,10 +10,7 @@ Wiki rule for macro calls ``` \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; exports.name = "macrocallinline"; @@ -45,5 +42,3 @@ exports.parse = function() { this.parser.pos = call.end; return [call]; }; - -})(); diff --git a/core/modules/parsers/wikiparser/rules/macrodef.js b/core/modules/parsers/wikiparser/rules/macrodef.js index 2001f70d5..24f0e1212 100644 --- a/core/modules/parsers/wikiparser/rules/macrodef.js +++ b/core/modules/parsers/wikiparser/rules/macrodef.js @@ -12,10 +12,7 @@ definition text, including $param$ markers ``` \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; exports.name = "macrodef"; @@ -58,7 +55,7 @@ exports.parse = function() { var reEnd; if(this.match[3]) { // If so, it is a multiline definition and the end of the body is marked with \end - reEnd = new RegExp("((?:^|\\r?\\n)[^\\S\\n\\r]*\\\\end[^\\S\\n\\r]*(?:" + $tw.utils.escapeRegExp(this.match[1]) + ")?(?:$|\\r?\\n))","mg"); + reEnd = new RegExp("((?:^|\\r?\\n)[^\\S\\n\\r]*\\\\end[^\\S\\n\\r]*(?:" + $tw.utils.escapeRegExp(this.match[1]) + ")?\\s*?(?:$|\\r?\\n))","mg"); } else { // Otherwise, the end of the definition is marked by the end of the line reEnd = /($|\r?\n)/mg; @@ -88,5 +85,3 @@ exports.parse = function() { $tw.utils.addAttributeToParseTreeNode(parseTreeNodes[0],"value",text); return parseTreeNodes; }; - -})(); diff --git a/core/modules/parsers/wikiparser/rules/parameters.js b/core/modules/parsers/wikiparser/rules/parameters.js index 60bbd8901..ccd50319c 100644 --- a/core/modules/parsers/wikiparser/rules/parameters.js +++ b/core/modules/parsers/wikiparser/rules/parameters.js @@ -11,10 +11,7 @@ definition text ``` \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; exports.name = "parameters"; @@ -56,5 +53,3 @@ exports.parse = function() { orderedAttributes: orderedAttributes }]; }; - -})(); diff --git a/core/modules/parsers/wikiparser/rules/parsermode.js b/core/modules/parsers/wikiparser/rules/parsermode.js index 72a6de067..868db3e15 100644 --- a/core/modules/parsers/wikiparser/rules/parsermode.js +++ b/core/modules/parsers/wikiparser/rules/parsermode.js @@ -11,10 +11,7 @@ Wiki pragma rule for parser mode specifications ``` \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; exports.name = "parsermode"; @@ -64,5 +61,3 @@ exports.parse = function() { // No parse tree nodes to return return []; }; - -})(); diff --git a/core/modules/parsers/wikiparser/rules/prettyextlink.js b/core/modules/parsers/wikiparser/rules/prettyextlink.js index 4707fa0d0..2c575c227 100644 --- a/core/modules/parsers/wikiparser/rules/prettyextlink.js +++ b/core/modules/parsers/wikiparser/rules/prettyextlink.js @@ -11,10 +11,7 @@ Wiki text inline rule for external links. For example: ``` \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; exports.name = "prettyextlink"; @@ -116,5 +113,3 @@ exports.parseLink = function(source,pos) { node.end = closePos + 2; return node; }; - -})(); diff --git a/core/modules/parsers/wikiparser/rules/prettylink.js b/core/modules/parsers/wikiparser/rules/prettylink.js index 66c19dc88..91579256d 100644 --- a/core/modules/parsers/wikiparser/rules/prettylink.js +++ b/core/modules/parsers/wikiparser/rules/prettylink.js @@ -12,10 +12,7 @@ Wiki text inline rule for pretty links. For example: ``` \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; exports.name = "prettylink"; @@ -66,5 +63,3 @@ exports.parse = function() { }]; } }; - -})(); diff --git a/core/modules/parsers/wikiparser/rules/quoteblock.js b/core/modules/parsers/wikiparser/rules/quoteblock.js index fdd6c860b..be8746de4 100644 --- a/core/modules/parsers/wikiparser/rules/quoteblock.js +++ b/core/modules/parsers/wikiparser/rules/quoteblock.js @@ -6,10 +6,7 @@ module-type: wikirule Wiki text rule for quote blocks. \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; exports.name = "quoteblock"; @@ -72,5 +69,3 @@ exports.parse = function() { children: tree }]; }; - -})(); diff --git a/core/modules/parsers/wikiparser/rules/rules.js b/core/modules/parsers/wikiparser/rules/rules.js index 1d0f80f29..7b3749308 100644 --- a/core/modules/parsers/wikiparser/rules/rules.js +++ b/core/modules/parsers/wikiparser/rules/rules.js @@ -11,10 +11,7 @@ Wiki pragma rule for rules specifications ``` \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; exports.name = "rules"; @@ -60,5 +57,3 @@ exports.parse = function() { // No parse tree nodes to return return []; }; - -})(); diff --git a/core/modules/parsers/wikiparser/rules/styleblock.js b/core/modules/parsers/wikiparser/rules/styleblock.js index 3fcad5bb4..2abf2fc9e 100644 --- a/core/modules/parsers/wikiparser/rules/styleblock.js +++ b/core/modules/parsers/wikiparser/rules/styleblock.js @@ -26,10 +26,7 @@ This is a paragraph ``` \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; exports.name = "styleblock"; @@ -69,5 +66,3 @@ exports.parse = function() { } return tree; }; - -})(); diff --git a/core/modules/parsers/wikiparser/rules/styleinline.js b/core/modules/parsers/wikiparser/rules/styleinline.js index 653e48986..3aea0d266 100644 --- a/core/modules/parsers/wikiparser/rules/styleinline.js +++ b/core/modules/parsers/wikiparser/rules/styleinline.js @@ -13,10 +13,7 @@ Wiki text inline rule for assigning styles and classes to inline runs. For examp \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; exports.name = "styleinline"; @@ -54,5 +51,3 @@ exports.parse = function() { } return [node]; }; - -})(); diff --git a/core/modules/parsers/wikiparser/rules/syslink.js b/core/modules/parsers/wikiparser/rules/syslink.js index 6bcbee384..a57850265 100644 --- a/core/modules/parsers/wikiparser/rules/syslink.js +++ b/core/modules/parsers/wikiparser/rules/syslink.js @@ -6,10 +6,7 @@ module-type: wikirule Wiki text inline rule for system tiddler links. Can be suppressed preceding them with `~`. \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; exports.name = "syslink"; @@ -49,5 +46,3 @@ exports.parse = function() { }]; } }; - -})(); diff --git a/core/modules/parsers/wikiparser/rules/table.js b/core/modules/parsers/wikiparser/rules/table.js index fbdbb4f9d..67def255f 100644 --- a/core/modules/parsers/wikiparser/rules/table.js +++ b/core/modules/parsers/wikiparser/rules/table.js @@ -6,10 +6,7 @@ module-type: wikirule Wiki text block rule for tables. \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; exports.name = "table"; @@ -187,5 +184,3 @@ exports.parse = function() { } return [table]; }; - -})(); diff --git a/core/modules/parsers/wikiparser/rules/transcludeblock.js b/core/modules/parsers/wikiparser/rules/transcludeblock.js index c033c2440..525113d5d 100644 --- a/core/modules/parsers/wikiparser/rules/transcludeblock.js +++ b/core/modules/parsers/wikiparser/rules/transcludeblock.js @@ -11,10 +11,7 @@ Wiki text rule for block-level transclusion. For example: ``` \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; exports.name = "transcludeblock"; @@ -85,5 +82,3 @@ exports.parse = function() { } } }; - -})(); diff --git a/core/modules/parsers/wikiparser/rules/transcludeinline.js b/core/modules/parsers/wikiparser/rules/transcludeinline.js index 3ce9dc78e..4ae58e617 100644 --- a/core/modules/parsers/wikiparser/rules/transcludeinline.js +++ b/core/modules/parsers/wikiparser/rules/transcludeinline.js @@ -11,10 +11,7 @@ Wiki text rule for inline-level transclusion. For example: ``` \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; exports.name = "transcludeinline"; @@ -83,5 +80,3 @@ exports.parse = function() { } } }; - -})(); diff --git a/core/modules/parsers/wikiparser/rules/typedblock.js b/core/modules/parsers/wikiparser/rules/typedblock.js index 07c88be15..03fdc8e10 100644 --- a/core/modules/parsers/wikiparser/rules/typedblock.js +++ b/core/modules/parsers/wikiparser/rules/typedblock.js @@ -22,10 +22,7 @@ $$$ ``` \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; var widget = require("$:/core/modules/widgets/widget.js"); @@ -82,5 +79,3 @@ exports.parse = function() { }]; } }; - -})(); diff --git a/core/modules/parsers/wikiparser/rules/whitespace.js b/core/modules/parsers/wikiparser/rules/whitespace.js index 5fd9d4b83..3be34ee88 100644 --- a/core/modules/parsers/wikiparser/rules/whitespace.js +++ b/core/modules/parsers/wikiparser/rules/whitespace.js @@ -11,10 +11,7 @@ Wiki pragma rule for whitespace specifications ``` \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; exports.name = "whitespace"; @@ -68,5 +65,3 @@ exports.parse = function() { // No parse tree nodes to return return []; }; - -})(); diff --git a/core/modules/parsers/wikiparser/rules/wikilink.js b/core/modules/parsers/wikiparser/rules/wikilink.js index 6b195f9ff..d706de8a9 100644 --- a/core/modules/parsers/wikiparser/rules/wikilink.js +++ b/core/modules/parsers/wikiparser/rules/wikilink.js @@ -14,10 +14,7 @@ AnotherLink Precede a camel case word with `~` to prevent it from being recognised as a link. \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; exports.name = "wikilink"; @@ -64,5 +61,3 @@ exports.parse = function() { }] }]; }; - -})(); diff --git a/core/modules/parsers/wikiparser/rules/wikilinkprefix.js b/core/modules/parsers/wikiparser/rules/wikilinkprefix.js index 60cb3d992..c1c5db1f6 100644 --- a/core/modules/parsers/wikiparser/rules/wikilinkprefix.js +++ b/core/modules/parsers/wikiparser/rules/wikilinkprefix.js @@ -10,10 +10,7 @@ Wiki text inline rule for suppressed wiki links. For example: ``` \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; exports.name = "wikilinkprefix"; @@ -36,5 +33,3 @@ exports.parse = function() { // Return the link without unwikilink character as plain text return [{type: "text", text: linkText.substr(1)}]; }; - -})(); diff --git a/core/modules/parsers/wikiparser/wikiparser.js b/core/modules/parsers/wikiparser/wikiparser.js index 854171d19..3d1379fd4 100644 --- a/core/modules/parsers/wikiparser/wikiparser.js +++ b/core/modules/parsers/wikiparser/wikiparser.js @@ -19,10 +19,7 @@ Attributes are stored as hashmaps of the following objects: {type: "macro", macro: } - indirect through a macro invocation \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; /* @@ -495,5 +492,3 @@ WikiParser.prototype.amendRules = function(type,names) { }; exports["text/vnd.tiddlywiki"] = WikiParser; - -})(); diff --git a/core/modules/parsers/wikiparser/wikirulebase.js b/core/modules/parsers/wikiparser/wikirulebase.js index 8aa960ef7..a9d6c748f 100644 --- a/core/modules/parsers/wikiparser/wikirulebase.js +++ b/core/modules/parsers/wikiparser/wikirulebase.js @@ -6,10 +6,7 @@ module-type: global Base class for wiki parser rules \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; /* @@ -35,5 +32,3 @@ WikiRuleBase.prototype.findNextMatch = function(startPos) { }; exports.WikiRuleBase = WikiRuleBase; - -})(); diff --git a/core/modules/pluginswitcher.js b/core/modules/pluginswitcher.js index 2915de95a..d89d261d7 100644 --- a/core/modules/pluginswitcher.js +++ b/core/modules/pluginswitcher.js @@ -6,10 +6,7 @@ module-type: global Manages switching plugins for themes and languages. \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; /* @@ -75,5 +72,3 @@ PluginSwitcher.prototype.switchPlugins = function() { }; exports.PluginSwitcher = PluginSwitcher; - -})(); diff --git a/core/modules/saver-handler.js b/core/modules/saver-handler.js index 23056bcc2..7f4e834a0 100644 --- a/core/modules/saver-handler.js +++ b/core/modules/saver-handler.js @@ -6,10 +6,7 @@ module-type: global The saver handler tracks changes to the store and handles saving the entire wiki via saver modules. \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; /* @@ -46,8 +43,10 @@ function SaverHandler(options) { // Filter the changes so that we only count changes to tiddlers that we care about var filteredChanges = self.filterFn.call(self.wiki,function(iterator) { $tw.utils.each(changes,function(change,title) { - var tiddler = self.wiki.getTiddler(title); - iterator(tiddler,title); + if(change.normal) { + var tiddler = self.wiki.getTiddler(title); + iterator(tiddler,title); + } }); }); // Adjust the number of changes @@ -183,7 +182,7 @@ SaverHandler.prototype.saveWiki = function(options) { // Call the highest priority saver that supports this method for(var t=this.savers.length-1; t>=0; t--) { var saver = this.savers[t]; - if(saver.info.capabilities.indexOf(method) !== -1 && saver.save(text,method,callback,{variables: {filename: variables.filename}})) { + if(saver.info.capabilities.indexOf(method) !== -1 && saver.save(text,method,callback,{variables: {filename: variables.filename, type: variables.type}})) { this.logger.log("Saving wiki with method",method,"through saver",saver.info.name); return true; } @@ -212,5 +211,3 @@ SaverHandler.prototype.updateDirtyStatus = function() { }; exports.SaverHandler = SaverHandler; - -})(); diff --git a/core/modules/savers/andtidwiki.js b/core/modules/savers/andtidwiki.js index 9ab405e37..5ce4dbe0e 100644 --- a/core/modules/savers/andtidwiki.js +++ b/core/modules/savers/andtidwiki.js @@ -6,10 +6,8 @@ module-type: saver Handles saving changes via the AndTidWiki Android app \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false, netscape: false, Components: false */ + "use strict"; var AndTidWiki = function(wiki) { @@ -86,5 +84,3 @@ Create an instance of this saver exports.create = function(wiki) { return new AndTidWiki(wiki); }; - -})(); diff --git a/core/modules/savers/custom.js b/core/modules/savers/custom.js index 836691204..dc5f91703 100644 --- a/core/modules/savers/custom.js +++ b/core/modules/savers/custom.js @@ -9,10 +9,7 @@ on the parent window (of an iframe). If present, the saver must define and the saver may define priority: number \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; var findSaver = function(window) { @@ -57,4 +54,3 @@ Create an instance of this saver exports.create = function(wiki) { return new CustomSaver(wiki); }; -})(); diff --git a/core/modules/savers/download.js b/core/modules/savers/download.js index 0a1d565ce..9d046d24a 100644 --- a/core/modules/savers/download.js +++ b/core/modules/savers/download.js @@ -6,10 +6,7 @@ module-type: saver Handles saving changes via HTML5's download APIs \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; /* @@ -22,6 +19,7 @@ DownloadSaver.prototype.save = function(text,method,callback,options) { options = options || {}; // Get the current filename var filename = options.variables.filename; + var type = options.variables.type; if(!filename) { var p = document.location.pathname.lastIndexOf("/"); if(p !== -1) { @@ -32,13 +30,16 @@ DownloadSaver.prototype.save = function(text,method,callback,options) { if(!filename) { filename = "tiddlywiki.html"; } + if(!type) { + type = "text/html"; + } // Set up the link var link = document.createElement("a"); if(Blob !== undefined) { - var blob = new Blob([text], {type: "text/html"}); + var blob = new Blob([text], {type: type}); link.setAttribute("href", URL.createObjectURL(blob)); } else { - link.setAttribute("href","data:text/html," + encodeURIComponent(text)); + link.setAttribute("href","data:" + type + "," + encodeURIComponent(text)); } link.setAttribute("download",filename); document.body.appendChild(link); @@ -80,5 +81,3 @@ Create an instance of this saver exports.create = function(wiki) { return new DownloadSaver(wiki); }; - -})(); diff --git a/core/modules/savers/fsosaver.js b/core/modules/savers/fsosaver.js index 37224e42a..85b56e956 100644 --- a/core/modules/savers/fsosaver.js +++ b/core/modules/savers/fsosaver.js @@ -9,10 +9,7 @@ Note: Since TiddlyWiki's markup contains the MOTW, the FileSystemObject normally However, if the wiki is loaded as an .HTA file (Windows HTML Applications) then the FSO can be used. \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; /* @@ -70,5 +67,3 @@ Create an instance of this saver exports.create = function(wiki) { return new FSOSaver(wiki); }; - -})(); diff --git a/core/modules/savers/gitea.js b/core/modules/savers/gitea.js index 826719ee9..ef23214c1 100644 --- a/core/modules/savers/gitea.js +++ b/core/modules/savers/gitea.js @@ -6,10 +6,7 @@ module-type: saver Saves wiki by pushing a commit to the gitea \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; /* @@ -132,5 +129,3 @@ Create an instance of this saver exports.create = function(wiki) { return new GiteaSaver(wiki); }; - -})(); diff --git a/core/modules/savers/github.js b/core/modules/savers/github.js index c0a34f2d6..f0dca48fc 100644 --- a/core/modules/savers/github.js +++ b/core/modules/savers/github.js @@ -6,10 +6,7 @@ module-type: saver Saves wiki by pushing a commit to the GitHub v3 REST API \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; /* @@ -115,5 +112,3 @@ Create an instance of this saver exports.create = function(wiki) { return new GitHubSaver(wiki); }; - -})(); diff --git a/core/modules/savers/gitlab.js b/core/modules/savers/gitlab.js index 243aab8a5..43305b578 100644 --- a/core/modules/savers/gitlab.js +++ b/core/modules/savers/gitlab.js @@ -6,10 +6,7 @@ module-type: saver Saves wiki by pushing a commit to the GitLab REST API \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: true */ "use strict"; /* @@ -113,5 +110,3 @@ Create an instance of this saver exports.create = function(wiki) { return new GitLabSaver(wiki); }; - -})(); diff --git a/core/modules/savers/manualdownload.js b/core/modules/savers/manualdownload.js index af9bcd743..bb3c3c142 100644 --- a/core/modules/savers/manualdownload.js +++ b/core/modules/savers/manualdownload.js @@ -6,10 +6,7 @@ module-type: saver Handles saving changes via HTML5's download APIs \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; // Title of the tiddler containing the download message @@ -52,5 +49,3 @@ Create an instance of this saver exports.create = function(wiki) { return new ManualDownloadSaver(wiki); }; - -})(); diff --git a/core/modules/savers/msdownload.js b/core/modules/savers/msdownload.js index 6cb55c334..233fd3571 100644 --- a/core/modules/savers/msdownload.js +++ b/core/modules/savers/msdownload.js @@ -6,10 +6,7 @@ module-type: saver Handles saving changes via window.navigator.msSaveBlob() \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; /* @@ -55,5 +52,3 @@ Create an instance of this saver exports.create = function(wiki) { return new MsDownloadSaver(wiki); }; - -})(); diff --git a/core/modules/savers/put.js b/core/modules/savers/put.js index 69689e6db..b77cfdfc8 100644 --- a/core/modules/savers/put.js +++ b/core/modules/savers/put.js @@ -9,10 +9,7 @@ Works with any server which accepts a PUT request to the current URL, such as a WebDAV server. \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; /* @@ -136,5 +133,3 @@ Create an instance of this saver exports.create = function(wiki) { return new PutSaver(wiki); }; - -})(); diff --git a/core/modules/savers/tiddlyfox.js b/core/modules/savers/tiddlyfox.js index 81b373d42..2356e287e 100644 --- a/core/modules/savers/tiddlyfox.js +++ b/core/modules/savers/tiddlyfox.js @@ -6,10 +6,7 @@ module-type: saver Handles saving changes via the TiddlyFox file extension \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false, netscape: false, Components: false */ "use strict"; var TiddlyFoxSaver = function(wiki) { @@ -82,5 +79,3 @@ Create an instance of this saver exports.create = function(wiki) { return new TiddlyFoxSaver(wiki); }; - -})(); diff --git a/core/modules/savers/tiddlyie.js b/core/modules/savers/tiddlyie.js index d6d49db45..3b380592d 100644 --- a/core/modules/savers/tiddlyie.js +++ b/core/modules/savers/tiddlyie.js @@ -6,10 +6,7 @@ module-type: saver Handles saving changes via Internet Explorer BHO extenion (TiddlyIE) \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; /* @@ -67,5 +64,3 @@ Create an instance of this saver exports.create = function(wiki) { return new TiddlyIESaver(wiki); }; - -})(); diff --git a/core/modules/savers/twedit.js b/core/modules/savers/twedit.js index ec125bf94..8aae0c54e 100644 --- a/core/modules/savers/twedit.js +++ b/core/modules/savers/twedit.js @@ -6,10 +6,7 @@ module-type: saver Handles saving changes via the TWEdit iOS app \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false, netscape: false, Components: false */ "use strict"; var TWEditSaver = function(wiki) { @@ -87,5 +84,3 @@ exports.create = function(wiki) { if($tw.browser) { window.version = {title: "TiddlyWiki"}; } - -})(); diff --git a/core/modules/savers/upload.js b/core/modules/savers/upload.js index ade545000..7f17d77bd 100644 --- a/core/modules/savers/upload.js +++ b/core/modules/savers/upload.js @@ -8,10 +8,7 @@ Handles saving changes via upload to a server. Designed to be compatible with BidiX's UploadPlugin at http://tiddlywiki.bidix.info/#UploadPlugin \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; /* @@ -107,5 +104,3 @@ Create an instance of this saver exports.create = function(wiki) { return new UploadSaver(wiki); }; - -})(); diff --git a/core/modules/server/authenticators/basic.js b/core/modules/server/authenticators/basic.js index cd528c485..e67e701f5 100644 --- a/core/modules/server/authenticators/basic.js +++ b/core/modules/server/authenticators/basic.js @@ -6,10 +6,7 @@ module-type: authenticator Authenticator for WWW basic authentication \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; if($tw.node) { @@ -90,5 +87,3 @@ BasicAuthenticator.prototype.authenticateRequest = function(request,response,sta }; exports.AuthenticatorClass = BasicAuthenticator; - -})(); diff --git a/core/modules/server/authenticators/header.js b/core/modules/server/authenticators/header.js index cc1d6bdaf..bbcf9a1d4 100644 --- a/core/modules/server/authenticators/header.js +++ b/core/modules/server/authenticators/header.js @@ -6,10 +6,7 @@ module-type: authenticator Authenticator for trusted header authentication \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; function HeaderAuthenticator(server) { @@ -46,4 +43,3 @@ HeaderAuthenticator.prototype.authenticateRequest = function(request,response,st exports.AuthenticatorClass = HeaderAuthenticator; -})(); diff --git a/core/modules/server/routes/delete-tiddler.js b/core/modules/server/routes/delete-tiddler.js index 85b552599..33cb40d55 100644 --- a/core/modules/server/routes/delete-tiddler.js +++ b/core/modules/server/routes/delete-tiddler.js @@ -6,10 +6,6 @@ module-type: route DELETE /recipes/default/tiddlers/:title \*/ -(function() { - -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; exports.method = "DELETE"; @@ -24,5 +20,3 @@ exports.handler = function(request,response,state) { }); response.end(); }; - -}()); diff --git a/core/modules/server/routes/get-favicon.js b/core/modules/server/routes/get-favicon.js index 39a391127..8b757b2f7 100644 --- a/core/modules/server/routes/get-favicon.js +++ b/core/modules/server/routes/get-favicon.js @@ -6,10 +6,6 @@ module-type: route GET /favicon.ico \*/ -(function() { - -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; exports.method = "GET"; @@ -20,5 +16,3 @@ exports.handler = function(request,response,state) { var buffer = state.wiki.getTiddlerText("$:/favicon.ico",""); state.sendResponse(200,{"Content-Type": "image/x-icon"},buffer,"base64"); }; - -}()); diff --git a/core/modules/server/routes/get-file.js b/core/modules/server/routes/get-file.js index 45aa51d34..39681de4c 100644 --- a/core/modules/server/routes/get-file.js +++ b/core/modules/server/routes/get-file.js @@ -6,10 +6,6 @@ module-type: route GET /files/:filepath \*/ -(function() { - -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; exports.method = "GET"; @@ -44,5 +40,3 @@ exports.handler = function(request,response,state) { state.sendResponse(404,{"Content-Type": "text/plain"},"File '" + suppliedFilename + "' not found"); } }; - -}()); diff --git a/core/modules/server/routes/get-index.js b/core/modules/server/routes/get-index.js index f2d01f793..7ba52faf6 100644 --- a/core/modules/server/routes/get-index.js +++ b/core/modules/server/routes/get-index.js @@ -6,10 +6,6 @@ module-type: route GET / \*/ -(function() { - -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; exports.method = "GET"; @@ -23,5 +19,3 @@ exports.handler = function(request,response,state) { }; state.sendResponse(200,responseHeaders,text); }; - -}()); diff --git a/core/modules/server/routes/get-login-basic.js b/core/modules/server/routes/get-login-basic.js index d573a0b5d..bca3bd18d 100644 --- a/core/modules/server/routes/get-login-basic.js +++ b/core/modules/server/routes/get-login-basic.js @@ -6,10 +6,6 @@ module-type: route GET /login-basic -- force a Basic Authentication challenge \*/ -(function() { - -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; exports.method = "GET"; @@ -25,12 +21,10 @@ exports.handler = function(request,response,state) { response.end(); } else { // Redirect to the root wiki if login worked - var location = ($tw.syncadaptor && $tw.syncadaptor.host)? $tw.syncadaptor.host: "/"; + var location = ($tw.syncadaptor && $tw.syncadaptor.host)? $tw.syncadaptor.host: `${state.pathPrefix}/`; response.writeHead(302,{ Location: location }); response.end(); } }; - -}()); diff --git a/core/modules/server/routes/get-status.js b/core/modules/server/routes/get-status.js index ac35ee874..d93c64037 100644 --- a/core/modules/server/routes/get-status.js +++ b/core/modules/server/routes/get-status.js @@ -6,10 +6,6 @@ module-type: route GET /status \*/ -(function() { - -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; exports.method = "GET"; @@ -29,5 +25,3 @@ exports.handler = function(request,response,state) { }); state.sendResponse(200,{"Content-Type": "application/json"},text,"utf8"); }; - -}()); diff --git a/core/modules/server/routes/get-tiddler-html.js b/core/modules/server/routes/get-tiddler-html.js index ab1570e30..a891ea6e7 100644 --- a/core/modules/server/routes/get-tiddler-html.js +++ b/core/modules/server/routes/get-tiddler-html.js @@ -6,10 +6,6 @@ module-type: route GET /:title \*/ -(function() { - -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; exports.method = "GET"; @@ -40,5 +36,3 @@ exports.handler = function(request,response,state) { response.end(); } }; - -}()); diff --git a/core/modules/server/routes/get-tiddler.js b/core/modules/server/routes/get-tiddler.js index ae6cfeadc..58ecb8a43 100644 --- a/core/modules/server/routes/get-tiddler.js +++ b/core/modules/server/routes/get-tiddler.js @@ -6,10 +6,6 @@ module-type: route GET /recipes/default/tiddlers/:title \*/ -(function() { - -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; exports.method = "GET"; @@ -42,5 +38,3 @@ exports.handler = function(request,response,state) { response.end(); } }; - -}()); diff --git a/core/modules/server/routes/get-tiddlers-json.js b/core/modules/server/routes/get-tiddlers-json.js index 6f3f07f6a..89f91032e 100644 --- a/core/modules/server/routes/get-tiddlers-json.js +++ b/core/modules/server/routes/get-tiddlers-json.js @@ -6,10 +6,6 @@ module-type: route GET /recipes/default/tiddlers.json?filter= \*/ -(function() { - -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; var DEFAULT_FILTER = "[all[tiddlers]!is[system]sort[title]]"; @@ -46,5 +42,3 @@ exports.handler = function(request,response,state) { var text = JSON.stringify(tiddlers); state.sendResponse(200,{"Content-Type": "application/json"},text,"utf8"); }; - -}()); diff --git a/core/modules/server/routes/put-tiddler.js b/core/modules/server/routes/put-tiddler.js index ff1bd2737..74327bd50 100644 --- a/core/modules/server/routes/put-tiddler.js +++ b/core/modules/server/routes/put-tiddler.js @@ -6,10 +6,6 @@ module-type: route PUT /recipes/default/tiddlers/:title \*/ -(function() { - -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; exports.method = "PUT"; @@ -48,5 +44,3 @@ exports.handler = function(request,response,state) { }); response.end(); }; - -}()); diff --git a/core/modules/server/server.js b/core/modules/server/server.js index d3c98f8fc..2118e9b50 100644 --- a/core/modules/server/server.js +++ b/core/modules/server/server.js @@ -6,10 +6,7 @@ module-type: library Serve tiddlers over http \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; if($tw.node) { @@ -374,5 +371,3 @@ Server.prototype.listen = function(port,host,prefix) { }; exports.Server = Server; - -})(); diff --git a/core/modules/startup/browser-messaging.js b/core/modules/startup/browser-messaging.js index 733041e45..27ddb19d5 100644 --- a/core/modules/startup/browser-messaging.js +++ b/core/modules/startup/browser-messaging.js @@ -6,10 +6,7 @@ module-type: startup Browser message handling \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; // Export name and synchronous status @@ -181,5 +178,3 @@ exports.startup = function() { } },false); }; - -})(); diff --git a/core/modules/startup/commands.js b/core/modules/startup/commands.js index bd8b4afb3..3e4e40f45 100644 --- a/core/modules/startup/commands.js +++ b/core/modules/startup/commands.js @@ -6,10 +6,7 @@ module-type: startup Command processing \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; // Export name and synchronous status @@ -33,5 +30,3 @@ exports.startup = function(callback) { ); commander.execute(); }; - -})(); diff --git a/core/modules/startup/favicon.js b/core/modules/startup/favicon.js index 55e7891e2..d1a7c5677 100644 --- a/core/modules/startup/favicon.js +++ b/core/modules/startup/favicon.js @@ -6,10 +6,7 @@ module-type: startup Favicon handling \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; // Export name and synchronous status @@ -39,5 +36,3 @@ function setFavicon() { faviconLink.setAttribute("href",$tw.utils.makeDataUri(tiddler.fields.text,tiddler.fields.type,tiddler.fields._canonical_uri)); } } - -})(); diff --git a/core/modules/startup/info.js b/core/modules/startup/info.js index ed2305930..a5767ed34 100644 --- a/core/modules/startup/info.js +++ b/core/modules/startup/info.js @@ -6,10 +6,7 @@ module-type: startup Initialise $:/info tiddlers via $:/temp/info-plugin pseudo-plugin \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; // Export name and synchronous status @@ -54,5 +51,3 @@ exports.startup = function() { $tw.wiki.registerPluginTiddlers("info",[TITLE_INFO_PLUGIN]); $tw.wiki.unpackPluginTiddlers(); }; - -})(); diff --git a/core/modules/startup/load-modules.js b/core/modules/startup/load-modules.js index 1dc71f7ac..cf0a8232d 100644 --- a/core/modules/startup/load-modules.js +++ b/core/modules/startup/load-modules.js @@ -6,10 +6,7 @@ module-type: startup Load core modules \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; // Export name and synchronous status @@ -36,5 +33,3 @@ exports.startup = function() { $tw.wiki.initParsers(); $tw.Commander.initCommands(); }; - -})(); diff --git a/core/modules/startup/password.js b/core/modules/startup/password.js index 5e8bd5352..5ea36ee19 100644 --- a/core/modules/startup/password.js +++ b/core/modules/startup/password.js @@ -6,10 +6,7 @@ module-type: startup Password handling \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; // Export name and synchronous status @@ -49,5 +46,3 @@ exports.startup = function() { } }); }; - -})(); diff --git a/core/modules/startup/plugins.js b/core/modules/startup/plugins.js index fc8ba9589..3ceda8669 100644 --- a/core/modules/startup/plugins.js +++ b/core/modules/startup/plugins.js @@ -6,10 +6,7 @@ module-type: startup Startup logic concerned with managing plugins \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; // Export name and synchronous status @@ -75,11 +72,10 @@ exports.startup = function() { $tw.wiki.unpackPluginTiddlers(); // Queue change events for the changed shadow tiddlers $tw.utils.each(Object.keys(changedShadowTiddlers),function(title) { - $tw.wiki.enqueueTiddlerEvent(title,changedShadowTiddlers[title]); + $tw.wiki.enqueueTiddlerEvent(title,changedShadowTiddlers[title], true); }); } } }); }; -})(); diff --git a/core/modules/startup/render.js b/core/modules/startup/render.js index 7206a51d0..13cbb0356 100644 --- a/core/modules/startup/render.js +++ b/core/modules/startup/render.js @@ -6,10 +6,7 @@ module-type: startup Title, stylesheet and page rendering \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; // Export name and synchronous status @@ -120,5 +117,3 @@ exports.startup = function() { // Run any post-render startup actions $tw.rootWidget.invokeActionsByTag("$:/tags/StartupAction/PostRender"); }; - -})(); diff --git a/core/modules/startup/rootwidget.js b/core/modules/startup/rootwidget.js index d96d569c3..b30e03e7b 100644 --- a/core/modules/startup/rootwidget.js +++ b/core/modules/startup/rootwidget.js @@ -6,10 +6,7 @@ module-type: startup Setup the root widget and the core root widget handlers \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; // Export name and synchronous status @@ -77,8 +74,9 @@ exports.startup = function() { $tw.rootWidget.addEventListener("tm-copy-to-clipboard",function(event) { $tw.utils.copyToClipboard(event.param,{ successNotification: event.paramObject && event.paramObject.successNotification, - failureNotification: event.paramObject && event.paramObject.failureNotification - }); + failureNotification: event.paramObject && event.paramObject.failureNotification, + plainText: event.paramObject && event.paramObject.plainText + },event.paramObject && event.paramObject.type); }); // Install the tm-focus-selector message $tw.rootWidget.addEventListener("tm-focus-selector",function(event) { @@ -127,5 +125,3 @@ exports.startup = function() { }); } }; - -})(); diff --git a/core/modules/startup/startup.js b/core/modules/startup/startup.js index e09f6393f..6f78c71b5 100755 --- a/core/modules/startup/startup.js +++ b/core/modules/startup/startup.js @@ -6,10 +6,7 @@ module-type: startup Miscellaneous startup logic for both the client and server. \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; // Export name and synchronous status @@ -67,14 +64,6 @@ exports.startup = function() { wiki: $tw.wiki, document: $tw.browser ? document : $tw.fakeDocument }); - // Execute any startup actions - $tw.rootWidget.invokeActionsByTag("$:/tags/StartupAction"); - if($tw.browser) { - $tw.rootWidget.invokeActionsByTag("$:/tags/StartupAction/Browser"); - } - if($tw.node) { - $tw.rootWidget.invokeActionsByTag("$:/tags/StartupAction/Node"); - } // Kick off the language manager and switcher $tw.language = new $tw.Language(); $tw.languageSwitcher = new $tw.PluginSwitcher({ @@ -88,8 +77,10 @@ exports.startup = function() { if($tw.browser) { var pluginTiddler = $tw.wiki.getTiddler(plugins[0]); if(pluginTiddler) { + document.documentElement.setAttribute("lang",pluginTiddler.getFieldString("name")); document.documentElement.setAttribute("dir",pluginTiddler.getFieldString("text-direction") || "auto"); } else { + document.documentElement.setAttribute("lang","en-GB"); document.documentElement.removeAttribute("dir"); } } @@ -115,6 +106,14 @@ exports.startup = function() { handlerMethod: "handleKeydownEvent" }]); } + // Execute any startup actions + $tw.rootWidget.invokeActionsByTag("$:/tags/StartupAction"); + if($tw.browser) { + $tw.rootWidget.invokeActionsByTag("$:/tags/StartupAction/Browser"); + } + if($tw.node) { + $tw.rootWidget.invokeActionsByTag("$:/tags/StartupAction/Node"); + } // Clear outstanding tiddler store change events to avoid an unnecessary refresh cycle at startup $tw.wiki.clearTiddlerEventQueue(); // Find a working syncadaptor @@ -146,5 +145,3 @@ exports.startup = function() { $tw.anim = new $tw.utils.Animator(); } }; - -})(); diff --git a/core/modules/startup/story.js b/core/modules/startup/story.js index c58c759c3..a0c878024 100644 --- a/core/modules/startup/story.js +++ b/core/modules/startup/story.js @@ -6,10 +6,7 @@ module-type: startup Load core modules \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; // Export name and synchronous status @@ -234,5 +231,3 @@ function updateLocationHash(options) { } } } - -})(); diff --git a/core/modules/startup/windows.js b/core/modules/startup/windows.js index 34f45d7a5..8506a9866 100644 --- a/core/modules/startup/windows.js +++ b/core/modules/startup/windows.js @@ -6,10 +6,7 @@ module-type: startup Setup root widget handlers for the messages concerned with opening external browser windows \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; // Export name and synchronous status @@ -110,5 +107,3 @@ exports.startup = function() { // Close open windows when unloading main window $tw.addUnloadTask(closeAllWindows); }; - -})(); diff --git a/core/modules/story.js b/core/modules/story.js index 16ff5a74a..4e624bb26 100644 --- a/core/modules/story.js +++ b/core/modules/story.js @@ -6,10 +6,7 @@ module-type: global Lightweight object for managing interactions with the story and history lists. \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; /* @@ -133,6 +130,3 @@ Story.prototype.storyNewTiddler = function(targetTitle) { }; exports.Story = Story; - - -})(); diff --git a/core/modules/storyviews/classic.js b/core/modules/storyviews/classic.js index a85e458c5..c1f1c0e0f 100644 --- a/core/modules/storyviews/classic.js +++ b/core/modules/storyviews/classic.js @@ -6,10 +6,7 @@ module-type: storyview Views the story as a linear sequence \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; var easing = "cubic-bezier(0.645, 0.045, 0.355, 1)"; // From http://easings.net/#easeInOutCubic @@ -117,5 +114,3 @@ ClassicStoryView.prototype.remove = function(widget) { }; exports.classic = ClassicStoryView; - -})(); diff --git a/core/modules/storyviews/pop.js b/core/modules/storyviews/pop.js index e2634e3d5..cbf649b18 100644 --- a/core/modules/storyviews/pop.js +++ b/core/modules/storyviews/pop.js @@ -6,10 +6,7 @@ module-type: storyview Animates list insertions and removals \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; var PopStoryView = function(listWidget) { @@ -99,5 +96,3 @@ PopStoryView.prototype.remove = function(widget) { }; exports.pop = PopStoryView; - -})(); diff --git a/core/modules/storyviews/zoomin.js b/core/modules/storyviews/zoomin.js index d02f705e7..e5c5b88a8 100644 --- a/core/modules/storyviews/zoomin.js +++ b/core/modules/storyviews/zoomin.js @@ -6,10 +6,7 @@ module-type: storyview Zooms between individual tiddlers \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; var easing = "cubic-bezier(0.645, 0.045, 0.355, 1)"; // From http://easings.net/#easeInOutCubic @@ -226,5 +223,3 @@ ZoominListView.prototype.logTextNodeRoot = function(node) { }; exports.zoomin = ZoominListView; - -})(); diff --git a/core/modules/syncer.js b/core/modules/syncer.js index f7627e1ac..f565d0b9f 100644 --- a/core/modules/syncer.js +++ b/core/modules/syncer.js @@ -6,10 +6,7 @@ module-type: global The syncer tracks changes to the store and synchronises them to a remote data store represented as a "sync adaptor" \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; /* @@ -703,5 +700,3 @@ SyncFromServerTask.prototype.run = function(callback) { }; exports.Syncer = Syncer; - -})(); diff --git a/core/modules/tiddler.js b/core/modules/tiddler.js index b0b6e6942..d28f90945 100644 --- a/core/modules/tiddler.js +++ b/core/modules/tiddler.js @@ -6,10 +6,7 @@ module-type: tiddlermethod Extension methods for the $tw.Tiddler object (constructor and methods required at boot time are in boot/boot.js) \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; exports.hasTag = function(tag) { @@ -40,10 +37,10 @@ exports.getFieldString = function(field,defaultValue) { }; /* -Get the value of a field as a list +Get the value of a field as an array / list */ exports.getFieldList = function(field) { - var value = this.fields[field]; + var value = this.getFieldString(field,null); // Check for a missing field if(value === undefined || value === null) { return []; @@ -99,5 +96,3 @@ exports.getFieldDay = function(field) { this.cache.day[field] = day; return day; }; - -})(); diff --git a/core/modules/upgraders/plugins.js b/core/modules/upgraders/plugins.js index 83487aabf..8f35d5090 100644 --- a/core/modules/upgraders/plugins.js +++ b/core/modules/upgraders/plugins.js @@ -6,10 +6,7 @@ module-type: upgrader Upgrader module that checks that plugins are newer than any already installed version \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; var UPGRADE_LIBRARY_TITLE = "$:/UpgradeLibrary"; @@ -75,5 +72,3 @@ exports.upgrade = function(wiki,titles,tiddlers) { }); return messages; }; - -})(); diff --git a/core/modules/upgraders/system.js b/core/modules/upgraders/system.js index a653a75b1..ae3f76b3c 100644 --- a/core/modules/upgraders/system.js +++ b/core/modules/upgraders/system.js @@ -6,10 +6,7 @@ module-type: upgrader Upgrader module that suppresses certain system tiddlers that shouldn't be imported \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; var DONT_IMPORT_LIST = ["$:/Import", "$:/build"], @@ -47,5 +44,3 @@ exports.upgrade = function(wiki,titles,tiddlers) { } return messages; }; - -})(); diff --git a/core/modules/upgraders/themetweaks.js b/core/modules/upgraders/themetweaks.js index e411b285a..616f9008d 100644 --- a/core/modules/upgraders/themetweaks.js +++ b/core/modules/upgraders/themetweaks.js @@ -15,10 +15,7 @@ Now, each tweak is stored in its own separate tiddler. This upgrader copies any values from the old format to the new. The old data tiddlers are not deleted in case they have been used to store additional indexes. \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; var MAPPINGS = { @@ -61,5 +58,3 @@ exports.upgrade = function(wiki,titles,tiddlers) { }); return messages; }; - -})(); diff --git a/core/modules/utils/crypto.js b/core/modules/utils/crypto.js index 8ad0923a4..dc239fbcc 100644 --- a/core/modules/utils/crypto.js +++ b/core/modules/utils/crypto.js @@ -6,10 +6,7 @@ module-type: utils Utility functions related to crypto. \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; /* @@ -90,5 +87,3 @@ exports.decryptStoreAreaInteractive = function(encryptedStoreArea,callback,optio }); } }; - -})(); diff --git a/core/modules/utils/csv.js b/core/modules/utils/csv.js index 68b647127..177f0c0ac 100644 --- a/core/modules/utils/csv.js +++ b/core/modules/utils/csv.js @@ -6,10 +6,7 @@ module-type: utils A barebones CSV parser \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; var QUOTE = '"'; @@ -120,5 +117,3 @@ exports.parseCsvStringWithHeader = function(text,options) { } return csv; } - -})(); diff --git a/core/modules/utils/dom/animations/slide.js b/core/modules/utils/dom/animations/slide.js index face94960..2057c4460 100644 --- a/core/modules/utils/dom/animations/slide.js +++ b/core/modules/utils/dom/animations/slide.js @@ -6,10 +6,7 @@ module-type: animation A simple slide animation that varies the height of the element \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; function slideOpen(domNode,options) { @@ -111,5 +108,3 @@ exports.slide = { open: slideOpen, close: slideClosed }; - -})(); diff --git a/core/modules/utils/dom/animator.js b/core/modules/utils/dom/animator.js index f994d9b58..013900975 100644 --- a/core/modules/utils/dom/animator.js +++ b/core/modules/utils/dom/animator.js @@ -6,10 +6,7 @@ module-type: utils Orchestrates animations and transitions \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; function Animator() { @@ -39,5 +36,3 @@ Animator.prototype.perform = function(type,domNode,options) { }; exports.Animator = Animator; - -})(); diff --git a/core/modules/utils/dom/browser.js b/core/modules/utils/dom/browser.js index fcc292bed..7501d4154 100644 --- a/core/modules/utils/dom/browser.js +++ b/core/modules/utils/dom/browser.js @@ -6,10 +6,7 @@ module-type: utils Browser feature detection \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; /* @@ -160,5 +157,3 @@ exports.getFullScreenApis = function() { return result; } }; - -})(); diff --git a/core/modules/utils/dom/dom.js b/core/modules/utils/dom/dom.js index 0b71e128c..a5b14ff78 100644 --- a/core/modules/utils/dom/dom.js +++ b/core/modules/utils/dom/dom.js @@ -6,10 +6,7 @@ module-type: utils Various static DOM-related utility functions. \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; var Popup = require("$:/core/modules/utils/dom/popup.js"); @@ -268,9 +265,10 @@ exports.copyStyles = function(srcDomNode,dstDomNode) { /* Copy plain text to the clipboard on browsers that support it */ -exports.copyToClipboard = function(text,options) { - options = options || {}; - text = text || ""; +exports.copyToClipboard = function(text,options,type) { + var text = text || ""; + var options = options || {}; + var type = type || "text/plain"; var textArea = document.createElement("textarea"); textArea.style.position = "fixed"; textArea.style.top = 0; @@ -283,10 +281,16 @@ exports.copyToClipboard = function(text,options) { textArea.style.outline = "none"; textArea.style.boxShadow = "none"; textArea.style.background = "transparent"; - textArea.value = text; document.body.appendChild(textArea); textArea.select(); textArea.setSelectionRange(0,text.length); + textArea.addEventListener("copy",function(event) { + event.preventDefault(); + if (options.plainText) { + event.clipboardData.setData("text/plain",options.plainText); + } + event.clipboardData.setData(type,text); + }); var succeeded = false; try { succeeded = document.execCommand("copy"); @@ -388,5 +392,3 @@ exports.querySelectorAllSafe = function(selector,baseElement) { console.log("Invalid selector: ",selector); } }; - -})(); diff --git a/core/modules/utils/dom/dragndrop.js b/core/modules/utils/dom/dragndrop.js index c7c32cbaf..25a13537c 100644 --- a/core/modules/utils/dom/dragndrop.js +++ b/core/modules/utils/dom/dragndrop.js @@ -6,10 +6,7 @@ module-type: utils Browser data transfer utilities, used with the clipboard and drag and drop \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; /* @@ -275,5 +272,3 @@ exports.dragEventContainsFiles = function(event) { }; exports.dragEventContainsType = dragEventContainsType; - -})(); diff --git a/core/modules/utils/dom/http.js b/core/modules/utils/dom/http.js index f16f1c512..75b82cd77 100644 --- a/core/modules/utils/dom/http.js +++ b/core/modules/utils/dom/http.js @@ -6,10 +6,7 @@ module-type: utils HTTP support \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; /* @@ -216,11 +213,11 @@ HttpClientRequest.prototype.send = function(callback) { if(lengthComputable) { setBinding(self.bindProgress,"" + Math.floor((loaded/total) * 100)) } - self.wiki.invokeActionString(self.progressActions,undefined,{ + self.wiki.invokeActionString(self.progressActions,undefined,$tw.utils.extend({},self.variables,{ lengthComputable: lengthComputable ? "yes" : "no", loaded: loaded, total: total - },{parentWidget: $tw.rootWidget}); + }),{parentWidget: $tw.rootWidget}); } }); } @@ -353,5 +350,3 @@ exports.setQueryStringParameter = function(url,paramName,paramValue) { return url; } }; - -})(); diff --git a/core/modules/utils/dom/keyboard.js b/core/modules/utils/dom/keyboard.js index 0ba1af5a0..926753a65 100644 --- a/core/modules/utils/dom/keyboard.js +++ b/core/modules/utils/dom/keyboard.js @@ -6,10 +6,7 @@ module-type: utils Keyboard utilities; now deprecated. Instead, use $tw.keyboardManager \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; ["parseKeyDescriptor","checkKeyDescriptor"].forEach(function(method) { @@ -21,5 +18,3 @@ Keyboard utilities; now deprecated. Instead, use $tw.keyboardManager } }; }); - -})(); diff --git a/core/modules/utils/dom/modal.js b/core/modules/utils/dom/modal.js index 1e620aa9a..cd827c3be 100644 --- a/core/modules/utils/dom/modal.js +++ b/core/modules/utils/dom/modal.js @@ -6,10 +6,7 @@ module-type: utils Modal message mechanism \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; var widget = require("$:/core/modules/widgets/widget.js"); @@ -253,5 +250,3 @@ Modal.prototype.adjustPageClass = function() { }; exports.Modal = Modal; - -})(); diff --git a/core/modules/utils/dom/notifier.js b/core/modules/utils/dom/notifier.js index bf93d451c..8743b83be 100644 --- a/core/modules/utils/dom/notifier.js +++ b/core/modules/utils/dom/notifier.js @@ -6,10 +6,7 @@ module-type: utils Notifier mechanism \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; var widget = require("$:/core/modules/widgets/widget.js"); @@ -88,5 +85,3 @@ Notifier.prototype.display = function(title,options) { }; exports.Notifier = Notifier; - -})(); diff --git a/core/modules/utils/dom/popup.js b/core/modules/utils/dom/popup.js index 017e7da8f..6ed7c4bca 100644 --- a/core/modules/utils/dom/popup.js +++ b/core/modules/utils/dom/popup.js @@ -6,10 +6,7 @@ module-type: utils Module that creates a $tw.utils.Popup object prototype that manages popups in the browser \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; /* @@ -243,5 +240,3 @@ exports.buildCoordinates = function(prefix,position) { } exports.Popup = Popup; - -})(); diff --git a/core/modules/utils/dom/scroller.js b/core/modules/utils/dom/scroller.js index 905bb2750..84be12c50 100644 --- a/core/modules/utils/dom/scroller.js +++ b/core/modules/utils/dom/scroller.js @@ -6,10 +6,7 @@ module-type: utils Module that creates a $tw.utils.Scroller object prototype that manages scrolling in the browser \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; /* @@ -135,5 +132,3 @@ PageScroller.prototype.scrollSelectorIntoView = function(baseElement,selector,ca }; exports.PageScroller = PageScroller; - -})(); diff --git a/core/modules/utils/edition-info.js b/core/modules/utils/edition-info.js index b9d97f962..2c525e3cc 100644 --- a/core/modules/utils/edition-info.js +++ b/core/modules/utils/edition-info.js @@ -6,10 +6,7 @@ module-type: utils-node Information about the available editions \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; var fs = require("fs"), @@ -44,5 +41,3 @@ exports.getEditionInfo = function() { } return editionInfo; }; - -})(); \ No newline at end of file diff --git a/core/modules/utils/errors.js b/core/modules/utils/errors.js index fac4b3fa7..40e0a4f8f 100644 --- a/core/modules/utils/errors.js +++ b/core/modules/utils/errors.js @@ -6,8 +6,6 @@ module-type: utils Custom errors for TiddlyWiki. \*/ -(function(){ - function TranscludeRecursionError() { Error.apply(this,arguments); this.signatures = Object.create(null); @@ -19,5 +17,3 @@ TranscludeRecursionError.MAX_WIDGET_TREE_DEPTH = 1000; TranscludeRecursionError.prototype = Object.create(Error); exports.TranscludeRecursionError = TranscludeRecursionError; - -})(); diff --git a/core/modules/utils/escapecss.js b/core/modules/utils/escapecss.js index 5935b034a..f2248c445 100644 --- a/core/modules/utils/escapecss.js +++ b/core/modules/utils/escapecss.js @@ -6,12 +6,10 @@ module-type: utils Provides CSS.escape() functionality. \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false, window: false */ "use strict"; +// TODO -- resolve this construction exports.escapeCSS = (function() { // use browser's native CSS.escape() function if available if ($tw.browser && window.CSS && window.CSS.escape) { @@ -100,5 +98,3 @@ exports.escapeCSS = (function() { return result; }; })(); - -})(); diff --git a/core/modules/utils/fakedom.js b/core/modules/utils/fakedom.js index 66f2314e2..764ac84f8 100755 --- a/core/modules/utils/fakedom.js +++ b/core/modules/utils/fakedom.js @@ -6,10 +6,7 @@ module-type: global A barebones implementation of DOM interfaces needed by the rendering mechanism. \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; // Sequence number used to enable us to track objects for testing @@ -353,5 +350,3 @@ var document = { }; exports.fakeDocument = document; - -})(); diff --git a/core/modules/utils/filesystem.js b/core/modules/utils/filesystem.js index 86001c291..aa214586a 100644 --- a/core/modules/utils/filesystem.js +++ b/core/modules/utils/filesystem.js @@ -6,10 +6,7 @@ module-type: utils-node File system utilities \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; var fs = require("fs"), @@ -543,5 +540,3 @@ exports.cleanupTiddlerFiles = function(options,callback) { return callback(null,bootInfo); } }; - -})(); diff --git a/core/modules/utils/linked-list.js b/core/modules/utils/linked-list.js index 917069d16..8d7f44676 100644 --- a/core/modules/utils/linked-list.js +++ b/core/modules/utils/linked-list.js @@ -7,7 +7,8 @@ This is a doubly-linked indexed list intended for manipulation, particularly pushTop, which it does with significantly better performance than an array. \*/ -(function(){ + +"use strict"; function LinkedList() { this.clear(); @@ -204,5 +205,3 @@ LLMap.prototype = { }; exports.LinkedList = LinkedList; - -})(); diff --git a/core/modules/utils/logger.js b/core/modules/utils/logger.js index 1bee04646..da0d66923 100644 --- a/core/modules/utils/logger.js +++ b/core/modules/utils/logger.js @@ -6,10 +6,7 @@ module-type: utils A basic logging implementation \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; var ALERT_TAG = "$:/tags/Alert"; @@ -134,5 +131,3 @@ Logger.prototype.clearAlerts = function() { }; exports.Logger = Logger; - -})(); diff --git a/core/modules/utils/parsetree.js b/core/modules/utils/parsetree.js index a74b8f3f8..410f92181 100644 --- a/core/modules/utils/parsetree.js +++ b/core/modules/utils/parsetree.js @@ -6,10 +6,7 @@ module-type: utils Parse tree utility functions. \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; /* @@ -122,5 +119,3 @@ exports.getParseTreeText = function getParseTreeText(tree) { } return output.join(""); }; - -})(); diff --git a/core/modules/utils/performance.js b/core/modules/utils/performance.js index 8a86d33c7..f8311d977 100644 --- a/core/modules/utils/performance.js +++ b/core/modules/utils/performance.js @@ -6,10 +6,7 @@ module-type: global Performance measurement. \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; function Performance(enabled) { @@ -87,5 +84,3 @@ Performance.prototype.measure = function(name,fn) { }; exports.Performance = Performance; - -})(); diff --git a/core/modules/utils/pluginmaker.js b/core/modules/utils/pluginmaker.js index e7426d62b..f64bbec85 100644 --- a/core/modules/utils/pluginmaker.js +++ b/core/modules/utils/pluginmaker.js @@ -6,10 +6,7 @@ module-type: utils A quick and dirty way to pack up plugins within the browser. \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; /* @@ -75,5 +72,3 @@ exports.repackPlugin = function(title,additionalTiddlers,excludeTiddlers) { // Return a heartwarming confirmation return "Plugin " + title + " successfully saved"; }; - -})(); diff --git a/core/modules/utils/repository.js b/core/modules/utils/repository.js index 3aeb4d25a..08d8828d9 100644 --- a/core/modules/utils/repository.js +++ b/core/modules/utils/repository.js @@ -6,10 +6,6 @@ module-type: utils Utilities for working with the TiddlyWiki repository file structure \*/ -(function(){ - -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; /* @@ -48,5 +44,3 @@ exports.getAllPlugins = function(options) { $tw.utils.each($tw.getLibraryItemSearchPaths($tw.config.languagesPath,options.ignoreEnvironmentVariables ? undefined : $tw.config.languagesEnvVar),collectPlugins); return tiddlers; }; - -})(); diff --git a/core/modules/utils/transliterate.js b/core/modules/utils/transliterate.js index ce1cbeddb..37c5502bf 100644 --- a/core/modules/utils/transliterate.js +++ b/core/modules/utils/transliterate.js @@ -6,10 +6,7 @@ module-type: utils Transliteration static utility functions. \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; /* @@ -928,5 +925,3 @@ exports.transliterateToSafeASCII = function(str) { return exports.transliterationPairs[ch] || "" }); }; - -})(); diff --git a/core/modules/utils/utils.js b/core/modules/utils/utils.js index 234de0c75..a228f91d4 100644 --- a/core/modules/utils/utils.js +++ b/core/modules/utils/utils.js @@ -6,10 +6,7 @@ module-type: utils Various static utility functions. \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; var base64utf8 = require("$:/core/modules/utils/base64-utf8/base64-utf8.module.js"); @@ -1038,5 +1035,3 @@ exports.makeCompareFunction = function(type,options) { }; return (types[type] || types[options.defaultType] || types.number); }; - -})(); diff --git a/core/modules/widgets/action-confirm.js b/core/modules/widgets/action-confirm.js index 68d8c447e..c2ca39b64 100644 --- a/core/modules/widgets/action-confirm.js +++ b/core/modules/widgets/action-confirm.js @@ -5,10 +5,7 @@ type: application/javascript module-type: widget \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; var Widget = require("$:/core/modules/widgets/widget.js").widget; @@ -74,5 +71,3 @@ ConfirmWidget.prototype.allowActionPropagation = function() { }; exports["action-confirm"] = ConfirmWidget; - -})(); diff --git a/core/modules/widgets/action-createtiddler.js b/core/modules/widgets/action-createtiddler.js index b49eaad20..d010e6465 100644 --- a/core/modules/widgets/action-createtiddler.js +++ b/core/modules/widgets/action-createtiddler.js @@ -6,10 +6,7 @@ module-type: widget Action widget to create a new tiddler with a unique name and specified fields. \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw:false, require:false, exports:false */ "use strict"; var Widget = require("$:/core/modules/widgets/widget.js").widget; @@ -109,5 +106,3 @@ CreateTiddlerWidget.prototype.invokeAction = function(triggeringWidget,event) { }; exports["action-createtiddler"] = CreateTiddlerWidget; - -})(); diff --git a/core/modules/widgets/action-deletefield.js b/core/modules/widgets/action-deletefield.js index 00f06562d..fd55e2270 100644 --- a/core/modules/widgets/action-deletefield.js +++ b/core/modules/widgets/action-deletefield.js @@ -6,10 +6,7 @@ module-type: widget Action widget to delete fields of a tiddler. \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; var Widget = require("$:/core/modules/widgets/widget.js").widget; @@ -85,5 +82,3 @@ DeleteFieldWidget.prototype.invokeAction = function(triggeringWidget,event) { }; exports["action-deletefield"] = DeleteFieldWidget; - -})(); diff --git a/core/modules/widgets/action-deletetiddler.js b/core/modules/widgets/action-deletetiddler.js index 816f9f55e..fa80620b7 100644 --- a/core/modules/widgets/action-deletetiddler.js +++ b/core/modules/widgets/action-deletetiddler.js @@ -6,10 +6,7 @@ module-type: widget Action widget to delete a tiddler. \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; var Widget = require("$:/core/modules/widgets/widget.js").widget; @@ -69,5 +66,3 @@ DeleteTiddlerWidget.prototype.invokeAction = function(triggeringWidget,event) { }; exports["action-deletetiddler"] = DeleteTiddlerWidget; - -})(); diff --git a/core/modules/widgets/action-listops.js b/core/modules/widgets/action-listops.js index b3d93a657..29cf9f8de 100644 --- a/core/modules/widgets/action-listops.js +++ b/core/modules/widgets/action-listops.js @@ -6,10 +6,6 @@ module-type: widget Action widget to apply list operations to any tiddler field (defaults to the 'list' field of the current tiddler) \*/ -(function() { - -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; var Widget = require("$:/core/modules/widgets/widget.js").widget; var ActionListopsWidget = function(parseTreeNode, options) { @@ -87,5 +83,3 @@ ActionListopsWidget.prototype.invokeAction = function(triggeringWidget, }; exports["action-listops"] = ActionListopsWidget; - -})(); diff --git a/core/modules/widgets/action-log.js b/core/modules/widgets/action-log.js index 7b1d1e904..3f8caf047 100644 --- a/core/modules/widgets/action-log.js +++ b/core/modules/widgets/action-log.js @@ -6,10 +6,7 @@ module-type: widget Action widget to log debug messages \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; var Widget = require("$:/core/modules/widgets/widget.js").widget; @@ -94,5 +91,3 @@ LogWidget.prototype.log = function() { } exports["action-log"] = LogWidget; - -})(); diff --git a/core/modules/widgets/action-navigate.js b/core/modules/widgets/action-navigate.js index 2df6a011f..67c7713db 100644 --- a/core/modules/widgets/action-navigate.js +++ b/core/modules/widgets/action-navigate.js @@ -6,10 +6,7 @@ module-type: widget Action widget to navigate to a tiddler \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; var Widget = require("$:/core/modules/widgets/widget.js").widget; @@ -87,5 +84,3 @@ NavigateWidget.prototype.invokeAction = function(triggeringWidget,event) { }; exports["action-navigate"] = NavigateWidget; - -})(); diff --git a/core/modules/widgets/action-popup.js b/core/modules/widgets/action-popup.js index a3ce20165..b44b3a524 100644 --- a/core/modules/widgets/action-popup.js +++ b/core/modules/widgets/action-popup.js @@ -6,10 +6,7 @@ module-type: widget Action widget to trigger a popup. \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; var Widget = require("$:/core/modules/widgets/widget.js").widget; @@ -81,5 +78,3 @@ ActionPopupWidget.prototype.invokeAction = function(triggeringWidget,event) { }; exports["action-popup"] = ActionPopupWidget; - -})(); diff --git a/core/modules/widgets/action-sendmessage.js b/core/modules/widgets/action-sendmessage.js index d1e800c91..7b9e6453f 100644 --- a/core/modules/widgets/action-sendmessage.js +++ b/core/modules/widgets/action-sendmessage.js @@ -6,10 +6,7 @@ module-type: widget Action widget to send a message \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; var Widget = require("$:/core/modules/widgets/widget.js").widget; @@ -95,5 +92,3 @@ SendMessageWidget.prototype.invokeAction = function(triggeringWidget,event) { }; exports["action-sendmessage"] = SendMessageWidget; - -})(); diff --git a/core/modules/widgets/action-setfield.js b/core/modules/widgets/action-setfield.js index f853484cd..2d2c6ce47 100644 --- a/core/modules/widgets/action-setfield.js +++ b/core/modules/widgets/action-setfield.js @@ -6,10 +6,7 @@ module-type: widget Action widget to set a single field or index on a tiddler. \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; var Widget = require("$:/core/modules/widgets/widget.js").widget; @@ -71,5 +68,3 @@ SetFieldWidget.prototype.invokeAction = function(triggeringWidget,event) { }; exports["action-setfield"] = SetFieldWidget; - -})(); diff --git a/core/modules/widgets/action-setmultiplefields.js b/core/modules/widgets/action-setmultiplefields.js index 174c72889..1e2326394 100644 --- a/core/modules/widgets/action-setmultiplefields.js +++ b/core/modules/widgets/action-setmultiplefields.js @@ -6,10 +6,7 @@ module-type: widget Action widget to set multiple fields or indexes on a tiddler \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; var Widget = require("$:/core/modules/widgets/widget.js").widget; @@ -81,6 +78,3 @@ SetMultipleFieldsWidget.prototype.invokeAction = function(triggeringWidget,event }; exports["action-setmultiplefields"] = SetMultipleFieldsWidget; - -})(); - \ No newline at end of file diff --git a/core/modules/widgets/browse.js b/core/modules/widgets/browse.js index 8130825b0..b0173f6e2 100644 --- a/core/modules/widgets/browse.js +++ b/core/modules/widgets/browse.js @@ -6,10 +6,7 @@ module-type: widget Browse widget for browsing for files to import \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; var Widget = require("$:/core/modules/widgets/widget.js").widget; @@ -42,6 +39,9 @@ BrowseWidget.prototype.render = function(parent,nextSibling) { if(this.tooltip) { domNode.setAttribute("title",this.tooltip); } + if(this.tabIndex) { + domNode.setAttribute("tabindex", this.tabIndex); + } // Nw.js supports "nwsaveas" to force a "save as" dialogue that allows a new or existing file to be selected if(this.nwsaveas) { domNode.setAttribute("nwsaveas",this.nwsaveas); @@ -56,6 +56,9 @@ BrowseWidget.prototype.render = function(parent,nextSibling) { if(this.nwdirectory) { domNode.setAttribute("nwdirectory",this.nwdirectory); } + if(this.isDisabled === "yes") { + domNode.setAttribute("disabled", true); + } // Add a click event handler domNode.addEventListener("change",function (event) { if(self.message) { @@ -94,6 +97,8 @@ BrowseWidget.prototype.execute = function() { this.accept = this.getAttribute("accept"); this.webkitdirectory = this.getAttribute("webkitdirectory"); this.nwdirectory = this.getAttribute("nwdirectory"); + this.tabIndex = this.getAttribute("tabindex"); + this.isDisabled = this.getAttribute("disabled", "no"); }; /* @@ -109,5 +114,3 @@ BrowseWidget.prototype.refresh = function(changedTiddlers) { }; exports.browse = BrowseWidget; - -})(); diff --git a/core/modules/widgets/button.js b/core/modules/widgets/button.js index aef0fe630..68f2fcd11 100644 --- a/core/modules/widgets/button.js +++ b/core/modules/widgets/button.js @@ -6,10 +6,7 @@ module-type: widget Button widget \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; var Widget = require("$:/core/modules/widgets/widget.js").widget; @@ -279,5 +276,3 @@ ButtonWidget.prototype.refresh = function(changedTiddlers) { }; exports.button = ButtonWidget; - -})(); diff --git a/core/modules/widgets/checkbox.js b/core/modules/widgets/checkbox.js index e07513b0a..7fe62fb42 100644 --- a/core/modules/widgets/checkbox.js +++ b/core/modules/widgets/checkbox.js @@ -6,10 +6,7 @@ module-type: widget Checkbox widget \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; var Widget = require("$:/core/modules/widgets/widget.js").widget; @@ -47,6 +44,9 @@ CheckboxWidget.prototype.render = function(parent,nextSibling) { if(isChecked === undefined && this.checkboxIndeterminate === "yes") { this.inputDomNode.indeterminate = true; } + if(this.tabIndex) { + this.inputDomNode.setAttribute("tabindex", this.tabIndex); + } if(this.isDisabled === "yes") { this.inputDomNode.setAttribute("disabled",true); } @@ -154,7 +154,7 @@ CheckboxWidget.prototype.getValue = function() { if(this.checkboxTag) { return false; } - if(this.checkboxField) { + if(this.checkboxField || this.checkboxIndex) { if(this.checkboxDefault === this.checkboxChecked) { return true; } @@ -305,6 +305,7 @@ CheckboxWidget.prototype.execute = function() { this.checkboxClass = this.getAttribute("class",""); this.checkboxInvertTag = this.getAttribute("invertTag",""); this.isDisabled = this.getAttribute("disabled","no"); + this.tabIndex = this.getAttribute(); // Make the child widgets this.makeChildWidgets(); }; @@ -314,7 +315,7 @@ Selectively refreshes the widget if needed. Returns true if the widget or any of */ CheckboxWidget.prototype.refresh = function(changedTiddlers) { var changedAttributes = this.computeAttributes(); - if(changedAttributes.tiddler || changedAttributes.tag || changedAttributes.invertTag || changedAttributes.field || changedAttributes.index || changedAttributes.listField || changedAttributes.listIndex || changedAttributes.filter || changedAttributes.checked || changedAttributes.unchecked || changedAttributes["default"] || changedAttributes.indeterminate || changedAttributes["class"] || changedAttributes.disabled) { + if(changedAttributes.tiddler || changedAttributes.tag || changedAttributes.invertTag || changedAttributes.field || changedAttributes.index || changedAttributes.listField || changedAttributes.listIndex || changedAttributes.filter || changedAttributes.checked || changedAttributes.unchecked || changedAttributes["default"] || changedAttributes.indeterminate || changedAttributes["class"] || changedAttributes.disabled || changedAttributes.tabindex) { this.refreshSelf(); return true; } else { @@ -340,6 +341,3 @@ CheckboxWidget.prototype.refresh = function(changedTiddlers) { }; exports.checkbox = CheckboxWidget; - -})(); - \ No newline at end of file diff --git a/core/modules/widgets/codeblock.js b/core/modules/widgets/codeblock.js index aa7910cf8..0c709c8e2 100644 --- a/core/modules/widgets/codeblock.js +++ b/core/modules/widgets/codeblock.js @@ -6,10 +6,7 @@ module-type: widget Code block node widget \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; var Widget = require("$:/core/modules/widgets/widget.js").widget; @@ -62,5 +59,3 @@ CodeBlockWidget.prototype.refresh = function(changedTiddlers) { }; exports.codeblock = CodeBlockWidget; - -})(); diff --git a/core/modules/widgets/count.js b/core/modules/widgets/count.js index b7ee45452..57acc6fe2 100644 --- a/core/modules/widgets/count.js +++ b/core/modules/widgets/count.js @@ -6,10 +6,7 @@ module-type: widget Count widget \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; var Widget = require("$:/core/modules/widgets/widget.js").widget; @@ -68,5 +65,3 @@ CountWidget.prototype.refresh = function(changedTiddlers) { }; exports.count = CountWidget; - -})(); diff --git a/core/modules/widgets/data.js b/core/modules/widgets/data.js index 5d76f5abd..50eafc63f 100644 --- a/core/modules/widgets/data.js +++ b/core/modules/widgets/data.js @@ -6,10 +6,6 @@ module-type: widget Widget to dynamically represent one or more tiddlers \*/ -(function(){ - -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; var Widget = require("$:/core/modules/widgets/widget.js").widget; @@ -190,5 +186,3 @@ function hasPayloadChanged(a,b) { } exports.data = DataWidget; - -})(); diff --git a/core/modules/widgets/diff-text.js b/core/modules/widgets/diff-text.js index 47a47e259..32cc4f1d8 100644 --- a/core/modules/widgets/diff-text.js +++ b/core/modules/widgets/diff-text.js @@ -6,10 +6,7 @@ module-type: widget Widget to display a diff between two texts \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; var Widget = require("$:/core/modules/widgets/widget.js").widget, @@ -144,5 +141,3 @@ DiffTextWidget.prototype.refresh = function(changedTiddlers) { }; exports["diff-text"] = DiffTextWidget; - -})(); diff --git a/core/modules/widgets/draggable.js b/core/modules/widgets/draggable.js index 97e795ae4..0bb2fc169 100644 --- a/core/modules/widgets/draggable.js +++ b/core/modules/widgets/draggable.js @@ -6,10 +6,7 @@ module-type: widget Draggable widget \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; var Widget = require("$:/core/modules/widgets/widget.js").widget; @@ -131,5 +128,3 @@ DraggableWidget.prototype.refresh = function(changedTiddlers) { }; exports.draggable = DraggableWidget; - -})(); diff --git a/core/modules/widgets/droppable.js b/core/modules/widgets/droppable.js index ba54d8860..fe528d08f 100644 --- a/core/modules/widgets/droppable.js +++ b/core/modules/widgets/droppable.js @@ -6,10 +6,7 @@ module-type: widget Droppable widget \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; var Widget = require("$:/core/modules/widgets/widget.js").widget; @@ -206,5 +203,3 @@ DroppableWidget.prototype.refresh = function(changedTiddlers) { }; exports.droppable = DroppableWidget; - -})(); \ No newline at end of file diff --git a/core/modules/widgets/dropzone.js b/core/modules/widgets/dropzone.js index 043b2557f..7d7d8b815 100644 --- a/core/modules/widgets/dropzone.js +++ b/core/modules/widgets/dropzone.js @@ -6,10 +6,7 @@ module-type: widget Dropzone widget \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; var IMPORT_TITLE = "$:/Import"; @@ -328,5 +325,3 @@ DropZoneWidget.prototype.refresh = function(changedTiddlers) { }; exports.dropzone = DropZoneWidget; - -})(); diff --git a/core/modules/widgets/edit-binary.js b/core/modules/widgets/edit-binary.js index a4a18f63d..bb9581df7 100644 --- a/core/modules/widgets/edit-binary.js +++ b/core/modules/widgets/edit-binary.js @@ -6,10 +6,7 @@ module-type: widget Edit-binary widget; placeholder for editing binary tiddlers \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; var BINARY_WARNING_MESSAGE = "$:/core/ui/BinaryWarning"; @@ -103,5 +100,3 @@ EditBinaryWidget.prototype.refresh = function(changedTiddlers) { }; exports["edit-binary"] = EditBinaryWidget; - -})(); diff --git a/core/modules/widgets/edit-bitmap.js b/core/modules/widgets/edit-bitmap.js index 5065127d8..3065384b3 100644 --- a/core/modules/widgets/edit-bitmap.js +++ b/core/modules/widgets/edit-bitmap.js @@ -6,10 +6,7 @@ module-type: widget Edit-bitmap widget \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; // Default image sizes @@ -339,5 +336,3 @@ EditBitmapWidget.prototype.saveChanges = function() { }; exports["edit-bitmap"] = EditBitmapWidget; - -})(); diff --git a/core/modules/widgets/edit-shortcut.js b/core/modules/widgets/edit-shortcut.js index 31d81b6b8..9a45b6ec0 100644 --- a/core/modules/widgets/edit-shortcut.js +++ b/core/modules/widgets/edit-shortcut.js @@ -6,10 +6,7 @@ module-type: widget Widget to display an editable keyboard shortcut \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; var Widget = require("$:/core/modules/widgets/widget.js").widget; @@ -48,6 +45,9 @@ EditShortcutWidget.prototype.render = function(parent,nextSibling) { if(this.shortcutAriaLabel) { this.inputNode.setAttribute("aria-label",this.shortcutAriaLabel); } + if(this.isDisabled === "yes") { + this.inputNode.setAttribute("disabled", true); + } // Assign the current shortcut this.updateInputNode(); // Add event handlers @@ -77,6 +77,7 @@ EditShortcutWidget.prototype.execute = function() { this.shortcutTooltip = this.getAttribute("tooltip"); this.shortcutAriaLabel = this.getAttribute("aria-label"); this.shortcutFocus = this.getAttribute("focus"); + this.isDisabled = this.getAttribute("disabled", "no"); }; /* @@ -138,7 +139,7 @@ Selectively refreshes the widget if needed. Returns true if the widget needed re */ EditShortcutWidget.prototype.refresh = function(changedTiddlers) { var changedAttributes = this.computeAttributes(); - if(changedAttributes.tiddler || changedAttributes.field || changedAttributes.index || changedAttributes.placeholder || changedAttributes["default"] || changedAttributes["class"] || changedAttributes.style || changedAttributes.tooltip || changedAttributes["aria-label"] || changedAttributes.focus) { + if(changedAttributes.tiddler || changedAttributes.field || changedAttributes.index || changedAttributes.placeholder || changedAttributes["default"] || changedAttributes["class"] || changedAttributes.style || changedAttributes.tooltip || changedAttributes["aria-label"] || changedAttributes.focus || changedAttributes.disabled) { this.refreshSelf(); return true; } else if(changedTiddlers[this.shortcutTiddler]) { @@ -150,5 +151,3 @@ EditShortcutWidget.prototype.refresh = function(changedTiddlers) { }; exports["edit-shortcut"] = EditShortcutWidget; - -})(); diff --git a/core/modules/widgets/edit-text.js b/core/modules/widgets/edit-text.js index bc7b77490..28dc5f79c 100644 --- a/core/modules/widgets/edit-text.js +++ b/core/modules/widgets/edit-text.js @@ -6,10 +6,7 @@ module-type: widget Edit-text widget \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; var editTextWidgetFactory = require("$:/core/modules/editor/factory.js").editTextWidgetFactory, @@ -17,5 +14,3 @@ var editTextWidgetFactory = require("$:/core/modules/editor/factory.js").editTex SimpleEngine = require("$:/core/modules/editor/engines/simple.js").SimpleEngine; exports["edit-text"] = editTextWidgetFactory(FramedEngine,SimpleEngine); - -})(); diff --git a/core/modules/widgets/edit.js b/core/modules/widgets/edit.js index eb7758e90..ed2ad0b35 100644 --- a/core/modules/widgets/edit.js +++ b/core/modules/widgets/edit.js @@ -6,10 +6,7 @@ module-type: widget Edit widget is a meta-widget chooses the appropriate actual editting widget \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; var Widget = require("$:/core/modules/widgets/widget.js").widget; @@ -43,15 +40,6 @@ EditWidget.prototype.execute = function() { // Get our parameters this.editTitle = this.getAttribute("tiddler",this.getVariable("currentTiddler")); this.editField = this.getAttribute("field","text"); - this.editIndex = this.getAttribute("index"); - this.editClass = this.getAttribute("class"); - this.editPlaceholder = this.getAttribute("placeholder"); - this.editTabIndex = this.getAttribute("tabindex"); - this.editFocus = this.getAttribute("focus",""); - this.editCancelPopups = this.getAttribute("cancelPopups",""); - this.editInputActions = this.getAttribute("inputActions"); - this.editRefreshTitle = this.getAttribute("refreshTitle"); - this.editAutoComplete = this.getAttribute("autocomplete"); // Choose the appropriate edit widget this.editorType = this.getEditorType(); // Make the child widgets @@ -89,8 +77,8 @@ Selectively refreshes the widget if needed. Returns true if the widget or any of */ EditWidget.prototype.refresh = function(changedTiddlers) { var changedAttributes = this.computeAttributes(); - // Refresh if an attribute has changed, or the type associated with the target tiddler has changed - if(changedAttributes.tiddler || changedAttributes.field || changedAttributes.index || changedAttributes.tabindex || changedAttributes.cancelPopups || changedAttributes.inputActions || changedAttributes.refreshTitle || changedAttributes.autocomplete || (this.getEditorType() !== this.editorType)) { + // Refresh if the editor type has changed + if(changedAttributes.tiddler || changedAttributes.field || (this.getEditorType() !== this.editorType)) { this.refreshSelf(); return true; } else { @@ -99,5 +87,3 @@ EditWidget.prototype.refresh = function(changedTiddlers) { }; exports.edit = EditWidget; - -})(); diff --git a/core/modules/widgets/element.js b/core/modules/widgets/element.js index 716886e5b..34fd3b9ff 100755 --- a/core/modules/widgets/element.js +++ b/core/modules/widgets/element.js @@ -6,10 +6,7 @@ module-type: widget Element widget \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; var Widget = require("$:/core/modules/widgets/widget.js").widget; @@ -101,5 +98,3 @@ ElementWidget.prototype.refresh = function(changedTiddlers) { }; exports.element = ElementWidget; - -})(); diff --git a/core/modules/widgets/encrypt.js b/core/modules/widgets/encrypt.js index 28dfdaf78..edfbe4429 100644 --- a/core/modules/widgets/encrypt.js +++ b/core/modules/widgets/encrypt.js @@ -6,10 +6,7 @@ module-type: widget Encrypt widget \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; var Widget = require("$:/core/modules/widgets/widget.js").widget; @@ -65,5 +62,3 @@ EncryptWidget.prototype.refresh = function(changedTiddlers) { }; exports.encrypt = EncryptWidget; - -})(); diff --git a/core/modules/widgets/entity.js b/core/modules/widgets/entity.js index 6f1a66fed..a88f32c3d 100755 --- a/core/modules/widgets/entity.js +++ b/core/modules/widgets/entity.js @@ -6,10 +6,7 @@ module-type: widget HTML entity widget \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; var Widget = require("$:/core/modules/widgets/widget.js").widget; @@ -56,5 +53,3 @@ EntityWidget.prototype.refresh = function(changedTiddlers) { }; exports.entity = EntityWidget; - -})(); diff --git a/core/modules/widgets/error.js b/core/modules/widgets/error.js index 6a4a607f1..efbb2cbfb 100644 --- a/core/modules/widgets/error.js +++ b/core/modules/widgets/error.js @@ -6,10 +6,7 @@ module-type: widget Error widget \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; var Widget = require("$:/core/modules/widgets/widget.js").widget; @@ -59,5 +56,3 @@ ErrorWidget.prototype.refresh = function(changedTiddlers) { }; exports.error = ErrorWidget; - -})(); diff --git a/core/modules/widgets/eventcatcher.js b/core/modules/widgets/eventcatcher.js index dad9503c6..70dc99202 100644 --- a/core/modules/widgets/eventcatcher.js +++ b/core/modules/widgets/eventcatcher.js @@ -6,10 +6,7 @@ module-type: widget Event handler widget \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; var Widget = require("$:/core/modules/widgets/widget.js").widget; @@ -155,5 +152,3 @@ EventWidget.prototype.refresh = function(changedTiddlers) { }; exports.eventcatcher = EventWidget; - -})(); diff --git a/core/modules/widgets/fieldmangler.js b/core/modules/widgets/fieldmangler.js index 5a7e43659..811318e99 100644 --- a/core/modules/widgets/fieldmangler.js +++ b/core/modules/widgets/fieldmangler.js @@ -6,10 +6,7 @@ module-type: widget Field mangler widget \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; var Widget = require("$:/core/modules/widgets/widget.js").widget; @@ -130,5 +127,3 @@ FieldManglerWidget.prototype.handleAddTagEvent = function(event) { }; exports.fieldmangler = FieldManglerWidget; - -})(); diff --git a/core/modules/widgets/fields.js b/core/modules/widgets/fields.js index 0e32443ad..db558e3b6 100755 --- a/core/modules/widgets/fields.js +++ b/core/modules/widgets/fields.js @@ -6,10 +6,7 @@ module-type: widget Fields widget \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; var Widget = require("$:/core/modules/widgets/widget.js").widget; @@ -110,5 +107,3 @@ FieldsWidget.prototype.refresh = function(changedTiddlers) { }; exports.fields = FieldsWidget; - -})(); diff --git a/core/modules/widgets/fill.js b/core/modules/widgets/fill.js index de88c95af..3a93a2b02 100644 --- a/core/modules/widgets/fill.js +++ b/core/modules/widgets/fill.js @@ -6,10 +6,7 @@ module-type: widget Sub-widget used by the transclude widget for specifying values for slots within transcluded content. It doesn't do anything by itself because the transclude widget only ever deals with the parse tree nodes, and doesn't instantiate the widget itself \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; var Widget = require("$:/core/modules/widgets/widget.js").widget; @@ -24,7 +21,8 @@ Inherit from the base widget class */ FillWidget.prototype = new Widget(); -exports.fill = FillWidget; +FillWidget.prototype.execute = function() { + // Do nothing. Make no child widgets. $Fill widgets should be invisible when naturally encountered. Instead, their parseTreeNodes are made available to $slot widgets that want it. +}; -})(); - \ No newline at end of file +exports.fill = FillWidget; diff --git a/core/modules/widgets/genesis.js b/core/modules/widgets/genesis.js index 299be1e48..3084ad285 100644 --- a/core/modules/widgets/genesis.js +++ b/core/modules/widgets/genesis.js @@ -6,10 +6,7 @@ module-type: widget Genesis widget for dynamically creating widgets \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; var Widget = require("$:/core/modules/widgets/widget.js").widget; @@ -23,15 +20,21 @@ Inherit from the base widget class */ GenesisWidget.prototype = new Widget(); +GenesisWidget.prototype.computeAttributes = function(options) { + options = options || Object.create(null); + options.filterFn = function(name) { + // Only compute our own attributes which start with a single dollar + return name.charAt(0) === "$" && name.charAt(1) !== "$"; + } + return Widget.prototype.computeAttributes.call(this,options); +}; + /* Render this widget into the DOM */ GenesisWidget.prototype.render = function(parent,nextSibling) { this.parentDomNode = parent; - this.computeAttributes({filterFn: function(name) { - // Only compute our own attributes which start with a single dollar - return name.charAt(0) === "$" && name.charAt(1) !== "$"; - }}); + this.computeAttributes(); this.execute(); this.renderChildren(parent,nextSibling); }; @@ -111,5 +114,3 @@ GenesisWidget.prototype.refresh = function(changedTiddlers) { }; exports.genesis = GenesisWidget; - -})(); diff --git a/core/modules/widgets/image.js b/core/modules/widgets/image.js index 52496fd74..a8fddc789 100644 --- a/core/modules/widgets/image.js +++ b/core/modules/widgets/image.js @@ -22,10 +22,7 @@ Tiddlers that contain wikitext could be rendered to a DIV of the usual size of a The width and height attributes are interpreted as a number of pixels, and do not need to include the "px" suffix. \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; var Widget = require("$:/core/modules/widgets/widget.js").widget; @@ -162,5 +159,3 @@ ImageWidget.prototype.refresh = function(changedTiddlers) { }; exports.image = ImageWidget; - -})(); diff --git a/core/modules/widgets/importvariables.js b/core/modules/widgets/importvariables.js index 3e1ac3fc6..befee4a90 100644 --- a/core/modules/widgets/importvariables.js +++ b/core/modules/widgets/importvariables.js @@ -6,10 +6,7 @@ module-type: widget Import variable definitions from other tiddlers \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; var Widget = require("$:/core/modules/widgets/widget.js").widget; @@ -132,5 +129,3 @@ ImportVariablesWidget.prototype.refresh = function(changedTiddlers) { }; exports.importvariables = ImportVariablesWidget; - -})(); diff --git a/core/modules/widgets/jsontiddler.js b/core/modules/widgets/jsontiddler.js index 44a9e50e3..8d16ae862 100644 --- a/core/modules/widgets/jsontiddler.js +++ b/core/modules/widgets/jsontiddler.js @@ -6,10 +6,7 @@ module-type: widget Render a tiddler as JSON text \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; var Widget = require("$:/core/modules/widgets/widget.js").widget; @@ -87,5 +84,3 @@ JSONTiddlerWidget.prototype.getTiddlerFields = function() { }; exports.jsontiddler = JSONTiddlerWidget; - -})(); \ No newline at end of file diff --git a/core/modules/widgets/keyboard.js b/core/modules/widgets/keyboard.js index 9515f5a3b..f4f6c2906 100644 --- a/core/modules/widgets/keyboard.js +++ b/core/modules/widgets/keyboard.js @@ -6,10 +6,7 @@ module-type: widget Keyboard shortcut widget \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; var Widget = require("$:/core/modules/widgets/widget.js").widget; @@ -135,5 +132,3 @@ KeyboardWidget.prototype.refresh = function(changedTiddlers) { }; exports.keyboard = KeyboardWidget; - -})(); diff --git a/core/modules/widgets/let.js b/core/modules/widgets/let.js index 2b2886530..3cc09ad94 100644 --- a/core/modules/widgets/let.js +++ b/core/modules/widgets/let.js @@ -14,10 +14,7 @@ the later variables to depend upon the earlier ones. ``` \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; var Widget = require("$:/core/modules/widgets/widget.js").widget; @@ -92,5 +89,3 @@ LetWidget.prototype.refresh = function(changedTiddlers) { }; exports["let"] = LetWidget; - -})(); diff --git a/core/modules/widgets/link.js b/core/modules/widgets/link.js index f02a7cae2..c8b54818d 100755 --- a/core/modules/widgets/link.js +++ b/core/modules/widgets/link.js @@ -6,10 +6,7 @@ module-type: widget Link widget \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; var Widget = require("$:/core/modules/widgets/widget.js").widget; @@ -225,6 +222,3 @@ LinkWidget.prototype.refresh = function(changedTiddlers) { }; exports.link = LinkWidget; - -})(); - \ No newline at end of file diff --git a/core/modules/widgets/linkcatcher.js b/core/modules/widgets/linkcatcher.js index 4f4a66b17..d95b523ad 100644 --- a/core/modules/widgets/linkcatcher.js +++ b/core/modules/widgets/linkcatcher.js @@ -6,10 +6,7 @@ module-type: widget Linkcatcher widget \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; var Widget = require("$:/core/modules/widgets/widget.js").widget; @@ -100,5 +97,3 @@ LinkCatcherWidget.prototype.handleNavigateEvent = function(event) { }; exports.linkcatcher = LinkCatcherWidget; - -})(); diff --git a/core/modules/widgets/list.js b/core/modules/widgets/list.js index d4ad41995..f86d2d571 100755 --- a/core/modules/widgets/list.js +++ b/core/modules/widgets/list.js @@ -6,10 +6,7 @@ module-type: widget List and list item widgets \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; var Widget = require("$:/core/modules/widgets/widget.js").widget; @@ -523,4 +520,35 @@ ListJoinWidget.prototype.refresh = function() { return false; } exports["list-join"] = ListJoinWidget; -})(); +/* +Make <$list-template> and <$list-empty> widgets that do nothing +*/ +var ListTemplateWidget = function(parseTreeNode,options) { + // Main initialisation inherited from widget.js + this.initialise(parseTreeNode,options); +}; +ListTemplateWidget.prototype = new Widget(); +ListTemplateWidget.prototype.render = function() {} +ListTemplateWidget.prototype.refresh = function() { return false; } + +exports["list-template"] = ListTemplateWidget; + +var ListEmptyWidget = function(parseTreeNode,options) { + // Main initialisation inherited from widget.js + this.initialise(parseTreeNode,options); +}; +ListEmptyWidget.prototype = new Widget(); +ListEmptyWidget.prototype.render = function() {} +ListEmptyWidget.prototype.refresh = function() { return false; } + +exports["list-empty"] = ListEmptyWidget; + +var ListJoinWidget = function(parseTreeNode,options) { + // Main initialisation inherited from widget.js + this.initialise(parseTreeNode,options); +}; +ListJoinWidget.prototype = new Widget(); +ListJoinWidget.prototype.render = function() {} +ListJoinWidget.prototype.refresh = function() { return false; } + +exports["list-join"] = ListJoinWidget; diff --git a/core/modules/widgets/log.js b/core/modules/widgets/log.js index 9d6e95159..332c79fc2 100644 --- a/core/modules/widgets/log.js +++ b/core/modules/widgets/log.js @@ -6,10 +6,7 @@ module-type: widget-subclass Widget to log debug messages \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; exports.baseClass = "action-log"; @@ -26,5 +23,3 @@ exports.prototype.render = function(event) { Object.getPrototypeOf(Object.getPrototypeOf(this)).render.call(this,event); Object.getPrototypeOf(Object.getPrototypeOf(this)).log.call(this); } - -})(); \ No newline at end of file diff --git a/core/modules/widgets/macrocall.js b/core/modules/widgets/macrocall.js index 2c4adc355..75a927a62 100644 --- a/core/modules/widgets/macrocall.js +++ b/core/modules/widgets/macrocall.js @@ -6,10 +6,7 @@ module-type: widget Macrocall widget \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; var Widget = require("$:/core/modules/widgets/widget.js").widget; @@ -87,5 +84,3 @@ MacroCallWidget.prototype.refresh = function(changedTiddlers) { }; exports.macrocall = MacroCallWidget; - -})(); diff --git a/core/modules/widgets/messagecatcher.js b/core/modules/widgets/messagecatcher.js index 1457cd11f..44cb60f41 100644 --- a/core/modules/widgets/messagecatcher.js +++ b/core/modules/widgets/messagecatcher.js @@ -6,10 +6,7 @@ module-type: widget Message catcher widget \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; var Widget = require("$:/core/modules/widgets/widget.js").widget; @@ -106,5 +103,3 @@ MessageCatcherWidget.prototype.refresh = function(changedTiddlers) { }; exports.messagecatcher = MessageCatcherWidget; - -})(); diff --git a/core/modules/widgets/navigator.js b/core/modules/widgets/navigator.js index e9bec7682..793bc8416 100755 --- a/core/modules/widgets/navigator.js +++ b/core/modules/widgets/navigator.js @@ -6,10 +6,7 @@ module-type: widget Navigator widget \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; var IMPORT_TITLE = "$:/Import"; @@ -277,6 +274,8 @@ NavigatorWidget.prototype.makeDraftTiddler = function(targetTitle) { } // Get the current value of the tiddler we're editing var tiddler = this.wiki.getTiddler(targetTitle); + var defaultType = this.wiki.getTiddlerText("$:/config/DefaultMissingType", "").trim(); + var defaultFields = { type: defaultType }; // Save the initial value of the draft tiddler draftTitle = this.generateDraftTitle(targetTitle); var draftTiddler = new $tw.Tiddler({ @@ -288,7 +287,8 @@ NavigatorWidget.prototype.makeDraftTiddler = function(targetTitle) { "draft.title": targetTitle, "draft.of": targetTitle }, - this.wiki.getModificationFields() + this.wiki.getModificationFields(), + tiddler === null || tiddler === undefined ? defaultFields : {} ); this.wiki.addTiddler(draftTiddler); return draftTiddler; @@ -636,5 +636,3 @@ NavigatorWidget.prototype.handleUnfoldAllTiddlersEvent = function(event) { }; exports.navigator = NavigatorWidget; - -})(); diff --git a/core/modules/widgets/parameters.js b/core/modules/widgets/parameters.js index fdd2cb963..638db8054 100644 --- a/core/modules/widgets/parameters.js +++ b/core/modules/widgets/parameters.js @@ -6,10 +6,7 @@ module-type: widget Widget for definition of transclusion parameters \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; var Widget = require("$:/core/modules/widgets/widget.js").widget, @@ -104,5 +101,3 @@ ParametersWidget.prototype.refresh = function(changedTiddlers) { }; exports.parameters = ParametersWidget; - -})(); diff --git a/core/modules/widgets/password.js b/core/modules/widgets/password.js index 1d2e4ca69..59b084940 100644 --- a/core/modules/widgets/password.js +++ b/core/modules/widgets/password.js @@ -6,10 +6,7 @@ module-type: widget Password widget \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; var Widget = require("$:/core/modules/widgets/widget.js").widget; @@ -78,5 +75,3 @@ PasswordWidget.prototype.refresh = function(changedTiddlers) { }; exports.password = PasswordWidget; - -})(); diff --git a/core/modules/widgets/qualify.js b/core/modules/widgets/qualify.js index 07a5c8b4e..438d88d65 100644 --- a/core/modules/widgets/qualify.js +++ b/core/modules/widgets/qualify.js @@ -6,10 +6,7 @@ module-type: widget Qualify text to a variable \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; var Widget = require("$:/core/modules/widgets/widget.js").widget; @@ -62,5 +59,3 @@ QualifyWidget.prototype.refresh = function(changedTiddlers) { }; exports.qualify = QualifyWidget; - -})(); diff --git a/core/modules/widgets/radio.js b/core/modules/widgets/radio.js index aa7a32cf1..4587df65f 100644 --- a/core/modules/widgets/radio.js +++ b/core/modules/widgets/radio.js @@ -6,10 +6,7 @@ module-type: widget Set a field or index at a given tiddler via radio buttons \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; var Widget = require("$:/core/modules/widgets/widget.js").widget; @@ -47,6 +44,9 @@ RadioWidget.prototype.render = function(parent,nextSibling) { if(isChecked) { this.inputDomNode.checked = true; } + if(this.tabIndex) { + this.inputDomNode.setAttribute("tabindex", this.tabIndex); + } if(this.isDisabled === "yes") { this.inputDomNode.setAttribute("disabled",true); } @@ -111,6 +111,7 @@ RadioWidget.prototype.execute = function() { this.radioClass = this.getAttribute("class",""); this.radioDefault = this.getAttribute("default"); this.isDisabled = this.getAttribute("disabled","no"); + this.tabIndex = this.getAttribute("tabindex"); this.radioActions = this.getAttribute("actions",""); // Make the child widgets this.makeChildWidgets(); @@ -134,5 +135,3 @@ RadioWidget.prototype.refresh = function(changedTiddlers) { }; exports.radio = RadioWidget; - -})(); diff --git a/core/modules/widgets/range.js b/core/modules/widgets/range.js index db2699cc4..8d039b1f1 100644 --- a/core/modules/widgets/range.js +++ b/core/modules/widgets/range.js @@ -6,10 +6,7 @@ module-type: widget Range widget \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; var Widget = require("$:/core/modules/widgets/widget.js").widget; @@ -46,6 +43,9 @@ RangeWidget.prototype.render = function(parent,nextSibling) { if(this.increment){ this.inputDomNode.setAttribute("step", this.increment); } + if(this.tabIndex) { + this.inputDomNode.setAttribute("tabindex", this.tabIndex); + } if(this.isDisabled === "yes") { this.inputDomNode.setAttribute("disabled",true); } @@ -164,6 +164,7 @@ RangeWidget.prototype.execute = function() { this.defaultValue = this.getAttribute("default",""); this.elementClass = this.getAttribute("class",""); this.isDisabled = this.getAttribute("disabled","no"); + this.tabIndex = this.getAttribute("tabindex"); // Actions since 5.1.23 // Next 2 only fire once! this.actionsMouseDown = this.getAttribute("actionsStart",""); @@ -196,5 +197,3 @@ RangeWidget.prototype.refresh = function(changedTiddlers) { }; exports.range = RangeWidget; - -})(); diff --git a/core/modules/widgets/raw.js b/core/modules/widgets/raw.js index 6d0ac41de..3de52a892 100644 --- a/core/modules/widgets/raw.js +++ b/core/modules/widgets/raw.js @@ -6,10 +6,7 @@ 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; @@ -49,5 +46,3 @@ RawWidget.prototype.refresh = function(changedTiddlers) { }; exports.raw = RawWidget; - -})(); diff --git a/core/modules/widgets/reveal.js b/core/modules/widgets/reveal.js index 3e3510f75..f57f1cf42 100755 --- a/core/modules/widgets/reveal.js +++ b/core/modules/widgets/reveal.js @@ -6,10 +6,7 @@ module-type: widget Reveal widget \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; var Widget = require("$:/core/modules/widgets/widget.js").widget; @@ -275,5 +272,3 @@ RevealWidget.prototype.updateState = function() { }; exports.reveal = RevealWidget; - -})(); diff --git a/core/modules/widgets/scrollable.js b/core/modules/widgets/scrollable.js index 227c455c3..f34d462e7 100644 --- a/core/modules/widgets/scrollable.js +++ b/core/modules/widgets/scrollable.js @@ -6,10 +6,7 @@ module-type: widget Scrollable widget \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; var DEBOUNCE_INTERVAL = 100; // Delay after last scroll event before updating the bound tiddler @@ -262,5 +259,3 @@ ScrollableWidget.prototype.refresh = function(changedTiddlers) { }; exports.scrollable = ScrollableWidget; - -})(); diff --git a/core/modules/widgets/select.js b/core/modules/widgets/select.js index 2940e3be0..8bc23542c 100644 --- a/core/modules/widgets/select.js +++ b/core/modules/widgets/select.js @@ -16,10 +16,7 @@ Select widget: ``` \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; var Widget = require("$:/core/modules/widgets/widget.js").widget; @@ -53,6 +50,9 @@ SelectWidget.prototype.render = function(parent,nextSibling) { if(this.selectMultiple) { domNode.setAttribute("multiple","multiple"); } + if(this.isDisabled === "yes") { + domNode.setAttribute("disabled", true); + } if(this.selectSize) { domNode.setAttribute("size",this.selectSize); } @@ -172,6 +172,7 @@ SelectWidget.prototype.execute = function() { this.selectTabindex = this.getAttribute("tabindex"); this.selectTooltip = this.getAttribute("tooltip"); this.selectFocus = this.getAttribute("focus"); + this.isDisabled = this.getAttribute("disabled","no"); // Make the child widgets this.makeChildWidgets(); }; @@ -182,7 +183,7 @@ Selectively refreshes the widget if needed. Returns true if the widget or any of SelectWidget.prototype.refresh = function(changedTiddlers) { var changedAttributes = this.computeAttributes(); // If we're using a different tiddler/field/index then completely refresh ourselves - if(changedAttributes.tiddler || changedAttributes.field || changedAttributes.index || changedAttributes.tooltip || changedAttributes.tabindex) { + if(changedAttributes.tiddler || changedAttributes.field || changedAttributes.index || changedAttributes.tooltip || changedAttributes.tabindex || changedAttributes.disabled) { this.refreshSelf(); return true; } else { @@ -205,5 +206,3 @@ SelectWidget.prototype.refresh = function(changedTiddlers) { }; exports.select = SelectWidget; - -})(); diff --git a/core/modules/widgets/setmultiplevariables.js b/core/modules/widgets/setmultiplevariables.js index 41951953e..c2c3f65de 100644 --- a/core/modules/widgets/setmultiplevariables.js +++ b/core/modules/widgets/setmultiplevariables.js @@ -6,10 +6,7 @@ module-type: widget Widget to set multiple variables at once from a list of names and a list of values \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; var Widget = require("$:/core/modules/widgets/widget.js").widget; @@ -76,6 +73,3 @@ SetMultipleVariablesWidget.prototype.refresh = function(changedTiddlers) { }; exports["setmultiplevariables"] = SetMultipleVariablesWidget; - -})(); - \ No newline at end of file diff --git a/core/modules/widgets/setvariable.js b/core/modules/widgets/setvariable.js index f8e98f390..688268a8d 100755 --- a/core/modules/widgets/setvariable.js +++ b/core/modules/widgets/setvariable.js @@ -6,10 +6,7 @@ module-type: widget Set variable widget \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; var Widget = require("$:/core/modules/widgets/widget.js").widget; @@ -122,5 +119,3 @@ SetWidget.prototype.refresh = function(changedTiddlers) { exports.setvariable = SetWidget; exports.set = SetWidget; - -})(); diff --git a/core/modules/widgets/slot.js b/core/modules/widgets/slot.js index eeaaedefe..37c671c90 100644 --- a/core/modules/widgets/slot.js +++ b/core/modules/widgets/slot.js @@ -6,10 +6,7 @@ module-type: widget Widget for definition of slots within transcluded content. The values provided by the translusion are passed to the slot. \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; var Widget = require("$:/core/modules/widgets/widget.js").widget, @@ -78,5 +75,3 @@ SlotWidget.prototype.refresh = function(changedTiddlers) { }; exports.slot = SlotWidget; - -})(); diff --git a/core/modules/widgets/testcase.js b/core/modules/widgets/testcase.js index 0fd55531c..ccdce7ac5 100644 --- a/core/modules/widgets/testcase.js +++ b/core/modules/widgets/testcase.js @@ -6,10 +6,6 @@ module-type: widget Widget to display a test case \*/ -(function(){ - -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; var Widget = require("$:/core/modules/widgets/widget.js").widget; @@ -33,6 +29,7 @@ TestCaseWidget.prototype.render = function(parent,nextSibling) { this.execute(); // Create container DOM node var domNode = this.document.createElement("div"); + domNode.setAttribute("class", "tc-test-case " + this.testcaseClass); this.domNodes.push(domNode); parent.insertBefore(domNode,nextSibling); // Render the children into a hidden DOM node @@ -145,6 +142,7 @@ TestCaseWidget.prototype.execute = function() { this.testcaseTestActions = this.getAttribute("testActions"); this.testcaseTestExpectedResult = this.getAttribute("testExpectedResult"); this.testcaseHideIfPass = this.getAttribute("testHideIfPass"); + this.testcaseClass = this.getAttribute("class",""); }; /* @@ -161,5 +159,3 @@ TestCaseWidget.prototype.refresh = function(changedTiddlers) { }; exports["testcase"] = TestCaseWidget; - -})(); diff --git a/core/modules/widgets/text.js b/core/modules/widgets/text.js index 14f729114..a349b5550 100755 --- a/core/modules/widgets/text.js +++ b/core/modules/widgets/text.js @@ -6,10 +6,7 @@ module-type: widget Text node widget \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; var Widget = require("$:/core/modules/widgets/widget.js").widget; @@ -58,5 +55,3 @@ TextNodeWidget.prototype.refresh = function(changedTiddlers) { }; exports.text = TextNodeWidget; - -})(); diff --git a/core/modules/widgets/tiddler.js b/core/modules/widgets/tiddler.js index 0b70ff875..6c08aac4e 100755 --- a/core/modules/widgets/tiddler.js +++ b/core/modules/widgets/tiddler.js @@ -6,10 +6,7 @@ module-type: widget Tiddler widget \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; var Widget = require("$:/core/modules/widgets/widget.js").widget; @@ -97,5 +94,3 @@ TiddlerWidget.prototype.refresh = function(changedTiddlers) { }; exports.tiddler = TiddlerWidget; - -})(); diff --git a/core/modules/widgets/transclude.js b/core/modules/widgets/transclude.js index 35b4941bd..9bec28b07 100755 --- a/core/modules/widgets/transclude.js +++ b/core/modules/widgets/transclude.js @@ -6,10 +6,7 @@ module-type: widget Transclude widget \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; var Widget = require("$:/core/modules/widgets/widget.js").widget; @@ -101,6 +98,7 @@ TranscludeWidget.prototype.execute = function() { } this.sourceText = target.text; this.parserType = target.type; + this._canonical_uri = target._canonical_uri; // Set the legacy transclusion context variables only if we're not transcluding a variable if(!this.transcludeVariable) { var recursionMarker = this.makeRecursionMarker(); @@ -228,7 +226,8 @@ TranscludeWidget.prototype.getTransclusionTarget = function() { }); return { text: parserInfo.text, - type: parserInfo.type + type: parserInfo.type, + _canonical_uri: parserInfo._canonical_uri }; } }; @@ -455,8 +454,11 @@ TranscludeWidget.prototype.makeRecursionMarker = function() { TranscludeWidget.prototype.parserNeedsRefresh = function() { // Doesn't need to consider transcluded variables because a parent variable can't change once a widget has been created - var parserInfo = this.wiki.getTextReferenceParserInfo(this.transcludeTitle,this.transcludeField,this.transcludeIndex,{subTiddler:this.transcludeSubTiddler}); - return (this.sourceText === undefined || parserInfo.sourceText !== this.sourceText || parserInfo.parserType !== this.parserType) + var parserInfo = this.wiki.getTextReferenceParserInfo(this.transcludeTitle,this.transcludeField,this.transcludeIndex,{ + subTiddler: this.transcludeSubTiddler, + defaultType: this.transcludeType + }); + return (this.sourceText === undefined || parserInfo.sourceText !== this.sourceText || parserInfo.parserType !== this.parserType || parserInfo._canonical_uri !== this._canonical_uri); }; TranscludeWidget.prototype.functionNeedsRefresh = function() { @@ -480,5 +482,3 @@ TranscludeWidget.prototype.refresh = function(changedTiddlers) { }; exports.transclude = TranscludeWidget; - -})(); diff --git a/core/modules/widgets/vars.js b/core/modules/widgets/vars.js index 42c2b273d..97edab041 100644 --- a/core/modules/widgets/vars.js +++ b/core/modules/widgets/vars.js @@ -13,10 +13,7 @@ This widget allows multiple variables to be set in one go: ``` \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; var Widget = require("$:/core/modules/widgets/widget.js").widget; @@ -69,5 +66,3 @@ VarsWidget.prototype.refresh = function(changedTiddlers) { }; exports["vars"] = VarsWidget; - -})(); diff --git a/core/modules/widgets/view.js b/core/modules/widgets/view.js index 070836bff..e7c808645 100755 --- a/core/modules/widgets/view.js +++ b/core/modules/widgets/view.js @@ -6,10 +6,7 @@ module-type: widget View widget \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; var Widget = require("$:/core/modules/widgets/widget.js").widget; @@ -224,5 +221,3 @@ ViewWidget.prototype.refresh = function(changedTiddlers) { }; exports.view = ViewWidget; - -})(); diff --git a/core/modules/widgets/widget.js b/core/modules/widgets/widget.js index 14e90ba2d..b89df34b7 100755 --- a/core/modules/widgets/widget.js +++ b/core/modules/widgets/widget.js @@ -6,10 +6,7 @@ module-type: widget Widget base class \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; /* @@ -628,31 +625,53 @@ Widget.prototype.addEventListeners = function(listeners) { }; /* -Add an event listener +Add an event listener. + +Listener could return a boolean indicating whether to further propagation or not, default to `false`. */ Widget.prototype.addEventListener = function(type,handler) { - var self = this; - if(typeof handler === "string") { // The handler is a method name on this widget - this.eventListeners[type] = function(event) { - return self[handler].call(self,event); - }; - } else { // The handler is a function - this.eventListeners[type] = function(event) { - return handler.call(self,event); - }; + this.eventListeners[type] = this.eventListeners[type] || []; + if(this.eventListeners[type].indexOf(handler) === -1) { + this.eventListeners[type].push(handler); } }; /* -Dispatch an event to a widget. If the widget doesn't handle the event then it is also dispatched to the parent widget +Remove an event listener +*/ +Widget.prototype.removeEventListener = function(type,handler) { + if(!this.eventListeners[type]) return; + var index = this.eventListeners[type].indexOf(handler); + if(index !== -1) { + this.eventListeners[type].splice(index,1); + } +}; + +/* +Dispatch an event to a widget. + +If the widget doesn't handle the event then it is also dispatched to the parent widget */ Widget.prototype.dispatchEvent = function(event) { event.widget = event.widget || this; - // Dispatch the event if this widget handles it - var listener = this.eventListeners[event.type]; - if(listener) { - // Don't propagate the event if the listener returned false - if(!listener(event)) { + var listeners = this.eventListeners[event.type]; + if(listeners) { + var self = this; + var shouldPropagate = true; + $tw.utils.each(listeners,function(handler) { + var propagate; + if(typeof handler === "string") { + // If handler is a string, call it as a method on the widget + propagate = self[handler].call(self,event); + } else { + // Otherwise call the function handler directly + propagate = handler.call(self,event); + } + if(propagate === false) { + shouldPropagate = false; + } + }); + if(!shouldPropagate) { return false; } } @@ -846,5 +865,3 @@ Widget.evaluateVariable = function(widget,name,options) { }; exports.widget = Widget; - -})(); diff --git a/core/modules/widgets/wikify.js b/core/modules/widgets/wikify.js index 987c3ab8a..bdb154b1b 100644 --- a/core/modules/widgets/wikify.js +++ b/core/modules/widgets/wikify.js @@ -6,10 +6,7 @@ module-type: widget Widget to wikify text into a variable \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; var Widget = require("$:/core/modules/widgets/widget.js").widget; @@ -86,5 +83,3 @@ WikifyWidget.prototype.refresh = function(changedTiddlers) { }; exports.wikify = WikifyWidget; - -})(); diff --git a/core/modules/wiki-bulkops.js b/core/modules/wiki-bulkops.js index d730b3c2e..ca7ca4a97 100644 --- a/core/modules/wiki-bulkops.js +++ b/core/modules/wiki-bulkops.js @@ -6,10 +6,7 @@ module-type: wikimethod Bulk tiddler operations such as rename. \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; /* @@ -84,5 +81,3 @@ function relinkTiddler(fromTitle,toTitle,options) { exports.renameTiddler = renameTiddler; exports.relinkTiddler = relinkTiddler; - -})(); diff --git a/core/modules/wiki.js b/core/modules/wiki.js index 29a839c7a..878b34eb2 100755 --- a/core/modules/wiki.js +++ b/core/modules/wiki.js @@ -16,10 +16,7 @@ Adds the following properties to the wiki object: * `globalCache` is a hashmap by cache name of cache objects that are cleared whenever any tiddler change occurs \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; var widget = require("$:/core/modules/widgets/widget.js"); @@ -141,12 +138,15 @@ This method should be called after the changes it describes have been made to th title: Title of tiddler isDeleted: defaults to false (meaning the tiddler has been created or modified), true if the tiddler has been deleted + isShadow: defaults to false (meaning the change applies to the normal tiddler), + true if the tiddler being changed is a shadow tiddler */ -exports.enqueueTiddlerEvent = function(title,isDeleted) { +exports.enqueueTiddlerEvent = function(title,isDeleted,isShadow) { // Record the touch in the list of changed tiddlers this.changedTiddlers = this.changedTiddlers || Object.create(null); this.changedTiddlers[title] = this.changedTiddlers[title] || Object.create(null); this.changedTiddlers[title][isDeleted ? "deleted" : "modified"] = true; + this.changedTiddlers[title][isShadow ? "shadow" : "normal"] = true; // Increment the change count this.changeCount = this.changeCount || Object.create(null); if($tw.utils.hop(this.changeCount,title)) { @@ -1132,6 +1132,7 @@ exports.getTextReferenceParserInfo = function(title,field,index,options) { if(tiddler.fields.type) { parserInfo.parserType = tiddler.fields.type; } + parserInfo._canonical_uri = tiddler.fields._canonical_uri; } } else if(field) { if(field === "title") { @@ -1787,5 +1788,3 @@ exports.slugify = function(title,options) { } return slug; }; - -})(); diff --git a/core/palettes/FlexokiDark.tid b/core/palettes/FlexokiDark.tid index b8bb4570c..05e53edf5 100644 --- a/core/palettes/FlexokiDark.tid +++ b/core/palettes/FlexokiDark.tid @@ -65,11 +65,11 @@ flexoki-bl-2: <> flexoki-pu-2: <> flexoki-ma-2: <> -alert-background: <> -alert-border: <> +alert-background: <> +alert-border: <> alert-highlight: <> alert-muted-foreground: <> -background: #1C1B1A +background: #100F0F blockquote-bar: <> button-background: <> button-foreground: <> @@ -78,13 +78,13 @@ code-background: <> code-border: <> code-foreground: <> diff-delete-background: <> -diff-delete-foreground: <> +diff-delete-foreground: <> diff-equal-background: diff-equal-foreground: inherit diff-insert-background: <> -diff-insert-foreground: <> +diff-insert-foreground: <> diff-invisible-background: <> -diff-invisible-foreground: <> +diff-invisible-foreground: <> dirty-indicator: <> download-background: <> download-foreground: <> @@ -102,9 +102,9 @@ external-link-foreground-hover: inherit external-link-foreground-visited: <> external-link-foreground: <> footnote-target-background: <> -foreground: #B7B5AC -highlight-background: #ffff00 -highlight-foreground: #000000 +foreground: #CECDC3 +highlight-background: <> +highlight-foreground: inherit menubar-background: <> menubar-foreground: <> message-background: <> @@ -118,14 +118,14 @@ modal-footer-border: <> modal-header-border: <> muted-foreground: <> network-activity-foreground: <> -notification-background: <> -notification-border: <> +notification-background: <> +notification-border: <> page-background: <> -pre-background: <> +pre-background: <> pre-border: <> primary: <> -selection-background: #2b7b73 -selection-foreground: <> +selection-background: <> +selection-foreground: <> select-tag-background: <> select-tag-foreground: <> sidebar-button-foreground: <> @@ -135,11 +135,11 @@ sidebar-foreground-shadow: transparent sidebar-foreground: <> sidebar-muted-foreground-hover: <> sidebar-muted-foreground: <> -sidebar-tab-background-selected: <> +sidebar-tab-background-selected: <> sidebar-tab-background: <> sidebar-tab-border-selected: <> sidebar-tab-border: <> -sidebar-tab-divider: #e4e4e4 +sidebar-tab-divider: <> sidebar-tab-foreground-selected: sidebar-tab-foreground: <> sidebar-tiddler-link-foreground-hover: <> @@ -157,7 +157,7 @@ tab-border: <> tab-divider: <> tab-foreground-selected: <> tab-foreground: <> -table-border: <> +table-border: <> table-footer-background: <> table-header-background: <> tag-background: #D0A215 @@ -169,7 +169,7 @@ tiddler-background: <> tiddler-border: <> tiddler-controls-foreground-hover: <> tiddler-controls-foreground-selected: <> -tiddler-controls-foreground: <> +tiddler-controls-foreground: <> tiddler-editor-background: <> tiddler-editor-border-image: #ffffff tiddler-editor-border: <> @@ -188,25 +188,25 @@ toolbar-save-button: toolbar-info-button: toolbar-edit-button: toolbar-close-button: -toolbar-delete-button: +toolbar-delete-button: <> toolbar-cancel-button: toolbar-done-button: -untagged-background: #999999 +untagged-background: <> very-muted-foreground: <> -wikilist-background: #e5e5e5 -wikilist-item: #fff -wikilist-info: #000 -wikilist-title: #666 +wikilist-background: <> +wikilist-item: <> +wikilist-info: <> +wikilist-title: <> wikilist-title-svg: <> -wikilist-url: #aaa -wikilist-button-open: #4fb82b -wikilist-button-open-hover: green -wikilist-button-reveal: #5778d8 -wikilist-button-reveal-hover: blue -wikilist-button-remove: #d85778 -wikilist-button-remove-hover: red -wikilist-toolbar-background: #d3d3d3 -wikilist-toolbar-foreground: #888 -wikilist-droplink-dragover: rgba(255,192,192,0.5) -wikilist-button-background: #acacac -wikilist-button-foreground: #000 \ No newline at end of file +wikilist-url: <> +wikilist-button-open: <> +wikilist-button-open-hover: <> +wikilist-button-reveal: <> +wikilist-button-reveal-hover: <> +wikilist-button-remove: <> +wikilist-button-remove-hover: <> +wikilist-toolbar-background: <> +wikilist-toolbar-foreground: <> +wikilist-droplink-dragover: <> +wikilist-button-background: <> +wikilist-button-foreground: <> \ No newline at end of file diff --git a/core/palettes/FlexokiLight.tid b/core/palettes/FlexokiLight.tid index ba6862f66..c3c4d2f25 100644 --- a/core/palettes/FlexokiLight.tid +++ b/core/palettes/FlexokiLight.tid @@ -94,8 +94,8 @@ dragger-background: <> dragger-foreground: <> dropdown-background: <> dropdown-border: <> -dropdown-tab-background-selected: #fff -dropdown-tab-background: #ececec +dropdown-tab-background-selected: <> +dropdown-tab-background: <> dropzone-background: <> external-link-background-hover: inherit external-link-background-visited: inherit @@ -105,8 +105,8 @@ external-link-foreground-visited: <> external-link-foreground: <> footnote-target-background: <> foreground: #100F0F -highlight-background: #ffff00 -highlight-foreground: #000000 +highlight-background: <> +highlight-foreground: inherit menubar-background: <> menubar-foreground: <> message-background: <> @@ -114,26 +114,26 @@ message-border: <> message-foreground: <> modal-backdrop: <> modal-background: <> -modal-border: #999999 -modal-footer-background: #f5f5f5 -modal-footer-border: #dddddd -modal-header-border: #eeeeee +modal-border: <> +modal-footer-background: <> +modal-footer-border: <> +modal-header-border: <> muted-foreground: <> network-activity-foreground: <> notification-background: <> notification-border: <> page-background: <> -pre-background: <> +pre-background: <> pre-border: <> -primary: <> -selection-background: -selection-foreground: +primary: <> +selection-background: <> +selection-foreground: <> select-tag-background: <> select-tag-foreground: <> sidebar-button-foreground: <> sidebar-controls-foreground-hover: <> sidebar-controls-foreground: <> -sidebar-foreground-shadow: rgba(255,255,255, 0.8) +sidebar-foreground-shadow: transparent sidebar-foreground: <> sidebar-muted-foreground-hover: <> sidebar-muted-foreground: <> @@ -182,7 +182,7 @@ tiddler-info-border: <> tiddler-info-tab-background: <> tiddler-link-background: <> tiddler-link-foreground: <> -tiddler-subtitle-foreground: <> +tiddler-subtitle-foreground: <> tiddler-title-foreground: <> toolbar-new-button: toolbar-options-button: @@ -190,25 +190,25 @@ toolbar-save-button: toolbar-info-button: toolbar-edit-button: toolbar-close-button: -toolbar-delete-button: +toolbar-delete-button: <> toolbar-cancel-button: toolbar-done-button: -untagged-background: #999999 -very-muted-foreground: #888888 +untagged-background: <> +very-muted-foreground: <> wikilist-background: <> -wikilist-item: #fff -wikilist-info: #000 -wikilist-title: #666 +wikilist-item: <> +wikilist-info: <> +wikilist-title: <> wikilist-title-svg: <> -wikilist-url: #aaa -wikilist-button-open: #4fb82b -wikilist-button-open-hover: green -wikilist-button-reveal: #5778d8 -wikilist-button-reveal-hover: blue -wikilist-button-remove: #d85778 -wikilist-button-remove-hover: red -wikilist-toolbar-background: #d3d3d3 -wikilist-toolbar-foreground: #888 -wikilist-droplink-dragover: rgba(255,192,192,0.5) -wikilist-button-background: #acacac -wikilist-button-foreground: #000 +wikilist-url: <> +wikilist-button-open: <> +wikilist-button-open-hover: <> +wikilist-button-reveal: <> +wikilist-button-reveal-hover: <> +wikilist-button-remove: <> +wikilist-button-remove-hover: <> +wikilist-toolbar-background: <> +wikilist-toolbar-foreground: <> +wikilist-droplink-dragover: <> +wikilist-button-background: <> +wikilist-button-foreground: <> diff --git a/core/palettes/GruvBoxDark.tid b/core/palettes/GruvBoxDark.tid index e839fd7b4..16ac22d65 100644 --- a/core/palettes/GruvBoxDark.tid +++ b/core/palettes/GruvBoxDark.tid @@ -21,9 +21,9 @@ diff-delete-foreground: <> diff-equal-background: diff-equal-foreground: <> diff-insert-background: #b8bb26 -diff-insert-foreground: <> -diff-invisible-background: -diff-invisible-foreground: <> +diff-insert-foreground: <> +diff-invisible-background: #ffff97 +diff-invisible-foreground: #444347 dirty-indicator: #fb4934 download-background: #b8bb26 download-foreground: <> diff --git a/core/palettes/Nord.tid b/core/palettes/Nord.tid index 5f18dce3f..87e918927 100644 --- a/core/palettes/Nord.tid +++ b/core/palettes/Nord.tid @@ -21,8 +21,8 @@ diff-delete-foreground: <> diff-equal-background: diff-equal-foreground: <> diff-insert-background: #A3BE8C -diff-insert-foreground: <> -diff-invisible-background: +diff-insert-foreground: <> +diff-invisible-background: #f9f3b5 diff-invisible-foreground: <> dirty-indicator: #BF616A download-background: #A3BE8C diff --git a/core/palettes/SolarFlare.tid b/core/palettes/SolarFlare.tid index 9f394f10c..ff6ddcf1d 100644 --- a/core/palettes/SolarFlare.tid +++ b/core/palettes/SolarFlare.tid @@ -125,6 +125,14 @@ foreground: #657b83 tiddler-link-foreground: <> alert-border: #b99e2f +diff-delete-background: <> +diff-delete-foreground: <> +diff-equal-background: inherit +diff-equal-foreground: inherit +diff-insert-background: <> +diff-insert-foreground: <> +diff-invisible-background: <> +diff-invisible-foreground: <> dirty-indicator: #ff0000 dropzone-background: rgba(0,200,0,0.7) external-link-background-hover: inherit diff --git a/core/palettes/SolarizedDark.tid b/core/palettes/SolarizedDark.tid index 326f6a4fb..9338998e9 100644 --- a/core/palettes/SolarizedDark.tid +++ b/core/palettes/SolarizedDark.tid @@ -18,6 +18,14 @@ button-foreground: #93a1a1 code-background: #073642 code-border: #586e75 code-foreground: #93a1a1 +diff-delete-background: #dc322f +diff-delete-foreground: #eee8d5 +diff-equal-background: inherit +diff-equal-foreground: inherit +diff-insert-background: #859900 +diff-insert-foreground: #073642 +diff-invisible-background: #b58900 +diff-invisible-foreground: #eee8d5 dirty-indicator: #dc322f download-background: #859900 download-foreground: #073642 diff --git a/core/palettes/SolarizedLight.tid b/core/palettes/SolarizedLight.tid index 28ce1c7c2..c01ff8821 100644 --- a/core/palettes/SolarizedLight.tid +++ b/core/palettes/SolarizedLight.tid @@ -18,6 +18,14 @@ button-foreground: #586e75 code-background: #eee8d5 code-border: #93a1a1 code-foreground: #586e75 +diff-delete-background: #dc322f +diff-delete-foreground: #eee8d5 +diff-equal-background: inherit +diff-equal-foreground: inherit +diff-insert-background: #859900 +diff-insert-foreground: #eee8d5 +diff-invisible-background: #b58900 +diff-invisible-foreground: #eee8d5 dirty-indicator: #dc322f download-background: #859900 download-foreground: #eee8d5 diff --git a/core/palettes/Twilight.tid b/core/palettes/Twilight.tid index 1cd8efab1..d6b54673a 100644 --- a/core/palettes/Twilight.tid +++ b/core/palettes/Twilight.tid @@ -19,13 +19,13 @@ code-background: rgba(0,0,0,0.03) code-border: rgba(0,0,0,0.08) code-foreground: rgb(255, 94, 94) diff-delete-background: #ffc9c9 -diff-delete-foreground: <> +diff-delete-foreground: <> diff-equal-background: diff-equal-foreground: <> diff-insert-background: #aaefad -diff-insert-foreground: <> -diff-invisible-background: -diff-invisible-foreground: <> +diff-insert-foreground: <> +diff-invisible-background: #fdfcbd +diff-invisible-foreground: <> dirty-indicator: rgb(255, 94, 94) download-background: #19a974 download-foreground: rgb(38, 38, 38) diff --git a/core/templates/exporters/CsvFile.tid b/core/templates/exporters/CsvFile.tid index 23d3bbd73..724827d89 100644 --- a/core/templates/exporters/CsvFile.tid +++ b/core/templates/exporters/CsvFile.tid @@ -2,5 +2,6 @@ title: $:/core/templates/exporters/CsvFile tags: $:/tags/Exporter description: {{$:/language/Exporters/CsvFile}} extension: .csv +file-type: text/csv <$macrocall $name="csvtiddlers" filter=<> format="quoted-comma-sep" $output="text/raw"/> diff --git a/core/templates/exporters/JsonFile.tid b/core/templates/exporters/JsonFile.tid index 9008906cc..2ae5495c1 100644 --- a/core/templates/exporters/JsonFile.tid +++ b/core/templates/exporters/JsonFile.tid @@ -2,5 +2,6 @@ title: $:/core/templates/exporters/JsonFile tags: $:/tags/Exporter description: {{$:/language/Exporters/JsonFile}} extension: .json +file-type: application/json <$macrocall $name="jsontiddlers" filter=<> $output="text/raw"/> diff --git a/core/templates/exporters/TidFile.tid b/core/templates/exporters/TidFile.tid index 7b0bb2d78..94f9744a8 100644 --- a/core/templates/exporters/TidFile.tid +++ b/core/templates/exporters/TidFile.tid @@ -2,6 +2,7 @@ title: $:/core/templates/exporters/TidFile tags: $:/tags/Exporter description: {{$:/language/Exporters/TidFile}} extension: .tid +file-type: text/vnd.tiddlywiki condition: [compare:lte[1]] \define renderContent() diff --git a/core/ui/AdvancedSearch/Standard.tid b/core/ui/AdvancedSearch/Standard.tid index c85c8b9f2..ae80ced35 100644 --- a/core/ui/AdvancedSearch/Standard.tid +++ b/core/ui/AdvancedSearch/Standard.tid @@ -37,7 +37,7 @@ caption: {{$:/language/Search/Standard/Caption}} inputCancelActions=<> inputAcceptActions=<> inputAcceptVariantActions=<> - configTiddlerFilter="[[$:/state/search/currentTab]!is[missing]get[text]] :else[{$:/config/SearchResults/Default}]" + configTiddlerFilter="[[$:/state/advancedsearch/standard/currentTab]!is[missing]get[text]] :else[{$:/config/SearchResults/Default}]" filterMinLength={{$:/config/Search/MinLength}}/> diff --git a/core/ui/EditorToolbar/link-dropdown.tid b/core/ui/EditorToolbar/link-dropdown.tid index 2b75a32ce..68e41a17b 100644 --- a/core/ui/EditorToolbar/link-dropdown.tid +++ b/core/ui/EditorToolbar/link-dropdown.tid @@ -8,13 +8,8 @@ title: $:/core/ui/EditorToolbar/link-dropdown <$action-deletetiddler $filter="[] [] [] [] []"/> \end -\procedure prefix.bracket() [ -\procedure suffix.bracket() ] - -\function tf.get-focus-selector() [[data-tiddler-title=]addprefix[$(prefix.bracket)$]substitute[]addsuffixaddsuffix[$(suffix.bracket)$]substitute[]] .tc-create-wikitext-link input :and[join[ ]] - \procedure cancel-search-actions-inner() -<$set name="userInput" value={{{ [get[text]] }}}><$list filter="[get[text]!match]" emptyMessage="<$action-deletetiddler $filter='[] [] [] []'/>"><$action-setfield $tiddler=<> text=<>/><$action-setfield $tiddler=<> text="yes"/> +<$let userInput={{{ [get[text]] }}}><$list filter="[get[text]!match]" emptyMessage="<$action-deletetiddler $filter='[] [] [] []'/>"><$action-setfield $tiddler=<> text=<>/><$action-setfield $tiddler=<> text="yes"/> \end \procedure cancel-search-actions() <$list filter="[!has[text]] :and[!has[text]]" emptyMessage="<>"><$action-sendmessage $message="tm-edit-text-operation" $param="focus-editor"/> @@ -34,9 +29,9 @@ title: $:/core/ui/EditorToolbar/link-dropdown \whitespace trim ''<>'' -<$vars searchTiddler={{{ [addsuffix[/search]] }}} linkTiddler={{{ [addsuffix[/link]] }}} linktext="" searchListState=<> refreshTitle=<> storeTitle=<>> +<$let searchTiddler=`$(config-title)$/search` linkTiddler=`$(config-title)$/link` linktext="" searchListState=<> refreshTitle=<> storeTitle=<>> -<$vars linkTiddler=<>> +<$let linkTiddler=<>> <$keyboard key="((input-tab-right))" actions=<>> <$keyboard key="((input-tab-left))" actions=<> class="tc-create-wikitext-link"> <$transclude $variable="keyboard-driven-input" tiddler=<> storeTitle=<> @@ -51,28 +46,28 @@ title: $:/core/ui/EditorToolbar/link-dropdown <> <$button class="tc-btn-invisible tc-btn-mini" style="width: auto; display: inline-block; background-colour: inherit;"> -<><$set name="cssEscapedTitle" value={{{ [escapecss[]] }}}><$action-sendmessage $message="tm-focus-selector" $param=<>/> +<><$action-sendmessage $message="tm-focus-selector" $param=`[data-tiddler-title=${[escapecss[]]}$] .tc-create-wikitext-link input`/> {{$:/core/images/close-button}} - + <$reveal tag="div" state=<> type="nomatch" text=""> <$linkcatcher actions=<> to=<>> -<$vars userInput={{{ [get[text]] }}} configTiddler={{{ [[$:/state/search/currentTab]!is[missing]get[text]] :else[{$:/config/SearchResults/Default}] }}}> +<$let userInput={{{ [get[text]] }}} configTiddler={{{ [[$:/state/search/currentTab]!is[missing]get[text]] :else[{$:/config/SearchResults/Default}] }}}> {{$:/core/ui/SearchResults}} - + - + \end -<$transclude $variable="body" config-title=<>/> +<$transclude $variable="body" config-title=<>/> \ No newline at end of file diff --git a/core/ui/ExportTiddlyWikiCore.tid b/core/ui/ExportTiddlyWikiCore.tid index 4b913a020..af097b648 100644 --- a/core/ui/ExportTiddlyWikiCore.tid +++ b/core/ui/ExportTiddlyWikiCore.tid @@ -12,7 +12,7 @@ Export the TiddlyWiki core JavaScript code for running with external JavaScript: tooltip="Export the TiddlyWiki core code for running with external JavaScript" aria-label="export TiddlyWiki core" class="tc-btn-big-green"> -<$action-sendmessage $message='tm-download-file' $param='$:/core/templates/tiddlywiki5.js' filename=<>/> +<$action-sendmessage $message='tm-download-file' $param='$:/core/templates/tiddlywiki5.js' filename=<> type="application/javascript"/> {{$:/core/images/download-button}} Download TiddlyWiki core diff --git a/core/ui/PageControls/advanced-search.tid b/core/ui/PageControls/advanced-search.tid index 4aa49e6e5..4d13d16e3 100644 --- a/core/ui/PageControls/advanced-search.tid +++ b/core/ui/PageControls/advanced-search.tid @@ -5,6 +5,7 @@ description: {{$:/language/Buttons/AdvancedSearch/Hint}} \whitespace trim \procedure advanced-search-button(class) +\whitespace trim <$button to="$:/AdvancedSearch" tooltip={{$:/language/Buttons/AdvancedSearch/Hint}} aria-label={{$:/language/Buttons/AdvancedSearch/Caption}} class=`$(tv-config-toolbar-class)$ $(class)$`> <%if [match[yes]] %> {{$:/core/images/advanced-search-button}} diff --git a/core/ui/PageControls/controlpanel.tid b/core/ui/PageControls/controlpanel.tid index 8b9db8d9a..6413db21d 100644 --- a/core/ui/PageControls/controlpanel.tid +++ b/core/ui/PageControls/controlpanel.tid @@ -5,6 +5,7 @@ description: {{$:/language/Buttons/ControlPanel/Hint}} \whitespace trim \procedure control-panel-button(class) +\whitespace trim <$button to="$:/ControlPanel" tooltip={{$:/language/Buttons/ControlPanel/Hint}} aria-label={{$:/language/Buttons/ControlPanel/Caption}} class=`$(tv-config-toolbar-class)$ $(class)$`> <%if [match[yes]] %> {{$:/core/images/options-button}} diff --git a/core/ui/PageControls/export-tiddlywikicore.tid b/core/ui/PageControls/export-tiddlywikicore.tid index a6bb68c13..087ca6a36 100644 --- a/core/ui/PageControls/export-tiddlywikicore.tid +++ b/core/ui/PageControls/export-tiddlywikicore.tid @@ -12,7 +12,7 @@ element, and right-click its `src` URI. Save the link as ''$(jsFileName)$''

Export the ~TiddlyWiki core ~JavaScript code for running with external ~JavaScript: <$button tooltip="Export the ~TiddlyWiki core code for running with external ~JavaScript" aria-label="export TiddlyWiki core" class="tc-btn-big-green"> -<$list filter="[[$:/boot/boot.js]is[missing]]" variable="ignore" emptyMessage="""<$action-sendmessage $message="tm-download-file" $param="$:/core/templates/tiddlywiki5.js" filename=<>/>""" > +<$list filter="[[$:/boot/boot.js]is[missing]]" variable="ignore" emptyMessage="""<$action-sendmessage $message="tm-download-file" $param="$:/core/templates/tiddlywiki5.js" filename=<> type="application/javascript"/>""" > <$action-setfield $tiddler=<> text=<> subtitle="Export ~TiddllyWiki Core"/> <$action-sendmessage $message="tm-modal" $param=<>/> diff --git a/core/ui/PageControls/language.tid b/core/ui/PageControls/language.tid index 3315b5a23..085b3bfd9 100644 --- a/core/ui/PageControls/language.tid +++ b/core/ui/PageControls/language.tid @@ -7,11 +7,7 @@ description: {{$:/language/Buttons/Language/Hint}} <$button popup=<> tooltip={{$:/language/Buttons/Language/Hint}} aria-label={{$:/language/Buttons/Language/Caption}} class=<> selectedClass="tc-selected"> <%if [match[yes]] %> - - <$set name="languagePluginTitle" value={{$:/language}}> - <$image source=`$(languagePluginTitle)$/icon`/> - - +{{$:/core/images/language}} <%endif%> <%if [match[yes]] %> <$text text={{$:/language/Buttons/Language/Caption}}/> diff --git a/core/ui/PageControls/manager.tid b/core/ui/PageControls/manager.tid index 3cc364f80..1b966a214 100644 --- a/core/ui/PageControls/manager.tid +++ b/core/ui/PageControls/manager.tid @@ -5,6 +5,7 @@ description: {{$:/language/Buttons/Manager/Hint}} \whitespace trim \procedure manager-button(class) +\whitespace trim <$button to="$:/Manager" tooltip={{$:/language/Buttons/Manager/Hint}} aria-label={{$:/language/Buttons/Manager/Caption}} class=`$(tv-config-toolbar-class)$ $(class)$`> <%if [match[yes]] %> {{$:/core/images/list}} diff --git a/core/ui/PageControls/savewiki.tid b/core/ui/PageControls/savewiki.tid index 7e6a18ccc..1d833c35d 100644 --- a/core/ui/PageControls/savewiki.tid +++ b/core/ui/PageControls/savewiki.tid @@ -4,10 +4,17 @@ caption: {{$:/core/images/save-button-dynamic}} {{$:/language/Buttons/SaveWiki/C description: {{$:/language/Buttons/SaveWiki/Hint}} \whitespace trim -<$button tooltip={{$:/language/Buttons/SaveWiki/Hint}} aria-label={{$:/language/Buttons/SaveWiki/Caption}} class=<>> +\procedure saveActions() <$wikify name="site-title" text={{$:/config/SaveWikiButton/Filename}}> -<$action-sendmessage $message="tm-save-wiki" $param={{$:/config/SaveWikiButton/Template}} filename=<>/> + <$action-sendmessage $message="tm-save-wiki" $param={{$:/config/SaveWikiButton/Template}} filename=<>/> +\end + +<$button actions=<> + tooltip={{$:/language/Buttons/SaveWiki/Hint}} + aria-label={{$:/language/Buttons/SaveWiki/Caption}} + class=<> +> <%if [match[yes]] %> {{$:/core/images/save-button-dynamic}} diff --git a/core/ui/PageControls/tag-button.tid b/core/ui/PageControls/tag-button.tid index 6c04804ce..8b1a45226 100644 --- a/core/ui/PageControls/tag-button.tid +++ b/core/ui/PageControls/tag-button.tid @@ -5,6 +5,7 @@ description: {{$:/language/Buttons/TagManager/Hint}} \whitespace trim \procedure control-panel-button(class) +\whitespace trim <$button to="$:/TagManager" tooltip={{$:/language/Buttons/TagManager/Hint}} aria-label={{$:/language/Buttons/TagManager/Caption}} class=`$(tv-config-toolbar-class)$ $(class)$`> <%if [match[yes]] %> {{$:/core/images/tag-button}} diff --git a/core/ui/ViewTemplate/body/rendered-plain-text.tid b/core/ui/ViewTemplate/body/rendered-plain-text/css.tid similarity index 66% rename from core/ui/ViewTemplate/body/rendered-plain-text.tid rename to core/ui/ViewTemplate/body/rendered-plain-text/css.tid index d1dcc0f80..2e78bedcc 100644 --- a/core/ui/ViewTemplate/body/rendered-plain-text.tid +++ b/core/ui/ViewTemplate/body/rendered-plain-text/css.tid @@ -2,6 +2,7 @@ title: $:/core/ui/ViewTemplate/body/rendered-plain-text code-body: yes \whitespace trim +\parameters (language:"css") <$wikify name="text" text={{!!text}} type={{!!type}}> -<$codeblock code=<> language="css"/> +<$codeblock code=<> language=<>/> diff --git a/core/ui/ViewTemplate/body/rendered-plain-text/html.tid b/core/ui/ViewTemplate/body/rendered-plain-text/html.tid new file mode 100644 index 000000000..d0742afcc --- /dev/null +++ b/core/ui/ViewTemplate/body/rendered-plain-text/html.tid @@ -0,0 +1,4 @@ +title: $:/core/ui/ViewTemplate/body/rendered-plain-text/html +code-body: yes + +{{||$:/core/ui/ViewTemplate/body/rendered-plain-text|html}} \ No newline at end of file diff --git a/core/wiki/config/OfficialPluginLibrary.tid b/core/wiki/config/OfficialPluginLibrary.tid index fc11b6140..88fd39abe 100644 --- a/core/wiki/config/OfficialPluginLibrary.tid +++ b/core/wiki/config/OfficialPluginLibrary.tid @@ -1,6 +1,6 @@ title: $:/config/OfficialPluginLibrary tags: $:/tags/PluginLibrary -url: https://tiddlywiki.com/library/v5.3.6/index.html +url: https://tiddlywiki.com/library/v5.3.7/index.html caption: {{$:/language/OfficialPluginLibrary}} {{$:/language/OfficialPluginLibrary/Hint}} diff --git a/core/wiki/config/ViewTemplateBodyFilters.multids b/core/wiki/config/ViewTemplateBodyFilters.multids index 90c127a0c..8fdddd775 100644 --- a/core/wiki/config/ViewTemplateBodyFilters.multids +++ b/core/wiki/config/ViewTemplateBodyFilters.multids @@ -3,6 +3,7 @@ tags: $:/tags/ViewTemplateBodyFilter testcase: [tag[$:/tags/wiki-test-spec]type[text/vnd.tiddlywiki-multiple]] [tag[$:/tags/wiki-test-spec-failing]type[text/vnd.tiddlywiki-multiple]] :then[[$:/core/ui/TestCaseTemplate]] stylesheet: [tag[$:/tags/Stylesheet]then[$:/core/ui/ViewTemplate/body/rendered-plain-text]] +html: [tag[$:/tags/RawMarkupWikified]] [tag[$:/tags/RawMarkupWikified/TopHead]] [tag[$:/tags/RawMarkupWikified/TopBody]] [tag[$:/tags/RawMarkupWikified/BottomBody]] :then[[$:/core/ui/ViewTemplate/body/rendered-plain-text/html]] core-ui-tags: [tag[$:/tags/PageTemplate]] [tag[$:/tags/EditTemplate]] [tag[$:/tags/ViewTemplate]] [tag[$:/tags/KeyboardShortcut]] [tag[$:/tags/ImportPreview]] [tag[$:/tags/EditPreview]] [tag[$:/tags/EditorToolbar]] [tag[$:/EditorTools]] [tag[$:/tags/Actions]] [tag[$:/tags/ToolbarButtonStyle]] :then[[$:/core/ui/ViewTemplate/body/code]] system: [prefix[$:/boot/]] [prefix[$:/core/macros]] [prefix[$:/core/save/]] [prefix[$:/core/templates/]] [prefix[$:/config/]] [prefix[$:/core/config/]] [prefix[$:/info/]] [prefix[$:/language/]] [prefix[$:/languages/]] [prefix[$:/snippets/]] [prefix[$:/info/]] [prefix[$:/state/]] [prefix[$:/status/]] [prefix[$:/temp/]] :and[!is[image]] :then[[$:/core/ui/ViewTemplate/body/code]] code-body: [field:code-body[yes]then[$:/core/ui/ViewTemplate/body/code]] diff --git a/core/wiki/languageswitcher.tid b/core/wiki/languageswitcher.tid index 48422fca1..7d79c0f5c 100644 --- a/core/wiki/languageswitcher.tid +++ b/core/wiki/languageswitcher.tid @@ -1,25 +1,12 @@ title: $:/snippets/languageswitcher -\define flag-title() -$(languagePluginTitle)$/icon -\end \whitespace trim - <$linkcatcher to="$:/language">
<$list filter="[[$:/languages/en-GB]] [plugin-type[language]sort[description]]"> -<$set name="cls" filter="[all[current]field:title{$:/language}]" value="tc-chooser-item tc-chosen" emptyValue="tc-chooser-item">
>> +<$set name="cls" filter="[all[current]field:title{$:/language}]" value="tc-chooser-item tc-chosen" emptyValue="tc-chooser-item"> +
> lang={{!!name}}> <$link> - -<$set name="languagePluginTitle" value=<>> -<$transclude subtiddler=<>> -<$list filter="[all[current]field:title[$:/languages/en-GB]]"> -<$transclude tiddler="$:/languages/en-GB/icon"/> - - - - - <$view field="description"> <$view field="name"> <$view field="title"/> diff --git a/core/wiki/macros/colour-picker.tid b/core/wiki/macros/colour-picker.tid index 7a607a551..3c37dc9b5 100644 --- a/core/wiki/macros/colour-picker.tid +++ b/core/wiki/macros/colour-picker.tid @@ -1,58 +1,55 @@ title: $:/core/macros/colour-picker tags: $:/tags/Macro -\define colour-picker-update-recent() +\procedure colour-picker-update-recent() <$action-listops $tiddler="$:/config/ColourPicker/Recent" - $subfilter="$(colour-picker-value)$ [list[$:/config/ColourPicker/Recent]remove[$(colour-picker-value)$]] +[limit[8]]" + $subfilter="[] [list[$:/config/ColourPicker/Recent]remove] +[limit[8]]" /> \end -\define colour-picker-inner(actions) -<$button tag="a" tooltip="""$(colour-picker-value)$"""> -$(colour-picker-update-recent)$ -<$transclude $variable="__actions__"/> - - - +\procedure colour-picker-inner(actions) +<$button tag="a" tooltip=<>> +<> +<$transclude $variable="actions"/> +> style.width="100%" style.height="100%" style.borderRadius="50%"/> \end -\define colour-picker-recent-inner(actions) \whitespace trim -<$set name="colour-picker-value" value="$(recentColour)$"> -<$macrocall $name="colour-picker-inner" actions=<<__actions__>>/> +\procedure colour-picker-recent-inner(actions) +<$set name="colour-picker-value" value=<>> +<$transclude $variable="colour-picker-inner" actions=<>/> \end -\define colour-picker-recent(actions) -\whitespace trim +\procedure colour-picker-recent(actions) {{$:/language/ColourPicker/Recent}}<$list filter="[list[$:/config/ColourPicker/Recent]]" variable="recentColour"> -<$macrocall $name="colour-picker-recent-inner" actions=<<__actions__>>/> +<$transclude $variable="colour-picker-recent-inner" actions=<>/> \end -\define colour-picker(actions) -\whitespace trim +\procedure colour-picker(actions)
-<$macrocall $name="colour-picker-recent" actions=<<__actions__>>/> +<$transclude $variable="colour-picker-recent" actions=<>/> --- <$list filter="LightPink Pink Crimson LavenderBlush PaleVioletRed HotPink DeepPink MediumVioletRed Orchid Thistle Plum Violet Magenta Fuchsia DarkMagenta Purple MediumOrchid DarkViolet DarkOrchid Indigo BlueViolet MediumPurple MediumSlateBlue SlateBlue DarkSlateBlue Lavender GhostWhite Blue MediumBlue MidnightBlue DarkBlue Navy RoyalBlue CornflowerBlue LightSteelBlue LightSlateGrey SlateGrey DodgerBlue AliceBlue SteelBlue LightSkyBlue SkyBlue DeepSkyBlue LightBlue PowderBlue CadetBlue Azure LightCyan PaleTurquoise Cyan Aqua DarkTurquoise DarkSlateGrey DarkCyan Teal MediumTurquoise LightSeaGreen Turquoise Aquamarine MediumAquamarine MediumSpringGreen MintCream SpringGreen MediumSeaGreen SeaGreen Honeydew LightGreen PaleGreen DarkSeaGreen LimeGreen Lime ForestGreen Green DarkGreen Chartreuse LawnGreen GreenYellow DarkOliveGreen YellowGreen OliveDrab Beige LightGoldenrodYellow Ivory LightYellow Yellow Olive DarkKhaki LemonChiffon PaleGoldenrod Khaki Gold Cornsilk Goldenrod DarkGoldenrod FloralWhite OldLace Wheat Moccasin Orange PapayaWhip BlanchedAlmond NavajoWhite AntiqueWhite Tan BurlyWood Bisque DarkOrange Linen Peru PeachPuff SandyBrown Chocolate SaddleBrown Seashell Sienna LightSalmon Coral OrangeRed DarkSalmon Tomato MistyRose Salmon Snow LightCoral RosyBrown IndianRed Red Brown FireBrick DarkRed Maroon White WhiteSmoke Gainsboro LightGrey Silver DarkGrey Grey DimGrey Black" variable="colour-picker-value"> -<$macrocall $name="colour-picker-inner" actions=<<__actions__>>/> +<$transclude $variable="colour-picker-inner" actions=<>/> --- -<$edit-text tiddler="$:/config/ColourPicker/New" tag="input" default="" placeholder=""/> - +<$edit-text tiddler="$:/config/ColourPicker/New" tag="input" default="" placeholder="" class="tc-tiny-gap-right"/> <$edit-text tiddler="$:/config/ColourPicker/New" type="color" tag="input"/> <$set name="colour-picker-value" value={{$:/config/ColourPicker/New}}> -<$macrocall $name="colour-picker-inner" actions=<<__actions__>>/> +<%if [{$:/config/ColourPicker/New}!is[blank]] %> +<$transclude $variable="colour-picker-inner" actions=<>/> +<%endif%>
diff --git a/core/wiki/macros/copy-to-clipboard.tid b/core/wiki/macros/copy-to-clipboard.tid index d05d014e2..f299cf955 100644 --- a/core/wiki/macros/copy-to-clipboard.tid +++ b/core/wiki/macros/copy-to-clipboard.tid @@ -3,9 +3,11 @@ tags: $:/tags/Macro \whitespace trim -\procedure copy-to-clipboard(src,class:"tc-btn-invisible",style) -<$button message="tm-copy-to-clipboard" - param=<> +\procedure copy-to-clipboard(src,class:"tc-btn-invisible",style,type:"text/plain",plain) +\procedure copy-to-clipboard-actions() +<$action-sendmessage $message="tm-copy-to-clipboard" $param=<> type=<> plainText=<>/> +\end copy-to-clipboard-actions +<$button actions=<> class=<> style=< + +複数のクラス(それぞれ`.`のプレフィックス付き)は、開始の`@@`の直後にスペース` `を空けて記述します。これは、インラインコンテンツとブロックコンテンツの両方で機能します: + +<> + +<> + +複数のクラスとスタイルを同時に適用できます。インラインコンテンツの場合は、最初にスタイルを定義し、その後にクラスを定義する必要があります。 + +<> + +ブロックコンテンツの場合、スタイルとクラスは、インラインコンテンツの場合と同じように開始`@@`の後の1行で定義することも、それぞれ`@@`で始まる別々の行で定義することもできます: + +<> + +同様に、行の先頭の文字によって導入されるブロックWikiText要素に、スタイルではなくクラスを適用できます。プレフィックス`.`が付くクラスは、特殊文字の直後に記述され、その後にスペース` `が続きます。 + +<> \ No newline at end of file diff --git a/editions/ja-JP/tiddlers/workingwithtw/Audio.tid b/editions/ja-JP/tiddlers/workingwithtw/Audio.tid new file mode 100644 index 000000000..53c3e5416 --- /dev/null +++ b/editions/ja-JP/tiddlers/workingwithtw/Audio.tid @@ -0,0 +1,27 @@ +created: 20141018131647392 +modified: 20241110105324243 +original-modified: 20141019200654436 +tags: [[Working with TiddlyWiki]] Features +title: Audio +ja-title: オーディオ +type: text/vnd.tiddlywiki + +オーディオファイルは、[[画像|Images in WikiText]]と非常によく似た方法でTiddlyWikiに組み込むことができます。 + +! 埋め込みオーディオ + +小さなオーディオファイルは、TiddlyWiki内に直接埋め込むことができます。埋め込みは、TiddlyWikiファイルのサイズが大きくなるため、大きなファイル(数百キロバイト以上)には適していません。 + +たとえば、Tiddler[[TiddlyWiki.mp3]]には、"TiddlyWiki"という単語のMP3録音が含まれています。このTiddlerにアクセスすると、録音を再生するオーディオプレーヤーが表示されます。 + +オーディオファイルをトランスクルードすることもできます。例: + +<> + +! 外部オーディオ + +外部オーディオTiddlerは、''_canonical_uri''フィールドを使用して外部オーディオファイル/ストリームを指定し、''テキスト''フィールドをブロックします。これにより、サイズが大幅に削減されますが、再生は可能です。 + +たとえば、Tiddler[[Caruso - Ave Maria]]は、 http://archive.org でホストされているオンラインオーディオ録音を指しています: + +<> diff --git a/editions/ja-JP/tiddlers/workingwithtw/BrowserCompatibility.tid b/editions/ja-JP/tiddlers/workingwithtw/BrowserCompatibility.tid new file mode 100644 index 000000000..b4098cbb8 --- /dev/null +++ b/editions/ja-JP/tiddlers/workingwithtw/BrowserCompatibility.tid @@ -0,0 +1,14 @@ +title: BrowserCompatibility +ja-title: ブラウザの互換性 +tags: [[Working with TiddlyWiki]] + +TiddlyWikiは、HTML5互換ブラウザで動作するように設計されています + +次の表は、TiddlyWikiが動作することが知られているブラウザのバージョンをまとめたものです + +|!ブラウザ |!ステータス | +|Internet Explorer |Version 10以降 | +|Chrome |最近のすべてのバージョン | +|Firefox |最近のすべてのバージョン | +|Firefox for Android |最近のすべてのバージョン | +|Safari |Version 6以降 | diff --git a/editions/ja-JP/tiddlers/workingwithtw/Creating and editing tiddlers.tid b/editions/ja-JP/tiddlers/workingwithtw/Creating and editing tiddlers.tid new file mode 100644 index 000000000..684d2151d --- /dev/null +++ b/editions/ja-JP/tiddlers/workingwithtw/Creating and editing tiddlers.tid @@ -0,0 +1,37 @@ +created: 20140904140300000 +modified: 20241101121407637 +original-modified: 20160607153747195 +tags: [[Working with TiddlyWiki]] +title: Creating and editing tiddlers +ja-title: Tiddlerの作成と編集 +type: text/vnd.tiddlywiki + +! Tiddlerを作成する + +Tiddlerを作成するには、サイドバーの<<.icon $:/core/images/new-button>>ボタンをクリックするか、未作成Tiddlerへのリンクをクリックします。未作成Tiddlerへのリンクは、[[青い斜体|blue italics]]で表示されます。 + +参照: + +* [[日誌(Journal Tiddler)の作成|Creating journal tiddlers]] + +! Tiddlerを編集する + +既存のTiddlerを編集するには、Tiddlerの右上にある<<.icon $:/core/images/edit-button>>ボタンをクリックします。 + +!! ドラフトモード + +新しいTiddlerを作成したり、既存のTiddlerを編集したりすると、Tiddlerはドラフトモードになります。これにより、Tiddlerをさまざまな方法で修正するためのコントロールパネルが表示されます。コントロールパネルは、上から下までいくつかの部分で構成されています: + +*''タイトルフィールド'' - Tiddlerのタイトルを変更できます +*''タグセレクタ'' - タグを追加や削除できます。ボックスにタグ名を入力すると、一致する既存のタグがドロップダウンリストに表示されます。このリストから選択するか、まったく新しいタグを作成できます。次に、''追加''ボタンをクリックするか、Enterキーを押して、タグをTiddlerに追加します。各タグは、色付きのピルとして表示されます。ピルの"×"をクリックすると、そのタグが削除されます。 +*''テキストエリア'' - Tiddlerのメインコンテンツを編集できます。''プレビュー''ボタン (<<.icon $:/core/images/preview-closed>> / <<.icon $:/core/images/preview-open>>)をクリックすると、変更内容を確認できます。 +*''種類セレクタ'' - Tiddlerを画像などのように特別な方法で表示する必要がある場合に使用します。オプションのリストについては、ContentTypeを参照してください。デフォルトは`text/vnd.tiddlywiki`で、TiddlerにWikiTextが含まれていることを意味します。 +*''フィールドセレクタ'' - Tiddlerのフィールドを追加、削除できます。たとえば、他のTiddlerをタグ付けするために使用されているTiddlerを編集している場合は、[[''list''フィールド|ListField]]を追加して、それらのTiddlerがリストされる順序を変更できます。 + +! 確定、破棄、削除 + +編集が完了したら、Tiddlerの右上にあるボタンをクリックします: + +*''編集内容を確定します''ボタン(<<.icon $:/core/images/done-button>>)をクリックすると、このTiddlerへの変更が保存され、ドラフトモードが終了します。Wikiが[[自動保存|AutoSave]]に設定されている場合、変更は永続的に保存されます。設定されていない場合は、変更はWebブラウザに一時的に保存されているだけなので、サイドバーのマスター''Wikiを保存します''ボタン(<<.icon $:/core/images/save-button-dynamic>>)をクリックせずに~TiddlyWikiページを閉じると、変更は失われます。 +*''このTildderの変更を破棄します''ボタン(<<.icon $:/core/images/cancel-button>>)は、(確認を求めた後)、変更を破棄し、ドラフトモードを終了します。 +*''Tiddlerを削除します''ボタン(<<.icon $:/core/images/delete-button>>)は、削除ボタンは、Tiddlerを削除します(確認メッセージが表示された後)。 diff --git a/editions/ja-JP/tiddlers/workingwithtw/Creating journal tiddlers.tid b/editions/ja-JP/tiddlers/workingwithtw/Creating journal tiddlers.tid new file mode 100644 index 000000000..5a483641f --- /dev/null +++ b/editions/ja-JP/tiddlers/workingwithtw/Creating journal tiddlers.tid @@ -0,0 +1,42 @@ +created: 20141010093214683 +modified: 20241103101345607 +original-modified: 20181218180042029 +tags: [[Working with TiddlyWiki]] +title: Creating journal tiddlers +ja-title: 日誌(Journal Tiddler)の作成 +type: text/vnd.tiddlywiki + +! イントロダクション + +日誌(Journal Tiddler)は、タイトルとして日付や時刻を使用するTiddlerです。通常、タイムスタンプ付きの情報を素早く記録する手段として使用されます。 + +日誌(Journal Tiddler)で追加のタグを使用して他のTiddlerにリンクし、情報項目間の関係を確立することができます。 + +たとえば、''2014年10月10日''という日誌(Journal Tiddler)を使用して、その特定の日に捉えた考えや情報を記録できます。''ショッピング''と''ロンドン''のタグを使用して、ロンドンでのショッピングに関する記載であることを示すことができます。 + +! 日誌(Journal Tiddler)を作成する + +日誌(Journal Tiddler)を作成する最も簡単な方法は、サイドバーの''ツール''タブにある''新しい日誌''ボタン<<.icon $:/core/images/new-journal-button>>を使用することです。ボタンを頻繁に使用する場合は、ボタンの横にあるチェックボックスをクリックして、検索ボックスのすぐ上にボタンが表示されるようにします。 + +''新しい日誌''ボタンは、''Journal''タグと今日の日付から派生したタイトルを持つ空のTiddlerとして日誌エントリを作成します。そのタイトルの日誌(Journal Tiddler)がすでに存在する場合は、これが編集用に表示されます。 + +! タグ付き日誌(Journal Tiddler)を作成する + +一般的な一連のアクションは、今日の日誌エントリを作成(または再表示)し、別のTiddlerのタイトルでタグ付けすることです。これは、他のTiddlerのツールバーにある''タグ付き日誌の作成''ボタン<<.icon $:/core/images/new-journal-button>>で実施できます。このボタンは、TiddlerのInfoPanelの''ツール''タブで見つけられます。 + +たとえば、''Oxford Street''というTiddlerをレビューしていて、それがショッピング旅行の計画に関連していることに気付いたとします。''Oxford Street'' Tiddlerの''タグ付き日誌の作成''ボタンをクリックすると、 ''Oxford Street''でタグ付けされた日誌エントリが表示されます。 + +! 日誌(Journal Tiddler)のカスタマイズ + +新しい日誌エントリの作成方法を構成するには、[[コントロールパネルの|$:/ControlPanel]] <<.icon $:/core/images/options-button>>の''情報''の中の''基本''タブに訪ずれます。 + +* "日誌(Journal Tiddlers)のデフォルトのタイトル"は、これらのTiddlerに名前を付ける方法を[[日付のフォーマット文字列|DateFormat]]として指定します。 デフォルト設定`YYYY年MM月DD日(ddd)`では、新しいエントリのタイトルは"2014年10月10日(金)"という形式になります +* "日誌(Journal Tiddler)のタグ"は、新しい日誌エントリに自動的に付与されるタグを[[特定|Title List]]します。例: `Journal [[Summer vacation]]` + +ヒント: ''新しい日誌''をクリックするたびに別の日誌(Journal Tiddler)を作成したい場合(同じ日に何度も行う場合でも)、タイトル形式に時刻を含めることができます。日付形式として`YYYY年MM月DD日(ddd) 0hh:0mm:0ss`などを指定します。 + +もう1つの便利なトリックは、タイトルフォーマットのどこかに`<>`を含めることです。つまり、複数の異なるTiddlerで''タグ付き日誌の作成''をクリックすると、それらの各Tiddlerのタイトルが、結果として得られる日誌エントリの名前の一部になります。 + +! カスタムの新しい日誌(Journal Tiddler)ボタンを作成する + +独自のカスタム日誌ボタンを作成する方法については、[[カスタム日誌ボタンの作成|Making a custom journal button]] Tiddlerを参照してください \ No newline at end of file diff --git a/editions/ja-JP/tiddlers/workingwithtw/Formatting text in TiddlyWiki.tid b/editions/ja-JP/tiddlers/workingwithtw/Formatting text in TiddlyWiki.tid new file mode 100644 index 000000000..670021d10 --- /dev/null +++ b/editions/ja-JP/tiddlers/workingwithtw/Formatting text in TiddlyWiki.tid @@ -0,0 +1,59 @@ +created: 20140908131500000 +modified: 20241103115932893 +original-modified: 20140919214820549 +tags: [[Working with TiddlyWiki]] +title: Formatting text in TiddlyWiki +ja-title: TiddlyWikiでのテキストフォーマット +type: text/vnd.tiddlywiki + +Tiddlerのテキスト内では、WikiTextと呼ばれる特別なフォーマットを使用して、テキストの表示方法を制御できます。 + +WikiTextは、[[エディターツールバー|Editor toolbar]]を使用して入力することも、手動で入力することもできます。前者は便利ですが、WikiTextマークアップコードがわかっている場合は後者の方が速いです。 + +! 単純なフォーマット + +最も単純なものは、WikiTextでは、太字、斜体、リスト、表などの使い慣れたワードプロセッサ機能を使用できます。例: + +``` +The ''quick'' brown ~~flea~~ fox //jumps// over the `lazy` dog +``` + +… 次のように表示されます: + +The ''quick'' brown ~~flea~~ fox //jumps// over the `lazy` dog + +! Tiddlerとの連携 + +WikiTextでは、二重角括弧を使用するか、CamelCaseワードの自動リンクを利用して、Tiddlerにリンクすることができます: + +``` +This is a link to HelloThere, and one to [[History of TiddlyWiki]] +``` + +… 次のように表示されます: + +This is a link to HelloThere, and one to [[History of TiddlyWiki]] + +! マクロ + +マクロを使用すると、WikiTextの繰り返し断片をパッケージ化して、簡単に再利用できるようになります。 + +たとえば、一意の識別子から~YouTube動画のURLを生成するマクロの定義は次のとおりです: + +``` +\define youtube(video) +https://www.youtube.com/watch?v=$video$ +\end +``` + +この定義を適用すると、`<>`は、URL https://www.youtube.com/watch?v=1g66s7UbyuU を生成します + +! 高度なWikiText + +高度なWikiText機能を使用すると、自動リストやドロップダウンメニューなどのインタラクティブ機能を作成できます。実際、TiddlyWiki自体のユーザーインターフェイス全体がWikiTextで記述されているため、TiddlyWikiで見られるどの機能もすべて、独自のWikiで使用できます。 + +高度な機能の中には、複雑なコーディングを必要とするものもあります。TiddlyWikiには、タブ、目次、Tiddlerリストなど、一般的なユーザーインターフェイスタスクを簡素化する組み込みマクロがいくつか用意されています。 + +! 詳細 + +WikiTextの書き方の詳細については、[[WikiText]]を参照してください。 diff --git a/editions/ja-JP/tiddlers/workingwithtw/Navigating between open tiddlers.tid b/editions/ja-JP/tiddlers/workingwithtw/Navigating between open tiddlers.tid new file mode 100644 index 000000000..beec5c7b5 --- /dev/null +++ b/editions/ja-JP/tiddlers/workingwithtw/Navigating between open tiddlers.tid @@ -0,0 +1,22 @@ +created: 20140908092600000 +modified: 20241031112948060 +original-modified: 20160607145200048 +tags: [[Working with TiddlyWiki]] +title: Navigating between open tiddlers +ja-title: 表示中のTiddler間の移動 +type: text/vnd.tiddlywiki + +デフォルトの"クラシック"ストーリービューモードでは、表示中のTiddlerは"ストーリーリバー"と呼ばれる垂直の列に表示されます。ストーリーリバーをナビゲートする方法、つまり表示中のTiddler間を行ったり来たりする方法はいくつかあります。 + +* 最善の方法は、サイドバーの''表示中タブを使用''して、移動したい表示中Tiddlerをクリックすることです。 + +** ''表示中''タブには、表示されているすべてのTiddlerのリストが含まれています。リスト内の任意のTiddlerをクリックすると、そのTiddlerにジャンプできます。また、Tiddlerリンクの横にある"×"をクリックすると、そのTiddlerを閉じることができます。表示中のTiddlerリストの下部には、便利な<<.icon $:/core/images/close-all-button>> ''すべて閉じる''ボタンもあります。 + +* 別の方法は、右側のストーリーリバースクロールバーを使用して''ページを上下にスクロールする''ことです。 + +** ストーリーリバーとサイドバーの両方が表示画面より下に伸びている場合は、スクロールバーが//2つ//あることに注意してください。外側または右端のスクロールバーはストーリーリバーを制御します。内側のスクロールバーはサイドバーを制御します。 + +* 多くの新米ユーザーが試みる不格好な方法は、探しているTiddlerにたどり着くまで''Tiddlerを1つずつ閉じていく''ことです。 +** ストーリーリバーの一番上または中間にあるTiddlerを閉じると、その下にあるすべてのTiddlerがリバーを上って行きます。閉じたTiddlerのすぐ下のTiddlerが上にスライドして、その位置を占めます。 + +** 一番下のTiddlerを閉じると、そのTiddlerが閉じて、その上のTiddlerの下部が見えるようになります。 diff --git a/editions/ja-JP/tiddlers/workingwithtw/Performance.tid b/editions/ja-JP/tiddlers/workingwithtw/Performance.tid new file mode 100644 index 000000000..ed50687bf --- /dev/null +++ b/editions/ja-JP/tiddlers/workingwithtw/Performance.tid @@ -0,0 +1,35 @@ +created: 20150330155120127 +modified: 20241110110532672 +original-modified: 20191014091943444 +tags: [[Working with TiddlyWiki]] +title: Performance +ja-title: パフォーマンス +type: text/vnd.tiddlywiki + +TiddlyWikiは、スマートフォンからデスクトップコンピューターまで、モダンなデバイスを最大限に活用できるように設計されたデフォルト設定で出荷されています。古い、性能の低いデバイスで作業する必要がある場合や、大量のコンテンツを処理する必要がある場合は、パフォーマンスを向上させるために実行できる手順があります。 + +!! 使用法 + +* ''"最近の更新"タブは使用しないでください'' Tiddler の変更に応じて生成し更新するには計算に時間がかかります。 +* ''"Vanilla"テーマを使用します'' デフォルトの"Snow White"テーマには、影、透明度、ぼかしなどの視覚効果が含まれており、古いデバイスではレンダリングが遅くなる可能性があります +* ''大きなTiddlerは避けてください'' 大きなビットマップはTiddlyWikiのパフォーマンスを著しく低下させる可能性があります。たとえば、最近のスマートフォンで撮影した画像は5MB以上になることがよくあります。可能な限り、ExternalImagesを使用してください +* ''一度にたくさんのTiddlerを開かないでください'' 表示中のTiddlerすべては、ストアが変更されるたびに最新の状態に保つための処理が必要になります(たとえば、ドラフトのTiddlerに入力している間)。zoominストーリービューを使用すると、サイドバーの''表示中''タブに数十のTiddlerがリストされてしまうことがよくあります。<<.icon $:/core/images/close-all-button>> ''すべて閉じる''ボタンを使用して、表示中のすべてのTiddlerを定期的に閉じる習慣をつけましょう + +!! WikiText + +* ''組み込みのパフォーマンス計測を使用します'' [[パフォーマンス計測|Performance Instrumentation]]の結果を調査すると、パフォーマンスの問題を明らかにするのに役立ちます +* インデックス付きフィルター演算子を活用します。フィルター実行の開始時に次の構造を実行すると、他の方法よりも何倍も高速に実行されるように最適化されます: +** `[all[tiddlers]tag[x]...` +** `[all[shadows]tag[x]...` +** `[all[tiddlers+shadows]tag[x]...` +** `[all[shadows+tiddlers]tag[x]...` +** `[all[tiddlers]field:y[x]...` +** `[all[shadows]field:y[x]...` +** `[all[tiddlers+shadows]field:y[x]...` +** `[all[shadows+tiddlers]field:y[x]...` +** フィールドのインデックスは現在、128文字未満のフィールド値をインデックスするようにデフォルト設定されていることに注意してください。長い値も検索できますが、インデックスは構築されません +** また、演算子名がフィールド名である場合にも“field”演算子が使用されることに注意してください。つまり、たとえば、`[all[shadows+tiddlers]caption[x]...`は最適化されます。 +* RefreshMechanismの[[スロットル|RefreshThrottling]]機能を賢明に使用します +* ''個別のTiddlerをトランスクルードする方がマクロを多用するよりもパフォーマンスが高く''、状況によってはその差が大きくなる可能性があることに留意してください。各Tiddlerのパース結果はキャッシュされ、Tiddlerが変更されていない場合は次回再利用されます。マクロには同じテクニックを使用できず、マクロはグローバルではなくウィジェットツリーに対してローカルであるため、毎回再度パースする必要があります。 +** <<.from-version "5.1.23">> パラメータや変数(つまり、`$parameter$`または`$(variable)$`)を介してテキスト置換を実行''しない''マクロのパースツリーがキャッシュされるようになりました。 +* 可能であれば、変数の宣言や文字列の連結には、''WikifyWidgetではなく、フィルター付きのSetWidgetやVarsWidgetを使用して''ください。パースツリーやウィジェット ツリーをキャッシュする機会がないため、wikifyメカニズムのパフォーマンスは比較的低くなります。 diff --git a/editions/ja-JP/tiddlers/workingwithtw/Using links to navigate between tiddlers.tid b/editions/ja-JP/tiddlers/workingwithtw/Using links to navigate between tiddlers.tid new file mode 100644 index 000000000..4864d4059 --- /dev/null +++ b/editions/ja-JP/tiddlers/workingwithtw/Using links to navigate between tiddlers.tid @@ -0,0 +1,55 @@ +created: 20140908093600000 +modified: 20241031114951639 +original-modified: 20201129183020567 +tags: [[Working with TiddlyWiki]] +title: Using links to navigate between tiddlers +ja-title: リンクを使用してTiddler間を移動する +type: text/vnd.tiddlywiki + +リンク(通常は青いテキストで表示されます)を使用すると、あるTiddlerから別のTiddlerにナビゲートできます。任意のTiddlerへのリンクをクリックすると、そのTiddlerに移動します。Tiddlerが閉じている場合は表示されます。~TiddlyWikiの素晴らしい点は、Tiddlerへのリンクを可能な限りアクセスしやすくしていることです。リンクはどこにでもあります。~TiddlyWikiでTiddlerへのリンクを見つけることができる主な場所は次のとおりです: + +* Tiddlerが既に存在するかどうかに関係なく、Tiddlerの本文にTiddlerへの''リンクを作成''できます。Tiddler間のリンクを作成するさまざまな簡単な方法については、[[WikiTextでのリンク|Linking in WikiText]]を参照してください。 + +* あなたのTiddler内の各''タグピル''(このTiddlerのタイトルの下の''~TiddlyWikiの操作''タグピルなど)には、そのタグのTiddlerへのリンクと、そのタグを持つすべてのTiddlerのリストが含まれています。これにより、それらのTiddlerのいずれかに移動できます。 + +* 各Tiddlerの''情報パネル''では、関連するTiddlerのリストを含む4つのタブにアクセスできます: + +** ''参照''タブには、現在のTiddler//へ//リンクしているすべてのTiddlerが一覧表示されます。 + +** ''この名でタグ付''タブには、現在のTiddlerのタイトルでタグ付けされたすべてのTiddlerが一覧表示されます。 + +** ''一覧''タブには、現在のTiddlerの[[listフィールド|ListField]]に記載されているすべてのTiddler(または潜在的なTiddler)が一覧表示されます。 + +** ''被リスト''タブには、//それらの//listフィールドに現在のTiddlerティドラーを記載しているすべてのTiddlerがリストされます。 + +* ''サイドバー''のタブには、Tiddlerへのリンクのリストが多数含まれています: + +** ''表示中''タブには、現在開いている、つまりページ上のどこかに表示されているすべてのTiddlerが一覧表示されます。 + +** ''最近の更新''タブには、最近修正された順に、100件のTiddlerが表示されます。 + +** ''詳しく''タブには、8つの追加のTiddlerリストが表示されます: + +*** ''すべて''はアルファベット順にすべてのTiddlerをリストします。 + +*** ''タグ別''にはすべてのタグがリストされます。任意のタグのピルをクリックすると、そのタグが付けられたTiddlerのリストにアクセスできます。 + +*** ''未作成''には、まだ存在しないが、他のTiddlerからリンクされているTiddlerがリストされます。これは、作成する予定だったが、作成できなかったTiddlerを見つけるのに役立ちます。 + +*** ''下書き''には、現在下書きモードになっているTiddlerのリストが表示されます。~TiddlyWikiでは、Tiddlerの下書き編集中は別のTiddlerとして扱われるため、''Australia''というタイトルのTiddlerを編集している間は、 ''Australia'' and ''Draft of 'Australia'''という2つのTiddlerが存在することになります。下書きへの変更を保存して閉じると、その変更は''Australia''Tiddlerに適用されます。そのため、''下書き''タブは、編集を開始したが未完成の下書きを見つける手段としてご利用ください。 + +*** ''被参照なし''には、別のTiddlerから直接リンクされていないすべてのTiddlerが一覧表示されます。これは、どのTiddlerを他のTiddlerとより慎重に統合する必要があるかを示してくれるので、ファイルの編集に役立ちます。 + +*** ''種類別''には、画像や音声などの特別なコンテンツを含むTiddlerのリストが表示されます。 + +*** ''システム''は、すべてのSystemTiddlersを一覧表示します。 + +*** ''隠し''には、すべてのShadowTiddlersがリストされています。 + +* ''検索結果''は、検索ボックスに入力したテキストを含むTiddlerのリストです。 + +* 最後に、さまざまな方法で、Tiddlerの独自カスタムリストを作成できます: + +** [[フィルター|Filters]]をトランスクルージョンすることができます([[WikiText でのトランスクルージョン|Transclusion in WikiText]]を参照)。たとえば、`{{{ [tag[mountain]] }}}`をTiddler に追加すると、''mountain''タグが付けられたすべてのTiddlerのリストが挿入されます。 + +** ListWidgetを使用できます。これは、[[フィルター|Filters]]をトランスクルードするよりも複雑ですが、その代わりに、リストを希望どおりに設計し表示するための柔軟性が向上します。 diff --git a/editions/ja-JP/tiddlers/workingwithtw/Working with TiddlyWiki.tid b/editions/ja-JP/tiddlers/workingwithtw/Working with TiddlyWiki.tid new file mode 100644 index 000000000..c739c05a9 --- /dev/null +++ b/editions/ja-JP/tiddlers/workingwithtw/Working with TiddlyWiki.tid @@ -0,0 +1,13 @@ +created: 20140904101100000 +list: [[The First Rule of Using TiddlyWiki]] GettingStarted [[Getting Started Video]] Upgrading [[Navigating between open tiddlers]] [[Using links to navigate between tiddlers]] [[Searching in TiddlyWiki]] [[Creating and editing tiddlers]] [[Creating journal tiddlers]] Saving [[Formatting text in TiddlyWiki]] [[Structuring TiddlyWiki]] Tagging [[Images in WikiText]] KeyboardShortcuts Encryption +modified: 20241028110521720 +original-modified: 20140919191122898 +tags: TableOfContents +title: Working with TiddlyWiki +ja-title: TiddlyWikiの操作 +type: text/vnd.tiddlywiki + +TiddlyWikiを使い初めるのに役立つ情報: + +<> + diff --git a/editions/katexdemo/tiddlers/$__coreURL.tid b/editions/katexdemo/tiddlers/$__coreURL.tid new file mode 100644 index 000000000..99eff5356 --- /dev/null +++ b/editions/katexdemo/tiddlers/$__coreURL.tid @@ -0,0 +1,4 @@ +title: $:/coreURL +tags: $:/tags/Global + +\function coreURL() [[../../../tiddlywikicore-$(version)$.js]substitute[]] diff --git a/editions/katexdemo/tiddlywiki.info b/editions/katexdemo/tiddlywiki.info index bd07b3e28..40c84dfc6 100644 --- a/editions/katexdemo/tiddlywiki.info +++ b/editions/katexdemo/tiddlywiki.info @@ -16,6 +16,9 @@ "--render","$:/core/templates/static.template.html","static.html","text/plain", "--render","$:/core/templates/alltiddlers.template.html","alltiddlers.html","text/plain", "--render","[!is[system]]","[encodeuricomponent[]addprefix[static/]addsuffix[.html]]","text/plain","$:/core/templates/static.tiddler.html", - "--render","$:/core/templates/static.template.css","static/static.css","text/plain"] + "--render","$:/core/templates/static.template.css","static/static.css","text/plain"], + "external": [ + "--render","$:/core/save/all-external-js","katexdemo.html","text/plain" + ] } } diff --git a/editions/markdowndemo/tiddlers/$__coreURL.tid b/editions/markdowndemo/tiddlers/$__coreURL.tid new file mode 100644 index 000000000..99eff5356 --- /dev/null +++ b/editions/markdowndemo/tiddlers/$__coreURL.tid @@ -0,0 +1,4 @@ +title: $:/coreURL +tags: $:/tags/Global + +\function coreURL() [[../../../tiddlywikicore-$(version)$.js]substitute[]] diff --git a/editions/markdowndemo/tiddlers/DefaultMissingType.tid b/editions/markdowndemo/tiddlers/DefaultMissingType.tid new file mode 100644 index 000000000..2f725cd4c --- /dev/null +++ b/editions/markdowndemo/tiddlers/DefaultMissingType.tid @@ -0,0 +1,3 @@ +title: $:/config/DefaultMissingType + +text/markdown diff --git a/editions/markdowndemo/tiddlers/HelloThere.tid b/editions/markdowndemo/tiddlers/HelloThere.tid index c536d83ee..32e134299 100644 --- a/editions/markdowndemo/tiddlers/HelloThere.tid +++ b/editions/markdowndemo/tiddlers/HelloThere.tid @@ -6,4 +6,10 @@ This is a demo of TiddlyWiki5 incorporating a plugin for parsing tiddlers writte To add the plugin to your own TiddlyWiki5, just drag this link to the browser window: -[[$:/plugins/tiddlywiki/markdown]] \ No newline at end of file +[[$:/plugins/tiddlywiki/markdown]] + +! Overridden Defaults + +This demo overrides the default value for tiddlers created from missing tiddler +links so that Markdown is the default rather than WikiText. See +the [[$:/config/DefaultMissingType]] tiddler for the modification. diff --git a/editions/markdowndemo/tiddlywiki.info b/editions/markdowndemo/tiddlywiki.info index 575c1e416..bc025070d 100644 --- a/editions/markdowndemo/tiddlywiki.info +++ b/editions/markdowndemo/tiddlywiki.info @@ -13,6 +13,9 @@ ], "build": { "index": [ - "--rendertiddler","$:/core/save/all","markdowndemo.html","text/plain"] + "--rendertiddler","$:/core/save/all","markdowndemo.html","text/plain"], + "external": [ + "--render","$:/core/save/all-external-js","markdowndemo.html","text/plain" + ] } } diff --git a/editions/prerelease/tiddlers/Release 5.3.7.tid b/editions/prerelease/tiddlers/Release 5.3.7.tid new file mode 100644 index 000000000..1644c9300 --- /dev/null +++ b/editions/prerelease/tiddlers/Release 5.3.7.tid @@ -0,0 +1,98 @@ +caption: 5.3.7 +created: 20241115171024144 +modified: 20241115171024144 +tags: ReleaseNotes +title: Release 5.3.7 +type: text/vnd.tiddlywiki +description: Under development + +//[[See GitHub for detailed change history of this release|https://github.com/TiddlyWiki/TiddlyWiki5/compare/v5.3.6...master]]// + + +! Major Improvements + +! Translation improvements + +* French +* German +* Japanese + +! Plugin Improvements + + +! Widget Improvements + +* + +! Filter Improvements + +* + +! Usability Improvements + +* <<.link-badge-added "https://github.com/TiddlyWiki/TiddlyWiki5/pull/8783"> (and <<.link-badge-here "https://github.com/TiddlyWiki/TiddlyWiki5/commit/028c80782d105beb90f5d58a7f22e865c7e8c6f4">>) [[Hidden Setting: Default Type for Missing Tiddlers]] +* <<.link-badge-added "https://github.com/TiddlyWiki/TiddlyWiki5/pull/8661">> DiffTextWidget colours to several core palettes +* <<.link-badge-improved "https://github.com/TiddlyWiki/TiddlyWiki5/pull/8807">> (and <<.link-badge-here "https://github.com/TiddlyWiki/TiddlyWiki5/pull/8911">>) Flexoki palette with additional colours +* <<.link-badge-fixed "https://github.com/TiddlyWiki/TiddlyWiki5/pull/8837">> [[incorrect|https://localizejs.com/articles/why-using-flag-icons-can-confuse-your-users/]] use of national flags to represent languages + +! Hackability Improvements + +* <<.link-badge-updated "https://github.com/TiddlyWiki/TiddlyWiki5/pull/8768">> several macros such as [[colour-picker Macro]], [[dumpvariables Macro]], [[image-picker Macro]], [[translink Macro]], [[tree Macro]] and [[list-links-draggable Macro]] to use the newer syntax +* <<.link-badge-extended "https://github.com/TiddlyWiki/TiddlyWiki5/pull/8780">> rendered plain text template to support more languages +* <<.link-badge-extended "https://github.com/TiddlyWiki/TiddlyWiki5/pull/8816">> 'disabled' attribute to SelectWidget and BrowseWidget +* <<.link-badge-extended "https://github.com/TiddlyWiki/TiddlyWiki5/pull/8819">> 'tabindex' attribute to BrowseWidget, RangeWidget, CheckboxWidget and RadioWidget +* <<.link-badge-updated "https://github.com/TiddlyWiki/TiddlyWiki5/pull/8821">> the editor link dropdown to use newer syntax +* <<.link-badge-added "https://github.com/TiddlyWiki/TiddlyWiki5/pull/8911">> support for images in AVIF format +* <<.link-badge-added "https://github.com/TiddlyWiki/TiddlyWiki5/pull/8912">> support for custom MIME types to the [[WidgetMessage: tm-copy-to-clipboard]] + +! Bug Fixes + +* <<.link-badge-fixed "https://github.com/TiddlyWiki/TiddlyWiki5/pull/8800">> problem with overwriting shadow tiddlers from plugins that do not have a `plugin-priority` field +* <<.link-badge-fixed "https://github.com/TiddlyWiki/TiddlyWiki5/pull/8831">> (and <<.link-badge-here "https://github.com/TiddlyWiki/TiddlyWiki5/pull/8835">>) problem with switching language not correctly updating the `lang` attribute of the root `` element +* <<.link-badge-fixed "https://github.com/TiddlyWiki/TiddlyWiki5/issues/8842">> bug with refreshing ExternalImages with a `_canonical_uri` field +* <<.link-badge-fixed "https://github.com/TiddlyWiki/TiddlyWiki5/pull/8882">> [[unusedtitle Macro]] to trim whitespace from the generated title +* <<.link-badge-fixed "https://github.com/TiddlyWiki/TiddlyWiki5/pull/8898">> file extensions and MIME types for font files +* <<.link-badge-fixed "https://github.com/TiddlyWiki/TiddlyWiki5/pull/8903">> bug where the wiki would be marked as dirty when a shadow tiddler is changed +* <<.link-badge-fixed "https://github.com/TiddlyWiki/TiddlyWiki5/pull/8895">> unnecessary refresh with GenesisWidget +* <<.link-badge-fixed "https://github.com/TiddlyWiki/TiddlyWiki5/commit/d4bc3fcd998902c17cd6bcefdc8d380e5c224458">> [[WidgetMessage: tm-http-request]] to pass custom variables to the progress actions +* <<.link-badge-fixed "https://github.com/TiddlyWiki/TiddlyWiki5/pull/8930">> FillWidget to no longer display its content +* <<.link-badge-fixed "https://github.com/TiddlyWiki/TiddlyWiki5/issues/8921">> inconsistent whitespace in page toolbar "More" dropdown +* <<.link-badge-fixed "https://github.com/TiddlyWiki/TiddlyWiki5/pull/8931">> RSOD with [[contains Operator]] if created field is accessed +* <<.link-badge-fixed "https://github.com/TiddlyWiki/TiddlyWiki5/issues/8881">> incorrect .html file extension of exported tiddlers on Android +* <<.link-badge-fixed "https://github.com/TiddlyWiki/TiddlyWiki5/pull/8951">> Arabic text using sans-serif font by adding "system-ui" to default font family +* <<.link-badge-fixed "https://github.com/TiddlyWiki/TiddlyWiki5/issues/8955">> refresh problem with "save" button +* <<.link-badge-fixed "https://github.com/TiddlyWiki/TiddlyWiki5/pull/8721">> [[list-tagged-draggable Macro]] to use the "caption" field if available +* <<.link-badge-fixed "https://github.com/TiddlyWiki/TiddlyWiki5/pull/8959">> problem with missing expandable arrow in [[toc-selective-expandable|Table-of-Contents Macros]] +* <<.link-badge-fixed "https://github.com/TiddlyWiki/TiddlyWiki5/issues/5930">> the default value does not working for the CheckboxWidget if it is bound to an index in a data tiddler +* <<.link-badge-fixed "https://github.com/TiddlyWiki/TiddlyWiki5/issues/8970">> [[median Operator]] to order values as numbers, not strings + +! Node.js Improvements + +* <<.link-badge-fixed "https://github.com/TiddlyWiki/TiddlyWiki5/pull/8789">> incorrect redirect when combining a custom [[path-prefix|WebServer Parameter: path-prefix]] with manual HTTP Basic Authentication via the [[/login-basic|WebServer API: Force Basic Authentication Login]] endpoint + +! Developer Improvements + +* + +! Acknowledgements + +[[@Jermolene|https://github.com/Jermolene]] would like to thank the contributors to this release who have generously given their time to help improve TiddlyWiki: + +<<.contributors """ +DesignThinkerer +flibbles +galenhuntington +IchijikuIchigo +jeremyredhead +jrbntt +jryans +Leilei332 +linonetwo +michaeljmcd +opn +pmario +Rhys-T +saqimtiaz +well-noted +xcazin +""">> diff --git a/editions/prerelease/tiddlers/system/PrereleaseLocalPluginLibrary.tid b/editions/prerelease/tiddlers/system/PrereleaseLocalPluginLibrary.tid index 9c7a90f45..0ad81e302 100644 --- a/editions/prerelease/tiddlers/system/PrereleaseLocalPluginLibrary.tid +++ b/editions/prerelease/tiddlers/system/PrereleaseLocalPluginLibrary.tid @@ -1,6 +1,6 @@ title: $:/config/LocalPluginLibrary tags: $:/tags/PluginLibrary -url: http://127.0.0.1:8080/prerelease/library/v5.3.6/index.html +url: http://127.0.0.1:8080/prerelease/library/v5.3.7/index.html caption: {{$:/language/OfficialPluginLibrary}} (Prerelease Local) A locally installed version of the official ~TiddlyWiki plugin library at tiddlywiki.com for testing and debugging. //Requires a local web server to share the library// diff --git a/editions/prerelease/tiddlers/system/PrereleaseOfficialPluginLibrary.tid b/editions/prerelease/tiddlers/system/PrereleaseOfficialPluginLibrary.tid index 149770f59..2162c3b4b 100644 --- a/editions/prerelease/tiddlers/system/PrereleaseOfficialPluginLibrary.tid +++ b/editions/prerelease/tiddlers/system/PrereleaseOfficialPluginLibrary.tid @@ -1,6 +1,6 @@ title: $:/config/OfficialPluginLibrary tags: $:/tags/PluginLibrary -url: https://tiddlywiki.com/prerelease/library/v5.3.6/index.html +url: https://tiddlywiki.com/prerelease/library/v5.3.7/index.html caption: {{$:/language/OfficialPluginLibrary}} (Prerelease) The prerelease version of the official ~TiddlyWiki plugin library at tiddlywiki.com. Plugins, themes and language packs are maintained by the core team. diff --git a/editions/prerelease/tiddlers/system/SiteDomain.tid b/editions/prerelease/tiddlers/system/SiteDomain.tid new file mode 100644 index 000000000..fee678ff7 --- /dev/null +++ b/editions/prerelease/tiddlers/system/SiteDomain.tid @@ -0,0 +1,3 @@ +title: $:/SiteDomain + +tiddlywiki.com \ No newline at end of file diff --git a/editions/prerelease/tiddlers/system/SitePreviewUrl.tid b/editions/prerelease/tiddlers/system/SitePreviewUrl.tid new file mode 100644 index 000000000..0111c059f --- /dev/null +++ b/editions/prerelease/tiddlers/system/SitePreviewUrl.tid @@ -0,0 +1,3 @@ +title: $:/SitePreviewUrl + +https://tiddlywiki.com/prerelease/images/Introduction%2520Video%2520Thumbnail.jpg \ No newline at end of file diff --git a/editions/prerelease/tiddlers/system/SiteUrl.tid b/editions/prerelease/tiddlers/system/SiteUrl.tid new file mode 100644 index 000000000..f3473a390 --- /dev/null +++ b/editions/prerelease/tiddlers/system/SiteUrl.tid @@ -0,0 +1,3 @@ +title: $:/SiteUrl + +https://tiddlywiki.com/prerelease/ \ No newline at end of file diff --git a/editions/prerelease/tiddlers/system/styles.tid b/editions/prerelease/tiddlers/system/styles.tid index 2f63c5a48..33424e4ae 100644 --- a/editions/prerelease/tiddlers/system/styles.tid +++ b/editions/prerelease/tiddlers/system/styles.tid @@ -4,14 +4,3 @@ type: text/vnd.tiddlywiki \rules only filteredtranscludeinline transcludeinline macrodef macrocallinline macrocallblock -.tc-scary-warning { - font-weight: bold; - padding: 0 1em; - margin-left: -1em; - margin-right: -1em; - color: #f22; - border-radius: 4px; - border: 3px solid transparent; - background: #ffd; - background: linear-gradient(#ffd, #ffd) padding-box, repeating-linear-gradient(-45deg, red 0, red 25%, transparent 0, transparent 50%) 0 / .6em .6em; -} \ No newline at end of file diff --git a/editions/test/tiddlers/tests/data/data-widget/ImportCompound.tid b/editions/test/tiddlers/tests/data/data-widget/ImportCompound.tid index 60fd08697..dc60b1566 100644 --- a/editions/test/tiddlers/tests/data/data-widget/ImportCompound.tid +++ b/editions/test/tiddlers/tests/data/data-widget/ImportCompound.tid @@ -24,4 +24,4 @@ This is a payload tiddler from a compound tiddler + title: ExpectedResult -

[{"title":"Payload Tiddler","tags":"Alpha Beta Gamma","text":"This is a payload tiddler from a compound tiddler","custom":"Alpha"}]

\ No newline at end of file +

[{"title":"Payload Tiddler","tags":"Alpha Beta Gamma","text":"This is a payload tiddler from a compound tiddler","custom":"Alpha"}]

\ No newline at end of file diff --git a/editions/test/tiddlers/tests/data/data-widget/ImportCustomTitle.tid b/editions/test/tiddlers/tests/data/data-widget/ImportCustomTitle.tid index 34029ae32..91fbde644 100644 --- a/editions/test/tiddlers/tests/data/data-widget/ImportCustomTitle.tid +++ b/editions/test/tiddlers/tests/data/data-widget/ImportCustomTitle.tid @@ -20,4 +20,4 @@ This is the tiddler HelloThere + title: ExpectedResult -

[{"title":"RealTitle","tags":"Definitions","text":"This is the tiddler HelloThere"}]

\ No newline at end of file +

[{"title":"RealTitle","tags":"Definitions","text":"This is the tiddler HelloThere"}]

\ No newline at end of file diff --git a/editions/test/tiddlers/tests/data/data-widget/ImportFilter.tid b/editions/test/tiddlers/tests/data/data-widget/ImportFilter.tid index 2fce27b71..7beca9aba 100644 --- a/editions/test/tiddlers/tests/data/data-widget/ImportFilter.tid +++ b/editions/test/tiddlers/tests/data/data-widget/ImportFilter.tid @@ -25,4 +25,4 @@ This is the tiddler AnotherDefinition + title: ExpectedResult -

[{"title":"AnotherDefinition","tags":"Definitions","text":"This is the tiddler AnotherDefinition","custom":"Alpha"},{"title":"HelloThere","tags":"Definitions","text":"This is the tiddler HelloThere","custom":"Alpha"}]

\ No newline at end of file +

[{"title":"AnotherDefinition","tags":"Definitions","text":"This is the tiddler AnotherDefinition","custom":"Alpha"},{"title":"HelloThere","tags":"Definitions","text":"This is the tiddler HelloThere","custom":"Alpha"}]

\ No newline at end of file diff --git a/editions/test/tiddlers/tests/data/data-widget/ImportTiddler.tid b/editions/test/tiddlers/tests/data/data-widget/ImportTiddler.tid index 1c2018c5b..dd8c57243 100644 --- a/editions/test/tiddlers/tests/data/data-widget/ImportTiddler.tid +++ b/editions/test/tiddlers/tests/data/data-widget/ImportTiddler.tid @@ -20,4 +20,4 @@ This is the tiddler HelloThere + title: ExpectedResult -

[{"title":"HelloThere","tags":"Definitions","text":"This is the tiddler HelloThere","custom":"Alpha"}]

\ No newline at end of file +

[{"title":"HelloThere","tags":"Definitions","text":"This is the tiddler HelloThere","custom":"Alpha"}]

\ No newline at end of file diff --git a/editions/test/tiddlers/tests/data/data-widget/Simple.tid b/editions/test/tiddlers/tests/data/data-widget/Simple.tid index 25be3d46a..badb28d27 100644 --- a/editions/test/tiddlers/tests/data/data-widget/Simple.tid +++ b/editions/test/tiddlers/tests/data/data-widget/Simple.tid @@ -9,10 +9,10 @@ text: Standalone data widget to create individual tiddlers title: Output \whitespace trim -<$testcase template="$:/core/ui/testcases/RawJSONTemplate"> +<$testcase template="$:/core/ui/testcases/RawJSONTemplate" class="my-class an-other-class"> <$data title="Epsilon" text="Theta"/> + title: ExpectedResult -

[{"title":"Epsilon","text":"Theta"}]

\ No newline at end of file +

[{"title":"Epsilon","text":"Theta"}]

\ No newline at end of file diff --git a/editions/test/tiddlers/tests/data/transclude/CustomWidget-RawAndSlotted.tid b/editions/test/tiddlers/tests/data/transclude/CustomWidget-RawAndSlotted.tid new file mode 100644 index 000000000..a8e6feb68 --- /dev/null +++ b/editions/test/tiddlers/tests/data/transclude/CustomWidget-RawAndSlotted.tid @@ -0,0 +1,34 @@ +title: Transclude/CustomWidget/RawAndSlotted +description: Custom widget can mix ts-raw and custom slots +type: text/vnd.tiddlywiki-multiple +tags: [[$:/tags/wiki-test-spec]] + +title: Output + +\whitespace trim +\widget $my.widget() +\whitespace trim +<$slot $name="ts-header"> + Default Header + +- +<$slot $name="ts-raw"/> +\end +<$my.widget> + First Body + + + +<$my.widget> + <$fill $name="ts-header"> + Custom Header + + <$fill $name="ts-never"> + <$log RawAndSlotted="Transclude/CustomWidget/RawAndSlotted is actually failing. $fill slots are executing silently when they weren't invoked." /> + + Second Body + ++ +title: ExpectedResult + +

Default Header-First Body

Custom Header-Second Body

\ No newline at end of file diff --git a/editions/test/tiddlers/tests/modules/utils/test-csv.js b/editions/test/tiddlers/tests/modules/utils/test-csv.js index b53e9b289..3556235ec 100644 --- a/editions/test/tiddlers/tests/modules/utils/test-csv.js +++ b/editions/test/tiddlers/tests/modules/utils/test-csv.js @@ -6,9 +6,6 @@ tags: [[$:/tags/test-spec]] Tests the backlinks mechanism. \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; describe('CSV Parsing', function() { @@ -29,5 +26,3 @@ describe('CSV Parsing', function() { }) }); - -})(); diff --git a/editions/test/tiddlers/tests/test-action-deletefield.js b/editions/test/tiddlers/tests/test-action-deletefield.js index 876f44d8e..f87eeda01 100644 --- a/editions/test/tiddlers/tests/test-action-deletefield.js +++ b/editions/test/tiddlers/tests/test-action-deletefield.js @@ -6,12 +6,6 @@ tags: [[$:/tags/test-spec]] Tests <$action-deletefield />. \*/ -(function(){ - -/* jslint node: true, browser: true */ -/* eslint-env node, browser, jasmine */ -/* eslint no-mixed-spaces-and-tabs: ["error", "smart-tabs"]*/ -/* global $tw, require */ "use strict"; describe("<$action-deletefield /> tests", function() { @@ -172,5 +166,3 @@ it("should correctly delete fields", function() { }); }); - -})(); diff --git a/editions/test/tiddlers/tests/test-action-widgets.js b/editions/test/tiddlers/tests/test-action-widgets.js index 9d706e1a3..f8a7ddea0 100644 --- a/editions/test/tiddlers/tests/test-action-widgets.js +++ b/editions/test/tiddlers/tests/test-action-widgets.js @@ -6,7 +6,7 @@ tags: [[$:/tags/test-spec]] Tests the action widgets. \*/ -(function(){ + /* jslint node: true, browser: true */ /* eslint-env node, browser, jasmine */ @@ -94,5 +94,3 @@ it("should handle the action-listops widget", function() { }); -})(); - diff --git a/editions/test/tiddlers/tests/test-backlinks.js b/editions/test/tiddlers/tests/test-backlinks.js index ea7c2b7b4..c02f9b1c7 100644 --- a/editions/test/tiddlers/tests/test-backlinks.js +++ b/editions/test/tiddlers/tests/test-backlinks.js @@ -6,9 +6,6 @@ tags: [[$:/tags/test-spec]] Tests the backlinks mechanism. \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; describe('Backlinks tests', function() { @@ -141,5 +138,3 @@ describe('Backlinks tests', function() { }); }); }); - -})(); diff --git a/editions/test/tiddlers/tests/test-backtranscludes.js b/editions/test/tiddlers/tests/test-backtranscludes.js index afc09af4e..52f08d970 100644 --- a/editions/test/tiddlers/tests/test-backtranscludes.js +++ b/editions/test/tiddlers/tests/test-backtranscludes.js @@ -6,9 +6,6 @@ tags: $:/tags/test-spec Tests the backtranscludes mechanism. \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; describe('Backtranscludes and transclude filter tests', function() { @@ -253,5 +250,3 @@ describe('Backtranscludes and transclude filter tests', function() { }); }); }); - -})(); diff --git a/editions/test/tiddlers/tests/test-checkbox-widget.js b/editions/test/tiddlers/tests/test-checkbox-widget.js index f42a269a9..83ed66421 100644 --- a/editions/test/tiddlers/tests/test-checkbox-widget.js +++ b/editions/test/tiddlers/tests/test-checkbox-widget.js @@ -6,7 +6,7 @@ tags: [[$:/tags/test-spec]] Tests the checkbox widget thoroughly. \*/ -(function(){ + /*jslint node: true, browser: true */ /*global $tw: false */ @@ -78,6 +78,13 @@ Tests the checkbox widget thoroughly. startsOutChecked: false, expectedChange: { "TiddlerOne": { expand: "yes" } } }, + { + testName: "field mode default when missing -> true", + tiddlers: [], + widgetText: "<$checkbox tiddler='TiddlerOne' field='expand' default='yes' checked='yes' unchecked='no' />", + startsOutChecked: true, + expectedChange: { "TiddlerOne": { expand: "no" } } + }, { testName: "field mode indeterminate -> true", tiddlers: [{title: "TiddlerOne", text: "Jolly Old World", expand: "some other value"}], @@ -98,19 +105,28 @@ Tests the checkbox widget thoroughly. var indexModeTests = fieldModeTests.map(data => { var newData = {...data}; var newName = data.testName.replace('field mode', 'index mode'); + var tiddlerOneAlreadyExists = false; var newTiddlers = data.tiddlers.map(tiddler => { + if(tiddler.title === "TiddlerOne") { + tiddlerOneAlreadyExists = true; + } return {title: tiddler.title, type: "application/x-tiddler-dictionary", text: `one: a\nexpand: ${tiddler.expand}\ntwo: b`} }); var newWidgetText = data.widgetText.replace("field='expand'", "index='expand'"); var newChange = {}; for (var key of Object.keys(data.expectedChange)) { var oldChange = data.expectedChange[key]; - if (oldChange.expand) { - newChange[key] = { text: `one: a\nexpand: ${oldChange.expand}\ntwo: b` } + var text; + if (!tiddlerOneAlreadyExists) { + // If it wasn't there, the created one will be JSON + text = `{\n "expand": "${oldChange.expand}"\n}`; + } else if (oldChange.expand) { + text = `one: a\nexpand: ${oldChange.expand}\ntwo: b`; } else { // In index tiddlers, the "expand" field gets completely removed, not turned into "expand: (undefined)" - newChange[key] = { text: `one: a\ntwo: b` } + text = `one: a\ntwo: b`; } + newChange[key] = { text: text }; } newData.testName = newName; newData.tiddlers = newTiddlers; @@ -514,7 +530,9 @@ Tests the checkbox widget thoroughly. /* * Checkbox widget tests using the test data above */ - for (var data of checkboxTestData) { + // MAKE SURE TO USE $tw.utils.each HERE!!! + // If you use a forloop, the closure of the tests will all use the last value "data" was assigned to, and thus all run the same test. + $tw.utils.each(checkboxTestData, function(data) { it('checkbox widget test: ' + data.testName, function() { // Setup @@ -553,9 +571,8 @@ Tests the checkbox widget thoroughly. } } }) - } + }); }); -})(); \ No newline at end of file diff --git a/editions/test/tiddlers/tests/test-compare-filter.js b/editions/test/tiddlers/tests/test-compare-filter.js index b146fcc18..1fedf890c 100644 --- a/editions/test/tiddlers/tests/test-compare-filter.js +++ b/editions/test/tiddlers/tests/test-compare-filter.js @@ -6,7 +6,7 @@ tags: [[$:/tags/test-spec]] Tests the compare filter. \*/ -(function(){ + /* jslint node: true, browser: true */ /* eslint-env node, browser, jasmine */ @@ -81,4 +81,3 @@ describe("'compare' filter tests", function() { }); -})(); diff --git a/editions/test/tiddlers/tests/test-deserialize-operator.js b/editions/test/tiddlers/tests/test-deserialize-operator.js index c629de3ae..cc465dfbb 100644 --- a/editions/test/tiddlers/tests/test-deserialize-operator.js +++ b/editions/test/tiddlers/tests/test-deserialize-operator.js @@ -6,7 +6,7 @@ tags: [[$:/tags/test-spec]] Tests deserialize[] filter operator with various core deserializers \*/ -(function(){ + /* jslint node: true, browser: true */ /* eslint-env node, browser, jasmine */ @@ -37,8 +37,4 @@ Tests deserialize[] filter operator with various core deserializers }); }); -})(); - - - \ No newline at end of file diff --git a/editions/test/tiddlers/tests/test-deserializers.js b/editions/test/tiddlers/tests/test-deserializers.js index ae652cdfe..d207debf1 100644 --- a/editions/test/tiddlers/tests/test-deserializers.js +++ b/editions/test/tiddlers/tests/test-deserializers.js @@ -6,7 +6,6 @@ tags: [[$:/tags/test-spec]] Tests various core deserializers \*/ -(function(){ /* jslint node: true, browser: true */ /* eslint-env node, browser, jasmine */ @@ -34,6 +33,3 @@ Tests various core deserializers executeTestCase("dezerializer test data case 5",[ { title: 'Hello "There"', text: 'Abacus', type: 'text/vnd.tiddlywiki' }, { title: 'Hello "There"', text: 'Calculator'} , { title: 'Hello "There"', text: 'Protractor'} ]); }); - - })(); - \ No newline at end of file diff --git a/editions/test/tiddlers/tests/test-fakedom.js b/editions/test/tiddlers/tests/test-fakedom.js index 7041f017b..8cfe3f9c2 100644 --- a/editions/test/tiddlers/tests/test-fakedom.js +++ b/editions/test/tiddlers/tests/test-fakedom.js @@ -6,10 +6,6 @@ tags: [[$:/tags/test-spec]] Tests the fakedom that Tiddlywiki occasionally uses. \*/ -(function(){ - -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; describe("fakedom tests", function() { @@ -23,5 +19,3 @@ describe("fakedom tests", function() { expect($tw.fakeDocument.createTextNode("text").TEXT_NODE).toBe(3); }); }); - -})(); diff --git a/editions/test/tiddlers/tests/test-filters.js b/editions/test/tiddlers/tests/test-filters.js index 727f64ca4..96100e2f7 100644 --- a/editions/test/tiddlers/tests/test-filters.js +++ b/editions/test/tiddlers/tests/test-filters.js @@ -6,12 +6,7 @@ tags: [[$:/tags/test-spec]] Tests the filtering mechanism. \*/ -(function(){ - /* jslint node: true, browser: true */ - /* eslint-env node, browser, jasmine */ - /* eslint no-mixed-spaces-and-tabs: ["error", "smart-tabs"]*/ - /* global $tw, require */ "use strict"; describe("Filter tests", function() { @@ -1134,9 +1129,17 @@ Tests the filtering mechanism. expect(wiki.filterTiddlers("[[<>:\"/\\|?*]encodeuricomponent[]]").join(",")).toBe("%3C%3E%3A%22%2F%5C%7C%3F%2A"); }); + it("should handle the moduleproperty operator", function() { + // We don't need to confirm them all, only it it finds at least one module name that we're sure is there. + expect(wiki.filterTiddlers("[[macro]modules[]moduleproperty[name]]")).toContain("qualify"); + // No such property. Nothing to return. + expect(wiki.filterTiddlers("[[macro]modules[]moduleproperty[nonexistent]]").length).toBe(0); + // No such tiddlers. Nothing to return. + expect(wiki.filterTiddlers("[[nonexistent]moduleproperty[name]]").length).toBe(0); + // Non string properties should get toStringed. + expect(wiki.filterTiddlers("[[$:/core/modules/commands/init.js]moduleproperty[info]]").join(" ")).toBe('{"name":"init","synchronous":true}'); + }); } }); - })(); - diff --git a/editions/test/tiddlers/tests/test-html-parser.js b/editions/test/tiddlers/tests/test-html-parser.js index d2266ca5e..9fc108235 100644 --- a/editions/test/tiddlers/tests/test-html-parser.js +++ b/editions/test/tiddlers/tests/test-html-parser.js @@ -6,10 +6,7 @@ tags: [[$:/tags/test-spec]] Tests for the internal components of the HTML tag parser \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; function FakeParser() { @@ -231,5 +228,3 @@ describe("HTML tag new parser tests", function() { }); }); - -})(); diff --git a/editions/test/tiddlers/tests/test-json-filters.js b/editions/test/tiddlers/tests/test-json-filters.js index bfb8a4504..566f77fe2 100644 --- a/editions/test/tiddlers/tests/test-json-filters.js +++ b/editions/test/tiddlers/tests/test-json-filters.js @@ -6,7 +6,7 @@ tags: [[$:/tags/test-spec]] Tests the JSON filters and the format:json operator \*/ -(function(){ + /* jslint node: true, browser: true */ /* eslint-env node, browser, jasmine */ @@ -151,4 +151,3 @@ describe("json filter tests", function() { }); -})(); diff --git a/editions/test/tiddlers/tests/test-linked-list.js b/editions/test/tiddlers/tests/test-linked-list.js index de477257d..20150bc80 100644 --- a/editions/test/tiddlers/tests/test-linked-list.js +++ b/editions/test/tiddlers/tests/test-linked-list.js @@ -21,10 +21,7 @@ NOTE TO FURTHER LINKED LIST DEVELOPERS: the end. I think you'll probably be better off preventing 'prev' from ever adding undefined. \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; describe("LinkedList class tests", function() { @@ -307,4 +304,3 @@ describe("LinkedList class tests", function() { }); }); -})(); diff --git a/editions/test/tiddlers/tests/test-parsetextreference.js b/editions/test/tiddlers/tests/test-parsetextreference.js index 59f885232..3c18b90fb 100644 --- a/editions/test/tiddlers/tests/test-parsetextreference.js +++ b/editions/test/tiddlers/tests/test-parsetextreference.js @@ -6,10 +6,7 @@ tags: [[$:/tags/test-spec]] Tests for source attribute in parser returned from wiki.parseTextReference \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; describe("Wiki.parseTextReference tests", function() { @@ -129,4 +126,3 @@ describe("Wiki.parseTextReference tests", function() { }); -})(); diff --git a/editions/test/tiddlers/tests/test-plugins.js b/editions/test/tiddlers/tests/test-plugins.js index 8e79efe24..86cd4c6f0 100644 --- a/editions/test/tiddlers/tests/test-plugins.js +++ b/editions/test/tiddlers/tests/test-plugins.js @@ -6,10 +6,6 @@ tags: [[$:/tags/test-spec]] Tests for integrity of the core plugins, languages, themes and editions \*/ -(function(){ - -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; if($tw.node) { @@ -50,6 +46,3 @@ if($tw.node) { }); }); } - - -})(); diff --git a/editions/test/tiddlers/tests/test-popup.js b/editions/test/tiddlers/tests/test-popup.js index 455da2b9b..fe6dac2c4 100644 --- a/editions/test/tiddlers/tests/test-popup.js +++ b/editions/test/tiddlers/tests/test-popup.js @@ -6,10 +6,7 @@ tags: [[$:/tags/test-spec]] Tests some utility function of the Popup prototype. \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; describe("Popup tests", function() { @@ -60,4 +57,3 @@ describe("Popup tests", function() { }); }); -})(); diff --git a/editions/test/tiddlers/tests/test-prefixes-filter.js b/editions/test/tiddlers/tests/test-prefixes-filter.js index a8d109d73..c71d32585 100644 --- a/editions/test/tiddlers/tests/test-prefixes-filter.js +++ b/editions/test/tiddlers/tests/test-prefixes-filter.js @@ -4,7 +4,7 @@ type: application/javascript tags: [[$:/tags/test-spec]] Tests the reduce prefix and filter. \*/ -(function(){ + /* jslint node: true, browser: true */ /* eslint-env node, browser, jasmine */ @@ -459,5 +459,3 @@ describe("'reduce' and 'intersection' filter prefix tests", function() { expect(wiki.filterTiddlers('[tag[shopping]] :reduce[]',anchorWidget).join(",")).toBe(" 0 Brownies, 1 Chick Peas, 2 Milk, 3 Rice Pudding,"); }); }); - -})(); \ No newline at end of file diff --git a/editions/test/tiddlers/tests/test-tags-operator.js b/editions/test/tiddlers/tests/test-tags-operator.js index 87970d113..4fa0b5963 100644 --- a/editions/test/tiddlers/tests/test-tags-operator.js +++ b/editions/test/tiddlers/tests/test-tags-operator.js @@ -6,8 +6,7 @@ tags: [[$:/tags/test-spec]] Tests the tagging mechanism. \*/ -/*jslint node: true, browser: true */ -/*global $tw: false */ + "use strict"; describe("Tags Operator tests", function() { diff --git a/editions/test/tiddlers/tests/test-tags.js b/editions/test/tiddlers/tests/test-tags.js index 563c39fe5..2032db039 100644 --- a/editions/test/tiddlers/tests/test-tags.js +++ b/editions/test/tiddlers/tests/test-tags.js @@ -6,10 +6,7 @@ tags: [[$:/tags/test-spec]] Tests the tagging mechanism. \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; describe("Tag tests", function() { @@ -179,4 +176,3 @@ function runTests(wiki,wikiOptions) { }); -})(); diff --git a/editions/test/tiddlers/tests/test-tiddler.js b/editions/test/tiddlers/tests/test-tiddler.js index f85ee9c6a..070ca98dc 100644 --- a/editions/test/tiddlers/tests/test-tiddler.js +++ b/editions/test/tiddlers/tests/test-tiddler.js @@ -6,10 +6,7 @@ tags: [[$:/tags/test-spec]] Tests the tiddler object \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; describe("Tiddler tests", function() { @@ -134,4 +131,3 @@ describe("Tiddler tests", function() { }); -})(); diff --git a/editions/test/tiddlers/tests/test-utils.js b/editions/test/tiddlers/tests/test-utils.js index 91ddf86f4..29fa99c01 100644 --- a/editions/test/tiddlers/tests/test-utils.js +++ b/editions/test/tiddlers/tests/test-utils.js @@ -6,10 +6,7 @@ tags: [[$:/tags/test-spec]] Tests various utility functions. \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; describe("Utility tests", function() { @@ -210,5 +207,3 @@ describe("Utility tests", function() { }); }); - -})(); \ No newline at end of file diff --git a/editions/test/tiddlers/tests/test-widget-event.js b/editions/test/tiddlers/tests/test-widget-event.js new file mode 100644 index 000000000..9aeb9a838 --- /dev/null +++ b/editions/test/tiddlers/tests/test-widget-event.js @@ -0,0 +1,219 @@ +/*\ +title: test-widget-event.js +type: application/javascript +tags: [[$:/tags/test-spec]] +\*/ + +"use strict"; + +describe("Widget Event Listeners", function() { + var widget = require("$:/core/modules/widgets/widget.js"); + + function createWidgetNode(parseTreeNode,wiki,parentWidget) { + return new widget.widget(parseTreeNode,{ + wiki: wiki, + document: $tw.fakeDocument, + parentWidget: parentWidget + }); + } + + it("should call all added event listeners on dispatchEvent", function() { + var calls = []; + var wiki = new $tw.Wiki(); + var widget = createWidgetNode({type:"widget", text:"text"}, wiki); + + // Add a function listener. + widget.addEventListener("testEvent", function(e) { + calls.push("funcListener"); + return true; + }); + // Setup a method on widget for string listener. + widget.testHandler = function(e) { + calls.push("methodListener"); + return true; + }; + widget.addEventListener("testEvent", "testHandler"); + + var event = {type:"testEvent"}; + var result = widget.dispatchEvent(event); + expect(result).toBe(true); + expect(calls.length).toBe(2); + expect(calls).toContain("funcListener"); + expect(calls).toContain("methodListener"); + }); + + it("should remove an event listener correctly", function() { + var calls = []; + var wiki = new $tw.Wiki(); + var widget = createWidgetNode({type:"widget", text:"text"}, wiki); + + function listener(e) { + calls.push("listener"); + return true; + } + // Add listener twice: once as function and then add another distinct listener. + widget.addEventListener("removeTest", listener); + widget.addEventListener("removeTest", function(e) { + calls.push("secondListener"); + return true; + }); + // Remove the function listener. + widget.removeEventListener("removeTest", listener); + + var event = {type:"removeTest"}; + var result = widget.dispatchEvent(event); + expect(result).toBe(true); + expect(calls.length).toBe(1); + expect(calls).toContain("secondListener"); + expect(calls).not.toContain("listener"); + }); + + it("stop further propagation by returns false won't block other listeners on the same level.", function() { + var calls = []; + var wiki = new $tw.Wiki(); + var widget = createWidgetNode({type:"widget", text:"text"}, wiki); + + widget.addEventListener("stopEvent", function(e) { + calls.push("first"); + // stops further propagation, but still dispatch event for second listener. + return false; + }); + widget.addEventListener("stopEvent", function(e) { + calls.push("second"); + return true; + }); + var event = {type:"stopEvent"}; + var result = widget.dispatchEvent(event); + expect(result).toBe(false); + expect(calls.length).toBe(2); + expect(calls).toContain("first"); + expect(calls).toContain("second"); + }); + + it("should dispatch event to parent widget if not handled on child", function() { + var parentCalls = []; + var wiki = new $tw.Wiki(); + var parentWidget = createWidgetNode({type:"widget", text:"text"}, wiki); + parentWidget.addEventListener("parentEvent", function(e) { + parentCalls.push("parentListener"); + return true; + }); + // Create a child with parentWidget assigned. + var childWidget = createWidgetNode({type:"widget", text:"text"}, wiki, parentWidget); + // No listener on child; so dispatch should bubble up. + var event = {type:"parentEvent"}; + var result = childWidget.dispatchEvent(event); + expect(result).toBe(true); + expect(parentCalls.length).toBe(1); + expect(parentCalls).toContain("parentListener"); + }); + + it("should not dispatch event to parent if child's listener stops propagation", function() { + var parentCalls = []; + var wiki = new $tw.Wiki(); + var parentWidget = createWidgetNode({type:"widget", text:"text"}, wiki); + parentWidget.addEventListener("bubbleTest", function(e) { + parentCalls.push("parentListener"); + return true; + }); + var childWidget = createWidgetNode({type:"widget", text:"text"}, wiki, parentWidget); + childWidget.addEventListener("bubbleTest", function(e) { + return false; // Stop event propagation + }); + var event = {type:"bubbleTest"}; + var result = childWidget.dispatchEvent(event); + expect(result).toBe(false); + expect(parentCalls.length).toBe(0); + }); + + it("should call multiple listeners in proper order across child and parent", function() { + var calls = []; + var wiki = new $tw.Wiki(); + var parentWidget = createWidgetNode({type:"widget", text:"text"}, wiki); + parentWidget.addEventListener("chainEvent", function(e) { + calls.push("parentListener"); + return true; + }); + var childWidget = createWidgetNode({type:"widget", text:"text"}, wiki, parentWidget); + childWidget.addEventListener("chainEvent", function(e) { + calls.push("childListener"); + return true; + }); + var event = {type:"chainEvent"}; + var result = childWidget.dispatchEvent(event); + expect(result).toBe(true); + expect(calls.length).toBe(2); + // First call from child widget and then parent's listener. + expect(calls[0]).toBe("childListener"); + expect(calls[1]).toBe("parentListener"); + }); + + // Additional tests for multiple event types + it("should handle events of different types separately", function() { + var callsA = []; + var callsB = []; + var wiki = new $tw.Wiki(); + var widget = createWidgetNode({type:"widget", text:"text"}, wiki); + widget.addEventListener("eventA", function(e) { + callsA.push("A1"); + return true; + }); + widget.addEventListener("eventB", function(e) { + callsB.push("B1"); + return true; + }); + widget.dispatchEvent({type:"eventA"}); + widget.dispatchEvent({type:"eventB"}); + expect(callsA).toContain("A1"); + expect(callsB).toContain("B1"); + }); + + // Test using $tw.utils.each in removeEventListener internally (behavior verified via dispatch) + it("should remove listeners using $tw.utils.each without affecting other listeners", function() { + var calls = []; + var wiki = new $tw.Wiki(); + var widget = createWidgetNode({type:"widget", text:"text"}, wiki); + function listener1(e) { + calls.push("listener1"); + return true; + } + function listener2(e) { + calls.push("listener2"); + return true; + } + widget.addEventListener("testRemove", listener1); + widget.addEventListener("testRemove", listener2); + widget.removeEventListener("testRemove", listener1); + widget.dispatchEvent({type:"testRemove"}); + expect(calls.length).toBe(1); + expect(calls).toContain("listener2"); + expect(calls).not.toContain("listener1"); + }); + + it("should prevent adding the same event listener multiple times", function() { + var calls = 0; + var wiki = new $tw.Wiki(); + var widget = createWidgetNode({type:"widget", text:"text"}, wiki); + + function listener(e) { + calls++; + return true; + } + + // Add the same listener multiple times + widget.addEventListener("testEvent", listener); + widget.addEventListener("testEvent", listener); + widget.addEventListener("testEvent", listener); + + // Dispatch the event + var event = {type:"testEvent"}; + widget.dispatchEvent(event); + + // The listener should only be called once + expect(calls).toBe(1); + + // Check the internal structure of eventListeners array + expect(widget.eventListeners["testEvent"].length).toBe(1); + }); + +}); diff --git a/editions/test/tiddlers/tests/test-widget-getVariableInfo.js b/editions/test/tiddlers/tests/test-widget-getVariableInfo.js index 7273a6dce..ae0f4ce20 100644 --- a/editions/test/tiddlers/tests/test-widget-getVariableInfo.js +++ b/editions/test/tiddlers/tests/test-widget-getVariableInfo.js @@ -6,10 +6,6 @@ tags: [[$:/tags/test-spec]] Tests the wikitext rendering pipeline end-to-end. We also need tests that individually test parsers, rendertreenodes etc., but this gets us started. \*/ -(function(){ - -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; describe("Widget module", function() { @@ -92,4 +88,3 @@ describe("Widget module", function() { }); -})(); diff --git a/editions/test/tiddlers/tests/test-widget.js b/editions/test/tiddlers/tests/test-widget.js index 637104c0b..7d1cbc329 100755 --- a/editions/test/tiddlers/tests/test-widget.js +++ b/editions/test/tiddlers/tests/test-widget.js @@ -6,10 +6,7 @@ tags: [[$:/tags/test-spec]] Tests the wikitext rendering pipeline end-to-end. We also need tests that individually test parsers, rendertreenodes etc., but this gets us started. \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; describe("Widget module", function() { @@ -945,4 +942,3 @@ describe("Widget module", function() { }); }); -})(); diff --git a/editions/test/tiddlers/tests/test-wikitext-parser.js b/editions/test/tiddlers/tests/test-wikitext-parser.js index a488ff030..7a8a132c7 100644 --- a/editions/test/tiddlers/tests/test-wikitext-parser.js +++ b/editions/test/tiddlers/tests/test-wikitext-parser.js @@ -6,10 +6,7 @@ tags: [[$:/tags/test-spec]] Tests for wikitext parser \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; describe("WikiText parser tests", function() { @@ -119,6 +116,22 @@ describe("WikiText parser tests", function() { ); }); + it("should parse macro definitions with end statements followed by spaces", function() { + expect(parse("\\define myMacro()\nnothing\n\\end \n")).toEqual( + + [{"type":"set","attributes":{"name":{"name":"name","type":"string","value":"myMacro"},"value":{"name":"value","type":"string","value":"nothing"}},"children":[],"params":[],"isMacroDefinition":true,"orderedAttributes":[{"name":"name","type":"string","value":"myMacro"},{"name":"value","type":"string","value":"nothing"}],"start":0,"end":33,"rule":"macrodef"}] + + ); + }); + + it("should parse macro definitions with named end statements followed by spaces", function() { + expect(parse("\\define myMacro()\nnothing\n\\end myMacro \n")).toEqual( + + [{"type":"set","attributes":{"name":{"name":"name","type":"string","value":"myMacro"},"value":{"name":"value","type":"string","value":"nothing"}},"children":[],"params":[],"isMacroDefinition":true,"orderedAttributes":[{"name":"name","type":"string","value":"myMacro"},{"name":"value","type":"string","value":"nothing"}],"start":0,"end":40,"rule":"macrodef"}] + + ); + }); + it("should parse procedure definitions with no parameters", function() { expect(parse("\\procedure myMacro()\nnothing\n\\end\n")).toEqual( @@ -135,6 +148,22 @@ describe("WikiText parser tests", function() { ); }); + it("should parse procedure definitions with end statements followed by spaces", function() { + expect(parse("\\procedure myMacro()\nnothing\n\\end \n")).toEqual( + + [{"type":"set","attributes":{"name":{"name":"name","type":"string","value":"myMacro"},"value":{"name":"value","type":"string","value":"nothing"}},"children":[],"params":[],"orderedAttributes":[{"name":"name","type":"string","value":"myMacro"},{"name":"value","type":"string","value":"nothing"}],"isProcedureDefinition":true,"start":0,"end":36,"rule":"fnprocdef"}] + + ); + }); + + it("should parse procedure definitions with named end statements followed by spaces", function() { + expect(parse("\\procedure myMacro()\nnothing\n\\end myMacro \n")).toEqual( + + [{"type":"set","attributes":{"name":{"name":"name","type":"string","value":"myMacro"},"value":{"name":"value","type":"string","value":"nothing"}},"children":[],"params":[],"orderedAttributes":[{"name":"name","type":"string","value":"myMacro"},{"name":"value","type":"string","value":"nothing"}],"isProcedureDefinition":true,"start":0,"end":43,"rule":"fnprocdef"}] + + ); + }); + it("should parse procedure definitions with parameters", function() { expect(parse("\\procedure myMacro(one,two,three,four:elephant)\nnothing\n\\end\n")).toEqual( @@ -158,6 +187,22 @@ describe("WikiText parser tests", function() { ); }); + it("should parse function definitions with end statements followed by spaces", function() { + expect(parse("\\function myMacro()\nnothing\n\\end \n")).toEqual( + + [{"type":"set","attributes":{"name":{"name":"name","type":"string","value":"myMacro"},"value":{"name":"value","type":"string","value":"nothing"}},"children":[],"params":[],"orderedAttributes":[{"name":"name","type":"string","value":"myMacro"},{"name":"value","type":"string","value":"nothing"}],"isFunctionDefinition":true,"start":0,"end":35,"rule":"fnprocdef"}] + + ); + }); + + it("should parse function definitions with named end statements followed by spaces", function() { + expect(parse("\\function myMacro()\nnothing\n\\end myMacro \n")).toEqual( + + [{"type":"set","attributes":{"name":{"name":"name","type":"string","value":"myMacro"},"value":{"name":"value","type":"string","value":"nothing"}},"children":[],"params":[],"orderedAttributes":[{"name":"name","type":"string","value":"myMacro"},{"name":"value","type":"string","value":"nothing"}],"isFunctionDefinition":true,"start":0,"end":42,"rule":"fnprocdef"}] + + ); + }); + it("should parse single line function definitions with no parameters", function() { expect(parse("\\function myMacro() nothing\n")).toEqual( @@ -420,4 +465,3 @@ describe("WikiText parser tests", function() { }); }); -})(); diff --git a/editions/test/tiddlers/tests/test-wikitext-tabs-macro.js b/editions/test/tiddlers/tests/test-wikitext-tabs-macro.js index 973f6fe66..16e93d73a 100644 --- a/editions/test/tiddlers/tests/test-wikitext-tabs-macro.js +++ b/editions/test/tiddlers/tests/test-wikitext-tabs-macro.js @@ -9,10 +9,7 @@ Intended to permit future readability improvements. Adding new functionality will probably change the "expected" html structure. \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; describe("Tabs-macro HTML tests", function() { @@ -81,4 +78,3 @@ describe("Tabs-macro HTML tests", function() { }); }); -})(); diff --git a/editions/test/tiddlers/tests/test-wikitext.js b/editions/test/tiddlers/tests/test-wikitext.js index eddef73f7..c86cb90d7 100644 --- a/editions/test/tiddlers/tests/test-wikitext.js +++ b/editions/test/tiddlers/tests/test-wikitext.js @@ -6,10 +6,7 @@ tags: [[$:/tags/test-spec]] Tests the wikitext rendering pipeline end-to-end. We also need tests that individually test parsers, rendertreenodes etc., but this gets us started. \*/ -(function(){ -/*jslint node: true, browser: true */ -/*global $tw: false */ "use strict"; describe("WikiText tests", function() { @@ -71,4 +68,3 @@ describe("WikiText tests", function() { }); }); -})(); diff --git a/editions/text-slicer/tiddlers/system/$__coreURL.tid b/editions/text-slicer/tiddlers/system/$__coreURL.tid new file mode 100644 index 000000000..f3ab8b9c0 --- /dev/null +++ b/editions/text-slicer/tiddlers/system/$__coreURL.tid @@ -0,0 +1,4 @@ +title: $:/coreURL +tags: $:/tags/Global + +\function coreURL() [[../../tiddlywikicore-$(version)$.js]substitute[]] diff --git a/editions/text-slicer/tiddlywiki.info b/editions/text-slicer/tiddlywiki.info index 7906ba510..f3a0df3bf 100644 --- a/editions/text-slicer/tiddlywiki.info +++ b/editions/text-slicer/tiddlywiki.info @@ -13,6 +13,9 @@ "build": { "index": [ "--rendertiddler","$:/core/save/all","index.html","text/plain" + ], + "external": [ + "--render","$:/core/save/all-external-js","index.html","text/plain" ] } } \ No newline at end of file diff --git a/editions/tour/tiddlers/System/$__coreURL.tid b/editions/tour/tiddlers/System/$__coreURL.tid new file mode 100644 index 000000000..5876d6687 --- /dev/null +++ b/editions/tour/tiddlers/System/$__coreURL.tid @@ -0,0 +1,4 @@ +title: $:/coreURL +tags: $:/tags/Global + +\function coreURL() [[tiddlywikicore-$(version)$.js]substitute[]] diff --git a/editions/translators/tiddlers/Extracting Translations.tid b/editions/translators/tiddlers/Extracting Translations.tid index 3fe559e10..c29d7a40e 100644 --- a/editions/translators/tiddlers/Extracting Translations.tid +++ b/editions/translators/tiddlers/Extracting Translations.tid @@ -12,7 +12,6 @@ Use this procedure if the language being submitted is not already present in the # Create the new language folder `languages/xx-XX` # Copy the language files into the language folder # Create a `plugin.info` file for the translation -# Create an appropriate flag image in `icon.tid` # Add the new language to tw5.com # Submit a pull request diff --git a/editions/tw5.com-docs/tiddlers/$__coreURL.tid b/editions/tw5.com-docs/tiddlers/$__coreURL.tid new file mode 100644 index 000000000..f3ab8b9c0 --- /dev/null +++ b/editions/tw5.com-docs/tiddlers/$__coreURL.tid @@ -0,0 +1,4 @@ +title: $:/coreURL +tags: $:/tags/Global + +\function coreURL() [[../../tiddlywikicore-$(version)$.js]substitute[]] diff --git a/editions/tw5.com-docs/tiddlywiki.info b/editions/tw5.com-docs/tiddlywiki.info index 4d486267b..b788116eb 100644 --- a/editions/tw5.com-docs/tiddlywiki.info +++ b/editions/tw5.com-docs/tiddlywiki.info @@ -10,6 +10,9 @@ ], "build": { "index": [ - "--render","$:/core/save/all","index.html","text/plain"] + "--render","$:/core/save/all","index.html","text/plain"], + "external": [ + "--render","$:/core/save/all-external-js","index.html","text/plain" + ] } } diff --git a/editions/tw5.com/tiddlers/HTML Tags.tid b/editions/tw5.com/tiddlers/HTML Tags.tid new file mode 100644 index 000000000..8df3b22d9 --- /dev/null +++ b/editions/tw5.com/tiddlers/HTML Tags.tid @@ -0,0 +1,11 @@ +created: 20250211092107689 +modified: 20250211092307574 +tags: Definitions +title: HTML Tags +type: text/vnd.tiddlywiki + +<<< +In HTML, a tag is used for creating an element. + +The name of an HTML element is the name that appears at the beginning of the element's start tag and at the end of the element's end tag (if the element has an end tag). For example, the p in the `

` start tag and `

` end tag is the name of the HTML paragraph element. Note that an element name in an end tag is preceded by a slash character: `

`, and that for void elements, the end tag is neither required nor allowed. +<<< https://developer.mozilla.org/en-US/docs/Glossary/Tag \ No newline at end of file diff --git a/editions/tw5.com/tiddlers/Tags.tid b/editions/tw5.com/tiddlers/Tags.tid new file mode 100644 index 000000000..b77f0d452 --- /dev/null +++ b/editions/tw5.com/tiddlers/Tags.tid @@ -0,0 +1,8 @@ +created: 20250211093401937 +modified: 20250211093527189 +tags: Concepts +title: Tags + +Tags are used to organise tiddlers into categories. + +For more details see: [[Tagging]] \ No newline at end of file diff --git a/editions/tw5.com/tiddlers/TestCases_WikifyWidget_RenderHTML.tid b/editions/tw5.com/tiddlers/TestCases_WikifyWidget_RenderHTML.tid new file mode 100644 index 000000000..7a0ac231f --- /dev/null +++ b/editions/tw5.com/tiddlers/TestCases_WikifyWidget_RenderHTML.tid @@ -0,0 +1,28 @@ +created: 20241201235747500 +description: Exporting rendered html +tags: $:/tags/wiki-test-spec +title: TestCases/WikifyWidget/RenderHTML +type: text/vnd.tiddlywiki-multiple + +title: Narrative + +You can use <<.wid wikify>> to copy your wikitext as a formated HTML. ++ +title: Output + +<$wikify name="code" text={{code}} output="html"> + +<$codeblock code=<> /> + +<$macrocall $name="copy-to-clipboard" src=<>/> + + ++ +title: code +text: + +!! A nice list + +* Item 1 +* Item 2 +* Item 3 \ No newline at end of file diff --git a/editions/tw5.com/tiddlers/TestCases_WikifyWidget_RenderSVGURI.tid b/editions/tw5.com/tiddlers/TestCases_WikifyWidget_RenderSVGURI.tid new file mode 100644 index 000000000..e809c7891 --- /dev/null +++ b/editions/tw5.com/tiddlers/TestCases_WikifyWidget_RenderSVGURI.tid @@ -0,0 +1,48 @@ +created: 20241206225533517 +description: Rendering parameterised SVG for use in stylesheets +tags: $:/tags/wiki-test-spec +title: TestCases/WikifyWidget/RenderSVGURI +type: text/vnd.tiddlywiki-multiple + +title: Narrative + +The core svg icons use a parameter widget, making their use in stylesheets impossible without wikify. ++ +title: Output + +* https://tiddlywiki.com/ +* [[TW5|http://tiddlywiki.com/]] +* [[Mail me|mailto:me@where.net]] +* [[Open file|file:///c:/users/me/index.html]] + + ++ +title: Stylesheet + +\rules except dash +\procedure link-icon(protocol,img) +<$tiddler tiddler=<> > + <$wikify name="svg" text={{!!text}} mode="inline" output="html"> + <$text text=` + [href*="$(protocol)$"]{ + --mask:url('data:image/svg+xml;utf8,$(svg)$'); + } + `/> + + +\end + +.tc-tiddlylink-external:after{ + width:.7rem; + aspect-ratio:1; + background:currentColor; + display: inline-block; + mask: center / contain no-repeat var(--mask); + margin-inline:.5ch; + content:""; +} + +<> +<> +<> +<> \ No newline at end of file diff --git a/editions/tw5.com/tiddlers/TestCases_WikifyWidget_WidgetValue_Fail.tid b/editions/tw5.com/tiddlers/TestCases_WikifyWidget_WidgetValue_Fail.tid new file mode 100644 index 000000000..c07005786 --- /dev/null +++ b/editions/tw5.com/tiddlers/TestCases_WikifyWidget_WidgetValue_Fail.tid @@ -0,0 +1,33 @@ +created: 20241202000005087 +description: Using a widget as a value +tags: $:/tags/wiki-test-spec-failing +title: TestCases/WikifyWidget/WidgetValue/Fail +type: text/vnd.tiddlywiki-multiple + +title: Narrative + +If you try to directly use a widget as a value, you will instead get the raw wikitext of the widget and not the rendered value. ++ +title: Output + + + {{widget}} text on {{target}} is a good contrast + ++ +title: widget +text: <$transclude $variable="contrastcolour" target={{target}} fallbackTarget=<> colourA={{colourA}} colourB={{colourB}} /> ++ +title: target +text: purple ++ +title: colourA +text: white ++ +title: colourB +text: black ++ +title: ExpectedResult + +

> colourA={{colourA}} colourB={{colourB}} />;background:purple;"> + white text on purple is a good contrast +

\ No newline at end of file diff --git a/editions/tw5.com/tiddlers/TestCases_WikifyWidget_WidgetValue_Success.tid b/editions/tw5.com/tiddlers/TestCases_WikifyWidget_WidgetValue_Success.tid new file mode 100644 index 000000000..ba147f2b7 --- /dev/null +++ b/editions/tw5.com/tiddlers/TestCases_WikifyWidget_WidgetValue_Success.tid @@ -0,0 +1,43 @@ +created: 20241202003148804 +description: Using a widget as a value +tags: $:/tags/wiki-test-spec +title: TestCases/WikifyWidget/WidgetValue/Success +type: text/vnd.tiddlywiki-multiple + +title: Narrative + +If you use <<.wid wikify>>, you can get the rendered output and use it as a value. ++ +title: Output + +<$wikify name="wikified-color" text={{widget}} > + > style.background={{target}}> + {{widget}} text on {{target}} is a good contrast + + ++ +title: widget + +<$transclude $variable="contrastcolour" + target={{target}} + fallbackTarget=<> + colourA={{colourA}} + colourB={{colourB}} +/> ++ +title: target +text: purple ++ +title: colourA +text: white ++ +title: colourB +text: black ++ +title: ExpectedResult + +

+ + white text on purple is a good contrast + +

\ No newline at end of file diff --git a/editions/tw5.com/tiddlers/TestCases_WikifyWidget_WordCount_Fail.tid b/editions/tw5.com/tiddlers/TestCases_WikifyWidget_WordCount_Fail.tid new file mode 100644 index 000000000..570f85fff --- /dev/null +++ b/editions/tw5.com/tiddlers/TestCases_WikifyWidget_WordCount_Fail.tid @@ -0,0 +1,19 @@ +created: 20241201235746062 +description: Accurate word count +tags: $:/tags/wiki-test-spec-failing +title: TestCases/WikifyWidget/WordCount/Fail +type: text/vnd.tiddlywiki-multiple + +title: Narrative + +If a tiddler transclude some content, or use widgets to generate content, filters that try to calculate the word count won’t be accurate: they will instead count the raw text words. ++ +title: Output + +Word count = <$count filter="[{lorem}split[ ]!is[blank]]"/> ++ +title: lorem +text: <$list filter="[range[1],[3]]"><$text text=" word "/> ++ +title: ExpectedResult +text:

Word count = 3

\ No newline at end of file diff --git a/editions/tw5.com/tiddlers/TestCases_WikifyWidget_WordCount_Success.tid b/editions/tw5.com/tiddlers/TestCases_WikifyWidget_WordCount_Success.tid new file mode 100644 index 000000000..be214b97a --- /dev/null +++ b/editions/tw5.com/tiddlers/TestCases_WikifyWidget_WordCount_Success.tid @@ -0,0 +1,19 @@ +created: 20241202011409888 +description: Accurate word count +tags: $:/tags/wiki-test-spec +title: TestCases/WikifyWidget/WordCount/Success +type: text/vnd.tiddlywiki-multiple + +title: Narrative + +If you use wikify, you can calculate an accurate word count. ++ +title: Output + +<$wikify name="lorem" text={{lorem}} output="text">Word count = <$count filter="[split[ ]!is[blank]]"/> ++ +title: lorem +text: <$list filter="[range[1],[3]]"><$text text=" word "/> ++ +title: ExpectedResult +text:

Word count = 3

\ No newline at end of file diff --git a/editions/tw5.com/tiddlers/Title.tid b/editions/tw5.com/tiddlers/Title.tid new file mode 100644 index 000000000..cd89fb6dc --- /dev/null +++ b/editions/tw5.com/tiddlers/Title.tid @@ -0,0 +1,8 @@ +created: 20250211094052630 +modified: 20250211094419548 +tags: Concepts +title: Title + +The minimum requirement for a valid tiddler is a ''unique'' title. + +Learn more at: [[Tiddlers]] \ No newline at end of file diff --git a/editions/tw5.com/tiddlers/system/doc-macros.tid b/editions/tw5.com/tiddlers/_tw_shared/doc-utilities/doc-macros.tid similarity index 98% rename from editions/tw5.com/tiddlers/system/doc-macros.tid rename to editions/tw5.com/tiddlers/_tw_shared/doc-utilities/doc-macros.tid index 199479fb8..19ae159ce 100644 --- a/editions/tw5.com/tiddlers/system/doc-macros.tid +++ b/editions/tw5.com/tiddlers/_tw_shared/doc-utilities/doc-macros.tid @@ -228,3 +228,11 @@ This is an example tiddler. See [[Table-of-Contents Macros (Examples)]]. \end + +\procedure .copy-code-to-clipboard(text) +
+<$transclude $variable="copy-to-clipboard-above-right" src=<>/> +<$codeblock code=<>/> +
+\end .copy-code-to-clipboard + diff --git a/editions/tw5.com/tiddlers/system/doc-styles.tid b/editions/tw5.com/tiddlers/_tw_shared/doc-utilities/doc-styles.tid similarity index 100% rename from editions/tw5.com/tiddlers/system/doc-styles.tid rename to editions/tw5.com/tiddlers/_tw_shared/doc-utilities/doc-styles.tid diff --git a/editions/tw5.com/tiddlers/system/version-macros.tid b/editions/tw5.com/tiddlers/_tw_shared/doc-utilities/version-macros.tid similarity index 100% rename from editions/tw5.com/tiddlers/system/version-macros.tid rename to editions/tw5.com/tiddlers/_tw_shared/doc-utilities/version-macros.tid diff --git a/editions/tw5.com/tiddlers/system/wikitext-macros.tid b/editions/tw5.com/tiddlers/_tw_shared/doc-utilities/wikitext-macros.tid similarity index 100% rename from editions/tw5.com/tiddlers/system/wikitext-macros.tid rename to editions/tw5.com/tiddlers/_tw_shared/doc-utilities/wikitext-macros.tid diff --git a/editions/tw5.com/tiddlers/_tw_shared/favicons/mws.tiddlywiki.com.png b/editions/tw5.com/tiddlers/_tw_shared/favicons/mws.tiddlywiki.com.png new file mode 100644 index 000000000..f197f135b Binary files /dev/null and b/editions/tw5.com/tiddlers/_tw_shared/favicons/mws.tiddlywiki.com.png differ diff --git a/editions/tw5.com/tiddlers/_tw_shared/favicons/mws.tiddlywiki.com.png.meta b/editions/tw5.com/tiddlers/_tw_shared/favicons/mws.tiddlywiki.com.png.meta new file mode 100644 index 000000000..d97a171b3 --- /dev/null +++ b/editions/tw5.com/tiddlers/_tw_shared/favicons/mws.tiddlywiki.com.png.meta @@ -0,0 +1,3 @@ +title: $:/_tw_shared/favicons/mws.tiddlywiki.com +type: image/png +tags: TiddlyWikiSitesMenu diff --git a/editions/tw5.com/tiddlers/_tw_shared/sites/mws.tiddlywiki.com.tid b/editions/tw5.com/tiddlers/_tw_shared/sites/mws.tiddlywiki.com.tid new file mode 100644 index 000000000..f06e55d6c --- /dev/null +++ b/editions/tw5.com/tiddlers/_tw_shared/sites/mws.tiddlywiki.com.tid @@ -0,0 +1,6 @@ +title: $:/_tw_shared/sites/mws.tiddlywiki.com +tags: $:/tags/TiddlyWikiSites TiddlyWikiSitesMenu +caption: mws.tiddlywiki.com +description: ~MultiWikiServer Home +url: https://mws.tiddlywiki.com/ +icon: $:/_tw_shared/favicons/mws.tiddlywiki.com diff --git a/editions/tw5.com/tiddlers/_tw_shared/tags-TiddlyWikiSites.tid b/editions/tw5.com/tiddlers/_tw_shared/tags-TiddlyWikiSites.tid index 00e567510..e627aeabb 100644 --- a/editions/tw5.com/tiddlers/_tw_shared/tags-TiddlyWikiSites.tid +++ b/editions/tw5.com/tiddlers/_tw_shared/tags-TiddlyWikiSites.tid @@ -1,3 +1,3 @@ title: $:/tags/TiddlyWikiSites -list: $:/_tw_shared/sites/tiddlywiki.com $:/_tw_shared/sites/tiddlywiki.org $:/_tw_shared/sites/talk.tiddlywiki.org $:/_tw_shared/sites/links.tiddlywiki.org $:/_tw_shared/sites/tiddlywiki.com.upgrade $:/_tw_shared/sites/tiddlywiki.com.dev $:/_tw_shared/sites/tiddlywiki.com.prerelease $:/_tw_shared/sites/classic.tiddlywiki.com $:/_tw_shared/sites/marketplace +list: $:/_tw_shared/sites/tiddlywiki.com $:/_tw_shared/sites/tiddlywiki.org $:/_tw_shared/sites/talk.tiddlywiki.org $:/_tw_shared/sites/links.tiddlywiki.org $:/_tw_shared/sites/tiddlywiki.com.upgrade $:/_tw_shared/sites/tiddlywiki.com.dev $:/_tw_shared/sites/tiddlywiki.com.prerelease $:/_tw_shared/sites/mws.tiddlywiki.com $:/_tw_shared/sites/classic.tiddlywiki.com $:/_tw_shared/sites/marketplace tags: TiddlyWikiSitesMenu diff --git a/editions/tw5.com/tiddlers/about/Archive.tid b/editions/tw5.com/tiddlers/about/Archive.tid index c3bbf8671..98901027b 100644 --- a/editions/tw5.com/tiddlers/about/Archive.tid +++ b/editions/tw5.com/tiddlers/about/Archive.tid @@ -1,5 +1,5 @@ created: 20231005205623086 -modified: 20240723172222378 +modified: 20241115193649399 tags: About title: TiddlyWiki Archive @@ -8,7 +8,7 @@ title: TiddlyWiki Archive 5.1.10 5.1.11 5.1.12 5.1.13 5.1.14 5.1.15 5.1.16 5.1.17 5.1.18 5.1.19 5.1.20 5.1.21 5.1.22 5.1.23 5.2.0 5.2.1 5.2.2 5.2.3 5.2.4 5.2.5 5.2.6 5.2.7 -5.3.0 5.3.1 5.3.2 5.3.3 5.3.4 5.3.5 +5.3.0 5.3.1 5.3.2 5.3.3 5.3.4 5.3.5 5.3.6 \end Older versions of TiddlyWiki are available in the [[archive|https://github.com/TiddlyWiki/tiddlywiki.com-gh-pages/tree/master/archive]]: diff --git a/editions/tw5.com/tiddlers/about/Developers.tid b/editions/tw5.com/tiddlers/about/Developers.tid index 7ec64f20e..084869ae9 100644 --- a/editions/tw5.com/tiddlers/about/Developers.tid +++ b/editions/tw5.com/tiddlers/about/Developers.tid @@ -22,8 +22,3 @@ There are several resources for developers to learn more about TiddlyWiki and to *** An enhanced group search facility is available on [[mail-archive.com|https://www.mail-archive.com/tiddlywikidev@googlegroups.com/]] * Chat at https://gitter.im/TiddlyWiki/public (development room coming soon) - -! Twitter - -* Follow [[@TiddlyWiki on Twitter|http://twitter.com/#!/TiddlyWiki]] for the latest news - diff --git a/editions/tw5.com/tiddlers/community/Articles.tid b/editions/tw5.com/tiddlers/community/Articles.tid index 8408056cb..729fe539d 100644 --- a/editions/tw5.com/tiddlers/community/Articles.tid +++ b/editions/tw5.com/tiddlers/community/Articles.tid @@ -4,7 +4,7 @@ tags: Community title: Articles type: text/vnd.tiddlywiki -Here are some recent articles written about ~TiddlyWiki. Submit new articles via GitHub, Twitter or by posting in the [[TiddlyWiki Groups|Forums]]. +Here are some recent articles written about ~TiddlyWiki. Submit new articles via GitHub or by posting in the [[TiddlyWiki Groups|Forums]].