diff --git a/.eslintignore b/.eslintignore deleted file mode 100644 index 9e586b92e..000000000 --- a/.eslintignore +++ /dev/null @@ -1,8 +0,0 @@ -# Ignore "third party" code whose style we will not change. -/boot/sjcl.js -/core/modules/utils/base64-utf8/base64-utf8.module.js -/core/modules/utils/base64-utf8/base64-utf8.module.min.js -/core/modules/utils/diff-match-patch/diff_match_patch.js -/core/modules/utils/diff-match-patch/diff_match_patch_uncompressed.js -/core/modules/utils/dom/csscolorparser.js -/plugins/tiddlywiki/*/files/ diff --git a/.eslintrc.yml b/.eslintrc.yml deleted file mode 100644 index 049af59e4..000000000 --- a/.eslintrc.yml +++ /dev/null @@ -1,283 +0,0 @@ -env: - browser: true - commonjs: true - es2021: true - node: true -extends: 'eslint:recommended' -globals: - "$tw": "writable" # temporary -parserOptions: - ecmaVersion: 5 -rules: - array-bracket-newline: 'off' - array-bracket-spacing: 'off' - array-callback-return: 'off' - array-element-newline: 'off' - arrow-body-style: error - arrow-parens: - - error - - as-needed - arrow-spacing: - - error - - after: true - before: true - block-scoped-var: 'off' - block-spacing: 'off' - brace-style: 'off' - callback-return: 'off' - camelcase: 'off' - capitalized-comments: 'off' - class-methods-use-this: error - comma-dangle: 'off' - comma-spacing: 'off' - comma-style: 'off' - complexity: 'off' - computed-property-spacing: 'off' - consistent-return: 'off' - consistent-this: 'off' - curly: 'off' - default-case: 'off' - default-case-last: error - default-param-last: error - dot-location: 'off' - dot-notation: 'off' - eol-last: 'off' - eqeqeq: 'off' - func-call-spacing: 'off' - func-name-matching: 'off' - func-names: 'off' - func-style: 'off' - function-call-argument-newline: 'off' - function-paren-newline: 'off' - generator-star-spacing: error - global-require: 'off' - grouped-accessor-pairs: error - guard-for-in: 'off' - handle-callback-err: 'off' - id-blacklist: error - id-denylist: error - id-length: 'off' - id-match: error - implicit-arrow-linebreak: error - indent: 'off' - indent-legacy: 'off' - init-declarations: 'off' - jsx-quotes: error - key-spacing: 'off' - keyword-spacing: - - error - - before: true - after: false - overrides: - 'case': - after: true - 'do': - 'after': true - 'else': - after: true - 'return': - after: true - 'throw': - after: true - 'try': - after: true - line-comment-position: 'off' - linebreak-style: 'off' - lines-around-comment: 'off' - lines-around-directive: 'off' - lines-between-class-members: error - max-classes-per-file: error - max-depth: 'off' - max-len: 'off' - max-lines: 'off' - max-lines-per-function: 'off' - max-nested-callbacks: error - max-params: 'off' - max-statements: 'off' - max-statements-per-line: 'off' - multiline-comment-style: 'off' - multiline-ternary: 'off' - new-parens: 'off' - newline-after-var: 'off' - newline-before-return: 'off' - newline-per-chained-call: 'off' - no-alert: 'off' - no-array-constructor: 'off' - no-await-in-loop: error - no-bitwise: 'off' - no-buffer-constructor: 'off' - no-caller: error - no-catch-shadow: 'off' - no-confusing-arrow: error - no-console: 'off' - no-constant-condition: - - error - - checkLoops: false - no-constructor-return: error - no-continue: 'off' - no-div-regex: 'off' - no-duplicate-imports: error - no-else-return: 'off' - no-empty-function: 'off' - no-eq-null: 'off' - no-eval: 'off' - no-extend-native: 'off' - no-extra-bind: 'off' - no-extra-label: 'off' - no-extra-parens: 'off' - no-floating-decimal: 'off' - no-implicit-coercion: - - error - - boolean: false - number: false - string: false - no-implicit-globals: 'off' - no-implied-eval: error - no-inline-comments: 'off' - no-invalid-this: 'off' - no-iterator: error - no-label-var: 'off' - no-labels: 'off' - no-lone-blocks: 'off' - no-lonely-if: 'off' - no-loop-func: 'off' - no-loss-of-precision: error - no-magic-numbers: 'off' - no-mixed-operators: 'off' - no-mixed-requires: 'off' - no-multi-assign: 'off' - no-multi-spaces: 'off' - no-multi-str: error - no-multiple-empty-lines: 'off' - no-native-reassign: 'off' - no-negated-condition: 'off' - no-negated-in-lhs: error - no-nested-ternary: 'off' - no-new: 'off' - no-new-func: 'off' - no-new-object: 'off' - no-new-require: error - no-new-wrappers: error - no-octal-escape: error - no-param-reassign: 'off' - no-path-concat: error - no-plusplus: 'off' - no-process-env: 'off' - no-process-exit: 'off' - no-promise-executor-return: error - no-proto: 'off' - no-restricted-exports: error - no-restricted-globals: error - no-restricted-imports: error - no-restricted-modules: error - no-restricted-properties: error - no-restricted-syntax: error - no-return-assign: 'off' - no-return-await: error - no-script-url: 'off' - no-self-compare: 'off' - no-sequences: 'off' - no-shadow: 'off' - no-spaced-func: 'off' - no-sync: 'off' - no-tabs: 'off' - no-template-curly-in-string: error - no-ternary: 'off' - no-throw-literal: 'off' - no-trailing-spaces: 'off' - no-undef-init: 'off' - no-undefined: 'off' - no-underscore-dangle: 'off' - no-unmodified-loop-condition: 'off' - no-unneeded-ternary: 'off' - no-unreachable-loop: error - no-unused-expressions: 'off' - no-use-before-define: 'off' - no-useless-backreference: error - no-useless-call: 'off' - no-useless-computed-key: error - no-useless-concat: 'off' - no-useless-constructor: error - no-useless-rename: error - no-useless-return: 'off' - no-var: 'off' - no-void: 'off' - no-warning-comments: 'off' - no-whitespace-before-property: error - nonblock-statement-body-position: - - error - - any - object-curly-newline: 'off' - object-curly-spacing: 'off' - object-property-newline: 'off' - object-shorthand: 'off' - one-var: 'off' - one-var-declaration-per-line: 'off' - operator-assignment: 'off' - operator-linebreak: 'off' - padded-blocks: 'off' - padding-line-between-statements: error - prefer-arrow-callback: 'off' - prefer-const: 'off' - prefer-destructuring: 'off' - prefer-exponentiation-operator: 'off' - prefer-named-capture-group: 'off' - prefer-numeric-literals: error - prefer-object-spread: 'off' - prefer-promise-reject-errors: error - prefer-reflect: 'off' - prefer-regex-literals: 'off' - prefer-rest-params: 'off' - prefer-spread: 'off' - prefer-template: 'off' - quote-props: 'off' - quotes: 'off' - radix: 'off' - require-atomic-updates: error - require-await: error - require-jsdoc: 'off' - require-unicode-regexp: 'off' - rest-spread-spacing: error - semi: 'off' - semi-spacing: 'off' - semi-style: 'off' - sort-imports: error - sort-keys: 'off' - sort-vars: 'off' - space-before-blocks: 'off' - space-before-function-paren: 'off' - space-in-parens: 'off' - space-infix-ops: 'off' - space-unary-ops: 'off' - spaced-comment: 'off' - strict: 'off' - switch-colon-spacing: 'off' - symbol-description: error - template-curly-spacing: error - template-tag-spacing: error - unicode-bom: - - error - - never - valid-jsdoc: 'off' - valid-typeof: - - error - - requireStringLiterals: false - vars-on-top: 'off' - wrap-iife: 'off' - wrap-regex: 'off' - yield-star-spacing: error - yoda: 'off' - - # temporary rules - no-useless-escape: 'off' - no-unused-vars: 'off' - no-empty: 'off' - no-extra-semi: 'off' - no-redeclare: 'off' - no-control-regex: "off" - no-mixed-spaces-and-tabs: "off" - no-extra-boolean-cast: "off" - no-prototype-builtins: "off" - no-undef: "off" - no-unreachable: "off" - no-self-assign: "off" diff --git a/bin/build-site.sh b/bin/build-site.sh index 43ba7b9d7..f1fe649e7 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.5 + TW5_BUILD_VERSION=v5.3.6 fi echo "Using TW5_BUILD_VERSION as [$TW5_BUILD_VERSION]" @@ -97,7 +97,6 @@ if [ -n "$TW5_BUILD_ARCHIVE" ]; then node $TW5_BUILD_TIDDLYWIKI \ $TW5_BUILD_MAIN_EDITION \ - --verbose \ --version \ --load $TW5_BUILD_OUTPUT/build.tid \ --output $TW5_BUILD_ARCHIVE \ @@ -115,7 +114,6 @@ fi node $TW5_BUILD_TIDDLYWIKI \ $TW5_BUILD_MAIN_EDITION \ - --verbose \ --version \ --load $TW5_BUILD_OUTPUT/build.tid \ --output $TW5_BUILD_OUTPUT \ @@ -128,7 +126,6 @@ node $TW5_BUILD_TIDDLYWIKI \ # /tiddlywikicore-.js Core plugin javascript node $TW5_BUILD_TIDDLYWIKI \ ./editions/empty \ - --verbose \ --output $TW5_BUILD_OUTPUT \ --build empty emptyexternalcore \ || exit 1 @@ -137,7 +134,6 @@ node $TW5_BUILD_TIDDLYWIKI \ # /test.html Test edition node $TW5_BUILD_TIDDLYWIKI \ ./editions/test \ - --verbose \ --output $TW5_BUILD_OUTPUT \ --rendertiddler $:/core/save/all test.html text/plain \ || exit 1 @@ -150,7 +146,6 @@ node $TW5_BUILD_TIDDLYWIKI \ # /dev/static/static.css Static stylesheet node $TW5_BUILD_TIDDLYWIKI \ ./editions/dev \ - --verbose \ --load $TW5_BUILD_OUTPUT/build.tid \ --output $TW5_BUILD_OUTPUT/dev \ --build index favicon static \ @@ -159,7 +154,6 @@ node $TW5_BUILD_TIDDLYWIKI \ # /tour.html tour edition node $TW5_BUILD_TIDDLYWIKI \ ./editions/tour \ - --verbose \ --output $TW5_BUILD_OUTPUT \ --rendertiddler $:/core/save/all tour.html text/plain \ || exit 1 @@ -167,7 +161,6 @@ node $TW5_BUILD_TIDDLYWIKI \ # /share.html Custom edition for sharing via the URL node $TW5_BUILD_TIDDLYWIKI \ ./editions/share \ - --verbose \ --load $TW5_BUILD_OUTPUT/build.tid \ --output $TW5_BUILD_OUTPUT \ --build share \ @@ -176,7 +169,6 @@ node $TW5_BUILD_TIDDLYWIKI \ # /upgrade.html Custom edition for performing upgrades node $TW5_BUILD_TIDDLYWIKI \ ./editions/upgrade \ - --verbose \ --load $TW5_BUILD_OUTPUT/build.tid \ --output $TW5_BUILD_OUTPUT \ --build upgrade \ @@ -185,7 +177,6 @@ node $TW5_BUILD_TIDDLYWIKI \ # /encrypted.html Copy of the main file encrypted with the password "password" node $TW5_BUILD_TIDDLYWIKI \ $TW5_BUILD_MAIN_EDITION \ - --verbose \ --load $TW5_BUILD_OUTPUT/build.tid \ --output $TW5_BUILD_OUTPUT \ --build encrypted \ @@ -201,7 +192,6 @@ node $TW5_BUILD_TIDDLYWIKI \ # /editions/xlsx-utils/index.html xlsx-utils edition node $TW5_BUILD_TIDDLYWIKI \ ./editions/xlsx-utils \ - --verbose \ --load $TW5_BUILD_OUTPUT/build.tid \ --output $TW5_BUILD_OUTPUT/editions/xlsx-utils/ \ --build index \ @@ -210,7 +200,6 @@ node $TW5_BUILD_TIDDLYWIKI \ # /editions/resumebuilder/index.html Resume builder edition node $TW5_BUILD_TIDDLYWIKI \ ./editions/resumebuilder \ - --verbose \ --load $TW5_BUILD_OUTPUT/build.tid \ --output $TW5_BUILD_OUTPUT/editions/resumebuilder/ \ --build index \ @@ -219,7 +208,6 @@ node $TW5_BUILD_TIDDLYWIKI \ # /editions/text-slicer/index.html Text slicer edition node $TW5_BUILD_TIDDLYWIKI \ ./editions/text-slicer \ - --verbose \ --load $TW5_BUILD_OUTPUT/build.tid \ --output $TW5_BUILD_OUTPUT/editions/text-slicer/ \ --build index \ @@ -228,7 +216,6 @@ node $TW5_BUILD_TIDDLYWIKI \ # /editions/translators/index.html Translators edition node $TW5_BUILD_TIDDLYWIKI \ ./editions/translators \ - --verbose \ --load $TW5_BUILD_OUTPUT/build.tid \ --output $TW5_BUILD_OUTPUT/editions/translators/ \ --build index \ @@ -237,7 +224,6 @@ node $TW5_BUILD_TIDDLYWIKI \ # /editions/introduction/index.html Introduction edition node $TW5_BUILD_TIDDLYWIKI \ ./editions/introduction \ - --verbose \ --load $TW5_BUILD_OUTPUT/build.tid \ --output $TW5_BUILD_OUTPUT/editions/introduction/ \ --build index \ @@ -246,7 +232,6 @@ node $TW5_BUILD_TIDDLYWIKI \ # /editions/full/index.html Full edition node $TW5_BUILD_TIDDLYWIKI \ ./editions/full \ - --verbose \ --load $TW5_BUILD_OUTPUT/build.tid \ --output $TW5_BUILD_OUTPUT/editions/full/ \ --build index \ @@ -255,7 +240,6 @@ node $TW5_BUILD_TIDDLYWIKI \ # /editions/tw5.com-docs/index.html tiddlywiki.com docs edition node $TW5_BUILD_TIDDLYWIKI \ ./editions/tw5.com-docs \ - --verbose \ --load $TW5_BUILD_OUTPUT/build.tid \ --output $TW5_BUILD_OUTPUT/editions/tw5.com-docs/ \ --build index \ @@ -264,7 +248,6 @@ node $TW5_BUILD_TIDDLYWIKI \ # /editions/twitter-archivist/index.html Twitter Archivist edition node $TW5_BUILD_TIDDLYWIKI \ ./editions/twitter-archivist \ - --verbose \ --load $TW5_BUILD_OUTPUT/build.tid \ --output $TW5_BUILD_OUTPUT/editions/twitter-archivist/ \ --build index \ @@ -280,7 +263,6 @@ node $TW5_BUILD_TIDDLYWIKI \ node $TW5_BUILD_TIDDLYWIKI \ ./editions/innerwikidemo \ - --verbose \ --load $TW5_BUILD_OUTPUT/build.tid \ --output $TW5_BUILD_OUTPUT \ --rendertiddler $:/core/save/all plugins/tiddlywiki/innerwiki/index.html text/plain \ @@ -291,7 +273,6 @@ node $TW5_BUILD_TIDDLYWIKI \ node $TW5_BUILD_TIDDLYWIKI \ ./editions/dynaviewdemo \ - --verbose \ --load $TW5_BUILD_OUTPUT/build.tid \ --output $TW5_BUILD_OUTPUT \ --rendertiddler $:/core/save/all plugins/tiddlywiki/dynaview/index.html text/plain \ @@ -306,7 +287,6 @@ node $TW5_BUILD_TIDDLYWIKI \ node $TW5_BUILD_TIDDLYWIKI \ ./editions/katexdemo \ - --verbose \ --load $TW5_BUILD_OUTPUT/build.tid \ --output $TW5_BUILD_OUTPUT \ --rendertiddler $:/core/save/all plugins/tiddlywiki/katex/index.html text/plain \ @@ -317,7 +297,6 @@ node $TW5_BUILD_TIDDLYWIKI \ # /plugins/tiddlywiki/tahoelafs/empty.html Empty wiki with Tahoe-LAFS plugin node $TW5_BUILD_TIDDLYWIKI \ ./editions/tahoelafs \ - --verbose \ --load $TW5_BUILD_OUTPUT/build.tid \ --output $TW5_BUILD_OUTPUT \ --rendertiddler $:/core/save/all plugins/tiddlywiki/tahoelafs/index.html text/plain \ @@ -328,7 +307,6 @@ node $TW5_BUILD_TIDDLYWIKI \ # /plugins/tiddlywiki/d3/empty.html Empty wiki with D3 plugin node $TW5_BUILD_TIDDLYWIKI \ ./editions/d3demo \ - --verbose \ --load $TW5_BUILD_OUTPUT/build.tid \ --output $TW5_BUILD_OUTPUT \ --rendertiddler $:/core/save/all plugins/tiddlywiki/d3/index.html text/plain \ @@ -339,7 +317,6 @@ node $TW5_BUILD_TIDDLYWIKI \ # /plugins/tiddlywiki/codemirror/empty.html Empty wiki with codemirror plugin node $TW5_BUILD_TIDDLYWIKI \ ./editions/codemirrordemo \ - --verbose \ --load $TW5_BUILD_OUTPUT/build.tid \ --output $TW5_BUILD_OUTPUT \ --rendertiddler $:/core/save/all plugins/tiddlywiki/codemirror/index.html text/plain \ @@ -350,7 +327,6 @@ node $TW5_BUILD_TIDDLYWIKI \ # /plugins/tiddlywiki/markdown/empty.html Empty wiki with Markdown plugin node $TW5_BUILD_TIDDLYWIKI \ ./editions/markdowndemo \ - --verbose \ --load $TW5_BUILD_OUTPUT/build.tid \ --output $TW5_BUILD_OUTPUT \ --rendertiddler $:/core/save/all plugins/tiddlywiki/markdown/index.html text/plain \ @@ -361,7 +337,6 @@ node $TW5_BUILD_TIDDLYWIKI \ # /plugins/tiddlywiki/tw2parser/empty.html Empty wiki with tw2parser plugin node $TW5_BUILD_TIDDLYWIKI \ ./editions/classicparserdemo \ - --verbose \ --load $TW5_BUILD_OUTPUT/build.tid \ --output $TW5_BUILD_OUTPUT \ --rendertiddler $:/core/save/all plugins/tiddlywiki/tw2parser/index.html text/plain \ @@ -372,7 +347,6 @@ node $TW5_BUILD_TIDDLYWIKI \ # /plugins/tiddlywiki/highlight/empty.html Empty wiki with highlight plugin node $TW5_BUILD_TIDDLYWIKI \ ./editions/highlightdemo \ - --verbose \ --load $TW5_BUILD_OUTPUT/build.tid \ --output $TW5_BUILD_OUTPUT \ --rendertiddler $:/core/save/all plugins/tiddlywiki/highlight/index.html text/plain \ @@ -383,7 +357,6 @@ node $TW5_BUILD_TIDDLYWIKI \ # /plugins/tiddlywiki/geospatial/empty.html Empty wiki with geospatial plugin node $TW5_BUILD_TIDDLYWIKI \ ./editions/geospatialdemo \ - --verbose \ --load $TW5_BUILD_OUTPUT/build.tid \ --output $TW5_BUILD_OUTPUT \ --rendertiddler $:/core/save/all plugins/tiddlywiki/geospatial/index.html text/plain \ @@ -411,7 +384,6 @@ rm -rf $TW5_BUILD_OUTPUT/languages/zh-Hant/static/* # /languages/de-AT/empty.html Empty wiki with de-AT language node $TW5_BUILD_TIDDLYWIKI \ ./editions/de-AT \ - --verbose \ --load $TW5_BUILD_OUTPUT/build.tid \ --output $TW5_BUILD_OUTPUT/languages/de-AT \ --build favicon empty static index \ @@ -421,7 +393,6 @@ node $TW5_BUILD_TIDDLYWIKI \ # /languages/de-DE/empty.html Empty wiki with de-DE language node $TW5_BUILD_TIDDLYWIKI \ ./editions/de-DE \ - --verbose \ --load $TW5_BUILD_OUTPUT/build.tid \ --output $TW5_BUILD_OUTPUT/languages/de-DE \ --build favicon empty static index \ @@ -431,7 +402,6 @@ node $TW5_BUILD_TIDDLYWIKI \ # /languages/es-ES/empty.html Empty wiki with es-ES language node $TW5_BUILD_TIDDLYWIKI \ ./editions/es-ES \ - --verbose \ --load $TW5_BUILD_OUTPUT/build.tid \ --output $TW5_BUILD_OUTPUT/languages/es-ES \ --build favicon empty static index \ @@ -441,7 +411,6 @@ node $TW5_BUILD_TIDDLYWIKI \ # /languages/fr-FR/empty.html Empty wiki with fr-FR language node $TW5_BUILD_TIDDLYWIKI \ ./editions/fr-FR \ - --verbose \ --load $TW5_BUILD_OUTPUT/build.tid \ --output $TW5_BUILD_OUTPUT/languages/fr-FR \ --build favicon empty static index \ @@ -451,7 +420,6 @@ node $TW5_BUILD_TIDDLYWIKI \ # /languages/ja-JP/empty.html Empty wiki with ja-JP language node $TW5_BUILD_TIDDLYWIKI \ ./editions/ja-JP \ - --verbose \ --load $TW5_BUILD_OUTPUT/build.tid \ --output $TW5_BUILD_OUTPUT/languages/ja-JP \ --build empty index \ @@ -461,7 +429,6 @@ node $TW5_BUILD_TIDDLYWIKI \ # /languages/ko-KR/empty.html Empty wiki with ko-KR language node $TW5_BUILD_TIDDLYWIKI \ ./editions/ko-KR \ - --verbose \ --load $TW5_BUILD_OUTPUT/build.tid \ --output $TW5_BUILD_OUTPUT/languages/ko-KR \ --build favicon empty static index \ @@ -471,7 +438,6 @@ node $TW5_BUILD_TIDDLYWIKI \ # /languages/zh-Hans/empty.html Empty wiki with zh-Hans language node $TW5_BUILD_TIDDLYWIKI \ ./editions/zh-Hans \ - --verbose \ --load $TW5_BUILD_OUTPUT/build.tid \ --output $TW5_BUILD_OUTPUT/languages/zh-Hans \ --build empty index \ @@ -481,7 +447,6 @@ node $TW5_BUILD_TIDDLYWIKI \ # /languages/zh-Hant/empty.html Empty wiki with zh-Hant language node $TW5_BUILD_TIDDLYWIKI \ ./editions/zh-Hant \ - --verbose \ --load $TW5_BUILD_OUTPUT/build.tid \ --output $TW5_BUILD_OUTPUT/languages/zh-Hant \ --build empty index \ @@ -495,7 +460,6 @@ node $TW5_BUILD_TIDDLYWIKI \ node $TW5_BUILD_TIDDLYWIKI \ ./editions/pluginlibrary \ - --verbose \ --load $TW5_BUILD_OUTPUT/build.tid \ --output $TW5_BUILD_OUTPUT/library/$TW5_BUILD_VERSION \ --build library\ diff --git a/boot/boot.js b/boot/boot.js index ea20c83fd..b4bdc00f2 100644 --- a/boot/boot.js +++ b/boot/boot.js @@ -386,8 +386,8 @@ $tw.utils.parseDate = function(value) { parseInt(value.substr(10,2)||"00",10), parseInt(value.substr(12,2)||"00",10), parseInt(value.substr(14,3)||"000",10))); - d.setUTCFullYear(year); // See https://stackoverflow.com/a/5870822 - return d; + d.setUTCFullYear(year); // See https://stackoverflow.com/a/5870822 + return d; } else if($tw.utils.isDate(value)) { return value; } else { diff --git a/boot/bootprefix.js b/boot/bootprefix.js index 0ae236c21..4dae1b28f 100644 --- a/boot/bootprefix.js +++ b/boot/bootprefix.js @@ -21,7 +21,7 @@ $tw.boot = $tw.boot || Object.create(null); // Detect platforms if(!("browser" in $tw)) { - $tw.browser = typeof(window) !== "undefined" ? {} : null; + $tw.browser = typeof(window) !== "undefined" && typeof(document) !== "undefined" ? {} : null; } if(!("node" in $tw)) { $tw.node = typeof(process) === "object" ? {} : null; diff --git a/contributing.md b/contributing.md index 549e862a6..707c34110 100644 --- a/contributing.md +++ b/contributing.md @@ -1,3 +1,3 @@ -

