mirror of
https://github.com/Jermolene/TiddlyWiki5.git
synced 2025-12-06 02:30:46 -08:00
Merge branch 'master' into browser-messaging-saver
This commit is contained in:
commit
7e76db15aa
5188 changed files with 117138 additions and 55954 deletions
|
|
@ -1,15 +0,0 @@
|
|||
# Known minified files
|
||||
/boot/sjcl.js
|
||||
/core/modules/utils/base64-utf8/base64-utf8.module.min.js
|
||||
/core/modules/utils/diff-match-patch/diff_match_patch.js
|
||||
/plugins/tiddlywiki/async/files/async.min.v1.5.0.js
|
||||
/plugins/tiddlywiki/codemirror-autocomplete/files/addon/hint/anyword-hint.js
|
||||
/plugins/tiddlywiki/codemirror-autocomplete/files/addon/hint/css-hint.js
|
||||
/plugins/tiddlywiki/codemirror-autocomplete/files/addon/hint/html-hint.js
|
||||
/plugins/tiddlywiki/codemirror-autocomplete/files/addon/hint/javascript-hint.js
|
||||
/plugins/tiddlywiki/codemirror-autocomplete/files/addon/hint/show-hint.js
|
||||
/plugins/tiddlywiki/codemirror-autocomplete/files/addon/hint/xml-hint.js
|
||||
/plugins/tiddlywiki/codemirror-closebrackets/files/addon/edit/closebrackets.js
|
||||
/plugins/tiddlywiki/codemirror-closebrackets/files/addon/edit/matchbrackets.js
|
||||
/plugins/tiddlywiki/codemirror-closetag/files/addon/edit/closetag.js
|
||||
/plugins/tiddlywiki/codemirror-closetag/files/addon/fold/xml-fold.js
|
||||
267
.eslintrc.yml
267
.eslintrc.yml
|
|
@ -1,267 +0,0 @@
|
|||
env:
|
||||
browser: true
|
||||
commonjs: true
|
||||
es2021: true
|
||||
node: true
|
||||
extends: 'eslint:recommended'
|
||||
globals:
|
||||
"$tw": "writable" # temporary
|
||||
parserOptions:
|
||||
ecmaVersion: 5
|
||||
rules:
|
||||
array-bracket-newline: 'off'
|
||||
array-bracket-spacing: 'off'
|
||||
array-callback-return: 'off'
|
||||
array-element-newline: 'off'
|
||||
arrow-body-style: error
|
||||
arrow-parens:
|
||||
- error
|
||||
- as-needed
|
||||
arrow-spacing:
|
||||
- error
|
||||
- after: true
|
||||
before: true
|
||||
block-scoped-var: 'off'
|
||||
block-spacing: 'off'
|
||||
brace-style: 'off'
|
||||
callback-return: 'off'
|
||||
camelcase: 'off'
|
||||
capitalized-comments: 'off'
|
||||
class-methods-use-this: error
|
||||
comma-dangle: 'off'
|
||||
comma-spacing: 'off'
|
||||
comma-style: 'off'
|
||||
complexity: 'off'
|
||||
computed-property-spacing: 'off'
|
||||
consistent-return: 'off'
|
||||
consistent-this: 'off'
|
||||
curly: 'off'
|
||||
default-case: 'off'
|
||||
default-case-last: error
|
||||
default-param-last: error
|
||||
dot-location: 'off'
|
||||
dot-notation: 'off'
|
||||
eol-last: 'off'
|
||||
eqeqeq: 'off'
|
||||
func-call-spacing: 'off'
|
||||
func-name-matching: 'off'
|
||||
func-names: 'off'
|
||||
func-style: 'off'
|
||||
function-call-argument-newline: 'off'
|
||||
function-paren-newline: 'off'
|
||||
generator-star-spacing: error
|
||||
global-require: 'off'
|
||||
grouped-accessor-pairs: error
|
||||
guard-for-in: 'off'
|
||||
handle-callback-err: 'off'
|
||||
id-blacklist: error
|
||||
id-denylist: error
|
||||
id-length: 'off'
|
||||
id-match: error
|
||||
implicit-arrow-linebreak: error
|
||||
indent: 'off'
|
||||
indent-legacy: 'off'
|
||||
init-declarations: 'off'
|
||||
jsx-quotes: error
|
||||
key-spacing: 'off'
|
||||
keyword-spacing: 'off'
|
||||
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"
|
||||
43
.github/ISSUE_TEMPLATE/bug_report.md
vendored
43
.github/ISSUE_TEMPLATE/bug_report.md
vendored
|
|
@ -1,43 +0,0 @@
|
|||
---
|
||||
name: Bug report
|
||||
about: Create a report to help us improve TiddlyWiki 5
|
||||
title: "[BUG]"
|
||||
labels: ''
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
**Describe the bug**
|
||||
A clear and concise description of what the bug is.
|
||||
|
||||
**To Reproduce**
|
||||
Steps to reproduce the behavior:
|
||||
1. Go to '...'
|
||||
2. Click on '....'
|
||||
3. Scroll down to '....'
|
||||
4. See error
|
||||
|
||||
**Expected behavior**
|
||||
A clear and concise description of what you expected to happen.
|
||||
|
||||
**Screenshots**
|
||||
If applicable, add screenshots to help explain your problem.
|
||||
|
||||
**TiddlyWiki Configuration (please complete the following information):**
|
||||
- Version [e.g. v5.1.24]
|
||||
- Saving mechanism [e.g. Node.js, TiddlyDesktop, TiddlyHost etc]
|
||||
- Plugins installed [e.g. Freelinks, TiddlyMap]
|
||||
|
||||
**Desktop (please complete the following information):**
|
||||
- OS: [e.g. iOS]
|
||||
- Browser [e.g. chrome, safari]
|
||||
- Version [e.g. 22]
|
||||
|
||||
**Smartphone (please complete the following information):**
|
||||
- Device: [e.g. iPhone6]
|
||||
- OS: [e.g. iOS8.1]
|
||||
- Browser [e.g. stock browser, safari]
|
||||
- Version [e.g. 22]
|
||||
|
||||
**Additional context**
|
||||
Add any other context about the problem here.
|
||||
67
.github/ISSUE_TEMPLATE/bug_report.yml
vendored
Normal file
67
.github/ISSUE_TEMPLATE/bug_report.yml
vendored
Normal file
|
|
@ -0,0 +1,67 @@
|
|||
name: Bug report
|
||||
description: Create a report to help us improve TiddlyWiki 5
|
||||
title: "[BUG] "
|
||||
body:
|
||||
- type: textarea
|
||||
id: Describe
|
||||
attributes:
|
||||
label: Describe the bug
|
||||
description: A clear and concise description of what the bug is.
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: Expected
|
||||
attributes:
|
||||
label: Expected behavior
|
||||
description: A clear and concise description of what you expected to happen.
|
||||
validations:
|
||||
required: false
|
||||
- type: textarea
|
||||
id: Reproduce
|
||||
attributes:
|
||||
label: To Reproduce
|
||||
description: "Steps to reproduce the behavior:"
|
||||
placeholder: |
|
||||
1. Go to '...'
|
||||
2. Click on '....'
|
||||
3. Scroll down to '....'
|
||||
4. See error
|
||||
validations:
|
||||
required: false
|
||||
- type: textarea
|
||||
id: Screenshots
|
||||
attributes:
|
||||
label: Screenshots
|
||||
description: If applicable, add screenshots to help explain your problem.
|
||||
placeholder: Drag image here to upload screenshot!
|
||||
validations:
|
||||
required: false
|
||||
- type: textarea
|
||||
id: Configuration
|
||||
attributes:
|
||||
label: TiddlyWiki Configuration
|
||||
description: please complete the following information
|
||||
placeholder: |
|
||||
- Version [e.g. v5.1.24]
|
||||
- Saving mechanism [e.g. Node.js, TiddlyDesktop, TiddlyHost etc]
|
||||
- Plugins installed [e.g. Freelinks, TiddlyMap]
|
||||
|
||||
### Desktop (please complete the following information):
|
||||
|
||||
- OS: [e.g. iOS]
|
||||
- Browser [e.g. chrome, safari]
|
||||
- Version [e.g. 22]
|
||||
|
||||
### Smartphone (please complete the following information):
|
||||
|
||||
- Device: [e.g. iPhone6]
|
||||
- OS: [e.g. iOS8.1]
|
||||
- Browser [e.g. stock browser, safari]
|
||||
- Version [e.g. 22]
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: Context
|
||||
attributes:
|
||||
label: Additional context
|
||||
description: Add any other context about the problem here.
|
||||
8
.github/ISSUE_TEMPLATE/config.yml
vendored
Normal file
8
.github/ISSUE_TEMPLATE/config.yml
vendored
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
blank_issues_enabled: false
|
||||
contact_links:
|
||||
- name: Discuss feature request
|
||||
url: https://github.com/TiddlyWiki/TiddlyWiki5/discussions
|
||||
about: Open new discussion about new feature
|
||||
- name: Talk.Tiddlywiki Forum
|
||||
url: https://talk.tiddlywiki.org
|
||||
about: Join the Forum
|
||||
|
|
@ -20,3 +20,11 @@ A clear and concise description of any alternative solutions or features you've
|
|||
Add any other context or screenshots about the feature request here.
|
||||
|
||||
If you link to discussions elsewhere then please copy and paste the important text, and don't expect readers to scan the entire discussion to find the relevant part.
|
||||
|
||||
## Checklist before requesting a review
|
||||
|
||||
- [ ] Illustrate any visual changes (however minor) with before/after screenshots
|
||||
- [ ] Self-review of code
|
||||
- [ ] Documentation updates (for user-visible changes)
|
||||
- [ ] Tests (for core code changes)
|
||||
- [ ] Complies with coding style guidelines (for JavaScript code)
|
||||
|
|
|
|||
26
.github/workflows/ci.yml
vendored
26
.github/workflows/ci.yml
vendored
|
|
@ -5,16 +5,22 @@ on:
|
|||
- master
|
||||
- tiddlywiki-com
|
||||
env:
|
||||
NODE_VERSION: "12"
|
||||
NODE_VERSION: "22"
|
||||
jobs:
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/setup-node@v1
|
||||
- uses: actions/checkout@v5
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: "${{ env.NODE_VERSION }}"
|
||||
- run: "./bin/test.sh"
|
||||
- run: "./bin/ci-test.sh"
|
||||
- uses: actions/upload-artifact@v4
|
||||
if: always()
|
||||
with:
|
||||
name: playwright-report
|
||||
path: playwright-report/
|
||||
retention-days: 30
|
||||
build-prerelease:
|
||||
runs-on: ubuntu-latest
|
||||
if: github.ref == 'refs/heads/master'
|
||||
|
|
@ -24,8 +30,8 @@ jobs:
|
|||
TW5_BUILD_MAIN_EDITION: "./editions/prerelease"
|
||||
TW5_BUILD_OUTPUT: "./output/prerelease"
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/setup-node@v1
|
||||
- uses: actions/checkout@v5
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: "${{ env.NODE_VERSION }}"
|
||||
- run: "./bin/ci-pre-build.sh"
|
||||
|
|
@ -54,9 +60,10 @@ jobs:
|
|||
TW5_BUILD_TIDDLYWIKI: "./node_modules/tiddlywiki/tiddlywiki.js"
|
||||
TW5_BUILD_MAIN_EDITION: "./editions/tw5.com"
|
||||
TW5_BUILD_OUTPUT: "./output"
|
||||
TW5_BUILD_ARCHIVE: "./output"
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/setup-node@v1
|
||||
- uses: actions/checkout@v5
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: "${{ env.NODE_VERSION }}"
|
||||
- run: "./bin/ci-pre-build.sh"
|
||||
|
|
@ -72,3 +79,6 @@ jobs:
|
|||
- run: "./bin/ci-push.sh"
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GITHUBPUSHTOKEN }}
|
||||
- run: "./bin/build-tw-org.sh"
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GITHUBPUSHTOKEN }}
|
||||
|
|
|
|||
30
.github/workflows/cla-check.yml
vendored
Normal file
30
.github/workflows/cla-check.yml
vendored
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
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 }}
|
||||
70
.github/workflows/cla-signed.yml
vendored
Normal file
70
.github/workflows/cla-signed.yml
vendored
Normal file
|
|
@ -0,0 +1,70 @@
|
|||
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
|
||||
40
.github/workflows/eslint.yml
vendored
Normal file
40
.github/workflows/eslint.yml
vendored
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
name: ESLint
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
types: [opened, synchronize, reopened]
|
||||
workflow_dispatch:
|
||||
|
||||
concurrency:
|
||||
group: lint-${{ github.event.pull_request.number || github.ref_name }}
|
||||
cancel-in-progress: true
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
# Needed for GitHub Checks API
|
||||
checks: write
|
||||
|
||||
jobs:
|
||||
eslint:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v5
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 20
|
||||
|
||||
- name: Install dependencies
|
||||
run: npm install --include=dev
|
||||
|
||||
- name: Run ESLint with reviewdog (GitHub Checks)
|
||||
uses: reviewdog/action-eslint@v1
|
||||
with:
|
||||
eslint_flags: '.'
|
||||
reporter: github-pr-check
|
||||
fail_level: error
|
||||
level: error
|
||||
tool_name: ESLint PR code
|
||||
55
.github/workflows/pr-check-build-size.yml
vendored
Normal file
55
.github/workflows/pr-check-build-size.yml
vendored
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
name: Calculate PR build size
|
||||
on:
|
||||
pull_request_target:
|
||||
types: [opened, reopened, synchronize]
|
||||
paths:
|
||||
- 'boot/**'
|
||||
- 'core/**'
|
||||
- 'themes/tiddlywiki/snowwhite/**'
|
||||
- 'themes/tiddlywiki/vanilla/**'
|
||||
|
||||
jobs:
|
||||
calculate-build-size:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
pull-requests: read
|
||||
contents: read
|
||||
outputs:
|
||||
pr_size: ${{ steps.get_sizes.outputs.pr_size }}
|
||||
base_size: ${{ steps.get_sizes.outputs.base_size }}
|
||||
steps:
|
||||
- name: build-size-check
|
||||
id: get_sizes
|
||||
uses: TiddlyWiki/cerebrus@v4
|
||||
with:
|
||||
pr_number: ${{ github.event.pull_request.number }}
|
||||
repo: ${{ github.repository }}
|
||||
base_ref: ${{ github.event.pull_request.base.ref }}
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
mode: size:calc
|
||||
|
||||
dispatch-followup:
|
||||
needs: calculate-build-size
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
actions: write # Required to dispatch another workflow
|
||||
pull-requests: write
|
||||
contents: read
|
||||
steps:
|
||||
- name: Trigger follow-up workflow
|
||||
uses: actions/github-script@v6
|
||||
with:
|
||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
script: |
|
||||
await github.rest.actions.createWorkflowDispatch({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
workflow_id: 'pr-comment-build-size.yml',
|
||||
ref: 'master',
|
||||
inputs: {
|
||||
pr_number: '${{ github.event.pull_request.number }}',
|
||||
base_ref: '${{ github.event.pull_request.base.ref }}',
|
||||
pr_size: '${{ needs.calculate-build-size.outputs.pr_size }}',
|
||||
base_size: '${{ needs.calculate-build-size.outputs.base_size }}'
|
||||
}
|
||||
});
|
||||
36
.github/workflows/pr-comment-build-size.yml
vendored
Normal file
36
.github/workflows/pr-comment-build-size.yml
vendored
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
name: Comment on PR build size (Trusted workflow)
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
pr_number:
|
||||
required: true
|
||||
type: string
|
||||
base_ref:
|
||||
required: true
|
||||
type: string
|
||||
pr_size:
|
||||
required: true
|
||||
type: string
|
||||
base_size:
|
||||
required: true
|
||||
type: string
|
||||
|
||||
jobs:
|
||||
comment-on-pr:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
pull-requests: write
|
||||
contents: read
|
||||
|
||||
steps:
|
||||
- name: Build and check size
|
||||
uses: TiddlyWiki/cerebrus@v4
|
||||
with:
|
||||
pr_number: ${{ inputs.pr_number }}
|
||||
repo: ${{ github.repository }}
|
||||
base_ref: ${{ inputs.base_ref }}
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
mode: size:comment
|
||||
pr_size: ${{ inputs.pr_size }}
|
||||
base_size: ${{ inputs.base_size }}
|
||||
18
.github/workflows/pr-path-validation.yml
vendored
Normal file
18
.github/workflows/pr-path-validation.yml
vendored
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
name: Validate PR Paths
|
||||
|
||||
on:
|
||||
pull_request_target:
|
||||
types: [opened, reopened, synchronize]
|
||||
|
||||
jobs:
|
||||
validate-pr:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Validate PR
|
||||
uses: TiddlyWiki/cerebrus@v4
|
||||
with:
|
||||
pr_number: ${{ github.event.pull_request.number }}
|
||||
repo: ${{ github.repository }}
|
||||
base_ref: ${{ github.base_ref }}
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
6
.gitignore
vendored
6
.gitignore
vendored
|
|
@ -1,5 +1,11 @@
|
|||
.DS_Store
|
||||
.c9/
|
||||
.vs/
|
||||
.vscode/
|
||||
tmp/
|
||||
output/
|
||||
node_modules/
|
||||
/test-results/
|
||||
/playwright-report/
|
||||
/playwright/.cache/
|
||||
$__StoryList.tid
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
# Default to the current version number for building the plugin library
|
||||
|
||||
if [ -z "$TW5_BUILD_VERSION" ]; then
|
||||
TW5_BUILD_VERSION=v5.1.24
|
||||
TW5_BUILD_VERSION=v5.4.0
|
||||
fi
|
||||
|
||||
echo "Using TW5_BUILD_VERSION as [$TW5_BUILD_VERSION]"
|
||||
|
|
@ -73,10 +73,8 @@ rm $TW5_BUILD_OUTPUT/dev/static/*
|
|||
|
||||
echo "<a href='./plugins/tiddlywiki/tw2parser/index.html'>Moved to http://tiddlywiki.com/plugins/tiddlywiki/tw2parser/index.html</a>" > $TW5_BUILD_OUTPUT/classicparserdemo.html
|
||||
echo "<a href='./plugins/tiddlywiki/codemirror/index.html'>Moved to http://tiddlywiki.com/plugins/tiddlywiki/codemirror/index.html</a>" > $TW5_BUILD_OUTPUT/codemirrordemo.html
|
||||
echo "<a href='./plugins/tiddlywiki/d3/index.html'>Moved to http://tiddlywiki.com/plugins/tiddlywiki/d3/index.html</a>" > $TW5_BUILD_OUTPUT/d3demo.html
|
||||
echo "<a href='./plugins/tiddlywiki/highlight/index.html'>Moved to http://tiddlywiki.com/plugins/tiddlywiki/highlight/index.html</a>" > $TW5_BUILD_OUTPUT/highlightdemo.html
|
||||
echo "<a href='./plugins/tiddlywiki/markdown/index.html'>Moved to http://tiddlywiki.com/plugins/tiddlywiki/markdown/index.html</a>" > $TW5_BUILD_OUTPUT/markdowndemo.html
|
||||
echo "<a href='./plugins/tiddlywiki/tahoelafs/index.html'>Moved to http://tiddlywiki.com/plugins/tiddlywiki/tahoelafs/index.html</a>" > $TW5_BUILD_OUTPUT/tahoelafs.html
|
||||
|
||||
# Put the build details into a .tid file so that it can be included in each build (deleted at the end of this script)
|
||||
|
||||
|
|
@ -84,40 +82,57 @@ echo -e -n "title: $:/build\ncommit: $TW5_BUILD_COMMIT\n\n$TW5_BUILD_DETAILS\n"
|
|||
|
||||
######################################################
|
||||
#
|
||||
# Core distribution
|
||||
# Core distributions
|
||||
#
|
||||
######################################################
|
||||
|
||||
# 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
|
||||
# /external-(version).html External core version of main site
|
||||
# /favicon.ico Favicon for main site
|
||||
# /static.html Static rendering of default tiddlers
|
||||
# /alltiddlers.html Static rendering of all tiddlers
|
||||
# /static/* Static single tiddlers
|
||||
# /static/static.css Static stylesheet
|
||||
# /static/favicon.ico Favicon for static pages
|
||||
|
||||
node $TW5_BUILD_TIDDLYWIKI \
|
||||
$TW5_BUILD_MAIN_EDITION \
|
||||
--verbose \
|
||||
--version \
|
||||
--load $TW5_BUILD_OUTPUT/build.tid \
|
||||
--output $TW5_BUILD_OUTPUT \
|
||||
--build favicon static index \
|
||||
--build favicon static index external-js \
|
||||
|| exit 1
|
||||
|
||||
# /empty.html Empty
|
||||
# /empty.hta For Internet Explorer
|
||||
# /empty.html Empty
|
||||
# /empty.hta For Internet Explorer
|
||||
# /empty-external-core.html External core empty
|
||||
# /tiddlywikicore-<version>.js Core plugin javascript
|
||||
node $TW5_BUILD_TIDDLYWIKI \
|
||||
./editions/empty \
|
||||
--verbose \
|
||||
--output $TW5_BUILD_OUTPUT \
|
||||
--build empty \
|
||||
--build empty emptyexternalcore \
|
||||
|| exit 1
|
||||
|
||||
|
||||
# /test.html Test edition
|
||||
node $TW5_BUILD_TIDDLYWIKI \
|
||||
./editions/test \
|
||||
--verbose \
|
||||
--output $TW5_BUILD_OUTPUT \
|
||||
--rendertiddler $:/core/save/all test.html text/plain \
|
||||
|| exit 1
|
||||
|
|
@ -130,16 +145,28 @@ node $TW5_BUILD_TIDDLYWIKI \
|
|||
# /dev/static/static.css Static stylesheet
|
||||
node $TW5_BUILD_TIDDLYWIKI \
|
||||
./editions/dev \
|
||||
--verbose \
|
||||
--load $TW5_BUILD_OUTPUT/build.tid \
|
||||
--output $TW5_BUILD_OUTPUT/dev \
|
||||
--build index favicon static \
|
||||
|| exit 1
|
||||
|
||||
# /tour.html tour edition
|
||||
node $TW5_BUILD_TIDDLYWIKI \
|
||||
./editions/tour \
|
||||
--output $TW5_BUILD_OUTPUT \
|
||||
--rendertiddler $:/core/save/all-external-js tour.html text/plain \
|
||||
|| exit 1
|
||||
|
||||
# /surveys.html surveys edition
|
||||
node $TW5_BUILD_TIDDLYWIKI \
|
||||
./editions/tiddlywiki-surveys \
|
||||
--output $TW5_BUILD_OUTPUT \
|
||||
--build index \
|
||||
|| exit 1
|
||||
|
||||
# /share.html Custom edition for sharing via the URL
|
||||
node $TW5_BUILD_TIDDLYWIKI \
|
||||
./editions/share \
|
||||
--verbose \
|
||||
--load $TW5_BUILD_OUTPUT/build.tid \
|
||||
--output $TW5_BUILD_OUTPUT \
|
||||
--build share \
|
||||
|
|
@ -148,7 +175,6 @@ node $TW5_BUILD_TIDDLYWIKI \
|
|||
# /upgrade.html Custom edition for performing upgrades
|
||||
node $TW5_BUILD_TIDDLYWIKI \
|
||||
./editions/upgrade \
|
||||
--verbose \
|
||||
--load $TW5_BUILD_OUTPUT/build.tid \
|
||||
--output $TW5_BUILD_OUTPUT \
|
||||
--build upgrade \
|
||||
|
|
@ -157,7 +183,6 @@ node $TW5_BUILD_TIDDLYWIKI \
|
|||
# /encrypted.html Copy of the main file encrypted with the password "password"
|
||||
node $TW5_BUILD_TIDDLYWIKI \
|
||||
$TW5_BUILD_MAIN_EDITION \
|
||||
--verbose \
|
||||
--load $TW5_BUILD_OUTPUT/build.tid \
|
||||
--output $TW5_BUILD_OUTPUT \
|
||||
--build encrypted \
|
||||
|
|
@ -173,16 +198,14 @@ node $TW5_BUILD_TIDDLYWIKI \
|
|||
# /editions/xlsx-utils/index.html xlsx-utils edition
|
||||
node $TW5_BUILD_TIDDLYWIKI \
|
||||
./editions/xlsx-utils \
|
||||
--verbose \
|
||||
--load $TW5_BUILD_OUTPUT/build.tid \
|
||||
--output $TW5_BUILD_OUTPUT/editions/xlsx-utils/ \
|
||||
--build index \
|
||||
--build external \
|
||||
|| exit 1
|
||||
|
||||
# /editions/resumebuilder/index.html Resume builder edition
|
||||
node $TW5_BUILD_TIDDLYWIKI \
|
||||
./editions/resumebuilder \
|
||||
--verbose \
|
||||
--load $TW5_BUILD_OUTPUT/build.tid \
|
||||
--output $TW5_BUILD_OUTPUT/editions/resumebuilder/ \
|
||||
--build index \
|
||||
|
|
@ -191,16 +214,14 @@ node $TW5_BUILD_TIDDLYWIKI \
|
|||
# /editions/text-slicer/index.html Text slicer edition
|
||||
node $TW5_BUILD_TIDDLYWIKI \
|
||||
./editions/text-slicer \
|
||||
--verbose \
|
||||
--load $TW5_BUILD_OUTPUT/build.tid \
|
||||
--output $TW5_BUILD_OUTPUT/editions/text-slicer/ \
|
||||
--build index \
|
||||
--build external \
|
||||
|| exit 1
|
||||
|
||||
# /editions/translators/index.html Translators edition
|
||||
node $TW5_BUILD_TIDDLYWIKI \
|
||||
./editions/translators \
|
||||
--verbose \
|
||||
--load $TW5_BUILD_OUTPUT/build.tid \
|
||||
--output $TW5_BUILD_OUTPUT/editions/translators/ \
|
||||
--build index \
|
||||
|
|
@ -209,7 +230,6 @@ node $TW5_BUILD_TIDDLYWIKI \
|
|||
# /editions/introduction/index.html Introduction edition
|
||||
node $TW5_BUILD_TIDDLYWIKI \
|
||||
./editions/introduction \
|
||||
--verbose \
|
||||
--load $TW5_BUILD_OUTPUT/build.tid \
|
||||
--output $TW5_BUILD_OUTPUT/editions/introduction/ \
|
||||
--build index \
|
||||
|
|
@ -218,7 +238,6 @@ node $TW5_BUILD_TIDDLYWIKI \
|
|||
# /editions/full/index.html Full edition
|
||||
node $TW5_BUILD_TIDDLYWIKI \
|
||||
./editions/full \
|
||||
--verbose \
|
||||
--load $TW5_BUILD_OUTPUT/build.tid \
|
||||
--output $TW5_BUILD_OUTPUT/editions/full/ \
|
||||
--build index \
|
||||
|
|
@ -227,9 +246,16 @@ node $TW5_BUILD_TIDDLYWIKI \
|
|||
# /editions/tw5.com-docs/index.html tiddlywiki.com docs edition
|
||||
node $TW5_BUILD_TIDDLYWIKI \
|
||||
./editions/tw5.com-docs \
|
||||
--verbose \
|
||||
--load $TW5_BUILD_OUTPUT/build.tid \
|
||||
--output $TW5_BUILD_OUTPUT/editions/tw5.com-docs/ \
|
||||
--build external \
|
||||
|| exit 1
|
||||
|
||||
# /editions/twitter-archivist/index.html Twitter Archivist edition
|
||||
node $TW5_BUILD_TIDDLYWIKI \
|
||||
./editions/twitter-archivist \
|
||||
--load $TW5_BUILD_OUTPUT/build.tid \
|
||||
--output $TW5_BUILD_OUTPUT/editions/twitter-archivist/ \
|
||||
--build index \
|
||||
|| exit 1
|
||||
|
||||
|
|
@ -243,10 +269,9 @@ node $TW5_BUILD_TIDDLYWIKI \
|
|||
|
||||
node $TW5_BUILD_TIDDLYWIKI \
|
||||
./editions/innerwikidemo \
|
||||
--verbose \
|
||||
--load $TW5_BUILD_OUTPUT/build.tid \
|
||||
--output $TW5_BUILD_OUTPUT \
|
||||
--rendertiddler $:/core/save/all plugins/tiddlywiki/innerwiki/index.html text/plain \
|
||||
--rendertiddler $:/core/save/all-external-js plugins/tiddlywiki/innerwiki/index.html text/plain \
|
||||
|| exit 1
|
||||
|
||||
# /plugins/tiddlywiki/dynaview/index.html Demo wiki with DynaView plugin
|
||||
|
|
@ -254,10 +279,9 @@ node $TW5_BUILD_TIDDLYWIKI \
|
|||
|
||||
node $TW5_BUILD_TIDDLYWIKI \
|
||||
./editions/dynaviewdemo \
|
||||
--verbose \
|
||||
--load $TW5_BUILD_OUTPUT/build.tid \
|
||||
--output $TW5_BUILD_OUTPUT \
|
||||
--rendertiddler $:/core/save/all plugins/tiddlywiki/dynaview/index.html text/plain \
|
||||
--rendertiddler $:/core/save/all-external-js plugins/tiddlywiki/dynaview/index.html text/plain \
|
||||
--rendertiddler $:/core/save/empty plugins/tiddlywiki/dynaview/empty.html text/plain \
|
||||
|| exit 1
|
||||
|
||||
|
|
@ -269,43 +293,19 @@ node $TW5_BUILD_TIDDLYWIKI \
|
|||
|
||||
node $TW5_BUILD_TIDDLYWIKI \
|
||||
./editions/katexdemo \
|
||||
--verbose \
|
||||
--load $TW5_BUILD_OUTPUT/build.tid \
|
||||
--output $TW5_BUILD_OUTPUT \
|
||||
--rendertiddler $:/core/save/all plugins/tiddlywiki/katex/index.html text/plain \
|
||||
--rendertiddler $:/core/save/all-external-js plugins/tiddlywiki/katex/index.html text/plain \
|
||||
--rendertiddler $:/core/save/empty plugins/tiddlywiki/katex/empty.html text/plain \
|
||||
|| exit 1
|
||||
|
||||
# /plugins/tiddlywiki/tahoelafs/index.html Demo wiki with Tahoe-LAFS plugin
|
||||
# /plugins/tiddlywiki/tahoelafs/empty.html Empty wiki with Tahoe-LAFS plugin
|
||||
node $TW5_BUILD_TIDDLYWIKI \
|
||||
./editions/tahoelafs \
|
||||
--verbose \
|
||||
--load $TW5_BUILD_OUTPUT/build.tid \
|
||||
--output $TW5_BUILD_OUTPUT \
|
||||
--rendertiddler $:/core/save/all plugins/tiddlywiki/tahoelafs/index.html text/plain \
|
||||
--rendertiddler $:/core/save/empty plugins/tiddlywiki/tahoelafs/empty.html text/plain \
|
||||
|| exit 1
|
||||
|
||||
# /plugins/tiddlywiki/d3/index.html Demo wiki with D3 plugin
|
||||
# /plugins/tiddlywiki/d3/empty.html Empty wiki with D3 plugin
|
||||
node $TW5_BUILD_TIDDLYWIKI \
|
||||
./editions/d3demo \
|
||||
--verbose \
|
||||
--load $TW5_BUILD_OUTPUT/build.tid \
|
||||
--output $TW5_BUILD_OUTPUT \
|
||||
--rendertiddler $:/core/save/all plugins/tiddlywiki/d3/index.html text/plain \
|
||||
--rendertiddler $:/core/save/empty plugins/tiddlywiki/d3/empty.html text/plain \
|
||||
|| exit 1
|
||||
|
||||
# /plugins/tiddlywiki/codemirror/index.html Demo wiki with codemirror plugin
|
||||
# /plugins/tiddlywiki/codemirror/empty.html Empty wiki with codemirror plugin
|
||||
node $TW5_BUILD_TIDDLYWIKI \
|
||||
./editions/codemirrordemo \
|
||||
--verbose \
|
||||
--load $TW5_BUILD_OUTPUT/build.tid \
|
||||
--output $TW5_BUILD_OUTPUT \
|
||||
--rendertiddler $:/core/save/all plugins/tiddlywiki/codemirror/index.html text/plain \
|
||||
--rendertiddler $:/core/save/all-external-js plugins/tiddlywiki/codemirror/index.html text/plain \
|
||||
--rendertiddler $:/core/save/empty plugins/tiddlywiki/codemirror/empty.html text/plain \
|
||||
|| exit 1
|
||||
|
||||
|
|
@ -313,10 +313,9 @@ node $TW5_BUILD_TIDDLYWIKI \
|
|||
# /plugins/tiddlywiki/markdown/empty.html Empty wiki with Markdown plugin
|
||||
node $TW5_BUILD_TIDDLYWIKI \
|
||||
./editions/markdowndemo \
|
||||
--verbose \
|
||||
--load $TW5_BUILD_OUTPUT/build.tid \
|
||||
--output $TW5_BUILD_OUTPUT \
|
||||
--rendertiddler $:/core/save/all plugins/tiddlywiki/markdown/index.html text/plain \
|
||||
--rendertiddler $:/core/save/all-external-js plugins/tiddlywiki/markdown/index.html text/plain \
|
||||
--rendertiddler $:/core/save/empty plugins/tiddlywiki/markdown/empty.html text/plain \
|
||||
|| exit 1
|
||||
|
||||
|
|
@ -324,10 +323,9 @@ node $TW5_BUILD_TIDDLYWIKI \
|
|||
# /plugins/tiddlywiki/tw2parser/empty.html Empty wiki with tw2parser plugin
|
||||
node $TW5_BUILD_TIDDLYWIKI \
|
||||
./editions/classicparserdemo \
|
||||
--verbose \
|
||||
--load $TW5_BUILD_OUTPUT/build.tid \
|
||||
--output $TW5_BUILD_OUTPUT \
|
||||
--rendertiddler $:/core/save/all plugins/tiddlywiki/tw2parser/index.html text/plain \
|
||||
--rendertiddler $:/core/save/all-external-js plugins/tiddlywiki/tw2parser/index.html text/plain \
|
||||
--rendertiddler $:/core/save/empty plugins/tiddlywiki/tw2parser/empty.html text/plain \
|
||||
|| exit 1
|
||||
|
||||
|
|
@ -335,13 +333,22 @@ node $TW5_BUILD_TIDDLYWIKI \
|
|||
# /plugins/tiddlywiki/highlight/empty.html Empty wiki with highlight plugin
|
||||
node $TW5_BUILD_TIDDLYWIKI \
|
||||
./editions/highlightdemo \
|
||||
--verbose \
|
||||
--load $TW5_BUILD_OUTPUT/build.tid \
|
||||
--output $TW5_BUILD_OUTPUT \
|
||||
--rendertiddler $:/core/save/all plugins/tiddlywiki/highlight/index.html text/plain \
|
||||
--rendertiddler $:/core/save/all-external-js plugins/tiddlywiki/highlight/index.html text/plain \
|
||||
--rendertiddler $:/core/save/empty plugins/tiddlywiki/highlight/empty.html text/plain \
|
||||
|| exit 1
|
||||
|
||||
# /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-external-js plugins/tiddlywiki/geospatial/index.html text/plain \
|
||||
--rendertiddler $:/core/save/empty plugins/tiddlywiki/geospatial/empty.html text/plain \
|
||||
|| exit 1
|
||||
|
||||
######################################################
|
||||
#
|
||||
# Language editions
|
||||
|
|
@ -350,20 +357,19 @@ node $TW5_BUILD_TIDDLYWIKI \
|
|||
|
||||
# Delete any existing static content
|
||||
|
||||
rm $TW5_BUILD_OUTPUT/languages/de-AT/static/*
|
||||
rm $TW5_BUILD_OUTPUT/languages/de-DE/static/*
|
||||
rm $TW5_BUILD_OUTPUT/languages/es-ES/static/*
|
||||
rm $TW5_BUILD_OUTPUT/languages/fr-FR/static/*
|
||||
rm $TW5_BUILD_OUTPUT/languages/ja-JP/static/*
|
||||
rm $TW5_BUILD_OUTPUT/languages/ko-KR/static/*
|
||||
rm $TW5_BUILD_OUTPUT/languages/zh-Hans/static/*
|
||||
rm $TW5_BUILD_OUTPUT/languages/zh-Hant/static/*
|
||||
rm -rf $TW5_BUILD_OUTPUT/languages/de-AT/static/*
|
||||
rm -rf $TW5_BUILD_OUTPUT/languages/de-DE/static/*
|
||||
rm -rf $TW5_BUILD_OUTPUT/languages/es-ES/static/*
|
||||
rm -rf $TW5_BUILD_OUTPUT/languages/fr-FR/static/*
|
||||
rm -rf $TW5_BUILD_OUTPUT/languages/ja-JP/static/*
|
||||
rm -rf $TW5_BUILD_OUTPUT/languages/ko-KR/static/*
|
||||
rm -rf $TW5_BUILD_OUTPUT/languages/zh-Hans/static/*
|
||||
rm -rf $TW5_BUILD_OUTPUT/languages/zh-Hant/static/*
|
||||
|
||||
# /languages/de-AT/index.html Demo wiki with de-AT language
|
||||
# /languages/de-AT/empty.html Empty wiki with de-AT language
|
||||
node $TW5_BUILD_TIDDLYWIKI \
|
||||
./editions/de-AT \
|
||||
--verbose \
|
||||
--load $TW5_BUILD_OUTPUT/build.tid \
|
||||
--output $TW5_BUILD_OUTPUT/languages/de-AT \
|
||||
--build favicon empty static index \
|
||||
|
|
@ -373,7 +379,6 @@ node $TW5_BUILD_TIDDLYWIKI \
|
|||
# /languages/de-DE/empty.html Empty wiki with de-DE language
|
||||
node $TW5_BUILD_TIDDLYWIKI \
|
||||
./editions/de-DE \
|
||||
--verbose \
|
||||
--load $TW5_BUILD_OUTPUT/build.tid \
|
||||
--output $TW5_BUILD_OUTPUT/languages/de-DE \
|
||||
--build favicon empty static index \
|
||||
|
|
@ -383,7 +388,6 @@ node $TW5_BUILD_TIDDLYWIKI \
|
|||
# /languages/es-ES/empty.html Empty wiki with es-ES language
|
||||
node $TW5_BUILD_TIDDLYWIKI \
|
||||
./editions/es-ES \
|
||||
--verbose \
|
||||
--load $TW5_BUILD_OUTPUT/build.tid \
|
||||
--output $TW5_BUILD_OUTPUT/languages/es-ES \
|
||||
--build favicon empty static index \
|
||||
|
|
@ -393,7 +397,6 @@ node $TW5_BUILD_TIDDLYWIKI \
|
|||
# /languages/fr-FR/empty.html Empty wiki with fr-FR language
|
||||
node $TW5_BUILD_TIDDLYWIKI \
|
||||
./editions/fr-FR \
|
||||
--verbose \
|
||||
--load $TW5_BUILD_OUTPUT/build.tid \
|
||||
--output $TW5_BUILD_OUTPUT/languages/fr-FR \
|
||||
--build favicon empty static index \
|
||||
|
|
@ -403,7 +406,6 @@ node $TW5_BUILD_TIDDLYWIKI \
|
|||
# /languages/ja-JP/empty.html Empty wiki with ja-JP language
|
||||
node $TW5_BUILD_TIDDLYWIKI \
|
||||
./editions/ja-JP \
|
||||
--verbose \
|
||||
--load $TW5_BUILD_OUTPUT/build.tid \
|
||||
--output $TW5_BUILD_OUTPUT/languages/ja-JP \
|
||||
--build empty index \
|
||||
|
|
@ -413,7 +415,6 @@ node $TW5_BUILD_TIDDLYWIKI \
|
|||
# /languages/ko-KR/empty.html Empty wiki with ko-KR language
|
||||
node $TW5_BUILD_TIDDLYWIKI \
|
||||
./editions/ko-KR \
|
||||
--verbose \
|
||||
--load $TW5_BUILD_OUTPUT/build.tid \
|
||||
--output $TW5_BUILD_OUTPUT/languages/ko-KR \
|
||||
--build favicon empty static index \
|
||||
|
|
@ -423,7 +424,6 @@ node $TW5_BUILD_TIDDLYWIKI \
|
|||
# /languages/zh-Hans/empty.html Empty wiki with zh-Hans language
|
||||
node $TW5_BUILD_TIDDLYWIKI \
|
||||
./editions/zh-Hans \
|
||||
--verbose \
|
||||
--load $TW5_BUILD_OUTPUT/build.tid \
|
||||
--output $TW5_BUILD_OUTPUT/languages/zh-Hans \
|
||||
--build empty index \
|
||||
|
|
@ -433,7 +433,6 @@ node $TW5_BUILD_TIDDLYWIKI \
|
|||
# /languages/zh-Hant/empty.html Empty wiki with zh-Hant language
|
||||
node $TW5_BUILD_TIDDLYWIKI \
|
||||
./editions/zh-Hant \
|
||||
--verbose \
|
||||
--load $TW5_BUILD_OUTPUT/build.tid \
|
||||
--output $TW5_BUILD_OUTPUT/languages/zh-Hant \
|
||||
--build empty index \
|
||||
|
|
@ -447,10 +446,9 @@ node $TW5_BUILD_TIDDLYWIKI \
|
|||
|
||||
node $TW5_BUILD_TIDDLYWIKI \
|
||||
./editions/pluginlibrary \
|
||||
--verbose \
|
||||
--load $TW5_BUILD_OUTPUT/build.tid \
|
||||
--output $TW5_BUILD_OUTPUT/library/$TW5_BUILD_VERSION \
|
||||
--build \
|
||||
--build library\
|
||||
|| exit 1
|
||||
|
||||
# Delete the temporary build tiddler
|
||||
|
|
|
|||
97
bin/build-tw-org.sh
Executable file
97
bin/build-tw-org.sh
Executable file
|
|
@ -0,0 +1,97 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Build tiddlywiki.org assets.
|
||||
|
||||
# Default to the version of TiddlyWiki installed in this repo
|
||||
|
||||
if [ -z "$TWORG_BUILD_TIDDLYWIKI" ]; then
|
||||
TWORG_BUILD_TIDDLYWIKI=./tiddlywiki.js
|
||||
fi
|
||||
|
||||
echo "Using TWORG_BUILD_TIDDLYWIKI as [$TWORG_BUILD_TIDDLYWIKI]"
|
||||
|
||||
# Set up the build details
|
||||
|
||||
if [ -z "$TWORG_BUILD_DETAILS" ]; then
|
||||
TWORG_BUILD_DETAILS="$(git symbolic-ref --short HEAD)-$(git rev-parse HEAD) from $(git remote get-url origin)"
|
||||
fi
|
||||
|
||||
echo "Using TWORG_BUILD_DETAILS as [$TWORG_BUILD_DETAILS]"
|
||||
|
||||
if [ -z "$TWORG_BUILD_COMMIT" ]; then
|
||||
TWORG_BUILD_COMMIT="$(git rev-parse HEAD)"
|
||||
fi
|
||||
|
||||
echo "Using TWORG_BUILD_COMMIT as [$TWORG_BUILD_COMMIT]"
|
||||
|
||||
# Set up the build output directory
|
||||
|
||||
if [ -z "$TWORG_BUILD_OUTPUT" ]; then
|
||||
TWORG_BUILD_OUTPUT=$(mktemp -d)
|
||||
fi
|
||||
|
||||
mkdir -p $TWORG_BUILD_OUTPUT
|
||||
|
||||
if [ ! -d "$TWORG_BUILD_OUTPUT" ]; then
|
||||
echo 'A valid TWORG_BUILD_OUTPUT environment variable must be set'
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Using TWORG_BUILD_OUTPUT as [$TWORG_BUILD_OUTPUT]"
|
||||
|
||||
# Pull existing GitHub pages content
|
||||
|
||||
git clone --depth=1 --branch=main "https://github.com/TiddlyWiki/tiddlywiki.org-gh-pages.git" $TWORG_BUILD_OUTPUT
|
||||
|
||||
# Make the CNAME file that GitHub Pages requires
|
||||
|
||||
echo "tiddlywiki.org" > $TWORG_BUILD_OUTPUT/CNAME
|
||||
|
||||
# Delete any existing static content
|
||||
|
||||
mkdir -p $TWORG_BUILD_OUTPUT/static
|
||||
rm $TWORG_BUILD_OUTPUT/static/*
|
||||
|
||||
# Put the build details into a .tid file so that it can be included in each build (deleted at the end of this script)
|
||||
|
||||
echo -e -n "title: $:/build\ncommit: $TWORG_BUILD_COMMIT\n\n$TWORG_BUILD_DETAILS\n" > $TWORG_BUILD_OUTPUT/build.tid
|
||||
|
||||
######################################################
|
||||
#
|
||||
# tiddlywiki.org distribution
|
||||
#
|
||||
######################################################
|
||||
|
||||
# /index.html Main site
|
||||
# /favicon.ico Favicon for main site
|
||||
# /static.html Static rendering of default tiddlers
|
||||
# /alltiddlers.html Static rendering of all tiddlers
|
||||
# /static/* Static single tiddlers
|
||||
# /static/static.css Static stylesheet
|
||||
# /static/favicon.ico Favicon for static pages
|
||||
node $TWORG_BUILD_TIDDLYWIKI \
|
||||
editions/tw.org \
|
||||
--verbose \
|
||||
--version \
|
||||
--load $TWORG_BUILD_OUTPUT/build.tid \
|
||||
--output $TWORG_BUILD_OUTPUT \
|
||||
--build favicon static index \
|
||||
|| exit 1
|
||||
|
||||
# Delete the temporary build tiddler
|
||||
|
||||
rm $TWORG_BUILD_OUTPUT/build.tid || exit 1
|
||||
|
||||
# Push output back to GitHub
|
||||
|
||||
# Exit script immediately if any command fails
|
||||
set -e
|
||||
|
||||
pushd $TWORG_BUILD_OUTPUT
|
||||
git config --global user.email "actions@github.com"
|
||||
git config --global user.name "GitHub Actions"
|
||||
git add -A .
|
||||
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.org-gh-pages.git" &>/dev/null
|
||||
git push deploy main &>/dev/null
|
||||
popd
|
||||
|
|
@ -7,4 +7,4 @@ npm --force install tiddlywiki || exit 1
|
|||
|
||||
# Pull existing GitHub pages content
|
||||
|
||||
git clone --depth=1 --branch=master "https://github.com/Jermolene/jermolene.github.io.git" output
|
||||
git clone --depth=1 --branch=master "https://github.com/TiddlyWiki/tiddlywiki.com-gh-pages.git" output
|
||||
|
|
|
|||
|
|
@ -10,6 +10,6 @@ git config --global user.email "actions@github.com"
|
|||
git config --global user.name "GitHub Actions"
|
||||
git add -A .
|
||||
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/Jermolene/jermolene.github.io.git" &>/dev/null
|
||||
git remote add deploy "https://$GH_TOKEN@github.com/TiddlyWiki/tiddlywiki.com-gh-pages.git" &>/dev/null
|
||||
git push deploy master &>/dev/null
|
||||
cd ..
|
||||
|
|
|
|||
16
bin/ci-test.sh
Executable file
16
bin/ci-test.sh
Executable file
|
|
@ -0,0 +1,16 @@
|
|||
#!/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
|
||||
|
|
@ -2,4 +2,4 @@
|
|||
|
||||
# Remove any output files
|
||||
|
||||
find . -regex "^./editions/[a-z0-9\.-]*/output/.*" -delete
|
||||
find . -regex "^./editions/.*/output/.*" -delete
|
||||
|
|
|
|||
|
|
@ -5,52 +5,52 @@ Optimise the SVGs in ./core/images using SVGO from https://github.com/svg/svgo
|
|||
|
||||
Install SVGO with the following command in the root of the repo:
|
||||
|
||||
npm install svgo
|
||||
npm install svgo@2.3.0
|
||||
*/
|
||||
|
||||
"use strict";
|
||||
|
||||
var fs = require("fs"),
|
||||
path = require("path"),
|
||||
SVGO = require("svgo"),
|
||||
svgo = new SVGO({
|
||||
{ optimize } = require("svgo"),
|
||||
config = {
|
||||
plugins: [
|
||||
{cleanupAttrs: true},
|
||||
{removeDoctype: true},
|
||||
{removeXMLProcInst: true},
|
||||
{removeComments: true},
|
||||
{removeMetadata: true},
|
||||
{removeTitle: true},
|
||||
{removeDesc: true},
|
||||
{removeUselessDefs: true},
|
||||
{removeEditorsNSData: true},
|
||||
{removeEmptyAttrs: true},
|
||||
{removeHiddenElems: true},
|
||||
{removeEmptyText: true},
|
||||
{removeEmptyContainers: true},
|
||||
{removeViewBox: false},
|
||||
{cleanupEnableBackground: true},
|
||||
{convertStyleToAttrs: true},
|
||||
{convertColors: true},
|
||||
{convertPathData: true},
|
||||
{convertTransform: true},
|
||||
{removeUnknownsAndDefaults: true},
|
||||
{removeNonInheritableGroupAttrs: true},
|
||||
{removeUselessStrokeAndFill: true},
|
||||
{removeUnusedNS: true},
|
||||
{cleanupIDs: true},
|
||||
{cleanupNumericValues: true},
|
||||
{moveElemsAttrsToGroup: true},
|
||||
{moveGroupAttrsToElems: true},
|
||||
{collapseGroups: true},
|
||||
{removeRasterImages: false},
|
||||
{mergePaths: true},
|
||||
{convertShapeToPath: true},
|
||||
{sortAttrs: true},
|
||||
{removeDimensions: false},
|
||||
{removeAttrs: {attrs: "(stroke|fill)"}}
|
||||
'cleanupAttrs',
|
||||
'removeDoctype',
|
||||
'removeXMLProcInst',
|
||||
'removeComments',
|
||||
'removeMetadata',
|
||||
'removeTitle',
|
||||
'removeDesc',
|
||||
'removeUselessDefs',
|
||||
'removeEditorsNSData',
|
||||
'removeEmptyAttrs',
|
||||
'removeHiddenElems',
|
||||
'removeEmptyText',
|
||||
'removeEmptyContainers',
|
||||
// 'removeViewBox',
|
||||
'cleanupEnableBackground',
|
||||
'convertStyleToAttrs',
|
||||
'convertColors',
|
||||
'convertPathData',
|
||||
'convertTransform',
|
||||
'removeUnknownsAndDefaults',
|
||||
'removeNonInheritableGroupAttrs',
|
||||
'removeUselessStrokeAndFill',
|
||||
'removeUnusedNS',
|
||||
'cleanupIDs',
|
||||
'cleanupNumericValues',
|
||||
'moveElemsAttrsToGroup',
|
||||
'moveGroupAttrsToElems',
|
||||
'collapseGroups',
|
||||
// 'removeRasterImages',
|
||||
'mergePaths',
|
||||
'convertShapeToPath',
|
||||
'sortAttrs',
|
||||
//'removeDimensions',
|
||||
{name: 'removeAttrs', params: { attrs: '(stroke|fill)' } }
|
||||
]
|
||||
});
|
||||
};
|
||||
|
||||
var basepath = "./core/images/",
|
||||
files = fs.readdirSync(basepath).sort();
|
||||
|
|
@ -66,12 +66,14 @@ files.forEach(function(filename) {
|
|||
fakeSVG = body.join("\n");
|
||||
// A hack to make the new-journal-button work
|
||||
fakeSVG = fakeSVG.replace("<<now \"DD\">>","<<now "DD">>");
|
||||
svgo.optimize(fakeSVG, {path: filepath}).then(function(result) {
|
||||
config.path = filepath;
|
||||
var result = optimize(fakeSVG,config);
|
||||
if(result) {
|
||||
var newSVG = header.join("\n") + "\n\n" + result.data.replace("<<now "DD">>","<<now \"DD\">>");
|
||||
fs.writeFileSync(filepath,newSVG);
|
||||
},function(err) {
|
||||
} else {
|
||||
console.log("Error " + err + " with " + filename)
|
||||
process.exit();
|
||||
});
|
||||
};
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -15,3 +15,11 @@ node $TW5_BUILD_TIDDLYWIKI \
|
|||
--output . \
|
||||
--build readmes \
|
||||
|| exit 1
|
||||
|
||||
# tw.org readmes
|
||||
node $TW5_BUILD_TIDDLYWIKI \
|
||||
editions/tw.org \
|
||||
--verbose \
|
||||
--output . \
|
||||
--build readmes \
|
||||
|| exit 1
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ node ./tiddlywiki.js \
|
|||
--verbose \
|
||||
--version \
|
||||
--rendertiddler $:/core/save/all test.html text/plain \
|
||||
--test \
|
||||
|| exit 1
|
||||
|
||||
echo To run the tests in a browser, open "editions/test/output/test.html"
|
||||
|
|
|
|||
461
boot/boot.js
461
boot/boot.js
|
|
@ -68,6 +68,26 @@ $tw.utils.isArrayEqual = function(array1,array2) {
|
|||
});
|
||||
};
|
||||
|
||||
/*
|
||||
Add an entry to a sorted array if it doesn't already exist, while maintaining the sort order
|
||||
*/
|
||||
$tw.utils.insertSortedArray = function(array,value) {
|
||||
var low = 0, high = array.length - 1, mid, cmp;
|
||||
while(low <= high) {
|
||||
mid = (low + high) >> 1;
|
||||
cmp = value.localeCompare(array[mid]);
|
||||
if(cmp > 0) {
|
||||
low = mid + 1;
|
||||
} else if(cmp < 0) {
|
||||
high = mid - 1;
|
||||
} else {
|
||||
return array;
|
||||
}
|
||||
}
|
||||
array.splice(low,0,value);
|
||||
return array;
|
||||
};
|
||||
|
||||
/*
|
||||
Push entries onto an array, removing them first if they already exist in the array
|
||||
array: array to modify (assumed to be free of duplicates)
|
||||
|
|
@ -122,15 +142,15 @@ $tw.utils.each = function(object,callback) {
|
|||
var next,f,length;
|
||||
if(object) {
|
||||
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);
|
||||
if(next === false) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
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];
|
||||
next = callback(object[key],key,object);
|
||||
if(next === false) {
|
||||
|
|
@ -157,6 +177,7 @@ document: defaults to current document
|
|||
eventListeners: array of event listeners (this option won't work until $tw.utils.addEventListeners() has been loaded)
|
||||
*/
|
||||
$tw.utils.domMaker = function(tag,options) {
|
||||
var options = options || {};
|
||||
var doc = options.document || document;
|
||||
var element = doc.createElementNS(options.namespace || "http://www.w3.org/1999/xhtml",tag);
|
||||
if(options["class"]) {
|
||||
|
|
@ -198,9 +219,34 @@ $tw.utils.error = function(err) {
|
|||
heading = dm("h1",{text: errHeading}),
|
||||
prompt = dm("div",{text: promptMsg, "class": "tc-error-prompt"}),
|
||||
message = dm("div",{text: err, "class":"tc-error-message"}),
|
||||
button = dm("div",{children: [dm("button",{text: ( $tw.language == undefined ? "close" : $tw.language.getString("Buttons/Close/Caption") )})], "class": "tc-error-prompt"}),
|
||||
form = dm("form",{children: [heading,prompt,message,button], "class": "tc-error-form"});
|
||||
closeButton = 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,downloadButton,message,closeButton], "class": "tc-error-form"});
|
||||
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) {
|
||||
document.body.removeChild(form);
|
||||
event.preventDefault();
|
||||
|
|
@ -229,7 +275,7 @@ Extend an object with the properties from a list of source objects
|
|||
$tw.utils.extend = function(object /*, sourceObjectList */) {
|
||||
$tw.utils.each(Array.prototype.slice.call(arguments,1),function(source) {
|
||||
if(source) {
|
||||
for (var p in source) {
|
||||
for(var p in source) {
|
||||
object[p] = source[p];
|
||||
}
|
||||
}
|
||||
|
|
@ -243,7 +289,7 @@ Fill in any null or undefined properties of an object with the properties from a
|
|||
$tw.utils.deepDefaults = function(object /*, sourceObjectList */) {
|
||||
$tw.utils.each(Array.prototype.slice.call(arguments,1),function(source) {
|
||||
if(source) {
|
||||
for (var p in source) {
|
||||
for(var p in source) {
|
||||
if(object[p] === null || object[p] === undefined) {
|
||||
object[p] = source[p];
|
||||
}
|
||||
|
|
@ -256,6 +302,28 @@ $tw.utils.deepDefaults = function(object /*, sourceObjectList */) {
|
|||
return object;
|
||||
};
|
||||
|
||||
/*
|
||||
Convert a URIComponent encoded string to a string safely
|
||||
*/
|
||||
$tw.utils.decodeURIComponentSafe = function(s) {
|
||||
var v = s;
|
||||
try {
|
||||
v = decodeURIComponent(s);
|
||||
} catch(e) {}
|
||||
return v;
|
||||
};
|
||||
|
||||
/*
|
||||
Convert a URI encoded string to a string safely
|
||||
*/
|
||||
$tw.utils.decodeURISafe = function(s) {
|
||||
var v = s;
|
||||
try {
|
||||
v = decodeURI(s);
|
||||
} catch(e) {}
|
||||
return v;
|
||||
};
|
||||
|
||||
/*
|
||||
Convert "&" to &, " " to nbsp, "<" to <, ">" to > and """ to "
|
||||
*/
|
||||
|
|
@ -271,7 +339,7 @@ $tw.utils.getLocationHash = function() {
|
|||
var idx = href.indexOf('#');
|
||||
if(idx === -1) {
|
||||
return "#";
|
||||
} else if(idx < href.length-1 && href[idx+1] === '#') {
|
||||
} else if(href.substr(idx + 1,1) === "#" || href.substr(idx + 1,3) === "%23") {
|
||||
// Special case: ignore location hash if it itself starts with a #
|
||||
return "#";
|
||||
} else {
|
||||
|
|
@ -318,8 +386,8 @@ $tw.utils.parseDate = function(value) {
|
|||
parseInt(value.substr(10,2)||"00",10),
|
||||
parseInt(value.substr(12,2)||"00",10),
|
||||
parseInt(value.substr(14,3)||"000",10)));
|
||||
d.setUTCFullYear(year); // See https://stackoverflow.com/a/5870822
|
||||
return d;
|
||||
d.setUTCFullYear(year); // See https://stackoverflow.com/a/5870822
|
||||
return d;
|
||||
} else if($tw.utils.isDate(value)) {
|
||||
return value;
|
||||
} else {
|
||||
|
|
@ -333,7 +401,7 @@ $tw.utils.stringifyList = function(value) {
|
|||
var result = new Array(value.length);
|
||||
for(var t=0, l=value.length; t<l; t++) {
|
||||
var entry = value[t] || "";
|
||||
if(entry.indexOf(" ") !== -1) {
|
||||
if(entry.match(/[^\S\xA0]/mg)) {
|
||||
result[t] = "[[" + entry + "]]";
|
||||
} else {
|
||||
result[t] = entry;
|
||||
|
|
@ -387,6 +455,19 @@ $tw.utils.parseFields = function(text,fields) {
|
|||
return fields;
|
||||
};
|
||||
|
||||
// Safely parse a string as JSON
|
||||
$tw.utils.parseJSONSafe = function(text,defaultJSON) {
|
||||
try {
|
||||
return JSON.parse(text);
|
||||
} catch(e) {
|
||||
if(typeof defaultJSON === "function") {
|
||||
return defaultJSON(e);
|
||||
} else {
|
||||
return defaultJSON || {};
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/*
|
||||
Resolves a source filepath delimited with `/` relative to a specified absolute root filepath.
|
||||
In relative paths, the special folder name `..` refers to immediate parent directory, and the
|
||||
|
|
@ -514,10 +595,22 @@ $tw.utils.getTypeEncoding = function(ext) {
|
|||
return typeInfo ? typeInfo.encoding : "utf8";
|
||||
};
|
||||
|
||||
var globalCheck =[
|
||||
" Object.defineProperty(Object.prototype, '__temp__', {",
|
||||
" get: function () { return this; },",
|
||||
" configurable: true",
|
||||
" });",
|
||||
" if(Object.keys(__temp__).length){",
|
||||
" console.log(\"Warning: Global assignment detected\",Object.keys(__temp__));",
|
||||
" delete Object.prototype.__temp__;",
|
||||
" }",
|
||||
" delete Object.prototype.__temp__;",
|
||||
].join('\n');
|
||||
|
||||
/*
|
||||
Run code globally with specified context variables in scope
|
||||
*/
|
||||
$tw.utils.evalGlobal = function(code,context,filename) {
|
||||
$tw.utils.evalGlobal = function(code,context,filename,sandbox,allowGlobals) {
|
||||
var contextCopy = $tw.utils.extend(Object.create(null),context);
|
||||
// Get the context variables as a pair of arrays of names and values
|
||||
var contextNames = [], contextValues = [];
|
||||
|
|
@ -526,25 +619,38 @@ $tw.utils.evalGlobal = function(code,context,filename) {
|
|||
contextValues.push(value);
|
||||
});
|
||||
// Add the code prologue and epilogue
|
||||
code = "(function(" + contextNames.join(",") + ") {(function(){\n" + code + "\n;})();\nreturn exports;\n})\n";
|
||||
code = [
|
||||
"(function(" + contextNames.join(",") + ") {",
|
||||
" (function(){" + code + "\n;})();\n",
|
||||
(!$tw.browser && sandbox && !allowGlobals) ? globalCheck : "",
|
||||
"\nreturn exports;\n",
|
||||
"})"
|
||||
].join("");
|
||||
|
||||
// Compile the code into a function
|
||||
var fn;
|
||||
if($tw.browser) {
|
||||
fn = window["eval"](code + "\n\n//# sourceURL=" + filename);
|
||||
} else {
|
||||
fn = vm.runInThisContext(code,filename);
|
||||
if(sandbox){
|
||||
fn = vm.runInContext(code,sandbox,filename)
|
||||
} else {
|
||||
fn = vm.runInThisContext(code,filename);
|
||||
}
|
||||
}
|
||||
// Call the function and return the exports
|
||||
return fn.apply(null,contextValues);
|
||||
};
|
||||
|
||||
$tw.utils.sandbox = !$tw.browser ? vm.createContext({}) : undefined;
|
||||
/*
|
||||
Run code in a sandbox with only the specified context variables in scope
|
||||
*/
|
||||
$tw.utils.evalSandboxed = $tw.browser ? $tw.utils.evalGlobal : function(code,context,filename) {
|
||||
var sandbox = $tw.utils.extend(Object.create(null),context);
|
||||
vm.runInNewContext(code,sandbox,filename);
|
||||
return sandbox.exports;
|
||||
$tw.utils.evalSandboxed = $tw.browser ? $tw.utils.evalGlobal : function(code,context,filename,allowGlobals) {
|
||||
return $tw.utils.evalGlobal(
|
||||
code,context,filename,
|
||||
allowGlobals ? vm.createContext({}) : $tw.utils.sandbox,
|
||||
allowGlobals
|
||||
);
|
||||
};
|
||||
|
||||
/*
|
||||
|
|
@ -693,12 +799,13 @@ the password, and to encrypt/decrypt a block of text
|
|||
$tw.utils.Crypto = function() {
|
||||
var sjcl = $tw.node ? (global.sjcl || require("./sjcl.js")) : window.sjcl,
|
||||
currentPassword = null,
|
||||
callSjcl = function(method,inputText,password) {
|
||||
callSjcl = function(method,inputText,password,options) {
|
||||
options = options || {};
|
||||
password = password || currentPassword;
|
||||
var outputText;
|
||||
try {
|
||||
if(password) {
|
||||
outputText = sjcl[method](password,inputText);
|
||||
outputText = sjcl[method](password,inputText,options);
|
||||
}
|
||||
} catch(ex) {
|
||||
console.log("Crypto error:" + ex);
|
||||
|
|
@ -706,6 +813,7 @@ $tw.utils.Crypto = function() {
|
|||
}
|
||||
return outputText;
|
||||
};
|
||||
$tw.sjcl = sjcl;
|
||||
this.setPassword = function(newPassword) {
|
||||
currentPassword = newPassword;
|
||||
this.updateCryptoStateTiddler();
|
||||
|
|
@ -723,7 +831,8 @@ $tw.utils.Crypto = function() {
|
|||
return !!currentPassword;
|
||||
}
|
||||
this.encrypt = function(text,password) {
|
||||
return callSjcl("encrypt",text,password);
|
||||
// set default ks:256 -- see: http://bitwiseshiftleft.github.io/sjcl/doc/convenience.js.html
|
||||
return callSjcl("encrypt",text,password,{v:1,iter:10000,ks:256,ts:64,mode:"ccm",adata:"",cipher:"aes"});
|
||||
};
|
||||
this.decrypt = function(text,password) {
|
||||
return callSjcl("decrypt",text,password);
|
||||
|
|
@ -786,8 +895,8 @@ $tw.modules.execute = function(moduleName,moduleRoot) {
|
|||
} else {
|
||||
/*
|
||||
CommonJS optional require.main property:
|
||||
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)
|
||||
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)
|
||||
*/
|
||||
Object.defineProperty(sandbox.require, "main", {
|
||||
value: (typeof(require) !== "undefined") ? require.main : {TiddlyWiki: _boot},
|
||||
|
|
@ -829,9 +938,9 @@ $tw.modules.execute = function(moduleName,moduleRoot) {
|
|||
moduleInfo.exports = moduleInfo.definition;
|
||||
}
|
||||
} catch(e) {
|
||||
if (e instanceof SyntaxError) {
|
||||
if(e instanceof SyntaxError) {
|
||||
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);
|
||||
} else if(!$tw.browser) {
|
||||
// this is the only way to get node.js to display the line at which the syntax error appeared,
|
||||
|
|
@ -845,7 +954,7 @@ $tw.modules.execute = function(moduleName,moduleRoot) {
|
|||
}
|
||||
} else {
|
||||
// line number should be included in e.stack for runtime errors
|
||||
$tw.utils.error("Error executing boot module " + name + ": " + JSON.stringify(e) + "\n\n" + e.stack);
|
||||
$tw.utils.error("Error executing boot module " + name + ": " + String(e) + "\n\n" + e.stack);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1059,7 +1168,7 @@ $tw.Wiki = function(options) {
|
|||
tiddlerTitles = null, // Array of tiddler titles
|
||||
getTiddlerTitles = function() {
|
||||
if(!tiddlerTitles) {
|
||||
tiddlerTitles = Object.keys(tiddlers);
|
||||
tiddlerTitles = Object.keys(tiddlers).sort(function(a,b) {return a.localeCompare(b);});
|
||||
}
|
||||
return tiddlerTitles;
|
||||
},
|
||||
|
|
@ -1069,7 +1178,7 @@ $tw.Wiki = function(options) {
|
|||
shadowTiddlerTitles = null,
|
||||
getShadowTiddlerTitles = function() {
|
||||
if(!shadowTiddlerTitles) {
|
||||
shadowTiddlerTitles = Object.keys(shadowTiddlers);
|
||||
shadowTiddlerTitles = Object.keys(shadowTiddlers).sort(function(a,b) {return a.localeCompare(b);});
|
||||
}
|
||||
return shadowTiddlerTitles;
|
||||
},
|
||||
|
|
@ -1112,10 +1221,8 @@ $tw.Wiki = function(options) {
|
|||
}
|
||||
// Save the new tiddler
|
||||
tiddlers[title] = tiddler;
|
||||
// Check we've got it's title
|
||||
if(tiddlerTitles && tiddlerTitles.indexOf(title) === -1) {
|
||||
tiddlerTitles.push(title);
|
||||
}
|
||||
// Check we've got the title
|
||||
tiddlerTitles = $tw.utils.insertSortedArray(tiddlerTitles || [],title);
|
||||
// Record the new tiddler state
|
||||
updateDescriptor["new"] = {
|
||||
tiddler: tiddler,
|
||||
|
|
@ -1154,7 +1261,7 @@ $tw.Wiki = function(options) {
|
|||
var index = tiddlerTitles.indexOf(title);
|
||||
if(index !== -1) {
|
||||
tiddlerTitles.splice(index,1);
|
||||
}
|
||||
}
|
||||
}
|
||||
// Record the new tiddler state
|
||||
updateDescriptor["new"] = {
|
||||
|
|
@ -1177,13 +1284,16 @@ $tw.Wiki = function(options) {
|
|||
this.getTiddler = function(title) {
|
||||
if(title) {
|
||||
var t = tiddlers[title];
|
||||
if(t instanceof $tw.Tiddler) {
|
||||
if(t !== undefined) {
|
||||
return t;
|
||||
} else if(title !== undefined && shadowTiddlers[title]) {
|
||||
return shadowTiddlers[title].tiddler;
|
||||
} else {
|
||||
var s = shadowTiddlers[title];
|
||||
if(s !== undefined) {
|
||||
return s.tiddler;
|
||||
}
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
return undefined;
|
||||
};
|
||||
|
||||
// Get an array of all tiddler titles
|
||||
|
|
@ -1212,8 +1322,12 @@ $tw.Wiki = function(options) {
|
|||
index,titlesLength,title;
|
||||
for(index = 0, titlesLength = titles.length; index < titlesLength; index++) {
|
||||
title = titles[index];
|
||||
var shadowInfo = shadowTiddlers[title];
|
||||
callback(shadowInfo.tiddler,title);
|
||||
if(tiddlers[title]) {
|
||||
callback(tiddlers[title],title);
|
||||
} else {
|
||||
var shadowInfo = shadowTiddlers[title];
|
||||
callback(shadowInfo.tiddler,title);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -1296,12 +1410,12 @@ $tw.Wiki = function(options) {
|
|||
var tiddler = tiddlers[title];
|
||||
if(tiddler) {
|
||||
if(tiddler.fields.type === "application/json" && tiddler.hasField("plugin-type") && tiddler.fields.text) {
|
||||
pluginInfo[tiddler.fields.title] = JSON.parse(tiddler.fields.text);
|
||||
pluginInfo[tiddler.fields.title] = $tw.utils.parseJSONSafe(tiddler.fields.text);
|
||||
results.modifiedPlugins.push(tiddler.fields.title);
|
||||
}
|
||||
} else {
|
||||
if(pluginInfo[title]) {
|
||||
delete pluginInfo[title];
|
||||
delete pluginInfo[title];
|
||||
results.deletedPlugins.push(title);
|
||||
}
|
||||
}
|
||||
|
|
@ -1321,7 +1435,7 @@ $tw.Wiki = function(options) {
|
|||
checkTiddler = function(tiddler,title) {
|
||||
if(tiddler && tiddler.fields.type === "application/json" && tiddler.fields["plugin-type"] && (!pluginType || tiddler.fields["plugin-type"] === pluginType)) {
|
||||
var disablingTiddler = self.getTiddler("$:/config/Plugins/Disabled/" + title);
|
||||
if(title === "$:/core" || !disablingTiddler || (disablingTiddler.fields.text || "").trim() !== "yes") {
|
||||
if(title === "$:/core" || title === "$:/core-server" || !disablingTiddler || (disablingTiddler.fields.text || "").trim() !== "yes") {
|
||||
self.unregisterPluginTiddlers(null,[title]); // Unregister the plugin if it's already registered
|
||||
pluginTiddlers.push(tiddler);
|
||||
registeredTitles.push(tiddler.fields.title);
|
||||
|
|
@ -1358,17 +1472,15 @@ $tw.Wiki = function(options) {
|
|||
// Unpack the currently registered plugins, creating shadow tiddlers for their constituent tiddlers
|
||||
this.unpackPluginTiddlers = function() {
|
||||
var self = this;
|
||||
// Sort the plugin titles by the `plugin-priority` field
|
||||
pluginTiddlers.sort(function(a,b) {
|
||||
if("plugin-priority" in a.fields && "plugin-priority" in b.fields) {
|
||||
return a.fields["plugin-priority"] - b.fields["plugin-priority"];
|
||||
} else if("plugin-priority" in a.fields) {
|
||||
// Sort the plugin titles by the `plugin-priority` field, if this field is missing, default to 1
|
||||
pluginTiddlers.sort(function(a, b) {
|
||||
var priorityA = "plugin-priority" in a.fields ? a.fields["plugin-priority"] : 1;
|
||||
var priorityB = "plugin-priority" in b.fields ? b.fields["plugin-priority"] : 1;
|
||||
if (priorityA !== priorityB) {
|
||||
return priorityA - priorityB;
|
||||
} else if (a.fields.title < b.fields.title) {
|
||||
return -1;
|
||||
} else if("plugin-priority" in b.fields) {
|
||||
return +1;
|
||||
} else if(a.fields.title < b.fields.title) {
|
||||
return -1;
|
||||
} else if(a.fields.title === b.fields.title) {
|
||||
} else if (a.fields.title === b.fields.title) {
|
||||
return 0;
|
||||
} else {
|
||||
return +1;
|
||||
|
|
@ -1420,8 +1532,9 @@ Define all modules stored in ordinary tiddlers
|
|||
*/
|
||||
$tw.Wiki.prototype.defineTiddlerModules = function() {
|
||||
this.each(function(tiddler,title) {
|
||||
if(tiddler.hasField("module-type")) {
|
||||
switch (tiddler.fields.type) {
|
||||
// Modules in draft tiddlers are disabled
|
||||
if(tiddler.hasField("module-type") && (!tiddler.hasField("draft.of"))) {
|
||||
switch(tiddler.fields.type) {
|
||||
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
|
||||
if(!$tw.utils.hop($tw.modules.titles,tiddler.fields.title)) {
|
||||
|
|
@ -1429,7 +1542,7 @@ $tw.Wiki.prototype.defineTiddlerModules = function() {
|
|||
}
|
||||
break;
|
||||
case "application/json":
|
||||
$tw.modules.define(tiddler.fields.title,tiddler.fields["module-type"],JSON.parse(tiddler.fields.text));
|
||||
$tw.modules.define(tiddler.fields.title,tiddler.fields["module-type"],$tw.utils.parseJSONSafe(tiddler.fields.text));
|
||||
break;
|
||||
case "application/x-tiddler-dictionary":
|
||||
$tw.modules.define(tiddler.fields.title,tiddler.fields["module-type"],$tw.utils.parseFields(tiddler.fields.text));
|
||||
|
|
@ -1447,6 +1560,11 @@ $tw.Wiki.prototype.defineShadowModules = function() {
|
|||
this.eachShadow(function(tiddler,title) {
|
||||
// Don't define the module if it is overidden by an ordinary tiddler
|
||||
if(!self.tiddlerExists(title) && tiddler.hasField("module-type")) {
|
||||
if(tiddler.hasField("draft.of")) {
|
||||
// Report a fundamental problem
|
||||
console.warn(`TiddlyWiki: Plugins should not contain tiddlers with a 'draft.of' field: ${tiddler.fields.title}`);
|
||||
return;
|
||||
}
|
||||
// Define the module
|
||||
$tw.modules.define(tiddler.fields.title,tiddler.fields["module-type"],tiddler.fields.text);
|
||||
}
|
||||
|
|
@ -1602,8 +1720,8 @@ $tw.modules.define("$:/boot/tiddlerdeserializer/json","tiddlerdeserializer",{
|
|||
}
|
||||
for(var f in data) {
|
||||
if($tw.utils.hop(data,f)) {
|
||||
// Check field name doesn't contain whitespace or control characters
|
||||
if(typeof(data[f]) !== "string" || /[\x00-\x1F\s]/.test(f)) {
|
||||
// Check field name doesn't contain control characters
|
||||
if(typeof(data[f]) !== "string" || /[\x00-\x1F]/.test(f)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
@ -1618,7 +1736,7 @@ $tw.modules.define("$:/boot/tiddlerdeserializer/json","tiddlerdeserializer",{
|
|||
}
|
||||
return true;
|
||||
},
|
||||
data = JSON.parse(text);
|
||||
data = $tw.utils.parseJSONSafe(text);
|
||||
if($tw.utils.isArray(data) && isTiddlerArrayValid(data)) {
|
||||
return data;
|
||||
} else if(isTiddlerValid(data)) {
|
||||
|
|
@ -1658,7 +1776,7 @@ $tw.boot.decryptEncryptedTiddlers = function(callback) {
|
|||
$tw.crypto.setPassword(data.password);
|
||||
var decryptedText = $tw.crypto.decrypt(encryptedText);
|
||||
if(decryptedText) {
|
||||
var json = JSON.parse(decryptedText);
|
||||
var json = $tw.utils.parseJSONSafe(decryptedText);
|
||||
for(var title in json) {
|
||||
$tw.preloadTiddler(json[title]);
|
||||
}
|
||||
|
|
@ -1724,13 +1842,20 @@ $tw.modules.define("$:/boot/tiddlerdeserializer/dom","tiddlerdeserializer",{
|
|||
},
|
||||
t,result = [];
|
||||
if(node) {
|
||||
for(t = 0; t < node.childNodes.length; t++) {
|
||||
var type = (node.getAttribute && node.getAttribute("type")) || null;
|
||||
if(type) {
|
||||
// A new-style container with an explicit deserialization type
|
||||
result = $tw.wiki.deserializeTiddlers(type,node.textContent);
|
||||
} else {
|
||||
// An old-style container of classic DIV-based tiddlers
|
||||
for(t = 0; t < node.childNodes.length; t++) {
|
||||
var childNode = node.childNodes[t],
|
||||
tiddlers = extractTextTiddlers(childNode);
|
||||
tiddlers = tiddlers || extractModuleTiddlers(childNode);
|
||||
if(tiddlers) {
|
||||
result.push.apply(result,tiddlers);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
|
|
@ -1739,17 +1864,23 @@ $tw.modules.define("$:/boot/tiddlerdeserializer/dom","tiddlerdeserializer",{
|
|||
|
||||
$tw.loadTiddlersBrowser = function() {
|
||||
// In the browser, we load tiddlers from certain elements
|
||||
var containerIds = [
|
||||
"libraryModules",
|
||||
"modules",
|
||||
"bootKernelPrefix",
|
||||
"bootKernel",
|
||||
"styleArea",
|
||||
"storeArea",
|
||||
"systemArea"
|
||||
var containerSelectors = [
|
||||
// IDs for old-style v5.1.x tiddler stores
|
||||
"#libraryModules",
|
||||
"#modules",
|
||||
"#bootKernelPrefix",
|
||||
"#bootKernel",
|
||||
"#styleArea",
|
||||
"#storeArea",
|
||||
"#systemArea",
|
||||
// Classes for new-style v5.2.x JSON tiddler stores
|
||||
"script.tiddlywiki-tiddler-store"
|
||||
];
|
||||
for(var t=0; t<containerIds.length; t++) {
|
||||
$tw.wiki.addTiddlers($tw.wiki.deserializeTiddlers("(DOM)",document.getElementById(containerIds[t])));
|
||||
for(var t=0; t<containerSelectors.length; t++) {
|
||||
var nodes = document.querySelectorAll(containerSelectors[t]);
|
||||
for(var n=0; n<nodes.length; n++) {
|
||||
$tw.wiki.addTiddlers($tw.wiki.deserializeTiddlers("(DOM)",nodes[n]));
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -1779,8 +1910,16 @@ $tw.loadTiddlersFromFile = function(filepath,fields) {
|
|||
extensionInfo = $tw.utils.getFileExtensionInfo(ext),
|
||||
type = extensionInfo ? extensionInfo.type : null,
|
||||
typeInfo = type ? $tw.config.contentTypeInfo[type] : null,
|
||||
data = fs.readFileSync(filepath,typeInfo ? typeInfo.encoding : "utf8"),
|
||||
tiddlers = $tw.wiki.deserializeTiddlers(ext,data,fields),
|
||||
fileSize = fs.statSync(filepath).size,
|
||||
data;
|
||||
if(fileSize > $tw.config.maxEditFileSize) {
|
||||
data = "File " + filepath + " not loaded because it is too large";
|
||||
console.log("Warning: " + data);
|
||||
ext = ".txt";
|
||||
} else {
|
||||
data = fs.readFileSync(filepath,typeInfo ? typeInfo.encoding : "utf8");
|
||||
}
|
||||
var tiddlers = $tw.wiki.deserializeTiddlers(ext,data,fields),
|
||||
metadata = $tw.loadMetadataForFile(filepath);
|
||||
if(metadata) {
|
||||
if(type === "application/json") {
|
||||
|
|
@ -1808,7 +1947,7 @@ A default set of files for TiddlyWiki to ignore during load.
|
|||
This matches what NPM ignores, and adds "*.meta" to ignore tiddler
|
||||
metadata files.
|
||||
*/
|
||||
$tw.boot.excludeRegExp = /^\.DS_Store$|^.*\.meta$|^\..*\.swp$|^\._.*$|^\.git$|^\.hg$|^\.lock-wscript$|^\.svn$|^\.wafpickle-.*$|^CVS$|^npm-debug\.log$/;
|
||||
$tw.boot.excludeRegExp = /^\.DS_Store$|^.*\.meta$|^\..*\.swp$|^\._.*$|^\.git$|^\.github$|^\.vscode$|^\.hg$|^\.lock-wscript$|^\.svn$|^\.wafpickle-.*$|^CVS$|^npm-debug\.log$/;
|
||||
|
||||
/*
|
||||
Load all the tiddlers recursively from a directory, including honouring `tiddlywiki.files` files for drawing in external files. Returns an array of {filepath:,type:,tiddlers: [{..fields...}],hasMetaFile:}. Note that no file information is returned for externally loaded tiddlers, just the `tiddlers` property.
|
||||
|
|
@ -1845,22 +1984,41 @@ filepath: pathname of the directory containing the specification file
|
|||
$tw.loadTiddlersFromSpecification = function(filepath,excludeRegExp) {
|
||||
var tiddlers = [];
|
||||
// Read the specification
|
||||
var filesInfo = JSON.parse(fs.readFileSync(filepath + path.sep + "tiddlywiki.files","utf8"));
|
||||
var filesInfo = $tw.utils.parseJSONSafe(fs.readFileSync(filepath + path.sep + "tiddlywiki.files","utf8"), function(e) {
|
||||
console.log("Warning: tiddlywiki.files in " + filepath + " invalid: " + e.message);
|
||||
return {};
|
||||
});
|
||||
|
||||
// Helper to process a file
|
||||
var processFile = function(filename,isTiddlerFile,fields,isEditableFile) {
|
||||
var processFile = function(filename,isTiddlerFile,fields,isEditableFile,rootPath) {
|
||||
var extInfo = $tw.config.fileExtensionInfo[path.extname(filename)],
|
||||
type = (extInfo || {}).type || fields.type || "text/plain",
|
||||
typeInfo = $tw.config.contentTypeInfo[type] || {},
|
||||
pathname = path.resolve(filepath,filename),
|
||||
text = fs.readFileSync(pathname,typeInfo.encoding || "utf8"),
|
||||
metadata = $tw.loadMetadataForFile(pathname) || {},
|
||||
fileTiddlers;
|
||||
fileTooLarge = false,
|
||||
text, fileTiddlers;
|
||||
|
||||
if("_canonical_uri" in fields) {
|
||||
text = "";
|
||||
} else if(fs.statSync(pathname).size > $tw.config.maxEditFileSize) {
|
||||
var msg = "File " + pathname + " not loaded because it is too large";
|
||||
console.log("Warning: " + msg);
|
||||
fileTooLarge = true;
|
||||
text = isTiddlerFile ? msg : "";
|
||||
} else {
|
||||
text = fs.readFileSync(pathname,typeInfo.encoding || "utf8");
|
||||
}
|
||||
|
||||
if(isTiddlerFile) {
|
||||
fileTiddlers = $tw.wiki.deserializeTiddlers(path.extname(pathname),text,metadata) || [];
|
||||
fileTiddlers = $tw.wiki.deserializeTiddlers(fileTooLarge ? ".txt" : path.extname(pathname),text,metadata) || [];
|
||||
} else {
|
||||
fileTiddlers = [$tw.utils.extend({text: text},metadata)];
|
||||
}
|
||||
var combinedFields = $tw.utils.extend({},fields,metadata);
|
||||
if(fileTooLarge && isTiddlerFile) {
|
||||
delete combinedFields.type; // type altered
|
||||
}
|
||||
$tw.utils.each(fileTiddlers,function(tiddler) {
|
||||
$tw.utils.each(combinedFields,function(fieldInfo,name) {
|
||||
if(typeof fieldInfo === "string" || $tw.utils.isArray(fieldInfo)) {
|
||||
|
|
@ -1868,26 +2026,32 @@ $tw.loadTiddlersFromSpecification = function(filepath,excludeRegExp) {
|
|||
} else {
|
||||
var value = tiddler[name];
|
||||
switch(fieldInfo.source) {
|
||||
case "subdirectories":
|
||||
value = $tw.utils.stringifyList(path.relative(rootPath, filename).split(path.sep).slice(0, -1));
|
||||
break;
|
||||
case "filepath":
|
||||
value = path.relative(rootPath, filename).split(path.sep).join('/');
|
||||
break;
|
||||
case "filename":
|
||||
value = path.basename(filename);
|
||||
break;
|
||||
case "filename-uri-decoded":
|
||||
value = decodeURIComponent(path.basename(filename));
|
||||
value = $tw.utils.decodeURIComponentSafe(path.basename(filename));
|
||||
break;
|
||||
case "basename":
|
||||
value = path.basename(filename,path.extname(filename));
|
||||
break;
|
||||
case "basename-uri-decoded":
|
||||
value = decodeURIComponent(path.basename(filename,path.extname(filename)));
|
||||
value = $tw.utils.decodeURIComponentSafe(path.basename(filename,path.extname(filename)));
|
||||
break;
|
||||
case "extname":
|
||||
value = path.extname(filename);
|
||||
break;
|
||||
case "created":
|
||||
value = new Date(fs.statSync(pathname).birthtime);
|
||||
value = $tw.utils.stringifyDate(new Date(fs.statSync(pathname).birthtime));
|
||||
break;
|
||||
case "modified":
|
||||
value = new Date(fs.statSync(pathname).mtime);
|
||||
value = $tw.utils.stringifyDate(new Date(fs.statSync(pathname).mtime));
|
||||
break;
|
||||
}
|
||||
if(fieldInfo.prefix) {
|
||||
|
|
@ -1906,6 +2070,20 @@ $tw.loadTiddlersFromSpecification = function(filepath,excludeRegExp) {
|
|||
tiddlers.push({tiddlers: fileTiddlers});
|
||||
}
|
||||
};
|
||||
// Helper to recursively search subdirectories
|
||||
var getAllFiles = function(dirPath, recurse, arrayOfFiles) {
|
||||
recurse = recurse || false;
|
||||
arrayOfFiles = arrayOfFiles || [];
|
||||
var files = fs.readdirSync(dirPath);
|
||||
files.forEach(function(file) {
|
||||
if(recurse && fs.statSync(dirPath + path.sep + file).isDirectory()) {
|
||||
arrayOfFiles = getAllFiles(dirPath + path.sep + file, recurse, arrayOfFiles);
|
||||
} else if(fs.statSync(dirPath + path.sep + file).isFile()){
|
||||
arrayOfFiles.push(path.join(dirPath, path.sep, file));
|
||||
}
|
||||
});
|
||||
return arrayOfFiles;
|
||||
}
|
||||
// Process the listed tiddlers
|
||||
$tw.utils.each(filesInfo.tiddlers,function(tidInfo) {
|
||||
if(tidInfo.prefix && tidInfo.suffix) {
|
||||
|
|
@ -1915,6 +2093,7 @@ $tw.loadTiddlersFromSpecification = function(filepath,excludeRegExp) {
|
|||
} else if(tidInfo.suffix) {
|
||||
tidInfo.fields.text = {suffix: tidInfo.suffix};
|
||||
}
|
||||
tidInfo.fields = tidInfo.fields || {};
|
||||
processFile(tidInfo.file,tidInfo.isTiddlerFile,tidInfo.fields);
|
||||
});
|
||||
// Process any listed directories
|
||||
|
|
@ -1929,18 +2108,20 @@ $tw.loadTiddlersFromSpecification = function(filepath,excludeRegExp) {
|
|||
// Process directory specifier
|
||||
var dirPath = path.resolve(filepath,dirSpec.path);
|
||||
if(fs.existsSync(dirPath) && fs.statSync(dirPath).isDirectory()) {
|
||||
var files = fs.readdirSync(dirPath),
|
||||
var files = getAllFiles(dirPath, dirSpec.searchSubdirectories),
|
||||
fileRegExp = new RegExp(dirSpec.filesRegExp || "^.*$"),
|
||||
metaRegExp = /^.*\.meta$/;
|
||||
for(var t=0; t<files.length; t++) {
|
||||
var filename = files[t];
|
||||
var thisPath = path.relative(filepath, files[t]),
|
||||
filename = path.basename(thisPath);
|
||||
if(filename !== "tiddlywiki.files" && !metaRegExp.test(filename) && fileRegExp.test(filename)) {
|
||||
processFile(dirPath + path.sep + filename,dirSpec.isTiddlerFile,dirSpec.fields,dirSpec.isEditableFile);
|
||||
dirSpec.fields = dirSpec.fields || {};
|
||||
processFile(thisPath,dirSpec.isTiddlerFile,dirSpec.fields,dirSpec.isEditableFile,dirSpec.path);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
console.log("Warning: a directory in a tiddlywiki.files file does not exist.");
|
||||
console.log("dirPath: " + dirPath);
|
||||
console.log("dirPath: " + dirPath);
|
||||
console.log("tiddlywiki.files location: " + filepath);
|
||||
}
|
||||
}
|
||||
|
|
@ -1960,7 +2141,11 @@ $tw.loadPluginFolder = function(filepath,excludeRegExp) {
|
|||
console.log("Warning: missing plugin.info file in " + filepath);
|
||||
return null;
|
||||
}
|
||||
var pluginInfo = JSON.parse(fs.readFileSync(infoPath,"utf8"));
|
||||
var pluginInfo = $tw.utils.parseJSONSafe(fs.readFileSync(infoPath,"utf8"),function() {return null;});
|
||||
if(!pluginInfo) {
|
||||
console.log("warning: invalid JSON in plugin.info file at " + infoPath);
|
||||
pluginInfo = {};
|
||||
}
|
||||
// Read the plugin files
|
||||
var pluginFiles = $tw.loadTiddlersFromPath(filepath,excludeRegExp);
|
||||
// Save the plugin tiddlers into the plugin info
|
||||
|
|
@ -1985,7 +2170,7 @@ $tw.loadPluginFolder = function(filepath,excludeRegExp) {
|
|||
pluginInfo.dependents = pluginInfo.dependents || [];
|
||||
pluginInfo.type = "application/json";
|
||||
// Set plugin text
|
||||
pluginInfo.text = JSON.stringify({tiddlers: pluginInfo.tiddlers},null,4);
|
||||
pluginInfo.text = JSON.stringify({tiddlers: pluginInfo.tiddlers});
|
||||
delete pluginInfo.tiddlers;
|
||||
// Deserialise array fields (currently required for the dependents field)
|
||||
for(var field in pluginInfo) {
|
||||
|
|
@ -2038,13 +2223,16 @@ Returns an array of search paths
|
|||
*/
|
||||
$tw.getLibraryItemSearchPaths = function(libraryPath,envVar) {
|
||||
var pluginPaths = [path.resolve($tw.boot.corePath,libraryPath)],
|
||||
env;
|
||||
if(envVar) {
|
||||
env = process.env[envVar];
|
||||
if(env) {
|
||||
env.split(path.delimiter).map(function(item) {
|
||||
if(item) {
|
||||
pluginPaths.push(item);
|
||||
}
|
||||
});
|
||||
if(env) {
|
||||
env.split(path.delimiter).map(function(item) {
|
||||
if(item) {
|
||||
pluginPaths.push(item);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
return pluginPaths;
|
||||
};
|
||||
|
|
@ -2077,7 +2265,11 @@ $tw.loadWikiTiddlers = function(wikiPath,options) {
|
|||
pluginFields;
|
||||
// Bail if we don't have a wiki info file
|
||||
if(fs.existsSync(wikiInfoPath)) {
|
||||
wikiInfo = JSON.parse(fs.readFileSync(wikiInfoPath,"utf8"));
|
||||
wikiInfo = $tw.utils.parseJSONSafe(fs.readFileSync(wikiInfoPath,"utf8"),function() {return null;});
|
||||
if(!wikiInfo) {
|
||||
console.log("warning: invalid JSON in tiddlywiki.info file at " + wikiInfoPath);
|
||||
wikiInfo = {};
|
||||
}
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
|
|
@ -2126,13 +2318,14 @@ $tw.loadWikiTiddlers = function(wikiPath,options) {
|
|||
}
|
||||
$tw.wiki.addTiddlers(tiddlerFile.tiddlers);
|
||||
});
|
||||
if ($tw.boot.wikiPath == wikiPath) {
|
||||
if($tw.boot.wikiPath == wikiPath) {
|
||||
// Save the original tiddler file locations if requested
|
||||
var output = {}, relativePath, fileInfo;
|
||||
for(var title in $tw.boot.files) {
|
||||
fileInfo = $tw.boot.files[title];
|
||||
if(fileInfo.isEditableFile) {
|
||||
relativePath = path.relative($tw.boot.wikiTiddlersPath,fileInfo.filepath);
|
||||
fileInfo.originalpath = relativePath;
|
||||
output[title] =
|
||||
path.sep === "/" ?
|
||||
relativePath :
|
||||
|
|
@ -2186,6 +2379,7 @@ $tw.loadTiddlersNode = function() {
|
|||
});
|
||||
// Load the core tiddlers
|
||||
$tw.wiki.addTiddler($tw.loadPluginFolder($tw.boot.corePath));
|
||||
$tw.wiki.addTiddler($tw.loadPluginFolder($tw.boot.coreServerPath));
|
||||
// Load any extra plugins
|
||||
$tw.utils.each($tw.boot.extraPlugins,function(name) {
|
||||
if(name.charAt(0) === "+") { // Relative path to plugin
|
||||
|
|
@ -2198,7 +2392,7 @@ $tw.loadTiddlersNode = function() {
|
|||
type = parts[0];
|
||||
if(parts.length === 3 && ["plugins","themes","languages"].indexOf(type) !== -1) {
|
||||
$tw.loadPlugins([parts[1] + "/" + parts[2]],$tw.config[type + "Path"],$tw.config[type + "EnvVar"]);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
// Load the tiddlers from the wiki directory
|
||||
|
|
@ -2259,6 +2453,7 @@ $tw.boot.initStartup = function(options) {
|
|||
// System paths and filenames
|
||||
$tw.boot.bootPath = options.bootPath || path.dirname(module.filename);
|
||||
$tw.boot.corePath = path.resolve($tw.boot.bootPath,"../core");
|
||||
$tw.boot.coreServerPath = path.resolve($tw.boot.bootPath,"../core-server");
|
||||
// If there's no arguments then default to `--help`
|
||||
if($tw.boot.argv.length === 0) {
|
||||
$tw.boot.argv = ["--help"];
|
||||
|
|
@ -2307,30 +2502,38 @@ $tw.boot.initStartup = function(options) {
|
|||
$tw.utils.registerFileType("image/webp","base64",".webp",{flags:["image"]});
|
||||
$tw.utils.registerFileType("image/heic","base64",".heic",{flags:["image"]});
|
||||
$tw.utils.registerFileType("image/heif","base64",".heif",{flags:["image"]});
|
||||
$tw.utils.registerFileType("image/avif","base64",".avif",{flags:["image"]});
|
||||
$tw.utils.registerFileType("image/svg+xml","utf8",".svg",{flags:["image"]});
|
||||
$tw.utils.registerFileType("image/vnd.microsoft.icon","base64",".ico",{flags:["image"]});
|
||||
$tw.utils.registerFileType("image/x-icon","base64",".ico",{flags:["image"]});
|
||||
$tw.utils.registerFileType("application/font-woff","base64",".woff");
|
||||
$tw.utils.registerFileType("application/x-font-ttf","base64",".woff");
|
||||
$tw.utils.registerFileType("application/font-woff2","base64",".woff2");
|
||||
$tw.utils.registerFileType("application/wasm","base64",".wasm");
|
||||
$tw.utils.registerFileType("font/woff","base64",".woff");
|
||||
$tw.utils.registerFileType("font/woff2","base64",".woff2");
|
||||
$tw.utils.registerFileType("font/ttf","base64",".ttf");
|
||||
$tw.utils.registerFileType("font/otf","base64",".otf");
|
||||
$tw.utils.registerFileType("audio/ogg","base64",".ogg");
|
||||
$tw.utils.registerFileType("audio/mp4","base64",[".mp4",".m4a"]);
|
||||
$tw.utils.registerFileType("video/ogg","base64",[".ogm",".ogv",".ogg"]);
|
||||
$tw.utils.registerFileType("video/webm","base64",".webm");
|
||||
$tw.utils.registerFileType("video/mp4","base64",".mp4");
|
||||
$tw.utils.registerFileType("audio/mp3","base64",".mp3");
|
||||
$tw.utils.registerFileType("audio/mp4","base64",[".mp4",".m4a"]);
|
||||
$tw.utils.registerFileType("audio/mpeg","base64",[".mp3",".m2a",".mp2",".mpa",".mpg",".mpga"]);
|
||||
$tw.utils.registerFileType("text/markdown","utf8",[".md",".markdown"],{deserializerType:"text/x-markdown"});
|
||||
$tw.utils.registerFileType("text/x-markdown","utf8",[".md",".markdown"]);
|
||||
$tw.utils.registerFileType("application/enex+xml","utf8",".enex");
|
||||
$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/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/mspowerpoint","base64",".ppt");
|
||||
$tw.utils.registerFileType("text/x-bibtex","utf8",".bib",{deserializerType:"application/x-bibtex"});
|
||||
$tw.utils.registerFileType("application/x-bibtex","utf8",".bib");
|
||||
$tw.utils.registerFileType("application/epub+zip","base64",".epub");
|
||||
$tw.utils.registerFileType("application/octet-stream","base64",".octet-stream");
|
||||
// Create the wiki store for the app
|
||||
$tw.wiki = new $tw.Wiki();
|
||||
$tw.wiki = new $tw.Wiki($tw.safeMode && {enableIndexers: []});
|
||||
// Install built in tiddler fields modules
|
||||
$tw.Tiddler.fieldModules = $tw.modules.getModulesByTypeAsHashmap("tiddlerfield");
|
||||
// Install the tiddler deserializer modules
|
||||
|
|
@ -2375,10 +2578,10 @@ $tw.boot.execStartup = function(options){
|
|||
if($tw.safeMode) {
|
||||
$tw.wiki.processSafeMode();
|
||||
}
|
||||
// Register typed modules from the tiddlers we've just loaded
|
||||
$tw.wiki.defineTiddlerModules();
|
||||
// And any modules within plugins
|
||||
// Register typed modules from the tiddlers we've just loaded and any modules within plugins
|
||||
// Tiddlers should appear last so that they may overwrite shadows during module registration
|
||||
$tw.wiki.defineShadowModules();
|
||||
$tw.wiki.defineTiddlerModules();
|
||||
// Make sure the crypto state tiddler is up to date
|
||||
if($tw.crypto) {
|
||||
$tw.crypto.updateCryptoStateTiddler();
|
||||
|
|
@ -2447,11 +2650,13 @@ $tw.boot.executeNextStartupTask = function(callback) {
|
|||
$tw.boot.log(s.join(" "));
|
||||
// Execute task
|
||||
if(!$tw.utils.hop(task,"synchronous") || task.synchronous) {
|
||||
task.startup();
|
||||
if(task.name) {
|
||||
$tw.boot.executedStartupModules[task.name] = true;
|
||||
const thenable = task.startup();
|
||||
if(thenable && typeof thenable.then === "function"){
|
||||
thenable.then(asyncTaskCallback);
|
||||
return true;
|
||||
} else {
|
||||
return asyncTaskCallback();
|
||||
}
|
||||
return $tw.boot.executeNextStartupTask(callback);
|
||||
} else {
|
||||
task.startup(asyncTaskCallback);
|
||||
return true;
|
||||
|
|
@ -2466,16 +2671,29 @@ $tw.boot.executeNextStartupTask = function(callback) {
|
|||
};
|
||||
|
||||
/*
|
||||
Returns true if we are running on one platforms specified in a task modules `platforms` array
|
||||
Returns true if we are running on one of the platforms specified in taskModule's
|
||||
`platforms` array; or if `platforms` property is not defined.
|
||||
*/
|
||||
$tw.boot.doesTaskMatchPlatform = function(taskModule) {
|
||||
var platforms = taskModule.platforms;
|
||||
if(platforms) {
|
||||
for(var t=0; t<platforms.length; t++) {
|
||||
if((platforms[t] === "browser" && !$tw.browser) || (platforms[t] === "node" && !$tw.node)) {
|
||||
return false;
|
||||
switch(platforms[t]) {
|
||||
case "browser":
|
||||
if($tw.browser) {
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
case "node":
|
||||
if($tw.node) {
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
$tw.utils.error("Module " + taskModule.name + ": '" + platforms[t] + "' in export.platforms invalid");
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
};
|
||||
|
|
@ -2497,7 +2715,7 @@ $tw.boot.isStartupTaskEligible = function(taskModule) {
|
|||
for(t=0; t<remaining.length; t++) {
|
||||
var task = remaining[t];
|
||||
if(task.before && task.before.indexOf(name) !== -1) {
|
||||
if($tw.boot.doesTaskMatchPlatform(task) || (task.name && $tw.boot.disabledStartupModules.indexOf(name) !== -1)) {
|
||||
if($tw.boot.doesTaskMatchPlatform(task) && (!task.name || $tw.boot.disabledStartupModules.indexOf(task.name) === -1)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
@ -2532,13 +2750,25 @@ $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
|
||||
*/
|
||||
$tw.hooks.invokeHook = function(hookName /*, value,... */) {
|
||||
var args = Array.prototype.slice.call(arguments,1);
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
|
@ -2576,3 +2806,4 @@ if(typeof(exports) !== "undefined") {
|
|||
} else {
|
||||
_boot(window.$tw);
|
||||
}
|
||||
//# sourceURL=$:/boot/boot.js
|
||||
|
|
|
|||
|
|
@ -19,9 +19,13 @@ var _bootprefix = (function($tw) {
|
|||
$tw = $tw || Object.create(null);
|
||||
$tw.boot = $tw.boot || Object.create(null);
|
||||
|
||||
// Config
|
||||
$tw.config = $tw.config || Object.create(null);
|
||||
$tw.config.maxEditFileSize = 100 * 1024 * 1024; // 100MB
|
||||
|
||||
// Detect platforms
|
||||
if(!("browser" in $tw)) {
|
||||
$tw.browser = typeof(window) !== "undefined" ? {} : null;
|
||||
$tw.browser = typeof(window) !== "undefined" && typeof(document) !== "undefined" ? {} : null;
|
||||
}
|
||||
if(!("node" in $tw)) {
|
||||
$tw.node = typeof(process) === "object" ? {} : null;
|
||||
|
|
@ -117,3 +121,4 @@ if(typeof(exports) === "undefined") {
|
|||
// Export functionality as a module
|
||||
exports.bootprefix = _bootprefix;
|
||||
}
|
||||
//# sourceURL=$:/boot/bootprefix.js
|
||||
|
|
|
|||
|
|
@ -1,3 +0,0 @@
|
|||
title: $:/library/sjcl.js
|
||||
type: application/javascript
|
||||
library: yes
|
||||
32
boot/tiddlywiki.files
Normal file
32
boot/tiddlywiki.files
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
{
|
||||
"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
|
||||
}
|
||||
]
|
||||
}
|
||||
1
code-of-conduct.md
Normal file
1
code-of-conduct.md
Normal file
|
|
@ -0,0 +1 @@
|
|||
<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>
|
||||
5
community/docs/Community Cards Caveats.tid
Normal file
5
community/docs/Community Cards Caveats.tid
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
title: Community Cards Caveats
|
||||
created: 20250909171928024
|
||||
modified: 20250909171928024
|
||||
|
||||
''Please note that [[Community Cards]] are a new initiative started in September 2025. There is further work required to complete the team and people information.''
|
||||
11
community/docs/Community Cards.tid
Normal file
11
community/docs/Community Cards.tid
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
title: Community Cards
|
||||
tags: Community
|
||||
modified: 20250909171928024
|
||||
created: 20250909171928024
|
||||
|
||||
The purpose of Community Cards is to allow project plans and other community activities to be linked to the people who are involved in them. They also allow people to share their interests and activities in the TiddlyWiki community, and to help people in the TiddlyWiki community get to know each other better.
|
||||
|
||||
{{Community Cards Caveats}}
|
||||
|
||||
* [[Submitting a Community Card]]
|
||||
* [[Displaying Community Cards]]
|
||||
26
community/docs/Displaying Community Cards.tid
Normal file
26
community/docs/Displaying Community Cards.tid
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
title: Displaying Community Cards
|
||||
tags: [[Community Cards]]
|
||||
modified: 20250909171928024
|
||||
created: 20250909171928024
|
||||
|
||||
!! Cards for people
|
||||
|
||||
This is an inline card for <<community-card-pill-person title:"@Jermolene">> and <<community-card-pill-person title:"@ericshulman">> which can be used in the middle of a sentence.
|
||||
|
||||
This is a stack of inline cards:
|
||||
|
||||
<<community-card-pill-stack-person>>
|
||||
|
||||
Here is a full format card:
|
||||
|
||||
<<community-card-person title:"@Jermolene">>
|
||||
|
||||
This is how the card looks when there is no such person:
|
||||
|
||||
<<community-card-person title:"@MissingPerson">>
|
||||
|
||||
!! Cards for teams
|
||||
|
||||
This is a card for a project team:
|
||||
|
||||
<<community-card-team title:"Project Team">>
|
||||
36
community/docs/Submitting a Community Card.tid
Normal file
36
community/docs/Submitting a Community Card.tid
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
title: Submitting a Community Card
|
||||
tags: [[Community Cards]]
|
||||
modified: 20250909171928024
|
||||
created: 20250909171928024
|
||||
|
||||
Anyone associated with the TiddlyWiki community can submit a Community Card. The submission process currently involves making a GitHub pull request but we intend to provide a more user-friendly submission process in the future.
|
||||
|
||||
Pull requests to add or update a community card should be made against the `tiddlywiki-com` branch of the [[TiddlyWiki repository|https://github.com/TiddlyWiki/TiddlyWiki5]] in the directory `community/people`.
|
||||
|
||||
The card should be a TiddlyWiki tiddler with the following fields:
|
||||
|
||||
|!Field |!Required|!Description |
|
||||
|`title`|Yes |The username of the person represented by the card, starting with `@` (e.g. `@Jermolene`). This is the title of the card and should be unique |
|
||||
|`tags`|Yes |The tags for the card, including `Community/Person` |
|
||||
|`fullname`|Yes |The full name of the person or group represented by the card |
|
||||
|`avatar`|Yes |The base64 representation of the 32x32 avatar image for the person represented by the card |
|
||||
|`first-sighting`|No |The date of the first sighting in the community of the person represented by the card. This should be in ISO 8601 format (YYYY-MM-DD) |
|
||||
|`talk.tiddlywiki.org`|Yes |The username of the person or group on the TiddlyWiki Talk forum |
|
||||
|`github`|No |The username of the person or group on GitHub |
|
||||
|`linkedin`|No |The URL of the LinkedIn profile for the person or group represented by the card |
|
||||
|`flickr`|No |The URL of the Flickr profile for the person or group represented by the card |
|
||||
|`homepage`|No |The URL of the homepage for the person or group represented by the card |
|
||||
|`email`|No |The email address of the person or group represented by the card |
|
||||
|`text`|Yes |The text of the card. This should include a brief description of the person or group represented by the card, and any other relevant information |
|
||||
|
||||
! Rules for Community Cards
|
||||
|
||||
Community cards must observe the following rules. It is intended to enforce them with an automated script, but for the moment they will be manually checked.
|
||||
|
||||
* `title` must be unique and start with `@`
|
||||
* `tags` must include `Community/Person`
|
||||
* `fullname` must be provided
|
||||
* `avatar` must be a base64 representation of a 32x32 image, with a limit of 1KB. [[Squoosh|https://squoosh.app/]] is recommended for resizing and compressing images
|
||||
* `first-sighting` should be in ISO 8601 format (YYYY-MM-DD)
|
||||
* `talk.tiddlywiki.org` must be provided
|
||||
* `text` total size must not exceed 2KB
|
||||
10
community/people/Arlen22.tid
Normal file
10
community/people/Arlen22.tid
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
title: @Arlen22
|
||||
tags: Community/Person
|
||||
fullname: Arlen Beiler
|
||||
first-sighting: 2011-06-20
|
||||
talk.tiddlywiki.org: arlen22
|
||||
github: Arlen22
|
||||
homepage: arlen22.github.io
|
||||
avatar: /9j/4AAQSkZJRgABAQAAAQABAAD/2wEEEAAVABUAFQAVABYAFQAYABoAGgAYACEAIwAfACMAIQAwAC0AKQApAC0AMABJADQAOAA0ADgANABJAG8ARQBRAEUARQBRAEUAbwBiAHcAYQBaAGEAdwBiALEAiwB7AHsAiwCxAMwArACiAKwAzAD4AN0A3QD4ATgBKAE4AZcBlwIkEQAVABUAFQAVABYAFQAYABoAGgAYACEAIwAfACMAIQAwAC0AKQApAC0AMABJADQAOAA0ADgANABJAG8ARQBRAEUARQBRAEUAbwBiAHcAYQBaAGEAdwBiALEAiwB7AHsAiwCxAMwArACiAKwAzAD4AN0A3QD4ATgBKAE4AZcBlwIk/8IAEQgAQABAAwEiAAIRAQMRAf/EADAAAAIDAQEAAAAAAAAAAAAAAAMFAQQGAgABAQEBAQEAAAAAAAAAAAAAAAIDAQAE/9oADAMBAAIQAxAAAADIRMd3XctQlXtCTTmB6RFvANDouy4DYwEEar6YVM7ocz57mcqnZys+V2azZU4XZSoiZqhQt9TKOlnO+GOl1HyoUPXLn//EACYQAAICAQQCAgEFAAAAAAAAAAECABEDBBIhMUFRECITFCMycZH/2gAIAQEAAT8AI4Bv4ryAeBAnANHuNidWogEwYHNRsdfA8iruVMOIu6iYtK4c714vgTDpXyOfrQHdifoArEXxM2mR0NeOhUzI+LJzYbuHszCm5hYseZh0gXYWFIai4cWJgFJuFKYvtr2sJRuB9fUzgDHlGMHia2757uYsYc0TNHpsSmzzMONjl9iu74iK6PbWT7gv/RMiZDk+qcA3NXkAVl3gE+ADU1PDVdiaDCGJZjQEyowKANS1ZMwK+HJ+3a0KUDqYnYINxJ3eItDk81M2cZD+NVIrmanU/wAl2gCZiGNiaFziJ3LYIHcXMrLvDABe17EN1vCgqR2TNPnGTBSBbDTeV3c2amdlxPuD2C3H9epqmV628xqsUYmdiuwkVVTSZ0Q/dxwYdScrgBRsqONi2KQX7mo1G4WCK20B6j6p/VpcfMXPVQ9mbhx9eLgZrFGDUZB1DqMrCma4xN8mDcR5qK5Rgw7Hx//EABwRAQEBAQACAwAAAAAAAAAAAAECABEDIhIxQf/aAAgBAgEBPwDVQYpfzd66qDeOSn7yEmH23ffDAi66mug6DM9N8HTAY3//xAAcEQEBAQEAAgMAAAAAAAAAAAABAAIREBIiQVH/2gAIAQMBAT8AglC+rJbdCT1vVC33l83tj2OPLS+AJ3+Tf//Z
|
||||
|
||||
I make random software.
|
||||
29
community/people/EricShulman.tid
Normal file
29
community/people/EricShulman.tid
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
title: @ericshulman
|
||||
tags: Community/Person Community/Team/Contributors
|
||||
fullname: Eric Shulman
|
||||
first-sighting: 2005-06-21
|
||||
talk.tiddlywiki.org: ericshulman
|
||||
github: ericshulman
|
||||
homepage: tiddlytools.com
|
||||
email: elsdesign@gmail.com
|
||||
avatar: iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAQAAADZc7J/AAAD/ElEQVR42o2Tf2iUdRzH37e7rOa222233bab3mqKU9QihCAi+isKwX/sh5UQhGYQhNAvQowRUoghQWDOIJtQmOY0M92ZmVGm0WbTyZI1Nnft99S1jc3dPT9efffg/bHdLn19Hp4HPjzv9/fz+fL5aE58PwUkjzzFVC4P/G/k6E445Pc+uceeaqnv7Ogd6Rq68PPhrc+vkiERWOLT/+Ib8uQHNiXax3BIM0mC+CEtl2G7X9mIeCV+9Ejrr2MAtgkH14SNBRZXrYYPNF86nsXCkx/8dATAsp0JhknQTYJrTHg5SNI0qMekb+aw8Hr74WCKpNNu/0Kck5ymkRMcZz/1Jv5g2CUFbZYelrbMvlBMonHvJK3JuPsdTQxwExc8XG7SxF7OcxGScP6wRGCG/Asjf39VPydTzbQyRBrXBKToBCP/nQQ9VpIDO6SumU3EjUFLzX766HMG0mIvoJnXEbU47GGXc4TGBs3zWp5Jh7F47omdf56hy9lLIz3gyYfZSQMJztFEH3KEDg+bf1dkzkO9Savks7H9NLqnuEw3MEU314nTwABj/MV2R6y8JL+0wKdM8MtX23aFy04dF5mg08QI6XYsemmzRfiMDP5Mg1emK4ienZxi0p0gBfRwhSHAxgXGGeS6tYUdu6TPA3Ofr3Mfj9Bv4zHMDaCTMcBlnG4cJqx64sagN9Ngw3RJoa5R+MftI8k1Wm7NcSsH6KKPFGBbG1n1srQ+06DWpJ59cRhsGKGbo0wBFpDgNGcBcHGsl9BuSZmjfCRHWnv0BtgOcJVWwAZG2cw+3uErAKacZ6hq32PkGWuNSaxsHgIHxqjje5I4/Ms2dCt+BHpcUT4ai0j5sw22TCea2sCBbz3BOjaRFj+JeAE46IoHxlUmlfrmWuZT+8Ae935fjljDe3zpLdEJxGriLHdFtL8mKC2cbbAgIOXVBemwBhHibZq4xN/0YgPrESsRsiMs+C1zEwwFxqBqs4hY2yhlKeIUab5GLEM8SLlVRslu77jZhEwL/ofKKZ4uknxiiLO0cYFGFpJPMTGiRO0iQqtNrX7NxueTcahqv4/FTpgwFYinOcoxtiLKWEwF+U6Mqv5FuVlWSQHzvBWmKmUqIEg1YiMfIu6lhjKCRK0YkXelwoDmIjztWrCot5KQs5R5zKccIVZQwl3cTaVdQVGnfOkrzFbDuvuJWTVuBcXcQ5iFlFFAmBynlBKKH/f6z06pX6r6pJoSQlaeW2gsighi3na1E6HwNSkUUHbS45FXG7ajhIi68+1cO98qtqqJEHzTW6LbEfUstER1ef2llBKhiGqKW7VGUk6lT7dnmS/gnZMf1KPaoI16VWsrA1KhX3dObo5m9VqQpff/AFTcI4hMzFV+AAAAAElFTkSuQmCC
|
||||
|
||||
\define wiki(text,topic) [[$text$|https://en.wikipedia.org/wiki/$topic$]]
|
||||
|
||||
''Hello! My name is Eric Shulman''. I am the author of ''[[www.TiddlyTools.com|http://www.TiddlyTools.com]] (Small Tools for Big Ideas! ™)'', a popular collection of original plugins, macros, widgets, templates and stylesheets for TiddlyWiki that I have created and shared with the TiddlyWiki community.
|
||||
|
||||
<<<
|
||||
Think of TiddlyTools as a ''virtual hardware store and "demonstration showroom"'', offering tools, parts and techniques that provide a rich variety of new functionality and feature enhancements to help you ''turn a general-purpose TiddlyWiki "info-house" into a comfortable, custom-built "info-home"''.
|
||||
|
||||
The TiddlyWiki core system provides the basic structure and utilities: the foundation, framing, walls, roof, windows/doors, plumbing, heating, and electrical systems. Then, TiddlyTools helps you with all the "finish work": the appliances, fixtures, lighting, cabinets, furniture, paint, wallpaper, carpeting, etc. ''to best suit your specific needs and personal style''.
|
||||
<<<
|
||||
|
||||
Since the early days of TiddlyWiki (April 2005), I have worked closely with its inventor, [[Jeremy Ruston|https://jermolene.com/]], to help develop and improve TiddlyWiki's core functions. I am also a key contributor and administrator of the online TiddlyWiki [[Discourse|https://talk.TiddlyWiki.org]] and [[GoogleGroups|https://groups.google.com/forum/#!forum/tiddlywiki]] discussion forums, providing ongoing assistance to the worldwide TiddlyWiki community. I have written over 15,000 detailed responses to individual questions posted online. For several years I was also the lead developer and maintainer of the [[TiddlyWiki Classic|https://classic.tiddlywiki.com/]] codebase.
|
||||
|
||||
I was born and raised in suburban Long Island, NY, and attended [[Carnegie Mellon University (CMU)|https://www.cmu.edu/]] in Pittsburgh, PA, where I studied ''Computer Science, Cognitive Psychology, Sociology, Human Factors Design, and Artificial Intelligence''. As an undergraduate at CMU, I was privileged to work with some of the major luminaries in early software research and design, including <<wiki "Herbert Simon" "Herbert_A._Simon">>, <<wiki "Allen Newell" "Allen_Newell">>, <<wiki "James Gosling" "James_Gosling">>, and <<wiki "Raj Reddy" "Raj_Reddy">>. I was also employed in several Computer Science Department research projects, including the development of speech recognition technologies, graphical interface systems, and interactive applications for instruction in physics, art and music. I received a ''Bachelor of Science in "Interactive Systems Design"'' from CMU in 1985.
|
||||
|
||||
During my early post-graduate years, I worked for several notable software development companies, including
|
||||
<<wiki "Honeywell Information Systems" "Honeywell#Honeywell_Information_Systems">> and <<wiki "Lotus Software" "Lotus_Software">>. I was an integral member of the <<wiki "1-2-3 spreadsheet"
|
||||
"Lotus_1-2-3">> development team where I helped create the first GUI-based application interfaces for Microsoft Windows and IBM OS/2.
|
||||
|
||||
Since 1998, I have been an ''independent design consultant'', living and working in Silicon Valley, where I apply more than 40 years of experience to provide ''analysis, design and software development services'' for commercial companies and not-for-profit organizations, with emphasis on ''information architecture'' and ''interaction/visual design standards'' to improve ease-of-use for new and existing software products and online environments.
|
||||
21
community/people/Jermolene.tid
Normal file
21
community/people/Jermolene.tid
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
title: @Jermolene
|
||||
tags: Community/Person
|
||||
fullname: Jeremy Ruston
|
||||
first-sighting: 2004-09-20
|
||||
talk.tiddlywiki.org: jeremyruston
|
||||
github: Jermolene
|
||||
linkedin: www.linkedin.com/in/jermy
|
||||
flickr: www.flickr.com/photos/jermy/
|
||||
bluesky: https://bsky.app/profile/jermolene.bsky.social
|
||||
homepage: jermolene.com
|
||||
email: jeremy@jermolene.com
|
||||
avatar: /9j/4AAQSkZJRgABAQAAAQABAAD/2wCEAAgICAgJCAkKCgkNDgwODRMREBARExwUFhQWFBwrGx8bGx8bKyYuJSMlLiZENS8vNUROQj5CTl9VVV93cXecnNEBCAgICAkICQoKCQ0ODA4NExEQEBETHBQWFBYUHCsbHxsbHxsrJi4lIyUuJkQ1Ly81RE5CPkJOX1VVX3dxd5yc0f/CABEIACAAIAMBIgACEQEDEQH/xAAtAAEBAAMAAAAAAAAAAAAAAAAHBgIEBQEBAQEBAAAAAAAAAAAAAAAAAgQBBf/aAAwDAQACEAMQAAAANF4uTuPRhD2nBLnUiJvKM0DtMKy//8QAKxAAAgIBAwMDAQkAAAAAAAAAAQIDBBEABRITITEiMkFxFEJRUmFicoGR/9oACAEBAAE/AInTA6gUGP4ZOQbW1bPsmyUq1q+gmvFPUzZPDkPamtwqU75ks04JakroVcg5RwRjg66NUx25KbzqJYyMngfqSuq0M3NZYIebJIvZozIvI/iNPcp/aalSdJXsS4VcKeIzlvU3jVTcYLNiaGISrjkhWQYDfQ63pYAzCDBsOiu7Dsx4EHH6r2w2ttimjd2IsNErhhJHKI04/uzqxuCxpBYVVWKSHqwMyMSQ33SB7dUJFmlkMYRgnqZgCMf7rf8AeEt3A9YOhjXAb2k8u7dtT1RZeOtXmYxiOPj4ZWY/lb51skqUNnNW/wBNzC7IpB6gQeeB/jq/fqGOaLbowuYn5MAQOw8LjW5Vmeo0qIsqYLLKjHIZmwv9fB1//8QAHxEAAQMEAwEAAAAAAAAAAAAAEQABAgMSIWExMkFR/9oACAECAQE/AD9iTy2lJmHUB8BVKM4SNSOj46a29saX/8QAHREAAgICAwEAAAAAAAAAAAAAAQIAAwQRITGBkf/aAAgBAwEBPwDHpFpJZtamVSiBWT2Yt7hmCDsb+TKtsKqpGg3M/9k=
|
||||
|
||||
I'm the original inventor of TiddlyWiki. You can hire me through my consultancy company [[Intertwingled Innovations|https://intertwingledinnovations.com]] or contact me directly.
|
||||
|
||||
Further information:
|
||||
|
||||
* A recording of the [[keynote I gave at QCon London in April 2024|https://www.infoq.com/presentations/bbc-micro/]], and the [[discussion on talk.tiddlywiki.org|https://talk.tiddlywiki.org/t/recording-of-jeremys-keynote-at-qcon-london-april-2024/10505]]. The talk mixes some nostalgia about my teenage activities with the BBC Micro with thoughts on the development of the software industry and insights gained from working with TiddlyWiki
|
||||
* An [[interview with me in The Inquirer|https://web.archive.org/web/20111103225832/http://www.theinquirer.net/inquirer/feature/2105529/bt-software-engineer-tells-telco-source]] by Wendy Grossman
|
||||
* A [[hilarious interview with me|https://www.youtube.com/watch?v=auyIhw8MTmQ]] from British television in 1983
|
||||
* Here's a video of a presentation I did in 2007 called [["How to Start an Open Source Project"|http://vimeo.com/856110]].
|
||||
11
community/people/MotovunJack.tid
Normal file
11
community/people/MotovunJack.tid
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
title: @MotovunJack
|
||||
tags: Community/Person Community/Robot
|
||||
fullname: Motovun Jack
|
||||
first-sighting: 2012-01-12
|
||||
github: MotovunJack
|
||||
homepage: tiddlywiki.com
|
||||
avatar: /9j/4AAQSkZJRgABAQAAAQABAAD/2wEEEAAYABgAGAAYABkAGAAaAB0AHQAaACUAKAAjACgAJQA2ADIALgAuADIANgBSADsAPwA7AD8AOwBSAH0ATgBbAE4ATgBbAE4AfQBuAIYAbQBlAG0AhgBuAMYAnACKAIoAnADGAOUAwQC2AMEA5QEWAPgA+AEWAV4BTAFeAckByQJmEQAYABgAGAAYABkAGAAaAB0AHQAaACUAKAAjACgAJQA2ADIALgAuADIANgBSADsAPwA7AD8AOwBSAH0ATgBbAE4ATgBbAE4AfQBuAIYAbQBlAG0AhgBuAMYAnACKAIoAnADGAOUAwQC2AMEA5QEWAPgA+AEWAV4BTAFeAckByQJm/8IAEQgAQABAAwEiAAIRAQMRAf/EADAAAAIDAQEAAAAAAAAAAAAAAAMEAQIFBgABAQEBAQEAAAAAAAAAAAAAAAIDAQAE/9oADAMBAAIQAxAAAADZCfn5vZJz+rnODGtpbpm6O8xzG9lCiszXtikQhtkTBputBxURJuVVYlEdBaQ284mPDj6GmkNUblMxRmi7dKw//8QAKxAAAgIBAgUCBgMBAAAAAAAAAQIAAxESIQQTIkFRFGEjMUJxgaEyNGLR/9oACAEBAAE/AMmX3ilMkjPaV3ragZDtNRmoxpvA2sEqQcHEwJxlwa98nYbCU8TymDfSTvPVKMbZHkQcTU4yDH46tTiE8RxjLXnQp7Dx5MACgKuyqMAS1xXU7kjYTiEbWp3y0IucYbGx6e05hDAqMH/k59o3DfxAE5hss1MNzODdVraxu50ieppH1Tivi8O6eYQ1j4B6guAftChDMNjBqycHcCYJqdj2s3idRBHfpi/1Kie7PDo95w/EMxYM22n9yy5AzBc/iLe7dIqx7kyy2ypyOWoYTofhCyDAZtx4MOmpK9sncyx1NdSq2kBBt3EKf6mgIzDUPIiByuqk7faMLbOyEjuuxEAyo56AgeTA3KL1AYRm1CcvmkgAs2wHjEvPxGIMJPmHUQCQNothr32A0ggeYluplcAK2PlLbTytZUkdwI7V3lAQMgbAfP8AMoCV1AKMOR+pdsc5yD595mMmNIGD4h0vsfupHyBlTKW9znMd+TQnljPWqHYIqhwD1zKsqtjBzCAVAyBicnqG6jbOe0//xAAbEQEBAAMBAQEAAAAAAAAAAAABAAIRIRASQf/aAAgBAgEBPwBYbZDuXvnLE5OrkWJzxI4g33ift//EABsRAAMBAQADAAAAAAAAAAAAAAABEQIhEBJB/9oACAEDAQE/AMqjzHwjGoZXPHTb6Zp1/TRp1khYjW01xHqz/9k=
|
||||
|
||||
Motovun Jack is a robot that helps maintain the TiddlyWiki project infrastructure. It is not a person, but rather a set of automated scripts and tools that assist in managing the various services and resources used by the TiddlyWiki community.
|
||||
|
||||
The origin of the name "Motovun Jack" is a lovable and playful kitten encountered by [[@Jermolene]] in the beautiful medieval hill town of Motovun in Croatia. Jack was [[first adopted|https://github.com/TiddlyWiki/TiddlyWiki5/commit/ecfbaaa5641f14e1766ef17ef6416bf9aa992863]] as the TiddlyWiki 5 mascot in 2012.
|
||||
10
community/project/TiddlyWiki People.tid
Normal file
10
community/project/TiddlyWiki People.tid
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
title: TiddlyWiki People
|
||||
modified: 20250909171928024
|
||||
created: 20250909171928024
|
||||
tags: Community About
|
||||
|
||||
Members of the TiddlyWiki community who are involved in the development of TiddlyWiki and the running of the project are invited to [[create a Community Card|Submitting a Community Card]] so that they can be included in project plans and organisation charts. Community Cards can also showcase their interests and activities in the TiddlyWiki community.
|
||||
|
||||
{{Community Cards Caveats}}
|
||||
|
||||
<<community-card-pill-stack-person personFilter:"[tag[Community/Person]sort[title]]">>
|
||||
10
community/project/TiddlyWiki Project.tid
Normal file
10
community/project/TiddlyWiki Project.tid
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
title: TiddlyWiki Project
|
||||
modified: 20250909171928024
|
||||
created: 20250909171928024
|
||||
tags: Community About
|
||||
|
||||
The TiddlyWiki Project is the coordinated, ongoing effort to maintain and improve TiddlyWiki, and to support the TiddlyWiki community.
|
||||
|
||||
{{Community Cards Caveats}}
|
||||
|
||||
<$list filter="[tag[Community/Team]]" template="$:/tiddlywiki/community/cards/ViewTemplateBodyTemplateTeam"/>
|
||||
4
community/project/Vacant Positions.tid
Normal file
4
community/project/Vacant Positions.tid
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
title: Vacant Positions
|
||||
tags: [[TiddlyWiki Project]]
|
||||
|
||||
If you are interested in volunteering to help the project please get in touch with <<community-card-pill-person title:"@Jermolene">>.
|
||||
8
community/project/teams/Core Team.tid
Normal file
8
community/project/teams/Core Team.tid
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
title: Core Team
|
||||
tags: Community/Team
|
||||
modified: 20250909171928024
|
||||
created: 20250909171928024
|
||||
leader: @Jermolene
|
||||
team: @saqimtiaz
|
||||
|
||||
The core team is responsible for the maintenance and development of the TiddlyWiki core and official plugins.
|
||||
14
community/project/teams/Infrastructure Team.tid
Normal file
14
community/project/teams/Infrastructure Team.tid
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
title: Infrastructure Team
|
||||
tags: Community/Team
|
||||
modified: 20250909171928024
|
||||
created: 20250909171928024
|
||||
team: @MotovunJack
|
||||
|
||||
The Infrastructure Team is responsible for maintaining and improving the infrastructure that supports the TiddlyWiki project. This includes the hosting, deployment, and management of the TiddlyWiki websites and services, as well as the tools and systems used by the TiddlyWiki community.
|
||||
|
||||
The infrastructure includes:
|
||||
|
||||
* talk.tiddlywiki.org
|
||||
* github.com/TiddlyWiki
|
||||
* tiddlywiki.com DNS
|
||||
* Netlify account for PR previews
|
||||
8
community/project/teams/MultiWikiServer Team.tid
Normal file
8
community/project/teams/MultiWikiServer Team.tid
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
title: MultiWikiServer Team
|
||||
tags: Community/Team
|
||||
modified: 20250909171928024
|
||||
created: 20250909171928024
|
||||
leader: @Arlen22
|
||||
team:
|
||||
|
||||
The MultiWikiServer development repository is at https://github.com/TiddlyWiki/MultiWikiServer
|
||||
6
community/project/teams/Newsletter Team.tid
Normal file
6
community/project/teams/Newsletter Team.tid
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
title: Newsletter Team
|
||||
tags: Community/Team
|
||||
modified: 20250909171928024
|
||||
created: 20250909171928024
|
||||
|
||||
The Newsletter Team is responsible for producing the TiddlyWiki Newsletter, a monthly email newsletter that highlights news, updates, and community contributions related to TiddlyWiki.
|
||||
15
community/project/teams/Project Team.tid
Normal file
15
community/project/teams/Project Team.tid
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
title: Project Team
|
||||
tags: Community/Team
|
||||
modified: 20250909171928024
|
||||
created: 20250909171928024
|
||||
icon: $:/tiddlywiki/community/icons/project-team
|
||||
leader: @Jermolene
|
||||
team: @saqimtiaz @ericshulman
|
||||
|
||||
The project team is responsible for the overall TiddlyWiki project, its vision, mission and values, and ensuring that it meets the needs of the community.
|
||||
|
||||
Areas of responsibility include:
|
||||
|
||||
* Communicating and demonstrating the vision, mission and values of the project
|
||||
* Continuously improve the development process and practices of the project
|
||||
* more to come...
|
||||
13
community/project/teams/Succession Team.tid
Normal file
13
community/project/teams/Succession Team.tid
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
title: Succession Team
|
||||
tags: Community/Team
|
||||
modified: 20250909171928024
|
||||
created: 20250909171928024
|
||||
leader: @Jermolene
|
||||
team: @saqimtiaz @ericshulman
|
||||
|
||||
The Succession Team is responsible for ensuring that personnel changes do not impact access to the external infrastructure used by the project.
|
||||
|
||||
* Work with the other teams to ensure that the project has a succession plan for key personnel
|
||||
* Work with the other teams to ensure that they are using the appropriate, community-owned infrastructure
|
||||
* Ensure that the members of the succession team share ownership of the key project resources (eg passwords and user accounts). The Succession Team is not expected to use their access rights apart from managing access in the event of personnel changes
|
||||
|
||||
5
community/project/teams/tagCommunityTeam.tid
Normal file
5
community/project/teams/tagCommunityTeam.tid
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
title: Community/Team
|
||||
modified: 20250909171928024
|
||||
created: 20250909171928024
|
||||
list: [[Project Team]] [[Core Team]] [[Documentation Team]] [[MultiWikiServer Team]] [[Newsletter Team]] [[Infrastructure Team]] [[Succession Team]]
|
||||
|
||||
3
community/readme.md
Normal file
3
community/readme.md
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
# Community Records and Resources
|
||||
|
||||
These raw tiddlers comprise the community records and resources for the TiddlyWiki project. They are packaged as a root directory outside of the usual "editions" folder so that they can be shared with other wikis.
|
||||
15
community/tools/cards/DefaultColourMappings.multids
Normal file
15
community/tools/cards/DefaultColourMappings.multids
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
title: $:/config/DefaultColourMappings/
|
||||
|
||||
community-card-background: #ffffee
|
||||
community-card-foreground: #441111
|
||||
community-card-dark-shadow: rgba(188, 189, 189, 0.5)
|
||||
community-card-shadow: rgba(212, 212, 213, 0.5)
|
||||
community-card-header-background: #9e3060
|
||||
community-card-header-foreground: #ddddee
|
||||
community-card-team-header-background: #306090
|
||||
community-card-team-header-foreground: #ddeedd
|
||||
community-card-vacancy-header-background: #609030
|
||||
community-card-vacancy-header-foreground: #eedddd
|
||||
community-card-info-background: #f3f38b
|
||||
community-card-info-foreground: #444411
|
||||
community-card-field-name-foreground: #888844
|
||||
168
community/tools/cards/Procedures.tid
Normal file
168
community/tools/cards/Procedures.tid
Normal file
|
|
@ -0,0 +1,168 @@
|
|||
title: $:/tiddlywiki/community/cards/Procedures
|
||||
tags: $:/tags/Global
|
||||
|
||||
\procedure community-card-display-jpeg-field(fieldName,mode:"block",default)
|
||||
<$genesis $type={{{ [<mode>match[block]then[div]else[span]] }}} class={{{ tc-community-card-field-image [[tc-community-card-field-image-]addsuffix<fieldName>] +[join[ ]] }}}>
|
||||
<%if [<currentTiddler>has<fieldName>] %>
|
||||
<img src={{{ [<currentTiddler>get<fieldName>addprefix[data:image/jpeg;base64,]] }}} width="32"/>
|
||||
<%else%>
|
||||
<$transclude $tiddler=<<default>> $mode=<<mode>>/>
|
||||
<%endif%>
|
||||
</$genesis>
|
||||
\end community-card-display-jpeg-field
|
||||
|
||||
\procedure community-card-display-transclusion(fieldName,mode:"inline",default)
|
||||
<$genesis $type={{{ [<mode>match[block]then[div]else[span]] }}} class={{{ tc-community-card-field-image [[tc-community-card-field-image-]addsuffix<fieldName>] +[join[ ]] }}}>
|
||||
<%if [<currentTiddler>has<fieldName>] %>
|
||||
<$transclude $tiddler={{{ [<currentTiddler>get<fieldName>] }}} $mode=<<mode>>/>
|
||||
<%else%>
|
||||
<$transclude $tiddler=<<default>> $mode=<<mode>>/>
|
||||
<%endif%>
|
||||
</$genesis>
|
||||
\end community-card-display-transclusion
|
||||
|
||||
\procedure community-card-display-text-field(fieldName,showLabel:"yes",linkPrefix,displayPrefix,mode:"block")
|
||||
<%if [<currentTiddler>has<fieldName>] :or[<fieldName>match[title]] %>
|
||||
<$genesis $type={{{ [<mode>match[block]then[div]else[span]] }}} class={{{ tc-community-card-field-text [[tc-community-card-field-text-]addsuffix<fieldName>] +[join[ ]] }}}>
|
||||
<%if [<showLabel>match[yes]] %>
|
||||
<span class="tc-community-card-field-text-name"><$text text=<<fieldName>>/></span>
|
||||
<%endif%>
|
||||
<%if [<linkPrefix>!match[]] %>
|
||||
<a
|
||||
href={{{ [<currentTiddler>get<fieldName>addprefix<linkPrefix>] }}}
|
||||
class="tc-community-card-field-text-value"
|
||||
rel="noopener noreferrer"
|
||||
target="_blank"
|
||||
>
|
||||
<$text text={{{ [<currentTiddler>get<fieldName>] :else[<fieldName>match[title]then<currentTiddler>] +[addprefix<displayPrefix>] }}}/>
|
||||
</a>
|
||||
<%else%>
|
||||
<span class="tc-community-card-field-text-value">
|
||||
<$text text={{{ [<currentTiddler>get<fieldName>] :else[<fieldName>match[title]then<currentTiddler>] +[addprefix<displayPrefix>] }}}/>
|
||||
</span>
|
||||
<%endif%>
|
||||
</$genesis>
|
||||
<%endif%>
|
||||
\end community-card-display-text-field
|
||||
|
||||
\procedure community-card-person(title)
|
||||
<$let currentTiddler=<<title>>>
|
||||
<div class="tc-community-card">
|
||||
<$link to=<<currentTiddler>> class="tc-community-card-header-link">
|
||||
<div class="tc-community-card-header">
|
||||
<<community-card-display-jpeg-field "avatar" default:"$:/tiddlywiki/community/icons/person">>
|
||||
<<community-card-display-text-field "title" showLabel:"no">>
|
||||
</div>
|
||||
</$link>
|
||||
<div class="tc-community-card-info">
|
||||
<<community-card-display-text-field "fullname">>
|
||||
<<community-card-display-text-field "first-sighting">>
|
||||
<<community-card-display-text-field "talk.tiddlywiki.org" linkPrefix:"https://talk.tiddlywiki.org/u/" displayPrefix:"@">>
|
||||
<<community-card-display-text-field "github" linkPrefix:"https://github.com/" displayPrefix:"@">>
|
||||
<<community-card-display-text-field "linkedin" linkPrefix:"https://">>
|
||||
<<community-card-display-text-field "flickr" linkPrefix:"https://">>
|
||||
<<community-card-display-text-field "homepage" linkPrefix:"https://">>
|
||||
<<community-card-display-text-field "email" linkPrefix:"mailto:">>
|
||||
<%if [all[tiddlers+shadows]tag[Community/Team]sort[title]] :filter[{!!leader}match<..currentTiddler>] +[count[]compare:number:gt[0]] %>
|
||||
<div class="tc-community-card-field-text">
|
||||
<span class="tc-community-card-field-text-name">leader</span>
|
||||
<span class="tc-community-card-field-text-value">
|
||||
<$list filter="[all[tiddlers+shadows]tag[Community/Team]sort[title]] :filter[{!!leader}match<..currentTiddler>]">
|
||||
<$transclude $variable="community-card-pill-team" title=<<currentTiddler>>/>
|
||||
</$list>
|
||||
</span>
|
||||
</div>
|
||||
<%endif%>
|
||||
<%if [all[tiddlers+shadows]tag[Community/Team]sort[title]] :filter[enlist{!!team}match<..currentTiddler>] +[count[]compare:number:gt[0]] %>
|
||||
<div class="tc-community-card-field-text">
|
||||
<span class="tc-community-card-field-text-name">member</span>
|
||||
<span class="tc-community-card-field-text-value">
|
||||
<$list filter="[all[tiddlers+shadows]tag[Community/Team]sort[title]] :filter[enlist{!!team}match<..currentTiddler>]">
|
||||
<$transclude $variable="community-card-pill-team" title=<<currentTiddler>>/>
|
||||
</$list>
|
||||
</span>
|
||||
</div>
|
||||
<%endif%>
|
||||
</div>
|
||||
<div class="tc-community-card-body">
|
||||
<$transclude $tiddler=<<currentTiddler>> $field="text" $mode="block"/>
|
||||
</div>
|
||||
</div>
|
||||
</$let>
|
||||
\end community-card-person
|
||||
|
||||
\procedure community-card-team(title)
|
||||
<$let currentTiddler=<<title>>>
|
||||
<div class="tc-community-card tc-community-card-team">
|
||||
<$link to=<<currentTiddler>> class="tc-community-card-header-link">
|
||||
<div class="tc-community-card-header">
|
||||
<<community-card-display-transclusion fieldName:"icon" default:"$:/tiddlywiki/community/icons/team">>
|
||||
<<community-card-display-text-field "title" showLabel:"no">>
|
||||
</div>
|
||||
</$link>
|
||||
<div class="tc-community-card-info">
|
||||
<div class="tc-community-card-field-text">
|
||||
<span class="tc-community-card-field-text-name">leader</span>
|
||||
<span class="tc-community-card-field-text-value">
|
||||
<%if [<currentTiddler>has[leader]] %>
|
||||
<$transclude $variable="community-card-pill-person" title={{!!leader}}/>
|
||||
<%else%>
|
||||
<$transclude $variable="community-card-vacancy"/>
|
||||
<%endif%>
|
||||
</span>
|
||||
</div>
|
||||
<div class="tc-community-card-field-text">
|
||||
<span class="tc-community-card-field-text-name">team</span>
|
||||
<span class="tc-community-card-field-text-value"><$transclude $variable="community-card-pill-stack-person" personFilter={{!!team}}/></span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="tc-community-card-body">
|
||||
<$transclude $tiddler=<<currentTiddler>> $field="text" $mode="block"/>
|
||||
</div>
|
||||
</div>
|
||||
</$let>
|
||||
\end community-card-team
|
||||
|
||||
\procedure community-card-pill-person(title)
|
||||
<$let currentTiddler=<<title>>>
|
||||
<$link to=<<currentTiddler>> class="tc-community-card-pill">
|
||||
<<community-card-display-jpeg-field "avatar" default:"$:/tiddlywiki/community/icons/person" mode="inline">>
|
||||
<<community-card-display-text-field "title" showLabel:"no" mode:"inline">>
|
||||
</$link>
|
||||
</$let>
|
||||
\end community-card-pill-person
|
||||
|
||||
\procedure community-card-pill-stack-person(personFilter:"[tag[Community/Person]]")
|
||||
<div class="tc-community-card-pill-stack">
|
||||
<$list filter=<<personFilter>>>
|
||||
<$list-template>
|
||||
<$transclude $variable="community-card-pill-person" title=<<currentTiddler>> mode="block"/>
|
||||
</$list-template>
|
||||
<$list-empty>
|
||||
<$transclude $variable="community-card-vacancy"/>
|
||||
</$list-empty>
|
||||
</$list>
|
||||
</div>
|
||||
\end community-card-pill-stack-person
|
||||
|
||||
\procedure community-card-pill-team(title)
|
||||
<$let currentTiddler=<<title>>>
|
||||
<$link to=<<currentTiddler>> class="tc-community-card-pill">
|
||||
<<community-card-display-transclusion fieldName:"icon" default:"$:/tiddlywiki/community/icons/team">>
|
||||
<<community-card-display-text-field "title" showLabel:"no" mode:"inline">>
|
||||
</$link>
|
||||
</$let>
|
||||
\end community-card-pill-team
|
||||
|
||||
\procedure community-card-vacancy()
|
||||
<$link to="Vacant Positions" class="tc-community-card-pill tc-community-card-pill-vacancy">
|
||||
<span class="tc-community-card-field-image tc-community-card-field-image-avatar">
|
||||
{{$:/core/images/help}}
|
||||
</span>
|
||||
<span class="tc-community-card-field-text tc-community-card-field-text-title">
|
||||
<span class="tc-community-card-field-text-value">
|
||||
Vacant
|
||||
</span>
|
||||
</span>
|
||||
</$link>
|
||||
\end community-card-vacancy
|
||||
158
community/tools/cards/Styles.tid
Normal file
158
community/tools/cards/Styles.tid
Normal file
|
|
@ -0,0 +1,158 @@
|
|||
title: $:/tiddlywiki/community/cards/Styles
|
||||
tags: $:/tags/Stylesheet
|
||||
|
||||
.tc-community-card {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
flex-wrap: wrap;
|
||||
justify-content: center;
|
||||
border-radius: 8px;
|
||||
width: 100%;
|
||||
margin-bottom: 8px;
|
||||
background: <<colour community-card-background>>;
|
||||
color: <<colour community-card-foreground>>;
|
||||
fill: <<colour community-card-foreground>>;
|
||||
box-shadow: 0 1px 3px 0 <<colour community-card-shadow>>, 0 0 0 1px <<colour community-card-shadow>>;
|
||||
transition: box-shadow 0.3s ease,transform .3s ease;
|
||||
}
|
||||
|
||||
.tc-community-card:hover {
|
||||
box-shadow: 0 1px 6px 0 <<colour community-card-dark-shadow>>, 0 0 0 1px <<colour community-card-shadow>>;
|
||||
transform: translateY(-2px);
|
||||
}
|
||||
|
||||
.tc-community-card .tc-community-card-header-link {
|
||||
background-color: <<colour community-card-header-background>>;
|
||||
color: <<colour community-card-header-foreground>>;
|
||||
border-top-left-radius: 8px;
|
||||
border-top-right-radius: 8px;
|
||||
}
|
||||
|
||||
.tc-community-card.tc-community-card-team .tc-community-card-header-link {
|
||||
background: <<colour community-card-team-header-background>>;
|
||||
color: <<colour community-card-team-header-foreground>>;
|
||||
fill: <<colour community-card-team-header-foreground>>;
|
||||
}
|
||||
|
||||
.tc-community-card .tc-community-card-header-link:hover {
|
||||
text-decoration: none;
|
||||
background-color: <<colour community-card-header-foreground>>;
|
||||
color: <<colour community-card-header-background>>;
|
||||
}
|
||||
|
||||
.tc-community-card-header {
|
||||
margin: 0;
|
||||
padding: 0.5em;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
flex-wrap: nowrap;
|
||||
justify-content: flex-start;
|
||||
align-items: center;
|
||||
line-height: 0;
|
||||
}
|
||||
|
||||
.tc-community-card-header .tc-community-card-field-text-title {
|
||||
font-size: 1.5em;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.tc-community-card-header .tc-community-card-field-image {
|
||||
display: table-row;
|
||||
width: auto;
|
||||
max-width: 100%;
|
||||
margin-right: 12px;
|
||||
}
|
||||
|
||||
.tc-community-card-info {
|
||||
display: table;
|
||||
width: auto;
|
||||
max-width: 100%;
|
||||
padding: 8px;
|
||||
margin: 0;
|
||||
background-color: <<colour community-card-info-background>>;
|
||||
color: <<colour community-card-info-foreground>>;
|
||||
}
|
||||
|
||||
.tc-community-card-body {
|
||||
padding: 0 8px;
|
||||
}
|
||||
|
||||
.tc-community-card .tc-community-card-field-text {
|
||||
display: table-row;
|
||||
}
|
||||
|
||||
.tc-community-card .tc-community-card-field-text-name,
|
||||
.tc-community-card .tc-community-card-field-text-value {
|
||||
display: table-cell;
|
||||
padding: 2px 6px 2px 0;
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
.tc-community-card .tc-community-card-field-text-name {
|
||||
color: <<colour community-card-field-name-foreground>>;
|
||||
white-space: nowrap;
|
||||
text-align: right;
|
||||
padding-right: 8px;
|
||||
}
|
||||
|
||||
.tc-community-card .tc-community-card-field-text-value {
|
||||
word-break: break-word;
|
||||
font-weight: bold;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
a.tc-community-card-pill {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 4px;
|
||||
width: auto;
|
||||
min-width:0;
|
||||
max-width: none;
|
||||
align-self: auto;
|
||||
font-size: 0.9em;
|
||||
line-height: 1;
|
||||
vertical-align: middle;
|
||||
padding: 4px;
|
||||
border-radius: 4px;
|
||||
background: <<colour community-card-header-background>>;
|
||||
color: <<colour community-card-header-foreground>>;
|
||||
fill: <<colour community-card-header-foreground>>;
|
||||
box-shadow: 0 1px 3px 0 <<colour community-card-shadow>>, 0 0 0 1px <<colour community-card-shadow>>;
|
||||
transition: box-shadow 0.3s ease,transform .3s ease;
|
||||
}
|
||||
|
||||
a.tc-community-card-pill.tc-community-card-pill-vacancy {
|
||||
background: <<colour community-card-vacancy-header-background>>;
|
||||
color: <<colour community-card-vacancy-header-foreground>>;
|
||||
fill: <<colour community-card-vacancy-header-foreground>>;
|
||||
}
|
||||
|
||||
a.tc-community-card-pill:hover {
|
||||
text-decoration: none;
|
||||
box-shadow: 0 1px 6px 0 <<colour community-card-dark-shadow>>, 0 0 0 1px <<colour community-card-shadow>>;
|
||||
transform: translateY(-2px);
|
||||
background: <<colour community-card-header-foreground>>;
|
||||
color: <<colour community-card-header-background>>;
|
||||
fill: <<colour community-card-header-background>>;
|
||||
}
|
||||
|
||||
a.tc-community-card-pill .tc-community-card-field-image img,
|
||||
a.tc-community-card-pill .tc-community-card-field-image svg {
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
vertical-align: middle;
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
a.tc-community-card-pill .tc-community-card-field-text {
|
||||
display: inline;
|
||||
}
|
||||
|
||||
.tc-community-card-pill-stack {
|
||||
display: inline-flex;
|
||||
flex-direction: column;
|
||||
align-items: stretch;
|
||||
gap: 4px;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
6
community/tools/cards/ViewTemplateBodyCascade.tid
Normal file
6
community/tools/cards/ViewTemplateBodyCascade.tid
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
title: $:/tiddlywiki/community/cards/ViewTemplateBodyCascade
|
||||
tags: $:/tags/ViewTemplateBodyFilter
|
||||
list-before:
|
||||
|
||||
[tag[Community/Person]then[$:/tiddlywiki/community/cards/ViewTemplateBodyTemplatePerson]]
|
||||
[tag[Community/Team]then[$:/tiddlywiki/community/cards/ViewTemplateBodyTemplateTeam]]
|
||||
3
community/tools/cards/ViewTemplateBodyTemplatePerson.tid
Normal file
3
community/tools/cards/ViewTemplateBodyTemplatePerson.tid
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
title: $:/tiddlywiki/community/cards/ViewTemplateBodyTemplatePerson
|
||||
|
||||
<$transclude $variable="community-card-person" title=<<currentTiddler>>/>
|
||||
3
community/tools/cards/ViewTemplateBodyTemplateTeam.tid
Normal file
3
community/tools/cards/ViewTemplateBodyTemplateTeam.tid
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
title: $:/tiddlywiki/community/cards/ViewTemplateBodyTemplateTeam
|
||||
|
||||
<$transclude $variable="community-card-team" title=<<currentTiddler>>/>
|
||||
7
community/tools/icons/person.tid
Normal file
7
community/tools/icons/person.tid
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
title: $:/tiddlywiki/community/icons/person
|
||||
tags: $:/tags/Image
|
||||
|
||||
\parameters (size:"22pt")
|
||||
<svg width=<<size>> height=<<size>> viewBox="0 0 64 64">
|
||||
<path d="M43.127,29.612c-0.879,-0.378 -1.452,-1.25 -1.452,-2.207c-0.006,-0.678 0.27,-1.33 0.761,-1.797c0.147,-0.141 0.29,-0.28 0.397,-0.393c0.753,-0.791 1.416,-1.663 1.978,-2.6c1.392,-2.318 2.126,-4.974 2.126,-7.677c0,-8.196 -6.744,-14.938 -14.938,-14.938c-0.945,0 -1.886,0.088 -2.813,0.266c-5.891,1.031 -10.578,5.586 -11.781,11.446c-1.105,5.016 0.454,10.264 4.118,13.865c0.495,0.469 0.78,1.118 0.792,1.799l0,0.012c0.008,0.966 -0.567,1.848 -1.453,2.23c-5.949,2.466 -10.698,7.172 -13.217,13.099c-1.772,4.059 -2.66,8.45 -2.607,12.88l0,3.192c0,2.858 2.351,5.211 5.212,5.211l43.5,0c2.859,0 5.212,-2.353 5.212,-5.211l-0,-3.225c0.053,-4.427 -0.837,-8.816 -2.611,-12.873c-2.523,-5.922 -7.274,-10.621 -13.224,-13.079Z" style="fill-rule:nonzero;"/>
|
||||
</svg>
|
||||
7
community/tools/icons/project-team.tid
Normal file
7
community/tools/icons/project-team.tid
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
title: $:/tiddlywiki/community/icons/project-team
|
||||
tags: $:/tags/Image
|
||||
|
||||
\parameters (size:"22pt")
|
||||
<svg width=<<size>> height=<<size>> viewBox="0 0 64 64">
|
||||
<path d="M24.891,49.399l-3.521,0c-1.398,0 -2.547,-1.15 -2.547,-2.547l0,-1.56c-0.026,-2.165 0.408,-4.311 1.274,-6.295c1.231,-2.897 3.552,-5.197 6.46,-6.402c0.433,-0.187 0.714,-0.618 0.71,-1.09l0,-0.006c-0.006,-0.333 -0.145,-0.65 -0.387,-0.879c-1.791,-1.76 -2.553,-4.325 -2.013,-6.777c0.588,-2.864 2.879,-5.09 5.758,-5.594c0.453,-0.087 0.913,-0.13 1.375,-0.13c4.005,0 7.301,3.295 7.301,7.301c0,1.321 -0.359,2.619 -1.039,3.752c-0.275,0.458 -0.599,0.884 -0.967,1.271c-0.052,0.055 -0.122,0.123 -0.194,0.192c-0.24,0.228 -0.375,0.547 -0.372,0.878c0,0.468 0.28,0.894 0.71,1.079c2.908,1.201 5.23,3.498 6.463,6.392c0.815,1.865 1.248,3.872 1.276,5.904c-0.179,0.006 -0.351,0.007 -0.514,0.003c-0.556,-0.016 -1.375,-0.294 -2.288,-0.512c-1.295,-0.308 -2.719,-0.543 -4.01,-0.396l-0.013,0.001c-1.056,0.128 -2.116,0.325 -3.097,0.76c-0.385,0.171 -1.216,0.753 -1.446,0.916c-1.157,0.297 -2.564,0.475 -3.797,0.312c-0.713,-0.094 -1.402,-0.225 -1.703,-0.778c-0.207,-0.382 -0.181,-0.896 -0.031,-1.565c0.068,-0.3 0.11,-0.593 0.118,-0.842l-0.106,-0.887l-0.212,-0.491l-0.258,-0.36l-0.669,-0.514l-0.832,-0.231l-0.491,0.017l-0.459,0.12l-0.417,0.211l-0.415,0.342l-0.546,0.802l-0.033,0.067c-1.174,2.499 -0.945,4.643 0.013,6.317c0.251,0.437 0.56,0.845 0.919,1.219Zm22.984,-4.722c-0.052,-2.344 -0.566,-4.656 -1.514,-6.805c-1.232,-2.86 -3.339,-5.257 -6.018,-6.845c0.955,-0.816 2.033,-1.473 3.195,-1.949c0.434,-0.187 0.715,-0.618 0.71,-1.09l-0,-0.006c-0.005,-0.333 -0.144,-0.651 -0.386,-0.88c-1.791,-1.76 -2.553,-4.324 -2.013,-6.776c0.587,-2.864 2.878,-5.09 5.758,-5.594c0.453,-0.087 0.913,-0.131 1.375,-0.131c4.005,0 7.3,3.296 7.3,7.301c-0,1.322 -0.359,2.619 -1.038,3.753c-0.276,0.457 -0.6,0.883 -0.968,1.27c-0.052,0.055 -0.121,0.123 -0.194,0.192c-0.24,0.229 -0.375,0.547 -0.372,0.878c-0,0.468 0.28,0.894 0.71,1.079c2.908,1.201 5.229,3.498 6.462,6.392c0.756,1.728 1.184,3.578 1.264,5.458c-0.577,-0.341 -1.293,-0.373 -1.904,-0.07c-0.961,0.475 -1.861,1.117 -2.911,1.371c-0.49,-0.133 -0.983,-0.245 -1.485,-0.308c-0.253,-0.326 -0.536,-0.66 -0.84,-0.911l-0.813,-0.51l-0.752,-0.225c-0.327,-0.051 -0.662,-0.021 -0.974,0.089l-0.67,0.321l-0.569,0.448c-0.403,0.393 -0.733,0.911 -0.979,1.569c-0.202,0.54 -0.344,1.222 -0.492,2.014c-0.244,-0.027 -0.49,-0.047 -0.737,-0.058c-0.333,-0.02 -0.725,-0.006 -1.145,0.023Zm-24.215,-13.651c-2.683,1.591 -4.793,3.994 -6.024,6.861c-1.026,2.332 -1.542,4.857 -1.513,7.405l0,0.59l-11.735,0c-1.397,0 -2.547,-1.15 -2.547,-2.547l0,-1.561c-0.026,-2.165 0.409,-4.31 1.274,-6.295c1.231,-2.897 3.553,-5.197 6.46,-6.401c0.434,-0.187 0.715,-0.618 0.71,-1.09l0,-0.006c-0.005,-0.333 -0.144,-0.651 -0.386,-0.88c-1.791,-1.76 -2.553,-4.324 -2.013,-6.776c0.588,-2.864 2.879,-5.09 5.758,-5.594c0.453,-0.087 0.914,-0.131 1.375,-0.131c4.005,0 7.301,3.296 7.301,7.301c0,1.322 -0.359,2.619 -1.039,3.753c-0.275,0.457 -0.6,0.883 -0.967,1.27c-0.052,0.055 -0.122,0.123 -0.194,0.192c-0.24,0.228 -0.375,0.547 -0.372,0.878c0,0.468 0.28,0.894 0.71,1.079c1.164,0.476 2.246,1.135 3.202,1.952Zm29.027,33.111c-1.417,-0.04 -2.04,-0.037 -2.761,-1.223l-0.563,0.016c-0.654,-0.029 -0.381,-0.016 -0.818,-0.038c-0.73,-0.028 -0.613,-0.722 -0.742,-1.089c-0.205,-1.244 0.272,-2.494 0.257,-3.739c-0.005,-0.442 -0.63,-2.005 -0.854,-2.564c-0.7,0.131 -1.404,0.157 -2.114,0.192c-1.637,-0.004 -3.263,-0.205 -4.878,-0.459c-0.314,1.299 -1.249,3.118 -0.476,4.439c0.938,1.366 1.596,1.745 2.617,1.827c1.02,0.082 1.251,1.234 1.004,1.646c-0.219,0.284 -0.603,0.336 -0.929,0.405l-0.653,0.03c-0.513,-0.017 -0.973,-0.155 -1.43,-0.369c-0.765,-0.427 -1.554,-1.314 -2.141,-1.951c0.137,0.254 0.218,0.751 0.095,0.982c-0.347,0.491 -1.847,0.488 -2.534,0.183c-0.78,-0.347 -2.665,-2.781 -2.957,-4.604c0.776,-1.467 1.905,-2.744 2.477,-4.341c-1.246,-0.795 -1.913,-2.089 -1.827,-3.555l0.032,-0.17c-1.226,0.23 -0.59,0.144 -1.909,0.244c-4.2,-0.013 -7.893,-2.86 -5.813,-7.286c0.135,-0.262 0.263,-0.5 0.493,-0.386c0.184,0.091 0.157,0.457 0.065,0.863c-1.189,5.288 4.621,5.329 8.192,4.35c0.355,-0.097 1.06,-0.751 1.548,-0.968c0.798,-0.354 1.665,-0.498 2.524,-0.602c2.139,-0.244 4.709,0.883 6.015,0.92c1.306,0.037 3.164,-0.313 4.305,-0.239c0.827,0.037 1.64,0.187 2.438,0.4c0.517,-2.519 0.554,-4.374 1.779,-4.804c0.719,0.113 1.273,1.093 1.683,1.617l0.002,-0c0.835,-0.033 1.63,0.178 2.42,0.414c1.431,-0.203 2.631,-1.007 3.895,-1.632c-0.004,0.02 -0.025,0.027 -0.037,0.04c-1.244,1.005 -1.417,2.706 -1.271,4.278c0.054,0.816 -0.176,1.702 -0.461,2.538c-0.534,1.361 -1.564,2.796 -2.759,2.722c-0.452,-0.014 -0.715,-0.27 -1.051,-0.543c-0.065,0.553 -0.321,1.047 -0.568,1.536c-0.57,1.086 -2.06,1.564 -3.44,2.723c-1.379,1.159 0.442,5.297 0.883,6.052c0.442,0.754 1.674,1.03 1.196,1.71c-0.147,0.225 -0.37,0.305 -0.609,0.393l-0.325,0.042Zm-15.735,-3.096l0.206,0.06c0.258,-0.115 0.778,0.064 1.054,0.151c-0.508,-0.563 -1.273,-1.389 -1.824,-1.91c-0.181,-0.631 -0.103,-1.266 -0.065,-1.91l0.008,-0.053c-0.217,0.515 -0.493,1.016 -0.641,1.559c-0.173,0.732 0.771,1.522 1.137,1.975l0.125,0.128Z"/>
|
||||
</svg>
|
||||
9
community/tools/icons/team.tid
Normal file
9
community/tools/icons/team.tid
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
title: $:/tiddlywiki/community/icons/team
|
||||
tags: $:/tags/Image
|
||||
|
||||
\parameters (size:"22pt")
|
||||
<svg width=<<size>> height=<<size>> viewBox="0 0 64 64">
|
||||
<path d="M37.439,32.592c-0.43,-0.185 -0.71,-0.611 -0.71,-1.079c-0.003,-0.331 0.132,-0.65 0.372,-0.878c0.072,-0.069 0.142,-0.137 0.194,-0.192c0.368,-0.387 0.692,-0.813 0.967,-1.271c0.68,-1.133 1.039,-2.431 1.039,-3.752c-0,-4.006 -3.296,-7.301 -7.301,-7.301c-0.462,-0 -0.922,0.043 -1.375,0.13c-2.879,0.504 -5.17,2.73 -5.758,5.594c-0.54,2.452 0.222,5.017 2.013,6.777c0.242,0.229 0.381,0.546 0.387,0.879l-0,0.006c0.004,0.472 -0.277,0.903 -0.71,1.09c-2.908,1.205 -5.229,3.505 -6.46,6.402c-0.866,1.984 -1.3,4.13 -1.274,6.295l-0,1.56c-0,1.397 1.149,2.547 2.547,2.547c-0,-0 0,-0 0,-0l21.261,-0c1.397,-0 2.547,-1.15 2.547,-2.547l-0,-1.576c0.026,-2.164 -0.409,-4.309 -1.276,-6.292c-1.233,-2.894 -3.555,-5.191 -6.463,-6.392Z" style="fill-rule:nonzero;"/>
|
||||
<path d="M60.882,35.466c-1.233,-2.894 -3.554,-5.191 -6.462,-6.392c-0.43,-0.185 -0.71,-0.611 -0.71,-1.079c-0.003,-0.331 0.132,-0.649 0.372,-0.878c0.073,-0.069 0.142,-0.137 0.194,-0.192c0.368,-0.387 0.692,-0.813 0.968,-1.27c0.679,-1.134 1.038,-2.431 1.038,-3.753c0,-4.005 -3.295,-7.301 -7.3,-7.301c-0.462,0 -0.922,0.044 -1.375,0.131c-2.88,0.504 -5.171,2.73 -5.758,5.594c-0.54,2.452 0.222,5.016 2.013,6.776c0.242,0.229 0.381,0.547 0.386,0.88l-0,0.006c0.005,0.472 -0.276,0.903 -0.71,1.09c-1.162,0.476 -2.24,1.133 -3.195,1.949c2.679,1.588 4.786,3.985 6.018,6.845c1.029,2.332 1.546,4.857 1.517,7.405l-0,0.605l11.734,-0c1.397,-0 2.547,-1.15 2.547,-2.547l-0,-1.576c0.026,-2.165 -0.409,-4.31 -1.277,-6.293Z" style="fill-rule:nonzero;"/>
|
||||
<path d="M23.66,31.026c-0.956,-0.817 -2.038,-1.476 -3.202,-1.952c-0.43,-0.185 -0.71,-0.611 -0.71,-1.079c-0.003,-0.331 0.132,-0.65 0.372,-0.878c0.072,-0.069 0.142,-0.137 0.194,-0.192c0.367,-0.387 0.692,-0.813 0.967,-1.27c0.68,-1.134 1.039,-2.431 1.039,-3.753c-0,-4.005 -3.296,-7.301 -7.301,-7.301c-0.461,0 -0.922,0.044 -1.375,0.131c-2.879,0.504 -5.17,2.73 -5.758,5.594c-0.54,2.452 0.222,5.016 2.013,6.776c0.242,0.229 0.381,0.547 0.386,0.88l0,0.006c0.005,0.472 -0.276,0.903 -0.71,1.09c-2.907,1.204 -5.229,3.504 -6.46,6.401c-0.865,1.985 -1.3,4.13 -1.274,6.295c0,0 0,1.561 0,1.561c0,1.397 1.15,2.547 2.547,2.547c-0,-0 11.735,-0 11.735,-0l0,-0.59c-0.029,-2.548 0.487,-5.073 1.513,-7.405c1.231,-2.867 3.341,-5.27 6.024,-6.861Z" style="fill-rule:nonzero;"/>
|
||||
</svg>
|
||||
File diff suppressed because one or more lines are too long
|
|
@ -6,10 +6,7 @@ module-type: global
|
|||
The $tw.Commander class is a command interpreter
|
||||
|
||||
\*/
|
||||
(function(){
|
||||
|
||||
/*jslint node: true, browser: true */
|
||||
/*global $tw: false */
|
||||
"use strict";
|
||||
|
||||
/*
|
||||
|
|
@ -102,16 +99,18 @@ Commander.prototype.executeNextCommand = function() {
|
|||
}
|
||||
}
|
||||
if(command.info.synchronous) {
|
||||
// Synchronous command
|
||||
// Synchronous command (await thenables)
|
||||
c = new command.Command(params,this);
|
||||
err = c.execute();
|
||||
if(err) {
|
||||
if(err && typeof err.then === "function") {
|
||||
err.then(e => { e ? this.callback(e) : this.executeNextCommand(); });
|
||||
} else if(err) {
|
||||
this.callback(err);
|
||||
} else {
|
||||
this.executeNextCommand();
|
||||
}
|
||||
} else {
|
||||
// Asynchronous command
|
||||
// Asynchronous command (await thenables)
|
||||
c = new command.Command(params,this,function(err) {
|
||||
if(err) {
|
||||
self.callback(err);
|
||||
|
|
@ -120,7 +119,9 @@ Commander.prototype.executeNextCommand = function() {
|
|||
}
|
||||
});
|
||||
err = c.execute();
|
||||
if(err) {
|
||||
if(err && typeof err.then === "function") {
|
||||
err.then(e => { if(e) this.callback(e); });
|
||||
} else if(err) {
|
||||
this.callback(err);
|
||||
}
|
||||
}
|
||||
|
|
@ -154,7 +155,7 @@ Commander.prototype.extractNamedParameters = function(params,mandatoryParameters
|
|||
if(errors.length > 0) {
|
||||
return errors.join(" and\n");
|
||||
} else {
|
||||
return paramsByName;
|
||||
return paramsByName;
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -173,5 +174,3 @@ Commander.initCommands = function(moduleType) {
|
|||
};
|
||||
|
||||
exports.Commander = Commander;
|
||||
|
||||
})();
|
||||
|
|
@ -6,10 +6,7 @@ module-type: command
|
|||
Command to build a build target
|
||||
|
||||
\*/
|
||||
(function(){
|
||||
|
||||
/*jslint node: true, browser: true */
|
||||
/*global $tw: false */
|
||||
"use strict";
|
||||
|
||||
exports.info = {
|
||||
|
|
@ -24,7 +21,7 @@ var Command = function(params,commander) {
|
|||
|
||||
Command.prototype.execute = function() {
|
||||
// Get the build targets defined in the wiki
|
||||
var buildTargets = $tw.boot.wikiInfo.build;
|
||||
var buildTargets = $tw.boot.wikiInfo && $tw.boot.wikiInfo.build;
|
||||
if(!buildTargets) {
|
||||
return "No build targets defined";
|
||||
}
|
||||
|
|
@ -48,5 +45,3 @@ Command.prototype.execute = function() {
|
|||
};
|
||||
|
||||
exports.Command = Command;
|
||||
|
||||
})();
|
||||
|
|
@ -6,10 +6,7 @@ module-type: command
|
|||
Clear password for crypto operations
|
||||
|
||||
\*/
|
||||
(function(){
|
||||
|
||||
/*jslint node: true, browser: true */
|
||||
/*global $tw: false */
|
||||
"use strict";
|
||||
|
||||
exports.info = {
|
||||
|
|
@ -29,5 +26,3 @@ Command.prototype.execute = function() {
|
|||
};
|
||||
|
||||
exports.Command = Command;
|
||||
|
||||
})();
|
||||
36
core-server/commands/commands.js
Normal file
36
core-server/commands/commands.js
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
/*\
|
||||
title: $:/core/modules/commands/commands.js
|
||||
type: application/javascript
|
||||
module-type: command
|
||||
|
||||
Runs the commands returned from a filter
|
||||
|
||||
\*/
|
||||
|
||||
"use strict";
|
||||
|
||||
exports.info = {
|
||||
name: "commands",
|
||||
synchronous: true
|
||||
};
|
||||
|
||||
var Command = function(params, commander) {
|
||||
this.params = params;
|
||||
this.commander = commander;
|
||||
};
|
||||
|
||||
Command.prototype.execute = function() {
|
||||
// Parse the filter
|
||||
var filter = this.params[0];
|
||||
if(!filter) {
|
||||
return "No filter specified";
|
||||
}
|
||||
var commands = this.commander.wiki.filterTiddlers(filter)
|
||||
if(commands.length === 0) {
|
||||
return "No tiddlers found for filter '" + filter + "'";
|
||||
}
|
||||
this.commander.addCommandTokens(commands);
|
||||
return null;
|
||||
};
|
||||
|
||||
exports.Command = Command;
|
||||
|
|
@ -6,10 +6,7 @@ module-type: command
|
|||
Command to delete tiddlers
|
||||
|
||||
\*/
|
||||
(function(){
|
||||
|
||||
/*jslint node: true, browser: true */
|
||||
/*global $tw: false */
|
||||
"use strict";
|
||||
|
||||
exports.info = {
|
||||
|
|
@ -38,5 +35,3 @@ Command.prototype.execute = function() {
|
|||
};
|
||||
|
||||
exports.Command = Command;
|
||||
|
||||
})();
|
||||
|
|
@ -6,10 +6,7 @@ module-type: command
|
|||
Command to list the available editions
|
||||
|
||||
\*/
|
||||
(function(){
|
||||
|
||||
/*jslint node: true, browser: true */
|
||||
/*global $tw: false */
|
||||
"use strict";
|
||||
|
||||
exports.info = {
|
||||
|
|
@ -35,5 +32,3 @@ Command.prototype.execute = function() {
|
|||
};
|
||||
|
||||
exports.Command = Command;
|
||||
|
||||
})();
|
||||
|
|
@ -6,10 +6,7 @@ module-type: command
|
|||
Commands to fetch external tiddlers
|
||||
|
||||
\*/
|
||||
(function(){
|
||||
|
||||
/*jslint node: true, browser: true */
|
||||
/*global $tw: false */
|
||||
"use strict";
|
||||
|
||||
exports.info = {
|
||||
|
|
@ -115,7 +112,7 @@ Command.prototype.fetchFile = function(url,options,callback,redirectCount) {
|
|||
if(response.statusCode === 302 || response.statusCode === 303 || response.statusCode === 307) {
|
||||
return self.fetchFile(response.headers.location,options,callback,redirectCount + 1);
|
||||
} else {
|
||||
return callback("Error " + response.statusCode + " retrieving " + url)
|
||||
return callback("Error " + response.statusCode + " retrieving " + url)
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
@ -171,5 +168,3 @@ Command.prototype.processBody = function(body,type,options,url) {
|
|||
};
|
||||
|
||||
exports.Command = Command;
|
||||
|
||||
})();
|
||||
|
|
@ -6,10 +6,7 @@ module-type: command
|
|||
Help command
|
||||
|
||||
\*/
|
||||
(function(){
|
||||
|
||||
/*jshint node: true, browser: true */
|
||||
/*global $tw: false */
|
||||
"use strict";
|
||||
|
||||
exports.info = {
|
||||
|
|
@ -37,5 +34,3 @@ Command.prototype.execute = function() {
|
|||
};
|
||||
|
||||
exports.Command = Command;
|
||||
|
||||
})();
|
||||
|
|
@ -6,10 +6,7 @@ module-type: command
|
|||
Command to import tiddlers from a file
|
||||
|
||||
\*/
|
||||
(function(){
|
||||
|
||||
/*jslint node: true, browser: true */
|
||||
/*global $tw: false */
|
||||
"use strict";
|
||||
|
||||
exports.info = {
|
||||
|
|
@ -44,5 +41,3 @@ Command.prototype.execute = function() {
|
|||
};
|
||||
|
||||
exports.Command = Command;
|
||||
|
||||
})();
|
||||
|
|
@ -6,10 +6,7 @@ module-type: command
|
|||
Command to initialise an empty wiki folder
|
||||
|
||||
\*/
|
||||
(function(){
|
||||
|
||||
/*jslint node: true, browser: true */
|
||||
/*global $tw: false */
|
||||
"use strict";
|
||||
|
||||
exports.info = {
|
||||
|
|
@ -48,12 +45,10 @@ Command.prototype.execute = function() {
|
|||
}
|
||||
// Tweak the tiddlywiki.info to remove any included wikis
|
||||
var packagePath = $tw.boot.wikiPath + "/tiddlywiki.info",
|
||||
packageJson = JSON.parse(fs.readFileSync(packagePath));
|
||||
packageJson = $tw.utils.parseJSONSafe(fs.readFileSync(packagePath));
|
||||
delete packageJson.includeWikis;
|
||||
fs.writeFileSync(packagePath,JSON.stringify(packageJson,null,$tw.config.preferences.jsonSpaces));
|
||||
return null;
|
||||
};
|
||||
|
||||
exports.Command = Command;
|
||||
|
||||
})();
|
||||
|
|
@ -6,10 +6,7 @@ module-type: command
|
|||
Listen for HTTP requests and serve tiddlers
|
||||
|
||||
\*/
|
||||
(function(){
|
||||
|
||||
/*jslint node: true, browser: true */
|
||||
/*global $tw: false */
|
||||
"use strict";
|
||||
|
||||
var Server = require("$:/core/modules/server/server.js").Server;
|
||||
|
|
@ -18,7 +15,7 @@ exports.info = {
|
|||
name: "listen",
|
||||
synchronous: true,
|
||||
namedParameterMode: true,
|
||||
mandatoryParameters: [],
|
||||
mandatoryParameters: []
|
||||
};
|
||||
|
||||
var Command = function(params,commander,callback) {
|
||||
|
|
@ -44,5 +41,3 @@ Command.prototype.execute = function() {
|
|||
};
|
||||
|
||||
exports.Command = Command;
|
||||
|
||||
})();
|
||||
|
|
@ -6,10 +6,7 @@ module-type: command
|
|||
Command to load tiddlers from a file or directory
|
||||
|
||||
\*/
|
||||
(function(){
|
||||
|
||||
/*jslint node: true, browser: true */
|
||||
/*global $tw: false */
|
||||
"use strict";
|
||||
|
||||
exports.info = {
|
||||
|
|
@ -47,5 +44,3 @@ Command.prototype.execute = function() {
|
|||
};
|
||||
|
||||
exports.Command = Command;
|
||||
|
||||
})();
|
||||
40
core-server/commands/makelibrary.js
Normal file
40
core-server/commands/makelibrary.js
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
/*\
|
||||
title: $:/core/modules/commands/makelibrary.js
|
||||
type: application/javascript
|
||||
module-type: command
|
||||
|
||||
Command to pack all of the plugins in the library into a plugin tiddler of type "library"
|
||||
|
||||
\*/
|
||||
|
||||
"use strict";
|
||||
|
||||
exports.info = {
|
||||
name: "makelibrary",
|
||||
synchronous: true
|
||||
};
|
||||
|
||||
var UPGRADE_LIBRARY_TITLE = "$:/UpgradeLibrary";
|
||||
|
||||
var Command = function(params,commander,callback) {
|
||||
this.params = params;
|
||||
this.commander = commander;
|
||||
this.callback = callback;
|
||||
};
|
||||
|
||||
Command.prototype.execute = function() {
|
||||
var wiki = this.commander.wiki,
|
||||
upgradeLibraryTitle = this.params[0] || UPGRADE_LIBRARY_TITLE,
|
||||
tiddlers = $tw.utils.getAllPlugins();
|
||||
// Save the upgrade library tiddler
|
||||
var pluginFields = {
|
||||
title: upgradeLibraryTitle,
|
||||
type: "application/json",
|
||||
"plugin-type": "library",
|
||||
"text": JSON.stringify({tiddlers: tiddlers})
|
||||
};
|
||||
wiki.addTiddler(new $tw.Tiddler(pluginFields));
|
||||
return null;
|
||||
};
|
||||
|
||||
exports.Command = Command;
|
||||
|
|
@ -6,10 +6,7 @@ module-type: command
|
|||
Command to set the default output location (defaults to current working directory)
|
||||
|
||||
\*/
|
||||
(function(){
|
||||
|
||||
/*jslint node: true, browser: true */
|
||||
/*global $tw: false */
|
||||
"use strict";
|
||||
|
||||
exports.info = {
|
||||
|
|
@ -34,5 +31,3 @@ Command.prototype.execute = function() {
|
|||
};
|
||||
|
||||
exports.Command = Command;
|
||||
|
||||
})();
|
||||
|
|
@ -6,10 +6,7 @@ module-type: command
|
|||
Save password for crypto operations
|
||||
|
||||
\*/
|
||||
(function(){
|
||||
|
||||
/*jslint node: true, browser: true */
|
||||
/*global $tw: false */
|
||||
"use strict";
|
||||
|
||||
exports.info = {
|
||||
|
|
@ -32,5 +29,3 @@ Command.prototype.execute = function() {
|
|||
};
|
||||
|
||||
exports.Command = Command;
|
||||
|
||||
})();
|
||||
65
core-server/commands/render.js
Normal file
65
core-server/commands/render.js
Normal file
|
|
@ -0,0 +1,65 @@
|
|||
/*\
|
||||
title: $:/core/modules/commands/render.js
|
||||
type: application/javascript
|
||||
module-type: command
|
||||
|
||||
Render individual tiddlers and save the results to the specified files
|
||||
|
||||
\*/
|
||||
|
||||
"use strict";
|
||||
|
||||
var widget = require("$:/core/modules/widgets/widget.js");
|
||||
|
||||
exports.info = {
|
||||
name: "render",
|
||||
synchronous: true
|
||||
};
|
||||
|
||||
var Command = function(params,commander,callback) {
|
||||
this.params = params;
|
||||
this.commander = commander;
|
||||
this.callback = callback;
|
||||
};
|
||||
|
||||
Command.prototype.execute = function() {
|
||||
if(this.params.length < 1) {
|
||||
return "Missing tiddler filter";
|
||||
}
|
||||
var self = this,
|
||||
fs = require("fs"),
|
||||
path = require("path"),
|
||||
wiki = this.commander.wiki,
|
||||
tiddlerFilter = this.params[0],
|
||||
filenameFilter = this.params[1] || "[is[tiddler]addsuffix[.html]]",
|
||||
type = this.params[2] || "text/html",
|
||||
template = this.params[3],
|
||||
variableList = this.params.slice(4),
|
||||
tiddlers = wiki.filterTiddlers(tiddlerFilter),
|
||||
variables = Object.create(null);
|
||||
while(variableList.length >= 2) {
|
||||
variables[variableList[0]] = variableList[1];
|
||||
variableList = variableList.slice(2);
|
||||
}
|
||||
$tw.utils.each(tiddlers,function(title) {
|
||||
var filenameResults = wiki.filterTiddlers(filenameFilter,$tw.rootWidget,wiki.makeTiddlerIterator([title]));
|
||||
if(filenameResults.length > 0) {
|
||||
var filepath = path.resolve(self.commander.outputPath,filenameResults[0]);
|
||||
if(self.commander.verbose) {
|
||||
console.log("Rendering \"" + title + "\" to \"" + filepath + "\"");
|
||||
}
|
||||
var parser = wiki.parseTiddler(template || title),
|
||||
widgetNode = wiki.makeWidget(parser,{variables: $tw.utils.extend({},variables,{currentTiddler: title,storyTiddler: title})}),
|
||||
container = $tw.fakeDocument.createElement("div");
|
||||
widgetNode.render(container,null);
|
||||
var text = type === "text/html" ? container.innerHTML : container.textContent;
|
||||
$tw.utils.createFileDirectories(filepath);
|
||||
fs.writeFileSync(filepath,text,"utf8");
|
||||
} else {
|
||||
console.log("Not rendering \"" + title + "\" because the filename filter returned an empty result");
|
||||
}
|
||||
});
|
||||
return null;
|
||||
};
|
||||
|
||||
exports.Command = Command;
|
||||
|
|
@ -6,10 +6,7 @@ module-type: command
|
|||
Command to render a tiddler and save it to a file
|
||||
|
||||
\*/
|
||||
(function(){
|
||||
|
||||
/*jslint node: true, browser: true */
|
||||
/*global $tw: false */
|
||||
"use strict";
|
||||
|
||||
exports.info = {
|
||||
|
|
@ -40,6 +37,7 @@ Command.prototype.execute = function() {
|
|||
$tw.utils.createFileDirectories(filename);
|
||||
if(template) {
|
||||
variables.currentTiddler = title;
|
||||
variables.storyTiddler = title;
|
||||
title = template;
|
||||
}
|
||||
if(name && value) {
|
||||
|
|
@ -52,5 +50,3 @@ Command.prototype.execute = function() {
|
|||
};
|
||||
|
||||
exports.Command = Command;
|
||||
|
||||
})();
|
||||
|
|
@ -6,10 +6,7 @@ module-type: command
|
|||
Command to render several tiddlers to a folder of files
|
||||
|
||||
\*/
|
||||
(function(){
|
||||
|
||||
/*jslint node: true, browser: true */
|
||||
/*global $tw: false */
|
||||
"use strict";
|
||||
|
||||
var widget = require("$:/core/modules/widgets/widget.js");
|
||||
|
|
@ -36,7 +33,7 @@ Command.prototype.execute = function() {
|
|||
filter = this.params[0],
|
||||
template = this.params[1],
|
||||
outputPath = this.commander.outputPath,
|
||||
pathname = path.resolve(outputPath,this.params[2]),
|
||||
pathname = path.resolve(outputPath,this.params[2]),
|
||||
type = this.params[3] || "text/html",
|
||||
extension = this.params[4] || ".html",
|
||||
deleteDirectory = (this.params[5] || "").toLowerCase() !== "noclean",
|
||||
|
|
@ -46,7 +43,7 @@ Command.prototype.execute = function() {
|
|||
}
|
||||
$tw.utils.each(tiddlers,function(title) {
|
||||
var parser = wiki.parseTiddler(template),
|
||||
widgetNode = wiki.makeWidget(parser,{variables: {currentTiddler: title}}),
|
||||
widgetNode = wiki.makeWidget(parser,{variables: {currentTiddler: title, storyTiddler: title}}),
|
||||
container = $tw.fakeDocument.createElement("div");
|
||||
widgetNode.render(container,null);
|
||||
var text = type === "text/html" ? container.innerHTML : container.textContent,
|
||||
|
|
@ -57,7 +54,7 @@ Command.prototype.execute = function() {
|
|||
exportPath = path.resolve(outputPath,macroPath + extension);
|
||||
}
|
||||
}
|
||||
var finalPath = exportPath || path.resolve(pathname,encodeURIComponent(title) + extension);
|
||||
var finalPath = exportPath || path.resolve(pathname,$tw.utils.encodeURIComponentExtended(title) + extension);
|
||||
$tw.utils.createFileDirectories(finalPath);
|
||||
fs.writeFileSync(finalPath,text,"utf8");
|
||||
});
|
||||
|
|
@ -65,5 +62,3 @@ Command.prototype.execute = function() {
|
|||
};
|
||||
|
||||
exports.Command = Command;
|
||||
|
||||
})();
|
||||
63
core-server/commands/save.js
Normal file
63
core-server/commands/save.js
Normal file
|
|
@ -0,0 +1,63 @@
|
|||
/*\
|
||||
title: $:/core/modules/commands/save.js
|
||||
type: application/javascript
|
||||
module-type: command
|
||||
|
||||
Saves individual tiddlers in their raw text or binary format to the specified files
|
||||
|
||||
\*/
|
||||
|
||||
"use strict";
|
||||
|
||||
exports.info = {
|
||||
name: "save",
|
||||
synchronous: true
|
||||
};
|
||||
|
||||
var Command = function(params,commander,callback) {
|
||||
this.params = params;
|
||||
this.commander = commander;
|
||||
this.callback = callback;
|
||||
};
|
||||
|
||||
Command.prototype.execute = function() {
|
||||
if(this.params.length < 1) {
|
||||
return "Missing filename filter";
|
||||
}
|
||||
var self = this,
|
||||
fs = require("fs"),
|
||||
path = require("path"),
|
||||
result = null,
|
||||
wiki = this.commander.wiki,
|
||||
tiddlerFilter = this.params[0],
|
||||
filenameFilter = this.params[1] || "[is[tiddler]]",
|
||||
tiddlers = wiki.filterTiddlers(tiddlerFilter);
|
||||
$tw.utils.each(tiddlers,function(title) {
|
||||
if(!result) {
|
||||
var tiddler = self.commander.wiki.getTiddler(title);
|
||||
if(tiddler) {
|
||||
var fileInfo = $tw.utils.generateTiddlerFileInfo(tiddler,{
|
||||
directory: path.resolve(self.commander.outputPath),
|
||||
pathFilters: [filenameFilter],
|
||||
wiki: wiki,
|
||||
fileInfo: {
|
||||
overwrite: true
|
||||
}
|
||||
});
|
||||
if(self.commander.verbose) {
|
||||
console.log("Saving \"" + title + "\" to \"" + fileInfo.filepath + "\"");
|
||||
}
|
||||
try {
|
||||
$tw.utils.saveTiddlerToFileSync(tiddler,fileInfo);
|
||||
} catch (err) {
|
||||
result = "Error saving tiddler \"" + title + "\", to file: \"" + fileInfo.filepath + "\"";
|
||||
}
|
||||
} else {
|
||||
result = "Tiddler '" + title + "' not found";
|
||||
}
|
||||
}
|
||||
});
|
||||
return result;
|
||||
};
|
||||
|
||||
exports.Command = Command;
|
||||
|
|
@ -16,10 +16,7 @@ The pathname specifies the pathname to the folder in which the JSON files should
|
|||
The skinnylisting specifies the title of the tiddler to which a JSON catalogue of the subtiddlers will be saved. The JSON file contains the same data as the bundle tiddler but with the `text` field removed.
|
||||
|
||||
\*/
|
||||
(function(){
|
||||
|
||||
/*jslint node: true, browser: true */
|
||||
/*global $tw: false */
|
||||
"use strict";
|
||||
|
||||
exports.info = {
|
||||
|
|
@ -65,11 +62,11 @@ Command.prototype.execute = function() {
|
|||
$tw.utils.each(filteredPluginList,function(title) {
|
||||
var tiddler = containerData.tiddlers[title];
|
||||
// Save each JSON file and collect the skinny data
|
||||
var pathname = path.resolve(self.commander.outputPath,basepath + encodeURIComponent(title) + ".json");
|
||||
var pathname = path.resolve(self.commander.outputPath,basepath + $tw.utils.encodeURIComponentExtended(title) + ".json");
|
||||
$tw.utils.createFileDirectories(pathname);
|
||||
fs.writeFileSync(pathname,JSON.stringify(tiddler),"utf8");
|
||||
// Collect the skinny list data
|
||||
var pluginTiddlers = JSON.parse(tiddler.text),
|
||||
var pluginTiddlers = $tw.utils.parseJSONSafe(tiddler.text),
|
||||
readmeContent = (pluginTiddlers.tiddlers[title + "/readme"] || {}).text,
|
||||
doesRequireReload = !!self.commander.wiki.doesPluginInfoRequireReload(pluginTiddlers),
|
||||
iconTiddler = pluginTiddlers.tiddlers[title + "/icon"] || {},
|
||||
|
|
@ -94,5 +91,3 @@ Command.prototype.execute = function() {
|
|||
};
|
||||
|
||||
exports.Command = Command;
|
||||
|
||||
})();
|
||||
|
|
@ -6,10 +6,7 @@ module-type: command
|
|||
Command to save the content of a tiddler to a file
|
||||
|
||||
\*/
|
||||
(function(){
|
||||
|
||||
/*jslint node: true, browser: true */
|
||||
/*global $tw: false */
|
||||
"use strict";
|
||||
|
||||
exports.info = {
|
||||
|
|
@ -47,5 +44,3 @@ Command.prototype.execute = function() {
|
|||
};
|
||||
|
||||
exports.Command = Command;
|
||||
|
||||
})();
|
||||
|
|
@ -6,10 +6,7 @@ module-type: command
|
|||
Command to save several tiddlers to a folder of files
|
||||
|
||||
\*/
|
||||
(function(){
|
||||
|
||||
/*jslint node: true, browser: true */
|
||||
/*global $tw: false */
|
||||
"use strict";
|
||||
|
||||
var widget = require("$:/core/modules/widgets/widget.js");
|
||||
|
|
@ -45,12 +42,10 @@ Command.prototype.execute = function() {
|
|||
var tiddler = self.commander.wiki.getTiddler(title),
|
||||
type = tiddler.fields.type || "text/vnd.tiddlywiki",
|
||||
contentTypeInfo = $tw.config.contentTypeInfo[type] || {encoding: "utf8"},
|
||||
filename = path.resolve(pathname,encodeURIComponent(title));
|
||||
fs.writeFileSync(filename,tiddler.fields.text,contentTypeInfo.encoding);
|
||||
filename = path.resolve(pathname,$tw.utils.encodeURIComponentExtended(title));
|
||||
fs.writeFileSync(filename,tiddler.fields.text || "",contentTypeInfo.encoding);
|
||||
});
|
||||
return null;
|
||||
};
|
||||
|
||||
exports.Command = Command;
|
||||
|
||||
})();
|
||||
|
|
@ -5,13 +5,17 @@ module-type: command
|
|||
|
||||
Command to save the current wiki as a wiki folder
|
||||
|
||||
--savewikifolder <wikifolderpath> [<filter>]
|
||||
--savewikifolder <wikifolderpath> [ [<name>=<value>] ]*
|
||||
|
||||
The following options are supported:
|
||||
|
||||
* ''filter'': a filter expression defining the tiddlers to be included in the output
|
||||
* ''explodePlugins'': set to "no" to suppress exploding plugins into their constituent shadow tiddlers (defaults to "yes")
|
||||
|
||||
Supports backward compatibility with --savewikifolder <wikifolderpath> [<filter>] [ [<name>=<value>] ]*
|
||||
|
||||
\*/
|
||||
(function(){
|
||||
|
||||
/*jslint node: true, browser: true */
|
||||
/*global $tw: false */
|
||||
"use strict";
|
||||
|
||||
exports.info = {
|
||||
|
|
@ -35,14 +39,28 @@ Command.prototype.execute = function() {
|
|||
if(this.params.length < 1) {
|
||||
return "Missing wiki folder path";
|
||||
}
|
||||
var wikifoldermaker = new WikiFolderMaker(this.params[0],this.params[1],this.commander);
|
||||
var regFilter = /^[a-zA-Z0-9\.\-_]+=/g, // dynamic parameters
|
||||
namedParames,
|
||||
tiddlerFilter,
|
||||
options = {};
|
||||
if (regFilter.test(this.params[1])) {
|
||||
namedParames = this.commander.extractNamedParameters(this.params.slice(1));
|
||||
tiddlerFilter = namedParames.filter || "[all[tiddlers]]";
|
||||
} else {
|
||||
namedParames = this.commander.extractNamedParameters(this.params.slice(2));
|
||||
tiddlerFilter = this.params[1];
|
||||
}
|
||||
tiddlerFilter = tiddlerFilter || "[all[tiddlers]]";
|
||||
options.explodePlugins = namedParames.explodePlugins || "yes";
|
||||
var wikifoldermaker = new WikiFolderMaker(this.params[0],tiddlerFilter,this.commander,options);
|
||||
return wikifoldermaker.save();
|
||||
};
|
||||
|
||||
function WikiFolderMaker(wikiFolderPath,wikiFilter,commander) {
|
||||
function WikiFolderMaker(wikiFolderPath,wikiFilter,commander,options) {
|
||||
this.wikiFolderPath = wikiFolderPath;
|
||||
this.wikiFilter = wikiFilter || "[all[tiddlers]]";
|
||||
this.wikiFilter = wikiFilter;
|
||||
this.commander = commander;
|
||||
this.explodePlugins = options.explodePlugins;
|
||||
this.wiki = commander.wiki;
|
||||
this.savedPaths = []; // So that we can detect filename clashes
|
||||
}
|
||||
|
|
@ -58,6 +76,7 @@ WikiFolderMaker.prototype.tiddlersToIgnore = [
|
|||
"$:/boot/boot.js",
|
||||
"$:/boot/bootprefix.js",
|
||||
"$:/core",
|
||||
"$:/core-server",
|
||||
"$:/library/sjcl.js",
|
||||
"$:/temp/info-plugin"
|
||||
];
|
||||
|
|
@ -93,11 +112,14 @@ WikiFolderMaker.prototype.save = function() {
|
|||
self.log("Adding built-in plugin: " + libraryDetails.name);
|
||||
newWikiInfo[libraryDetails.type] = newWikiInfo[libraryDetails.type] || [];
|
||||
$tw.utils.pushTop(newWikiInfo[libraryDetails.type],libraryDetails.name);
|
||||
} else {
|
||||
} else if(self.explodePlugins !== "no") {
|
||||
// A custom plugin
|
||||
self.log("Processing custom plugin: " + title);
|
||||
self.saveCustomPlugin(tiddler);
|
||||
}
|
||||
} else if(self.explodePlugins === "no") {
|
||||
self.log("Processing custom plugin to tiddlders folder: " + title);
|
||||
self.saveTiddler("tiddlers", tiddler);
|
||||
}
|
||||
} else {
|
||||
// Ordinary tiddler
|
||||
self.saveTiddler("tiddlers",tiddler);
|
||||
|
|
@ -151,8 +173,11 @@ WikiFolderMaker.prototype.saveCustomPlugin = function(pluginTiddler) {
|
|||
pluginInfo = pluginTiddler.getFieldStrings({exclude: ["text","type"]});
|
||||
this.saveJSONFile(directory + path.sep + "plugin.info",pluginInfo);
|
||||
self.log("Writing " + directory + path.sep + "plugin.info: " + JSON.stringify(pluginInfo,null,$tw.config.preferences.jsonSpaces));
|
||||
var pluginTiddlers = JSON.parse(pluginTiddler.fields.text).tiddlers; // A hashmap of tiddlers in the plugin
|
||||
$tw.utils.each(pluginTiddlers,function(tiddler) {
|
||||
var pluginTiddlers = $tw.utils.parseJSONSafe(pluginTiddler.fields.text).tiddlers; // A hashmap of tiddlers in the plugin
|
||||
$tw.utils.each(pluginTiddlers,function(tiddler,title) {
|
||||
if(!tiddler.title) {
|
||||
tiddler.title = title;
|
||||
}
|
||||
self.saveTiddler(directory,new $tw.Tiddler(tiddler));
|
||||
});
|
||||
};
|
||||
|
|
@ -167,10 +192,10 @@ WikiFolderMaker.prototype.saveTiddler = function(directory,tiddler) {
|
|||
}
|
||||
var fileInfo = $tw.utils.generateTiddlerFileInfo(tiddler,{
|
||||
directory: path.resolve(this.wikiFolderPath,directory),
|
||||
wiki: this.wiki,
|
||||
pathFilters: pathFilters,
|
||||
extFilters: extFilters,
|
||||
originalpath: this.wiki.extractTiddlerDataItem("$:/config/OriginalTiddlerPaths",title, "")
|
||||
wiki: this.wiki,
|
||||
fileInfo: {}
|
||||
});
|
||||
try {
|
||||
$tw.utils.saveTiddlerToFileSync(tiddler,fileInfo);
|
||||
|
|
@ -194,5 +219,3 @@ WikiFolderMaker.prototype.saveFile = function(filename,encoding,data) {
|
|||
};
|
||||
|
||||
exports.Command = Command;
|
||||
|
||||
})();
|
||||
50
core-server/commands/server.js
Normal file
50
core-server/commands/server.js
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
/*\
|
||||
title: $:/core/modules/commands/server.js
|
||||
type: application/javascript
|
||||
module-type: command
|
||||
|
||||
Deprecated legacy command for serving tiddlers
|
||||
|
||||
\*/
|
||||
|
||||
"use strict";
|
||||
|
||||
var Server = require("$:/core/modules/server/server.js").Server;
|
||||
|
||||
exports.info = {
|
||||
name: "server",
|
||||
synchronous: true
|
||||
};
|
||||
|
||||
var Command = function(params,commander,callback) {
|
||||
var self = this;
|
||||
this.params = params;
|
||||
this.commander = commander;
|
||||
this.callback = callback;
|
||||
};
|
||||
|
||||
Command.prototype.execute = function() {
|
||||
if(!$tw.boot.wikiTiddlersPath) {
|
||||
$tw.utils.warning("Warning: Wiki folder '" + $tw.boot.wikiPath + "' does not exist or is missing a tiddlywiki.info file");
|
||||
}
|
||||
// Set up server
|
||||
this.server = new Server({
|
||||
wiki: this.commander.wiki,
|
||||
variables: {
|
||||
port: this.params[0],
|
||||
host: this.params[6],
|
||||
"root-tiddler": this.params[1],
|
||||
"root-render-type": this.params[2],
|
||||
"root-serve-type": this.params[3],
|
||||
username: this.params[4],
|
||||
password: this.params[5],
|
||||
"path-prefix": this.params[7],
|
||||
"debug-level": this.params[8]
|
||||
}
|
||||
});
|
||||
var nodeServer = this.server.listen();
|
||||
$tw.hooks.invokeHook("th-server-command-post-start",this.server,nodeServer,"tiddlywiki");
|
||||
return null;
|
||||
};
|
||||
|
||||
exports.Command = Command;
|
||||
|
|
@ -6,10 +6,7 @@ module-type: command
|
|||
Command to modify selected tiddlers to set a field to the text of a template tiddler that has been wikified with the selected tiddler as the current tiddler.
|
||||
|
||||
\*/
|
||||
(function(){
|
||||
|
||||
/*jslint node: true, browser: true */
|
||||
/*global $tw: false */
|
||||
"use strict";
|
||||
|
||||
var widget = require("$:/core/modules/widgets/widget.js");
|
||||
|
|
@ -54,5 +51,3 @@ Command.prototype.execute = function() {
|
|||
};
|
||||
|
||||
exports.Command = Command;
|
||||
|
||||
})();
|
||||
|
|
@ -6,10 +6,7 @@ module-type: command
|
|||
Command to extract the shadow tiddlers from within a plugin
|
||||
|
||||
\*/
|
||||
(function(){
|
||||
|
||||
/*jslint node: true, browser: true */
|
||||
/*global $tw: false */
|
||||
"use strict";
|
||||
|
||||
exports.info = {
|
||||
|
|
@ -40,5 +37,3 @@ Command.prototype.execute = function() {
|
|||
};
|
||||
|
||||
exports.Command = Command;
|
||||
|
||||
})();
|
||||
|
|
@ -6,10 +6,7 @@ module-type: command
|
|||
Verbose command
|
||||
|
||||
\*/
|
||||
(function(){
|
||||
|
||||
/*jslint node: true, browser: true */
|
||||
/*global $tw: false */
|
||||
"use strict";
|
||||
|
||||
exports.info = {
|
||||
|
|
@ -30,5 +27,3 @@ Command.prototype.execute = function() {
|
|||
};
|
||||
|
||||
exports.Command = Command;
|
||||
|
||||
})();
|
||||
|
|
@ -6,10 +6,7 @@ module-type: command
|
|||
Version command
|
||||
|
||||
\*/
|
||||
(function(){
|
||||
|
||||
/*jslint node: true, browser: true */
|
||||
/*global $tw: false */
|
||||
"use strict";
|
||||
|
||||
exports.info = {
|
||||
|
|
@ -28,5 +25,3 @@ Command.prototype.execute = function() {
|
|||
};
|
||||
|
||||
exports.Command = Command;
|
||||
|
||||
})();
|
||||
|
|
@ -6,10 +6,7 @@ module-type: utils-node
|
|||
File system utilities
|
||||
|
||||
\*/
|
||||
(function(){
|
||||
|
||||
/*jslint node: true, browser: true */
|
||||
/*global $tw: false */
|
||||
"use strict";
|
||||
|
||||
var fs = require("fs"),
|
||||
|
|
@ -213,13 +210,13 @@ Options include:
|
|||
extFilters: optional array of filters to be used to generate the base path
|
||||
wiki: optional wiki for evaluating the pathFilters,
|
||||
fileInfo: an existing fileInfo to check against
|
||||
originalpath: a preferred filepath if no pathFilters match
|
||||
*/
|
||||
exports.generateTiddlerFileInfo = function(tiddler,options) {
|
||||
var fileInfo = {}, metaExt;
|
||||
// Propagate the isEditableFile flag
|
||||
if(options.fileInfo) {
|
||||
fileInfo.isEditableFile = options.fileInfo.isEditableFile || false;
|
||||
if(options.fileInfo && !!options.fileInfo.isEditableFile) {
|
||||
fileInfo.isEditableFile = true;
|
||||
fileInfo.originalpath = options.fileInfo.originalpath;
|
||||
}
|
||||
// Check if the tiddler has any unsafe fields that can't be expressed in a .tid or .meta file: containing control characters, or leading/trailing whitespace
|
||||
var hasUnsafeFields = false;
|
||||
|
|
@ -228,6 +225,7 @@ exports.generateTiddlerFileInfo = function(tiddler,options) {
|
|||
hasUnsafeFields = hasUnsafeFields || /[\x00-\x1F]/mg.test(value);
|
||||
hasUnsafeFields = hasUnsafeFields || ($tw.utils.trim(value) !== value);
|
||||
}
|
||||
hasUnsafeFields = hasUnsafeFields || /:|#/mg.test(fieldName);
|
||||
});
|
||||
// Check for field values
|
||||
if(hasUnsafeFields) {
|
||||
|
|
@ -237,7 +235,7 @@ exports.generateTiddlerFileInfo = function(tiddler,options) {
|
|||
} else {
|
||||
// Save as a .tid or a text/binary file plus a .meta file
|
||||
var tiddlerType = tiddler.fields.type || "text/vnd.tiddlywiki";
|
||||
if(tiddlerType === "text/vnd.tiddlywiki") {
|
||||
if(tiddlerType === "text/vnd.tiddlywiki" || tiddlerType === "text/vnd.tiddlywiki-multiple" || tiddler.hasField("_canonical_uri")) {
|
||||
// Save as a .tid file
|
||||
fileInfo.type = "application/x-tiddler";
|
||||
fileInfo.hasMetaFile = false;
|
||||
|
|
@ -247,7 +245,7 @@ exports.generateTiddlerFileInfo = function(tiddler,options) {
|
|||
fileInfo.hasMetaFile = true;
|
||||
}
|
||||
if(options.extFilters) {
|
||||
// Check for extension override
|
||||
// Check for extension overrides
|
||||
metaExt = $tw.utils.generateTiddlerExtension(tiddler.fields.title,{
|
||||
extFilters: options.extFilters,
|
||||
wiki: options.wiki
|
||||
|
|
@ -279,8 +277,7 @@ exports.generateTiddlerFileInfo = function(tiddler,options) {
|
|||
directory: options.directory,
|
||||
pathFilters: options.pathFilters,
|
||||
wiki: options.wiki,
|
||||
fileInfo: options.fileInfo,
|
||||
originalpath: options.originalpath
|
||||
fileInfo: options.fileInfo
|
||||
});
|
||||
return fileInfo;
|
||||
};
|
||||
|
|
@ -292,8 +289,7 @@ Options include:
|
|||
wiki: optional wiki for evaluating the extFilters
|
||||
*/
|
||||
exports.generateTiddlerExtension = function(title,options) {
|
||||
var self = this,
|
||||
extension;
|
||||
var extension;
|
||||
// Check if any of the extFilters applies
|
||||
if(options.extFilters && options.wiki) {
|
||||
$tw.utils.each(options.extFilters,function(filter) {
|
||||
|
|
@ -317,13 +313,14 @@ Options include:
|
|||
pathFilters: optional array of filters to be used to generate the base path
|
||||
wiki: optional wiki for evaluating the pathFilters
|
||||
fileInfo: an existing fileInfo object to check against
|
||||
fileInfo.overwrite: if true, turns off filename clash numbers (defaults to false)
|
||||
*/
|
||||
exports.generateTiddlerFilepath = function(title,options) {
|
||||
var self = this,
|
||||
directory = options.directory || "",
|
||||
var directory = options.directory || "",
|
||||
extension = options.extension || "",
|
||||
originalpath = options.originalpath || "",
|
||||
filepath;
|
||||
originalpath = (options.fileInfo && options.fileInfo.originalpath) ? options.fileInfo.originalpath : "",
|
||||
overwrite = options.fileInfo && options.fileInfo.overwrite || false,
|
||||
filepath;
|
||||
// Check if any of the pathFilters applies
|
||||
if(options.pathFilters && options.wiki) {
|
||||
$tw.utils.each(options.pathFilters,function(filter) {
|
||||
|
|
@ -336,7 +333,7 @@ exports.generateTiddlerFilepath = function(title,options) {
|
|||
}
|
||||
});
|
||||
}
|
||||
if(!filepath && originalpath !== "") {
|
||||
if(!filepath && !!originalpath) {
|
||||
//Use the originalpath without the extension
|
||||
var ext = path.extname(originalpath);
|
||||
filepath = originalpath.substring(0,originalpath.length - ext.length);
|
||||
|
|
@ -345,29 +342,37 @@ exports.generateTiddlerFilepath = function(title,options) {
|
|||
// Remove any forward or backward slashes so we don't create directories
|
||||
filepath = filepath.replace(/\/|\\/g,"_");
|
||||
}
|
||||
//If the path does not start with "." or ".." and a path seperator, then
|
||||
// Replace any Windows control codes
|
||||
filepath = filepath.replace(/^(con|prn|aux|nul|com[0-9]|lpt[0-9])$/i,"_$1_");
|
||||
// Replace any leading spaces with the same number of underscores
|
||||
filepath = filepath.replace(/^ +/,function (u) { return u.replace(/ /g, "_")});
|
||||
//If the path does not start with "." or ".." && a path seperator, then
|
||||
if(!/^\.{1,2}[/\\]/g.test(filepath)) {
|
||||
// Don't let the filename start with any dots because such files are invisible on *nix
|
||||
filepath = filepath.replace(/^\.+/g,"_");
|
||||
filepath = filepath.replace(/^\.+/g,function (u) { return u.replace(/\./g, "_")});
|
||||
}
|
||||
// Replace any Unicode control codes
|
||||
filepath = filepath.replace(/[\x00-\x1f\x80-\x9f]/g,"_");
|
||||
// Replace any characters that can't be used in cross-platform filenames
|
||||
filepath = $tw.utils.transliterate(filepath.replace(/<|>|~|\:|\"|\||\?|\*|\^/g,"_"));
|
||||
// Replace any dots or spaces at the end of the extension with the same number of underscores
|
||||
extension = extension.replace(/[\. ]+$/, function (u) { return u.replace(/[\. ]/g, "_")});
|
||||
// Truncate the extension if it is too long
|
||||
if(extension.length > 32) {
|
||||
extension = extension.substr(0,32);
|
||||
}
|
||||
// If the filepath already ends in the extension then remove it
|
||||
if(filepath.substring(filepath.length - extension.length) === extension) {
|
||||
filepath = filepath.substring(0,filepath.length - extension.length);
|
||||
}
|
||||
// Remove any characters that can't be used in cross-platform filenames
|
||||
filepath = $tw.utils.transliterate(filepath.replace(/<|>|~|\:|\"|\||\?|\*|\^/g,"_"));
|
||||
// Truncate the filename if it is too long
|
||||
if(filepath.length > 200) {
|
||||
filepath = filepath.substr(0,200);
|
||||
}
|
||||
// Truncate the extension if it is too long
|
||||
if(extension.length > 32) {
|
||||
extension = extension.substr(0,32);
|
||||
}
|
||||
// If the resulting filename is blank (eg because the title is just punctuation characters)
|
||||
if(!filepath) {
|
||||
// If the resulting filename is blank (eg because the title is just punctuation)
|
||||
if(!filepath || /^_+$/g.test(filepath)) {
|
||||
// ...then just use the character codes of the title
|
||||
filepath = "";
|
||||
filepath = "";
|
||||
$tw.utils.each(title.split(""),function(char) {
|
||||
if(filepath) {
|
||||
filepath += "-";
|
||||
|
|
@ -375,28 +380,30 @@ exports.generateTiddlerFilepath = function(title,options) {
|
|||
filepath += char.charCodeAt(0).toString();
|
||||
});
|
||||
}
|
||||
// Add a uniquifier if the file already exists
|
||||
var fullPath, oldPath = (options.fileInfo) ? options.fileInfo.filepath : undefined,
|
||||
// Add a uniquifier if the file already exists (default)
|
||||
var fullPath = path.resolve(directory, filepath + extension);
|
||||
if (!overwrite) {
|
||||
var oldPath = (options.fileInfo) ? options.fileInfo.filepath : undefined,
|
||||
count = 0;
|
||||
do {
|
||||
fullPath = path.resolve(directory,filepath + (count ? "_" + count : "") + extension);
|
||||
if(oldPath && oldPath == fullPath) {
|
||||
break;
|
||||
}
|
||||
count++;
|
||||
} while(fs.existsSync(fullPath));
|
||||
do {
|
||||
fullPath = path.resolve(directory,filepath + (count ? "_" + count : "") + extension);
|
||||
if(oldPath && oldPath == fullPath) break;
|
||||
count++;
|
||||
} while(fs.existsSync(fullPath));
|
||||
}
|
||||
// If the last write failed with an error, or if path does not start with:
|
||||
// the resolved options.directory, the resolved wikiPath directory, or the wikiTiddlersPath directory,
|
||||
// then encodeURIComponent() and resolve to tiddler directory
|
||||
var writePath = $tw.hooks.invokeHook("th-make-tiddler-path",fullPath),
|
||||
// the resolved options.directory, the resolved wikiPath directory, the wikiTiddlersPath directory,
|
||||
// or the 'originalpath' directory, then $tw.utils.encodeURIComponentExtended() and resolve to options.directory.
|
||||
var writePath = $tw.hooks.invokeHook("th-make-tiddler-path",fullPath,fullPath),
|
||||
encode = (options.fileInfo || {writeError: false}).writeError == true;
|
||||
if(!encode) {
|
||||
encode = !(fullPath.indexOf(path.resolve(directory)) == 0 ||
|
||||
fullPath.indexOf(path.resolve($tw.boot.wikiPath)) == 0 ||
|
||||
fullPath.indexOf($tw.boot.wikiTiddlersPath) == 0);
|
||||
encode = !(writePath.indexOf($tw.boot.wikiTiddlersPath) == 0 ||
|
||||
writePath.indexOf(path.resolve(directory)) == 0 ||
|
||||
writePath.indexOf(path.resolve($tw.boot.wikiPath)) == 0 ||
|
||||
writePath.indexOf(path.resolve($tw.boot.wikiTiddlersPath,originalpath)) == 0 );
|
||||
}
|
||||
if(encode) {
|
||||
writePath = path.resolve(directory,encodeURIComponent(fullPath));
|
||||
writePath = path.resolve(directory,$tw.utils.encodeURIComponentExtended(fullPath));
|
||||
}
|
||||
// Return the full path to the file
|
||||
return writePath;
|
||||
|
|
@ -413,7 +420,7 @@ exports.saveTiddlerToFile = function(tiddler,fileInfo,callback) {
|
|||
if(fileInfo.hasMetaFile) {
|
||||
// Save the tiddler as a separate body and meta file
|
||||
var typeInfo = $tw.config.contentTypeInfo[tiddler.fields.type || "text/plain"] || {encoding: "utf8"};
|
||||
fs.writeFile(fileInfo.filepath,tiddler.fields.text,typeInfo.encoding,function(err) {
|
||||
fs.writeFile(fileInfo.filepath,tiddler.fields.text || "",typeInfo.encoding,function(err) {
|
||||
if(err) {
|
||||
return callback(err);
|
||||
}
|
||||
|
|
@ -455,7 +462,7 @@ exports.saveTiddlerToFileSync = function(tiddler,fileInfo) {
|
|||
if(fileInfo.hasMetaFile) {
|
||||
// Save the tiddler as a separate body and meta file
|
||||
var typeInfo = $tw.config.contentTypeInfo[tiddler.fields.type || "text/plain"] || {encoding: "utf8"};
|
||||
fs.writeFileSync(fileInfo.filepath,tiddler.fields.text,typeInfo.encoding);
|
||||
fs.writeFileSync(fileInfo.filepath,tiddler.fields.text || "",typeInfo.encoding);
|
||||
fs.writeFileSync(fileInfo.filepath + ".meta",tiddler.getFieldStringBlock({exclude: ["text","bag"]}),"utf8");
|
||||
} else {
|
||||
// Save the tiddler as a self contained templated file
|
||||
|
|
@ -465,6 +472,7 @@ exports.saveTiddlerToFileSync = function(tiddler,fileInfo) {
|
|||
fs.writeFileSync(fileInfo.filepath,JSON.stringify([tiddler.getFieldStrings({exclude: ["bag"]})],null,$tw.config.preferences.jsonSpaces),"utf8");
|
||||
}
|
||||
}
|
||||
return fileInfo;
|
||||
};
|
||||
|
||||
/*
|
||||
|
|
@ -481,7 +489,7 @@ exports.deleteTiddlerFile = function(fileInfo,callback) {
|
|||
fs.unlink(fileInfo.filepath,function(err) {
|
||||
if(err) {
|
||||
return callback(err);
|
||||
}
|
||||
}
|
||||
// Delete the metafile if present
|
||||
if(fileInfo.hasMetaFile && fs.existsSync(fileInfo.filepath + ".meta")) {
|
||||
fs.unlink(fileInfo.filepath + ".meta",function(err) {
|
||||
|
|
@ -532,5 +540,3 @@ exports.cleanupTiddlerFiles = function(options,callback) {
|
|||
return callback(null,bootInfo);
|
||||
}
|
||||
};
|
||||
|
||||
})();
|
||||
11
core-server/plugin.info
Normal file
11
core-server/plugin.info
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
{
|
||||
"title": "$:/core-server",
|
||||
"name": "Core Server Components",
|
||||
"description": "TiddlyWiki5 core server components",
|
||||
"author": "JeremyRuston",
|
||||
"core-version": ">=5.0.0",
|
||||
"platform": "server",
|
||||
"plugin-priority": "0",
|
||||
"list": "readme",
|
||||
"stability": "STABILITY_2_STABLE"
|
||||
}
|
||||
7
core-server/readme.tid
Normal file
7
core-server/readme.tid
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
title: $:/core-server/readme
|
||||
|
||||
This plugin contains TiddlyWiki's core components that are only needed on the server, comprising:
|
||||
|
||||
* Commands
|
||||
* HTTP server code
|
||||
* Utility functions for server
|
||||
|
|
@ -6,10 +6,7 @@ module-type: authenticator
|
|||
Authenticator for WWW basic authentication
|
||||
|
||||
\*/
|
||||
(function(){
|
||||
|
||||
/*jslint node: true, browser: true */
|
||||
/*global $tw: false */
|
||||
"use strict";
|
||||
|
||||
if($tw.node) {
|
||||
|
|
@ -90,5 +87,3 @@ BasicAuthenticator.prototype.authenticateRequest = function(request,response,sta
|
|||
};
|
||||
|
||||
exports.AuthenticatorClass = BasicAuthenticator;
|
||||
|
||||
})();
|
||||
|
|
@ -6,10 +6,7 @@ module-type: authenticator
|
|||
Authenticator for trusted header authentication
|
||||
|
||||
\*/
|
||||
(function(){
|
||||
|
||||
/*jslint node: true, browser: true */
|
||||
/*global $tw: false */
|
||||
"use strict";
|
||||
|
||||
function HeaderAuthenticator(server) {
|
||||
|
|
@ -37,11 +34,12 @@ HeaderAuthenticator.prototype.authenticateRequest = function(request,response,st
|
|||
return false;
|
||||
} else {
|
||||
// authenticatedUsername will be undefined for anonymous users
|
||||
state.authenticatedUsername = username;
|
||||
if(username) {
|
||||
state.authenticatedUsername = $tw.utils.decodeURIComponentSafe(username);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
exports.AuthenticatorClass = HeaderAuthenticator;
|
||||
|
||||
})();
|
||||
26
core-server/server/routes/delete-tiddler.js
Normal file
26
core-server/server/routes/delete-tiddler.js
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
/*\
|
||||
title: $:/core/modules/server/routes/delete-tiddler.js
|
||||
type: application/javascript
|
||||
module-type: route
|
||||
|
||||
DELETE /recipes/default/tiddlers/:title
|
||||
|
||||
\*/
|
||||
"use strict";
|
||||
|
||||
exports.methods = ["DELETE"];
|
||||
|
||||
exports.path = /^\/bags\/default\/tiddlers\/(.+)$/;
|
||||
|
||||
exports.info = {
|
||||
priority: 100
|
||||
};
|
||||
|
||||
exports.handler = function(request,response,state) {
|
||||
var title = $tw.utils.decodeURIComponentSafe(state.params[0]);
|
||||
state.wiki.deleteTiddler(title);
|
||||
response.writeHead(204, "OK", {
|
||||
"Content-Type": "text/plain"
|
||||
});
|
||||
response.end();
|
||||
};
|
||||
22
core-server/server/routes/get-favicon.js
Normal file
22
core-server/server/routes/get-favicon.js
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
/*\
|
||||
title: $:/core/modules/server/routes/get-favicon.js
|
||||
type: application/javascript
|
||||
module-type: route
|
||||
|
||||
GET /favicon.ico
|
||||
|
||||
\*/
|
||||
"use strict";
|
||||
|
||||
exports.methods = ["GET"];
|
||||
|
||||
exports.path = /^\/favicon.ico$/;
|
||||
|
||||
exports.info = {
|
||||
priority: 100
|
||||
};
|
||||
|
||||
exports.handler = function(request,response,state) {
|
||||
var buffer = state.wiki.getTiddlerText("$:/favicon.ico","");
|
||||
state.sendResponse(200,{"Content-Type": "image/x-icon"},buffer,"base64");
|
||||
};
|
||||
73
core-server/server/routes/get-file.js
Normal file
73
core-server/server/routes/get-file.js
Normal file
|
|
@ -0,0 +1,73 @@
|
|||
/*\
|
||||
title: $:/core/modules/server/routes/get-file.js
|
||||
type: application/javascript
|
||||
module-type: route
|
||||
|
||||
GET /files/:filepath
|
||||
|
||||
\*/
|
||||
"use strict";
|
||||
|
||||
exports.methods = ["GET"];
|
||||
|
||||
exports.path = /^\/files\/(.+)$/;
|
||||
|
||||
exports.info = {
|
||||
priority: 100
|
||||
};
|
||||
|
||||
exports.handler = function(request,response,state) {
|
||||
var path = require("path"),
|
||||
fs = require("fs"),
|
||||
suppliedFilename = $tw.utils.decodeURIComponentSafe(state.params[0]),
|
||||
baseFilename = path.resolve(state.boot.wikiPath,"files"),
|
||||
filename = path.resolve(baseFilename,suppliedFilename),
|
||||
extension = path.extname(filename);
|
||||
// Check that the filename is inside the wiki files folder
|
||||
if(path.relative(baseFilename,filename).indexOf("..") === 0) {
|
||||
return state.sendResponse(404,{"Content-Type": "text/plain"},"File '" + suppliedFilename + "' not found");
|
||||
}
|
||||
fs.stat(filename, function(err, stats) {
|
||||
if(err) {
|
||||
return state.sendResponse(404,{"Content-Type": "text/plain"},"File '" + suppliedFilename + "' not found");
|
||||
} else {
|
||||
var type = ($tw.config.fileExtensionInfo[extension] ? $tw.config.fileExtensionInfo[extension].type : "application/octet-stream"),
|
||||
responseHeaders = {
|
||||
"Content-Type": type,
|
||||
"Accept-Ranges": "bytes"
|
||||
};
|
||||
var rangeHeader = request.headers.range,
|
||||
stream;
|
||||
if(rangeHeader) {
|
||||
// Handle range requests
|
||||
var parts = rangeHeader.replace(/bytes=/, "").split("-"),
|
||||
start = parseInt(parts[0], 10),
|
||||
end = parts[1] ? parseInt(parts[1], 10) : stats.size - 1;
|
||||
// Validate start and end
|
||||
if(isNaN(start) || isNaN(end) || start < 0 || end < start || end >= stats.size) {
|
||||
responseHeaders["Content-Range"] = "bytes */" + stats.size;
|
||||
return response.writeHead(416, responseHeaders).end();
|
||||
}
|
||||
var chunksize = (end - start) + 1;
|
||||
responseHeaders["Content-Range"] = "bytes " + start + "-" + end + "/" + stats.size;
|
||||
responseHeaders["Content-Length"] = chunksize;
|
||||
response.writeHead(206, responseHeaders);
|
||||
stream = fs.createReadStream(filename, {start: start, end: end});
|
||||
} else {
|
||||
responseHeaders["Content-Length"] = stats.size;
|
||||
response.writeHead(200, responseHeaders);
|
||||
stream = fs.createReadStream(filename);
|
||||
}
|
||||
// Common stream error handling
|
||||
stream.on("error", function(err) {
|
||||
if(!response.headersSent) {
|
||||
response.writeHead(500, {"Content-Type": "text/plain"});
|
||||
response.end("Read error");
|
||||
} else {
|
||||
response.destroy();
|
||||
}
|
||||
});
|
||||
stream.pipe(response);
|
||||
}
|
||||
});
|
||||
};
|
||||
25
core-server/server/routes/get-index.js
Normal file
25
core-server/server/routes/get-index.js
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
/*\
|
||||
title: $:/core/modules/server/routes/get-index.js
|
||||
type: application/javascript
|
||||
module-type: route
|
||||
|
||||
GET /
|
||||
|
||||
\*/
|
||||
"use strict";
|
||||
|
||||
exports.methods = ["GET"];
|
||||
|
||||
exports.path = /^\/$/;
|
||||
|
||||
exports.info = {
|
||||
priority: 100
|
||||
};
|
||||
|
||||
exports.handler = function(request,response,state) {
|
||||
var text = state.wiki.renderTiddler(state.server.get("root-render-type"),state.server.get("root-tiddler")),
|
||||
responseHeaders = {
|
||||
"Content-Type": state.server.get("root-serve-type")
|
||||
};
|
||||
state.sendResponse(200,responseHeaders,text);
|
||||
};
|
||||
|
|
@ -6,30 +6,29 @@ module-type: route
|
|||
GET /login-basic -- force a Basic Authentication challenge
|
||||
|
||||
\*/
|
||||
(function() {
|
||||
|
||||
/*jslint node: true, browser: true */
|
||||
/*global $tw: false */
|
||||
"use strict";
|
||||
|
||||
exports.method = "GET";
|
||||
exports.methods = ["GET"];
|
||||
|
||||
exports.path = /^\/login-basic$/;
|
||||
|
||||
exports.info = {
|
||||
priority: 100
|
||||
};
|
||||
|
||||
exports.handler = function(request,response,state) {
|
||||
if(!state.authenticatedUsername) {
|
||||
// Challenge if there's no username
|
||||
response.writeHead(401,{
|
||||
"WWW-Authenticate": 'Basic realm="Please provide your username and password to login to ' + state.server.servername + '"'
|
||||
});
|
||||
response.end();
|
||||
response.end();
|
||||
} else {
|
||||
// Redirect to the root wiki if login worked
|
||||
var location = ($tw.syncadaptor && $tw.syncadaptor.host)? $tw.syncadaptor.host: `${state.pathPrefix}/`;
|
||||
response.writeHead(302,{
|
||||
Location: "/"
|
||||
Location: location
|
||||
});
|
||||
response.end();
|
||||
}
|
||||
};
|
||||
|
||||
}());
|
||||
31
core-server/server/routes/get-status.js
Normal file
31
core-server/server/routes/get-status.js
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
/*\
|
||||
title: $:/core/modules/server/routes/get-status.js
|
||||
type: application/javascript
|
||||
module-type: route
|
||||
|
||||
GET /status
|
||||
|
||||
\*/
|
||||
"use strict";
|
||||
|
||||
exports.methods = ["GET"];
|
||||
|
||||
exports.path = /^\/status$/;
|
||||
|
||||
exports.info = {
|
||||
priority: 100
|
||||
};
|
||||
|
||||
exports.handler = function(request,response,state) {
|
||||
var text = JSON.stringify({
|
||||
username: state.authenticatedUsername || state.server.get("anon-username") || "",
|
||||
anonymous: !state.authenticatedUsername,
|
||||
read_only: !state.server.isAuthorized("writers",state.authenticatedUsername),
|
||||
logout_is_available: false,
|
||||
space: {
|
||||
recipe: "default"
|
||||
},
|
||||
tiddlywiki_version: $tw.version
|
||||
});
|
||||
state.sendResponse(200,{"Content-Type": "application/json"},text,"utf8");
|
||||
};
|
||||
|
|
@ -6,18 +6,18 @@ module-type: route
|
|||
GET /:title
|
||||
|
||||
\*/
|
||||
(function() {
|
||||
|
||||
/*jslint node: true, browser: true */
|
||||
/*global $tw: false */
|
||||
"use strict";
|
||||
|
||||
exports.method = "GET";
|
||||
exports.methods = ["GET"];
|
||||
|
||||
exports.path = /^\/([^\/]+)$/;
|
||||
|
||||
exports.info = {
|
||||
priority: 100
|
||||
};
|
||||
|
||||
exports.handler = function(request,response,state) {
|
||||
var title = decodeURIComponent(state.params[0]),
|
||||
var title = $tw.utils.decodeURIComponentSafe(state.params[0]),
|
||||
tiddler = state.wiki.getTiddler(title);
|
||||
if(tiddler) {
|
||||
var renderType = tiddler.getFieldString("_render_type"),
|
||||
|
|
@ -32,13 +32,11 @@ exports.handler = function(request,response,state) {
|
|||
renderTemplate = renderTemplate || state.server.get("tiddler-render-template");
|
||||
}
|
||||
var text = state.wiki.renderTiddler(renderType,renderTemplate,{parseAsInline: true, variables: {currentTiddler: title}});
|
||||
|
||||
// Naughty not to set a content-type, but it's the easiest way to ensure the browser will see HTML pages as HTML, and accept plain text tiddlers as CSS or JS
|
||||
response.writeHead(200);
|
||||
response.end(text,"utf8");
|
||||
state.sendResponse(200,{},text,"utf8");
|
||||
} else {
|
||||
response.writeHead(404);
|
||||
response.end();
|
||||
}
|
||||
};
|
||||
|
||||
}());
|
||||
|
|
@ -6,18 +6,18 @@ module-type: route
|
|||
GET /recipes/default/tiddlers/:title
|
||||
|
||||
\*/
|
||||
(function() {
|
||||
|
||||
/*jslint node: true, browser: true */
|
||||
/*global $tw: false */
|
||||
"use strict";
|
||||
|
||||
exports.method = "GET";
|
||||
exports.methods = ["GET"];
|
||||
|
||||
exports.path = /^\/recipes\/default\/tiddlers\/(.+)$/;
|
||||
|
||||
exports.info = {
|
||||
priority: 100
|
||||
};
|
||||
|
||||
exports.handler = function(request,response,state) {
|
||||
var title = decodeURIComponent(state.params[0]),
|
||||
var title = $tw.utils.decodeURIComponentSafe(state.params[0]),
|
||||
tiddler = state.wiki.getTiddler(title),
|
||||
tiddlerFields = {},
|
||||
knownFields = [
|
||||
|
|
@ -36,12 +36,9 @@ exports.handler = function(request,response,state) {
|
|||
tiddlerFields.revision = state.wiki.getChangeCount(title);
|
||||
tiddlerFields.bag = "default";
|
||||
tiddlerFields.type = tiddlerFields.type || "text/vnd.tiddlywiki";
|
||||
response.writeHead(200, {"Content-Type": "application/json"});
|
||||
response.end(JSON.stringify(tiddlerFields),"utf8");
|
||||
state.sendResponse(200,{"Content-Type": "application/json"},JSON.stringify(tiddlerFields),"utf8");
|
||||
} else {
|
||||
response.writeHead(404);
|
||||
response.end();
|
||||
}
|
||||
};
|
||||
|
||||
}());
|
||||
|
|
@ -6,18 +6,18 @@ module-type: route
|
|||
GET /recipes/default/tiddlers.json?filter=<filter>
|
||||
|
||||
\*/
|
||||
(function() {
|
||||
|
||||
/*jslint node: true, browser: true */
|
||||
/*global $tw: false */
|
||||
"use strict";
|
||||
|
||||
var DEFAULT_FILTER = "[all[tiddlers]!is[system]sort[title]]";
|
||||
|
||||
exports.method = "GET";
|
||||
exports.methods = ["GET"];
|
||||
|
||||
exports.path = /^\/recipes\/default\/tiddlers.json$/;
|
||||
|
||||
exports.info = {
|
||||
priority: 100
|
||||
};
|
||||
|
||||
exports.handler = function(request,response,state) {
|
||||
var filter = state.queryParameters.filter || DEFAULT_FILTER;
|
||||
if(state.wiki.getTiddlerText("$:/config/Server/AllowAllExternalFilters") !== "yes") {
|
||||
|
|
@ -33,7 +33,6 @@ exports.handler = function(request,response,state) {
|
|||
}
|
||||
var excludeFields = (state.queryParameters.exclude || "text").split(","),
|
||||
titles = state.wiki.filterTiddlers(filter);
|
||||
response.writeHead(200, {"Content-Type": "application/json"});
|
||||
var tiddlers = [];
|
||||
$tw.utils.each(titles,function(title) {
|
||||
var tiddler = state.wiki.getTiddler(title);
|
||||
|
|
@ -45,7 +44,5 @@ exports.handler = function(request,response,state) {
|
|||
}
|
||||
});
|
||||
var text = JSON.stringify(tiddlers);
|
||||
response.end(text,"utf8");
|
||||
state.sendResponse(200,{"Content-Type": "application/json"},text,"utf8");
|
||||
};
|
||||
|
||||
}());
|
||||
50
core-server/server/routes/put-tiddler.js
Normal file
50
core-server/server/routes/put-tiddler.js
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
/*\
|
||||
title: $:/core/modules/server/routes/put-tiddler.js
|
||||
type: application/javascript
|
||||
module-type: route
|
||||
|
||||
PUT /recipes/default/tiddlers/:title
|
||||
|
||||
\*/
|
||||
"use strict";
|
||||
|
||||
exports.methods = ["PUT"];
|
||||
|
||||
exports.path = /^\/recipes\/default\/tiddlers\/(.+)$/;
|
||||
|
||||
exports.info = {
|
||||
priority: 100
|
||||
};
|
||||
|
||||
exports.handler = function(request,response,state) {
|
||||
var title = $tw.utils.decodeURIComponentSafe(state.params[0]),
|
||||
fields = $tw.utils.parseJSONSafe(state.data);
|
||||
// Pull up any subfields in the `fields` object
|
||||
if(fields.fields) {
|
||||
$tw.utils.each(fields.fields,function(field,name) {
|
||||
fields[name] = field;
|
||||
});
|
||||
delete fields.fields;
|
||||
}
|
||||
// Remove any revision field
|
||||
if(fields.revision) {
|
||||
delete fields.revision;
|
||||
}
|
||||
// If this is a skinny tiddler, it means the client never got the full
|
||||
// version of the tiddler to edit. So we must preserve whatever text
|
||||
// already exists on the server, or else we'll inadvertently delete it.
|
||||
if(fields._is_skinny !== undefined) {
|
||||
var tiddler = state.wiki.getTiddler(title);
|
||||
if(tiddler) {
|
||||
fields.text = tiddler.fields.text;
|
||||
}
|
||||
delete fields._is_skinny;
|
||||
}
|
||||
state.wiki.addTiddler(new $tw.Tiddler(fields,{title: title}));
|
||||
var changeCount = state.wiki.getChangeCount(title).toString();
|
||||
response.writeHead(204, "OK",{
|
||||
Etag: "\"default/" + encodeURIComponent(title) + "/" + changeCount + ":\"",
|
||||
"Content-Type": "text/plain"
|
||||
});
|
||||
response.end();
|
||||
};
|
||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue