1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2026-01-25 20:33:41 +00:00

Compare commits

..

2 Commits

Author SHA1 Message Date
Jeremy Ruston
0f51406c08 Don't use a fixed ID 2023-09-19 15:06:03 +01:00
Jeremy Ruston
049797b7cf Add barcode reader widget to qrcode plugin 2023-09-16 12:01:49 +01:00
2776 changed files with 11847 additions and 57822 deletions

8
.eslintignore Normal file
View File

@@ -0,0 +1,8 @@
# 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/

View File

@@ -1,317 +0,0 @@
{
"env": {
"browser": true,
"commonjs": true,
"node": true
},
"extends": [
"eslint:recommended"
],
"globals": {
"$tw": "writable"
},
"parserOptions": {
"ecmaVersion": 5
},
"plugins": [],
"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
},
"catch": {
"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": ["warn", { "max": 4, "maxEOF": 0 }],
"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": "error",
"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",
"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"
}
}

283
.eslintrc.yml Normal file
View File

@@ -0,0 +1,283 @@
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"

View File

@@ -21,7 +21,7 @@ body:
attributes: attributes:
label: To Reproduce label: To Reproduce
description: "Steps to reproduce the behavior:" description: "Steps to reproduce the behavior:"
placeholder: | value: |
1. Go to '...' 1. Go to '...'
2. Click on '....' 2. Click on '....'
3. Scroll down to '....' 3. Scroll down to '....'
@@ -41,7 +41,7 @@ body:
attributes: attributes:
label: TiddlyWiki Configuration label: TiddlyWiki Configuration
description: please complete the following information description: please complete the following information
placeholder: | value: |
- Version [e.g. v5.1.24] - Version [e.g. v5.1.24]
- Saving mechanism [e.g. Node.js, TiddlyDesktop, TiddlyHost etc] - Saving mechanism [e.g. Node.js, TiddlyDesktop, TiddlyHost etc]
- Plugins installed [e.g. Freelinks, TiddlyMap] - Plugins installed [e.g. Freelinks, TiddlyMap]

View File

@@ -1,7 +1,7 @@
blank_issues_enabled: false blank_issues_enabled: false
contact_links: contact_links:
- name: Discuss feature request - name: Discuss feature request
url: https://github.com/TiddlyWiki/TiddlyWiki5/discussions url: https://github.com/Jermolene/TiddlyWiki5/discussions
about: Open new discussion about new feature about: Open new discussion about new feature
- name: Talk.Tiddlywiki Forum - name: Talk.Tiddlywiki Forum
url: https://talk.tiddlywiki.org url: https://talk.tiddlywiki.org

View File

@@ -5,22 +5,16 @@ on:
- master - master
- tiddlywiki-com - tiddlywiki-com
env: env:
NODE_VERSION: "22" NODE_VERSION: "12"
jobs: jobs:
test: test:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v2
- uses: actions/setup-node@v4 - uses: actions/setup-node@v1
with: with:
node-version: "${{ env.NODE_VERSION }}" node-version: "${{ env.NODE_VERSION }}"
- run: "./bin/ci-test.sh" - run: "./bin/test.sh"
- uses: actions/upload-artifact@v4
if: always()
with:
name: playwright-report
path: playwright-report/
retention-days: 30
build-prerelease: build-prerelease:
runs-on: ubuntu-latest runs-on: ubuntu-latest
if: github.ref == 'refs/heads/master' if: github.ref == 'refs/heads/master'
@@ -30,8 +24,8 @@ jobs:
TW5_BUILD_MAIN_EDITION: "./editions/prerelease" TW5_BUILD_MAIN_EDITION: "./editions/prerelease"
TW5_BUILD_OUTPUT: "./output/prerelease" TW5_BUILD_OUTPUT: "./output/prerelease"
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v2
- uses: actions/setup-node@v4 - uses: actions/setup-node@v1
with: with:
node-version: "${{ env.NODE_VERSION }}" node-version: "${{ env.NODE_VERSION }}"
- run: "./bin/ci-pre-build.sh" - run: "./bin/ci-pre-build.sh"
@@ -60,10 +54,9 @@ jobs:
TW5_BUILD_TIDDLYWIKI: "./node_modules/tiddlywiki/tiddlywiki.js" TW5_BUILD_TIDDLYWIKI: "./node_modules/tiddlywiki/tiddlywiki.js"
TW5_BUILD_MAIN_EDITION: "./editions/tw5.com" TW5_BUILD_MAIN_EDITION: "./editions/tw5.com"
TW5_BUILD_OUTPUT: "./output" TW5_BUILD_OUTPUT: "./output"
TW5_BUILD_ARCHIVE: "./output"
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v2
- uses: actions/setup-node@v4 - uses: actions/setup-node@v1
with: with:
node-version: "${{ env.NODE_VERSION }}" node-version: "${{ env.NODE_VERSION }}"
- run: "./bin/ci-pre-build.sh" - run: "./bin/ci-pre-build.sh"

View File