Contributing to TiddlyWiki5

Here we focus on contributions via GitHub Pull Requests but there are many other ways that anyone can help the TiddlyWiki project, such as reporting bugs or helping to improve our documentation.

Rules for Pull Requests

PRs must meet these minimum requirements before they can be considered for merging:

Imperative Mood for PR Titles

The "imperative mood" means written as if giving a command or instruction. See this post for more details, but the gist is that the title of the PR should make sense when used to complete the sentence "If applied, this commit will...". So for example, these are good PR titles:

These a poorly worded PR titles:

PR titles may also include a short prefix to indicate the subsystem to which they apply. For example:

Commenting on Pull Requests

One of the principles of open source is that many pairs of eyes on the code can improve quality. So, we welcome comments and critiques of pending PRs. Conventional Comments has some techniques to help make comments as constructive and actionable as possible. Notably, they recommend prefixing a comment with a label to clarify the intention:

praisePraises highlight something positive. Try to leave at least one of these comments per review. Do not leave false praise (which can actually be damaging). Do look for something to sincerely praise
nitpickNitpicks are small, trivial, but necessary changes. Distinguishing nitpick comments significantly helps direct the reader's attention to comments requiring more involvement
suggestionSuggestions are specific requests to improve the subject under review. It is assumed that we all want to do what's best, so these comments are never dismissed as “mere suggestions”, but are taken seriously
issueIssues represent user-facing problems. If possible, it's great to follow this kind of comment with a suggestion
questionQuestions are appropriate if you have a potential concern but are not quite sure if it's relevant or not. Asking the author for clarification or investigation can lead to a quick resolution
thoughtThoughts represent an idea that popped up from reviewing. These comments are non-blocking by nature, but they are extremely valuable and can lead to more focused initiatives and mentoring opportunities
choreChores are simple tasks that must be done before the subject can be “officially” accepted. Usually, these comments reference some common process. Try to leave a link to the process description so that the reader knows how to resolve the chore