@@ -1,30 +0,0 @@
name: Check CLA Signature
on:
pull_request_target:
types:
- opened
- reopened
paths-ignore:
- 'licenses/cla-individual.md'
jobs:
check_cla:
runs-on: ubuntu-latest
permissions:
pull-requests: write
if: ${{ (github.event.pull_request.user.login != github.repository_owner) }}
steps:
- run: |
if ! curl -s https://raw.githubusercontent.com/Jermolene/TiddlyWiki5/tiddlywiki-com/licenses/cla-individual.md | grep -io "@$USER,"; then
echo "CLA not signed"
gh pr comment "$NUMBER" -b "@$USER It appears that this is your first contribution to the project, welcome.
With apologies for the bureaucracy, please could you prepare a separate PR to the 'tiddlywiki-com' branch with your signature for the Contributor License Agreement (see [contributing.md](https://github.com/TiddlyWiki/TiddlyWiki5/blob/master/contributing.md))."
else
echo "CLA already signed"
gh pr comment "$NUMBER" -b "Confirmed: **$USER** has already signed the Contributor License Agreement (see [contributing.md](https://github.com/TiddlyWiki/TiddlyWiki5/blob/master/contributing.md))"
fi
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_REPO: ${{ github.repository }}
NUMBER: ${{ github.event.pull_request.number }}
USER: ${{ github.actor }}

View File

@@ -1,70 +0,0 @@
name: CLA Signed
on:
pull_request_target:
types:
- opened
- closed
paths:
- 'licenses/cla-individual.md'
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_REPO: ${{ github.repository }}
NUMBER: ${{ github.event.pull_request.number }}
AUTHOR: ${{ github.event.pull_request.user.login }}
jobs:
# check if PRs updating the CLA are targetting the tiddlywiki-com branch
check-signature-branch:
if: (github.event.pull_request.merged != true) && (github.event.pull_request.user.login != github.repository_owner)
runs-on: ubuntu-latest
permissions:
pull-requests: write
steps:
- run: |
if [[ "$BRANCH" != "tiddlywiki-com" ]]; then
echo "This CLA signature targets the wrong branch: $BRANCH"
gh pr comment "$NUMBER" -b "@$AUTHOR Signatures to the CLA must target the 'tiddlywiki-com' branch."
fi
env:
BRANCH: ${{ github.event.pull_request.base.ref }}
# leave a comment on each open PR by a given author when their signature is added to the CLA
cla-signed:
if: (github.event.pull_request.merged == true) && (github.event.pull_request.user.login != github.repository_owner)
runs-on: ubuntu-latest
permissions:
pull-requests: write
steps:
- name: List open PRs by user
id: list-prs
uses: actions/github-script@v6
with:
result-encoding: string
script: |
const owner = context.repo.owner,
repo = context.repo.repo,
author = context.payload.pull_request.user.login;
const { data: pullRequests } = await github.rest.pulls.list({
owner: owner,
repo: repo,
state: 'open',
sort: 'created',
direction: 'desc',
per_page: 100
});
const userPullRequests = pullRequests.filter(pr => pr.user.login === author),
prNumbers = userPullRequests.map(pr => pr.number).join(',');
console.log(`Open pull requests by ${author}:${prNumbers}`);
return prNumbers;
- name: Comment open PRs by the same author
run: |
prs=($(echo ${{ steps.list-prs.outputs.result }} | tr "," "\n"))
for number in "${prs[@]}"
do
gh pr comment "$number" -b "**$AUTHOR** has signed the Contributor License Agreement (see [contributing.md](https://github.com/TiddlyWiki/TiddlyWiki5/blob/master/contributing.md))"
done

5
.gitignore vendored
View File

@@ -5,7 +5,4 @@
tmp/ tmp/
output/ output/
node_modules/ node_modules/
/test-results/
/playwright-report/
/playwright/.cache/
$__StoryList.tid

View File

@@ -5,7 +5,7 @@
# Default to the current version number for building the plugin library # Default to the current version number for building the plugin library
if [ -z "$TW5_BUILD_VERSION" ]; then if [ -z "$TW5_BUILD_VERSION" ]; then
TW5_BUILD_VERSION=v5.3.7 TW5_BUILD_VERSION=v5.3.2
fi fi
echo "Using TW5_BUILD_VERSION as [$TW5_BUILD_VERSION]" echo "Using TW5_BUILD_VERSION as [$TW5_BUILD_VERSION]"
@@ -84,41 +84,24 @@ echo -e -n "title: $:/build\ncommit: $TW5_BUILD_COMMIT\n\n$TW5_BUILD_DETAILS\n"
###################################################### ######################################################
# #
# Core distributions # Core distribution
# #
###################################################### ######################################################
# Conditionally build archive if $TW5_BUILD_ARCHIVE variable is set, otherwise do nothing
#
# /archive/Empty-TiddlyWiki-<version>.html Empty archived version
# /archive/TiddlyWiki-<version>.html Full archived version
if [ -n "$TW5_BUILD_ARCHIVE" ]; then
node $TW5_BUILD_TIDDLYWIKI \
$TW5_BUILD_MAIN_EDITION \
--version \
--load $TW5_BUILD_OUTPUT/build.tid \
--output $TW5_BUILD_ARCHIVE \
--build archive \
|| exit 1
fi
# /index.html Main site # /index.html Main site
# /external-(version).html External core version of main site
# /favicon.ico Favicon for main site # /favicon.ico Favicon for main site
# /static.html Static rendering of default tiddlers # /static.html Static rendering of default tiddlers
# /alltiddlers.html Static rendering of all tiddlers # /alltiddlers.html Static rendering of all tiddlers
# /static/* Static single tiddlers # /static/* Static single tiddlers
# /static/static.css Static stylesheet # /static/static.css Static stylesheet
# /static/favicon.ico Favicon for static pages # /static/favicon.ico Favicon for static pages
node $TW5_BUILD_TIDDLYWIKI \ node $TW5_BUILD_TIDDLYWIKI \
$TW5_BUILD_MAIN_EDITION \ $TW5_BUILD_MAIN_EDITION \
--verbose \
--version \ --version \
--load $TW5_BUILD_OUTPUT/build.tid \ --load $TW5_BUILD_OUTPUT/build.tid \
--output $TW5_BUILD_OUTPUT \ --output $TW5_BUILD_OUTPUT \
--build favicon static index external-js \ --build favicon static index \
|| exit 1 || exit 1
# /empty.html Empty # /empty.html Empty
@@ -127,6 +110,7 @@ node $TW5_BUILD_TIDDLYWIKI \
# /tiddlywikicore-<version>.js Core plugin javascript # /tiddlywikicore-<version>.js Core plugin javascript
node $TW5_BUILD_TIDDLYWIKI \ node $TW5_BUILD_TIDDLYWIKI \
./editions/empty \ ./editions/empty \
--verbose \
--output $TW5_BUILD_OUTPUT \ --output $TW5_BUILD_OUTPUT \
--build empty emptyexternalcore \ --build empty emptyexternalcore \
|| exit 1 || exit 1
@@ -135,6 +119,7 @@ node $TW5_BUILD_TIDDLYWIKI \
# /test.html Test edition # /test.html Test edition
node $TW5_BUILD_TIDDLYWIKI \ node $TW5_BUILD_TIDDLYWIKI \
./editions/test \ ./editions/test \
--verbose \
--output $TW5_BUILD_OUTPUT \ --output $TW5_BUILD_OUTPUT \
--rendertiddler $:/core/save/all test.html text/plain \ --rendertiddler $:/core/save/all test.html text/plain \
|| exit 1 || exit 1
@@ -147,21 +132,16 @@ node $TW5_BUILD_TIDDLYWIKI \
# /dev/static/static.css Static stylesheet # /dev/static/static.css Static stylesheet
node $TW5_BUILD_TIDDLYWIKI \ node $TW5_BUILD_TIDDLYWIKI \
./editions/dev \ ./editions/dev \
--verbose \
--load $TW5_BUILD_OUTPUT/build.tid \ --load $TW5_BUILD_OUTPUT/build.tid \
--output $TW5_BUILD_OUTPUT/dev \ --output $TW5_BUILD_OUTPUT/dev \
--build index favicon static \ --build index favicon static \
|| exit 1 || exit 1
# /tour.html tour edition
node $TW5_BUILD_TIDDLYWIKI \
./editions/tour \
--output $TW5_BUILD_OUTPUT \
--rendertiddler $:/core/save/all tour.html text/plain \
|| exit 1
# /share.html Custom edition for sharing via the URL # /share.html Custom edition for sharing via the URL
node $TW5_BUILD_TIDDLYWIKI \ node $TW5_BUILD_TIDDLYWIKI \
./editions/share \ ./editions/share \
--verbose \
--load $TW5_BUILD_OUTPUT/build.tid \ --load $TW5_BUILD_OUTPUT/build.tid \
--output $TW5_BUILD_OUTPUT \ --output $TW5_BUILD_OUTPUT \
--build share \ --build share \
@@ -170,6 +150,7 @@ node $TW5_BUILD_TIDDLYWIKI \
# /upgrade.html Custom edition for performing upgrades # /upgrade.html Custom edition for performing upgrades
node $TW5_BUILD_TIDDLYWIKI \ node $TW5_BUILD_TIDDLYWIKI \
./editions/upgrade \ ./editions/upgrade \
--verbose \
--load $TW5_BUILD_OUTPUT/build.tid \ --load $TW5_BUILD_OUTPUT/build.tid \
--output $TW5_BUILD_OUTPUT \ --output $TW5_BUILD_OUTPUT \
--build upgrade \ --build upgrade \
@@ -178,6 +159,7 @@ node $TW5_BUILD_TIDDLYWIKI \
# /encrypted.html Copy of the main file encrypted with the password "password" # /encrypted.html Copy of the main file encrypted with the password "password"
node $TW5_BUILD_TIDDLYWIKI \ node $TW5_BUILD_TIDDLYWIKI \
$TW5_BUILD_MAIN_EDITION \ $TW5_BUILD_MAIN_EDITION \
--verbose \
--load $TW5_BUILD_OUTPUT/build.tid \ --load $TW5_BUILD_OUTPUT/build.tid \
--output $TW5_BUILD_OUTPUT \ --output $TW5_BUILD_OUTPUT \
--build encrypted \ --build encrypted \
@@ -193,6 +175,7 @@ node $TW5_BUILD_TIDDLYWIKI \
# /editions/xlsx-utils/index.html xlsx-utils edition # /editions/xlsx-utils/index.html xlsx-utils edition
node $TW5_BUILD_TIDDLYWIKI \ node $TW5_BUILD_TIDDLYWIKI \
./editions/xlsx-utils \ ./editions/xlsx-utils \
--verbose \
--load $TW5_BUILD_OUTPUT/build.tid \ --load $TW5_BUILD_OUTPUT/build.tid \
--output $TW5_BUILD_OUTPUT/editions/xlsx-utils/ \ --output $TW5_BUILD_OUTPUT/editions/xlsx-utils/ \
--build index \ --build index \
@@ -201,6 +184,7 @@ node $TW5_BUILD_TIDDLYWIKI \
# /editions/resumebuilder/index.html Resume builder edition # /editions/resumebuilder/index.html Resume builder edition
node $TW5_BUILD_TIDDLYWIKI \ node $TW5_BUILD_TIDDLYWIKI \
./editions/resumebuilder \ ./editions/resumebuilder \
--verbose \
--load $TW5_BUILD_OUTPUT/build.tid \ --load $TW5_BUILD_OUTPUT/build.tid \
--output $TW5_BUILD_OUTPUT/editions/resumebuilder/ \ --output $TW5_BUILD_OUTPUT/editions/resumebuilder/ \
--build index \ --build index \
@@ -209,6 +193,7 @@ node $TW5_BUILD_TIDDLYWIKI \
# /editions/text-slicer/index.html Text slicer edition # /editions/text-slicer/index.html Text slicer edition
node $TW5_BUILD_TIDDLYWIKI \ node $TW5_BUILD_TIDDLYWIKI \
./editions/text-slicer \ ./editions/text-slicer \
--verbose \
--load $TW5_BUILD_OUTPUT/build.tid \ --load $TW5_BUILD_OUTPUT/build.tid \
--output $TW5_BUILD_OUTPUT/editions/text-slicer/ \ --output $TW5_BUILD_OUTPUT/editions/text-slicer/ \
--build index \ --build index \
@@ -217,6 +202,7 @@ node $TW5_BUILD_TIDDLYWIKI \
# /editions/translators/index.html Translators edition # /editions/translators/index.html Translators edition
node $TW5_BUILD_TIDDLYWIKI \ node $TW5_BUILD_TIDDLYWIKI \
./editions/translators \ ./editions/translators \
--verbose \
--load $TW5_BUILD_OUTPUT/build.tid \ --load $TW5_BUILD_OUTPUT/build.tid \
--output $TW5_BUILD_OUTPUT/editions/translators/ \ --output $TW5_BUILD_OUTPUT/editions/translators/ \
--build index \ --build index \
@@ -225,6 +211,7 @@ node $TW5_BUILD_TIDDLYWIKI \
# /editions/introduction/index.html Introduction edition # /editions/introduction/index.html Introduction edition
node $TW5_BUILD_TIDDLYWIKI \ node $TW5_BUILD_TIDDLYWIKI \
./editions/introduction \ ./editions/introduction \
--verbose \
--load $TW5_BUILD_OUTPUT/build.tid \ --load $TW5_BUILD_OUTPUT/build.tid \
--output $TW5_BUILD_OUTPUT/editions/introduction/ \ --output $TW5_BUILD_OUTPUT/editions/introduction/ \
--build index \ --build index \
@@ -233,6 +220,7 @@ node $TW5_BUILD_TIDDLYWIKI \
# /editions/full/index.html Full edition # /editions/full/index.html Full edition
node $TW5_BUILD_TIDDLYWIKI \ node $TW5_BUILD_TIDDLYWIKI \
./editions/full \ ./editions/full \
--verbose \
--load $TW5_BUILD_OUTPUT/build.tid \ --load $TW5_BUILD_OUTPUT/build.tid \
--output $TW5_BUILD_OUTPUT/editions/full/ \ --output $TW5_BUILD_OUTPUT/editions/full/ \
--build index \ --build index \
@@ -241,6 +229,7 @@ node $TW5_BUILD_TIDDLYWIKI \
# /editions/tw5.com-docs/index.html tiddlywiki.com docs edition # /editions/tw5.com-docs/index.html tiddlywiki.com docs edition
node $TW5_BUILD_TIDDLYWIKI \ node $TW5_BUILD_TIDDLYWIKI \
./editions/tw5.com-docs \ ./editions/tw5.com-docs \
--verbose \
--load $TW5_BUILD_OUTPUT/build.tid \ --load $TW5_BUILD_OUTPUT/build.tid \
--output $TW5_BUILD_OUTPUT/editions/tw5.com-docs/ \ --output $TW5_BUILD_OUTPUT/editions/tw5.com-docs/ \
--build index \ --build index \
@@ -249,6 +238,7 @@ node $TW5_BUILD_TIDDLYWIKI \
# /editions/twitter-archivist/index.html Twitter Archivist edition # /editions/twitter-archivist/index.html Twitter Archivist edition
node $TW5_BUILD_TIDDLYWIKI \ node $TW5_BUILD_TIDDLYWIKI \
./editions/twitter-archivist \ ./editions/twitter-archivist \
--verbose \
--load $TW5_BUILD_OUTPUT/build.tid \ --load $TW5_BUILD_OUTPUT/build.tid \
--output $TW5_BUILD_OUTPUT/editions/twitter-archivist/ \ --output $TW5_BUILD_OUTPUT/editions/twitter-archivist/ \
--build index \ --build index \
@@ -264,6 +254,7 @@ node $TW5_BUILD_TIDDLYWIKI \
node $TW5_BUILD_TIDDLYWIKI \ node $TW5_BUILD_TIDDLYWIKI \
./editions/innerwikidemo \ ./editions/innerwikidemo \
--verbose \
--load $TW5_BUILD_OUTPUT/build.tid \ --load $TW5_BUILD_OUTPUT/build.tid \
--output $TW5_BUILD_OUTPUT \ --output $TW5_BUILD_OUTPUT \
--rendertiddler $:/core/save/all plugins/tiddlywiki/innerwiki/index.html text/plain \ --rendertiddler $:/core/save/all plugins/tiddlywiki/innerwiki/index.html text/plain \
@@ -274,6 +265,7 @@ node $TW5_BUILD_TIDDLYWIKI \
node $TW5_BUILD_TIDDLYWIKI \ node $TW5_BUILD_TIDDLYWIKI \
./editions/dynaviewdemo \ ./editions/dynaviewdemo \
--verbose \
--load $TW5_BUILD_OUTPUT/build.tid \ --load $TW5_BUILD_OUTPUT/build.tid \
--output $TW5_BUILD_OUTPUT \ --output $TW5_BUILD_OUTPUT \
--rendertiddler $:/core/save/all plugins/tiddlywiki/dynaview/index.html text/plain \ --rendertiddler $:/core/save/all plugins/tiddlywiki/dynaview/index.html text/plain \
@@ -288,6 +280,7 @@ node $TW5_BUILD_TIDDLYWIKI \
node $TW5_BUILD_TIDDLYWIKI \ node $TW5_BUILD_TIDDLYWIKI \
./editions/katexdemo \ ./editions/katexdemo \
--verbose \
--load $TW5_BUILD_OUTPUT/build.tid \ --load $TW5_BUILD_OUTPUT/build.tid \
--output $TW5_BUILD_OUTPUT \ --output $TW5_BUILD_OUTPUT \
--rendertiddler $:/core/save/all plugins/tiddlywiki/katex/index.html text/plain \ --rendertiddler $:/core/save/all plugins/tiddlywiki/katex/index.html text/plain \
@@ -298,6 +291,7 @@ node $TW5_BUILD_TIDDLYWIKI \
# /plugins/tiddlywiki/tahoelafs/empty.html Empty wiki with Tahoe-LAFS plugin # /plugins/tiddlywiki/tahoelafs/empty.html Empty wiki with Tahoe-LAFS plugin
node $TW5_BUILD_TIDDLYWIKI \ node $TW5_BUILD_TIDDLYWIKI \
./editions/tahoelafs \ ./editions/tahoelafs \
--verbose \
--load $TW5_BUILD_OUTPUT/build.tid \ --load $TW5_BUILD_OUTPUT/build.tid \
--output $TW5_BUILD_OUTPUT \ --output $TW5_BUILD_OUTPUT \
--rendertiddler $:/core/save/all plugins/tiddlywiki/tahoelafs/index.html text/plain \ --rendertiddler $:/core/save/all plugins/tiddlywiki/tahoelafs/index.html text/plain \
@@ -308,6 +302,7 @@ node $TW5_BUILD_TIDDLYWIKI \
# /plugins/tiddlywiki/d3/empty.html Empty wiki with D3 plugin # /plugins/tiddlywiki/d3/empty.html Empty wiki with D3 plugin
node $TW5_BUILD_TIDDLYWIKI \ node $TW5_BUILD_TIDDLYWIKI \
./editions/d3demo \ ./editions/d3demo \
--verbose \
--load $TW5_BUILD_OUTPUT/build.tid \ --load $TW5_BUILD_OUTPUT/build.tid \
--output $TW5_BUILD_OUTPUT \ --output $TW5_BUILD_OUTPUT \
--rendertiddler $:/core/save/all plugins/tiddlywiki/d3/index.html text/plain \ --rendertiddler $:/core/save/all plugins/tiddlywiki/d3/index.html text/plain \
@@ -318,6 +313,7 @@ node $TW5_BUILD_TIDDLYWIKI \
# /plugins/tiddlywiki/codemirror/empty.html Empty wiki with codemirror plugin # /plugins/tiddlywiki/codemirror/empty.html Empty wiki with codemirror plugin
node $TW5_BUILD_TIDDLYWIKI \ node $TW5_BUILD_TIDDLYWIKI \
./editions/codemirrordemo \ ./editions/codemirrordemo \
--verbose \
--load $TW5_BUILD_OUTPUT/build.tid \ --load $TW5_BUILD_OUTPUT/build.tid \
--output $TW5_BUILD_OUTPUT \ --output $TW5_BUILD_OUTPUT \
--rendertiddler $:/core/save/all plugins/tiddlywiki/codemirror/index.html text/plain \ --rendertiddler $:/core/save/all plugins/tiddlywiki/codemirror/index.html text/plain \
@@ -328,6 +324,7 @@ node $TW5_BUILD_TIDDLYWIKI \
# /plugins/tiddlywiki/markdown/empty.html Empty wiki with Markdown plugin # /plugins/tiddlywiki/markdown/empty.html Empty wiki with Markdown plugin
node $TW5_BUILD_TIDDLYWIKI \ node $TW5_BUILD_TIDDLYWIKI \
./editions/markdowndemo \ ./editions/markdowndemo \
--verbose \
--load $TW5_BUILD_OUTPUT/build.tid \ --load $TW5_BUILD_OUTPUT/build.tid \
--output $TW5_BUILD_OUTPUT \ --output $TW5_BUILD_OUTPUT \
--rendertiddler $:/core/save/all plugins/tiddlywiki/markdown/index.html text/plain \ --rendertiddler $:/core/save/all plugins/tiddlywiki/markdown/index.html text/plain \
@@ -338,6 +335,7 @@ node $TW5_BUILD_TIDDLYWIKI \
# /plugins/tiddlywiki/tw2parser/empty.html Empty wiki with tw2parser plugin # /plugins/tiddlywiki/tw2parser/empty.html Empty wiki with tw2parser plugin
node $TW5_BUILD_TIDDLYWIKI \ node $TW5_BUILD_TIDDLYWIKI \
./editions/classicparserdemo \ ./editions/classicparserdemo \
--verbose \
--load $TW5_BUILD_OUTPUT/build.tid \ --load $TW5_BUILD_OUTPUT/build.tid \
--output $TW5_BUILD_OUTPUT \ --output $TW5_BUILD_OUTPUT \
--rendertiddler $:/core/save/all plugins/tiddlywiki/tw2parser/index.html text/plain \ --rendertiddler $:/core/save/all plugins/tiddlywiki/tw2parser/index.html text/plain \
@@ -348,22 +346,13 @@ node $TW5_BUILD_TIDDLYWIKI \
# /plugins/tiddlywiki/highlight/empty.html Empty wiki with highlight plugin # /plugins/tiddlywiki/highlight/empty.html Empty wiki with highlight plugin
node $TW5_BUILD_TIDDLYWIKI \ node $TW5_BUILD_TIDDLYWIKI \
./editions/highlightdemo \ ./editions/highlightdemo \
--verbose \
--load $TW5_BUILD_OUTPUT/build.tid \ --load $TW5_BUILD_OUTPUT/build.tid \
--output $TW5_BUILD_OUTPUT \ --output $TW5_BUILD_OUTPUT \
--rendertiddler $:/core/save/all plugins/tiddlywiki/highlight/index.html text/plain \ --rendertiddler $:/core/save/all plugins/tiddlywiki/highlight/index.html text/plain \
--rendertiddler $:/core/save/empty plugins/tiddlywiki/highlight/empty.html text/plain \ --rendertiddler $:/core/save/empty plugins/tiddlywiki/highlight/empty.html text/plain \
|| exit 1 || exit 1
# /plugins/tiddlywiki/geospatial/index.html Demo wiki with geospatial plugin
# /plugins/tiddlywiki/geospatial/empty.html Empty wiki with geospatial plugin
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/empty plugins/tiddlywiki/geospatial/empty.html text/plain \
|| exit 1
###################################################### ######################################################
# #
# Language editions # Language editions
@@ -385,6 +374,7 @@ rm -rf $TW5_BUILD_OUTPUT/languages/zh-Hant/static/*
# /languages/de-AT/empty.html Empty wiki with de-AT language # /languages/de-AT/empty.html Empty wiki with de-AT language
node $TW5_BUILD_TIDDLYWIKI \ node $TW5_BUILD_TIDDLYWIKI \
./editions/de-AT \ ./editions/de-AT \
--verbose \
--load $TW5_BUILD_OUTPUT/build.tid \ --load $TW5_BUILD_OUTPUT/build.tid \
--output $TW5_BUILD_OUTPUT/languages/de-AT \ --output $TW5_BUILD_OUTPUT/languages/de-AT \
--build favicon empty static index \ --build favicon empty static index \
@@ -394,6 +384,7 @@ node $TW5_BUILD_TIDDLYWIKI \
# /languages/de-DE/empty.html Empty wiki with de-DE language # /languages/de-DE/empty.html Empty wiki with de-DE language
node $TW5_BUILD_TIDDLYWIKI \ node $TW5_BUILD_TIDDLYWIKI \
./editions/de-DE \ ./editions/de-DE \
--verbose \
--load $TW5_BUILD_OUTPUT/build.tid \ --load $TW5_BUILD_OUTPUT/build.tid \
--output $TW5_BUILD_OUTPUT/languages/de-DE \ --output $TW5_BUILD_OUTPUT/languages/de-DE \
--build favicon empty static index \ --build favicon empty static index \
@@ -403,6 +394,7 @@ node $TW5_BUILD_TIDDLYWIKI \
# /languages/es-ES/empty.html Empty wiki with es-ES language # /languages/es-ES/empty.html Empty wiki with es-ES language
node $TW5_BUILD_TIDDLYWIKI \ node $TW5_BUILD_TIDDLYWIKI \
./editions/es-ES \ ./editions/es-ES \
--verbose \
--load $TW5_BUILD_OUTPUT/build.tid \ --load $TW5_BUILD_OUTPUT/build.tid \
--output $TW5_BUILD_OUTPUT/languages/es-ES \ --output $TW5_BUILD_OUTPUT/languages/es-ES \
--build favicon empty static index \ --build favicon empty static index \
@@ -412,6 +404,7 @@ node $TW5_BUILD_TIDDLYWIKI \
# /languages/fr-FR/empty.html Empty wiki with fr-FR language # /languages/fr-FR/empty.html Empty wiki with fr-FR language
node $TW5_BUILD_TIDDLYWIKI \ node $TW5_BUILD_TIDDLYWIKI \
./editions/fr-FR \ ./editions/fr-FR \
--verbose \
--load $TW5_BUILD_OUTPUT/build.tid \ --load $TW5_BUILD_OUTPUT/build.tid \
--output $TW5_BUILD_OUTPUT/languages/fr-FR \ --output $TW5_BUILD_OUTPUT/languages/fr-FR \
--build favicon empty static index \ --build favicon empty static index \
@@ -421,6 +414,7 @@ node $TW5_BUILD_TIDDLYWIKI \
# /languages/ja-JP/empty.html Empty wiki with ja-JP language # /languages/ja-JP/empty.html Empty wiki with ja-JP language
node $TW5_BUILD_TIDDLYWIKI \ node $TW5_BUILD_TIDDLYWIKI \
./editions/ja-JP \ ./editions/ja-JP \
--verbose \
--load $TW5_BUILD_OUTPUT/build.tid \ --load $TW5_BUILD_OUTPUT/build.tid \
--output $TW5_BUILD_OUTPUT/languages/ja-JP \ --output $TW5_BUILD_OUTPUT/languages/ja-JP \
--build empty index \ --build empty index \
@@ -430,6 +424,7 @@ node $TW5_BUILD_TIDDLYWIKI \
# /languages/ko-KR/empty.html Empty wiki with ko-KR language # /languages/ko-KR/empty.html Empty wiki with ko-KR language
node $TW5_BUILD_TIDDLYWIKI \ node $TW5_BUILD_TIDDLYWIKI \
./editions/ko-KR \ ./editions/ko-KR \
--verbose \
--load $TW5_BUILD_OUTPUT/build.tid \ --load $TW5_BUILD_OUTPUT/build.tid \
--output $TW5_BUILD_OUTPUT/languages/ko-KR \ --output $TW5_BUILD_OUTPUT/languages/ko-KR \
--build favicon empty static index \ --build favicon empty static index \
@@ -439,6 +434,7 @@ node $TW5_BUILD_TIDDLYWIKI \
# /languages/zh-Hans/empty.html Empty wiki with zh-Hans language # /languages/zh-Hans/empty.html Empty wiki with zh-Hans language
node $TW5_BUILD_TIDDLYWIKI \ node $TW5_BUILD_TIDDLYWIKI \
./editions/zh-Hans \ ./editions/zh-Hans \
--verbose \
--load $TW5_BUILD_OUTPUT/build.tid \ --load $TW5_BUILD_OUTPUT/build.tid \
--output $TW5_BUILD_OUTPUT/languages/zh-Hans \ --output $TW5_BUILD_OUTPUT/languages/zh-Hans \
--build empty index \ --build empty index \
@@ -448,6 +444,7 @@ node $TW5_BUILD_TIDDLYWIKI \
# /languages/zh-Hant/empty.html Empty wiki with zh-Hant language # /languages/zh-Hant/empty.html Empty wiki with zh-Hant language
node $TW5_BUILD_TIDDLYWIKI \ node $TW5_BUILD_TIDDLYWIKI \
./editions/zh-Hant \ ./editions/zh-Hant \
--verbose \
--load $TW5_BUILD_OUTPUT/build.tid \ --load $TW5_BUILD_OUTPUT/build.tid \
--output $TW5_BUILD_OUTPUT/languages/zh-Hant \ --output $TW5_BUILD_OUTPUT/languages/zh-Hant \
--build empty index \ --build empty index \
@@ -461,6 +458,7 @@ node $TW5_BUILD_TIDDLYWIKI \
node $TW5_BUILD_TIDDLYWIKI \ node $TW5_BUILD_TIDDLYWIKI \
./editions/pluginlibrary \ ./editions/pluginlibrary \
--verbose \
--load $TW5_BUILD_OUTPUT/build.tid \ --load $TW5_BUILD_OUTPUT/build.tid \
--output $TW5_BUILD_OUTPUT/library/$TW5_BUILD_VERSION \ --output $TW5_BUILD_OUTPUT/library/$TW5_BUILD_VERSION \
--build library\ --build library\

View File

@@ -7,4 +7,4 @@ npm --force install tiddlywiki || exit 1
# Pull existing GitHub pages content # Pull existing GitHub pages content
git clone --depth=1 --branch=master "https://github.com/TiddlyWiki/tiddlywiki.com-gh-pages.git" output git clone --depth=1 --branch=master "https://github.com/Jermolene/jermolene.github.io.git" output

View File

@@ -10,6 +10,6 @@ git config --global user.email "actions@github.com"
git config --global user.name "GitHub Actions" git config --global user.name "GitHub Actions"
git add -A . git add -A .
git commit --message "GitHub build: $GITHUB_RUN_NUMBER of $TW5_BUILD_BRANCH ($(date +'%F %T %Z'))" git commit --message "GitHub build: $GITHUB_RUN_NUMBER of $TW5_BUILD_BRANCH ($(date +'%F %T %Z'))"
git remote add deploy "https://$GH_TOKEN@github.com/TiddlyWiki/tiddlywiki.com-gh-pages.git" &>/dev/null git remote add deploy "https://$GH_TOKEN@github.com/Jermolene/jermolene.github.io.git" &>/dev/null
git push deploy master &>/dev/null git push deploy master &>/dev/null
cd .. cd ..

View File

@@ -1,16 +0,0 @@
#!/bin/bash
# test TiddlyWiki5 for tiddlywiki.com
node ./tiddlywiki.js \
./editions/test \
--verbose \
--version \
--rendertiddler $:/core/save/all test.html text/plain \
--test \
|| exit 1
npm install playwright @playwright/test
npx playwright install chromium firefox --with-deps
npx playwright test

View File

@@ -15,11 +15,3 @@ node $TW5_BUILD_TIDDLYWIKI \
--output . \ --output . \
--build readmes \ --build readmes \
|| exit 1 || exit 1
# tw.org readmes
node $TW5_BUILD_TIDDLYWIKI \
editions/tw.org \
--verbose \
--output . \
--build readmes \
|| exit 1

View File

@@ -142,15 +142,15 @@ $tw.utils.each = function(object,callback) {
var next,f,length; var next,f,length;
if(object) { if(object) {
if(Object.prototype.toString.call(object) == "[object Array]") { if(Object.prototype.toString.call(object) == "[object Array]") {
for(f=0, length=object.length; f<length; f++) { for (f=0, length=object.length; f<length; f++) {
next = callback(object[f],f,object); next = callback(object[f],f,object);
if(next === false) { if(next === false) {
break; break;
} }
} }
} else { } else {
var keys = Object.keys(object); var keys = Object.keys(object);
for(f=0, length=keys.length; f<length; f++) { for (f=0, length=keys.length; f<length; f++) {
var key = keys[f]; var key = keys[f];
next = callback(object[key],key,object); next = callback(object[key],key,object);
if(next === false) { if(next === false) {
@@ -177,7 +177,6 @@ document: defaults to current document
eventListeners: array of event listeners (this option won't work until $tw.utils.addEventListeners() has been loaded) eventListeners: array of event listeners (this option won't work until $tw.utils.addEventListeners() has been loaded)
*/ */
$tw.utils.domMaker = function(tag,options) { $tw.utils.domMaker = function(tag,options) {
var options = options || {};
var doc = options.document || document; var doc = options.document || document;
var element = doc.createElementNS(options.namespace || "http://www.w3.org/1999/xhtml",tag); var element = doc.createElementNS(options.namespace || "http://www.w3.org/1999/xhtml",tag);
if(options["class"]) { if(options["class"]) {
@@ -219,34 +218,9 @@ $tw.utils.error = function(err) {
heading = dm("h1",{text: errHeading}), heading = dm("h1",{text: errHeading}),
prompt = dm("div",{text: promptMsg, "class": "tc-error-prompt"}), prompt = dm("div",{text: promptMsg, "class": "tc-error-prompt"}),
message = dm("div",{text: err, "class":"tc-error-message"}), message = dm("div",{text: err, "class":"tc-error-message"}),
closeButton = dm("div",{children: [dm("button",{text: ( $tw.language == undefined ? "close" : $tw.language.getString("Buttons/Close/Caption") )})], "class": "tc-error-prompt"}), button = dm("div",{children: [dm("button",{text: ( $tw.language == undefined ? "close" : $tw.language.getString("Buttons/Close/Caption") )})], "class": "tc-error-prompt"}),
downloadButton = dm("div",{children: [dm("button",{text: ( $tw.language == undefined ? "download tiddlers" : $tw.language.getString("Buttons/EmergencyDownload/Caption") )})], "class": "tc-error-prompt"}), form = dm("form",{children: [heading,prompt,message,button], "class": "tc-error-form"});
form = dm("form",{children: [heading,prompt,downloadButton,message,closeButton], "class": "tc-error-form"});
document.body.insertBefore(form,document.body.firstChild); document.body.insertBefore(form,document.body.firstChild);
downloadButton.addEventListener("click",function(event) {
if($tw && $tw.wiki) {
var tiddlers = [];
$tw.wiki.each(function(tiddler,title) {
tiddlers.push(tiddler.fields);
});
var link = dm("a"),
text = JSON.stringify(tiddlers);
if(Blob !== undefined) {
var blob = new Blob([text], {type: "application/json"});
link.setAttribute("href", URL.createObjectURL(blob));
} else {
link.setAttribute("href","data:application/json," + encodeURIComponent(text));
}
link.setAttribute("download","emergency-tiddlers-" + (new Date()) + ".json");
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
} else {
alert("Emergency tiddler download is not available");
}
event.preventDefault();
return false;
},true);
form.addEventListener("submit",function(event) { form.addEventListener("submit",function(event) {
document.body.removeChild(form); document.body.removeChild(form);
event.preventDefault(); event.preventDefault();
@@ -275,7 +249,7 @@ Extend an object with the properties from a list of source objects
$tw.utils.extend = function(object /*, sourceObjectList */) { $tw.utils.extend = function(object /*, sourceObjectList */) {
$tw.utils.each(Array.prototype.slice.call(arguments,1),function(source) { $tw.utils.each(Array.prototype.slice.call(arguments,1),function(source) {
if(source) { if(source) {
for(var p in source) { for (var p in source) {
object[p] = source[p]; object[p] = source[p];
} }
} }
@@ -289,7 +263,7 @@ Fill in any null or undefined properties of an object with the properties from a
$tw.utils.deepDefaults = function(object /*, sourceObjectList */) { $tw.utils.deepDefaults = function(object /*, sourceObjectList */) {
$tw.utils.each(Array.prototype.slice.call(arguments,1),function(source) { $tw.utils.each(Array.prototype.slice.call(arguments,1),function(source) {
if(source) { if(source) {
for(var p in source) { for (var p in source) {
if(object[p] === null || object[p] === undefined) { if(object[p] === null || object[p] === undefined) {
object[p] = source[p]; object[p] = source[p];
} }
@@ -386,8 +360,8 @@ $tw.utils.parseDate = function(value) {
parseInt(value.substr(10,2)||"00",10), parseInt(value.substr(10,2)||"00",10),
parseInt(value.substr(12,2)||"00",10), parseInt(value.substr(12,2)||"00",10),
parseInt(value.substr(14,3)||"000",10))); parseInt(value.substr(14,3)||"000",10)));
d.setUTCFullYear(year); // See https://stackoverflow.com/a/5870822 d.setUTCFullYear(year); // See https://stackoverflow.com/a/5870822
return d; return d;
} else if($tw.utils.isDate(value)) { } else if($tw.utils.isDate(value)) {
return value; return value;
} else { } else {
@@ -812,7 +786,6 @@ $tw.utils.Crypto = function() {
} }
return outputText; return outputText;
}; };
$tw.sjcl = sjcl;
this.setPassword = function(newPassword) { this.setPassword = function(newPassword) {
currentPassword = newPassword; currentPassword = newPassword;
this.updateCryptoStateTiddler(); this.updateCryptoStateTiddler();
@@ -893,8 +866,8 @@ $tw.modules.execute = function(moduleName,moduleRoot) {
} else { } else {
/* /*
CommonJS optional require.main property: CommonJS optional require.main property:
In a browser we offer a fake main module which points back to the boot function In a browser we offer a fake main module which points back to the boot function
(Theoretically, this may allow TW to eventually load itself as a module in the browser) (Theoretically, this may allow TW to eventually load itself as a module in the browser)
*/ */
Object.defineProperty(sandbox.require, "main", { Object.defineProperty(sandbox.require, "main", {
value: (typeof(require) !== "undefined") ? require.main : {TiddlyWiki: _boot}, value: (typeof(require) !== "undefined") ? require.main : {TiddlyWiki: _boot},
@@ -936,9 +909,9 @@ $tw.modules.execute = function(moduleName,moduleRoot) {
moduleInfo.exports = moduleInfo.definition; moduleInfo.exports = moduleInfo.definition;
} }
} catch(e) { } catch(e) {
if(e instanceof SyntaxError) { if (e instanceof SyntaxError) {
var line = e.lineNumber || e.line; // Firefox || Safari var line = e.lineNumber || e.line; // Firefox || Safari
if(typeof(line) != "undefined" && line !== null) { if (typeof(line) != "undefined" && line !== null) {
$tw.utils.error("Syntax error in boot module " + name + ":" + line + ":\n" + e.stack); $tw.utils.error("Syntax error in boot module " + name + ":" + line + ":\n" + e.stack);
} else if(!$tw.browser) { } else if(!$tw.browser) {
// this is the only way to get node.js to display the line at which the syntax error appeared, // this is the only way to get node.js to display the line at which the syntax error appeared,
@@ -1068,10 +1041,6 @@ $tw.Tiddler.prototype.hasField = function(field) {
return $tw.utils.hop(this.fields,field); return $tw.utils.hop(this.fields,field);
}; };
$tw.Tiddler.prototype.isPlugin = function() {
return this.fields.type === "application/json" && this.hasField("plugin-type") && !this.hasField("draft.of");
};
/* /*
Compare two tiddlers for equality Compare two tiddlers for equality
tiddler: the tiddler to compare tiddler: the tiddler to compare
@@ -1166,21 +1135,21 @@ enableIndexers - Array of indexer names to enable, or null to use all available
$tw.Wiki = function(options) { $tw.Wiki = function(options) {
options = options || {}; options = options || {};
var self = this, var self = this,
tiddlerStore = Object.create(null), // Hashmap of tiddlers tiddlers = Object.create(null), // Hashmap of tiddlers
tiddlerTitles = null, // Array of tiddler titles, calculated and cached when needed tiddlerTitles = null, // Array of tiddler titles
getTiddlerTitles = function() { getTiddlerTitles = function() {
if(!tiddlerTitles) { if(!tiddlerTitles) {
tiddlerTitles = Object.keys(tiddlerStore).sort(function(a,b) {return a.localeCompare(b);}); tiddlerTitles = Object.keys(tiddlers).sort(function(a,b) {return a.localeCompare(b);});
} }
return tiddlerTitles; return tiddlerTitles;
}, },
pluginTiddlersInfo = [], // Array of tiddler fields for all plugins and sub-plugins, ordered by priority pluginTiddlers = [], // Array of tiddlers containing registered plugins, ordered by priority
pluginContents = Object.create(null), // Hashmap by title of {contents:<parsed plugin contents>,fields:<fields>,subPluginTitles:<list>} pluginInfo = Object.create(null), // Hashmap of parsed plugin content
shadowTiddlerInfo = Object.create(null), // Hashmap by title of {source:, tiddler:} shadowTiddlers = Object.create(null), // Hashmap by title of {source:, tiddler:}
shadowTiddlerTitles = null, // Array of tiddler titles, calculated and cached when needed shadowTiddlerTitles = null,
getShadowTiddlerTitles = function() { getShadowTiddlerTitles = function() {
if(!shadowTiddlerTitles) { if(!shadowTiddlerTitles) {
shadowTiddlerTitles = Object.keys(shadowTiddlerInfo).sort(function(a,b) {return a.localeCompare(b);}); shadowTiddlerTitles = Object.keys(shadowTiddlers).sort(function(a,b) {return a.localeCompare(b);});
} }
return shadowTiddlerTitles; return shadowTiddlerTitles;
}, },
@@ -1222,7 +1191,7 @@ $tw.Wiki = function(options) {
} }
} }
// Save the new tiddler // Save the new tiddler
tiddlerStore[title] = tiddler; tiddlers[title] = tiddler;
// Check we've got the title // Check we've got the title
tiddlerTitles = $tw.utils.insertSortedArray(tiddlerTitles || [],title); tiddlerTitles = $tw.utils.insertSortedArray(tiddlerTitles || [],title);
// Record the new tiddler state // Record the new tiddler state
@@ -1247,7 +1216,7 @@ $tw.Wiki = function(options) {
this.deleteTiddler = function(title) { this.deleteTiddler = function(title) {
// Uncomment the following line for detailed logs of all tiddler deletions // Uncomment the following line for detailed logs of all tiddler deletions
// console.log("Deleting",title) // console.log("Deleting",title)
if($tw.utils.hop(tiddlerStore,title)) { if($tw.utils.hop(tiddlers,title)) {
// Record the old tiddler state // Record the old tiddler state
var updateDescriptor = { var updateDescriptor = {
old: { old: {
@@ -1257,7 +1226,7 @@ $tw.Wiki = function(options) {
} }
} }
// Delete the tiddler // Delete the tiddler
delete tiddlerStore[title]; delete tiddlers[title];
// Delete it from the list of titles // Delete it from the list of titles
if(tiddlerTitles) { if(tiddlerTitles) {
var index = tiddlerTitles.indexOf(title); var index = tiddlerTitles.indexOf(title);
@@ -1285,11 +1254,11 @@ $tw.Wiki = function(options) {
// Get a tiddler from the store // Get a tiddler from the store
this.getTiddler = function(title) { this.getTiddler = function(title) {
if(title) { if(title) {
var t = tiddlerStore[title]; var t = tiddlers[title];
if(t !== undefined) { if(t !== undefined) {
return t; return t;
} else { } else {
var s = shadowTiddlerInfo[title]; var s = shadowTiddlers[title];
if(s !== undefined) { if(s !== undefined) {
return s.tiddler; return s.tiddler;
} }
@@ -1309,7 +1278,7 @@ $tw.Wiki = function(options) {
index,titlesLength,title; index,titlesLength,title;
for(index = 0, titlesLength = titles.length; index < titlesLength; index++) { for(index = 0, titlesLength = titles.length; index < titlesLength; index++) {
title = titles[index]; title = titles[index];
callback(tiddlerStore[title],title); callback(tiddlers[title],title);
} }
}; };
@@ -1324,10 +1293,10 @@ $tw.Wiki = function(options) {
index,titlesLength,title; index,titlesLength,title;
for(index = 0, titlesLength = titles.length; index < titlesLength; index++) { for(index = 0, titlesLength = titles.length; index < titlesLength; index++) {
title = titles[index]; title = titles[index];
if(tiddlerStore[title]) { if(tiddlers[title]) {
callback(tiddlerStore[title],title); callback(tiddlers[title],title);
} else { } else {
var shadowInfo = shadowTiddlerInfo[title]; var shadowInfo = shadowTiddlers[title];
callback(shadowInfo.tiddler,title); callback(shadowInfo.tiddler,title);
} }
} }
@@ -1339,13 +1308,13 @@ $tw.Wiki = function(options) {
titles = getTiddlerTitles(); titles = getTiddlerTitles();
for(index = 0, titlesLength = titles.length; index < titlesLength; index++) { for(index = 0, titlesLength = titles.length; index < titlesLength; index++) {
title = titles[index]; title = titles[index];
callback(tiddlerStore[title],title); callback(tiddlers[title],title);
} }
titles = getShadowTiddlerTitles(); titles = getShadowTiddlerTitles();
for(index = 0, titlesLength = titles.length; index < titlesLength; index++) { for(index = 0, titlesLength = titles.length; index < titlesLength; index++) {
title = titles[index]; title = titles[index];
if(!tiddlerStore[title]) { if(!tiddlers[title]) {
var shadowInfo = shadowTiddlerInfo[title]; var shadowInfo = shadowTiddlers[title];
callback(shadowInfo.tiddler,title); callback(shadowInfo.tiddler,title);
} }
} }
@@ -1357,35 +1326,35 @@ $tw.Wiki = function(options) {
titles = getShadowTiddlerTitles(); titles = getShadowTiddlerTitles();
for(index = 0, titlesLength = titles.length; index < titlesLength; index++) { for(index = 0, titlesLength = titles.length; index < titlesLength; index++) {
title = titles[index]; title = titles[index];
if(tiddlerStore[title]) { if(tiddlers[title]) {
callback(tiddlerStore[title],title); callback(tiddlers[title],title);
} else { } else {
var shadowInfo = shadowTiddlerInfo[title]; var shadowInfo = shadowTiddlers[title];
callback(shadowInfo.tiddler,title); callback(shadowInfo.tiddler,title);
} }
} }
titles = getTiddlerTitles(); titles = getTiddlerTitles();
for(index = 0, titlesLength = titles.length; index < titlesLength; index++) { for(index = 0, titlesLength = titles.length; index < titlesLength; index++) {
title = titles[index]; title = titles[index];
if(!shadowTiddlerInfo[title]) { if(!shadowTiddlers[title]) {
callback(tiddlerStore[title],title); callback(tiddlers[title],title);
} }
} }
}; };
// Test for the existence of a tiddler (excludes shadow tiddlers) // Test for the existence of a tiddler (excludes shadow tiddlers)
this.tiddlerExists = function(title) { this.tiddlerExists = function(title) {
return !!$tw.utils.hop(tiddlerStore,title); return !!$tw.utils.hop(tiddlers,title);
}; };
// Determines if a tiddler is a shadow tiddler, regardless of whether it has been overridden by a real tiddler // Determines if a tiddler is a shadow tiddler, regardless of whether it has been overridden by a real tiddler
this.isShadowTiddler = function(title) { this.isShadowTiddler = function(title) {
return $tw.utils.hop(shadowTiddlerInfo,title); return $tw.utils.hop(shadowTiddlers,title);
}; };
this.getShadowSource = function(title) { this.getShadowSource = function(title) {
if($tw.utils.hop(shadowTiddlerInfo,title)) { if($tw.utils.hop(shadowTiddlers,title)) {
return shadowTiddlerInfo[title].source; return shadowTiddlers[title].source;
} }
return null; return null;
}; };
@@ -1393,8 +1362,8 @@ $tw.Wiki = function(options) {
// Get an array of all the currently recognised plugin types // Get an array of all the currently recognised plugin types
this.getPluginTypes = function() { this.getPluginTypes = function() {
var types = []; var types = [];
$tw.utils.each(pluginTiddlersInfo,function(pluginTiddlerFields) { $tw.utils.each(pluginTiddlers,function(pluginTiddler) {
var pluginType = pluginTiddlerFields["plugin-type"]; var pluginType = pluginTiddler.fields["plugin-type"];
if(pluginType && types.indexOf(pluginType) === -1) { if(pluginType && types.indexOf(pluginType) === -1) {
types.push(pluginType); types.push(pluginType);
} }
@@ -1402,45 +1371,22 @@ $tw.Wiki = function(options) {
return types; return types;
}; };
// Read plugin contents for all plugins, or just an array of titles. Returns the list of updated plugin titles, the list of deleted plugin titles and // Read plugin info for all plugins, or just an array of titles. Returns the number of plugins updated or deleted
// a hashmap of the deleted plugin contents. Clears the pluginContents cache for any plugins that have been deleted
this.readPluginInfo = function(titles) { this.readPluginInfo = function(titles) {
var self = this, var results = {
results = {
modifiedPlugins: [], modifiedPlugins: [],
deletedPlugins: [], deletedPlugins: []
deletedPluginContents: {}
}; };
$tw.utils.each(titles || getTiddlerTitles(),function(title) { $tw.utils.each(titles || getTiddlerTitles(),function(title) {
var tiddler = self.getTiddler(title); var tiddler = tiddlers[title];
if(!tiddler) {
for(var t=0; t<pluginContents.length; t++) {
if(pluginContents[t].subPluginTitles.indexOf(title) !== -1) {
tiddler = new $tw.Tiddler(pluginContents[t].fields);
break;
}
}
}
if(tiddler) { if(tiddler) {
if(tiddler.isPlugin() && tiddler.fields.text) { if(tiddler.fields.type === "application/json" && tiddler.hasField("plugin-type") && tiddler.fields.text) {
var contents = $tw.utils.parseJSONSafe(tiddler.fields.text).tiddlers; pluginInfo[tiddler.fields.title] = $tw.utils.parseJSONSafe(tiddler.fields.text);
var subPluginTitles = []; results.modifiedPlugins.push(tiddler.fields.title);
// Read any sub-plugins
$tw.utils.each(contents,function(subPluginFields,subPluginTitle) {
if(subPluginFields["plugin-type"] && subPluginFields["type"] === "application/json") {
var contents = $tw.utils.parseJSONSafe(subPluginFields.text).tiddlers
pluginContents[subPluginTitle] = {contents: contents,fields: subPluginFields};
results.modifiedPlugins.push(subPluginTitle);
subPluginTitles.push(subPluginTitle)
}
});
pluginContents[title] = {contents: contents,fields: tiddler.fields,subPluginTitles: subPluginTitles};
results.modifiedPlugins.push(title);
} }
} else { } else {
if(pluginContents[title]) { if(pluginInfo[title]) {
results.deletedPluginContents[title] = {tiddlers: pluginContents[title].contents}; delete pluginInfo[title];
delete pluginContents[title];
results.deletedPlugins.push(title); results.deletedPlugins.push(title);
} }
} }
@@ -1448,42 +1394,34 @@ $tw.Wiki = function(options) {
return results; return results;
}; };
this.isSubPlugin = function(title) {
for(var t=0; t<pluginContents.length; t++) {
if(pluginContents[t].subPluginTitles.indexOf(title) !== -1) {
return true;
}
}
return false;
};
// Get plugin info for a plugin // Get plugin info for a plugin
this.getPluginInfo = function(title) { this.getPluginInfo = function(title) {
var pluginContent = pluginContents[title]; return pluginInfo[title];
if(pluginContent) {
return {tiddlers: pluginContent.contents, subPluginTitles: pluginContent.subPluginTitles, fields: pluginContent.fields};
} else {
return null;
}
}; };
// Register the plugin tiddlers of a particular type, or null/undefined for any type, optionally restricting registration to an array of tiddler titles. Return the array of titles affected // Register the plugin tiddlers of a particular type, or null/undefined for any type, optionally restricting registration to an array of tiddler titles. Return the array of titles affected
this.registerPluginTiddlers = function(pluginType,titles) { this.registerPluginTiddlers = function(pluginType,titles) {
var self = this, var self = this,
registeredTitles = []; registeredTitles = [],
$tw.utils.each(pluginContents,function(pluginContent,pluginTitle) { checkTiddler = function(tiddler,title) {
var pluginFields = pluginContent.fields; if(tiddler && tiddler.fields.type === "application/json" && tiddler.fields["plugin-type"] && (!pluginType || tiddler.fields["plugin-type"] === pluginType)) {
if(!titles || titles.indexOf(pluginTitle) !== -1) { var disablingTiddler = self.getTiddler("$:/config/Plugins/Disabled/" + title);
if(!pluginType || pluginFields["plugin-type"] === pluginType) { if(title === "$:/core" || !disablingTiddler || (disablingTiddler.fields.text || "").trim() !== "yes") {
var disablingTiddler = self.getTiddler("$:/config/Plugins/Disabled/" + pluginTitle); self.unregisterPluginTiddlers(null,[title]); // Unregister the plugin if it's already registered
if(pluginTitle === "$:/core" || !disablingTiddler || (disablingTiddler.fields.text || "").trim() !== "yes") { pluginTiddlers.push(tiddler);
self.unregisterPluginTiddlers(null,[pluginTitle]); // Unregister the plugin if it's already registered registeredTitles.push(tiddler.fields.title);
pluginTiddlersInfo.push(pluginFields);
registeredTitles.push(pluginTitle);
} }
} }
} };
}); if(titles) {
$tw.utils.each(titles,function(title) {
checkTiddler(self.getTiddler(title),title);
});
} else {
this.each(function(tiddler,title) {
checkTiddler(tiddler,title);
});
}
return registeredTitles; return registeredTitles;
}; };
@@ -1492,11 +1430,11 @@ $tw.Wiki = function(options) {
var self = this, var self = this,
unregisteredTitles = []; unregisteredTitles = [];
// Remove any previous registered plugins of this type // Remove any previous registered plugins of this type
for(var t=pluginTiddlersInfo.length-1; t>=0; t--) { for(var t=pluginTiddlers.length-1; t>=0; t--) {
var pluginFields = pluginTiddlersInfo[t]; var tiddler = pluginTiddlers[t];
if(pluginFields["plugin-type"] && (!pluginType || pluginFields["plugin-type"] === pluginType) && (!titles || titles.indexOf(pluginFields.title) !== -1)) { if(tiddler.fields["plugin-type"] && (!pluginType || tiddler.fields["plugin-type"] === pluginType) && (!titles || titles.indexOf(tiddler.fields.title) !== -1)) {
unregisteredTitles.push(pluginFields.title); unregisteredTitles.push(tiddler.fields.title);
pluginTiddlersInfo.splice(t,1); pluginTiddlers.splice(t,1);
} }
} }
return unregisteredTitles; return unregisteredTitles;
@@ -1505,34 +1443,39 @@ $tw.Wiki = function(options) {
// Unpack the currently registered plugins, creating shadow tiddlers for their constituent tiddlers // Unpack the currently registered plugins, creating shadow tiddlers for their constituent tiddlers
this.unpackPluginTiddlers = function() { this.unpackPluginTiddlers = function() {
var self = this; var self = this;
// Sort the plugin titles by the `plugin-priority` field, if this field is missing, default to 1 // Sort the plugin titles by the `plugin-priority` field
pluginTiddlersInfo.sort(function(a, b) { pluginTiddlers.sort(function(a,b) {
var priorityA = "plugin-priority" in a ? a["plugin-priority"] : 1, if("plugin-priority" in a.fields && "plugin-priority" in b.fields) {
priorityB = "plugin-priority" in b ? b["plugin-priority"] : 1; return a.fields["plugin-priority"] - b.fields["plugin-priority"];
if (priorityA !== priorityB) { } else if("plugin-priority" in a.fields) {
return priorityA - priorityB;
} else if (a.title < b.title) {
return -1; return -1;
} else if (a.title === b.title) { } 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) {
return 0; return 0;
} else { } else {
return +1; return +1;
} }
}); });
// Now go through the plugins in ascending order and assign the shadows // Now go through the plugins in ascending order and assign the shadows
shadowTiddlerInfo = Object.create(null); shadowTiddlers = Object.create(null);
$tw.utils.each(pluginTiddlersInfo,function(tiddlerFields) { $tw.utils.each(pluginTiddlers,function(tiddler) {
var contents = pluginContents[tiddlerFields.title].contents;
// Extract the constituent tiddlers // Extract the constituent tiddlers
$tw.utils.each(contents,function(constituentTiddler,constituentTitle) { if($tw.utils.hop(pluginInfo,tiddler.fields.title)) {
// Save the tiddler object $tw.utils.each(pluginInfo[tiddler.fields.title].tiddlers,function(constituentTiddler,constituentTitle) {
shadowTiddlerInfo[constituentTitle] = { // Save the tiddler object
source: tiddlerFields.title, if(constituentTitle) {
tiddler: new $tw.Tiddler(constituentTiddler,{title: constituentTitle}) shadowTiddlers[constituentTitle] = {
}; source: tiddler.fields.title,
}); tiddler: new $tw.Tiddler(constituentTiddler,{title: constituentTitle})
};
}
});
}
}); });
shadowTiddlerTitles = null; // Force regeneration of the shadow tiddler titles list shadowTiddlerTitles = null;
this.clearCache(null); this.clearCache(null);
this.clearGlobalCache(); this.clearGlobalCache();
$tw.utils.each(indexers,function(indexer) { $tw.utils.each(indexers,function(indexer) {
@@ -1563,7 +1506,7 @@ Define all modules stored in ordinary tiddlers
$tw.Wiki.prototype.defineTiddlerModules = function() { $tw.Wiki.prototype.defineTiddlerModules = function() {
this.each(function(tiddler,title) { this.each(function(tiddler,title) {
if(tiddler.hasField("module-type")) { if(tiddler.hasField("module-type")) {
switch(tiddler.fields.type) { switch (tiddler.fields.type) {
case "application/javascript": case "application/javascript":
// We only define modules that haven't already been defined, because in the browser modules in system tiddlers are defined in inline script // We only define modules that haven't already been defined, because in the browser modules in system tiddlers are defined in inline script
if(!$tw.utils.hop($tw.modules.titles,tiddler.fields.title)) { if(!$tw.utils.hop($tw.modules.titles,tiddler.fields.title)) {
@@ -1934,16 +1877,8 @@ $tw.loadTiddlersFromFile = function(filepath,fields) {
extensionInfo = $tw.utils.getFileExtensionInfo(ext), extensionInfo = $tw.utils.getFileExtensionInfo(ext),
type = extensionInfo ? extensionInfo.type : null, type = extensionInfo ? extensionInfo.type : null,
typeInfo = type ? $tw.config.contentTypeInfo[type] : null, typeInfo = type ? $tw.config.contentTypeInfo[type] : null,
fileSize = fs.statSync(filepath).size, data = fs.readFileSync(filepath,typeInfo ? typeInfo.encoding : "utf8"),
data; tiddlers = $tw.wiki.deserializeTiddlers(ext,data,fields),
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); metadata = $tw.loadMetadataForFile(filepath);
if(metadata) { if(metadata) {
if(type === "application/json") { if(type === "application/json") {
@@ -1976,7 +1911,7 @@ $tw.boot.excludeRegExp = /^\.DS_Store$|^.*\.meta$|^\..*\.swp$|^\._.*$|^\.git$|^\
/* /*
Load all the tiddlers recursively from a directory, including honouring `tiddlywiki.files` files for drawing in external files. Returns an array of {filepath:,type:,tiddlers: [{..fields...}],hasMetaFile:}. Note that no file information is returned for externally loaded tiddlers, just the `tiddlers` property. Load all the tiddlers recursively from a directory, including honouring `tiddlywiki.files` files for drawing in external files. Returns an array of {filepath:,type:,tiddlers: [{..fields...}],hasMetaFile:}. Note that no file information is returned for externally loaded tiddlers, just the `tiddlers` property.
*/ */
$tw.loadTiddlersFromPath = function(filepath,excludeRegExp,excludePluginInfo) { $tw.loadTiddlersFromPath = function(filepath,excludeRegExp) {
excludeRegExp = excludeRegExp || $tw.boot.excludeRegExp; excludeRegExp = excludeRegExp || $tw.boot.excludeRegExp;
var tiddlers = []; var tiddlers = [];
if(fs.existsSync(filepath)) { if(fs.existsSync(filepath)) {
@@ -1986,17 +1921,11 @@ $tw.loadTiddlersFromPath = function(filepath,excludeRegExp,excludePluginInfo) {
// Look for a tiddlywiki.files file // Look for a tiddlywiki.files file
if(files.indexOf("tiddlywiki.files") !== -1) { if(files.indexOf("tiddlywiki.files") !== -1) {
Array.prototype.push.apply(tiddlers,$tw.loadTiddlersFromSpecification(filepath,excludeRegExp)); Array.prototype.push.apply(tiddlers,$tw.loadTiddlersFromSpecification(filepath,excludeRegExp));
} else if(files.indexOf("plugin.info") !== -1 && !excludePluginInfo) {
// Load sub-plugin
var tiddler = $tw.loadPluginFolder(filepath);
if(tiddler) {
tiddlers.push({tiddlers: [tiddler]});
}
} else { } else {
// If not, read all the files in the directory // If not, read all the files in the directory
$tw.utils.each(files,function(file) { $tw.utils.each(files,function(file) {
if(!excludeRegExp.test(file) && file !== "plugin.info") { if(!excludeRegExp.test(file) && file !== "plugin.info") {
tiddlers.push.apply(tiddlers,$tw.loadTiddlersFromPath(path.join(filepath,file),excludeRegExp)); tiddlers.push.apply(tiddlers,$tw.loadTiddlersFromPath(filepath + path.sep + file,excludeRegExp));
} }
}); });
} }
@@ -2038,10 +1967,10 @@ $tw.loadTiddlersFromSpecification = function(filepath,excludeRegExp) {
var value = tiddler[name]; var value = tiddler[name];
switch(fieldInfo.source) { switch(fieldInfo.source) {
case "subdirectories": case "subdirectories":
value = path.relative(rootPath, filename).split(path.sep).slice(0, -1); value = path.relative(rootPath, filename).split('/').slice(0, -1);
break; break;
case "filepath": case "filepath":
value = path.relative(rootPath, filename).split(path.sep).join('/'); value = path.relative(rootPath, filename);
break; break;
case "filename": case "filename":
value = path.basename(filename); value = path.basename(filename);
@@ -2087,7 +2016,7 @@ $tw.loadTiddlersFromSpecification = function(filepath,excludeRegExp) {
arrayOfFiles = arrayOfFiles || []; arrayOfFiles = arrayOfFiles || [];
var files = fs.readdirSync(dirPath); var files = fs.readdirSync(dirPath);
files.forEach(function(file) { files.forEach(function(file) {
if(recurse && fs.statSync(dirPath + path.sep + file).isDirectory()) { if (recurse && fs.statSync(dirPath + path.sep + file).isDirectory()) {
arrayOfFiles = getAllFiles(dirPath + path.sep + file, recurse, arrayOfFiles); arrayOfFiles = getAllFiles(dirPath + path.sep + file, recurse, arrayOfFiles);
} else if(fs.statSync(dirPath + path.sep + file).isFile()){ } else if(fs.statSync(dirPath + path.sep + file).isFile()){
arrayOfFiles.push(path.join(dirPath, path.sep, file)); arrayOfFiles.push(path.join(dirPath, path.sep, file));
@@ -2143,69 +2072,54 @@ Load the tiddlers from a plugin folder, and package them up into a proper JSON p
*/ */
$tw.loadPluginFolder = function(filepath,excludeRegExp) { $tw.loadPluginFolder = function(filepath,excludeRegExp) {
excludeRegExp = excludeRegExp || $tw.boot.excludeRegExp; excludeRegExp = excludeRegExp || $tw.boot.excludeRegExp;
function readPluginFields(filepath) { var infoPath = filepath + path.sep + "plugin.info";
if(!(fs.existsSync(filepath) && fs.statSync(filepath).isDirectory())) { if(fs.existsSync(filepath) && fs.statSync(filepath).isDirectory()) {
return null; // Read the plugin information
}
var infoPath = path.join(filepath,"plugin.info");
// Read the plugin information file
if(!fs.existsSync(infoPath) || !fs.statSync(infoPath).isFile()) { if(!fs.existsSync(infoPath) || !fs.statSync(infoPath).isFile()) {
console.log("Warning: missing plugin.info file in " + filepath);
return null; return null;
} }
var pluginFields = $tw.utils.parseJSONSafe(fs.readFileSync(infoPath,"utf8"),{}); var pluginInfo = $tw.utils.parseJSONSafe(fs.readFileSync(infoPath,"utf8"),function() {return null;});
if(!(pluginFields.title && pluginFields.name)) { if(!pluginInfo) {
return null; console.log("warning: invalid JSON in plugin.info file at " + infoPath);
pluginInfo = {};
} }
// Give the plugin the same version number as the core if it doesn't have one // Read the plugin files
if(!("version" in pluginFields)) { var pluginFiles = $tw.loadTiddlersFromPath(filepath,excludeRegExp);
pluginFields.version = $tw.packageInfo.version; // Save the plugin tiddlers into the plugin info
} pluginInfo.tiddlers = pluginInfo.tiddlers || Object.create(null);
// Use "plugin" as the plugin-type if we don't have one
if(!("plugin-type" in pluginFields)) {
pluginFields["plugin-type"] = "plugin";
}
// Set the dependents and type
pluginFields.dependents = pluginFields.dependents || [];
pluginFields.type = "application/json";
// Deserialise array fields (currently required for the dependents field)
for(var field in pluginFields) {
if($tw.utils.isArray(pluginFields[field])) {
pluginFields[field] = $tw.utils.stringifyList(pluginFields[field]);
}
}
return pluginFields;
}
function readPluginTiddlers(tiddlersPath) {
var pluginFiles = $tw.loadTiddlersFromPath(tiddlersPath,excludeRegExp,true),
pluginTiddlers = {};
// Save the plugin tiddlers into the plugin payload
for(var f=0; f<pluginFiles.length; f++) { for(var f=0; f<pluginFiles.length; f++) {
var tiddlers = pluginFiles[f].tiddlers; var tiddlers = pluginFiles[f].tiddlers;
if(!tiddlers) {
console.log(`Gosh ${JSON.stringify(pluginFiles[f])}`)
}
for(var t=0; t<tiddlers.length; t++) { for(var t=0; t<tiddlers.length; t++) {
var tiddler= tiddlers[t]; var tiddler= tiddlers[t];
if(tiddler.title) { if(tiddler.title) {
pluginTiddlers[tiddler.title] = tiddler; pluginInfo.tiddlers[tiddler.title] = tiddler;
} }
} }
} }
return pluginTiddlers; // Give the plugin the same version number as the core if it doesn't have one
if(!("version" in pluginInfo)) {
pluginInfo.version = $tw.packageInfo.version;
}
// Use "plugin" as the plugin-type if we don't have one
if(!("plugin-type" in pluginInfo)) {
pluginInfo["plugin-type"] = "plugin";
}
pluginInfo.dependents = pluginInfo.dependents || [];
pluginInfo.type = "application/json";
// Set plugin text
pluginInfo.text = JSON.stringify({tiddlers: pluginInfo.tiddlers});
delete pluginInfo.tiddlers;
// Deserialise array fields (currently required for the dependents field)
for(var field in pluginInfo) {
if($tw.utils.isArray(pluginInfo[field])) {
pluginInfo[field] = $tw.utils.stringifyList(pluginInfo[field]);
}
}
return pluginInfo;
} else {
return null;
} }
// Get the primary plugin fields
var pluginFields = readPluginFields(filepath);
if(!pluginFields) {
console.log("Warning: missing or invalid plugin.info file in " + filepath);
return null;
}
// The payload to be stored in the plugin text field in JSON
var pluginPayload = {tiddlers: {}};
// Get the constituent tiddlers of the plugin
pluginPayload.tiddlers = readPluginTiddlers(filepath);
// Set plugin text
pluginFields.text = JSON.stringify(pluginPayload);
return pluginFields;
}; };
/* /*
@@ -2247,16 +2161,13 @@ Returns an array of search paths
*/ */
$tw.getLibraryItemSearchPaths = function(libraryPath,envVar) { $tw.getLibraryItemSearchPaths = function(libraryPath,envVar) {
var pluginPaths = [path.resolve($tw.boot.corePath,libraryPath)], var pluginPaths = [path.resolve($tw.boot.corePath,libraryPath)],
env;
if(envVar) {
env = process.env[envVar]; env = process.env[envVar];
if(env) { if(env) {
env.split(path.delimiter).map(function(item) { env.split(path.delimiter).map(function(item) {
if(item) { if(item) {
pluginPaths.push(item); pluginPaths.push(item);
} }
}); });
}
} }
return pluginPaths; return pluginPaths;
}; };
@@ -2342,7 +2253,7 @@ $tw.loadWikiTiddlers = function(wikiPath,options) {
} }
$tw.wiki.addTiddlers(tiddlerFile.tiddlers); $tw.wiki.addTiddlers(tiddlerFile.tiddlers);
}); });
if($tw.boot.wikiPath == wikiPath) { if ($tw.boot.wikiPath == wikiPath) {
// Save the original tiddler file locations if requested // Save the original tiddler file locations if requested
var output = {}, relativePath, fileInfo; var output = {}, relativePath, fileInfo;
for(var title in $tw.boot.files) { for(var title in $tw.boot.files) {
@@ -2524,15 +2435,12 @@ $tw.boot.initStartup = function(options) {
$tw.utils.registerFileType("image/webp","base64",".webp",{flags:["image"]}); $tw.utils.registerFileType("image/webp","base64",".webp",{flags:["image"]});
$tw.utils.registerFileType("image/heic","base64",".heic",{flags:["image"]}); $tw.utils.registerFileType("image/heic","base64",".heic",{flags:["image"]});
$tw.utils.registerFileType("image/heif","base64",".heif",{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/svg+xml","utf8",".svg",{flags:["image"]});
$tw.utils.registerFileType("image/vnd.microsoft.icon","base64",".ico",{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("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("font/woff","base64",".woff"); $tw.utils.registerFileType("application/x-font-ttf","base64",".woff");
$tw.utils.registerFileType("font/woff2","base64",".woff2"); $tw.utils.registerFileType("application/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/ogg","base64",".ogg");
$tw.utils.registerFileType("audio/mp4","base64",[".mp4",".m4a"]); $tw.utils.registerFileType("audio/mp4","base64",[".mp4",".m4a"]);
$tw.utils.registerFileType("video/ogg","base64",[".ogm",".ogv",".ogg"]); $tw.utils.registerFileType("video/ogg","base64",[".ogm",".ogv",".ogg"]);
@@ -2544,12 +2452,8 @@ $tw.boot.initStartup = function(options) {
$tw.utils.registerFileType("text/x-markdown","utf8",[".md",".markdown"]); $tw.utils.registerFileType("text/x-markdown","utf8",[".md",".markdown"]);
$tw.utils.registerFileType("application/enex+xml","utf8",".enex"); $tw.utils.registerFileType("application/enex+xml","utf8",".enex");
$tw.utils.registerFileType("application/vnd.openxmlformats-officedocument.wordprocessingml.document","base64",".docx"); $tw.utils.registerFileType("application/vnd.openxmlformats-officedocument.wordprocessingml.document","base64",".docx");
$tw.utils.registerFileType("application/msword","base64",".doc");
$tw.utils.registerFileType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","base64",".xlsx"); $tw.utils.registerFileType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","base64",".xlsx");
$tw.utils.registerFileType("application/excel","base64",".xls");
$tw.utils.registerFileType("application/vnd.ms-excel","base64",".xls");
$tw.utils.registerFileType("application/vnd.openxmlformats-officedocument.presentationml.presentation","base64",".pptx"); $tw.utils.registerFileType("application/vnd.openxmlformats-officedocument.presentationml.presentation","base64",".pptx");
$tw.utils.registerFileType("application/mspowerpoint","base64",".ppt");
$tw.utils.registerFileType("text/x-bibtex","utf8",".bib",{deserializerType:"application/x-bibtex"}); $tw.utils.registerFileType("text/x-bibtex","utf8",".bib",{deserializerType:"application/x-bibtex"});
$tw.utils.registerFileType("application/x-bibtex","utf8",".bib"); $tw.utils.registerFileType("application/x-bibtex","utf8",".bib");
$tw.utils.registerFileType("application/epub+zip","base64",".epub"); $tw.utils.registerFileType("application/epub+zip","base64",".epub");
@@ -2698,14 +2602,14 @@ $tw.boot.doesTaskMatchPlatform = function(taskModule) {
var platforms = taskModule.platforms; var platforms = taskModule.platforms;
if(platforms) { if(platforms) {
for(var t=0; t<platforms.length; t++) { for(var t=0; t<platforms.length; t++) {
switch(platforms[t]) { switch (platforms[t]) {
case "browser": case "browser":
if($tw.browser) { if ($tw.browser) {
return true; return true;
} }
break; break;
case "node": case "node":
if($tw.node) { if ($tw.node) {
return true; return true;
} }
break; break;
@@ -2770,25 +2674,13 @@ $tw.hooks.addHook = function(hookName,definition) {
} }
}; };
/*
Delete hooks from the hashmap
*/
$tw.hooks.removeHook = function(hookName,definition) {
if($tw.utils.hop($tw.hooks.names,hookName)) {
var p = $tw.hooks.names[hookName].indexOf(definition);
if(p !== -1) {
$tw.hooks.names[hookName].splice(p, 1);
}
}
};
/* /*
Invoke the hook by key Invoke the hook by key
*/ */
$tw.hooks.invokeHook = function(hookName /*, value,... */) { $tw.hooks.invokeHook = function(hookName /*, value,... */) {
var args = Array.prototype.slice.call(arguments,1); var args = Array.prototype.slice.call(arguments,1);
if($tw.utils.hop($tw.hooks.names,hookName)) { if($tw.utils.hop($tw.hooks.names,hookName)) {
for(var i = 0; i < $tw.hooks.names[hookName].length; i++) { for (var i = 0; i < $tw.hooks.names[hookName].length; i++) {
args[0] = $tw.hooks.names[hookName][i].apply(null,args); args[0] = $tw.hooks.names[hookName][i].apply(null,args);
} }
} }

View File

@@ -19,13 +19,9 @@ var _bootprefix = (function($tw) {
$tw = $tw || Object.create(null); $tw = $tw || Object.create(null);
$tw.boot = $tw.boot || 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 // Detect platforms
if(!("browser" in $tw)) { if(!("browser" in $tw)) {
$tw.browser = typeof(window) !== "undefined" && typeof(document) !== "undefined" ? {} : null; $tw.browser = typeof(window) !== "undefined" ? {} : null;
} }
if(!("node" in $tw)) { if(!("node" in $tw)) {
$tw.node = typeof(process) === "object" ? {} : null; $tw.node = typeof(process) === "object" ? {} : null;

3
boot/sjcl.js.meta Normal file
View File

@@ -0,0 +1,3 @@
title: $:/library/sjcl.js
type: application/javascript
library: yes

View File

@@ -1,32 +0,0 @@
{
"tiddlers": [
{
"file": "sjcl.js",
"fields": {
"title": "$:/library/sjcl.js",
"type": "application/javascript",
"library": "yes"
},
"prefix": "(function(define) {\n",
"suffix": "\n})(function (_,defined){window.sjcl = defined()})\n"
},
{
"file": "boot.js",
"fields": {
"title": "$:/boot/boot.js",
"type": "application/javascript"
}
},
{
"file": "bootprefix.js",
"fields": {
"title": "$:/boot/bootprefix.js",
"type": "application/javascript"
}
},
{
"file": "boot.css.tid",
"isTiddlerFile": true
}
]
}

View File

@@ -1 +0,0 @@
<p>This community exists because TiddlyWiki is more useful when people share and work together.</p><p>This community is a beautiful but fragile thing: a collection of diverse people from all over the planet, united in their interest in the project, and their commitment to helping one another achieve and learn more.</p><p>We try to make the community as broad and welcoming as possible by remembering some basic principles of culture and behaviour.</p><p>These principles guide technical and non-technical decisions, and help contributors and leaders support our project and community.</p><ul><li>We are optimistic and hopeful</li><li>We aim to foster a learning environment that is collaborative and safe for everyone</li><li>We recognise that the motivation for sharing and helping is usually for appreciation, and not financial gain, and so we take care to acknowledge and <strong>thank the people who enrich the community by sharing what they have created</strong></li><li>While we are united in our interest in TiddlyWiki, we differ in every other conceivable way. We choose to focus on what unites us, and <strong>avoid unnecessarily mixing contentious topics like religion and politics</strong></li><li>We treat each other with respect, and start with the assumption that <strong>others are acting in good faith</strong></li><li>We avoid discriminatory language</li><li>We try to use our strength as a community to help others</li><li>We avoid responding when angry or upset because we try to de-escalate conflict</li><li>We make sure we critique ideas, not people</li><li>When we disagree with others we do so graciously, and treat others with dignity and respoect</li><li>We do not tolerate intolerance towards others</li><li>We seek first to understand others, and then to be understood</li><li>We have fun</li></ul><p>Our discussions are in English. It is not the first language of many people in the community, nor do we all share the same cultural background and reference points. So we take care to use language that is clear and unambigous, and avoid cultural references or jokes that will not be widely understood.</p><p>It is not acceptable to make jokes or other comments that discriminate by race, gender, sexuality, or other protected characteristic.</p><p>As an inclusive community, we are committed to making sure that TiddlyWiki is an accessible tool that understands the needs of people with disabilities.</p>

File diff suppressed because one or more lines are too long

View File

@@ -5,3 +5,7 @@ TiddlyWiki incorporates code from these fine OpenSource projects:
* [[The Stanford Javascript Crypto Library|http://bitwiseshiftleft.github.io/sjcl/]] * [[The Stanford Javascript Crypto Library|http://bitwiseshiftleft.github.io/sjcl/]]
* [[The Jasmine JavaScript Test Framework|https://jasmine.github.io/]] * [[The Jasmine JavaScript Test Framework|https://jasmine.github.io/]]
* [[Normalize.css by Nicolas Gallagher|http://necolas.github.io/normalize.css/]] * [[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]]

View File

@@ -4,7 +4,7 @@ type: text/plain
TiddlyWiki created by Jeremy Ruston, (jeremy [at] jermolene [dot] com) TiddlyWiki created by Jeremy Ruston, (jeremy [at] jermolene [dot] com)
Copyright (c) 2004-2007, Jeremy Ruston Copyright (c) 2004-2007, Jeremy Ruston
Copyright (c) 2007-2025, UnaMesa Association Copyright (c) 2007-2023, UnaMesa Association
All rights reserved. All rights reserved.
Redistribution and use in source and binary forms, with or without Redistribution and use in source and binary forms, with or without

View File

@@ -1,5 +0,0 @@
title: $:/core/images/discord
tags: $:/tags/Image
\parameters (size:"22pt")
<svg width=<<size>> height=<<size>> class="tc-image-discord tc-image-button" viewBox="0 -28.5 256 256"><path d="M216.856 16.597A208.502 208.502 0 0 0 164.042 0c-2.275 4.113-4.933 9.645-6.766 14.046-19.692-2.961-39.203-2.961-58.533 0-1.832-4.4-4.55-9.933-6.846-14.046a207.809 207.809 0 0 0-52.855 16.638C5.618 67.147-3.443 116.4 1.087 164.956c22.169 16.555 43.653 26.612 64.775 33.193A161.094 161.094 0 0 0 79.735 175.3a136.413 136.413 0 0 1-21.846-10.632 108.636 108.636 0 0 0 5.356-4.237c42.122 19.702 87.89 19.702 129.51 0a131.66 131.66 0 0 0 5.355 4.237 136.07 136.07 0 0 1-21.886 10.653c4.006 8.02 8.638 15.67 13.873 22.848 21.142-6.58 42.646-16.637 64.815-33.213 5.316-56.288-9.08-105.09-38.056-148.36ZM85.474 135.095c-12.645 0-23.015-11.805-23.015-26.18s10.149-26.2 23.015-26.2c12.867 0 23.236 11.804 23.015 26.2.02 14.375-10.148 26.18-23.015 26.18Zm85.051 0c-12.645 0-23.014-11.805-23.014-26.18s10.148-26.2 23.014-26.2c12.867 0 23.236 11.804 23.015 26.2 0 14.375-10.148 26.18-23.015 26.18Z"/></svg>

View File

@@ -1,5 +0,0 @@
title: $:/core/images/input-button
tags: $:/tags/Image
\parameters (size:"22pt")
<svg width=<<size>> height=<<size>> class="tc-image-input-button tc-image-button" viewBox="0 0 22 22"><path d="M1.375 22h19.249c.365 0 .716-.145.973-.404v.001c.258-.257.404-.607.403-.972v-11a1.376 1.376 0 0 0-2.75 0v9.625H2.75V9.625a1.376 1.376 0 0 0-2.75 0v11C0 21.384.617 22 1.375 22Z"/><path d="m9.732 11.904-1.541-1.541a1.375 1.375 0 1 0-1.944 1.944l3.887 3.888c.258.258.608.402.973.402h-.001c.353 0 .705-.134.974-.402l3.888-3.889a1.376 1.376 0 0 0 .001-1.944 1.377 1.377 0 0 0-1.946 0l-1.541 1.542V1.376a1.375 1.375 0 1 0-2.75 0v10.528Z"/></svg>

View File

@@ -1,5 +0,0 @@
title: $:/core/images/language
tags: $:/tags/Image
\parameters (size:"22pt")
<svg width=<<size>> height=<<size>> class="tc-image-language tc-image-button" viewBox="0 0 92 92"><path d="M0 0h2480.32v3507.87H0z" style="fill:none" transform="scale(.03696 .02613)"/><path d="M71.508 62.298c-1.243 15.83-16.758 28.344-35.714 28.344-5.713 0-11.113-1.136-15.905-3.158-2.977 2.498-8.618 4.183-15.088 4.183-.929 0-1.84-.034-2.73-.102 4.499-1.5 7.989-4.886 9.298-9.099C4.373 76.918 0 69.016 0 60.246 0 49.773 6.237 40.537 15.729 35.07c1.235 7.764 5.492 14.713 11.724 19.953l-7.269 18.453c-.393.976-.676 1.737-.847 2.285a5.326 5.326 0 0 0-.256 1.591c0 .89.368 1.686 1.103 2.388.736.702 1.583 1.052 2.542 1.052 1.13 0 1.942-.33 2.438-.988.497-.659 1.096-1.93 1.797-3.812l1.797-4.826h15.3l1.797 4.723c.239.582.526 1.254.86 2.015.333.762.646 1.327.936 1.695.291.368.65.659 1.078.873.428.213.942.32 1.54.32a3.586 3.586 0 0 0 2.632-1.09c.727-.728 1.09-1.528 1.09-2.4 0-.84-.384-2.183-1.154-4.031l-3.545-8.755c2.142.3 4.34.455 6.58.455 5.541 0 10.824-.951 15.636-2.674Zm-30.563.247 1.059 2.898H30.76l2.32-6.467a43.152 43.152 0 0 0 7.865 3.569Z"/><path d="M71.778 57.635c-4.793 2.023-10.191 3.157-15.907 3.157-19.767 0-35.793-13.61-35.793-30.396S36.104.001 55.87.001c19.772 0 35.797 13.61 35.797 30.395 0 8.77-4.373 16.674-11.371 22.221 1.309 4.211 4.8 7.6 9.299 9.1-.89.067-1.802.1-2.73.1-6.47 0-12.11-1.686-15.088-4.182Zm-15.59-15.887a44.237 44.237 0 0 0 3.3 2.496c4.284 2.942 9.06 5.381 14.33 7.315l2.334-3.517c-5.134-1.871-9.696-4.125-13.69-6.763a42.558 42.558 0 0 1-3.37-2.483c4.247-4.806 7.374-10.43 9.38-16.869h6.698V17.78h-16.7a47.226 47.226 0 0 0-1.528-2.959 52.943 52.943 0 0 0-2.885-4.562l-4.218 1.554a36.467 36.467 0 0 1 2.971 3.983c.427.661.833 1.323 1.217 1.984H36.394v4.148h6.77a36.878 36.878 0 0 0 5.422 11.56 42.918 42.918 0 0 0 4.591 5.497c-4.687 4.017-10.548 6.932-17.582 8.744l2.247 3.709c7.746-2.44 13.861-5.67 18.347-9.689Zm-9.047-19.82h16.991c-1.86 5.668-4.528 10.402-8 14.204a42.526 42.526 0 0 1-4.247-4.922c-2.126-2.883-3.71-5.977-4.744-9.283Z"/></svg>

View File

@@ -1,7 +0,0 @@
title: $:/core/images/standard-layout
tags: $:/tags/Image
\parameters (size:"22pt")
<svg width=<<size>> height=<<size>> class="tc-image-standard-layout tc-image-button" viewBox="0 0 128 128">
<path d="M71.93 72A8.07 8.07 0 0 1 80 80.07v7.86A8.071 8.071 0 0 1 71.93 96H8.07A8.067 8.067 0 0 1 0 87.93v-7.86A8.072 8.072 0 0 1 8.07 72h63.86Zm0 32a8.07 8.07 0 0 1 8.07 8.07v7.86a8.071 8.071 0 0 1-8.07 8.07H8.07A8.067 8.067 0 0 1 0 119.93v-7.86A8.072 8.072 0 0 1 8.07 104h63.86Zm0-104A8.068 8.068 0 0 1 80 8.07v47.86A8.073 8.073 0 0 1 71.93 64H8.07A8.07 8.07 0 0 1 0 55.93V8.07A8.072 8.072 0 0 1 8.07 0h63.86Zm48 0c2.14 0 4.193.85 5.706 2.364A8.067 8.067 0 0 1 128 8.07v111.86c0 2.14-.85 4.193-2.364 5.706A8.067 8.067 0 0 1 119.93 128H96.07c-2.14 0-4.193-.85-5.706-2.364A8.067 8.067 0 0 1 88 119.93V8.07c0-2.14.85-4.193 2.364-5.706A8.067 8.067 0 0 1 96.07 0h23.86ZM116 24h-16a3.995 3.995 0 0 0-2.828 1.172 3.995 3.995 0 0 0 0 5.656A3.995 3.995 0 0 0 100 32h16a3.995 3.995 0 0 0 2.828-1.172 3.995 3.995 0 0 0 0-5.656A3.995 3.995 0 0 0 116 24Z"/>
</svg>

View File

@@ -3,8 +3,5 @@ name: en-GB
description: English (British) description: English (British)
author: JeremyRuston author: JeremyRuston
core-version: >=5.0.0" core-version: >=5.0.0"
plugin-type: language
type: application/json
hidden: yes
{tidddlers:{}} Stub pseudo-plugin for the default language

View File

@@ -28,7 +28,6 @@ Encryption/ClearPassword/Caption: clear password
Encryption/ClearPassword/Hint: Clear the password and save this wiki without encryption Encryption/ClearPassword/Hint: Clear the password and save this wiki without encryption
Encryption/SetPassword/Caption: set password Encryption/SetPassword/Caption: set password
Encryption/SetPassword/Hint: Set a password for saving this wiki with encryption Encryption/SetPassword/Hint: Set a password for saving this wiki with encryption
EmergencyDownload/Caption: download tiddlers as json
ExportPage/Caption: export all ExportPage/Caption: export all
ExportPage/Hint: Export all tiddlers ExportPage/Hint: Export all tiddlers
ExportTiddler/Caption: export tiddler ExportTiddler/Caption: export tiddler
@@ -80,7 +79,6 @@ NewMarkdown/Caption: new Markdown tiddler
NewMarkdown/Hint: Create a new Markdown tiddler NewMarkdown/Hint: Create a new Markdown tiddler
NewTiddler/Caption: new tiddler NewTiddler/Caption: new tiddler
NewTiddler/Hint: Create a new tiddler NewTiddler/Hint: Create a new tiddler
OpenControlPanel/Hint: Open control panel
OpenWindow/Caption: open in new window OpenWindow/Caption: open in new window
OpenWindow/Hint: Open tiddler in new window OpenWindow/Hint: Open tiddler in new window
Palette/Caption: palette Palette/Caption: palette
@@ -105,8 +103,6 @@ ShowSideBar/Caption: show sidebar
ShowSideBar/Hint: Show sidebar ShowSideBar/Hint: Show sidebar
TagManager/Caption: tag manager TagManager/Caption: tag manager
TagManager/Hint: Open tag manager TagManager/Hint: Open tag manager
TestCaseImport/Caption: import tiddlers
TestCaseImport/Hint: Import tiddlers
Timestamp/Caption: timestamps Timestamp/Caption: timestamps
Timestamp/Hint: Choose whether modifications update timestamps Timestamp/Hint: Choose whether modifications update timestamps
Timestamp/On/Caption: timestamps are on Timestamp/On/Caption: timestamps are on
@@ -133,7 +129,6 @@ Excise/Caption/Replace/Link: link
Excise/Caption/Replace/Transclusion: transclusion Excise/Caption/Replace/Transclusion: transclusion
Excise/Caption/Tag: Tag new tiddler with the title of this tiddler Excise/Caption/Tag: Tag new tiddler with the title of this tiddler
Excise/Caption/TiddlerExists: Warning: tiddler already exists Excise/Caption/TiddlerExists: Warning: tiddler already exists
Excise/DefaultTitle: New Excision
Excise/Hint: Excise the selected text into a new tiddler Excise/Hint: Excise the selected text into a new tiddler
Heading1/Caption: heading 1 Heading1/Caption: heading 1
Heading1/Hint: Apply heading level 1 formatting to lines containing selection Heading1/Hint: Apply heading level 1 formatting to lines containing selection

View File

@@ -96,10 +96,6 @@ Plugins/PluginWillRequireReload: (requires reload)
Plugins/Plugins/Caption: Plugins Plugins/Plugins/Caption: Plugins
Plugins/Plugins/Hint: Plugins Plugins/Plugins/Hint: Plugins
Plugins/Reinstall/Caption: reinstall 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/Caption: Themes
Plugins/Themes/Hint: Theme plugins Plugins/Themes/Hint: Theme plugins
Plugins/Update/Caption: update Plugins/Update/Caption: update
@@ -175,8 +171,6 @@ Settings/NavigationPermalinkviewMode/UpdateAddressBar/Description: Update addres
Settings/PerformanceInstrumentation/Caption: Performance Instrumentation Settings/PerformanceInstrumentation/Caption: Performance Instrumentation
Settings/PerformanceInstrumentation/Hint: Displays performance statistics in the browser developer console. Requires reload to take effect Settings/PerformanceInstrumentation/Hint: Displays performance statistics in the browser developer console. Requires reload to take effect
Settings/PerformanceInstrumentation/Description: Enable performance instrumentation 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/Caption: Toolbar Button Style
Settings/ToolbarButtonStyle/Hint: Choose the style for toolbar buttons: Settings/ToolbarButtonStyle/Hint: Choose the style for toolbar buttons:
Settings/ToolbarButtonStyle/Styles/Borderless: Borderless Settings/ToolbarButtonStyle/Styles/Borderless: Borderless
@@ -204,12 +198,6 @@ Settings/TitleLinks/Yes/Description: Display tiddler titles as links
Settings/MissingLinks/Caption: Wiki Links Settings/MissingLinks/Caption: Wiki Links
Settings/MissingLinks/Hint: Choose whether to link to tiddlers that do not exist yet Settings/MissingLinks/Hint: Choose whether to link to tiddlers that do not exist yet
Settings/MissingLinks/Description: Enable links to missing tiddlers 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/Caption: Story Tiddler
StoryTiddler/Hint: This rule cascade is used to dynamically choose the template for displaying a tiddler in the story river. StoryTiddler/Hint: This rule cascade is used to dynamically choose the template for displaying a tiddler in the story river.
StoryView/Caption: Story View StoryView/Caption: Story View
@@ -218,12 +206,6 @@ Stylesheets/Caption: Stylesheets
Stylesheets/Expand/Caption: Expand All Stylesheets/Expand/Caption: Expand All
Stylesheets/Hint: This is the rendered CSS of the current stylesheet tiddlers tagged with <<tag "$:/tags/Stylesheet">> Stylesheets/Hint: This is the rendered CSS of the current stylesheet tiddlers tagged with <<tag "$:/tags/Stylesheet">>
Stylesheets/Restore/Caption: Restore Stylesheets/Restore/Caption: Restore
TestCases/Caption: Test Cases
TestCases/Hint: Test cases are self contained examples for testing and learning
TestCases/All/Caption: All Test Cases
TestCases/All/Hint: All Test Cases
TestCases/Failed/Caption: Failed Test Cases
TestCases/Failed/Hint: Only Failed Test Cases
Theme/Caption: Theme Theme/Caption: Theme
Theme/Prompt: Current theme: Theme/Prompt: Current theme:
TiddlerFields/Caption: Tiddler Fields TiddlerFields/Caption: Tiddler Fields
@@ -247,7 +229,3 @@ 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. 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/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. 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.

View File

@@ -9,7 +9,7 @@ config: Data to be inserted into `$tw.config`.
filteroperator: Individual filter operator methods. filteroperator: Individual filter operator methods.
global: Global data to be inserted into `$tw`. global: Global data to be inserted into `$tw`.
info: Publishes system information via the [[$:/temp/info-plugin]] pseudo-plugin. info: Publishes system information via the [[$:/temp/info-plugin]] pseudo-plugin.
isfilteroperator: Parameters for the ''is'' filter operator. isfilteroperator: Operands for the ''is'' filter operator.
library: Generic module type for general purpose JavaScript modules. library: Generic module type for general purpose JavaScript modules.
macro: JavaScript macro definitions. macro: JavaScript macro definitions.
parser: Parsers for different content types. parser: Parsers for different content types.

View File

@@ -65,13 +65,6 @@ sidebar-tab-foreground-selected: Sidebar tab foreground for selected tabs
sidebar-tab-foreground: Sidebar tab foreground sidebar-tab-foreground: Sidebar tab foreground
sidebar-tiddler-link-foreground-hover: Sidebar tiddler link foreground hover sidebar-tiddler-link-foreground-hover: Sidebar tiddler link foreground hover
sidebar-tiddler-link-foreground: Sidebar tiddler link foreground sidebar-tiddler-link-foreground: Sidebar tiddler link foreground
stability-stable: Badge for stability level "stable"
stability-experimental: Badge for stability level "experimental"
stability-deprecated: Badge for stability level "deprecated"
stability-legacy: Badge for stability level "legacy"
testcase-accent-level-1: Test case accent colour with no nesting
testcase-accent-level-2: Test case accent colour with 2nd level nesting
testcase-accent-level-3: Test case accent colour with 3rd level nesting or higher
site-title-foreground: Site title foreground site-title-foreground: Site title foreground
static-alert-foreground: Static alert foreground static-alert-foreground: Static alert foreground
tab-background-selected: Tab background for selected tabs tab-background-selected: Tab background for selected tabs

View File

@@ -26,8 +26,6 @@ Tags/ClearInput/Caption: clear input
Tags/ClearInput/Hint: Clear tag input Tags/ClearInput/Hint: Clear tag input
Tags/Dropdown/Caption: tag list Tags/Dropdown/Caption: tag list
Tags/Dropdown/Hint: Show 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 <<bad-chars>> in tiddler titles Title/BadCharacterWarning: Warning: avoid using any of the characters <<bad-chars>> in tiddler titles
Title/Exists/Prompt: Target tiddler already exists Title/Exists/Prompt: Target tiddler already exists
Title/Relink/Prompt: Update ''<$text text=<<fromTitle>>/>'' to ''<$text text=<<toTitle>>/>'' in the //tags// and //list// fields of other tiddlers Title/Relink/Prompt: Update ''<$text text=<<fromTitle>>/>'' to ''<$text text=<<toTitle>>/>'' in the //tags// and //list// fields of other tiddlers

View File

@@ -3,4 +3,4 @@ title: $:/language/Exporters/
StaticRiver: Static HTML StaticRiver: Static HTML
JsonFile: JSON file JsonFile: JSON file
CsvFile: CSV file CsvFile: CSV file
TidFile: TID text file TidFile: ".tid" file

View File

@@ -4,7 +4,6 @@ _canonical_uri: The full URI of an external image tiddler
author: Name of the author of a plugin author: Name of the author of a plugin
bag: The name of the bag from which a tiddler came bag: The name of the bag from which a tiddler came
caption: The text to be displayed on a tab or button 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]]
code-body: The view template will display the tiddler as code if set to ''yes'' code-body: The view template will display the tiddler as code if set to ''yes''
color: The CSS color value associated with a tiddler 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|AlertMechanism]]
@@ -30,7 +29,6 @@ name: The human readable name associated with a plugin tiddler
parent-plugin: For a plugin, specifies which plugin of which it is a sub-plugin parent-plugin: For a plugin, specifies which plugin of which it is a sub-plugin
plugin-priority: A numerical value indicating the priority of a plugin tiddler plugin-priority: A numerical value indicating the priority of a plugin tiddler
plugin-type: The type of plugin in a plugin tiddler plugin-type: The type of plugin in a plugin tiddler
stability: The development status of a plugin: deprecated, experimental, stable, or legacy
revision: The revision of the tiddler held at the server revision: The revision of the tiddler held at the server
released: Date of a TiddlyWiki release released: Date of a TiddlyWiki release
source: The source URL associated with a tiddler source: The source URL associated with a tiddler

View File

@@ -10,7 +10,7 @@ Sequentially run the command tokens returned from a filter
Examples Examples
``` ```
--commands "[enlist:raw{$:/build-commands-as-text}]" --commands "[enlist{$:/build-commands-as-text}]"
``` ```
``` ```

View File

@@ -19,7 +19,7 @@ The following options are supported:
** ''yes'' will "explode" plugins into separate tiddler files and save them to the plugin directory within the wiki folder ** ''yes'' will "explode" plugins into separate tiddler files and save them to the plugin directory within the wiki folder
** ''no'' will suppress exploding plugins into their constituent tiddler files. It will save the plugin as a single JSON tiddler in the tiddlers folder ** ''no'' will suppress exploding plugins into their constituent tiddler files. It will save the plugin as a single JSON tiddler in the tiddlers folder
Note that both ''explodePlugins'' options will produce wiki folders that build the exact same original wiki. The difference lies in how plugins are represented in the wiki folder. Note that both ''explodePlugins'' options will produce wiki folders that build the same exact same original wiki. The difference lies in how plugins are represented in the wiki folder.
A common usage is to convert a TiddlyWiki HTML file into a wiki folder: A common usage is to convert a TiddlyWiki HTML file into a wiki folder:
@@ -31,4 +31,4 @@ Save the plugin to the tiddlers directory of the target wiki folder:
``` ```
tiddlywiki --load ./mywiki.html --savewikifolder ./mywikifolder explodePlugins=no tiddlywiki --load ./mywiki.html --savewikifolder ./mywikifolder explodePlugins=no
``` ```

View File

@@ -30,7 +30,7 @@ Error/DeserializeOperator/UnknownDeserializer: Filter Error: Unknown deserialize
Error/Filter: Filter error Error/Filter: Filter error
Error/FilterSyntax: Syntax error in filter expression Error/FilterSyntax: Syntax error in filter expression
Error/FilterRunPrefix: Filter Error: Unknown prefix for filter run Error/FilterRunPrefix: Filter Error: Unknown prefix for filter run
Error/IsFilterOperator: Filter Error: Unknown parameter for the 'is' filter operator Error/IsFilterOperator: Filter Error: Unknown operand for the 'is' filter operator
Error/FormatFilterOperator: Filter Error: Unknown suffix for the 'format' filter operator Error/FormatFilterOperator: Filter Error: Unknown suffix for the 'format' filter operator
Error/LoadingPluginLibrary: Error loading plugin library Error/LoadingPluginLibrary: Error loading plugin library
Error/NetworkErrorAlert: `<h2>''Network Error''</h2>It looks like the connection to the server has been lost. This may indicate a problem with your network connection. Please attempt to restore network connectivity before continuing.<br><br>''Any unsaved changes will be automatically synchronised when connectivity is restored''.` Error/NetworkErrorAlert: `<h2>''Network Error''</h2>It looks like the connection to the server has been lost. This may indicate a problem with your network connection. Please attempt to restore network connectivity before continuing.<br><br>''Any unsaved changes will be automatically synchronised when connectivity is restored''.`
@@ -70,7 +70,7 @@ No: No
OfficialPluginLibrary: Official ~TiddlyWiki Plugin Library OfficialPluginLibrary: Official ~TiddlyWiki Plugin Library
OfficialPluginLibrary/Hint: The official ~TiddlyWiki plugin library at tiddlywiki.com. Plugins, themes and language packs are maintained by the core team. OfficialPluginLibrary/Hint: The official ~TiddlyWiki plugin library at tiddlywiki.com. Plugins, themes and language packs are maintained by the core team.
PageTemplate/Description: the default ~TiddlyWiki layout PageTemplate/Description: the default ~TiddlyWiki layout
PageTemplate/Name: Standard Layout PageTemplate/Name: Default ~PageTemplate
PluginReloadWarning: Please save {{$:/core/ui/Buttons/save-wiki}} and reload {{$:/core/ui/Buttons/refresh}} to allow changes to ~JavaScript plugins to take effect PluginReloadWarning: Please save {{$:/core/ui/Buttons/save-wiki}} and reload {{$:/core/ui/Buttons/refresh}} to allow changes to ~JavaScript plugins to take effect
RecentChanges/DateFormat: DDth MMM YYYY RecentChanges/DateFormat: DDth MMM YYYY
Shortcuts/Input/AdvancedSearch/Hint: Open the ~AdvancedSearch panel from within the sidebar search field Shortcuts/Input/AdvancedSearch/Hint: Open the ~AdvancedSearch panel from within the sidebar search field

View File

@@ -6,8 +6,6 @@ Filter/Hint: Search via a [[filter expression|https://tiddlywiki.com/static/Filt
Filter/Matches: //<small><<resultCount>> matches</small>// Filter/Matches: //<small><<resultCount>> matches</small>//
Matches: //<small><<resultCount>> matches</small>// Matches: //<small><<resultCount>> matches</small>//
Matches/All: All matches: Matches/All: All matches:
Matches/NoMatch: //No match//
Matches/NoResult: //No search result//
Matches/Title: Title matches: Matches/Title: Title matches:
Search: Search Search: Search
Search/TooShort: Search text too short Search/TooShort: Search text too short

View File

@@ -1,7 +0,0 @@
title: $:/language/Snippets/FunctionDefinition
tags: $:/tags/TextEditor/Snippet
caption: Function definition
\function f.name(param1,param2:"default value") [<param1>!is[blank]else<param2>]
<<f.name>>

View File

@@ -1,7 +0,0 @@
title: $:/language/Snippets/ProcedureDefinition
tags: $:/tags/TextEditor/Snippet
caption: Procedure definition
\procedure procName(param1:"default value",param2)
Your text comes here.
\end

View File

@@ -1,5 +1,5 @@
title: $:/language/Docs/Types/image/svg+xml title: $:/language/Docs/Types/image/svg+xml
description: SVG image description: Structured Vector Graphics image
name: image/svg+xml name: image/svg+xml
group: Image group: Image
group-sort: 1 group-sort: 1

View File

@@ -0,0 +1,5 @@
title: $:/language/Docs/Types/image/x-icon
description: ICO format icon file
name: image/x-icon
group: Image
group-sort: 1

View File

@@ -1,5 +0,0 @@
title: $:/language/Docs/Types/text/vnd.tiddlywiki-multiple
description: Compound tiddler
name: text/vnd.tiddlywiki-multiple
group: Developer
group-sort: 2

View File

@@ -0,0 +1,13 @@
title: $:/languages/en-GB/icon
type: image/svg+xml
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 60 30" width="1200" height="600">
<clipPath id="t">
<path d="M30,15 h30 v15 z v15 h-30 z h-30 v-15 z v-15 h30 z"/>
</clipPath>
<path d="M0,0 v30 h60 v-30 z" fill="#00247d"/>
<path d="M0,0 L60,30 M60,0 L0,30" stroke="#fff" stroke-width="6"/>
<path d="M0,0 L60,30 M60,0 L0,30" clip-path="url(#t)" stroke="#cf142b" stroke-width="4"/>
<path d="M30,0 v30 M0,15 h60" stroke="#fff" stroke-width="10"/>
<path d="M30,0 v30 M0,15 h60" stroke="#cf142b" stroke-width="6"/>
</svg>

View File

@@ -6,7 +6,10 @@ module-type: global
The $tw.Commander class is a command interpreter The $tw.Commander class is a command interpreter
\*/ \*/
(function(){
/*jslint node: true, browser: true */
/*global $tw: false */
"use strict"; "use strict";
/* /*
@@ -170,3 +173,5 @@ Commander.initCommands = function(moduleType) {
}; };
exports.Commander = Commander; exports.Commander = Commander;
})();

View File

@@ -6,7 +6,10 @@ module-type: command
Command to build a build target Command to build a build target
\*/ \*/
(function(){
/*jslint node: true, browser: true */
/*global $tw: false */
"use strict"; "use strict";
exports.info = { exports.info = {
@@ -21,7 +24,7 @@ var Command = function(params,commander) {
Command.prototype.execute = function() { Command.prototype.execute = function() {
// Get the build targets defined in the wiki // Get the build targets defined in the wiki
var buildTargets = $tw.boot.wikiInfo && $tw.boot.wikiInfo.build; var buildTargets = $tw.boot.wikiInfo.build;
if(!buildTargets) { if(!buildTargets) {
return "No build targets defined"; return "No build targets defined";
} }
@@ -45,3 +48,5 @@ Command.prototype.execute = function() {
}; };
exports.Command = Command; exports.Command = Command;
})();

View File

@@ -6,7 +6,10 @@ module-type: command
Clear password for crypto operations Clear password for crypto operations
\*/ \*/
(function(){
/*jslint node: true, browser: true */
/*global $tw: false */
"use strict"; "use strict";
exports.info = { exports.info = {
@@ -26,3 +29,5 @@ Command.prototype.execute = function() {
}; };
exports.Command = Command; exports.Command = Command;
})();

View File

@@ -7,6 +7,10 @@ Runs the commands returned from a filter
\*/ \*/
(function() {
/*jslint node: true, browser: true */
/*global $tw: false */
"use strict"; "use strict";
exports.info = { exports.info = {
@@ -34,3 +38,5 @@ Command.prototype.execute = function() {
}; };
exports.Command = Command; exports.Command = Command;
})();

View File

@@ -6,7 +6,10 @@ module-type: command
Command to delete tiddlers Command to delete tiddlers
\*/ \*/
(function(){
/*jslint node: true, browser: true */
/*global $tw: false */
"use strict"; "use strict";
exports.info = { exports.info = {
@@ -35,3 +38,5 @@ Command.prototype.execute = function() {
}; };
exports.Command = Command; exports.Command = Command;
})();

View File

@@ -6,7 +6,10 @@ module-type: command
Command to list the available editions Command to list the available editions
\*/ \*/
(function(){
/*jslint node: true, browser: true */
/*global $tw: false */
"use strict"; "use strict";
exports.info = { exports.info = {
@@ -32,3 +35,5 @@ Command.prototype.execute = function() {
}; };
exports.Command = Command; exports.Command = Command;
})();

View File

@@ -6,7 +6,10 @@ module-type: command
Commands to fetch external tiddlers Commands to fetch external tiddlers
\*/ \*/
(function(){
/*jslint node: true, browser: true */
/*global $tw: false */
"use strict"; "use strict";
exports.info = { exports.info = {
@@ -168,3 +171,5 @@ Command.prototype.processBody = function(body,type,options,url) {
}; };
exports.Command = Command; exports.Command = Command;
})();

View File

@@ -6,7 +6,10 @@ module-type: command
Help command Help command
\*/ \*/
(function(){
/*jshint node: true, browser: true */
/*global $tw: false */
"use strict"; "use strict";
exports.info = { exports.info = {
@@ -34,3 +37,5 @@ Command.prototype.execute = function() {
}; };
exports.Command = Command; exports.Command = Command;
})();

View File

@@ -6,7 +6,10 @@ module-type: command
Command to import tiddlers from a file Command to import tiddlers from a file
\*/ \*/
(function(){
/*jslint node: true, browser: true */
/*global $tw: false */
"use strict"; "use strict";
exports.info = { exports.info = {
@@ -41,3 +44,5 @@ Command.prototype.execute = function() {
}; };
exports.Command = Command; exports.Command = Command;
})();

View File

@@ -6,7 +6,10 @@ module-type: command
Command to initialise an empty wiki folder Command to initialise an empty wiki folder
\*/ \*/
(function(){
/*jslint node: true, browser: true */
/*global $tw: false */
"use strict"; "use strict";
exports.info = { exports.info = {
@@ -52,3 +55,5 @@ Command.prototype.execute = function() {
}; };
exports.Command = Command; exports.Command = Command;
})();

View File

@@ -6,7 +6,10 @@ module-type: command
Listen for HTTP requests and serve tiddlers Listen for HTTP requests and serve tiddlers
\*/ \*/
(function(){
/*jslint node: true, browser: true */
/*global $tw: false */
"use strict"; "use strict";
var Server = require("$:/core/modules/server/server.js").Server; var Server = require("$:/core/modules/server/server.js").Server;
@@ -15,7 +18,7 @@ exports.info = {
name: "listen", name: "listen",
synchronous: true, synchronous: true,
namedParameterMode: true, namedParameterMode: true,
mandatoryParameters: [] mandatoryParameters: [],
}; };
var Command = function(params,commander,callback) { var Command = function(params,commander,callback) {
@@ -41,3 +44,5 @@ Command.prototype.execute = function() {
}; };
exports.Command = Command; exports.Command = Command;
})();

View File

@@ -6,7 +6,10 @@ module-type: command
Command to load tiddlers from a file or directory Command to load tiddlers from a file or directory
\*/ \*/
(function(){
/*jslint node: true, browser: true */
/*global $tw: false */
"use strict"; "use strict";
exports.info = { exports.info = {
@@ -44,3 +47,5 @@ Command.prototype.execute = function() {
}; };
exports.Command = Command; exports.Command = Command;
})();

View File

@@ -6,7 +6,10 @@ module-type: command
Command to pack all of the plugins in the library into a plugin tiddler of type "library" 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"; "use strict";
exports.info = { exports.info = {
@@ -24,8 +27,33 @@ var Command = function(params,commander,callback) {
Command.prototype.execute = function() { Command.prototype.execute = function() {
var wiki = this.commander.wiki, var wiki = this.commander.wiki,
fs = require("fs"),
path = require("path"),
upgradeLibraryTitle = this.params[0] || UPGRADE_LIBRARY_TITLE, upgradeLibraryTitle = this.params[0] || UPGRADE_LIBRARY_TITLE,
tiddlers = $tw.utils.getAllPlugins(); tiddlers = {};
// Collect up the library plugins
var collectPlugins = function(folder) {
var pluginFolders = $tw.utils.getSubdirectories(folder) || [];
for(var p=0; p<pluginFolders.length; p++) {
if(!$tw.boot.excludeRegExp.test(pluginFolders[p])) {
pluginFields = $tw.loadPluginFolder(path.resolve(folder,"./" + pluginFolders[p]));
if(pluginFields && pluginFields.title) {
tiddlers[pluginFields.title] = pluginFields;
}
}
}
},
collectPublisherPlugins = function(folder) {
var publisherFolders = $tw.utils.getSubdirectories(folder) || [];
for(var t=0; t<publisherFolders.length; t++) {
if(!$tw.boot.excludeRegExp.test(publisherFolders[t])) {
collectPlugins(path.resolve(folder,"./" + publisherFolders[t]));
}
}
};
$tw.utils.each($tw.getLibraryItemSearchPaths($tw.config.pluginsPath,$tw.config.pluginsEnvVar),collectPublisherPlugins);
$tw.utils.each($tw.getLibraryItemSearchPaths($tw.config.themesPath,$tw.config.themesEnvVar),collectPublisherPlugins);
$tw.utils.each($tw.getLibraryItemSearchPaths($tw.config.languagesPath,$tw.config.languagesEnvVar),collectPlugins);
// Save the upgrade library tiddler // Save the upgrade library tiddler
var pluginFields = { var pluginFields = {
title: upgradeLibraryTitle, title: upgradeLibraryTitle,
@@ -38,3 +66,5 @@ Command.prototype.execute = function() {
}; };
exports.Command = Command; exports.Command = Command;
})();

View File

@@ -6,7 +6,10 @@ module-type: command
Command to set the default output location (defaults to current working directory) Command to set the default output location (defaults to current working directory)
\*/ \*/
(function(){
/*jslint node: true, browser: true */
/*global $tw: false */
"use strict"; "use strict";
exports.info = { exports.info = {
@@ -31,3 +34,5 @@ Command.prototype.execute = function() {
}; };
exports.Command = Command; exports.Command = Command;
})();

View File

@@ -6,7 +6,10 @@ module-type: command
Save password for crypto operations Save password for crypto operations
\*/ \*/
(function(){
/*jslint node: true, browser: true */
/*global $tw: false */
"use strict"; "use strict";
exports.info = { exports.info = {
@@ -29,3 +32,5 @@ Command.prototype.execute = function() {
}; };
exports.Command = Command; exports.Command = Command;
})();

View File

@@ -6,7 +6,10 @@ module-type: command
Render individual tiddlers and save the results to the specified files Render individual tiddlers and save the results to the specified files
\*/ \*/
(function(){
/*jslint node: true, browser: true */
/*global $tw: false */
"use strict"; "use strict";
var widget = require("$:/core/modules/widgets/widget.js"); var widget = require("$:/core/modules/widgets/widget.js");
@@ -42,24 +45,22 @@ Render individual tiddlers and save the results to the specified files
variableList = variableList.slice(2); variableList = variableList.slice(2);
} }
$tw.utils.each(tiddlers,function(title) { $tw.utils.each(tiddlers,function(title) {
var filenameResults = wiki.filterTiddlers(filenameFilter,$tw.rootWidget,wiki.makeTiddlerIterator([title])); var filepath = path.resolve(self.commander.outputPath,wiki.filterTiddlers(filenameFilter,$tw.rootWidget,wiki.makeTiddlerIterator([title]))[0]);
if(filenameResults.length > 0) { if(self.commander.verbose) {
var filepath = path.resolve(self.commander.outputPath,filenameResults[0]); console.log("Rendering \"" + title + "\" to \"" + filepath + "\"");
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; return null;
}; };
exports.Command = Command; exports.Command = Command;
})();

View File

@@ -6,7 +6,10 @@ module-type: command
Command to render a tiddler and save it to a file Command to render a tiddler and save it to a file
\*/ \*/
(function(){
/*jslint node: true, browser: true */
/*global $tw: false */
"use strict"; "use strict";
exports.info = { exports.info = {
@@ -50,3 +53,5 @@ Command.prototype.execute = function() {
}; };
exports.Command = Command; exports.Command = Command;
})();

View File

@@ -6,7 +6,10 @@ module-type: command
Command to render several tiddlers to a folder of files Command to render several tiddlers to a folder of files
\*/ \*/
(function(){
/*jslint node: true, browser: true */
/*global $tw: false */
"use strict"; "use strict";
var widget = require("$:/core/modules/widgets/widget.js"); var widget = require("$:/core/modules/widgets/widget.js");
@@ -62,3 +65,5 @@ Command.prototype.execute = function() {
}; };
exports.Command = Command; exports.Command = Command;
})();

View File

@@ -6,7 +6,10 @@ module-type: command
Saves individual tiddlers in their raw text or binary format to the specified files 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"; "use strict";
exports.info = { exports.info = {
@@ -40,9 +43,7 @@ Saves individual tiddlers in their raw text or binary format to the specified fi
directory: path.resolve(self.commander.outputPath), directory: path.resolve(self.commander.outputPath),
pathFilters: [filenameFilter], pathFilters: [filenameFilter],
wiki: wiki, wiki: wiki,
fileInfo: { fileInfo: {}
overwrite: true
}
}); });
if(self.commander.verbose) { if(self.commander.verbose) {
console.log("Saving \"" + title + "\" to \"" + fileInfo.filepath + "\""); console.log("Saving \"" + title + "\" to \"" + fileInfo.filepath + "\"");
@@ -61,3 +62,6 @@ Saves individual tiddlers in their raw text or binary format to the specified fi
}; };
exports.Command = Command; exports.Command = Command;
})();

View File

@@ -16,7 +16,10 @@ 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. 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"; "use strict";
exports.info = { exports.info = {
@@ -91,3 +94,5 @@ Command.prototype.execute = function() {
}; };
exports.Command = Command; exports.Command = Command;
})();

View File

@@ -6,7 +6,10 @@ module-type: command
Command to save the content of a tiddler to a file Command to save the content of a tiddler to a file
\*/ \*/
(function(){
/*jslint node: true, browser: true */
/*global $tw: false */
"use strict"; "use strict";
exports.info = { exports.info = {
@@ -44,3 +47,5 @@ Command.prototype.execute = function() {
}; };
exports.Command = Command; exports.Command = Command;
})();

View File

@@ -6,7 +6,10 @@ module-type: command
Command to save several tiddlers to a folder of files Command to save several tiddlers to a folder of files
\*/ \*/
(function(){
/*jslint node: true, browser: true */
/*global $tw: false */
"use strict"; "use strict";
var widget = require("$:/core/modules/widgets/widget.js"); var widget = require("$:/core/modules/widgets/widget.js");
@@ -43,9 +46,11 @@ Command.prototype.execute = function() {
type = tiddler.fields.type || "text/vnd.tiddlywiki", type = tiddler.fields.type || "text/vnd.tiddlywiki",
contentTypeInfo = $tw.config.contentTypeInfo[type] || {encoding: "utf8"}, contentTypeInfo = $tw.config.contentTypeInfo[type] || {encoding: "utf8"},
filename = path.resolve(pathname,$tw.utils.encodeURIComponentExtended(title)); filename = path.resolve(pathname,$tw.utils.encodeURIComponentExtended(title));
fs.writeFileSync(filename,tiddler.fields.text || "",contentTypeInfo.encoding); fs.writeFileSync(filename,tiddler.fields.text,contentTypeInfo.encoding);
}); });
return null; return null;
}; };
exports.Command = Command; exports.Command = Command;
})();

View File

@@ -15,7 +15,10 @@ The following options are supported:
Supports backward compatibility with --savewikifolder <wikifolderpath> [<filter>] [ [<name>=<value>] ]* Supports backward compatibility with --savewikifolder <wikifolderpath> [<filter>] [ [<name>=<value>] ]*
\*/ \*/
(function(){
/*jslint node: true, browser: true */
/*global $tw: false */
"use strict"; "use strict";
exports.info = { exports.info = {
@@ -173,10 +176,7 @@ WikiFolderMaker.prototype.saveCustomPlugin = function(pluginTiddler) {
this.saveJSONFile(directory + path.sep + "plugin.info",pluginInfo); this.saveJSONFile(directory + path.sep + "plugin.info",pluginInfo);
self.log("Writing " + directory + path.sep + "plugin.info: " + JSON.stringify(pluginInfo,null,$tw.config.preferences.jsonSpaces)); self.log("Writing " + directory + path.sep + "plugin.info: " + JSON.stringify(pluginInfo,null,$tw.config.preferences.jsonSpaces));
var pluginTiddlers = $tw.utils.parseJSONSafe(pluginTiddler.fields.text).tiddlers; // A hashmap of tiddlers in the plugin var pluginTiddlers = $tw.utils.parseJSONSafe(pluginTiddler.fields.text).tiddlers; // A hashmap of tiddlers in the plugin
$tw.utils.each(pluginTiddlers,function(tiddler,title) { $tw.utils.each(pluginTiddlers,function(tiddler) {
if(!tiddler.title) {
tiddler.title = title;
}
self.saveTiddler(directory,new $tw.Tiddler(tiddler)); self.saveTiddler(directory,new $tw.Tiddler(tiddler));
}); });
}; };
@@ -218,3 +218,5 @@ WikiFolderMaker.prototype.saveFile = function(filename,encoding,data) {
}; };
exports.Command = Command; exports.Command = Command;
})();

View File

@@ -6,7 +6,10 @@ module-type: command
Deprecated legacy command for serving tiddlers Deprecated legacy command for serving tiddlers
\*/ \*/
(function(){
/*jslint node: true, browser: true */
/*global $tw: false */
"use strict"; "use strict";
var Server = require("$:/core/modules/server/server.js").Server; var Server = require("$:/core/modules/server/server.js").Server;
@@ -48,3 +51,5 @@ Command.prototype.execute = function() {
}; };
exports.Command = Command; exports.Command = Command;
})();

View File

@@ -6,7 +6,10 @@ 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. 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"; "use strict";
var widget = require("$:/core/modules/widgets/widget.js"); var widget = require("$:/core/modules/widgets/widget.js");
@@ -51,3 +54,5 @@ Command.prototype.execute = function() {
}; };
exports.Command = Command; exports.Command = Command;
})();

View File

@@ -6,7 +6,10 @@ module-type: command
Command to extract the shadow tiddlers from within a plugin Command to extract the shadow tiddlers from within a plugin
\*/ \*/
(function(){
/*jslint node: true, browser: true */
/*global $tw: false */
"use strict"; "use strict";
exports.info = { exports.info = {
@@ -37,3 +40,5 @@ Command.prototype.execute = function() {
}; };
exports.Command = Command; exports.Command = Command;
})();

View File

@@ -6,7 +6,10 @@ module-type: command
Verbose command Verbose command
\*/ \*/
(function(){
/*jslint node: true, browser: true */
/*global $tw: false */
"use strict"; "use strict";
exports.info = { exports.info = {
@@ -27,3 +30,5 @@ Command.prototype.execute = function() {
}; };
exports.Command = Command; exports.Command = Command;
})();

View File

@@ -6,7 +6,10 @@ module-type: command
Version command Version command
\*/ \*/
(function(){
/*jslint node: true, browser: true */
/*global $tw: false */
"use strict"; "use strict";
exports.info = { exports.info = {
@@ -25,3 +28,5 @@ Command.prototype.execute = function() {
}; };
exports.Command = Command; exports.Command = Command;
})();

View File

@@ -6,7 +6,10 @@ module-type: config
Core configuration constants Core configuration constants
\*/ \*/
(function(){
/*jslint node: true, browser: true */
/*global $tw: false */
"use strict"; "use strict";
exports.preferences = {}; exports.preferences = {};
@@ -27,10 +30,12 @@ exports.textPrimitives.wikiLink = exports.textPrimitives.upperLetter + "+" +
exports.textPrimitives.upperLetter + exports.textPrimitives.upperLetter +
exports.textPrimitives.anyLetter + "*"; 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, 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.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.htmlVoidElements = "area,base,br,col,command,embed,hr,img,input,keygen,link,meta,param,source,track,wbr".split(","); exports.htmlVoidElements = "area,base,br,col,command,embed,hr,img,input,keygen,link,meta,param,source,track,wbr".split(",");
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.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(","); exports.htmlUnsafeElements = "script".split(",");
})();

View File

@@ -6,7 +6,10 @@ module-type: tiddlerdeserializer
Functions to deserialise tiddlers from a block of text Functions to deserialise tiddlers from a block of text
\*/ \*/
(function(){
/*jslint node: true, browser: true */
/*global $tw: false */
"use strict"; "use strict";
exports["application/x-tiddler-html-div"] = function(text,fields) { exports["application/x-tiddler-html-div"] = function(text,fields) {
@@ -178,3 +181,5 @@ var deserializeTiddlerDiv = function(text /* [,fields] */) {
} }
return undefined; return undefined;
}; };
})();

View File

@@ -6,7 +6,10 @@ 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 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"; "use strict";
var HEIGHT_VALUE_TITLE = "$:/config/TextEditor/EditorHeight/Height"; var HEIGHT_VALUE_TITLE = "$:/config/TextEditor/EditorHeight/Height";
@@ -270,3 +273,5 @@ FramedEngine.prototype.executeTextOperation = function(operation) {
}; };
exports.FramedEngine = FramedEngine; exports.FramedEngine = FramedEngine;
})();

View File

@@ -6,7 +6,10 @@ module-type: library
Text editor engine based on a simple input or textarea tag Text editor engine based on a simple input or textarea tag
\*/ \*/
(function(){
/*jslint node: true, browser: true */
/*global $tw: false */
"use strict"; "use strict";
var HEIGHT_VALUE_TITLE = "$:/config/TextEditor/EditorHeight/Height"; var HEIGHT_VALUE_TITLE = "$:/config/TextEditor/EditorHeight/Height";
@@ -169,3 +172,5 @@ SimpleEngine.prototype.executeTextOperation = function(operation) {
}; };
exports.SimpleEngine = SimpleEngine; exports.SimpleEngine = SimpleEngine;
})();

View File

@@ -6,7 +6,10 @@ module-type: library
Factory for constructing text editor widgets with specified engines for the toolbar and non-toolbar cases 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"; "use strict";
var DEFAULT_MIN_TEXT_AREA_HEIGHT = "100px"; // Minimum height of textareas in pixels var DEFAULT_MIN_TEXT_AREA_HEIGHT = "100px"; // Minimum height of textareas in pixels
@@ -383,3 +386,5 @@ function editTextWidgetFactory(toolbarEngine,nonToolbarEngine) {
} }
exports.editTextWidgetFactory = editTextWidgetFactory; exports.editTextWidgetFactory = editTextWidgetFactory;
})();

View File

@@ -6,7 +6,10 @@ module-type: bitmapeditoroperation
Bitmap editor operation to clear the image Bitmap editor operation to clear the image
\*/ \*/
(function(){
/*jslint node: true, browser: true */
/*global $tw: false */
"use strict"; "use strict";
exports["clear"] = function(event) { exports["clear"] = function(event) {
@@ -17,3 +20,5 @@ exports["clear"] = function(event) {
// Save changes // Save changes
this.strokeEnd(); this.strokeEnd();
}; };
})();

View File

@@ -6,7 +6,10 @@ module-type: bitmapeditoroperation
Bitmap editor operation to resize the image Bitmap editor operation to resize the image
\*/ \*/
(function(){
/*jslint node: true, browser: true */
/*global $tw: false */
"use strict"; "use strict";
exports["resize"] = function(event) { exports["resize"] = function(event) {
@@ -22,3 +25,5 @@ exports["resize"] = function(event) {
// Save the image into the tiddler // Save the image into the tiddler
this.saveChanges(); this.saveChanges();
}; };
})();

View File

@@ -6,7 +6,10 @@ module-type: bitmapeditoroperation
Bitmap editor operation to rotate the image left by 90 degrees Bitmap editor operation to rotate the image left by 90 degrees
\*/ \*/
(function(){
/*jslint node: true, browser: true */
/*global $tw: false */
"use strict"; "use strict";
exports["rotate-left"] = function(event) { exports["rotate-left"] = function(event) {
@@ -17,3 +20,5 @@ exports["rotate-left"] = function(event) {
// Save the image into the tiddler // Save the image into the tiddler
this.saveChanges(); this.saveChanges();
}; };
})();

View File

@@ -6,30 +6,26 @@ module-type: texteditoroperation
Text editor operation to excise the selection to a new tiddler Text editor operation to excise the selection to a new tiddler
\*/ \*/
(function(){
/*jslint node: true, browser: true */
/*global $tw: false */
"use strict"; "use strict";
function isMarkdown(mediaType) {
return mediaType === 'text/markdown' || mediaType === 'text/x-markdown';
}
exports["excise"] = function(event,operation) { exports["excise"] = function(event,operation) {
var editTiddler = this.wiki.getTiddler(this.editTitle), 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"]) { if(editTiddler && editTiddler.fields["draft.of"]) {
editTiddlerTitle = editTiddler.fields["draft.of"]; editTiddlerTitle = editTiddler.fields["draft.of"];
} }
var excisionTitle = event.paramObject.title || this.wiki.generateNewTitle(excisionBaseTitle); var excisionTitle = event.paramObject.title || this.wiki.generateNewTitle("New Excision");
this.wiki.addTiddler(new $tw.Tiddler( this.wiki.addTiddler(new $tw.Tiddler(
this.wiki.getCreationFields(), this.wiki.getCreationFields(),
this.wiki.getModificationFields(), this.wiki.getModificationFields(),
{ {
title: excisionTitle, title: excisionTitle,
text: operation.selection, text: operation.selection,
tags: event.paramObject.tagnew === "yes" ? [editTiddlerTitle] : [], tags: event.paramObject.tagnew === "yes" ? [editTiddlerTitle] : []
type: editTiddler.fields.type
} }
)); ));
operation.replacement = excisionTitle; operation.replacement = excisionTitle;
@@ -38,8 +34,7 @@ exports["excise"] = function(event,operation) {
operation.replacement = "{{" + operation.replacement+ "}}"; operation.replacement = "{{" + operation.replacement+ "}}";
break; break;
case "link": case "link":
operation.replacement = wikiLinks ? "[[" + operation.replacement+ "]]" operation.replacement = "[[" + operation.replacement+ "]]";
: ("[" + operation.replacement + "](<#" + operation.replacement + ">)");
break; break;
case "macro": case "macro":
operation.replacement = "<<" + (event.paramObject.macro || "translink") + " \"\"\"" + operation.replacement + "\"\"\">>"; operation.replacement = "<<" + (event.paramObject.macro || "translink") + " \"\"\"" + operation.replacement + "\"\"\">>";
@@ -50,3 +45,5 @@ exports["excise"] = function(event,operation) {
operation.newSelStart = operation.selStart; operation.newSelStart = operation.selStart;
operation.newSelEnd = operation.selStart + operation.replacement.length; operation.newSelEnd = operation.selStart + operation.replacement.length;
}; };
})();

View File

@@ -4,9 +4,14 @@ type: application/javascript
module-type: texteditoroperation module-type: texteditoroperation
Simply focus the Text editor Simply focus the Text editor
\*/ \*/
(function(){
/*jslint node: true, browser: true */
/*global $tw: false */
"use strict"; "use strict";
exports["focus-editor"] = function(event,operation) { exports["focus-editor"] = function(event,operation) {
operation = null; operation = null;
}; };
})();

View File

@@ -6,7 +6,10 @@ module-type: texteditoroperation
Text editor operation insert text at the caret position. If there is a selection it is replaced. 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"; "use strict";
exports["insert-text"] = function(event,operation) { exports["insert-text"] = function(event,operation) {
@@ -16,3 +19,5 @@ exports["insert-text"] = function(event,operation) {
operation.newSelStart = operation.selStart + operation.replacement.length; operation.newSelStart = operation.selStart + operation.replacement.length;
operation.newSelEnd = operation.newSelStart; operation.newSelEnd = operation.newSelStart;
}; };
})();

View File

@@ -6,7 +6,10 @@ module-type: texteditoroperation
Text editor operation to make a link Text editor operation to make a link
\*/ \*/
(function(){
/*jslint node: true, browser: true */
/*global $tw: false */
"use strict"; "use strict";
exports["make-link"] = function(event,operation) { exports["make-link"] = function(event,operation) {
@@ -22,3 +25,5 @@ exports["make-link"] = function(event,operation) {
operation.newSelStart = operation.selStart + operation.replacement.length; operation.newSelStart = operation.selStart + operation.replacement.length;
operation.newSelEnd = operation.newSelStart; operation.newSelEnd = operation.newSelStart;
}; };
})();

View File

@@ -6,7 +6,10 @@ module-type: texteditoroperation
Text editor operation to add a prefix to the selected lines Text editor operation to add a prefix to the selected lines
\*/ \*/
(function(){
/*jslint node: true, browser: true */
/*global $tw: false */
"use strict"; "use strict";
exports["prefix-lines"] = function(event,operation) { exports["prefix-lines"] = function(event,operation) {
@@ -48,3 +51,5 @@ exports["prefix-lines"] = function(event,operation) {
operation.newSelEnd = operation.newSelStart + operation.replacement.length; operation.newSelEnd = operation.newSelStart + operation.replacement.length;
} }
}; };
})();

View File

@@ -6,7 +6,10 @@ module-type: texteditoroperation
Text editor operation to replace the entire text Text editor operation to replace the entire text
\*/ \*/
(function(){
/*jslint node: true, browser: true */
/*global $tw: false */
"use strict"; "use strict";
exports["replace-all"] = function(event,operation) { exports["replace-all"] = function(event,operation) {
@@ -16,3 +19,5 @@ exports["replace-all"] = function(event,operation) {
operation.newSelStart = 0; operation.newSelStart = 0;
operation.newSelEnd = operation.replacement.length; operation.newSelEnd = operation.replacement.length;
}; };
})();

View File

@@ -6,7 +6,10 @@ module-type: texteditoroperation
Text editor operation to replace the selection Text editor operation to replace the selection
\*/ \*/
(function(){
/*jslint node: true, browser: true */
/*global $tw: false */
"use strict"; "use strict";
exports["replace-selection"] = function(event,operation) { exports["replace-selection"] = function(event,operation) {
@@ -16,3 +19,5 @@ exports["replace-selection"] = function(event,operation) {
operation.newSelStart = operation.selStart; operation.newSelStart = operation.selStart;
operation.newSelEnd = operation.selStart + operation.replacement.length; operation.newSelEnd = operation.selStart + operation.replacement.length;
}; };
})();

View File

@@ -6,7 +6,10 @@ module-type: texteditoroperation
Text editor operation to save the current selection in a specified tiddler Text editor operation to save the current selection in a specified tiddler
\*/ \*/
(function(){
/*jslint node: true, browser: true */
/*global $tw: false */
"use strict"; "use strict";
exports["save-selection"] = function(event,operation) { exports["save-selection"] = function(event,operation) {
@@ -16,3 +19,5 @@ exports["save-selection"] = function(event,operation) {
this.wiki.setText(tiddler,field,null,operation.text.substring(operation.selStart,operation.selEnd)); this.wiki.setText(tiddler,field,null,operation.text.substring(operation.selStart,operation.selEnd));
} }
}; };
})();

View File

@@ -6,7 +6,10 @@ module-type: texteditoroperation
Text editor operation to wrap the selected lines with a prefix and suffix Text editor operation to wrap the selected lines with a prefix and suffix
\*/ \*/
(function(){
/*jslint node: true, browser: true */
/*global $tw: false */
"use strict"; "use strict";
exports["wrap-lines"] = function(event,operation) { exports["wrap-lines"] = function(event,operation) {
@@ -40,3 +43,5 @@ exports["wrap-lines"] = function(event,operation) {
operation.newSelEnd = operation.newSelStart + (operation.cutEnd - operation.cutStart); operation.newSelEnd = operation.newSelStart + (operation.cutEnd - operation.cutStart);
} }
}; };
})();

View File

@@ -6,128 +6,45 @@ module-type: texteditoroperation
Text editor operation to wrap the selection with the specified prefix and suffix Text editor operation to wrap the selection with the specified prefix and suffix
\*/ \*/
(function(){
/*jslint node: true, browser: true */
/*global $tw: false */
"use strict"; "use strict";
exports["wrap-selection"] = function(event,operation) { exports["wrap-selection"] = function(event,operation) {
var o = operation, if(operation.selStart === operation.selEnd) {
prefix = event.paramObject.prefix, // No selection; check if we're within the prefix/suffix
suffix = event.paramObject.suffix, if(operation.text.substring(operation.selStart - event.paramObject.prefix.length,operation.selStart + event.paramObject.suffix.length) === event.paramObject.prefix + 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 // Remove the prefix and suffix
o.cutStart = o.selStart - prefix.length; operation.cutStart = operation.selStart - event.paramObject.prefix.length;
o.cutEnd = o.selEnd + suffix.length; operation.cutEnd = operation.selEnd + event.paramObject.suffix.length;
o.replacement = ""; operation.replacement = "";
o.newSelStart = o.cutStart; operation.newSelStart = operation.cutStart;
o.newSelEnd = o.newSelStart; operation.newSelEnd = operation.newSelStart;
} else { } else {
// Wrap the cursor instead // Wrap the cursor instead
o.cutStart = o.selStart; operation.cutStart = operation.selStart;
o.cutEnd = o.selEnd; operation.cutEnd = operation.selEnd;
o.replacement = prefix + suffix; operation.replacement = event.paramObject.prefix + event.paramObject.suffix;
o.newSelStart = o.selStart + prefix.length; operation.newSelStart = operation.selStart + event.paramObject.prefix.length;
o.newSelEnd = o.newSelStart; operation.newSelEnd = operation.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 // Prefix and suffix are already present, so remove them
removePrefixSuffix(); operation.cutStart = operation.selStart;
} else if(o.text.substring(o.selStart - prefix.length, o.selStart) === prefix && operation.cutEnd = operation.selEnd;
o.text.substring(o.selEnd, o.selEnd + suffix.length) === suffix) { operation.replacement = operation.selection.substring(event.paramObject.prefix.length,operation.selection.length - event.paramObject.suffix.length);
// Prefix and suffix are present BUT not selected -> remove them operation.newSelStart = operation.selStart;
removePrefixSuffix({"lenPrefix": prefix.length, "lenSuffix": suffix.length}); operation.newSelEnd = operation.selStart + operation.replacement.length;
} else { } else {
// Add the prefix and suffix // Add the prefix and suffix
addPrefixSuffix(); 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;
} }
}; };
})();

View File

@@ -7,7 +7,10 @@ Union of sets without de-duplication.
Equivalent to = filter run prefix. Equivalent to = filter run prefix.
\*/ \*/
(function(){
/*jslint node: true, browser: true */
/*global $tw: false */
"use strict"; "use strict";
/* /*
@@ -18,3 +21,5 @@ exports.all = function(operationSubFunction) {
results.push.apply(results, operationSubFunction(source,widget)); results.push.apply(results, operationSubFunction(source,widget));
}; };
}; };
})();

View File

@@ -7,7 +7,10 @@ Intersection of sets.
Equivalent to + filter run prefix. Equivalent to + filter run prefix.
\*/ \*/
(function(){
/*jslint node: true, browser: true */
/*global $tw: false */
"use strict"; "use strict";
/* /*
@@ -21,3 +24,5 @@ exports.and = function(operationSubFunction,options) {
results.pushTop(operationSubFunction(source,widget)); results.pushTop(operationSubFunction(source,widget));
}; };
}; };
})();

View File

@@ -3,7 +3,10 @@ title: $:/core/modules/filterrunprefixes/cascade.js
type: application/javascript type: application/javascript
module-type: filterrunprefix module-type: filterrunprefix
\*/ \*/
(function(){
/*jslint node: true, browser: true */
/*global $tw: false */
"use strict"; "use strict";
/* /*
@@ -36,3 +39,5 @@ exports.cascade = function(operationSubFunction,options) {
} }
} }
}; };
})();

View File

@@ -6,7 +6,10 @@ module-type: filterrunprefix
Equivalent to ~ filter run prefix. Equivalent to ~ filter run prefix.
\*/ \*/
(function(){
/*jslint node: true, browser: true */
/*global $tw: false */
"use strict"; "use strict";
/* /*
@@ -20,3 +23,5 @@ exports.else = function(operationSubFunction) {
} }
}; };
}; };
})();

View File

@@ -7,7 +7,10 @@ Difference of sets.
Equivalent to - filter run prefix. Equivalent to - filter run prefix.
\*/ \*/
(function(){
/*jslint node: true, browser: true */
/*global $tw: false */
"use strict"; "use strict";
/* /*
@@ -18,3 +21,5 @@ exports.except = function(operationSubFunction) {
results.remove(operationSubFunction(source,widget)); results.remove(operationSubFunction(source,widget));
}; };
}; };
})();

View File

@@ -4,7 +4,10 @@ type: application/javascript
module-type: filterrunprefix module-type: filterrunprefix
\*/ \*/
(function(){
/*jslint node: true, browser: true */
/*global $tw: false */
"use strict"; "use strict";
/* /*
@@ -32,3 +35,5 @@ exports.filter = function(operationSubFunction,options) {
} }
} }
}; };
})();

View File

@@ -4,7 +4,10 @@ type: application/javascript
module-type: filterrunprefix module-type: filterrunprefix
\*/ \*/
(function(){
/*jslint node: true, browser: true */
/*global $tw: false */
"use strict"; "use strict";
/* /*
@@ -24,3 +27,5 @@ exports.intersection = function(operationSubFunction) {
} }
}; };
}; };
})();

View File

@@ -3,7 +3,10 @@ title: $:/core/modules/filterrunprefixes/map.js
type: application/javascript type: application/javascript
module-type: filterrunprefix module-type: filterrunprefix
\*/ \*/
(function(){
/*jslint node: true, browser: true */
/*global $tw: false */
"use strict"; "use strict";
/* /*
@@ -37,3 +40,5 @@ exports.map = function(operationSubFunction,options) {
} }
} }
}; };
})();

View File

@@ -6,7 +6,10 @@ module-type: filterrunprefix
Equivalent to a filter run with no prefix. Equivalent to a filter run with no prefix.
\*/ \*/
(function(){
/*jslint node: true, browser: true */
/*global $tw: false */
"use strict"; "use strict";
/* /*
@@ -17,3 +20,5 @@ exports.or = function(operationSubFunction) {
results.pushTop(operationSubFunction(source,widget)); results.pushTop(operationSubFunction(source,widget));
}; };
}; };
})();

Some files were not shown because too many files have changed in this diff Show More