Contributor License Agreement

Like other OpenSource projects, TiddlyWiki5 needs a signed contributor license agreement from individual contributors. This is a legal agreement that allows contributors to assert that they own the copyright of their contribution, and that they agree to license it to the UnaMesa Association (the legal entity that owns TiddlyWiki on behalf of the community).

How to sign the CLA

Create a GitHub pull request to add your name to cla-individual.md or cla-entity.md, with the date in the format (YYYY/MM/DD).

step by step

  1. Navigate to licenses/CLA-individual or licenses/CLA-entity according to whether you are signing as an individual or representative of an organisation
  2. Ensure that the "branch" dropdown at the top left is set to tiddlywiki-com
  3. Click the "edit" button at the top-right corner (clicking this button will fork the project so you can edit the file)
  4. Add your name at the bottom
    • eg: Jeremy Ruston, @Jermolene, 2011/11/22
  5. Below the edit box for the CLA text you should see a box labelled Propose file change
  6. Enter a brief title to explain the change (eg, "Signing the CLA")
  7. Click the green button labelled Propose file change
  8. On the following screen, click the green button labelled Create pull request

The CLA documents used for this project were created using Harmony Project Templates. "HA-CLA-I-LIST Version 1.0" for "CLA-individual" and "HA-CLA-E-LIST Version 1.0" for "CLA-entity". +

Contributing to TiddlyWiki5

Here we focus on contributions via GitHub Pull Requests but there are many other ways that anyone can help the TiddlyWiki project, such as reporting bugs or helping to improve our documentation.

Rules for Pull Requests

PRs must meet these minimum requirements before they can be considered for merging:

Imperative Mood for PR Titles

The "imperative mood" means written as if giving a command or instruction. See this post for more details, but the gist is that the title of the PR should make sense when used to complete the sentence "If applied, this commit will...". So for example, these are good PR titles:

These a poorly worded PR titles:

PR titles may also include a short prefix to indicate the subsystem to which they apply. For example:

Commenting on Pull Requests

One of the principles of open source is that many pairs of eyes on the code can improve quality. So, we welcome comments and critiques of pending PRs. Conventional Comments has some techniques to help make comments as constructive and actionable as possible. Notably, they recommend prefixing a comment with a label to clarify the intention:

praisePraises highlight something positive. Try to leave at least one of these comments per review. Do not leave false praise (which can actually be damaging). Do look for something to sincerely praise
nitpickNitpicks are small, trivial, but necessary changes. Distinguishing nitpick comments significantly helps direct the reader's attention to comments requiring more involvement
suggestionSuggestions are specific requests to improve the subject under review. It is assumed that we all want to do what's best, so these comments are never dismissed as “mere suggestions”, but are taken seriously
issueIssues represent user-facing problems. If possible, it's great to follow this kind of comment with a suggestion
questionQuestions are appropriate if you have a potential concern but are not quite sure if it's relevant or not. Asking the author for clarification or investigation can lead to a quick resolution
thoughtThoughts represent an idea that popped up from reviewing. These comments are non-blocking by nature, but they are extremely valuable and can lead to more focused initiatives and mentoring opportunities
choreChores are simple tasks that must be done before the subject can be “officially” accepted. Usually, these comments reference some common process. Try to leave a link to the process description so that the reader knows how to resolve the chore

Contributor License Agreement

Like other OpenSource projects, TiddlyWiki5 needs a signed contributor license agreement from individual contributors. This is a legal agreement that allows contributors to assert that they own the copyright of their contribution, and that they agree to license it to the UnaMesa Association (the legal entity that owns TiddlyWiki on behalf of the community).

How to sign the CLA

Create a GitHub pull request to add your name to cla-individual.md or cla-entity.md, with the date in the format (YYYY/MM/DD).

step by step

  1. Navigate to licenses/CLA-individual or licenses/CLA-entity according to whether you are signing as an individual or representative of an organisation
  2. Ensure that the "branch" dropdown at the top left is set to tiddlywiki-com
  3. Click the "edit" button at the top-right corner (clicking this button will fork the project so you can edit the file)
  4. Add your name at the bottom
    • eg: Jeremy Ruston, @Jermolene, 2011/11/22
  5. Below the edit box for the CLA text you should see a box labelled Propose file change
  6. Enter a brief title to explain the change (eg, "Signing the CLA")
  7. Click the green button labelled Propose file change
  8. On the following screen, click the green button labelled Create pull request

The CLA documents used for this project were created using Harmony Project Templates. "HA-CLA-I-LIST Version 1.0" for "CLA-individual" and "HA-CLA-E-LIST Version 1.0" for "CLA-entity".

This file was automatically generated by TiddlyWiki5

\ No newline at end of file diff --git a/core/images/discord.tid b/core/images/discord.tid new file mode 100644 index 000000000..7510babb4 --- /dev/null +++ b/core/images/discord.tid @@ -0,0 +1,5 @@ +title: $:/core/images/discord +tags: $:/tags/Image + +\parameters (size:"22pt") +> height=<> class="tc-image-discord tc-image-button" viewBox="0 -28.5 256 256"> \ No newline at end of file diff --git a/core/language/en-GB/Buttons.multids b/core/language/en-GB/Buttons.multids index 15273d18e..2fa732fd9 100644 --- a/core/language/en-GB/Buttons.multids +++ b/core/language/en-GB/Buttons.multids @@ -80,6 +80,7 @@ NewMarkdown/Caption: new Markdown tiddler NewMarkdown/Hint: Create a new Markdown tiddler NewTiddler/Caption: new tiddler NewTiddler/Hint: Create a new tiddler +OpenControlPanel/Hint: Open control panel OpenWindow/Caption: open in new window OpenWindow/Hint: Open tiddler in new window Palette/Caption: palette @@ -132,6 +133,7 @@ Excise/Caption/Replace/Link: link Excise/Caption/Replace/Transclusion: transclusion Excise/Caption/Tag: Tag new tiddler with the title of this tiddler Excise/Caption/TiddlerExists: Warning: tiddler already exists +Excise/DefaultTitle: New Excision Excise/Hint: Excise the selected text into a new tiddler Heading1/Caption: heading 1 Heading1/Hint: Apply heading level 1 formatting to lines containing selection diff --git a/core/language/en-GB/ControlPanel.multids b/core/language/en-GB/ControlPanel.multids index 93cfc3c10..129dab0b4 100644 --- a/core/language/en-GB/ControlPanel.multids +++ b/core/language/en-GB/ControlPanel.multids @@ -96,6 +96,10 @@ Plugins/PluginWillRequireReload: (requires reload) Plugins/Plugins/Caption: Plugins Plugins/Plugins/Hint: Plugins Plugins/Reinstall/Caption: reinstall +Plugins/Stability/Deprecated: DEPRECATED +Plugins/Stability/Experimental: EXPERIMENTAL +Plugins/Stability/Legacy: LEGACY +Plugins/Stability/Stable: STABLE Plugins/Themes/Caption: Themes Plugins/Themes/Hint: Theme plugins Plugins/Update/Caption: update @@ -171,6 +175,8 @@ Settings/NavigationPermalinkviewMode/UpdateAddressBar/Description: Update addres Settings/PerformanceInstrumentation/Caption: Performance Instrumentation Settings/PerformanceInstrumentation/Hint: Displays performance statistics in the browser developer console. Requires reload to take effect Settings/PerformanceInstrumentation/Description: Enable performance instrumentation +Settings/RecentLimit/Caption: Recent Tab Limit +Settings/RecentLimit/Hint: Maximum number of tiddlers to be displayed under the sidebar "Recent" tab Settings/ToolbarButtonStyle/Caption: Toolbar Button Style Settings/ToolbarButtonStyle/Hint: Choose the style for toolbar buttons: Settings/ToolbarButtonStyle/Styles/Borderless: Borderless @@ -198,6 +204,12 @@ Settings/TitleLinks/Yes/Description: Display tiddler titles as links Settings/MissingLinks/Caption: Wiki Links Settings/MissingLinks/Hint: Choose whether to link to tiddlers that do not exist yet 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/PreviewUrl/Preview: Preview image: +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 @@ -235,3 +247,7 @@ ViewTemplateBody/Caption: View Template Body ViewTemplateBody/Hint: This rule cascade is used by the default view template to dynamically choose the template for displaying the body of a tiddler. ViewTemplateTitle/Caption: View Template Title ViewTemplateTitle/Hint: This rule cascade is used by the default view template to dynamically choose the template for displaying the title of a tiddler. +ViewTemplateSubtitle/Caption: View Template Subtitle +ViewTemplateSubtitle/Hint: This rule cascade is used by the default view template to dynamically choose the template for displaying the subtitle of a tiddler. +ViewTemplateTags/Caption: View Template Tags +ViewTemplateTags/Hint: This rule cascade is used by the default view template to dynamically choose the template for displaying the tags area of a tiddler. diff --git a/core/language/en-GB/EditTemplate.multids b/core/language/en-GB/EditTemplate.multids index c4bfa5e56..8b2e6e17a 100644 --- a/core/language/en-GB/EditTemplate.multids +++ b/core/language/en-GB/EditTemplate.multids @@ -26,6 +26,8 @@ Tags/ClearInput/Caption: clear input Tags/ClearInput/Hint: Clear tag input Tags/Dropdown/Caption: tag list Tags/Dropdown/Hint: Show tag list +Tags/EmptyMessage: No tags found +Tags/EmptyMessage/System: No system tags found Title/BadCharacterWarning: Warning: avoid using any of the characters <> in tiddler titles Title/Exists/Prompt: Target tiddler already exists Title/Relink/Prompt: Update ''<$text text=<>/>'' to ''<$text text=<>/>'' in the //tags// and //list// fields of other tiddlers diff --git a/core/language/en-GB/Search.multids b/core/language/en-GB/Search.multids index 2a57a6416..f5aa478bf 100644 --- a/core/language/en-GB/Search.multids +++ b/core/language/en-GB/Search.multids @@ -6,6 +6,8 @@ Filter/Hint: Search via a [[filter expression|https://tiddlywiki.com/static/Filt Filter/Matches: //<> matches// Matches: //<> matches// Matches/All: All matches: +Matches/NoMatch: //No match// +Matches/NoResult: //No search result// Matches/Title: Title matches: Search: Search Search/TooShort: Search text too short diff --git a/core/language/en-GB/Snippets/FunctionDefinition.tid b/core/language/en-GB/Snippets/FunctionDefinition.tid new file mode 100644 index 000000000..e000e38b1 --- /dev/null +++ b/core/language/en-GB/Snippets/FunctionDefinition.tid @@ -0,0 +1,7 @@ +title: $:/language/Snippets/FunctionDefinition +tags: $:/tags/TextEditor/Snippet +caption: Function definition + +\function f.name(param1,param2:"default value") [!is[blank]else] + +<> diff --git a/core/language/en-GB/Snippets/ProcedureDefinition.tid b/core/language/en-GB/Snippets/ProcedureDefinition.tid new file mode 100644 index 000000000..632abcc01 --- /dev/null +++ b/core/language/en-GB/Snippets/ProcedureDefinition.tid @@ -0,0 +1,7 @@ +title: $:/language/Snippets/ProcedureDefinition +tags: $:/tags/TextEditor/Snippet +caption: Procedure definition + +\procedure procName(param1:"default value",param2) +Your text comes here. +\end diff --git a/core/language/en-GB/Types/image_x-icon.tid b/core/language/en-GB/Types/image_x-icon.tid deleted file mode 100644 index 55420387a..000000000 --- a/core/language/en-GB/Types/image_x-icon.tid +++ /dev/null @@ -1,5 +0,0 @@ -title: $:/language/Docs/Types/image/x-icon -description: ICO icon -name: image/x-icon -group: Image -group-sort: 1 diff --git a/core/language/en-GB/Types/text_vnd.tiddlywiki_multiple.tid b/core/language/en-GB/Types/text_vnd.tiddlywiki_multiple.tid new file mode 100644 index 000000000..af15d7ac3 --- /dev/null +++ b/core/language/en-GB/Types/text_vnd.tiddlywiki_multiple.tid @@ -0,0 +1,5 @@ +title: $:/language/Docs/Types/text/vnd.tiddlywiki-multiple +description: Compound tiddler +name: text/vnd.tiddlywiki-multiple +group: Developer +group-sort: 2 diff --git a/core/modules/commands/build.js b/core/modules/commands/build.js index 8471119d7..60456372d 100644 --- a/core/modules/commands/build.js +++ b/core/modules/commands/build.js @@ -24,7 +24,7 @@ var Command = function(params,commander) { Command.prototype.execute = function() { // Get the build targets defined in the wiki - var buildTargets = $tw.boot.wikiInfo.build; + var buildTargets = $tw.boot.wikiInfo && $tw.boot.wikiInfo.build; if(!buildTargets) { return "No build targets defined"; } diff --git a/core/modules/commands/render.js b/core/modules/commands/render.js index b396deef9..bd8b23171 100644 --- a/core/modules/commands/render.js +++ b/core/modules/commands/render.js @@ -45,17 +45,22 @@ Render individual tiddlers and save the results to the specified files variableList = variableList.slice(2); } $tw.utils.each(tiddlers,function(title) { - var filepath = path.resolve(self.commander.outputPath,wiki.filterTiddlers(filenameFilter,$tw.rootWidget,wiki.makeTiddlerIterator([title]))[0]); - if(self.commander.verbose) { - console.log("Rendering \"" + title + "\" to \"" + filepath + "\""); + var filenameResults = wiki.filterTiddlers(filenameFilter,$tw.rootWidget,wiki.makeTiddlerIterator([title])); + if(filenameResults.length > 0) { + var filepath = path.resolve(self.commander.outputPath,filenameResults[0]); + if(self.commander.verbose) { + console.log("Rendering \"" + title + "\" to \"" + filepath + "\""); + } + var parser = wiki.parseTiddler(template || title), + widgetNode = wiki.makeWidget(parser,{variables: $tw.utils.extend({},variables,{currentTiddler: title,storyTiddler: title})}), + container = $tw.fakeDocument.createElement("div"); + widgetNode.render(container,null); + var text = type === "text/html" ? container.innerHTML : container.textContent; + $tw.utils.createFileDirectories(filepath); + fs.writeFileSync(filepath,text,"utf8"); + } else { + console.log("Not rendering \"" + title + "\" because the filename filter returned an empty result"); } - var parser = wiki.parseTiddler(template || title), - widgetNode = wiki.makeWidget(parser,{variables: $tw.utils.extend({},variables,{currentTiddler: title,storyTiddler: title})}), - container = $tw.fakeDocument.createElement("div"); - widgetNode.render(container,null); - var text = type === "text/html" ? container.innerHTML : container.textContent; - $tw.utils.createFileDirectories(filepath); - fs.writeFileSync(filepath,text,"utf8"); }); return null; }; diff --git a/core/modules/config.js b/core/modules/config.js index 399af598b..fdcf94d0f 100644 --- a/core/modules/config.js +++ b/core/modules/config.js @@ -30,7 +30,7 @@ exports.textPrimitives.wikiLink = exports.textPrimitives.upperLetter + "+" + exports.textPrimitives.upperLetter + exports.textPrimitives.anyLetter + "*"; -exports.htmlEntities = {quot:34, dollar:36, amp:38, apos:39, lt:60, gt:62, nbsp:160, iexcl:161, cent:162, pound:163, curren:164, yen:165, brvbar:166, sect:167, uml:168, copy:169, ordf:170, laquo:171, not:172, shy:173, reg:174, macr:175, deg:176, plusmn:177, sup2:178, sup3:179, acute:180, micro:181, para:182, middot:183, cedil:184, sup1:185, ordm:186, raquo:187, frac14:188, frac12:189, frac34:190, iquest:191, Agrave:192, Aacute:193, Acirc:194, Atilde:195, Auml:196, Aring:197, AElig:198, Ccedil:199, Egrave:200, Eacute:201, Ecirc:202, Euml:203, Igrave:204, Iacute:205, Icirc:206, Iuml:207, ETH:208, Ntilde:209, Ograve:210, Oacute:211, Ocirc:212, Otilde:213, Ouml:214, times:215, Oslash:216, Ugrave:217, Uacute:218, Ucirc:219, Uuml:220, Yacute:221, THORN:222, szlig:223, agrave:224, aacute:225, acirc:226, atilde:227, auml:228, aring:229, aelig:230, ccedil:231, egrave:232, eacute:233, ecirc:234, euml:235, igrave:236, iacute:237, icirc:238, iuml:239, eth:240, ntilde:241, ograve:242, oacute:243, ocirc:244, otilde:245, ouml:246, divide:247, oslash:248, ugrave:249, uacute:250, ucirc:251, uuml:252, yacute:253, thorn:254, yuml:255, OElig:338, oelig:339, Scaron:352, scaron:353, Yuml:376, fnof:402, circ:710, tilde:732, Alpha:913, Beta:914, Gamma:915, Delta:916, Epsilon:917, Zeta:918, Eta:919, Theta:920, Iota:921, Kappa:922, Lambda:923, Mu:924, Nu:925, Xi:926, Omicron:927, Pi:928, Rho:929, Sigma:931, Tau:932, Upsilon:933, Phi:934, Chi:935, Psi:936, Omega:937, alpha:945, beta:946, gamma:947, delta:948, epsilon:949, zeta:950, eta:951, theta:952, iota:953, kappa:954, lambda:955, mu:956, nu:957, xi:958, omicron:959, pi:960, rho:961, sigmaf:962, sigma:963, tau:964, upsilon:965, phi:966, chi:967, psi:968, omega:969, thetasym:977, upsih:978, piv:982, ensp:8194, emsp:8195, thinsp:8201, zwnj:8204, zwj:8205, lrm:8206, rlm:8207, ndash:8211, mdash:8212, lsquo:8216, rsquo:8217, sbquo:8218, ldquo:8220, rdquo:8221, bdquo:8222, dagger:8224, Dagger:8225, bull:8226, hellip:8230, permil:8240, prime:8242, Prime:8243, lsaquo:8249, rsaquo:8250, oline:8254, frasl:8260, euro:8364, image:8465, weierp:8472, real:8476, trade:8482, alefsym:8501, larr:8592, uarr:8593, rarr:8594, darr:8595, harr:8596, crarr:8629, lArr:8656, uArr:8657, rArr:8658, dArr:8659, hArr:8660, forall:8704, part:8706, exist:8707, empty:8709, nabla:8711, isin:8712, notin:8713, ni:8715, prod:8719, sum:8721, minus:8722, lowast:8727, radic:8730, prop:8733, infin:8734, ang:8736, and:8743, or:8744, cap:8745, cup:8746, int:8747, there4:8756, sim:8764, cong:8773, asymp:8776, ne:8800, equiv:8801, le:8804, ge:8805, sub:8834, sup:8835, nsub:8836, sube:8838, supe:8839, oplus:8853, otimes:8855, perp:8869, sdot:8901, lceil:8968, rceil:8969, lfloor:8970, rfloor:8971, lang:9001, rang:9002, loz:9674, spades:9824, clubs:9827, hearts:9829, diams:9830 }; +exports.htmlEntities = {quot:34, dollar:36, amp:38, apos:39, lt:60, gt:62, nbsp:160, iexcl:161, cent:162, pound:163, curren:164, yen:165, brvbar:166, sect:167, uml:168, copy:169, ordf:170, laquo:171, not:172, shy:173, reg:174, macr:175, deg:176, plusmn:177, sup2:178, sup3:179, acute:180, micro:181, para:182, middot:183, cedil:184, sup1:185, ordm:186, raquo:187, frac14:188, frac12:189, frac34:190, iquest:191, Agrave:192, Aacute:193, Acirc:194, Atilde:195, Auml:196, Aring:197, AElig:198, Ccedil:199, Egrave:200, Eacute:201, Ecirc:202, Euml:203, Igrave:204, Iacute:205, Icirc:206, Iuml:207, ETH:208, Ntilde:209, Ograve:210, Oacute:211, Ocirc:212, Otilde:213, Ouml:214, times:215, Oslash:216, Ugrave:217, Uacute:218, Ucirc:219, Uuml:220, Yacute:221, THORN:222, szlig:223, agrave:224, aacute:225, acirc:226, atilde:227, auml:228, aring:229, aelig:230, ccedil:231, egrave:232, eacute:233, ecirc:234, euml:235, igrave:236, iacute:237, icirc:238, iuml:239, eth:240, ntilde:241, ograve:242, oacute:243, ocirc:244, otilde:245, ouml:246, divide:247, oslash:248, ugrave:249, uacute:250, ucirc:251, uuml:252, yacute:253, thorn:254, yuml:255, OElig:338, oelig:339, Scaron:352, scaron:353, Yuml:376, fnof:402, circ:710, tilde:732, Alpha:913, Beta:914, Gamma:915, Delta:916, Epsilon:917, Zeta:918, Eta:919, Theta:920, Iota:921, Kappa:922, Lambda:923, Mu:924, Nu:925, Xi:926, Omicron:927, Pi:928, Rho:929, Sigma:931, Tau:932, Upsilon:933, Phi:934, Chi:935, Psi:936, Omega:937, alpha:945, beta:946, gamma:947, delta:948, epsilon:949, zeta:950, eta:951, theta:952, iota:953, kappa:954, lambda:955, mu:956, nu:957, xi:958, omicron:959, pi:960, rho:961, sigmaf:962, sigma:963, tau:964, upsilon:965, phi:966, chi:967, psi:968, omega:969, thetasym:977, upsih:978, piv:982, ensp:8194, emsp:8195, thinsp:8201, zwnj:8204, zwj:8205, lrm:8206, rlm:8207, ndash:8211, mdash:8212, lsquo:8216, rsquo:8217, sbquo:8218, ldquo:8220, rdquo:8221, bdquo:8222, dagger:8224, Dagger:8225, bull:8226, hellip:8230, permil:8240, prime:8242, Prime:8243, lsaquo:8249, rsaquo:8250, oline:8254, frasl:8260, nobreak:8288, NoBreak:8288, euro:8364, image:8465, weierp:8472, real:8476, trade:8482, alefsym:8501, larr:8592, uarr:8593, rarr:8594, darr:8595, harr:8596, crarr:8629, lArr:8656, uArr:8657, rArr:8658, dArr:8659, hArr:8660, forall:8704, part:8706, exist:8707, empty:8709, nabla:8711, isin:8712, notin:8713, ni:8715, prod:8719, sum:8721, minus:8722, lowast:8727, radic:8730, prop:8733, infin:8734, ang:8736, and:8743, or:8744, cap:8745, cup:8746, int:8747, there4:8756, sim:8764, cong:8773, asymp:8776, ne:8800, equiv:8801, le:8804, ge:8805, sub:8834, sup:8835, nsub:8836, sube:8838, supe:8839, oplus:8853, otimes:8855, perp:8869, sdot:8901, lceil:8968, rceil:8969, lfloor:8970, rfloor:8971, lang:9001, rang:9002, loz:9674, spades:9824, clubs:9827, hearts:9829, diams:9830 }; exports.htmlVoidElements = "area,base,br,col,command,embed,hr,img,input,keygen,link,meta,param,source,track,wbr".split(","); diff --git a/core/modules/editor/operations/text/excise.js b/core/modules/editor/operations/text/excise.js index ced771719..0753705c5 100644 --- a/core/modules/editor/operations/text/excise.js +++ b/core/modules/editor/operations/text/excise.js @@ -12,20 +12,27 @@ Text editor operation to excise the selection to a new tiddler /*global $tw: false */ "use strict"; +function isMarkdown(mediaType) { + return mediaType === 'text/markdown' || mediaType === 'text/x-markdown'; +} + exports["excise"] = function(event,operation) { var editTiddler = this.wiki.getTiddler(this.editTitle), - editTiddlerTitle = this.editTitle; + editTiddlerTitle = this.editTitle, + wikiLinks = !isMarkdown(editTiddler.fields.type), + excisionBaseTitle = $tw.language.getString("Buttons/Excise/DefaultTitle"); if(editTiddler && editTiddler.fields["draft.of"]) { editTiddlerTitle = editTiddler.fields["draft.of"]; } - var excisionTitle = event.paramObject.title || this.wiki.generateNewTitle("New Excision"); + var excisionTitle = event.paramObject.title || this.wiki.generateNewTitle(excisionBaseTitle); this.wiki.addTiddler(new $tw.Tiddler( this.wiki.getCreationFields(), this.wiki.getModificationFields(), { title: excisionTitle, text: operation.selection, - tags: event.paramObject.tagnew === "yes" ? [editTiddlerTitle] : [] + tags: event.paramObject.tagnew === "yes" ? [editTiddlerTitle] : [], + type: editTiddler.fields.type } )); operation.replacement = excisionTitle; @@ -34,7 +41,8 @@ exports["excise"] = function(event,operation) { operation.replacement = "{{" + operation.replacement+ "}}"; break; case "link": - operation.replacement = "[[" + operation.replacement+ "]]"; + operation.replacement = wikiLinks ? "[[" + operation.replacement+ "]]" + : ("[" + operation.replacement + "](<#" + operation.replacement + ">)"); break; case "macro": operation.replacement = "<<" + (event.paramObject.macro || "translink") + " \"\"\"" + operation.replacement + "\"\"\">>"; diff --git a/core/modules/editor/operations/text/wrap-selection.js b/core/modules/editor/operations/text/wrap-selection.js index 6800cbe5b..665d72eb4 100644 --- a/core/modules/editor/operations/text/wrap-selection.js +++ b/core/modules/editor/operations/text/wrap-selection.js @@ -13,37 +13,125 @@ Text editor operation to wrap the selection with the specified prefix and suffix "use strict"; exports["wrap-selection"] = function(event,operation) { - if(operation.selStart === operation.selEnd) { - // No selection; check if we're within the prefix/suffix - if(operation.text.substring(operation.selStart - event.paramObject.prefix.length,operation.selStart + event.paramObject.suffix.length) === event.paramObject.prefix + event.paramObject.suffix) { + var o = operation, + prefix = event.paramObject.prefix, + suffix = event.paramObject.suffix, + trimSelection = event.paramObject.trimSelection || "no", + selLength = o.selEnd - o.selStart; + + // This function detects, if trailing spaces are part of the selection __and__ if the user wants to handle them + // Returns "yes", "start", "end", "no" (default) + // yes .. there are trailing spaces at both ends + // start .. there are trailing spaces at the start + // end .. there are trailing spaces at the end + // no .. no trailing spaces are taken into account + var trailingSpaceAt = function(sel) { + var _start, + _end, + result; + // trimSelection is a user parameter, which this evaluations takes into account + switch(trimSelection) { + case "end": + result = (sel.trimEnd().length !== selLength) ? "end" : "no"; + break; + case "yes": + _start = sel.trimStart().length !== selLength; + _end = sel.trimEnd().length !== selLength; + result = (_start && _end) ? "yes" : (_start) ? "start" : (_end) ? "end" : "no"; + break; + case "start": + result = (sel.trimStart().length !== selLength) ? "start" : "no"; + break; + default: + result = "no"; + break; + } + return result; + } + + function togglePrefixSuffix() { + if(o.text.substring(o.selStart - prefix.length, o.selStart + suffix.length) === prefix + suffix) { // Remove the prefix and suffix - operation.cutStart = operation.selStart - event.paramObject.prefix.length; - operation.cutEnd = operation.selEnd + event.paramObject.suffix.length; - operation.replacement = ""; - operation.newSelStart = operation.cutStart; - operation.newSelEnd = operation.newSelStart; + o.cutStart = o.selStart - prefix.length; + o.cutEnd = o.selEnd + suffix.length; + o.replacement = ""; + o.newSelStart = o.cutStart; + o.newSelEnd = o.newSelStart; } else { // Wrap the cursor instead - operation.cutStart = operation.selStart; - operation.cutEnd = operation.selEnd; - operation.replacement = event.paramObject.prefix + event.paramObject.suffix; - operation.newSelStart = operation.selStart + event.paramObject.prefix.length; - operation.newSelEnd = operation.newSelStart; + o.cutStart = o.selStart; + o.cutEnd = o.selEnd; + o.replacement = prefix + suffix; + o.newSelStart = o.selStart + prefix.length; + o.newSelEnd = o.newSelStart; } - } else if(operation.text.substring(operation.selStart,operation.selStart + event.paramObject.prefix.length) === event.paramObject.prefix && operation.text.substring(operation.selEnd - event.paramObject.suffix.length,operation.selEnd) === event.paramObject.suffix) { + } + + // options: lenPrefix, lenSuffix + function removePrefixSuffix(options) { + options = options || {}; + var _lenPrefix = options.lenPrefix || 0; + var _lenSuffix = options.lenSuffix || 0; + + o.cutStart = o.selStart - _lenPrefix; + o.cutEnd = o.selEnd + _lenSuffix; + o.replacement = (_lenPrefix || _lenSuffix) ? o.selection : o.selection.substring(prefix.length, o.selection.length - suffix.length); + o.newSelStart = o.cutStart; + o.newSelEnd = o.cutStart + o.replacement.length; + } + + function addPrefixSuffix() { + // remove trailing space if requested + switch(trailingSpaceAt(o.selection)) { + case "no": + // has no trailing spaces + o.cutStart = o.selStart; + o.cutEnd = o.selEnd; + o.replacement = prefix + o.selection + suffix; + o.newSelStart = o.selStart; + o.newSelEnd = o.selStart + o.replacement.length; + break; + case "yes": + // handle both ends + o.cutStart = o.selEnd - (o.selection.trimStart().length); + o.cutEnd = o.selection.trimEnd().length + o.selStart; + o.replacement = prefix + o.selection.trim() + suffix; + o.newSelStart = o.cutStart; + o.newSelEnd = o.cutStart + o.replacement.length; + break; + case "start": + // handle leading + o.cutStart = o.selEnd - (o.selection.trimStart().length); + o.cutEnd = o.selEnd; + o.replacement = prefix + o.selection.trimStart() + suffix; + o.newSelStart = o.cutStart; + o.newSelEnd = o.cutStart + o.replacement.length; + break; + case "end": + // handle trailing + o.cutStart = o.selStart; + o.cutEnd = o.selection.trimEnd().length + o.selStart; + o.replacement = prefix + o.selection.trimEnd() + suffix; + o.newSelStart = o.selStart; + o.newSelEnd = o.selStart + o.replacement.length; + break; + } + } + + if(o.selStart === o.selEnd) { + // No selection; Create prefix and suffix. Set cursor in between them: ""|"" + togglePrefixSuffix(); + } else if(o.text.substring(o.selStart, o.selStart + prefix.length) === prefix && + o.text.substring(o.selEnd - suffix.length,o.selEnd) === suffix) { // Prefix and suffix are already present, so remove them - operation.cutStart = operation.selStart; - operation.cutEnd = operation.selEnd; - operation.replacement = operation.selection.substring(event.paramObject.prefix.length,operation.selection.length - event.paramObject.suffix.length); - operation.newSelStart = operation.selStart; - operation.newSelEnd = operation.selStart + operation.replacement.length; + removePrefixSuffix(); + } else if(o.text.substring(o.selStart - prefix.length, o.selStart) === prefix && + o.text.substring(o.selEnd, o.selEnd + suffix.length) === suffix) { + // Prefix and suffix are present BUT not selected -> remove them + removePrefixSuffix({"lenPrefix": prefix.length, "lenSuffix": suffix.length}); } else { // Add the prefix and suffix - operation.cutStart = operation.selStart; - operation.cutEnd = operation.selEnd; - operation.replacement = event.paramObject.prefix + operation.selection + event.paramObject.suffix; - operation.newSelStart = operation.selStart; - operation.newSelEnd = operation.selStart + operation.replacement.length; + addPrefixSuffix(); } }; diff --git a/core/modules/filters/encodings.js b/core/modules/filters/encodings.js index a43a15f76..231e4d119 100644 --- a/core/modules/filters/encodings.js +++ b/core/modules/filters/encodings.js @@ -18,8 +18,8 @@ Export our filter functions exports.decodebase64 = function(source,operator,options) { var results = []; - var binary = operator.suffixes && operator.suffixes.indexOf("binary") !== -1; - var urlsafe = operator.suffixes && operator.suffixes.indexOf("urlsafe") !== -1; + var binary = operator.suffixes && operator.suffixes[0].indexOf("binary") !== -1; + var urlsafe = operator.suffixes && operator.suffixes[0].indexOf("urlsafe") !== -1; source(function(tiddler,title) { results.push($tw.utils.base64Decode(title,binary,urlsafe)); }); @@ -28,8 +28,8 @@ exports.decodebase64 = function(source,operator,options) { exports.encodebase64 = function(source,operator,options) { var results = []; - var binary = operator.suffixes && operator.suffixes.indexOf("binary") !== -1; - var urlsafe = operator.suffixes && operator.suffixes.indexOf("urlsafe") !== -1; + var binary = operator.suffixes && operator.suffixes[0].indexOf("binary") !== -1; + var urlsafe = operator.suffixes && operator.suffixes[0].indexOf("urlsafe") !== -1; source(function(tiddler,title) { results.push($tw.utils.base64Encode(title,binary,urlsafe)); }); diff --git a/core/modules/macros/unusedtitle.js b/core/modules/macros/unusedtitle.js index 952bd0264..8a61c425e 100644 --- a/core/modules/macros/unusedtitle.js +++ b/core/modules/macros/unusedtitle.js @@ -16,20 +16,22 @@ exports.name = "unusedtitle"; exports.params = [ {name: "baseName"}, {name: "separator"}, - {name: "template"} + {name: "template"}, + {name: "startCount"} ]; /* Run the macro */ -exports.run = function(baseName,separator,template) { +exports.run = function(baseName,separator,template,startCount) { separator = separator || " "; + startCount = startCount || 0; if(!baseName) { baseName = $tw.language.getString("DefaultNewTiddlerTitle"); } // $tw.wiki.generateNewTitle = function(baseTitle,options) - // options.prefix must be a string! - return this.wiki.generateNewTitle(baseName, {"prefix": separator, "template": template}); + // options.prefix must be a string! + return this.wiki.generateNewTitle(baseName, {"prefix": separator, "template": template, "startCount": startCount}); }; })(); diff --git a/core/modules/parsers/wikiparser/rules/conditional.js b/core/modules/parsers/wikiparser/rules/conditional.js index 23940fd88..c2d6a43b8 100644 --- a/core/modules/parsers/wikiparser/rules/conditional.js +++ b/core/modules/parsers/wikiparser/rules/conditional.js @@ -6,7 +6,7 @@ module-type: wikirule Conditional shortcut syntax ``` -This is a <% if [{something}] %>Elephant<% elseif [{else}] %>Pelican<% else %>Crocodile<% endif %> +This is a <%if [{something}] %>Elephant<%elseif [{else}] %>Pelican<%else%>Crocodile<%endif%> ``` \*/ @@ -27,7 +27,7 @@ exports.init = function(parser) { }; exports.findNextMatch = function(startPos) { - // Look for the next <% if shortcut + // Look for the next <%if shortcut this.matchRegExp.lastIndex = startPos; this.match = this.matchRegExp.exec(this.parser.source); // If not found then return no match diff --git a/core/modules/parsers/wikiparser/rules/table.js b/core/modules/parsers/wikiparser/rules/table.js index 59aa81e91..fbdbb4f9d 100644 --- a/core/modules/parsers/wikiparser/rules/table.js +++ b/core/modules/parsers/wikiparser/rules/table.js @@ -93,11 +93,12 @@ var processRow = function(prevColumns) { } // Check whether this is a heading cell var cell; + var start = this.parser.pos; if(chr === "!") { this.parser.pos++; - cell = {type: "element", tag: "th", children: []}; + cell = {type: "element", tag: "th", start: start, children: []}; } else { - cell = {type: "element", tag: "td", children: []}; + cell = {type: "element", tag: "td", start: start, children: []}; } tree.push(cell); // Record information about this cell @@ -121,6 +122,7 @@ var processRow = function(prevColumns) { } // Move back to the closing `|` this.parser.pos--; + cell.end = this.parser.pos; } col++; cellRegExp.lastIndex = this.parser.pos; @@ -169,12 +171,13 @@ exports.parse = function() { rowContainer.children = this.parser.parseInlineRun(rowTermRegExp,{eatTerminator: true}); } else { // Create the row - var theRow = {type: "element", tag: "tr", children: []}; + var theRow = {type: "element", tag: "tr", children: [], start: rowMatch.index}; $tw.utils.addClassToParseTreeNode(theRow,rowCount%2 ? "oddRow" : "evenRow"); rowContainer.children.push(theRow); // Process the row theRow.children = processRow.call(this,prevColumns); this.parser.pos = rowMatch.index + rowMatch[0].length; + theRow.end = this.parser.pos; // Increment the row count rowCount++; } diff --git a/core/modules/savers/put.js b/core/modules/savers/put.js index de9ba9465..69689e6db 100644 --- a/core/modules/savers/put.js +++ b/core/modules/savers/put.js @@ -20,7 +20,7 @@ Retrieve ETag if available */ var retrieveETag = function(self) { var headers = { - Accept: "*/*;charset=UTF-8" + Accept: "*/*" }; $tw.utils.httpRequest({ url: self.uri(), @@ -48,14 +48,14 @@ var PutSaver = function(wiki) { var self = this; var uri = this.uri(); // Async server probe. Until probe finishes, save will fail fast - // See also https://github.com/Jermolene/TiddlyWiki5/issues/2276 + // See also https://github.com/TiddlyWiki/TiddlyWiki5/issues/2276 $tw.utils.httpRequest({ url: uri, type: "OPTIONS", callback: function(err,data,xhr) { // Check DAV header http://www.webdav.org/specs/rfc2518.html#rfc.section.9.1 if(!err) { - self.serverAcceptsPuts = xhr.status === 200 && !!xhr.getResponseHeader("dav"); + self.serverAcceptsPuts = xhr.status >= 200 && xhr.status < 300 && !!xhr.getResponseHeader("dav"); } } }); diff --git a/core/modules/startup/rootwidget.js b/core/modules/startup/rootwidget.js index d81e07aee..d96d569c3 100644 --- a/core/modules/startup/rootwidget.js +++ b/core/modules/startup/rootwidget.js @@ -52,7 +52,9 @@ exports.startup = function() { basicAuthUsername: params["basic-auth-username"], basicAuthUsernameFromStore: params["basic-auth-username-from-store"], basicAuthPassword: params["basic-auth-password"], - basicAuthPasswordFromStore: params["basic-auth-password-from-store"] + basicAuthPasswordFromStore: params["basic-auth-password-from-store"], + bearerAuthToken: params["bearer-auth-token"], + bearerAuthTokenFromStore: params["bearer-auth-token-from-store"] }); }); $tw.rootWidget.addEventListener("tm-http-cancel-all-requests",function(event) { diff --git a/core/modules/storyviews/classic.js b/core/modules/storyviews/classic.js index c2848c435..a85e458c5 100644 --- a/core/modules/storyviews/classic.js +++ b/core/modules/storyviews/classic.js @@ -30,12 +30,8 @@ ClassicStoryView.prototype.navigateTo = function(historyInfo) { if(!targetElement || targetElement.nodeType === Node.TEXT_NODE) { return; } - if(duration) { - // Scroll the node into view - this.listWidget.dispatchEvent({type: "tm-scroll", target: targetElement}); - } else { - targetElement.scrollIntoView(); - } + // Scroll the node into view + this.listWidget.dispatchEvent({type: "tm-scroll", target: targetElement}); }; ClassicStoryView.prototype.insert = function(widget) { @@ -82,6 +78,10 @@ ClassicStoryView.prototype.remove = function(widget) { removeElement = function() { widget.removeChildDomNodes(); }; + // Blur the focus if it is within the descendents of the node we are removing + if($tw.utils.domContains(targetElement,targetElement.ownerDocument.activeElement)) { + targetElement.ownerDocument.activeElement.blur(); + } // Abandon if the list entry isn't a DOM element (it might be a text node) if(!targetElement || targetElement.nodeType === Node.TEXT_NODE) { removeElement(); diff --git a/core/modules/upgraders/system.js b/core/modules/upgraders/system.js index a93a57712..a653a75b1 100644 --- a/core/modules/upgraders/system.js +++ b/core/modules/upgraders/system.js @@ -12,7 +12,7 @@ Upgrader module that suppresses certain system tiddlers that shouldn't be import /*global $tw: false */ "use strict"; -var DONT_IMPORT_LIST = ["$:/Import"], +var DONT_IMPORT_LIST = ["$:/Import", "$:/build"], UNSELECT_PREFIX_LIST = ["$:/temp/","$:/state/","$:/StoryList","$:/HistoryList"], WARN_IMPORT_PREFIX_LIST = ["$:/core/modules/"]; diff --git a/core/modules/utils/dom/dom.js b/core/modules/utils/dom/dom.js index 4ba037ed5..0b71e128c 100644 --- a/core/modules/utils/dom/dom.js +++ b/core/modules/utils/dom/dom.js @@ -270,6 +270,7 @@ Copy plain text to the clipboard on browsers that support it */ exports.copyToClipboard = function(text,options) { options = options || {}; + text = text || ""; var textArea = document.createElement("textarea"); textArea.style.position = "fixed"; textArea.style.top = 0; @@ -289,7 +290,7 @@ exports.copyToClipboard = function(text,options) { var succeeded = false; try { succeeded = document.execCommand("copy"); - } catch (err) { + } catch(err) { } if(!options.doNotNotify) { var successNotification = options.successNotification || "$:/language/Notifications/CopiedToClipboard/Succeeded", @@ -326,7 +327,7 @@ exports.collectDOMVariables = function(selectedNode,domNode,event) { variables["tv-popup-coords"] = Popup.buildCoordinates(Popup.coordinatePrefix.csOffsetParent,nodeRect); var absRect = $tw.utils.extend({}, nodeRect); - for (var currentNode = selectedNode.offsetParent; currentNode; currentNode = currentNode.offsetParent) { + for(var currentNode = selectedNode.offsetParent; currentNode; currentNode = currentNode.offsetParent) { absRect.left += currentNode.offsetLeft; absRect.top += currentNode.offsetTop; } diff --git a/core/modules/utils/dom/http.js b/core/modules/utils/dom/http.js index 65bdfd1e5..f16f1c512 100644 --- a/core/modules/utils/dom/http.js +++ b/core/modules/utils/dom/http.js @@ -104,6 +104,8 @@ basicAuthUsername: plain username for basic authentication basicAuthUsernameFromStore: name of password store entry containing username basicAuthPassword: plain password for basic authentication basicAuthPasswordFromStore: name of password store entry containing password +bearerAuthToken: plain text token for bearer authentication +bearerAuthTokenFromStore: name of password store entry contain bear authorization token */ function HttpClientRequest(options) { var self = this; @@ -135,8 +137,11 @@ function HttpClientRequest(options) { }); this.basicAuthUsername = options.basicAuthUsername || (options.basicAuthUsernameFromStore && $tw.utils.getPassword(options.basicAuthUsernameFromStore)) || ""; this.basicAuthPassword = options.basicAuthPassword || (options.basicAuthPasswordFromStore && $tw.utils.getPassword(options.basicAuthPasswordFromStore)) || ""; + this.bearerAuthToken = options.bearerAuthToken || (options.bearerAuthTokenFromStore && $tw.utils.getPassword(options.bearerAuthTokenFromStore)) || ""; if(this.basicAuthUsername && this.basicAuthPassword) { this.requestHeaders.Authorization = "Basic " + $tw.utils.base64Encode(this.basicAuthUsername + ":" + this.basicAuthPassword); + } else if(this.bearerAuthToken) { + this.requestHeaders.Authorization = "Bearer " + this.bearerAuthToken; } } diff --git a/core/modules/utils/edition-info.js b/core/modules/utils/edition-info.js index f8a5cab06..b9d97f962 100644 --- a/core/modules/utils/edition-info.js +++ b/core/modules/utils/edition-info.js @@ -29,10 +29,14 @@ exports.getEditionInfo = function() { for(var entryIndex=0; entryIndex