mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2026-01-23 19:34:39 +00:00
Compare commits
2 Commits
this-tiddl
...
parser-var
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1a9731ba33 | ||
|
|
34830729e9 |
@@ -1,8 +0,0 @@
|
|||||||
# Ignore "third party" code whose style we will not change.
|
|
||||||
/boot/sjcl.js
|
|
||||||
/core/modules/utils/base64-utf8/base64-utf8.module.js
|
|
||||||
/core/modules/utils/base64-utf8/base64-utf8.module.min.js
|
|
||||||
/core/modules/utils/diff-match-patch/diff_match_patch.js
|
|
||||||
/core/modules/utils/diff-match-patch/diff_match_patch_uncompressed.js
|
|
||||||
/core/modules/utils/dom/csscolorparser.js
|
|
||||||
/plugins/tiddlywiki/*/files/
|
|
||||||
283
.eslintrc.yml
283
.eslintrc.yml
@@ -1,283 +0,0 @@
|
|||||||
env:
|
|
||||||
browser: true
|
|
||||||
commonjs: true
|
|
||||||
es2021: true
|
|
||||||
node: true
|
|
||||||
extends: 'eslint:recommended'
|
|
||||||
globals:
|
|
||||||
"$tw": "writable" # temporary
|
|
||||||
parserOptions:
|
|
||||||
ecmaVersion: 5
|
|
||||||
rules:
|
|
||||||
array-bracket-newline: 'off'
|
|
||||||
array-bracket-spacing: 'off'
|
|
||||||
array-callback-return: 'off'
|
|
||||||
array-element-newline: 'off'
|
|
||||||
arrow-body-style: error
|
|
||||||
arrow-parens:
|
|
||||||
- error
|
|
||||||
- as-needed
|
|
||||||
arrow-spacing:
|
|
||||||
- error
|
|
||||||
- after: true
|
|
||||||
before: true
|
|
||||||
block-scoped-var: 'off'
|
|
||||||
block-spacing: 'off'
|
|
||||||
brace-style: 'off'
|
|
||||||
callback-return: 'off'
|
|
||||||
camelcase: 'off'
|
|
||||||
capitalized-comments: 'off'
|
|
||||||
class-methods-use-this: error
|
|
||||||
comma-dangle: 'off'
|
|
||||||
comma-spacing: 'off'
|
|
||||||
comma-style: 'off'
|
|
||||||
complexity: 'off'
|
|
||||||
computed-property-spacing: 'off'
|
|
||||||
consistent-return: 'off'
|
|
||||||
consistent-this: 'off'
|
|
||||||
curly: 'off'
|
|
||||||
default-case: 'off'
|
|
||||||
default-case-last: error
|
|
||||||
default-param-last: error
|
|
||||||
dot-location: 'off'
|
|
||||||
dot-notation: 'off'
|
|
||||||
eol-last: 'off'
|
|
||||||
eqeqeq: 'off'
|
|
||||||
func-call-spacing: 'off'
|
|
||||||
func-name-matching: 'off'
|
|
||||||
func-names: 'off'
|
|
||||||
func-style: 'off'
|
|
||||||
function-call-argument-newline: 'off'
|
|
||||||
function-paren-newline: 'off'
|
|
||||||
generator-star-spacing: error
|
|
||||||
global-require: 'off'
|
|
||||||
grouped-accessor-pairs: error
|
|
||||||
guard-for-in: 'off'
|
|
||||||
handle-callback-err: 'off'
|
|
||||||
id-blacklist: error
|
|
||||||
id-denylist: error
|
|
||||||
id-length: 'off'
|
|
||||||
id-match: error
|
|
||||||
implicit-arrow-linebreak: error
|
|
||||||
indent: 'off'
|
|
||||||
indent-legacy: 'off'
|
|
||||||
init-declarations: 'off'
|
|
||||||
jsx-quotes: error
|
|
||||||
key-spacing: 'off'
|
|
||||||
keyword-spacing:
|
|
||||||
- error
|
|
||||||
- before: true
|
|
||||||
after: false
|
|
||||||
overrides:
|
|
||||||
'case':
|
|
||||||
after: true
|
|
||||||
'do':
|
|
||||||
'after': true
|
|
||||||
'else':
|
|
||||||
after: true
|
|
||||||
'return':
|
|
||||||
after: true
|
|
||||||
'throw':
|
|
||||||
after: true
|
|
||||||
'try':
|
|
||||||
after: true
|
|
||||||
line-comment-position: 'off'
|
|
||||||
linebreak-style: 'off'
|
|
||||||
lines-around-comment: 'off'
|
|
||||||
lines-around-directive: 'off'
|
|
||||||
lines-between-class-members: error
|
|
||||||
max-classes-per-file: error
|
|
||||||
max-depth: 'off'
|
|
||||||
max-len: 'off'
|
|
||||||
max-lines: 'off'
|
|
||||||
max-lines-per-function: 'off'
|
|
||||||
max-nested-callbacks: error
|
|
||||||
max-params: 'off'
|
|
||||||
max-statements: 'off'
|
|
||||||
max-statements-per-line: 'off'
|
|
||||||
multiline-comment-style: 'off'
|
|
||||||
multiline-ternary: 'off'
|
|
||||||
new-parens: 'off'
|
|
||||||
newline-after-var: 'off'
|
|
||||||
newline-before-return: 'off'
|
|
||||||
newline-per-chained-call: 'off'
|
|
||||||
no-alert: 'off'
|
|
||||||
no-array-constructor: 'off'
|
|
||||||
no-await-in-loop: error
|
|
||||||
no-bitwise: 'off'
|
|
||||||
no-buffer-constructor: 'off'
|
|
||||||
no-caller: error
|
|
||||||
no-catch-shadow: 'off'
|
|
||||||
no-confusing-arrow: error
|
|
||||||
no-console: 'off'
|
|
||||||
no-constant-condition:
|
|
||||||
- error
|
|
||||||
- checkLoops: false
|
|
||||||
no-constructor-return: error
|
|
||||||
no-continue: 'off'
|
|
||||||
no-div-regex: 'off'
|
|
||||||
no-duplicate-imports: error
|
|
||||||
no-else-return: 'off'
|
|
||||||
no-empty-function: 'off'
|
|
||||||
no-eq-null: 'off'
|
|
||||||
no-eval: 'off'
|
|
||||||
no-extend-native: 'off'
|
|
||||||
no-extra-bind: 'off'
|
|
||||||
no-extra-label: 'off'
|
|
||||||
no-extra-parens: 'off'
|
|
||||||
no-floating-decimal: 'off'
|
|
||||||
no-implicit-coercion:
|
|
||||||
- error
|
|
||||||
- boolean: false
|
|
||||||
number: false
|
|
||||||
string: false
|
|
||||||
no-implicit-globals: 'off'
|
|
||||||
no-implied-eval: error
|
|
||||||
no-inline-comments: 'off'
|
|
||||||
no-invalid-this: 'off'
|
|
||||||
no-iterator: error
|
|
||||||
no-label-var: 'off'
|
|
||||||
no-labels: 'off'
|
|
||||||
no-lone-blocks: 'off'
|
|
||||||
no-lonely-if: 'off'
|
|
||||||
no-loop-func: 'off'
|
|
||||||
no-loss-of-precision: error
|
|
||||||
no-magic-numbers: 'off'
|
|
||||||
no-mixed-operators: 'off'
|
|
||||||
no-mixed-requires: 'off'
|
|
||||||
no-multi-assign: 'off'
|
|
||||||
no-multi-spaces: 'off'
|
|
||||||
no-multi-str: error
|
|
||||||
no-multiple-empty-lines: 'off'
|
|
||||||
no-native-reassign: 'off'
|
|
||||||
no-negated-condition: 'off'
|
|
||||||
no-negated-in-lhs: error
|
|
||||||
no-nested-ternary: 'off'
|
|
||||||
no-new: 'off'
|
|
||||||
no-new-func: 'off'
|
|
||||||
no-new-object: 'off'
|
|
||||||
no-new-require: error
|
|
||||||
no-new-wrappers: error
|
|
||||||
no-octal-escape: error
|
|
||||||
no-param-reassign: 'off'
|
|
||||||
no-path-concat: error
|
|
||||||
no-plusplus: 'off'
|
|
||||||
no-process-env: 'off'
|
|
||||||
no-process-exit: 'off'
|
|
||||||
no-promise-executor-return: error
|
|
||||||
no-proto: 'off'
|
|
||||||
no-restricted-exports: error
|
|
||||||
no-restricted-globals: error
|
|
||||||
no-restricted-imports: error
|
|
||||||
no-restricted-modules: error
|
|
||||||
no-restricted-properties: error
|
|
||||||
no-restricted-syntax: error
|
|
||||||
no-return-assign: 'off'
|
|
||||||
no-return-await: error
|
|
||||||
no-script-url: 'off'
|
|
||||||
no-self-compare: 'off'
|
|
||||||
no-sequences: 'off'
|
|
||||||
no-shadow: 'off'
|
|
||||||
no-spaced-func: 'off'
|
|
||||||
no-sync: 'off'
|
|
||||||
no-tabs: 'off'
|
|
||||||
no-template-curly-in-string: error
|
|
||||||
no-ternary: 'off'
|
|
||||||
no-throw-literal: 'off'
|
|
||||||
no-trailing-spaces: 'off'
|
|
||||||
no-undef-init: 'off'
|
|
||||||
no-undefined: 'off'
|
|
||||||
no-underscore-dangle: 'off'
|
|
||||||
no-unmodified-loop-condition: 'off'
|
|
||||||
no-unneeded-ternary: 'off'
|
|
||||||
no-unreachable-loop: error
|
|
||||||
no-unused-expressions: 'off'
|
|
||||||
no-use-before-define: 'off'
|
|
||||||
no-useless-backreference: error
|
|
||||||
no-useless-call: 'off'
|
|
||||||
no-useless-computed-key: error
|
|
||||||
no-useless-concat: 'off'
|
|
||||||
no-useless-constructor: error
|
|
||||||
no-useless-rename: error
|
|
||||||
no-useless-return: 'off'
|
|
||||||
no-var: 'off'
|
|
||||||
no-void: 'off'
|
|
||||||
no-warning-comments: 'off'
|
|
||||||
no-whitespace-before-property: error
|
|
||||||
nonblock-statement-body-position:
|
|
||||||
- error
|
|
||||||
- any
|
|
||||||
object-curly-newline: 'off'
|
|
||||||
object-curly-spacing: 'off'
|
|
||||||
object-property-newline: 'off'
|
|
||||||
object-shorthand: 'off'
|
|
||||||
one-var: 'off'
|
|
||||||
one-var-declaration-per-line: 'off'
|
|
||||||
operator-assignment: 'off'
|
|
||||||
operator-linebreak: 'off'
|
|
||||||
padded-blocks: 'off'
|
|
||||||
padding-line-between-statements: error
|
|
||||||
prefer-arrow-callback: 'off'
|
|
||||||
prefer-const: 'off'
|
|
||||||
prefer-destructuring: 'off'
|
|
||||||
prefer-exponentiation-operator: 'off'
|
|
||||||
prefer-named-capture-group: 'off'
|
|
||||||
prefer-numeric-literals: error
|
|
||||||
prefer-object-spread: 'off'
|
|
||||||
prefer-promise-reject-errors: error
|
|
||||||
prefer-reflect: 'off'
|
|
||||||
prefer-regex-literals: 'off'
|
|
||||||
prefer-rest-params: 'off'
|
|
||||||
prefer-spread: 'off'
|
|
||||||
prefer-template: 'off'
|
|
||||||
quote-props: 'off'
|
|
||||||
quotes: 'off'
|
|
||||||
radix: 'off'
|
|
||||||
require-atomic-updates: error
|
|
||||||
require-await: error
|
|
||||||
require-jsdoc: 'off'
|
|
||||||
require-unicode-regexp: 'off'
|
|
||||||
rest-spread-spacing: error
|
|
||||||
semi: 'off'
|
|
||||||
semi-spacing: 'off'
|
|
||||||
semi-style: 'off'
|
|
||||||
sort-imports: error
|
|
||||||
sort-keys: 'off'
|
|
||||||
sort-vars: 'off'
|
|
||||||
space-before-blocks: 'off'
|
|
||||||
space-before-function-paren: 'off'
|
|
||||||
space-in-parens: 'off'
|
|
||||||
space-infix-ops: 'off'
|
|
||||||
space-unary-ops: 'off'
|
|
||||||
spaced-comment: 'off'
|
|
||||||
strict: 'off'
|
|
||||||
switch-colon-spacing: 'off'
|
|
||||||
symbol-description: error
|
|
||||||
template-curly-spacing: error
|
|
||||||
template-tag-spacing: error
|
|
||||||
unicode-bom:
|
|
||||||
- error
|
|
||||||
- never
|
|
||||||
valid-jsdoc: 'off'
|
|
||||||
valid-typeof:
|
|
||||||
- error
|
|
||||||
- requireStringLiterals: false
|
|
||||||
vars-on-top: 'off'
|
|
||||||
wrap-iife: 'off'
|
|
||||||
wrap-regex: 'off'
|
|
||||||
yield-star-spacing: error
|
|
||||||
yoda: 'off'
|
|
||||||
|
|
||||||
# temporary rules
|
|
||||||
no-useless-escape: 'off'
|
|
||||||
no-unused-vars: 'off'
|
|
||||||
no-empty: 'off'
|
|
||||||
no-extra-semi: 'off'
|
|
||||||
no-redeclare: 'off'
|
|
||||||
no-control-regex: "off"
|
|
||||||
no-mixed-spaces-and-tabs: "off"
|
|
||||||
no-extra-boolean-cast: "off"
|
|
||||||
no-prototype-builtins: "off"
|
|
||||||
no-undef: "off"
|
|
||||||
no-unreachable: "off"
|
|
||||||
no-self-assign: "off"
|
|
||||||
38
.github/ISSUE_TEMPLATE/bug_report.md
vendored
Normal file
38
.github/ISSUE_TEMPLATE/bug_report.md
vendored
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
---
|
||||||
|
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.
|
||||||
|
|
||||||
|
**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
67
.github/ISSUE_TEMPLATE/bug_report.yml
vendored
@@ -1,67 +0,0 @@
|
|||||||
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:"
|
|
||||||
value: |
|
|
||||||
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
|
|
||||||
value: |
|
|
||||||
- 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
8
.github/ISSUE_TEMPLATE/config.yml
vendored
@@ -1,8 +0,0 @@
|
|||||||
blank_issues_enabled: false
|
|
||||||
contact_links:
|
|
||||||
- name: Discuss feature request
|
|
||||||
url: https://github.com/Jermolene/TiddlyWiki5/discussions
|
|
||||||
about: Open new discussion about new feature
|
|
||||||
- name: Talk.Tiddlywiki Forum
|
|
||||||
url: https://talk.tiddlywiki.org
|
|
||||||
about: Join the Forum
|
|
||||||
@@ -20,11 +20,3 @@ A clear and concise description of any alternative solutions or features you've
|
|||||||
Add any other context or screenshots about the feature request here.
|
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.
|
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)
|
|
||||||
|
|||||||
15
.github/workflows/ci.yml
vendored
15
.github/workflows/ci.yml
vendored
@@ -39,9 +39,9 @@ jobs:
|
|||||||
- name: "Set dynamic environment variables"
|
- name: "Set dynamic environment variables"
|
||||||
run: |
|
run: |
|
||||||
TW5_BUILD_BRANCH=$(echo $GITHUB_REF | awk 'BEGIN { FS = "/" } ; { print $3 }')
|
TW5_BUILD_BRANCH=$(echo $GITHUB_REF | awk 'BEGIN { FS = "/" } ; { print $3 }')
|
||||||
echo "TW5_BUILD_BRANCH=${TW5_BUILD_BRANCH}" >> $GITHUB_ENV
|
echo ::set-env name=TW5_BUILD_BRANCH::${TW5_BUILD_BRANCH}
|
||||||
echo "TW5_BUILD_VERSION=$(./bin/get-plugin-library-version-number)" >> $GITHUB_ENV
|
echo ::set-env name=TW5_BUILD_VERSION::$(./bin/get-plugin-library-version-number)
|
||||||
echo "TW5_BUILD_DETAILS=Prerelease built from branch '$TW5_BUILD_BRANCH' at commit $(git rev-parse HEAD) of $(git remote get-url origin) at $(date +'%F %T %Z')" >> $GITHUB_ENV
|
echo ::set-env name=TW5_BUILD_DETAILS::Prerelease built from branch \'$TW5_BUILD_BRANCH\' at commit $(git rev-parse HEAD) of $(git remote get-url origin) at $(date +'%F %T %Z')
|
||||||
- run: "./bin/build-site.sh"
|
- run: "./bin/build-site.sh"
|
||||||
- run: "./bin/ci-push.sh"
|
- run: "./bin/ci-push.sh"
|
||||||
env:
|
env:
|
||||||
@@ -65,13 +65,10 @@ jobs:
|
|||||||
- name: "Set dynamic environment variables"
|
- name: "Set dynamic environment variables"
|
||||||
run: |
|
run: |
|
||||||
TW5_BUILD_BRANCH=$(echo $GITHUB_REF | awk 'BEGIN { FS = "/" } ; { print $3 }')
|
TW5_BUILD_BRANCH=$(echo $GITHUB_REF | awk 'BEGIN { FS = "/" } ; { print $3 }')
|
||||||
echo "TW5_BUILD_BRANCH=${TW5_BUILD_BRANCH}" >> $GITHUB_ENV
|
echo ::set-env name=TW5_BUILD_BRANCH::${TW5_BUILD_BRANCH}
|
||||||
echo "TW5_BUILD_VERSION=$(./bin/get-plugin-library-version-number)" >> $GITHUB_ENV
|
echo ::set-env name=TW5_BUILD_VERSION::$(./bin/get-plugin-library-version-number)
|
||||||
echo "TW5_BUILD_DETAILS=Built from branch '$TW5_BUILD_BRANCH' at commit $(git rev-parse HEAD) of $(git remote get-url origin) at $(date +'%F %T %Z')" >> $GITHUB_ENV
|
echo ::set-env name=TW5_BUILD_DETAILS::Built from branch \'$TW5_BUILD_BRANCH\' at commit $(git rev-parse HEAD) of $(git remote get-url origin) at $(date +'%F %T %Z')
|
||||||
- run: "./bin/build-site.sh"
|
- run: "./bin/build-site.sh"
|
||||||
- run: "./bin/ci-push.sh"
|
- run: "./bin/ci-push.sh"
|
||||||
env:
|
env:
|
||||||
GH_TOKEN: ${{ secrets.GITHUBPUSHTOKEN }}
|
GH_TOKEN: ${{ secrets.GITHUBPUSHTOKEN }}
|
||||||
- run: "./bin/build-tw-org.sh"
|
|
||||||
env:
|
|
||||||
GH_TOKEN: ${{ secrets.GITHUBPUSHTOKEN }}
|
|
||||||
|
|||||||
2
.gitignore
vendored
2
.gitignore
vendored
@@ -1,7 +1,5 @@
|
|||||||
.DS_Store
|
.DS_Store
|
||||||
.c9/
|
.c9/
|
||||||
.vscode/
|
|
||||||
tmp/
|
tmp/
|
||||||
output/
|
output/
|
||||||
node_modules/
|
node_modules/
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
# Default to the current version number for building the plugin library
|
# Default to the current version number for building the plugin library
|
||||||
|
|
||||||
if [ -z "$TW5_BUILD_VERSION" ]; then
|
if [ -z "$TW5_BUILD_VERSION" ]; then
|
||||||
TW5_BUILD_VERSION=v5.2.8
|
TW5_BUILD_VERSION=v5.1.23
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Using TW5_BUILD_VERSION as [$TW5_BUILD_VERSION]"
|
echo "Using TW5_BUILD_VERSION as [$TW5_BUILD_VERSION]"
|
||||||
@@ -107,7 +107,7 @@ node $TW5_BUILD_TIDDLYWIKI \
|
|||||||
# /empty.html Empty
|
# /empty.html Empty
|
||||||
# /empty.hta For Internet Explorer
|
# /empty.hta For Internet Explorer
|
||||||
node $TW5_BUILD_TIDDLYWIKI \
|
node $TW5_BUILD_TIDDLYWIKI \
|
||||||
$TW5_BUILD_MAIN_EDITION \
|
./editions/empty \
|
||||||
--verbose \
|
--verbose \
|
||||||
--output $TW5_BUILD_OUTPUT \
|
--output $TW5_BUILD_OUTPUT \
|
||||||
--build empty \
|
--build empty \
|
||||||
@@ -233,15 +233,6 @@ node $TW5_BUILD_TIDDLYWIKI \
|
|||||||
--build index \
|
--build index \
|
||||||
|| exit 1
|
|| exit 1
|
||||||
|
|
||||||
# /editions/twitter-archivist/index.html Twitter Archivist edition
|
|
||||||
node $TW5_BUILD_TIDDLYWIKI \
|
|
||||||
./editions/twitter-archivist \
|
|
||||||
--verbose \
|
|
||||||
--load $TW5_BUILD_OUTPUT/build.tid \
|
|
||||||
--output $TW5_BUILD_OUTPUT/editions/twitter-archivist/ \
|
|
||||||
--build index \
|
|
||||||
|| exit 1
|
|
||||||
|
|
||||||
######################################################
|
######################################################
|
||||||
#
|
#
|
||||||
# Plugin demos
|
# Plugin demos
|
||||||
@@ -359,14 +350,14 @@ node $TW5_BUILD_TIDDLYWIKI \
|
|||||||
|
|
||||||
# Delete any existing static content
|
# Delete any existing static content
|
||||||
|
|
||||||
rm -rf $TW5_BUILD_OUTPUT/languages/de-AT/static/*
|
rm $TW5_BUILD_OUTPUT/languages/de-AT/static/*
|
||||||
rm -rf $TW5_BUILD_OUTPUT/languages/de-DE/static/*
|
rm $TW5_BUILD_OUTPUT/languages/de-DE/static/*
|
||||||
rm -rf $TW5_BUILD_OUTPUT/languages/es-ES/static/*
|
rm $TW5_BUILD_OUTPUT/languages/es-ES/static/*
|
||||||
rm -rf $TW5_BUILD_OUTPUT/languages/fr-FR/static/*
|
rm $TW5_BUILD_OUTPUT/languages/fr-FR/static/*
|
||||||
rm -rf $TW5_BUILD_OUTPUT/languages/ja-JP/static/*
|
rm $TW5_BUILD_OUTPUT/languages/ja-JP/static/*
|
||||||
rm -rf $TW5_BUILD_OUTPUT/languages/ko-KR/static/*
|
rm $TW5_BUILD_OUTPUT/languages/ko-KR/static/*
|
||||||
rm -rf $TW5_BUILD_OUTPUT/languages/zh-Hans/static/*
|
rm $TW5_BUILD_OUTPUT/languages/zh-Hans/static/*
|
||||||
rm -rf $TW5_BUILD_OUTPUT/languages/zh-Hant/static/*
|
rm $TW5_BUILD_OUTPUT/languages/zh-Hant/static/*
|
||||||
|
|
||||||
# /languages/de-AT/index.html Demo wiki with de-AT language
|
# /languages/de-AT/index.html Demo wiki with de-AT language
|
||||||
# /languages/de-AT/empty.html Empty wiki with de-AT language
|
# /languages/de-AT/empty.html Empty wiki with de-AT language
|
||||||
@@ -459,7 +450,7 @@ node $TW5_BUILD_TIDDLYWIKI \
|
|||||||
--verbose \
|
--verbose \
|
||||||
--load $TW5_BUILD_OUTPUT/build.tid \
|
--load $TW5_BUILD_OUTPUT/build.tid \
|
||||||
--output $TW5_BUILD_OUTPUT/library/$TW5_BUILD_VERSION \
|
--output $TW5_BUILD_OUTPUT/library/$TW5_BUILD_VERSION \
|
||||||
--build library\
|
--build \
|
||||||
|| exit 1
|
|| exit 1
|
||||||
|
|
||||||
# Delete the temporary build tiddler
|
# Delete the temporary build tiddler
|
||||||
|
|||||||
@@ -1,97 +0,0 @@
|
|||||||
#!/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
|
|
||||||
@@ -2,14 +2,19 @@
|
|||||||
|
|
||||||
# Push output back to GitHub
|
# Push output back to GitHub
|
||||||
|
|
||||||
# Exit script immediately if any command fails
|
|
||||||
set -e
|
|
||||||
|
|
||||||
cd output
|
cd output || exit 1
|
||||||
git config --global user.email "actions@github.com"
|
|
||||||
git config --global user.name "GitHub Actions"
|
git config --global user.email "actions@github.com" || exit 1
|
||||||
git add -A .
|
|
||||||
git commit --message "GitHub build: $GITHUB_RUN_NUMBER of $TW5_BUILD_BRANCH ($(date +'%F %T %Z'))"
|
git config --global user.name "GitHub Actions" || exit 1
|
||||||
git remote add deploy "https://$GH_TOKEN@github.com/Jermolene/jermolene.github.io.git" &>/dev/null
|
|
||||||
git push deploy master &>/dev/null
|
git add -A . || exit 1
|
||||||
cd ..
|
|
||||||
|
git commit --message "GitHub build: $GITHUB_RUN_NUMBER of $TW5_BUILD_BRANCH ($(date +'%F %T %Z'))" || exit 1
|
||||||
|
|
||||||
|
git remote add deploy "https://$GH_TOKEN@github.com/Jermolene/jermolene.github.io.git" &>/dev/null || exit 1
|
||||||
|
|
||||||
|
git push deploy master &>/dev/null || exit 1
|
||||||
|
|
||||||
|
cd .. || exit 1
|
||||||
|
|||||||
@@ -2,4 +2,4 @@
|
|||||||
|
|
||||||
# Remove any output files
|
# Remove any output files
|
||||||
|
|
||||||
find . -regex "^./editions/.*/output/.*" -delete
|
find . -regex "^./editions/[a-z0-9\.-]*/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:
|
Install SVGO with the following command in the root of the repo:
|
||||||
|
|
||||||
npm install svgo@2.3.0
|
npm install svgo
|
||||||
*/
|
*/
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
var fs = require("fs"),
|
var fs = require("fs"),
|
||||||
path = require("path"),
|
path = require("path"),
|
||||||
{ optimize } = require("svgo"),
|
SVGO = require("svgo"),
|
||||||
config = {
|
svgo = new SVGO({
|
||||||
plugins: [
|
plugins: [
|
||||||
'cleanupAttrs',
|
{cleanupAttrs: true},
|
||||||
'removeDoctype',
|
{removeDoctype: true},
|
||||||
'removeXMLProcInst',
|
{removeXMLProcInst: true},
|
||||||
'removeComments',
|
{removeComments: true},
|
||||||
'removeMetadata',
|
{removeMetadata: true},
|
||||||
'removeTitle',
|
{removeTitle: true},
|
||||||
'removeDesc',
|
{removeDesc: true},
|
||||||
'removeUselessDefs',
|
{removeUselessDefs: true},
|
||||||
'removeEditorsNSData',
|
{removeEditorsNSData: true},
|
||||||
'removeEmptyAttrs',
|
{removeEmptyAttrs: true},
|
||||||
'removeHiddenElems',
|
{removeHiddenElems: true},
|
||||||
'removeEmptyText',
|
{removeEmptyText: true},
|
||||||
'removeEmptyContainers',
|
{removeEmptyContainers: true},
|
||||||
// 'removeViewBox',
|
{removeViewBox: false},
|
||||||
'cleanupEnableBackground',
|
{cleanupEnableBackground: true},
|
||||||
'convertStyleToAttrs',
|
{convertStyleToAttrs: true},
|
||||||
'convertColors',
|
{convertColors: true},
|
||||||
'convertPathData',
|
{convertPathData: true},
|
||||||
'convertTransform',
|
{convertTransform: true},
|
||||||
'removeUnknownsAndDefaults',
|
{removeUnknownsAndDefaults: true},
|
||||||
'removeNonInheritableGroupAttrs',
|
{removeNonInheritableGroupAttrs: true},
|
||||||
'removeUselessStrokeAndFill',
|
{removeUselessStrokeAndFill: true},
|
||||||
'removeUnusedNS',
|
{removeUnusedNS: true},
|
||||||
'cleanupIDs',
|
{cleanupIDs: true},
|
||||||
'cleanupNumericValues',
|
{cleanupNumericValues: true},
|
||||||
'moveElemsAttrsToGroup',
|
{moveElemsAttrsToGroup: true},
|
||||||
'moveGroupAttrsToElems',
|
{moveGroupAttrsToElems: true},
|
||||||
'collapseGroups',
|
{collapseGroups: true},
|
||||||
// 'removeRasterImages',
|
{removeRasterImages: false},
|
||||||
'mergePaths',
|
{mergePaths: true},
|
||||||
'convertShapeToPath',
|
{convertShapeToPath: true},
|
||||||
'sortAttrs',
|
{sortAttrs: true},
|
||||||
//'removeDimensions',
|
{removeDimensions: false},
|
||||||
{name: 'removeAttrs', params: { attrs: '(stroke|fill)' } }
|
{removeAttrs: {attrs: "(stroke|fill)"}}
|
||||||
]
|
]
|
||||||
};
|
});
|
||||||
|
|
||||||
var basepath = "./core/images/",
|
var basepath = "./core/images/",
|
||||||
files = fs.readdirSync(basepath).sort();
|
files = fs.readdirSync(basepath).sort();
|
||||||
@@ -66,14 +66,12 @@ files.forEach(function(filename) {
|
|||||||
fakeSVG = body.join("\n");
|
fakeSVG = body.join("\n");
|
||||||
// A hack to make the new-journal-button work
|
// A hack to make the new-journal-button work
|
||||||
fakeSVG = fakeSVG.replace("<<now \"DD\">>","<<now "DD">>");
|
fakeSVG = fakeSVG.replace("<<now \"DD\">>","<<now "DD">>");
|
||||||
config.path = filepath;
|
svgo.optimize(fakeSVG, {path: filepath}).then(function(result) {
|
||||||
var result = optimize(fakeSVG,config);
|
|
||||||
if(result) {
|
|
||||||
var newSVG = header.join("\n") + "\n\n" + result.data.replace("<<now "DD">>","<<now \"DD\">>");
|
var newSVG = header.join("\n") + "\n\n" + result.data.replace("<<now "DD">>","<<now \"DD\">>");
|
||||||
fs.writeFileSync(filepath,newSVG);
|
fs.writeFileSync(filepath,newSVG);
|
||||||
} else {
|
},function(err) {
|
||||||
console.log("Error " + err + " with " + filename)
|
console.log("Error " + err + " with " + filename)
|
||||||
process.exit();
|
process.exit();
|
||||||
};
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ node ./tiddlywiki.js \
|
|||||||
--verbose \
|
--verbose \
|
||||||
--version \
|
--version \
|
||||||
--rendertiddler $:/core/save/all test.html text/plain \
|
--rendertiddler $:/core/save/all test.html text/plain \
|
||||||
--test \
|
|
||||||
|| exit 1
|
|| exit 1
|
||||||
|
|
||||||
echo To run the tests in a browser, open "editions/test/output/test.html"
|
echo To run the tests in a browser, open "editions/test/output/test.html"
|
||||||
|
|||||||
343
boot/boot.js
343
boot/boot.js
@@ -68,26 +68,6 @@ $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
|
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)
|
array: array to modify (assumed to be free of duplicates)
|
||||||
@@ -276,28 +256,6 @@ $tw.utils.deepDefaults = function(object /*, sourceObjectList */) {
|
|||||||
return object;
|
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 "
|
Convert "&" to &, " " to nbsp, "<" to <, ">" to > and """ to "
|
||||||
*/
|
*/
|
||||||
@@ -309,16 +267,8 @@ $tw.utils.htmlDecode = function(s) {
|
|||||||
Get the browser location.hash. We don't use location.hash because of the way that Firefox auto-urldecodes it (see http://stackoverflow.com/questions/1703552/encoding-of-window-location-hash)
|
Get the browser location.hash. We don't use location.hash because of the way that Firefox auto-urldecodes it (see http://stackoverflow.com/questions/1703552/encoding-of-window-location-hash)
|
||||||
*/
|
*/
|
||||||
$tw.utils.getLocationHash = function() {
|
$tw.utils.getLocationHash = function() {
|
||||||
var href = window.location.href;
|
var parts = window.location.href.split('#');
|
||||||
var idx = href.indexOf('#');
|
return "#" + (parts.length > 1 ? parts[1] : "");
|
||||||
if(idx === -1) {
|
|
||||||
return "#";
|
|
||||||
} 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 {
|
|
||||||
return href.substring(idx);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -347,21 +297,13 @@ $tw.utils.stringifyDate = function(value) {
|
|||||||
// Parse a date from a UTC YYYYMMDDHHMMSSmmm format string
|
// Parse a date from a UTC YYYYMMDDHHMMSSmmm format string
|
||||||
$tw.utils.parseDate = function(value) {
|
$tw.utils.parseDate = function(value) {
|
||||||
if(typeof value === "string") {
|
if(typeof value === "string") {
|
||||||
var negative = 1;
|
return new Date(Date.UTC(parseInt(value.substr(0,4),10),
|
||||||
if(value.charAt(0) === "-") {
|
|
||||||
negative = -1;
|
|
||||||
value = value.substr(1);
|
|
||||||
}
|
|
||||||
var year = parseInt(value.substr(0,4),10) * negative,
|
|
||||||
d = new Date(Date.UTC(year,
|
|
||||||
parseInt(value.substr(4,2),10)-1,
|
parseInt(value.substr(4,2),10)-1,
|
||||||
parseInt(value.substr(6,2),10),
|
parseInt(value.substr(6,2),10),
|
||||||
parseInt(value.substr(8,2)||"00",10),
|
parseInt(value.substr(8,2)||"00",10),
|
||||||
parseInt(value.substr(10,2)||"00",10),
|
parseInt(value.substr(10,2)||"00",10),
|
||||||
parseInt(value.substr(12,2)||"00",10),
|
parseInt(value.substr(12,2)||"00",10),
|
||||||
parseInt(value.substr(14,3)||"000",10)));
|
parseInt(value.substr(14,3)||"000",10)));
|
||||||
d.setUTCFullYear(year); // See https://stackoverflow.com/a/5870822
|
|
||||||
return d;
|
|
||||||
} else if($tw.utils.isDate(value)) {
|
} else if($tw.utils.isDate(value)) {
|
||||||
return value;
|
return value;
|
||||||
} else {
|
} else {
|
||||||
@@ -375,7 +317,7 @@ $tw.utils.stringifyList = function(value) {
|
|||||||
var result = new Array(value.length);
|
var result = new Array(value.length);
|
||||||
for(var t=0, l=value.length; t<l; t++) {
|
for(var t=0, l=value.length; t<l; t++) {
|
||||||
var entry = value[t] || "";
|
var entry = value[t] || "";
|
||||||
if(entry.match(/[^\S\xA0]/mg)) {
|
if(entry.indexOf(" ") !== -1) {
|
||||||
result[t] = "[[" + entry + "]]";
|
result[t] = "[[" + entry + "]]";
|
||||||
} else {
|
} else {
|
||||||
result[t] = entry;
|
result[t] = entry;
|
||||||
@@ -429,19 +371,6 @@ $tw.utils.parseFields = function(text,fields) {
|
|||||||
return 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.
|
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
|
In relative paths, the special folder name `..` refers to immediate parent directory, and the
|
||||||
@@ -550,6 +479,31 @@ $tw.utils.registerFileType = function(type,encoding,extension,options) {
|
|||||||
$tw.config.contentTypeInfo[type] = {encoding: encoding, extension: extension, flags: options.flags || [], deserializerType: options.deserializerType || type};
|
$tw.config.contentTypeInfo[type] = {encoding: encoding, extension: extension, flags: options.flags || [], deserializerType: options.deserializerType || type};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
Parses a content type of the form "type/subtype; attribute=value", as per https://www.w3.org/Protocols/rfc1341/4_Content-Type.html
|
||||||
|
Returns an array of [type/subtype,attribute,value], with the last two entries being optional
|
||||||
|
*/
|
||||||
|
$tw.utils.parseContentType = function(contentType) {
|
||||||
|
contentType = contentType || "";
|
||||||
|
var parts = contentType.split(";"),
|
||||||
|
results = [(parts[0] || "").trim()];
|
||||||
|
if(parts[1]) {
|
||||||
|
parts = parts[1].split("=");
|
||||||
|
if(parts[0]) {
|
||||||
|
results[1] = (parts[0] || "").trim();
|
||||||
|
results[2] = (parts[1] || "").trim();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return results;
|
||||||
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
Returns the contentTypeInfo for a type
|
||||||
|
*/
|
||||||
|
$tw.utils.getContentTypeInfo = function(contentType) {
|
||||||
|
return $tw.config.contentTypeInfo[$tw.utils.parseContentType(contentType)[0]] || null;
|
||||||
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Given an extension, always access the $tw.config.fileExtensionInfo
|
Given an extension, always access the $tw.config.fileExtensionInfo
|
||||||
using a lowercase extension only.
|
using a lowercase extension only.
|
||||||
@@ -723,13 +677,11 @@ $tw.utils.PasswordPrompt.prototype.createPrompt = function(options) {
|
|||||||
var promptInfo = {
|
var promptInfo = {
|
||||||
serviceName: options.serviceName,
|
serviceName: options.serviceName,
|
||||||
callback: options.callback,
|
callback: options.callback,
|
||||||
form: form,
|
form: form
|
||||||
owner: this
|
|
||||||
};
|
};
|
||||||
this.passwordPrompts.push(promptInfo);
|
this.passwordPrompts.push(promptInfo);
|
||||||
// Make sure the wrapper is displayed
|
// Make sure the wrapper is displayed
|
||||||
this.setWrapperDisplay();
|
this.setWrapperDisplay();
|
||||||
return promptInfo;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
$tw.utils.PasswordPrompt.prototype.removePrompt = function(promptInfo) {
|
$tw.utils.PasswordPrompt.prototype.removePrompt = function(promptInfo) {
|
||||||
@@ -947,19 +899,6 @@ $tw.modules.applyMethods = function(moduleType,targetObject) {
|
|||||||
return targetObject;
|
return targetObject;
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
|
||||||
Return a class created from a modules. The module should export the properties to be added to those of the optional base class
|
|
||||||
*/
|
|
||||||
$tw.modules.createClassFromModule = function(moduleExports,baseClass) {
|
|
||||||
var newClass = function() {};
|
|
||||||
if(baseClass) {
|
|
||||||
newClass.prototype = new baseClass();
|
|
||||||
newClass.prototype.constructor = baseClass;
|
|
||||||
}
|
|
||||||
$tw.utils.extend(newClass.prototype,moduleExports);
|
|
||||||
return newClass;
|
|
||||||
};
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Return an array of classes created from the modules of a specified type. Each module should export the properties to be added to those of the optional base class
|
Return an array of classes created from the modules of a specified type. Each module should export the properties to be added to those of the optional base class
|
||||||
*/
|
*/
|
||||||
@@ -967,7 +906,13 @@ $tw.modules.createClassesFromModules = function(moduleType,subType,baseClass) {
|
|||||||
var classes = Object.create(null);
|
var classes = Object.create(null);
|
||||||
$tw.modules.forEachModuleOfType(moduleType,function(title,moduleExports) {
|
$tw.modules.forEachModuleOfType(moduleType,function(title,moduleExports) {
|
||||||
if(!subType || moduleExports.types[subType]) {
|
if(!subType || moduleExports.types[subType]) {
|
||||||
classes[moduleExports.name] = $tw.modules.createClassFromModule(moduleExports,baseClass);
|
var newClass = function() {};
|
||||||
|
if(baseClass) {
|
||||||
|
newClass.prototype = new baseClass();
|
||||||
|
newClass.prototype.constructor = baseClass;
|
||||||
|
}
|
||||||
|
$tw.utils.extend(newClass.prototype,moduleExports);
|
||||||
|
classes[moduleExports.name] = newClass;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return classes;
|
return classes;
|
||||||
@@ -1114,7 +1059,7 @@ $tw.Wiki = function(options) {
|
|||||||
tiddlerTitles = null, // Array of tiddler titles
|
tiddlerTitles = null, // Array of tiddler titles
|
||||||
getTiddlerTitles = function() {
|
getTiddlerTitles = function() {
|
||||||
if(!tiddlerTitles) {
|
if(!tiddlerTitles) {
|
||||||
tiddlerTitles = Object.keys(tiddlers).sort(function(a,b) {return a.localeCompare(b);});
|
tiddlerTitles = Object.keys(tiddlers);
|
||||||
}
|
}
|
||||||
return tiddlerTitles;
|
return tiddlerTitles;
|
||||||
},
|
},
|
||||||
@@ -1167,8 +1112,10 @@ $tw.Wiki = function(options) {
|
|||||||
}
|
}
|
||||||
// Save the new tiddler
|
// Save the new tiddler
|
||||||
tiddlers[title] = tiddler;
|
tiddlers[title] = tiddler;
|
||||||
// Check we've got the title
|
// Check we've got it's title
|
||||||
tiddlerTitles = $tw.utils.insertSortedArray(tiddlerTitles || [],title);
|
if(tiddlerTitles && tiddlerTitles.indexOf(title) === -1) {
|
||||||
|
tiddlerTitles.push(title);
|
||||||
|
}
|
||||||
// Record the new tiddler state
|
// Record the new tiddler state
|
||||||
updateDescriptor["new"] = {
|
updateDescriptor["new"] = {
|
||||||
tiddler: tiddler,
|
tiddler: tiddler,
|
||||||
@@ -1207,7 +1154,7 @@ $tw.Wiki = function(options) {
|
|||||||
var index = tiddlerTitles.indexOf(title);
|
var index = tiddlerTitles.indexOf(title);
|
||||||
if(index !== -1) {
|
if(index !== -1) {
|
||||||
tiddlerTitles.splice(index,1);
|
tiddlerTitles.splice(index,1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Record the new tiddler state
|
// Record the new tiddler state
|
||||||
updateDescriptor["new"] = {
|
updateDescriptor["new"] = {
|
||||||
@@ -1230,16 +1177,13 @@ $tw.Wiki = function(options) {
|
|||||||
this.getTiddler = function(title) {
|
this.getTiddler = function(title) {
|
||||||
if(title) {
|
if(title) {
|
||||||
var t = tiddlers[title];
|
var t = tiddlers[title];
|
||||||
if(t !== undefined) {
|
if(t instanceof $tw.Tiddler) {
|
||||||
return t;
|
return t;
|
||||||
} else {
|
} else if(title !== undefined && shadowTiddlers[title]) {
|
||||||
var s = shadowTiddlers[title];
|
return shadowTiddlers[title].tiddler;
|
||||||
if(s !== undefined) {
|
|
||||||
return s.tiddler;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
return undefined;
|
||||||
}
|
}
|
||||||
return undefined;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// Get an array of all tiddler titles
|
// Get an array of all tiddler titles
|
||||||
@@ -1268,12 +1212,8 @@ $tw.Wiki = function(options) {
|
|||||||
index,titlesLength,title;
|
index,titlesLength,title;
|
||||||
for(index = 0, titlesLength = titles.length; index < titlesLength; index++) {
|
for(index = 0, titlesLength = titles.length; index < titlesLength; index++) {
|
||||||
title = titles[index];
|
title = titles[index];
|
||||||
if(tiddlers[title]) {
|
var shadowInfo = shadowTiddlers[title];
|
||||||
callback(tiddlers[title],title);
|
callback(shadowInfo.tiddler,title);
|
||||||
} else {
|
|
||||||
var shadowInfo = shadowTiddlers[title];
|
|
||||||
callback(shadowInfo.tiddler,title);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -1355,13 +1295,13 @@ $tw.Wiki = function(options) {
|
|||||||
$tw.utils.each(titles || getTiddlerTitles(),function(title) {
|
$tw.utils.each(titles || getTiddlerTitles(),function(title) {
|
||||||
var tiddler = tiddlers[title];
|
var tiddler = tiddlers[title];
|
||||||
if(tiddler) {
|
if(tiddler) {
|
||||||
if(tiddler.fields.type === "application/json" && tiddler.hasField("plugin-type") && tiddler.fields.text) {
|
if(tiddler.fields.type === "application/json" && tiddler.hasField("plugin-type")) {
|
||||||
pluginInfo[tiddler.fields.title] = $tw.utils.parseJSONSafe(tiddler.fields.text);
|
pluginInfo[tiddler.fields.title] = JSON.parse(tiddler.fields.text);
|
||||||
results.modifiedPlugins.push(tiddler.fields.title);
|
results.modifiedPlugins.push(tiddler.fields.title);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if(pluginInfo[title]) {
|
if(pluginInfo[title]) {
|
||||||
delete pluginInfo[title];
|
delete pluginInfo[title];
|
||||||
results.deletedPlugins.push(title);
|
results.deletedPlugins.push(title);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1489,7 +1429,7 @@ $tw.Wiki.prototype.defineTiddlerModules = function() {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case "application/json":
|
case "application/json":
|
||||||
$tw.modules.define(tiddler.fields.title,tiddler.fields["module-type"],$tw.utils.parseJSONSafe(tiddler.fields.text));
|
$tw.modules.define(tiddler.fields.title,tiddler.fields["module-type"],JSON.parse(tiddler.fields.text));
|
||||||
break;
|
break;
|
||||||
case "application/x-tiddler-dictionary":
|
case "application/x-tiddler-dictionary":
|
||||||
$tw.modules.define(tiddler.fields.title,tiddler.fields["module-type"],$tw.utils.parseFields(tiddler.fields.text));
|
$tw.modules.define(tiddler.fields.title,tiddler.fields["module-type"],$tw.utils.parseFields(tiddler.fields.text));
|
||||||
@@ -1548,6 +1488,7 @@ $tw.Wiki.prototype.processSafeMode = function() {
|
|||||||
Extracts tiddlers from a typed block of text, specifying default field values
|
Extracts tiddlers from a typed block of text, specifying default field values
|
||||||
*/
|
*/
|
||||||
$tw.Wiki.prototype.deserializeTiddlers = function(type,text,srcFields,options) {
|
$tw.Wiki.prototype.deserializeTiddlers = function(type,text,srcFields,options) {
|
||||||
|
type = $tw.utils.parseContentType(type)[0];
|
||||||
srcFields = srcFields || Object.create(null);
|
srcFields = srcFields || Object.create(null);
|
||||||
options = options || {};
|
options = options || {};
|
||||||
var deserializer = $tw.Wiki.tiddlerDeserializerModules[options.deserializer],
|
var deserializer = $tw.Wiki.tiddlerDeserializerModules[options.deserializer],
|
||||||
@@ -1662,8 +1603,8 @@ $tw.modules.define("$:/boot/tiddlerdeserializer/json","tiddlerdeserializer",{
|
|||||||
}
|
}
|
||||||
for(var f in data) {
|
for(var f in data) {
|
||||||
if($tw.utils.hop(data,f)) {
|
if($tw.utils.hop(data,f)) {
|
||||||
// Check field name doesn't contain control characters
|
// Check field name doesn't contain whitespace or control characters
|
||||||
if(typeof(data[f]) !== "string" || /[\x00-\x1F]/.test(f)) {
|
if(typeof(data[f]) !== "string" || /[\x00-\x1F\s]/.test(f)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1678,7 +1619,7 @@ $tw.modules.define("$:/boot/tiddlerdeserializer/json","tiddlerdeserializer",{
|
|||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
data = $tw.utils.parseJSONSafe(text);
|
data = JSON.parse(text);
|
||||||
if($tw.utils.isArray(data) && isTiddlerArrayValid(data)) {
|
if($tw.utils.isArray(data) && isTiddlerArrayValid(data)) {
|
||||||
return data;
|
return data;
|
||||||
} else if(isTiddlerValid(data)) {
|
} else if(isTiddlerValid(data)) {
|
||||||
@@ -1718,7 +1659,7 @@ $tw.boot.decryptEncryptedTiddlers = function(callback) {
|
|||||||
$tw.crypto.setPassword(data.password);
|
$tw.crypto.setPassword(data.password);
|
||||||
var decryptedText = $tw.crypto.decrypt(encryptedText);
|
var decryptedText = $tw.crypto.decrypt(encryptedText);
|
||||||
if(decryptedText) {
|
if(decryptedText) {
|
||||||
var json = $tw.utils.parseJSONSafe(decryptedText);
|
var json = JSON.parse(decryptedText);
|
||||||
for(var title in json) {
|
for(var title in json) {
|
||||||
$tw.preloadTiddler(json[title]);
|
$tw.preloadTiddler(json[title]);
|
||||||
}
|
}
|
||||||
@@ -1784,20 +1725,13 @@ $tw.modules.define("$:/boot/tiddlerdeserializer/dom","tiddlerdeserializer",{
|
|||||||
},
|
},
|
||||||
t,result = [];
|
t,result = [];
|
||||||
if(node) {
|
if(node) {
|
||||||
var type = (node.getAttribute && node.getAttribute("type")) || null;
|
for(t = 0; t < node.childNodes.length; t++) {
|
||||||
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],
|
var childNode = node.childNodes[t],
|
||||||
tiddlers = extractTextTiddlers(childNode);
|
tiddlers = extractTextTiddlers(childNode);
|
||||||
tiddlers = tiddlers || extractModuleTiddlers(childNode);
|
tiddlers = tiddlers || extractModuleTiddlers(childNode);
|
||||||
if(tiddlers) {
|
if(tiddlers) {
|
||||||
result.push.apply(result,tiddlers);
|
result.push.apply(result,tiddlers);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
@@ -1806,23 +1740,17 @@ $tw.modules.define("$:/boot/tiddlerdeserializer/dom","tiddlerdeserializer",{
|
|||||||
|
|
||||||
$tw.loadTiddlersBrowser = function() {
|
$tw.loadTiddlersBrowser = function() {
|
||||||
// In the browser, we load tiddlers from certain elements
|
// In the browser, we load tiddlers from certain elements
|
||||||
var containerSelectors = [
|
var containerIds = [
|
||||||
// IDs for old-style v5.1.x tiddler stores
|
"libraryModules",
|
||||||
"#libraryModules",
|
"modules",
|
||||||
"#modules",
|
"bootKernelPrefix",
|
||||||
"#bootKernelPrefix",
|
"bootKernel",
|
||||||
"#bootKernel",
|
"styleArea",
|
||||||
"#styleArea",
|
"storeArea",
|
||||||
"#storeArea",
|
"systemArea"
|
||||||
"#systemArea",
|
|
||||||
// Classes for new-style v5.2.x JSON tiddler stores
|
|
||||||
"script.tiddlywiki-tiddler-store"
|
|
||||||
];
|
];
|
||||||
for(var t=0; t<containerSelectors.length; t++) {
|
for(var t=0; t<containerIds.length; t++) {
|
||||||
var nodes = document.querySelectorAll(containerSelectors[t]);
|
$tw.wiki.addTiddlers($tw.wiki.deserializeTiddlers("(DOM)",document.getElementById(containerIds[t])));
|
||||||
for(var n=0; n<nodes.length; n++) {
|
|
||||||
$tw.wiki.addTiddlers($tw.wiki.deserializeTiddlers("(DOM)",nodes[n]));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -1881,7 +1809,7 @@ A default set of files for TiddlyWiki to ignore during load.
|
|||||||
This matches what NPM ignores, and adds "*.meta" to ignore tiddler
|
This matches what NPM ignores, and adds "*.meta" to ignore tiddler
|
||||||
metadata files.
|
metadata files.
|
||||||
*/
|
*/
|
||||||
$tw.boot.excludeRegExp = /^\.DS_Store$|^.*\.meta$|^\..*\.swp$|^\._.*$|^\.git$|^\.github$|^\.vscode$|^\.hg$|^\.lock-wscript$|^\.svn$|^\.wafpickle-.*$|^CVS$|^npm-debug\.log$/;
|
$tw.boot.excludeRegExp = /^\.DS_Store$|^.*\.meta$|^\..*\.swp$|^\._.*$|^\.git$|^\.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.
|
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.
|
||||||
@@ -1918,9 +1846,9 @@ filepath: pathname of the directory containing the specification file
|
|||||||
$tw.loadTiddlersFromSpecification = function(filepath,excludeRegExp) {
|
$tw.loadTiddlersFromSpecification = function(filepath,excludeRegExp) {
|
||||||
var tiddlers = [];
|
var tiddlers = [];
|
||||||
// Read the specification
|
// Read the specification
|
||||||
var filesInfo = $tw.utils.parseJSONSafe(fs.readFileSync(filepath + path.sep + "tiddlywiki.files","utf8"));
|
var filesInfo = JSON.parse(fs.readFileSync(filepath + path.sep + "tiddlywiki.files","utf8"));
|
||||||
// Helper to process a file
|
// Helper to process a file
|
||||||
var processFile = function(filename,isTiddlerFile,fields,isEditableFile,rootPath) {
|
var processFile = function(filename,isTiddlerFile,fields) {
|
||||||
var extInfo = $tw.config.fileExtensionInfo[path.extname(filename)],
|
var extInfo = $tw.config.fileExtensionInfo[path.extname(filename)],
|
||||||
type = (extInfo || {}).type || fields.type || "text/plain",
|
type = (extInfo || {}).type || fields.type || "text/plain",
|
||||||
typeInfo = $tw.config.contentTypeInfo[type] || {},
|
typeInfo = $tw.config.contentTypeInfo[type] || {},
|
||||||
@@ -1941,23 +1869,17 @@ $tw.loadTiddlersFromSpecification = function(filepath,excludeRegExp) {
|
|||||||
} else {
|
} else {
|
||||||
var value = tiddler[name];
|
var value = tiddler[name];
|
||||||
switch(fieldInfo.source) {
|
switch(fieldInfo.source) {
|
||||||
case "subdirectories":
|
|
||||||
value = path.relative(rootPath, filename).split('/').slice(0, -1);
|
|
||||||
break;
|
|
||||||
case "filepath":
|
|
||||||
value = path.relative(rootPath, filename);
|
|
||||||
break;
|
|
||||||
case "filename":
|
case "filename":
|
||||||
value = path.basename(filename);
|
value = path.basename(filename);
|
||||||
break;
|
break;
|
||||||
case "filename-uri-decoded":
|
case "filename-uri-decoded":
|
||||||
value = $tw.utils.decodeURIComponentSafe(path.basename(filename));
|
value = decodeURIComponent(path.basename(filename));
|
||||||
break;
|
break;
|
||||||
case "basename":
|
case "basename":
|
||||||
value = path.basename(filename,path.extname(filename));
|
value = path.basename(filename,path.extname(filename));
|
||||||
break;
|
break;
|
||||||
case "basename-uri-decoded":
|
case "basename-uri-decoded":
|
||||||
value = $tw.utils.decodeURIComponentSafe(path.basename(filename,path.extname(filename)));
|
value = decodeURIComponent(path.basename(filename,path.extname(filename)));
|
||||||
break;
|
break;
|
||||||
case "extname":
|
case "extname":
|
||||||
value = path.extname(filename);
|
value = path.extname(filename);
|
||||||
@@ -1979,26 +1901,8 @@ $tw.loadTiddlersFromSpecification = function(filepath,excludeRegExp) {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
if(isEditableFile) {
|
tiddlers.push({tiddlers: fileTiddlers});
|
||||||
tiddlers.push({filepath: pathname, hasMetaFile: !!metadata && !isTiddlerFile, isEditableFile: true, tiddlers: fileTiddlers});
|
|
||||||
} else {
|
|
||||||
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
|
// Process the listed tiddlers
|
||||||
$tw.utils.each(filesInfo.tiddlers,function(tidInfo) {
|
$tw.utils.each(filesInfo.tiddlers,function(tidInfo) {
|
||||||
if(tidInfo.prefix && tidInfo.suffix) {
|
if(tidInfo.prefix && tidInfo.suffix) {
|
||||||
@@ -2020,22 +1924,15 @@ $tw.loadTiddlersFromSpecification = function(filepath,excludeRegExp) {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Process directory specifier
|
// Process directory specifier
|
||||||
var dirPath = path.resolve(filepath,dirSpec.path);
|
var dirPath = path.resolve(filepath,dirSpec.path),
|
||||||
if(fs.existsSync(dirPath) && fs.statSync(dirPath).isDirectory()) {
|
files = fs.readdirSync(dirPath),
|
||||||
var files = getAllFiles(dirPath, dirSpec.searchSubdirectories),
|
fileRegExp = new RegExp(dirSpec.filesRegExp || "^.*$"),
|
||||||
fileRegExp = new RegExp(dirSpec.filesRegExp || "^.*$"),
|
metaRegExp = /^.*\.meta$/;
|
||||||
metaRegExp = /^.*\.meta$/;
|
for(var t=0; t<files.length; t++) {
|
||||||
for(var t=0; t<files.length; t++) {
|
var filename = files[t];
|
||||||
var thisPath = path.relative(filepath, files[t]),
|
if(filename !== "tiddlywiki.files" && !metaRegExp.test(filename) && fileRegExp.test(filename)) {
|
||||||
filename = path.basename(thisPath);
|
processFile(dirPath + path.sep + filename,dirSpec.isTiddlerFile,dirSpec.fields);
|
||||||
if(filename !== "tiddlywiki.files" && !metaRegExp.test(filename) && fileRegExp.test(filename)) {
|
|
||||||
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("tiddlywiki.files location: " + filepath);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -2054,7 +1951,7 @@ $tw.loadPluginFolder = function(filepath,excludeRegExp) {
|
|||||||
console.log("Warning: missing plugin.info file in " + filepath);
|
console.log("Warning: missing plugin.info file in " + filepath);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
var pluginInfo = $tw.utils.parseJSONSafe(fs.readFileSync(infoPath,"utf8"));
|
var pluginInfo = JSON.parse(fs.readFileSync(infoPath,"utf8"));
|
||||||
// Read the plugin files
|
// Read the plugin files
|
||||||
var pluginFiles = $tw.loadTiddlersFromPath(filepath,excludeRegExp);
|
var pluginFiles = $tw.loadTiddlersFromPath(filepath,excludeRegExp);
|
||||||
// Save the plugin tiddlers into the plugin info
|
// Save the plugin tiddlers into the plugin info
|
||||||
@@ -2079,7 +1976,7 @@ $tw.loadPluginFolder = function(filepath,excludeRegExp) {
|
|||||||
pluginInfo.dependents = pluginInfo.dependents || [];
|
pluginInfo.dependents = pluginInfo.dependents || [];
|
||||||
pluginInfo.type = "application/json";
|
pluginInfo.type = "application/json";
|
||||||
// Set plugin text
|
// Set plugin text
|
||||||
pluginInfo.text = JSON.stringify({tiddlers: pluginInfo.tiddlers});
|
pluginInfo.text = JSON.stringify({tiddlers: pluginInfo.tiddlers},null,4);
|
||||||
delete pluginInfo.tiddlers;
|
delete pluginInfo.tiddlers;
|
||||||
// Deserialise array fields (currently required for the dependents field)
|
// Deserialise array fields (currently required for the dependents field)
|
||||||
for(var field in pluginInfo) {
|
for(var field in pluginInfo) {
|
||||||
@@ -2171,15 +2068,10 @@ $tw.loadWikiTiddlers = function(wikiPath,options) {
|
|||||||
pluginFields;
|
pluginFields;
|
||||||
// Bail if we don't have a wiki info file
|
// Bail if we don't have a wiki info file
|
||||||
if(fs.existsSync(wikiInfoPath)) {
|
if(fs.existsSync(wikiInfoPath)) {
|
||||||
wikiInfo = $tw.utils.parseJSONSafe(fs.readFileSync(wikiInfoPath,"utf8"));
|
wikiInfo = JSON.parse(fs.readFileSync(wikiInfoPath,"utf8"));
|
||||||
} else {
|
} else {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
// Save the path to the tiddlers folder for the filesystemadaptor
|
|
||||||
var config = wikiInfo.config || {};
|
|
||||||
if($tw.boot.wikiPath == wikiPath) {
|
|
||||||
$tw.boot.wikiTiddlersPath = path.resolve($tw.boot.wikiPath,config["default-tiddler-location"] || $tw.config.wikiTiddlersSubDir);
|
|
||||||
}
|
|
||||||
// Load any parent wikis
|
// Load any parent wikis
|
||||||
if(wikiInfo.includeWikis) {
|
if(wikiInfo.includeWikis) {
|
||||||
parentPaths = parentPaths.slice(0);
|
parentPaths = parentPaths.slice(0);
|
||||||
@@ -2213,31 +2105,27 @@ $tw.loadWikiTiddlers = function(wikiPath,options) {
|
|||||||
$tw.boot.files[tiddler.title] = {
|
$tw.boot.files[tiddler.title] = {
|
||||||
filepath: tiddlerFile.filepath,
|
filepath: tiddlerFile.filepath,
|
||||||
type: tiddlerFile.type,
|
type: tiddlerFile.type,
|
||||||
hasMetaFile: tiddlerFile.hasMetaFile,
|
hasMetaFile: tiddlerFile.hasMetaFile
|
||||||
isEditableFile: config["retain-original-tiddler-path"] || tiddlerFile.isEditableFile || tiddlerFile.filepath.indexOf($tw.boot.wikiTiddlersPath) !== 0
|
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
$tw.wiki.addTiddlers(tiddlerFile.tiddlers);
|
$tw.wiki.addTiddlers(tiddlerFile.tiddlers);
|
||||||
});
|
});
|
||||||
if ($tw.boot.wikiPath == wikiPath) {
|
// Save the original tiddler file locations if requested
|
||||||
// Save the original tiddler file locations if requested
|
var config = wikiInfo.config || {};
|
||||||
var output = {}, relativePath, fileInfo;
|
if(config["retain-original-tiddler-path"]) {
|
||||||
|
var output = {}, relativePath;
|
||||||
for(var title in $tw.boot.files) {
|
for(var title in $tw.boot.files) {
|
||||||
fileInfo = $tw.boot.files[title];
|
relativePath = path.relative(resolvedWikiPath,$tw.boot.files[title].filepath);
|
||||||
if(fileInfo.isEditableFile) {
|
output[title] =
|
||||||
relativePath = path.relative($tw.boot.wikiTiddlersPath,fileInfo.filepath);
|
path.sep === "/" ?
|
||||||
fileInfo.originalpath = relativePath;
|
relativePath :
|
||||||
output[title] =
|
relativePath.split(path.sep).join("/");
|
||||||
path.sep === "/" ?
|
|
||||||
relativePath :
|
|
||||||
relativePath.split(path.sep).join("/");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(Object.keys(output).length > 0){
|
|
||||||
$tw.wiki.addTiddler({title: "$:/config/OriginalTiddlerPaths", type: "application/json", text: JSON.stringify(output)});
|
|
||||||
}
|
}
|
||||||
|
$tw.wiki.addTiddler({title: "$:/config/OriginalTiddlerPaths", type: "application/json", text: JSON.stringify(output)});
|
||||||
}
|
}
|
||||||
|
// Save the path to the tiddlers folder for the filesystemadaptor
|
||||||
|
$tw.boot.wikiTiddlersPath = path.resolve($tw.boot.wikiPath,config["default-tiddler-location"] || $tw.config.wikiTiddlersSubDir);
|
||||||
// Load any plugins within the wiki folder
|
// Load any plugins within the wiki folder
|
||||||
var wikiPluginsPath = path.resolve(wikiPath,$tw.config.wikiPluginsSubDir);
|
var wikiPluginsPath = path.resolve(wikiPath,$tw.config.wikiPluginsSubDir);
|
||||||
if(fs.existsSync(wikiPluginsPath)) {
|
if(fs.existsSync(wikiPluginsPath)) {
|
||||||
@@ -2284,7 +2172,7 @@ $tw.loadTiddlersNode = function() {
|
|||||||
// Load any extra plugins
|
// Load any extra plugins
|
||||||
$tw.utils.each($tw.boot.extraPlugins,function(name) {
|
$tw.utils.each($tw.boot.extraPlugins,function(name) {
|
||||||
if(name.charAt(0) === "+") { // Relative path to plugin
|
if(name.charAt(0) === "+") { // Relative path to plugin
|
||||||
var pluginFields = $tw.loadPluginFolder(name.substring(1));
|
var pluginFields = $tw.loadPluginFolder(name.substring(1));;
|
||||||
if(pluginFields) {
|
if(pluginFields) {
|
||||||
$tw.wiki.addTiddler(pluginFields);
|
$tw.wiki.addTiddler(pluginFields);
|
||||||
}
|
}
|
||||||
@@ -2293,7 +2181,7 @@ $tw.loadTiddlersNode = function() {
|
|||||||
type = parts[0];
|
type = parts[0];
|
||||||
if(parts.length === 3 && ["plugins","themes","languages"].indexOf(type) !== -1) {
|
if(parts.length === 3 && ["plugins","themes","languages"].indexOf(type) !== -1) {
|
||||||
$tw.loadPlugins([parts[1] + "/" + parts[2]],$tw.config[type + "Path"],$tw.config[type + "EnvVar"]);
|
$tw.loadPlugins([parts[1] + "/" + parts[2]],$tw.config[type + "Path"],$tw.config[type + "EnvVar"]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
// Load the tiddlers from the wiki directory
|
// Load the tiddlers from the wiki directory
|
||||||
@@ -2396,25 +2284,22 @@ $tw.boot.initStartup = function(options) {
|
|||||||
$tw.utils.registerFileType("application/zip","base64",".zip");
|
$tw.utils.registerFileType("application/zip","base64",".zip");
|
||||||
$tw.utils.registerFileType("application/x-zip-compressed","base64",".zip");
|
$tw.utils.registerFileType("application/x-zip-compressed","base64",".zip");
|
||||||
$tw.utils.registerFileType("image/jpeg","base64",[".jpg",".jpeg"],{flags:["image"]});
|
$tw.utils.registerFileType("image/jpeg","base64",[".jpg",".jpeg"],{flags:["image"]});
|
||||||
$tw.utils.registerFileType("image/jpg","base64",[".jpg",".jpeg"],{flags:["image"]});
|
|
||||||
$tw.utils.registerFileType("image/png","base64",".png",{flags:["image"]});
|
$tw.utils.registerFileType("image/png","base64",".png",{flags:["image"]});
|
||||||
$tw.utils.registerFileType("image/gif","base64",".gif",{flags:["image"]});
|
$tw.utils.registerFileType("image/gif","base64",".gif",{flags:["image"]});
|
||||||
$tw.utils.registerFileType("image/webp","base64",".webp",{flags:["image"]});
|
$tw.utils.registerFileType("image/webp","base64",".webp",{flags:["image"]});
|
||||||
$tw.utils.registerFileType("image/heic","base64",".heic",{flags:["image"]});
|
$tw.utils.registerFileType("image/heic","base64",".heic",{flags:["image"]});
|
||||||
$tw.utils.registerFileType("image/heif","base64",".heif",{flags:["image"]});
|
$tw.utils.registerFileType("image/heif","base64",".heif",{flags:["image"]});
|
||||||
$tw.utils.registerFileType("image/svg+xml","utf8",".svg",{flags:["image"]});
|
$tw.utils.registerFileType("image/svg+xml","utf8",".svg",{flags:["image"]});
|
||||||
$tw.utils.registerFileType("image/vnd.microsoft.icon","base64",".ico",{flags:["image"]});
|
|
||||||
$tw.utils.registerFileType("image/x-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/font-woff","base64",".woff");
|
||||||
$tw.utils.registerFileType("application/x-font-ttf","base64",".woff");
|
$tw.utils.registerFileType("application/x-font-ttf","base64",".woff");
|
||||||
$tw.utils.registerFileType("application/font-woff2","base64",".woff2");
|
$tw.utils.registerFileType("application/font-woff2","base64",".woff2");
|
||||||
$tw.utils.registerFileType("audio/ogg","base64",".ogg");
|
$tw.utils.registerFileType("audio/ogg","base64",".ogg");
|
||||||
$tw.utils.registerFileType("audio/mp4","base64",[".mp4",".m4a"]);
|
|
||||||
$tw.utils.registerFileType("video/ogg","base64",[".ogm",".ogv",".ogg"]);
|
$tw.utils.registerFileType("video/ogg","base64",[".ogm",".ogv",".ogg"]);
|
||||||
$tw.utils.registerFileType("video/webm","base64",".webm");
|
$tw.utils.registerFileType("video/webm","base64",".webm");
|
||||||
$tw.utils.registerFileType("video/mp4","base64",".mp4");
|
$tw.utils.registerFileType("video/mp4","base64",".mp4");
|
||||||
$tw.utils.registerFileType("audio/mp3","base64",".mp3");
|
$tw.utils.registerFileType("audio/mp3","base64",".mp3");
|
||||||
$tw.utils.registerFileType("audio/mpeg","base64");
|
$tw.utils.registerFileType("audio/mp4","base64",[".mp4",".m4a"]);
|
||||||
$tw.utils.registerFileType("text/markdown","utf8",[".md",".markdown"],{deserializerType:"text/x-markdown"});
|
$tw.utils.registerFileType("text/markdown","utf8",[".md",".markdown"],{deserializerType:"text/x-markdown"});
|
||||||
$tw.utils.registerFileType("text/x-markdown","utf8",[".md",".markdown"]);
|
$tw.utils.registerFileType("text/x-markdown","utf8",[".md",".markdown"]);
|
||||||
$tw.utils.registerFileType("application/enex+xml","utf8",".enex");
|
$tw.utils.registerFileType("application/enex+xml","utf8",".enex");
|
||||||
@@ -2426,7 +2311,7 @@ $tw.boot.initStartup = function(options) {
|
|||||||
$tw.utils.registerFileType("application/epub+zip","base64",".epub");
|
$tw.utils.registerFileType("application/epub+zip","base64",".epub");
|
||||||
$tw.utils.registerFileType("application/octet-stream","base64",".octet-stream");
|
$tw.utils.registerFileType("application/octet-stream","base64",".octet-stream");
|
||||||
// Create the wiki store for the app
|
// Create the wiki store for the app
|
||||||
$tw.wiki = new $tw.Wiki($tw.safeMode && {enableIndexers: []});
|
$tw.wiki = new $tw.Wiki();
|
||||||
// Install built in tiddler fields modules
|
// Install built in tiddler fields modules
|
||||||
$tw.Tiddler.fieldModules = $tw.modules.getModulesByTypeAsHashmap("tiddlerfield");
|
$tw.Tiddler.fieldModules = $tw.modules.getModulesByTypeAsHashmap("tiddlerfield");
|
||||||
// Install the tiddler deserializer modules
|
// Install the tiddler deserializer modules
|
||||||
@@ -2562,29 +2447,16 @@ $tw.boot.executeNextStartupTask = function(callback) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Returns true if we are running on one of the platforms specified in taskModule's
|
Returns true if we are running on one platforms specified in a task modules `platforms` array
|
||||||
`platforms` array; or if `platforms` property is not defined.
|
|
||||||
*/
|
*/
|
||||||
$tw.boot.doesTaskMatchPlatform = function(taskModule) {
|
$tw.boot.doesTaskMatchPlatform = function(taskModule) {
|
||||||
var platforms = taskModule.platforms;
|
var platforms = taskModule.platforms;
|
||||||
if(platforms) {
|
if(platforms) {
|
||||||
for(var t=0; t<platforms.length; t++) {
|
for(var t=0; t<platforms.length; t++) {
|
||||||
switch (platforms[t]) {
|
if((platforms[t] === "browser" && !$tw.browser) || (platforms[t] === "node" && !$tw.node)) {
|
||||||
case "browser":
|
return false;
|
||||||
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;
|
return true;
|
||||||
};
|
};
|
||||||
@@ -2606,7 +2478,7 @@ $tw.boot.isStartupTaskEligible = function(taskModule) {
|
|||||||
for(t=0; t<remaining.length; t++) {
|
for(t=0; t<remaining.length; t++) {
|
||||||
var task = remaining[t];
|
var task = remaining[t];
|
||||||
if(task.before && task.before.indexOf(name) !== -1) {
|
if(task.before && task.before.indexOf(name) !== -1) {
|
||||||
if($tw.boot.doesTaskMatchPlatform(task) && (!task.name || $tw.boot.disabledStartupModules.indexOf(task.name) === -1)) {
|
if($tw.boot.doesTaskMatchPlatform(task) || (task.name && $tw.boot.disabledStartupModules.indexOf(name) !== -1)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2685,4 +2557,3 @@ if(typeof(exports) !== "undefined") {
|
|||||||
} else {
|
} else {
|
||||||
_boot(window.$tw);
|
_boot(window.$tw);
|
||||||
}
|
}
|
||||||
//# sourceURL=$:/boot/boot.js
|
|
||||||
|
|||||||
@@ -117,4 +117,3 @@ if(typeof(exports) === "undefined") {
|
|||||||
// Export functionality as a module
|
// Export functionality as a module
|
||||||
exports.bootprefix = _bootprefix;
|
exports.bootprefix = _bootprefix;
|
||||||
}
|
}
|
||||||
//# sourceURL=$:/boot/bootprefix.js
|
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@@ -4,7 +4,7 @@ type: text/plain
|
|||||||
TiddlyWiki created by Jeremy Ruston, (jeremy [at] jermolene [dot] com)
|
TiddlyWiki created by Jeremy Ruston, (jeremy [at] jermolene [dot] com)
|
||||||
|
|
||||||
Copyright (c) 2004-2007, Jeremy Ruston
|
Copyright (c) 2004-2007, Jeremy Ruston
|
||||||
Copyright (c) 2007-2023, UnaMesa Association
|
Copyright (c) 2007-2020, UnaMesa Association
|
||||||
All rights reserved.
|
All rights reserved.
|
||||||
|
|
||||||
Redistribution and use in source and binary forms, with or without
|
Redistribution and use in source and binary forms, with or without
|
||||||
|
|||||||
@@ -1,4 +0,0 @@
|
|||||||
title: $:/core/images/layout-button
|
|
||||||
tags: $:/tags/Image
|
|
||||||
|
|
||||||
<svg width="22pt" height="22pt" class="tc-image-layout-button tc-image-button" viewBox="0 0 24 24" stroke-width="1" stroke="none"><path d="M0 0h24v24H0z" fill="none"/><rect x="2" y="2" width="7" height="7" rx="2"/><rect x="2" y="13" width="7" height="9" rx="2"/><rect x="12" y="2" width="10" height="20" rx="2"/></svg>
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
title: $:/core/images/mastodon
|
|
||||||
tags: $:/tags/Image
|
|
||||||
|
|
||||||
<svg width="22pt" height="22pt" class="tc-image-mastodon tc-image-button" viewBox="0 0 128 128">
|
|
||||||
<path d="M112.716,76.735C111.231,85.764 99.411,95.646 85.836,97.561C78.757,98.559 71.787,99.476 64.355,99.073C52.201,98.415 42.61,95.646 42.61,95.646C42.61,97.044 42.683,98.374 42.829,99.619C44.409,113.79 54.723,114.639 64.493,115.035C74.354,115.434 83.134,112.163 83.134,112.163L83.539,122.695C83.539,122.695 76.642,127.071 64.355,127.875C57.58,128.315 49.167,127.674 39.369,124.61C18.118,117.965 14.463,91.202 13.904,64.048C13.733,55.985 13.839,48.383 13.839,42.024C13.839,14.257 29.238,6.118 29.238,6.118C37.002,1.905 50.326,0.134 64.177,-0L64.517,-0C78.369,0.134 91.701,1.905 99.465,6.118C99.465,6.118 114.864,14.257 114.864,42.024C114.864,42.024 115.057,62.511 112.716,76.735ZM96.7,44.179C96.7,37.307 95.219,31.847 92.245,27.807C89.177,23.767 85.16,21.696 80.174,21.696C74.403,21.696 70.034,24.316 67.146,29.556L64.337,35.118L61.529,29.556C58.64,24.316 54.271,21.696 48.501,21.696C43.514,21.696 39.497,23.767 36.43,27.807C33.455,31.847 31.974,37.307 31.974,44.179L31.974,77.8L43.249,77.8L43.249,45.167C43.249,38.288 45.699,34.796 50.599,34.796C56.017,34.796 58.733,38.938 58.733,47.128L58.733,64.99L69.941,64.99L69.941,47.128C69.941,38.938 72.657,34.796 78.075,34.796C82.975,34.796 85.425,38.288 85.425,45.167L85.425,77.8L96.7,77.8L96.7,44.179Z"/>
|
|
||||||
</svg>
|
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
title: $:/core/images/minus-button
|
|
||||||
tags: $:/tags/Image
|
|
||||||
|
|
||||||
<svg width="22pt" height="22pt" class="tc-image-minus-button tc-image-button" viewBox="0 0 128 128"><path d="M64 0c35.346 0 64 28.654 64 64 0 35.346-28.654 64-64 64-35.346 0-64-28.654-64-64C0 28.654 28.654 0 64 0zm.332 16c-26.51 0-48 21.49-48 48s21.49 48 48 48 48-21.49 48-48-21.49-48-48-48z"/><rect width="80" height="16" x="24" y="56" rx="8"/></svg>
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
title: $:/core/images/plugin-generic-language
|
title: $:/core/images/plugin-generic-language
|
||||||
tags: $:/tags/Image
|
tags: $:/tags/Image
|
||||||
|
|
||||||
<svg width="22pt" height="22pt" viewBox="0 0 128 128" class="tc-image-plugin-generic-language tc-image-button"><path fill-rule="evenodd" d="M61.207 68.137c-4.324 2.795-6.999 6.656-6.999 10.921 0 7.906 9.19 14.424 21.042 15.336 2.162 3.902 8.598 6.785 16.318 7.01-5.126-1.125-9.117-3.742-10.62-7.01C92.805 93.487 102 86.967 102 79.059c0-8.53-10.699-15.445-23.896-15.445-6.599 0-12.572 1.729-16.897 4.524zm12.794-14.158c-4.324 2.795-10.298 4.524-16.897 4.524-2.619 0-5.14-.272-7.497-.775-3.312 2.25-8.383 3.69-14.067 3.69l-.255-.002c4.119-.892 7.511-2.747 9.478-5.13-6.925-2.704-11.555-7.617-11.555-13.228 0-8.53 10.699-15.445 23.896-15.445C70.301 27.613 81 34.528 81 43.058c0 4.265-2.675 8.126-6.999 10.921zM64 0l54.56 32v64L64 128 9.44 96V32L64 0z"/></svg>
|
<svg width="22pt" height="22pt" viewBox="0 0 128 128"><path fill-rule="evenodd" d="M61.207 68.137c-4.324 2.795-6.999 6.656-6.999 10.921 0 7.906 9.19 14.424 21.042 15.336 2.162 3.902 8.598 6.785 16.318 7.01-5.126-1.125-9.117-3.742-10.62-7.01C92.805 93.487 102 86.967 102 79.059c0-8.53-10.699-15.445-23.896-15.445-6.599 0-12.572 1.729-16.897 4.524zm12.794-14.158c-4.324 2.795-10.298 4.524-16.897 4.524-2.619 0-5.14-.272-7.497-.775-3.312 2.25-8.383 3.69-14.067 3.69l-.255-.002c4.119-.892 7.511-2.747 9.478-5.13-6.925-2.704-11.555-7.617-11.555-13.228 0-8.53 10.699-15.445 23.896-15.445C70.301 27.613 81 34.528 81 43.058c0 4.265-2.675 8.126-6.999 10.921zM64 0l54.56 32v64L64 128 9.44 96V32L64 0z"/></svg>
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
title: $:/core/images/plugin-generic-plugin
|
title: $:/core/images/plugin-generic-plugin
|
||||||
tags: $:/tags/Image
|
tags: $:/tags/Image
|
||||||
|
|
||||||
<svg width="22pt" height="22pt" viewBox="0 0 128 128" class="tc-image-plugin-generic-plugin tc-image-button"><path fill-rule="evenodd" d="M40.397 76.446V95.34h14.12l-.001-.005a6.912 6.912 0 005.364-11.593l.046-.023a6.912 6.912 0 119.979.526l.086.055a6.914 6.914 0 004.408 10.948l-.023.092h21.32V75.568l-.15.038a6.912 6.912 0 00-11.593-5.364l-.022-.046a6.912 6.912 0 11.526-9.979l.055-.086a6.914 6.914 0 0010.948-4.408c.079.018.158.038.236.059v-15.74h-21.32l.023-.094a6.914 6.914 0 01-4.408-10.947 10.23 10.23 0 00-.086-.055 6.912 6.912 0 10-9.979-.526l-.046.023a6.912 6.912 0 01-5.364 11.593l.001.005h-14.12v12.847A6.912 6.912 0 0129.5 59.843l-.054.086a6.912 6.912 0 10-.526 9.979l.023.046a6.912 6.912 0 0111.455 6.492zM64 0l54.56 32v64L64 128 9.44 96V32L64 0z"/></svg>
|
<svg width="22pt" height="22pt" viewBox="0 0 128 128"><path fill-rule="evenodd" d="M40.397 76.446V95.34h14.12l-.001-.005a6.912 6.912 0 005.364-11.593l.046-.023a6.912 6.912 0 119.979.526l.086.055a6.914 6.914 0 004.408 10.948l-.023.092h21.32V75.568l-.15.038a6.912 6.912 0 00-11.593-5.364l-.022-.046a6.912 6.912 0 11.526-9.979l.055-.086a6.914 6.914 0 0010.948-4.408c.079.018.158.038.236.059v-15.74h-21.32l.023-.094a6.914 6.914 0 01-4.408-10.947 10.23 10.23 0 00-.086-.055 6.912 6.912 0 10-9.979-.526l-.046.023a6.912 6.912 0 01-5.364 11.593l.001.005h-14.12v12.847A6.912 6.912 0 0129.5 59.843l-.054.086a6.912 6.912 0 10-.526 9.979l.023.046a6.912 6.912 0 0111.455 6.492zM64 0l54.56 32v64L64 128 9.44 96V32L64 0z"/></svg>
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
title: $:/core/images/plugin-generic-theme
|
title: $:/core/images/plugin-generic-theme
|
||||||
tags: $:/tags/Image
|
tags: $:/tags/Image
|
||||||
|
|
||||||
<svg width="22pt" height="22pt" viewBox="0 0 128 128" class="tc-image-plugin-generic-theme tc-image-button"><path fill-rule="evenodd" d="M29.408 91.472L51.469 69.41l-.004-.005a2.22 2.22 0 01.004-3.146c.87-.87 2.281-.872 3.147-.005l9.465 9.464a2.22 2.22 0 01-.005 3.147c-.87.87-2.28.871-3.147.005l-.005-.005-22.061 22.062a6.686 6.686 0 11-9.455-9.455zM60.802 66.38c-2.436-2.704-4.465-5.091-5.817-6.869-6.855-9.014-10.313-4.268-14.226 0-3.913 4.268 1.03 7.726-2.683 10.741-3.713 3.015-3.484 4.06-9.752-1.455-6.267-5.516-6.7-7.034-3.823-10.181 2.877-3.147 5.281 1.808 11.159-3.785 5.877-5.593.94-10.55.94-10.55s12.237-25.014 28.588-23.167c16.351 1.848-6.186-2.392-11.792 17.226-2.4 8.4.447 6.42 4.998 9.968 1.394 1.086 6.03 4.401 11.794 8.685l20.677-20.676 1.615-4.766 7.84-4.689 3.151 3.152-4.688 7.84-4.766 1.615-20.224 20.223c12.663 9.547 28.312 22.146 28.312 26.709 0 7.217-3.071 11.526-9.535 9.164-4.693-1.715-18.768-15.192-28.753-25.897l-2.893 2.893-3.151-3.152 3.029-3.029zM63.953 0l54.56 32v64l-54.56 32-54.56-32V32l54.56-32z"/></svg>
|
<svg width="22pt" height="22pt" viewBox="0 0 128 128"><path fill-rule="evenodd" d="M29.408 91.472L51.469 69.41l-.004-.005a2.22 2.22 0 01.004-3.146c.87-.87 2.281-.872 3.147-.005l9.465 9.464a2.22 2.22 0 01-.005 3.147c-.87.87-2.28.871-3.147.005l-.005-.005-22.061 22.062a6.686 6.686 0 11-9.455-9.455zM60.802 66.38c-2.436-2.704-4.465-5.091-5.817-6.869-6.855-9.014-10.313-4.268-14.226 0-3.913 4.268 1.03 7.726-2.683 10.741-3.713 3.015-3.484 4.06-9.752-1.455-6.267-5.516-6.7-7.034-3.823-10.181 2.877-3.147 5.281 1.808 11.159-3.785 5.877-5.593.94-10.55.94-10.55s12.237-25.014 28.588-23.167c16.351 1.848-6.186-2.392-11.792 17.226-2.4 8.4.447 6.42 4.998 9.968 1.394 1.086 6.03 4.401 11.794 8.685l20.677-20.676 1.615-4.766 7.84-4.689 3.151 3.152-4.688 7.84-4.766 1.615-20.224 20.223c12.663 9.547 28.312 22.146 28.312 26.709 0 7.217-3.071 11.526-9.535 9.164-4.693-1.715-18.768-15.192-28.753-25.897l-2.893 2.893-3.151-3.152 3.029-3.029zM63.953 0l54.56 32v64l-54.56 32-54.56-32V32l54.56-32z"/></svg>
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
title: $:/core/images/plus-button
|
|
||||||
tags: $:/tags/Image
|
|
||||||
|
|
||||||
<svg width="22pt" height="22pt" class="tc-image-plus-button tc-image-button" viewBox="0 0 128 128"><path d="M64-.333c35.346 0 64 28.654 64 64 0 35.346-28.654 64-64 64-35.346 0-64-28.654-64-64 0-35.346 28.654-64 64-64zM64 16c-26.51 0-48 21.49-48 48s21.49 48 48 48 48-21.49 48-48-21.49-48-48-48z"/><rect width="80" height="16" x="24" y="56" rx="8"/><rect width="16" height="80" x="56" y="24" rx="8"/></svg>
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
title: $:/core/images/save-button-dynamic
|
|
||||||
tags: $:/tags/Image
|
|
||||||
|
|
||||||
<svg width="22pt" height="22pt" class="tc-image-save-button-dynamic tc-image-button" viewBox="0 0 128 128">
|
|
||||||
<g class="tc-image-save-button-dynamic-clean">
|
|
||||||
<path fill-rule="evenodd" d="M120.783 34.33c4.641 8.862 7.266 18.948 7.266 29.646 0 35.347-28.653 64-64 64-35.346 0-64-28.653-64-64 0-35.346 28.654-64 64-64 18.808 0 35.72 8.113 47.43 21.03l2.68-2.68c3.13-3.13 8.197-3.132 11.321-.008 3.118 3.118 3.121 8.193-.007 11.32l-4.69 4.691zm-12.058 12.058a47.876 47.876 0 013.324 17.588c0 26.51-21.49 48-48 48s-48-21.49-48-48 21.49-48 48-48c14.39 0 27.3 6.332 36.098 16.362L58.941 73.544 41.976 56.578c-3.127-3.127-8.201-3.123-11.32-.005-3.123 3.124-3.119 8.194.006 11.319l22.617 22.617a7.992 7.992 0 005.659 2.347c2.05 0 4.101-.783 5.667-2.349l44.12-44.12z"/>
|
|
||||||
</g>
|
|
||||||
<g class="tc-image-save-button-dynamic-dirty">
|
|
||||||
<path d="M64.856912,0 C100.203136,0 128.856912,28.653776 128.856912,64 C128.856912,99.346224 100.203136,128 64.856912,128 C29.510688,128 0.856911958,99.346224 0.856911958,64 C0.856911958,28.653776 29.510688,0 64.856912,0 Z M64.856912,16 C38.347244,16 16.856912,37.490332 16.856912,64 C16.856912,90.509668 38.347244,112 64.856912,112 C91.3665799,112 112.856912,90.509668 112.856912,64 C112.856912,37.490332 91.3665799,16 64.856912,16 Z"></path>
|
|
||||||
<circle cx="65" cy="64" r="32"></circle>
|
|
||||||
</g>
|
|
||||||
</svg>
|
|
||||||
@@ -18,8 +18,6 @@ CopyToClipboard/Caption: copy to clipboard
|
|||||||
CopyToClipboard/Hint: Copy this text to the clipboard
|
CopyToClipboard/Hint: Copy this text to the clipboard
|
||||||
Delete/Caption: delete
|
Delete/Caption: delete
|
||||||
Delete/Hint: Delete this tiddler
|
Delete/Hint: Delete this tiddler
|
||||||
DeleteTiddlers/Caption: delete tiddlers
|
|
||||||
DeleteTiddlers/Hint: Delete tiddlers
|
|
||||||
Edit/Caption: edit
|
Edit/Caption: edit
|
||||||
Edit/Hint: Edit this tiddler
|
Edit/Hint: Edit this tiddler
|
||||||
Encryption/Caption: encryption
|
Encryption/Caption: encryption
|
||||||
@@ -59,8 +57,6 @@ Home/Caption: home
|
|||||||
Home/Hint: Open the default tiddlers
|
Home/Hint: Open the default tiddlers
|
||||||
Language/Caption: language
|
Language/Caption: language
|
||||||
Language/Hint: Choose the user interface language
|
Language/Hint: Choose the user interface language
|
||||||
LayoutSwitcher/Hint: Open layout switcher
|
|
||||||
LayoutSwitcher/Caption: layout
|
|
||||||
Manager/Caption: tiddler manager
|
Manager/Caption: tiddler manager
|
||||||
Manager/Hint: Open tiddler manager
|
Manager/Hint: Open tiddler manager
|
||||||
More/Caption: more
|
More/Caption: more
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ Appearance/Hint: Ways to customise the appearance of your TiddlyWiki.
|
|||||||
Basics/AnimDuration/Prompt: Animation duration
|
Basics/AnimDuration/Prompt: Animation duration
|
||||||
Basics/AutoFocus/Prompt: Default focus field for new tiddlers
|
Basics/AutoFocus/Prompt: Default focus field for new tiddlers
|
||||||
Basics/Caption: Basics
|
Basics/Caption: Basics
|
||||||
Basics/DefaultTiddlers/BottomHint: Use [[double square brackets]] for titles with spaces. Or you can choose to {{retain story ordering||$:/snippets/retain-story-ordering-button}}
|
Basics/DefaultTiddlers/BottomHint: Use [[double square brackets]] for titles with spaces. Or you can choose to <$button set="$:/DefaultTiddlers" setTo="[list[$:/StoryList]]">retain story ordering</$button>
|
||||||
Basics/DefaultTiddlers/Prompt: Default tiddlers
|
Basics/DefaultTiddlers/Prompt: Default tiddlers
|
||||||
Basics/DefaultTiddlers/TopHint: Choose which tiddlers are displayed at startup
|
Basics/DefaultTiddlers/TopHint: Choose which tiddlers are displayed at startup
|
||||||
Basics/Language/Prompt: Hello! Current language:
|
Basics/Language/Prompt: Hello! Current language:
|
||||||
@@ -17,8 +17,6 @@ Basics/NewJournal/Tags/Prompt: Tags for new journal tiddlers
|
|||||||
Basics/NewTiddler/Title/Prompt: Title of new tiddlers
|
Basics/NewTiddler/Title/Prompt: Title of new tiddlers
|
||||||
Basics/NewTiddler/Tags/Prompt: Tags for new tiddlers
|
Basics/NewTiddler/Tags/Prompt: Tags for new tiddlers
|
||||||
Basics/OverriddenShadowTiddlers/Prompt: Number of overridden shadow tiddlers
|
Basics/OverriddenShadowTiddlers/Prompt: Number of overridden shadow tiddlers
|
||||||
Basics/RemoveTags: Update to current format
|
|
||||||
Basics/RemoveTags/Hint: Update the tags configuration to the latest format
|
|
||||||
Basics/ShadowTiddlers/Prompt: Number of shadow tiddlers
|
Basics/ShadowTiddlers/Prompt: Number of shadow tiddlers
|
||||||
Basics/Subtitle/Prompt: Subtitle
|
Basics/Subtitle/Prompt: Subtitle
|
||||||
Basics/SystemTiddlers/Prompt: Number of system tiddlers
|
Basics/SystemTiddlers/Prompt: Number of system tiddlers
|
||||||
@@ -27,17 +25,10 @@ Basics/Tiddlers/Prompt: Number of tiddlers
|
|||||||
Basics/Title/Prompt: Title of this ~TiddlyWiki
|
Basics/Title/Prompt: Title of this ~TiddlyWiki
|
||||||
Basics/Username/Prompt: Username for signing edits
|
Basics/Username/Prompt: Username for signing edits
|
||||||
Basics/Version/Prompt: ~TiddlyWiki version
|
Basics/Version/Prompt: ~TiddlyWiki version
|
||||||
Cascades/Caption: Cascades
|
|
||||||
Cascades/Hint: These global rules are used to dynamically choose certain templates. The result of the cascade is the result of the first filter in the sequence that returns a result
|
|
||||||
Cascades/TagPrompt: Filters tagged <$macrocall $name="tag" tag=<<currentTiddler>>/>
|
|
||||||
EditorTypes/Caption: Editor Types
|
EditorTypes/Caption: Editor Types
|
||||||
EditorTypes/Editor/Caption: Editor
|
EditorTypes/Editor/Caption: Editor
|
||||||
EditorTypes/Hint: These tiddlers determine which editor is used to edit specific tiddler types.
|
EditorTypes/Hint: These tiddlers determine which editor is used to edit specific tiddler types.
|
||||||
EditorTypes/Type/Caption: Type
|
EditorTypes/Type/Caption: Type
|
||||||
EditTemplateBody/Caption: Edit Template Body
|
|
||||||
EditTemplateBody/Hint: This rule cascade is used by the default edit template to dynamically choose the template for editing the body of a tiddler.
|
|
||||||
FieldEditor/Caption: Field Editor
|
|
||||||
FieldEditor/Hint: This rules cascade is used to dynamically choose the template for rendering a tiddler field based on its name. It is used within the Edit Template.
|
|
||||||
Info/Caption: Info
|
Info/Caption: Info
|
||||||
Info/Hint: Information about this TiddlyWiki
|
Info/Hint: Information about this TiddlyWiki
|
||||||
KeyboardShortcuts/Add/Prompt: Type shortcut here
|
KeyboardShortcuts/Add/Prompt: Type shortcut here
|
||||||
@@ -53,7 +44,6 @@ KeyboardShortcuts/Platform/Linux: Linux platform only
|
|||||||
KeyboardShortcuts/Platform/NonLinux: Non-Linux platforms only
|
KeyboardShortcuts/Platform/NonLinux: Non-Linux platforms only
|
||||||
KeyboardShortcuts/Platform/Windows: Windows platform only
|
KeyboardShortcuts/Platform/Windows: Windows platform only
|
||||||
KeyboardShortcuts/Platform/NonWindows: Non-Windows platforms only
|
KeyboardShortcuts/Platform/NonWindows: Non-Windows platforms only
|
||||||
LayoutSwitcher/Caption: Layout
|
|
||||||
LoadedModules/Caption: Loaded Modules
|
LoadedModules/Caption: Loaded Modules
|
||||||
LoadedModules/Hint: These are the currently loaded tiddler modules linked to their source tiddlers. Any italicised modules lack a source tiddler, typically because they were setup during the boot process.
|
LoadedModules/Hint: These are the currently loaded tiddler modules linked to their source tiddlers. Any italicised modules lack a source tiddler, typically because they were setup during the boot process.
|
||||||
Palette/Caption: Palette
|
Palette/Caption: Palette
|
||||||
@@ -90,8 +80,8 @@ Plugins/Languages/Caption: Languages
|
|||||||
Plugins/Languages/Hint: Language pack plugins
|
Plugins/Languages/Hint: Language pack plugins
|
||||||
Plugins/NoInfoFound/Hint: No ''"<$text text=<<currentTab>>/>"'' found
|
Plugins/NoInfoFound/Hint: No ''"<$text text=<<currentTab>>/>"'' found
|
||||||
Plugins/NotInstalled/Hint: This plugin is not currently installed
|
Plugins/NotInstalled/Hint: This plugin is not currently installed
|
||||||
Plugins/OpenPluginLibrary: Open plugin library
|
Plugins/OpenPluginLibrary: open plugin library
|
||||||
Plugins/ClosePluginLibrary: Close plugin library
|
Plugins/ClosePluginLibrary: close plugin library
|
||||||
Plugins/PluginWillRequireReload: (requires reload)
|
Plugins/PluginWillRequireReload: (requires reload)
|
||||||
Plugins/Plugins/Caption: Plugins
|
Plugins/Plugins/Caption: Plugins
|
||||||
Plugins/Plugins/Hint: Plugins
|
Plugins/Plugins/Hint: Plugins
|
||||||
@@ -130,12 +120,11 @@ Saving/TiddlySpot/BackupDir: Backup Directory
|
|||||||
Saving/TiddlySpot/ControlPanel: ~TiddlySpot Control Panel
|
Saving/TiddlySpot/ControlPanel: ~TiddlySpot Control Panel
|
||||||
Saving/TiddlySpot/Backups: Backups
|
Saving/TiddlySpot/Backups: Backups
|
||||||
Saving/TiddlySpot/Caption: ~TiddlySpot Saver
|
Saving/TiddlySpot/Caption: ~TiddlySpot Saver
|
||||||
Saving/TiddlySpot/Description: These settings are only used when saving to [[TiddlySpot|http://tiddlyspot.com]], [[TiddlyHost|https://tiddlyhost.com]], or a compatible remote server. See [[here|https://github.com/simonbaird/tiddlyhost/wiki/TiddlySpot-Saver-configuration-for-Tiddlyhost-and-Tiddlyspot]] for information on ~TiddlySpot and ~TiddlyHost saving configuration.
|
Saving/TiddlySpot/Description: These settings are only used when saving to http://tiddlyspot.com or a compatible remote server
|
||||||
Saving/TiddlySpot/Filename: Upload Filename
|
Saving/TiddlySpot/Filename: Upload Filename
|
||||||
Saving/TiddlySpot/Heading: ~TiddlySpot
|
Saving/TiddlySpot/Heading: ~TiddlySpot
|
||||||
Saving/TiddlySpot/Hint: //The server URL defaults to `http://<wikiname>.tiddlyspot.com/store.cgi` and can be changed to use a custom server address, e.g. `http://example.com/store.php`.//
|
Saving/TiddlySpot/Hint: //The server URL defaults to `http://<wikiname>.tiddlyspot.com/store.cgi` and can be changed to use a custom server address, e.g. `http://example.com/store.php`.//
|
||||||
Saving/TiddlySpot/Password: Password
|
Saving/TiddlySpot/Password: Password
|
||||||
Saving/TiddlySpot/ReadOnly: Note that [[TiddlySpot|http://tiddlyspot.com]] no longer allows the creation of new sites. For new sites, you can use [[TiddlyHost|https://tiddlyhost.com]], a new hosting service that replaces ~TiddlySpot.
|
|
||||||
Saving/TiddlySpot/ServerURL: Server URL
|
Saving/TiddlySpot/ServerURL: Server URL
|
||||||
Saving/TiddlySpot/UploadDir: Upload Directory
|
Saving/TiddlySpot/UploadDir: Upload Directory
|
||||||
Saving/TiddlySpot/UserName: Wiki Name
|
Saving/TiddlySpot/UserName: Wiki Name
|
||||||
@@ -198,8 +187,6 @@ Settings/TitleLinks/Yes/Description: Display tiddler titles as links
|
|||||||
Settings/MissingLinks/Caption: Wiki Links
|
Settings/MissingLinks/Caption: Wiki Links
|
||||||
Settings/MissingLinks/Hint: Choose whether to link to tiddlers that do not exist yet
|
Settings/MissingLinks/Hint: Choose whether to link to tiddlers that do not exist yet
|
||||||
Settings/MissingLinks/Description: Enable links to missing tiddlers
|
Settings/MissingLinks/Description: Enable links to missing tiddlers
|
||||||
StoryTiddler/Caption: Story Tiddler
|
|
||||||
StoryTiddler/Hint: This rule cascade is used to dynamically choose the template for displaying a tiddler in the story river.
|
|
||||||
StoryView/Caption: Story View
|
StoryView/Caption: Story View
|
||||||
StoryView/Prompt: Current view:
|
StoryView/Prompt: Current view:
|
||||||
Stylesheets/Caption: Stylesheets
|
Stylesheets/Caption: Stylesheets
|
||||||
@@ -210,10 +197,6 @@ Theme/Caption: Theme
|
|||||||
Theme/Prompt: Current theme:
|
Theme/Prompt: Current theme:
|
||||||
TiddlerFields/Caption: Tiddler Fields
|
TiddlerFields/Caption: Tiddler Fields
|
||||||
TiddlerFields/Hint: This is the full set of TiddlerFields in use in this wiki (including system tiddlers but excluding shadow tiddlers).
|
TiddlerFields/Hint: This is the full set of TiddlerFields in use in this wiki (including system tiddlers but excluding shadow tiddlers).
|
||||||
TiddlerColour/Caption: Tiddler Colour
|
|
||||||
TiddlerColour/Hint: This rules cascade is used to dynamically choose the colour for a tiddler (used for the icon and the associated tag pill).
|
|
||||||
TiddlerIcon/Caption: Tiddler Icon
|
|
||||||
TiddlerIcon/Hint: This rules cascade is used to dynamically choose the icon for a tiddler.
|
|
||||||
Toolbars/Caption: Toolbars
|
Toolbars/Caption: Toolbars
|
||||||
Toolbars/EditToolbar/Caption: Edit Toolbar
|
Toolbars/EditToolbar/Caption: Edit Toolbar
|
||||||
Toolbars/EditToolbar/Hint: Choose which buttons are displayed for tiddlers in edit mode. Drag and drop to change the ordering
|
Toolbars/EditToolbar/Hint: Choose which buttons are displayed for tiddlers in edit mode. Drag and drop to change the ordering
|
||||||
@@ -225,7 +208,3 @@ Toolbars/EditorToolbar/Hint: Choose which buttons are displayed in the editor to
|
|||||||
Toolbars/ViewToolbar/Caption: View Toolbar
|
Toolbars/ViewToolbar/Caption: View Toolbar
|
||||||
Toolbars/ViewToolbar/Hint: Choose which buttons are displayed for tiddlers in view mode. Drag and drop to change the ordering
|
Toolbars/ViewToolbar/Hint: Choose which buttons are displayed for tiddlers in view mode. Drag and drop to change the ordering
|
||||||
Tools/Download/Full/Caption: Download full wiki
|
Tools/Download/Full/Caption: Download full wiki
|
||||||
ViewTemplateBody/Caption: View Template Body
|
|
||||||
ViewTemplateBody/Hint: This rule cascade is used by the default view template to dynamically choose the template for displaying the body of a tiddler.
|
|
||||||
ViewTemplateTitle/Caption: View Template Title
|
|
||||||
ViewTemplateTitle/Hint: This rule cascade is used by the default view template to dynamically choose the template for displaying the title of a tiddler.
|
|
||||||
|
|||||||
@@ -23,7 +23,6 @@ tiddlerfield: Defines the behaviour of an individual tiddler field.
|
|||||||
tiddlermethod: Adds methods to the `$tw.Tiddler` prototype.
|
tiddlermethod: Adds methods to the `$tw.Tiddler` prototype.
|
||||||
upgrader: Applies upgrade processing to tiddlers during an upgrade/import.
|
upgrader: Applies upgrade processing to tiddlers during an upgrade/import.
|
||||||
utils: Adds methods to `$tw.utils`.
|
utils: Adds methods to `$tw.utils`.
|
||||||
utils-browser: Adds browser-specific methods to `$tw.utils`.
|
|
||||||
utils-node: Adds Node.js-specific methods to `$tw.utils`.
|
utils-node: Adds Node.js-specific methods to `$tw.utils`.
|
||||||
widget: Widgets encapsulate DOM rendering and refreshing.
|
widget: Widgets encapsulate DOM rendering and refreshing.
|
||||||
wikimethod: Adds methods to `$tw.Wiki`.
|
wikimethod: Adds methods to `$tw.Wiki`.
|
||||||
|
|||||||
@@ -1,11 +1,8 @@
|
|||||||
title: $:/language/EditTemplate/
|
title: $:/language/EditTemplate/
|
||||||
|
|
||||||
Caption: Editor
|
|
||||||
Body/External/Hint: This tiddler shows content stored outside of the main TiddlyWiki file. You can edit the tags and fields but cannot directly edit the content itself
|
Body/External/Hint: This tiddler shows content stored outside of the main TiddlyWiki file. You can edit the tags and fields but cannot directly edit the content itself
|
||||||
Body/Placeholder: Type the text for this tiddler
|
Body/Placeholder: Type the text for this tiddler
|
||||||
Body/Preview/Type/Output: output
|
Body/Preview/Type/Output: output
|
||||||
Body/Preview/Type/DiffShadow: differences from shadow (if any)
|
|
||||||
Body/Preview/Type/DiffCurrent: differences from current
|
|
||||||
Field/Remove/Caption: remove field
|
Field/Remove/Caption: remove field
|
||||||
Field/Remove/Hint: Remove field
|
Field/Remove/Hint: Remove field
|
||||||
Field/Dropdown/Caption: field list
|
Field/Dropdown/Caption: field list
|
||||||
@@ -22,8 +19,6 @@ Shadow/OverriddenWarning: This is a modified shadow tiddler. You can revert to t
|
|||||||
Tags/Add/Button: add
|
Tags/Add/Button: add
|
||||||
Tags/Add/Button/Hint: add tag
|
Tags/Add/Button/Hint: add tag
|
||||||
Tags/Add/Placeholder: tag name
|
Tags/Add/Placeholder: tag name
|
||||||
Tags/ClearInput/Caption: clear input
|
|
||||||
Tags/ClearInput/Hint: Clear tag input
|
|
||||||
Tags/Dropdown/Caption: tag list
|
Tags/Dropdown/Caption: tag list
|
||||||
Tags/Dropdown/Hint: Show tag list
|
Tags/Dropdown/Hint: Show tag list
|
||||||
Title/BadCharacterWarning: Warning: avoid using any of the characters <<bad-chars>> in tiddler titles
|
Title/BadCharacterWarning: Warning: avoid using any of the characters <<bad-chars>> in tiddler titles
|
||||||
|
|||||||
@@ -1,13 +1,10 @@
|
|||||||
title: $:/language/Docs/Fields/
|
title: $:/language/Docs/Fields/
|
||||||
|
|
||||||
_canonical_uri: The full URI of an external image tiddler
|
_canonical_uri: The full URI of an external image tiddler
|
||||||
author: Name of the author of a plugin
|
|
||||||
bag: The name of the bag from which a tiddler came
|
bag: The name of the bag from which a tiddler came
|
||||||
caption: The text to be displayed on a tab or button
|
caption: The text to be displayed on a tab or button
|
||||||
code-body: The view template will display the tiddler as code if set to ''yes''
|
|
||||||
color: The CSS color value associated with a tiddler
|
color: The CSS color value associated with a tiddler
|
||||||
component: The name of the component responsible for an [[alert tiddler|AlertMechanism]]
|
component: The name of the component responsible for an [[alert tiddler|AlertMechanism]]
|
||||||
core-version: For a plugin, indicates what version of TiddlyWiki with which it is compatible
|
|
||||||
current-tiddler: Used to cache the top tiddler in a [[history list|HistoryMechanism]]
|
current-tiddler: Used to cache the top tiddler in a [[history list|HistoryMechanism]]
|
||||||
created: The date a tiddler was created
|
created: The date a tiddler was created
|
||||||
creator: The name of the person who created a tiddler
|
creator: The name of the person who created a tiddler
|
||||||
@@ -15,29 +12,27 @@ dependents: For a plugin, lists the dependent plugin titles
|
|||||||
description: The descriptive text for a plugin, or a modal dialogue
|
description: The descriptive text for a plugin, or a modal dialogue
|
||||||
draft.of: For draft tiddlers, contains the title of the tiddler of which this is a draft
|
draft.of: For draft tiddlers, contains the title of the tiddler of which this is a draft
|
||||||
draft.title: For draft tiddlers, contains the proposed new title of the tiddler
|
draft.title: For draft tiddlers, contains the proposed new title of the tiddler
|
||||||
footer: The footer text for a modal
|
footer: The footer text for a wizard
|
||||||
hide-body: The view template will hide bodies of tiddlers if set to ''yes''
|
hide-body: The view template will hide bodies of tiddlers if set to: ''yes''
|
||||||
icon: The title of the tiddler containing the icon associated with a tiddler
|
icon: The title of the tiddler containing the icon associated with a tiddler
|
||||||
library: Indicates that a tiddler should be saved as a JavaScript library if set to ''yes''
|
library: Indicates that a tiddler should be saved as a JavaScript library if set to: ''yes''
|
||||||
list: An ordered list of tiddler titles associated with a tiddler
|
list: An ordered list of tiddler titles associated with a tiddler
|
||||||
list-before: If set, the title of a tiddler before which this tiddler should be added to the ordered list of tiddler titles, or at the start of the list if this field is present but empty
|
list-before: If set, the title of a tiddler before which this tiddler should be added to the ordered list of tiddler titles, or at the start of the list if this field is present but empty
|
||||||
list-after: If set, the title of the tiddler after which this tiddler should be added to the ordered list of tiddler titles, or at the end of the list if this field is present but empty
|
list-after: If set, the title of the tiddler after which this tiddler should be added to the ordered list of tiddler titles, or at the end of the list if this field is present but empty
|
||||||
modified: The date and time at which a tiddler was last modified
|
modified: The date and time at which a tiddler was last modified
|
||||||
modifier: The tiddler title associated with the person who last modified a tiddler
|
modifier: The tiddler title associated with the person who last modified a tiddler
|
||||||
module-type: For javascript tiddlers, specifies what kind of module it is
|
|
||||||
name: The human readable name associated with a plugin tiddler
|
name: The human readable name associated with a plugin tiddler
|
||||||
parent-plugin: For a plugin, specifies which plugin of which it is a sub-plugin
|
|
||||||
plugin-priority: A numerical value indicating the priority of a plugin tiddler
|
plugin-priority: A numerical value indicating the priority of a plugin tiddler
|
||||||
plugin-type: The type of plugin in a plugin tiddler
|
plugin-type: The type of plugin in a plugin tiddler
|
||||||
revision: The revision of the tiddler held at the server
|
revision: The revision of the tiddler held at the server
|
||||||
released: Date of a TiddlyWiki release
|
released: Date of a TiddlyWiki release
|
||||||
source: The source URL associated with a tiddler
|
source: The source URL associated with a tiddler
|
||||||
subtitle: The subtitle text for a modal
|
subtitle: The subtitle text for a wizard
|
||||||
tags: A list of tags associated with a tiddler
|
tags: A list of tags associated with a tiddler
|
||||||
text: The body text of a tiddler
|
text: The body text of a tiddler
|
||||||
throttle.refresh: If present, throttles refreshes of this tiddler
|
throttle.refresh: If present, throttles refreshes of this tiddler
|
||||||
title: The unique name of a tiddler
|
title: The unique name of a tiddler
|
||||||
toc-link: Suppresses the tiddler's link in a Table of Contents tree if set to ''no''
|
toc-link: Suppresses the tiddler's link in a Table of Contents tree if set to: ''no''
|
||||||
type: The content type of a tiddler
|
type: The content type of a tiddler
|
||||||
version: Version information for a plugin
|
version: Version information for a plugin
|
||||||
_is_skinny: If present, indicates that the tiddler text field must be loaded from the server
|
_is_skinny: If present, indicates that the tiddler text field must be loaded from the server
|
||||||
|
|||||||
@@ -9,10 +9,9 @@ Before you start storing important information in ~TiddlyWiki it is vital to mak
|
|||||||
|
|
||||||
<div class="tc-control-panel">
|
<div class="tc-control-panel">
|
||||||
|
|
||||||
|tc-table-no-border tc-first-col-min-width tc-first-link-nowrap|k
|
|<$link to="$:/SiteTitle"><<lingo Title/Prompt>></$link> |<$edit-text tiddler="$:/SiteTitle" default="" tag="input"/> |
|
||||||
| <$link to="$:/SiteTitle"><<lingo Title/Prompt>></$link>|<$edit-text tiddler="$:/SiteTitle" default="" tag="input"/> |
|
|<$link to="$:/SiteSubtitle"><<lingo Subtitle/Prompt>></$link> |<$edit-text tiddler="$:/SiteSubtitle" default="" tag="input"/> |
|
||||||
| <$link to="$:/SiteSubtitle"><<lingo Subtitle/Prompt>></$link>|<$edit-text tiddler="$:/SiteSubtitle" default="" tag="input"/> |
|
|<$link to="$:/DefaultTiddlers"><<lingo DefaultTiddlers/Prompt>></$link> |<<lingo DefaultTiddlers/TopHint>><br> <$edit tag="textarea" tiddler="$:/DefaultTiddlers"/><br>//<<lingo DefaultTiddlers/BottomHint>>// |
|
||||||
|^ <$link to="$:/DefaultTiddlers"><<lingo DefaultTiddlers/Prompt>></$link><br><<lingo DefaultTiddlers/TopHint>>|<$edit tag="textarea" tiddler="$:/DefaultTiddlers"/><br>//<<lingo DefaultTiddlers/BottomHint>>// |
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
See the [[control panel|$:/ControlPanel]] for more options.
|
See the [[control panel|$:/ControlPanel]] for more options.
|
||||||
|
|||||||
@@ -1,18 +0,0 @@
|
|||||||
title: $:/language/Help/commands
|
|
||||||
description: Run commands returned from a filter
|
|
||||||
|
|
||||||
Sequentially run the command tokens returned from a filter
|
|
||||||
|
|
||||||
```
|
|
||||||
--commands <filter>
|
|
||||||
```
|
|
||||||
|
|
||||||
Examples
|
|
||||||
|
|
||||||
```
|
|
||||||
--commands "[enlist{$:/build-commands-as-text}]"
|
|
||||||
```
|
|
||||||
|
|
||||||
```
|
|
||||||
--commands "[{$:/build-commands-as-json}jsonindexes[]] :map[{$:/build-commands-as-json}jsonget<currentTiddler>]"
|
|
||||||
```
|
|
||||||
@@ -3,7 +3,6 @@ title: $:/language/Help/default
|
|||||||
\define commandTitle()
|
\define commandTitle()
|
||||||
$:/language/Help/$(command)$
|
$:/language/Help/$(command)$
|
||||||
\end
|
\end
|
||||||
\whitespace trim
|
|
||||||
```
|
```
|
||||||
usage: tiddlywiki [<wikifolder>] [--<command> [<args>...]...]
|
usage: tiddlywiki [<wikifolder>] [--<command> [<args>...]...]
|
||||||
```
|
```
|
||||||
@@ -12,9 +11,7 @@ Available commands:
|
|||||||
|
|
||||||
<ul>
|
<ul>
|
||||||
<$list filter="[commands[]sort[title]]" variable="command">
|
<$list filter="[commands[]sort[title]]" variable="command">
|
||||||
<li><$link to=<<commandTitle>>><$macrocall $name="command" $type="text/plain" $output="text/plain"/></$link>:
|
<li><$link to=<<commandTitle>>><$macrocall $name="command" $type="text/plain" $output="text/plain"/></$link>: <$transclude tiddler=<<commandTitle>> field="description"/></li>
|
||||||
 
|
|
||||||
<$transclude tiddler=<<commandTitle>> field="description"/></li>
|
|
||||||
</$list>
|
</$list>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
|
|||||||
@@ -19,8 +19,8 @@ All parameters are optional with safe defaults, and can be specified in any orde
|
|||||||
* ''username'' - optional username for basic authentication
|
* ''username'' - optional username for basic authentication
|
||||||
* ''password'' - optional password for basic authentication
|
* ''password'' - optional password for basic authentication
|
||||||
* ''authenticated-user-header'' - optional name of header to be used for trusted authentication
|
* ''authenticated-user-header'' - optional name of header to be used for trusted authentication
|
||||||
* ''readers'' - comma-separated list of principals allowed to read from this wiki
|
* ''readers'' - comma separated list of principals allowed to read from this wiki
|
||||||
* ''writers'' - comma-separated list of principals allowed to write to this wiki
|
* ''writers'' - comma separated list of principals allowed to write to this wiki
|
||||||
* ''csrf-disable'' - set to "yes" to disable CSRF checks (defaults to "no")
|
* ''csrf-disable'' - set to "yes" to disable CSRF checks (defaults to "no")
|
||||||
* ''root-tiddler'' - the tiddler to serve at the root (defaults to "$:/core/save/all")
|
* ''root-tiddler'' - the tiddler to serve at the root (defaults to "$:/core/save/all")
|
||||||
* ''root-render-type'' - the content type to which the root tiddler should be rendered (defaults to "text/plain")
|
* ''root-render-type'' - the content type to which the root tiddler should be rendered (defaults to "text/plain")
|
||||||
@@ -29,7 +29,6 @@ All parameters are optional with safe defaults, and can be specified in any orde
|
|||||||
* ''tls-key'' - pathname of TLS key file (relative to wiki folder)
|
* ''tls-key'' - pathname of TLS key file (relative to wiki folder)
|
||||||
* ''debug-level'' - optional debug level; set to "debug" to view request details (defaults to "none")
|
* ''debug-level'' - optional debug level; set to "debug" to view request details (defaults to "none")
|
||||||
* ''gzip'' - set to "yes" to enable gzip compression for some http endpoints (defaults to "no")
|
* ''gzip'' - set to "yes" to enable gzip compression for some http endpoints (defaults to "no")
|
||||||
* ''use-browser-cache'' - set to "yes" to allow the browser to cache responses to save bandwidth (defaults to "no")
|
|
||||||
|
|
||||||
For information on opening up your instance to the entire local network, and possible security concerns, see the WebServer tiddler at TiddlyWiki.com.
|
For information on opening up your instance to the entire local network, and possible security concerns, see the WebServer tiddler at TiddlyWiki.com.
|
||||||
|
|
||||||
|
|||||||
@@ -8,15 +8,15 @@ Optionally, the title of a template tiddler can be specified. In this case, inst
|
|||||||
A name and value for an additional variable may optionally also be specified.
|
A name and value for an additional variable may optionally also be specified.
|
||||||
|
|
||||||
```
|
```
|
||||||
--render <tiddler-filter> [<filename-filter>] [<render-type>] [<template>] [ [<name>] [<value>] ]*
|
--render <tiddler-filter> [<filename-filter>] [<render-type>] [<template>] [<name>] [<value>]
|
||||||
```
|
```
|
||||||
|
|
||||||
* ''tiddler-filter'': A filter identifying the tiddler(s) to be rendered
|
* ''tiddler-filter'': A filter identifying the tiddler(s) to be rendered
|
||||||
* ''filename-filter'': Optional filter transforming tiddler titles into pathnames. If omitted, defaults to `[is[tiddler]addsuffix[.html]]`, which uses the unchanged tiddler title as the filename
|
* ''filename-filter'': Optional filter transforming tiddler titles into pathnames. If omitted, defaults to `[is[tiddler]addsuffix[.html]]`, which uses the unchanged tiddler title as the filename
|
||||||
* ''render-type'': Optional render type: `text/html` (the default) returns the full HTML text and `text/plain` just returns the text content (ie it ignores HTML tags and other unprintable material)
|
* ''render-type'': Optional render type: `text/html` (the default) returns the full HTML text and `text/plain` just returns the text content (ie it ignores HTML tags and other unprintable material)
|
||||||
* ''template'': Optional template through which each tiddler is rendered
|
* ''template'': Optional template through which each tiddler is rendered
|
||||||
* ''name'': Name of optional variables
|
* ''name'': Name of optional variable
|
||||||
* ''value'': Value of optional variables
|
* ''value'': Value of optional variable
|
||||||
|
|
||||||
By default, the filename is resolved relative to the `output` subdirectory of the edition directory. The `--output` command can be used to direct output to a different directory.
|
By default, the filename is resolved relative to the `output` subdirectory of the edition directory. The `--output` command can be used to direct output to a different directory.
|
||||||
|
|
||||||
@@ -24,12 +24,11 @@ Notes:
|
|||||||
|
|
||||||
* The output directory is not cleared of any existing files
|
* The output directory is not cleared of any existing files
|
||||||
* Any missing directories in the path to the filename are automatically created.
|
* Any missing directories in the path to the filename are automatically created.
|
||||||
* When referring to a tiddler with spaces in its title, take care to use both the quotes required by your shell and also TiddlyWiki's double square brackets: `--render "[[Motovun Jack.jpg]]"`
|
* When referring to a tiddler with spaces in its title, take care to use both the quotes required by your shell and also TiddlyWiki's double square brackets : `--render "[[Motovun Jack.jpg]]"`
|
||||||
* The filename filter is evaluated with the selected items being set to the title of the tiddler currently being rendered, allowing the title to be used as the basis for computing the filename. For example `[encodeuricomponent[]addprefix[static/]]` applies URI encoding to each title, and then adds the prefix `static/`
|
* The filename filter is evaluated with the selected items being set to the title of the tiddler currently being rendered, allowing the title to be used as the basis for computing the filename. For example `[encodeuricomponent[]addprefix[static/]]` applies URI encoding to each title, and then adds the prefix `static/`
|
||||||
* Multiple ''name''/''value'' pairs can be used to pass more than one variable
|
|
||||||
* The `--render` command is a more flexible replacement for both the `--rendertiddler` and `--rendertiddlers` commands, which are deprecated
|
* The `--render` command is a more flexible replacement for both the `--rendertiddler` and `--rendertiddlers` commands, which are deprecated
|
||||||
|
|
||||||
Examples:
|
Examples:
|
||||||
|
|
||||||
* `--render '[!is[system]]' '[encodeuricomponent[]addprefix[tiddlers/]addsuffix[.html]]'` -- renders all non-system tiddlers as files in the subdirectory "tiddlers" with URL-encoded titles and the extension HTML
|
* `--render "[!is[system]]" "[encodeuricomponent[]addprefix[tiddlers/]addsuffix[.html]]"` -- renders all non-system tiddlers as files in the subdirectory "tiddlers" with URL-encoded titles and the extension HTML
|
||||||
* `--render '.' 'tiddlers.json' 'text/plain' '$:/core/templates/exporters/JsonFile' 'exportFilter' '[tag[HelloThere]]'` -- renders the tiddlers tagged "HelloThere" to a JSON file named "tiddlers.json"
|
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ Notes:
|
|||||||
|
|
||||||
* The output directory is not cleared of any existing files
|
* The output directory is not cleared of any existing files
|
||||||
* Any missing directories in the path to the filename are automatically created.
|
* Any missing directories in the path to the filename are automatically created.
|
||||||
* When saving a tiddler with spaces in its title, take care to use both the quotes required by your shell and also TiddlyWiki's double square brackets: `--save "[[Motovun Jack.jpg]]"`
|
* When saving a tiddler with spaces in its title, take care to use both the quotes required by your shell and also TiddlyWiki's double square brackets : `--save "[[Motovun Jack.jpg]]"`
|
||||||
* The filename filter is evaluated with the selected items being set to the title of the tiddler currently being saved, allowing the title to be used as the basis for computing the filename. For example `[encodeuricomponent[]addprefix[static/]]` applies URI encoding to each title, and then adds the prefix `static/`
|
* The filename filter is evaluated with the selected items being set to the title of the tiddler currently being saved, allowing the title to be used as the basis for computing the filename. For example `[encodeuricomponent[]addprefix[static/]]` applies URI encoding to each title, and then adds the prefix `static/`
|
||||||
* The `--save` command is a more flexible replacement for both the `--savetiddler` and `--savetiddlers` commands, which are deprecated
|
* The `--save` command is a more flexible replacement for both the `--savetiddler` and `--savetiddlers` commands, which are deprecated
|
||||||
|
|
||||||
|
|||||||
@@ -1,9 +1,7 @@
|
|||||||
title: $:/language/Import/
|
title: $:/language/Import/
|
||||||
|
|
||||||
Editor/Import/Heading: Import images and insert them into the editor.
|
|
||||||
Imported/Hint: The following tiddlers were imported:
|
Imported/Hint: The following tiddlers were imported:
|
||||||
Listing/Cancel/Caption: Cancel
|
Listing/Cancel/Caption: Cancel
|
||||||
Listing/Cancel/Warning: Do you wish to cancel the import?
|
|
||||||
Listing/Hint: These tiddlers are ready to import:
|
Listing/Hint: These tiddlers are ready to import:
|
||||||
Listing/Import/Caption: Import
|
Listing/Import/Caption: Import
|
||||||
Listing/Select/Caption: Select
|
Listing/Select/Caption: Select
|
||||||
@@ -15,20 +13,11 @@ Listing/Preview/TextRaw: Text (Raw)
|
|||||||
Listing/Preview/Fields: Fields
|
Listing/Preview/Fields: Fields
|
||||||
Listing/Preview/Diff: Diff
|
Listing/Preview/Diff: Diff
|
||||||
Listing/Preview/DiffFields: Diff (Fields)
|
Listing/Preview/DiffFields: Diff (Fields)
|
||||||
Listing/Rename/Tooltip: Rename tiddler before importing
|
Upgrader/Plugins/Suppressed/Incompatible: Blocked incompatible or obsolete plugin
|
||||||
Listing/Rename/Prompt: Rename to:
|
Upgrader/Plugins/Suppressed/Version: Blocked plugin (due to incoming <<incoming>> being older than existing <<existing>>)
|
||||||
Listing/Rename/ConfirmRename: Rename tiddler
|
Upgrader/Plugins/Upgraded: Upgraded plugin from <<incoming>> to <<upgraded>>
|
||||||
Listing/Rename/CancelRename: Cancel
|
Upgrader/State/Suppressed: Blocked temporary state tiddler
|
||||||
Listing/Rename/OverwriteWarning: A tiddler with this title already exists.
|
Upgrader/System/Suppressed: Blocked system tiddler
|
||||||
Upgrader/Plugins/Suppressed/Incompatible: Blocked incompatible or obsolete plugin.
|
Upgrader/System/Warning: Core module tiddler
|
||||||
Upgrader/Plugins/Suppressed/Version: Blocked plugin (due to incoming <<incoming>> not being newer than existing <<existing>>).
|
Upgrader/System/Alert: You are about to import a tiddler that will overwrite a core module tiddler. This is not recommended as it may make the system unstable
|
||||||
Upgrader/Plugins/Upgraded: Upgraded plugin from <<incoming>> to <<upgraded>>.
|
Upgrader/ThemeTweaks/Created: Migrated theme tweak from <$text text=<<from>>/>
|
||||||
Upgrader/State/Suppressed: Blocked temporary state tiddler.
|
|
||||||
Upgrader/System/Disabled: Disabled system tiddler.
|
|
||||||
Upgrader/System/Suppressed: Blocked system tiddler.
|
|
||||||
Upgrader/System/Warning: Core module tiddler.
|
|
||||||
Upgrader/System/Alert: You are about to import a tiddler that will overwrite a core module tiddler. This is not recommended as it may make the system unstable.
|
|
||||||
Upgrader/ThemeTweaks/Created: Migrated theme tweak from <$text text=<<from>>/>.
|
|
||||||
Upgrader/Tiddler/Disabled: Disabled tiddler.
|
|
||||||
Upgrader/Tiddler/Selected: Selected tiddler.
|
|
||||||
Upgrader/Tiddler/Unselected: Unselected tiddler.
|
|
||||||
|
|||||||
@@ -8,14 +8,12 @@ CloseAll/Button: close all
|
|||||||
ColourPicker/Recent: Recent:
|
ColourPicker/Recent: Recent:
|
||||||
ConfirmCancelTiddler: Do you wish to discard changes to the tiddler "<$text text=<<title>>/>"?
|
ConfirmCancelTiddler: Do you wish to discard changes to the tiddler "<$text text=<<title>>/>"?
|
||||||
ConfirmDeleteTiddler: Do you wish to delete the tiddler "<$text text=<<title>>/>"?
|
ConfirmDeleteTiddler: Do you wish to delete the tiddler "<$text text=<<title>>/>"?
|
||||||
ConfirmDeleteTiddlers: Are you sure you wish to delete <<resultCount>> tiddler(s)?
|
|
||||||
ConfirmOverwriteTiddler: Do you wish to overwrite the tiddler "<$text text=<<title>>/>"?
|
ConfirmOverwriteTiddler: Do you wish to overwrite the tiddler "<$text text=<<title>>/>"?
|
||||||
ConfirmEditShadowTiddler: You are about to edit a ShadowTiddler. Any changes will override the default system making future upgrades non-trivial. Are you sure you want to edit "<$text text=<<title>>/>"?
|
ConfirmEditShadowTiddler: You are about to edit a ShadowTiddler. Any changes will override the default system making future upgrades non-trivial. Are you sure you want to edit "<$text text=<<title>>/>"?
|
||||||
ConfirmAction: Do you wish to proceed?
|
|
||||||
Count: count
|
Count: count
|
||||||
DefaultNewTiddlerTitle: New Tiddler
|
DefaultNewTiddlerTitle: New Tiddler
|
||||||
Diffs/CountMessage: <<diff-count>> differences
|
Diffs/CountMessage: <<diff-count>> differences
|
||||||
DropMessage: Drop now (or use the 'Escape' key to cancel)
|
DropMessage: Drop here (or use the 'Escape' key to cancel)
|
||||||
Encryption/Cancel: Cancel
|
Encryption/Cancel: Cancel
|
||||||
Encryption/ConfirmClearPassword: Do you wish to clear the password? This will remove the encryption applied when saving this wiki
|
Encryption/ConfirmClearPassword: Do you wish to clear the password? This will remove the encryption applied when saving this wiki
|
||||||
Encryption/PromptSetPassword: Set a new password for this TiddlyWiki
|
Encryption/PromptSetPassword: Set a new password for this TiddlyWiki
|
||||||
@@ -25,25 +23,21 @@ Encryption/RepeatPassword: Repeat password
|
|||||||
Encryption/PasswordNoMatch: Passwords do not match
|
Encryption/PasswordNoMatch: Passwords do not match
|
||||||
Encryption/SetPassword: Set password
|
Encryption/SetPassword: Set password
|
||||||
Error/Caption: Error
|
Error/Caption: Error
|
||||||
|
Error/EditConflict: File changed on server
|
||||||
Error/Filter: Filter error
|
Error/Filter: Filter error
|
||||||
Error/FilterSyntax: Syntax error in filter expression
|
Error/FilterSyntax: Syntax error in filter expression
|
||||||
Error/FilterRunPrefix: Filter Error: Unknown prefix for filter run
|
|
||||||
Error/IsFilterOperator: Filter Error: Unknown operand for the 'is' filter operator
|
Error/IsFilterOperator: Filter Error: Unknown operand for the 'is' filter operator
|
||||||
Error/FormatFilterOperator: Filter Error: Unknown suffix for the 'format' filter operator
|
Error/FormatFilterOperator: Filter Error: Unknown suffix for the 'format' filter operator
|
||||||
Error/LoadingPluginLibrary: Error loading plugin library
|
Error/LoadingPluginLibrary: Error loading plugin library
|
||||||
Error/NetworkErrorAlert: `<h2>''Network Error''</h2>It looks like the connection to the server has been lost. This may indicate a problem with your network connection. Please attempt to restore network connectivity before continuing.<br><br>''Any unsaved changes will be automatically synchronised when connectivity is restored''.`
|
Error/NetworkErrorAlert: `<h2>''Network Error''</h2>It looks like the connection to the server has been lost. This may indicate a problem with your network connection. Please attempt to restore network connectivity before continuing.<br><br>''Any unsaved changes will be automatically synchronised when connectivity is restored''.`
|
||||||
Error/PutEditConflict: File changed on server
|
|
||||||
Error/PutForbidden: Permission denied
|
|
||||||
Error/PutUnauthorized: Authentication required
|
|
||||||
Error/RecursiveTransclusion: Recursive transclusion error in transclude widget
|
Error/RecursiveTransclusion: Recursive transclusion error in transclude widget
|
||||||
Error/RetrievingSkinny: Error retrieving skinny tiddler list
|
Error/RetrievingSkinny: Error retrieving skinny tiddler list
|
||||||
Error/SavingToTWEdit: Error saving to TWEdit
|
Error/SavingToTWEdit: Error saving to TWEdit
|
||||||
Error/WhileSaving: Error while saving
|
Error/WhileSaving: Error while saving
|
||||||
Error/XMLHttpRequest: XMLHttpRequest error code
|
Error/XMLHttpRequest: XMLHttpRequest error code
|
||||||
Error/ZoominTextNode: Story View Error: It appears you tried to interact with a tiddler that displays in a custom container. This is most likely caused by using `$:/tags/StoryTiddlerTemplateFilter` with a template that contains text or whitespace at the start. Please use the pragma `\whitespace trim` and ensure the whole contents of the tiddler is wrapped in a single HTML element. The text that caused this issue:
|
|
||||||
InternalJavaScriptError/Title: Internal JavaScript Error
|
InternalJavaScriptError/Title: Internal JavaScript Error
|
||||||
InternalJavaScriptError/Hint: Well, this is embarrassing. It is recommended that you restart TiddlyWiki by refreshing your browser
|
InternalJavaScriptError/Hint: Well, this is embarrassing. It is recommended that you restart TiddlyWiki by refreshing your browser
|
||||||
LayoutSwitcher/Description: Open the layout switcher
|
InvalidFieldName: Illegal characters in field name "<$text text=<<fieldName>>/>". Fields can only contain lowercase letters, digits and the characters underscore (`_`), hyphen (`-`) and period (`.`)
|
||||||
LazyLoadingWarning: <p>Trying to load external content from ''<$text text={{!!_canonical_uri}}/>''</p><p>If this message doesn't disappear, either the tiddler content type doesn't match the type of the external content, or you may be using a browser that doesn't support external content for wikis loaded as standalone files. See https://tiddlywiki.com/#ExternalText</p>
|
LazyLoadingWarning: <p>Trying to load external content from ''<$text text={{!!_canonical_uri}}/>''</p><p>If this message doesn't disappear, either the tiddler content type doesn't match the type of the external content, or you may be using a browser that doesn't support external content for wikis loaded as standalone files. See https://tiddlywiki.com/#ExternalText</p>
|
||||||
LoginToTiddlySpace: Login to TiddlySpace
|
LoginToTiddlySpace: Login to TiddlySpace
|
||||||
Manager/Controls/FilterByTag/None: (none)
|
Manager/Controls/FilterByTag/None: (none)
|
||||||
@@ -67,23 +61,13 @@ MissingTiddler/Hint: Missing tiddler "<$text text=<<currentTiddler>>/>" -- click
|
|||||||
No: No
|
No: No
|
||||||
OfficialPluginLibrary: Official ~TiddlyWiki Plugin Library
|
OfficialPluginLibrary: Official ~TiddlyWiki Plugin Library
|
||||||
OfficialPluginLibrary/Hint: The official ~TiddlyWiki plugin library at tiddlywiki.com. Plugins, themes and language packs are maintained by the core team.
|
OfficialPluginLibrary/Hint: The official ~TiddlyWiki plugin library at tiddlywiki.com. Plugins, themes and language packs are maintained by the core team.
|
||||||
PageTemplate/Description: the default ~TiddlyWiki layout
|
|
||||||
PageTemplate/Name: Default ~PageTemplate
|
|
||||||
PluginReloadWarning: Please save {{$:/core/ui/Buttons/save-wiki}} and reload {{$:/core/ui/Buttons/refresh}} to allow changes to ~JavaScript plugins to take effect
|
PluginReloadWarning: Please save {{$:/core/ui/Buttons/save-wiki}} and reload {{$:/core/ui/Buttons/refresh}} to allow changes to ~JavaScript plugins to take effect
|
||||||
RecentChanges/DateFormat: DDth MMM YYYY
|
RecentChanges/DateFormat: DDth MMM YYYY
|
||||||
Shortcuts/Input/AdvancedSearch/Hint: Open the ~AdvancedSearch panel from within the sidebar search field
|
|
||||||
Shortcuts/Input/Accept/Hint: Accept the selected item
|
Shortcuts/Input/Accept/Hint: Accept the selected item
|
||||||
Shortcuts/Input/AcceptVariant/Hint: Accept the selected item (variant)
|
Shortcuts/Input/AcceptVariant/Hint: Accept the selected item (variant)
|
||||||
Shortcuts/Input/Cancel/Hint: Clear the input field
|
Shortcuts/Input/Cancel/Hint: Clear the input field
|
||||||
Shortcuts/Input/Down/Hint: Select the next item
|
Shortcuts/Input/Down/Hint: Select the next item
|
||||||
Shortcuts/Input/Tab-Left/Hint: Select the previous Tab
|
|
||||||
Shortcuts/Input/Tab-Right/Hint: Select the next Tab
|
|
||||||
Shortcuts/Input/Up/Hint: Select the previous item
|
Shortcuts/Input/Up/Hint: Select the previous item
|
||||||
Shortcuts/SidebarLayout/Hint: Change the sidebar layout
|
|
||||||
Switcher/Subtitle/theme: Switch Theme
|
|
||||||
Switcher/Subtitle/layout: Switch Layout
|
|
||||||
Switcher/Subtitle/language: Switch Language
|
|
||||||
Switcher/Subtitle/palette: Switch Palette
|
|
||||||
SystemTiddler/Tooltip: This is a system tiddler
|
SystemTiddler/Tooltip: This is a system tiddler
|
||||||
SystemTiddlers/Include/Prompt: Include system tiddlers
|
SystemTiddlers/Include/Prompt: Include system tiddlers
|
||||||
TagManager/Colour/Heading: Colour
|
TagManager/Colour/Heading: Colour
|
||||||
|
|||||||
21
core/language/en-GB/Modals/SaveInstructions.tid
Normal file
21
core/language/en-GB/Modals/SaveInstructions.tid
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
title: $:/language/Modals/SaveInstructions
|
||||||
|
subtitle: Save your work
|
||||||
|
footer: <$button message="tm-close-tiddler">Close</$button>
|
||||||
|
help: https://tiddlywiki.com/static/SavingChanges.html
|
||||||
|
|
||||||
|
Your changes to this wiki need to be saved as a ~TiddlyWiki HTML file.
|
||||||
|
|
||||||
|
!!! Desktop browsers
|
||||||
|
|
||||||
|
# Select ''Save As'' from the ''File'' menu
|
||||||
|
# Choose a filename and location
|
||||||
|
#* Some browsers also require you to explicitly specify the file saving format as ''Webpage, HTML only'' or similar
|
||||||
|
# Close this tab
|
||||||
|
|
||||||
|
!!! Smartphone browsers
|
||||||
|
|
||||||
|
# Create a bookmark to this page
|
||||||
|
#* If you've got iCloud or Google Sync set up then the bookmark will automatically sync to your desktop where you can open it and save it as above
|
||||||
|
# Close this tab
|
||||||
|
|
||||||
|
//If you open the bookmark again in Mobile Safari you will see this message again. If you want to go ahead and use the file, just click the ''close'' button below//
|
||||||
@@ -1,6 +1,5 @@
|
|||||||
title: $:/language/SideBar/
|
title: $:/language/SideBar/
|
||||||
|
|
||||||
Caption: Sidebar
|
|
||||||
All/Caption: All
|
All/Caption: All
|
||||||
Contents/Caption: Contents
|
Contents/Caption: Contents
|
||||||
Drafts/Caption: Drafts
|
Drafts/Caption: Drafts
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ List/Caption: List
|
|||||||
List/Empty: This tiddler does not have a list
|
List/Empty: This tiddler does not have a list
|
||||||
Listed/Caption: Listed
|
Listed/Caption: Listed
|
||||||
Listed/Empty: This tiddler is not listed by any others
|
Listed/Empty: This tiddler is not listed by any others
|
||||||
References/Caption: Backlinks
|
References/Caption: References
|
||||||
References/Empty: No tiddlers link to this one
|
References/Empty: No tiddlers link to this one
|
||||||
Tagging/Caption: Tagging
|
Tagging/Caption: Tagging
|
||||||
Tagging/Empty: No tiddlers are tagged with this one
|
Tagging/Empty: No tiddlers are tagged with this one
|
||||||
|
|||||||
@@ -154,7 +154,7 @@ Commander.prototype.extractNamedParameters = function(params,mandatoryParameters
|
|||||||
if(errors.length > 0) {
|
if(errors.length > 0) {
|
||||||
return errors.join(" and\n");
|
return errors.join(" and\n");
|
||||||
} else {
|
} else {
|
||||||
return paramsByName;
|
return paramsByName;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -1,42 +0,0 @@
|
|||||||
/*\
|
|
||||||
title: $:/core/modules/commands/commands.js
|
|
||||||
type: application/javascript
|
|
||||||
module-type: command
|
|
||||||
|
|
||||||
Runs the commands returned from a filter
|
|
||||||
|
|
||||||
\*/
|
|
||||||
|
|
||||||
(function() {
|
|
||||||
|
|
||||||
/*jslint node: true, browser: true */
|
|
||||||
/*global $tw: false */
|
|
||||||
"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;
|
|
||||||
|
|
||||||
})();
|
|
||||||
@@ -115,7 +115,7 @@ Command.prototype.fetchFile = function(url,options,callback,redirectCount) {
|
|||||||
if(response.statusCode === 302 || response.statusCode === 303 || response.statusCode === 307) {
|
if(response.statusCode === 302 || response.statusCode === 303 || response.statusCode === 307) {
|
||||||
return self.fetchFile(response.headers.location,options,callback,redirectCount + 1);
|
return self.fetchFile(response.headers.location,options,callback,redirectCount + 1);
|
||||||
} else {
|
} else {
|
||||||
return callback("Error " + response.statusCode + " retrieving " + url)
|
return callback("Error " + response.statusCode + " retrieving " + url)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -132,7 +132,7 @@ Command.prototype.processBody = function(body,type,options,url) {
|
|||||||
// Collect the tiddlers in a wiki
|
// Collect the tiddlers in a wiki
|
||||||
var incomingWiki = new $tw.Wiki();
|
var incomingWiki = new $tw.Wiki();
|
||||||
if(options.raw) {
|
if(options.raw) {
|
||||||
var typeInfo = type ? $tw.config.contentTypeInfo[type] : null,
|
var typeInfo = type ? $tw.utils.getContentTypeInfo(type) : null,
|
||||||
encoding = typeInfo ? typeInfo.encoding : "utf8";
|
encoding = typeInfo ? typeInfo.encoding : "utf8";
|
||||||
incomingWiki.addTiddler(new $tw.Tiddler({
|
incomingWiki.addTiddler(new $tw.Tiddler({
|
||||||
title: url,
|
title: url,
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ Command.prototype.execute = function() {
|
|||||||
}
|
}
|
||||||
// Tweak the tiddlywiki.info to remove any included wikis
|
// Tweak the tiddlywiki.info to remove any included wikis
|
||||||
var packagePath = $tw.boot.wikiPath + "/tiddlywiki.info",
|
var packagePath = $tw.boot.wikiPath + "/tiddlywiki.info",
|
||||||
packageJson = $tw.utils.parseJSONSafe(fs.readFileSync(packagePath));
|
packageJson = JSON.parse(fs.readFileSync(packagePath));
|
||||||
delete packageJson.includeWikis;
|
delete packageJson.includeWikis;
|
||||||
fs.writeFileSync(packagePath,JSON.stringify(packageJson,null,$tw.config.preferences.jsonSpaces));
|
fs.writeFileSync(packagePath,JSON.stringify(packageJson,null,$tw.config.preferences.jsonSpaces));
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
@@ -8,59 +8,58 @@ Render individual tiddlers and save the results to the specified files
|
|||||||
\*/
|
\*/
|
||||||
(function(){
|
(function(){
|
||||||
|
|
||||||
/*jslint node: true, browser: true */
|
/*jslint node: true, browser: true */
|
||||||
/*global $tw: false */
|
/*global $tw: false */
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
var widget = require("$:/core/modules/widgets/widget.js");
|
var widget = require("$:/core/modules/widgets/widget.js");
|
||||||
|
|
||||||
exports.info = {
|
exports.info = {
|
||||||
name: "render",
|
name: "render",
|
||||||
synchronous: true
|
synchronous: true
|
||||||
};
|
};
|
||||||
|
|
||||||
var Command = function(params,commander,callback) {
|
var Command = function(params,commander,callback) {
|
||||||
this.params = params;
|
this.params = params;
|
||||||
this.commander = commander;
|
this.commander = commander;
|
||||||
this.callback = callback;
|
this.callback = callback;
|
||||||
};
|
};
|
||||||
|
|
||||||
Command.prototype.execute = function() {
|
Command.prototype.execute = function() {
|
||||||
if(this.params.length < 1) {
|
if(this.params.length < 1) {
|
||||||
return "Missing tiddler filter";
|
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],
|
||||||
|
varName = this.params[4],
|
||||||
|
varValue = this.params[5],
|
||||||
|
tiddlers = wiki.filterTiddlers(tiddlerFilter);
|
||||||
|
$tw.utils.each(tiddlers,function(title) {
|
||||||
|
var parser = wiki.parseTiddler(template || title),
|
||||||
|
variables = {currentTiddler: title};
|
||||||
|
if(varName) {
|
||||||
|
variables[varName] = varValue || "";
|
||||||
}
|
}
|
||||||
var self = this,
|
var widgetNode = wiki.makeWidget(parser,{variables: variables}),
|
||||||
fs = require("fs"),
|
container = $tw.fakeDocument.createElement("div");
|
||||||
path = require("path"),
|
widgetNode.render(container,null);
|
||||||
wiki = this.commander.wiki,
|
var text = type === "text/html" ? container.innerHTML : container.textContent,
|
||||||
tiddlerFilter = this.params[0],
|
filepath = path.resolve(self.commander.outputPath,wiki.filterTiddlers(filenameFilter,$tw.rootWidget,wiki.makeTiddlerIterator([title]))[0]);
|
||||||
filenameFilter = this.params[1] || "[is[tiddler]addsuffix[.html]]",
|
if(self.commander.verbose) {
|
||||||
type = this.params[2] || "text/html",
|
console.log("Rendering \"" + title + "\" to \"" + filepath + "\"");
|
||||||
template = this.params[3],
|
}
|
||||||
variableList = this.params.slice(4),
|
$tw.utils.createFileDirectories(filepath);
|
||||||
tiddlers = wiki.filterTiddlers(tiddlerFilter),
|
fs.writeFileSync(filepath,text,"utf8");
|
||||||
variables = Object.create(null);
|
});
|
||||||
while(variableList.length >= 2) {
|
return null;
|
||||||
variables[variableList[0]] = variableList[1];
|
};
|
||||||
variableList = variableList.slice(2);
|
|
||||||
}
|
exports.Command = Command;
|
||||||
$tw.utils.each(tiddlers,function(title) {
|
|
||||||
var filepath = path.resolve(self.commander.outputPath,wiki.filterTiddlers(filenameFilter,$tw.rootWidget,wiki.makeTiddlerIterator([title]))[0]);
|
})();
|
||||||
if(self.commander.verbose) {
|
|
||||||
console.log("Rendering \"" + title + "\" to \"" + filepath + "\"");
|
|
||||||
}
|
|
||||||
var parser = wiki.parseTiddler(template || title),
|
|
||||||
widgetNode = wiki.makeWidget(parser,{variables: $tw.utils.extend({},variables,{currentTiddler: title,storyTiddler: title})}),
|
|
||||||
container = $tw.fakeDocument.createElement("div");
|
|
||||||
widgetNode.render(container,null);
|
|
||||||
var text = type === "text/html" ? container.innerHTML : container.textContent;
|
|
||||||
$tw.utils.createFileDirectories(filepath);
|
|
||||||
fs.writeFileSync(filepath,text,"utf8");
|
|
||||||
});
|
|
||||||
return null;
|
|
||||||
};
|
|
||||||
|
|
||||||
exports.Command = Command;
|
|
||||||
|
|
||||||
})();
|
|
||||||
|
|
||||||
|
|||||||
@@ -40,7 +40,6 @@ Command.prototype.execute = function() {
|
|||||||
$tw.utils.createFileDirectories(filename);
|
$tw.utils.createFileDirectories(filename);
|
||||||
if(template) {
|
if(template) {
|
||||||
variables.currentTiddler = title;
|
variables.currentTiddler = title;
|
||||||
variables.storyTiddler = title;
|
|
||||||
title = template;
|
title = template;
|
||||||
}
|
}
|
||||||
if(name && value) {
|
if(name && value) {
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ Command.prototype.execute = function() {
|
|||||||
filter = this.params[0],
|
filter = this.params[0],
|
||||||
template = this.params[1],
|
template = this.params[1],
|
||||||
outputPath = this.commander.outputPath,
|
outputPath = this.commander.outputPath,
|
||||||
pathname = path.resolve(outputPath,this.params[2]),
|
pathname = path.resolve(outputPath,this.params[2]),
|
||||||
type = this.params[3] || "text/html",
|
type = this.params[3] || "text/html",
|
||||||
extension = this.params[4] || ".html",
|
extension = this.params[4] || ".html",
|
||||||
deleteDirectory = (this.params[5] || "").toLowerCase() !== "noclean",
|
deleteDirectory = (this.params[5] || "").toLowerCase() !== "noclean",
|
||||||
@@ -46,7 +46,7 @@ Command.prototype.execute = function() {
|
|||||||
}
|
}
|
||||||
$tw.utils.each(tiddlers,function(title) {
|
$tw.utils.each(tiddlers,function(title) {
|
||||||
var parser = wiki.parseTiddler(template),
|
var parser = wiki.parseTiddler(template),
|
||||||
widgetNode = wiki.makeWidget(parser,{variables: {currentTiddler: title, storyTiddler: title}}),
|
widgetNode = wiki.makeWidget(parser,{variables: {currentTiddler: title}}),
|
||||||
container = $tw.fakeDocument.createElement("div");
|
container = $tw.fakeDocument.createElement("div");
|
||||||
widgetNode.render(container,null);
|
widgetNode.render(container,null);
|
||||||
var text = type === "text/html" ? container.innerHTML : container.textContent,
|
var text = type === "text/html" ? container.innerHTML : container.textContent,
|
||||||
@@ -57,7 +57,7 @@ Command.prototype.execute = function() {
|
|||||||
exportPath = path.resolve(outputPath,macroPath + extension);
|
exportPath = path.resolve(outputPath,macroPath + extension);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
var finalPath = exportPath || path.resolve(pathname,$tw.utils.encodeURIComponentExtended(title) + extension);
|
var finalPath = exportPath || path.resolve(pathname,encodeURIComponent(title) + extension);
|
||||||
$tw.utils.createFileDirectories(finalPath);
|
$tw.utils.createFileDirectories(finalPath);
|
||||||
fs.writeFileSync(finalPath,text,"utf8");
|
fs.writeFileSync(finalPath,text,"utf8");
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -8,60 +8,46 @@ Saves individual tiddlers in their raw text or binary format to the specified fi
|
|||||||
\*/
|
\*/
|
||||||
(function(){
|
(function(){
|
||||||
|
|
||||||
/*jslint node: true, browser: true */
|
/*jslint node: true, browser: true */
|
||||||
/*global $tw: false */
|
/*global $tw: false */
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
exports.info = {
|
exports.info = {
|
||||||
name: "save",
|
name: "save",
|
||||||
synchronous: true
|
synchronous: true
|
||||||
};
|
};
|
||||||
|
|
||||||
var Command = function(params,commander,callback) {
|
var Command = function(params,commander,callback) {
|
||||||
this.params = params;
|
this.params = params;
|
||||||
this.commander = commander;
|
this.commander = commander;
|
||||||
this.callback = callback;
|
this.callback = callback;
|
||||||
};
|
};
|
||||||
|
|
||||||
Command.prototype.execute = function() {
|
Command.prototype.execute = function() {
|
||||||
if(this.params.length < 1) {
|
if(this.params.length < 1) {
|
||||||
return "Missing filename filter";
|
return "Missing filename filter";
|
||||||
|
}
|
||||||
|
var self = this,
|
||||||
|
fs = require("fs"),
|
||||||
|
path = require("path"),
|
||||||
|
wiki = this.commander.wiki,
|
||||||
|
tiddlerFilter = this.params[0],
|
||||||
|
filenameFilter = this.params[1] || "[is[tiddler]]",
|
||||||
|
tiddlers = wiki.filterTiddlers(tiddlerFilter);
|
||||||
|
$tw.utils.each(tiddlers,function(title) {
|
||||||
|
var tiddler = self.commander.wiki.getTiddler(title),
|
||||||
|
type = tiddler.fields.type || "text/vnd.tiddlywiki",
|
||||||
|
contentTypeInfo = $tw.utils.getContentTypeInfo(type) || {encoding: "utf8"},
|
||||||
|
filepath = path.resolve(self.commander.outputPath,wiki.filterTiddlers(filenameFilter,$tw.rootWidget,wiki.makeTiddlerIterator([title]))[0]);
|
||||||
|
if(self.commander.verbose) {
|
||||||
|
console.log("Saving \"" + title + "\" to \"" + filepath + "\"");
|
||||||
}
|
}
|
||||||
var self = this,
|
$tw.utils.createFileDirectories(filepath);
|
||||||
fs = require("fs"),
|
fs.writeFileSync(filepath,tiddler.fields.text,contentTypeInfo.encoding);
|
||||||
path = require("path"),
|
});
|
||||||
result = null,
|
return null;
|
||||||
wiki = this.commander.wiki,
|
};
|
||||||
tiddlerFilter = this.params[0],
|
|
||||||
filenameFilter = this.params[1] || "[is[tiddler]]",
|
exports.Command = Command;
|
||||||
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: {}
|
|
||||||
});
|
|
||||||
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;
|
|
||||||
|
|
||||||
})();
|
|
||||||
|
|
||||||
|
|||||||
@@ -65,11 +65,11 @@ Command.prototype.execute = function() {
|
|||||||
$tw.utils.each(filteredPluginList,function(title) {
|
$tw.utils.each(filteredPluginList,function(title) {
|
||||||
var tiddler = containerData.tiddlers[title];
|
var tiddler = containerData.tiddlers[title];
|
||||||
// Save each JSON file and collect the skinny data
|
// Save each JSON file and collect the skinny data
|
||||||
var pathname = path.resolve(self.commander.outputPath,basepath + $tw.utils.encodeURIComponentExtended(title) + ".json");
|
var pathname = path.resolve(self.commander.outputPath,basepath + encodeURIComponent(title) + ".json");
|
||||||
$tw.utils.createFileDirectories(pathname);
|
$tw.utils.createFileDirectories(pathname);
|
||||||
fs.writeFileSync(pathname,JSON.stringify(tiddler),"utf8");
|
fs.writeFileSync(pathname,JSON.stringify(tiddler),"utf8");
|
||||||
// Collect the skinny list data
|
// Collect the skinny list data
|
||||||
var pluginTiddlers = $tw.utils.parseJSONSafe(tiddler.text),
|
var pluginTiddlers = JSON.parse(tiddler.text),
|
||||||
readmeContent = (pluginTiddlers.tiddlers[title + "/readme"] || {}).text,
|
readmeContent = (pluginTiddlers.tiddlers[title + "/readme"] || {}).text,
|
||||||
doesRequireReload = !!self.commander.wiki.doesPluginInfoRequireReload(pluginTiddlers),
|
doesRequireReload = !!self.commander.wiki.doesPluginInfoRequireReload(pluginTiddlers),
|
||||||
iconTiddler = pluginTiddlers.tiddlers[title + "/icon"] || {},
|
iconTiddler = pluginTiddlers.tiddlers[title + "/icon"] || {},
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ Command.prototype.execute = function() {
|
|||||||
tiddler = this.commander.wiki.getTiddler(title);
|
tiddler = this.commander.wiki.getTiddler(title);
|
||||||
if(tiddler) {
|
if(tiddler) {
|
||||||
var type = tiddler.fields.type || "text/vnd.tiddlywiki",
|
var type = tiddler.fields.type || "text/vnd.tiddlywiki",
|
||||||
contentTypeInfo = $tw.config.contentTypeInfo[type] || {encoding: "utf8"};
|
contentTypeInfo = $tw.utils.getContentTypeInfo(type) || {encoding: "utf8"};
|
||||||
$tw.utils.createFileDirectories(filename);
|
$tw.utils.createFileDirectories(filename);
|
||||||
fs.writeFile(filename,tiddler.fields.text,contentTypeInfo.encoding,function(err) {
|
fs.writeFile(filename,tiddler.fields.text,contentTypeInfo.encoding,function(err) {
|
||||||
self.callback(err);
|
self.callback(err);
|
||||||
|
|||||||
@@ -44,8 +44,8 @@ Command.prototype.execute = function() {
|
|||||||
$tw.utils.each(tiddlers,function(title) {
|
$tw.utils.each(tiddlers,function(title) {
|
||||||
var tiddler = self.commander.wiki.getTiddler(title),
|
var tiddler = self.commander.wiki.getTiddler(title),
|
||||||
type = tiddler.fields.type || "text/vnd.tiddlywiki",
|
type = tiddler.fields.type || "text/vnd.tiddlywiki",
|
||||||
contentTypeInfo = $tw.config.contentTypeInfo[type] || {encoding: "utf8"},
|
contentTypeInfo = $tw.utils.getContentTypeInfo(type) || {encoding: "utf8"},
|
||||||
filename = path.resolve(pathname,$tw.utils.encodeURIComponentExtended(title));
|
filename = path.resolve(pathname,encodeURIComponent(title));
|
||||||
fs.writeFileSync(filename,tiddler.fields.text,contentTypeInfo.encoding);
|
fs.writeFileSync(filename,tiddler.fields.text,contentTypeInfo.encoding);
|
||||||
});
|
});
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
@@ -97,7 +97,7 @@ WikiFolderMaker.prototype.save = function() {
|
|||||||
// A custom plugin
|
// A custom plugin
|
||||||
self.log("Processing custom plugin: " + title);
|
self.log("Processing custom plugin: " + title);
|
||||||
self.saveCustomPlugin(tiddler);
|
self.saveCustomPlugin(tiddler);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Ordinary tiddler
|
// Ordinary tiddler
|
||||||
self.saveTiddler("tiddlers",tiddler);
|
self.saveTiddler("tiddlers",tiddler);
|
||||||
@@ -151,32 +151,18 @@ WikiFolderMaker.prototype.saveCustomPlugin = function(pluginTiddler) {
|
|||||||
pluginInfo = pluginTiddler.getFieldStrings({exclude: ["text","type"]});
|
pluginInfo = pluginTiddler.getFieldStrings({exclude: ["text","type"]});
|
||||||
this.saveJSONFile(directory + path.sep + "plugin.info",pluginInfo);
|
this.saveJSONFile(directory + path.sep + "plugin.info",pluginInfo);
|
||||||
self.log("Writing " + directory + path.sep + "plugin.info: " + JSON.stringify(pluginInfo,null,$tw.config.preferences.jsonSpaces));
|
self.log("Writing " + directory + path.sep + "plugin.info: " + JSON.stringify(pluginInfo,null,$tw.config.preferences.jsonSpaces));
|
||||||
var pluginTiddlers = $tw.utils.parseJSONSafe(pluginTiddler.fields.text).tiddlers; // A hashmap of tiddlers in the plugin
|
var pluginTiddlers = JSON.parse(pluginTiddler.fields.text).tiddlers; // A hashmap of tiddlers in the plugin
|
||||||
$tw.utils.each(pluginTiddlers,function(tiddler) {
|
$tw.utils.each(pluginTiddlers,function(tiddler) {
|
||||||
self.saveTiddler(directory,new $tw.Tiddler(tiddler));
|
self.saveTiddler(directory,new $tw.Tiddler(tiddler));
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
WikiFolderMaker.prototype.saveTiddler = function(directory,tiddler) {
|
WikiFolderMaker.prototype.saveTiddler = function(directory,tiddler) {
|
||||||
var title = tiddler.fields.title, fileInfo, pathFilters, extFilters;
|
|
||||||
if(this.wiki.tiddlerExists("$:/config/FileSystemPaths")) {
|
|
||||||
pathFilters = this.wiki.getTiddlerText("$:/config/FileSystemPaths","").split("\n");
|
|
||||||
}
|
|
||||||
if(this.wiki.tiddlerExists("$:/config/FileSystemExtensions")) {
|
|
||||||
extFilters = this.wiki.getTiddlerText("$:/config/FileSystemExtensions","").split("\n");
|
|
||||||
}
|
|
||||||
var fileInfo = $tw.utils.generateTiddlerFileInfo(tiddler,{
|
var fileInfo = $tw.utils.generateTiddlerFileInfo(tiddler,{
|
||||||
directory: path.resolve(this.wikiFolderPath,directory),
|
directory: path.resolve(this.wikiFolderPath,directory),
|
||||||
pathFilters: pathFilters,
|
wiki: this.wiki
|
||||||
extFilters: extFilters,
|
|
||||||
wiki: this.wiki,
|
|
||||||
fileInfo: {}
|
|
||||||
});
|
});
|
||||||
try {
|
$tw.utils.saveTiddlerToFileSync(tiddler,fileInfo);
|
||||||
$tw.utils.saveTiddlerToFileSync(tiddler,fileInfo);
|
|
||||||
} catch (err) {
|
|
||||||
console.log("SaveWikiFolder: Error saving file '" + fileInfo.filepath + "', tiddler: '" + tiddler.fields.title);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
WikiFolderMaker.prototype.saveJSONFile = function(filename,json) {
|
WikiFolderMaker.prototype.saveJSONFile = function(filename,json) {
|
||||||
|
|||||||
@@ -30,11 +30,11 @@ exports.textPrimitives.wikiLink = exports.textPrimitives.upperLetter + "+" +
|
|||||||
exports.textPrimitives.upperLetter +
|
exports.textPrimitives.upperLetter +
|
||||||
exports.textPrimitives.anyLetter + "*";
|
exports.textPrimitives.anyLetter + "*";
|
||||||
|
|
||||||
exports.htmlEntities = {quot:34, dollar:36, amp:38, apos:39, lt:60, gt:62, nbsp:160, iexcl:161, cent:162, pound:163, curren:164, yen:165, brvbar:166, sect:167, uml:168, copy:169, ordf:170, laquo:171, not:172, shy:173, reg:174, macr:175, deg:176, plusmn:177, sup2:178, sup3:179, acute:180, micro:181, para:182, middot:183, cedil:184, sup1:185, ordm:186, raquo:187, frac14:188, frac12:189, frac34:190, iquest:191, Agrave:192, Aacute:193, Acirc:194, Atilde:195, Auml:196, Aring:197, AElig:198, Ccedil:199, Egrave:200, Eacute:201, Ecirc:202, Euml:203, Igrave:204, Iacute:205, Icirc:206, Iuml:207, ETH:208, Ntilde:209, Ograve:210, Oacute:211, Ocirc:212, Otilde:213, Ouml:214, times:215, Oslash:216, Ugrave:217, Uacute:218, Ucirc:219, Uuml:220, Yacute:221, THORN:222, szlig:223, agrave:224, aacute:225, acirc:226, atilde:227, auml:228, aring:229, aelig:230, ccedil:231, egrave:232, eacute:233, ecirc:234, euml:235, igrave:236, iacute:237, icirc:238, iuml:239, eth:240, ntilde:241, ograve:242, oacute:243, ocirc:244, otilde:245, ouml:246, divide:247, oslash:248, ugrave:249, uacute:250, ucirc:251, uuml:252, yacute:253, thorn:254, yuml:255, OElig:338, oelig:339, Scaron:352, scaron:353, Yuml:376, fnof:402, circ:710, tilde:732, Alpha:913, Beta:914, Gamma:915, Delta:916, Epsilon:917, Zeta:918, Eta:919, Theta:920, Iota:921, Kappa:922, Lambda:923, Mu:924, Nu:925, Xi:926, Omicron:927, Pi:928, Rho:929, Sigma:931, Tau:932, Upsilon:933, Phi:934, Chi:935, Psi:936, Omega:937, alpha:945, beta:946, gamma:947, delta:948, epsilon:949, zeta:950, eta:951, theta:952, iota:953, kappa:954, lambda:955, mu:956, nu:957, xi:958, omicron:959, pi:960, rho:961, sigmaf:962, sigma:963, tau:964, upsilon:965, phi:966, chi:967, psi:968, omega:969, thetasym:977, upsih:978, piv:982, ensp:8194, emsp:8195, thinsp:8201, zwnj:8204, zwj:8205, lrm:8206, rlm:8207, ndash:8211, mdash:8212, lsquo:8216, rsquo:8217, sbquo:8218, ldquo:8220, rdquo:8221, bdquo:8222, dagger:8224, Dagger:8225, bull:8226, hellip:8230, permil:8240, prime:8242, Prime:8243, lsaquo:8249, rsaquo:8250, oline:8254, frasl:8260, euro:8364, image:8465, weierp:8472, real:8476, trade:8482, alefsym:8501, larr:8592, uarr:8593, rarr:8594, darr:8595, harr:8596, crarr:8629, lArr:8656, uArr:8657, rArr:8658, dArr:8659, hArr:8660, forall:8704, part:8706, exist:8707, empty:8709, nabla:8711, isin:8712, notin:8713, ni:8715, prod:8719, sum:8721, minus:8722, lowast:8727, radic:8730, prop:8733, infin:8734, ang:8736, and:8743, or:8744, cap:8745, cup:8746, int:8747, there4:8756, sim:8764, cong:8773, asymp:8776, ne:8800, equiv:8801, le:8804, ge:8805, sub:8834, sup:8835, nsub:8836, sube:8838, supe:8839, oplus:8853, otimes:8855, perp:8869, sdot:8901, lceil:8968, rceil:8969, lfloor:8970, rfloor:8971, lang:9001, rang:9002, loz:9674, spades:9824, clubs:9827, hearts:9829, diams:9830 };
|
exports.htmlEntities = {quot:34, amp:38, apos:39, lt:60, gt:62, nbsp:160, iexcl:161, cent:162, pound:163, curren:164, yen:165, brvbar:166, sect:167, uml:168, copy:169, ordf:170, laquo:171, not:172, shy:173, reg:174, macr:175, deg:176, plusmn:177, sup2:178, sup3:179, acute:180, micro:181, para:182, middot:183, cedil:184, sup1:185, ordm:186, raquo:187, frac14:188, frac12:189, frac34:190, iquest:191, Agrave:192, Aacute:193, Acirc:194, Atilde:195, Auml:196, Aring:197, AElig:198, Ccedil:199, Egrave:200, Eacute:201, Ecirc:202, Euml:203, Igrave:204, Iacute:205, Icirc:206, Iuml:207, ETH:208, Ntilde:209, Ograve:210, Oacute:211, Ocirc:212, Otilde:213, Ouml:214, times:215, Oslash:216, Ugrave:217, Uacute:218, Ucirc:219, Uuml:220, Yacute:221, THORN:222, szlig:223, agrave:224, aacute:225, acirc:226, atilde:227, auml:228, aring:229, aelig:230, ccedil:231, egrave:232, eacute:233, ecirc:234, euml:235, igrave:236, iacute:237, icirc:238, iuml:239, eth:240, ntilde:241, ograve:242, oacute:243, ocirc:244, otilde:245, ouml:246, divide:247, oslash:248, ugrave:249, uacute:250, ucirc:251, uuml:252, yacute:253, thorn:254, yuml:255, OElig:338, oelig:339, Scaron:352, scaron:353, Yuml:376, fnof:402, circ:710, tilde:732, Alpha:913, Beta:914, Gamma:915, Delta:916, Epsilon:917, Zeta:918, Eta:919, Theta:920, Iota:921, Kappa:922, Lambda:923, Mu:924, Nu:925, Xi:926, Omicron:927, Pi:928, Rho:929, Sigma:931, Tau:932, Upsilon:933, Phi:934, Chi:935, Psi:936, Omega:937, alpha:945, beta:946, gamma:947, delta:948, epsilon:949, zeta:950, eta:951, theta:952, iota:953, kappa:954, lambda:955, mu:956, nu:957, xi:958, omicron:959, pi:960, rho:961, sigmaf:962, sigma:963, tau:964, upsilon:965, phi:966, chi:967, psi:968, omega:969, thetasym:977, upsih:978, piv:982, ensp:8194, emsp:8195, thinsp:8201, zwnj:8204, zwj:8205, lrm:8206, rlm:8207, ndash:8211, mdash:8212, lsquo:8216, rsquo:8217, sbquo:8218, ldquo:8220, rdquo:8221, bdquo:8222, dagger:8224, Dagger:8225, bull:8226, hellip:8230, permil:8240, prime:8242, Prime:8243, lsaquo:8249, rsaquo:8250, oline:8254, frasl:8260, euro:8364, image:8465, weierp:8472, real:8476, trade:8482, alefsym:8501, larr:8592, uarr:8593, rarr:8594, darr:8595, harr:8596, crarr:8629, lArr:8656, uArr:8657, rArr:8658, dArr:8659, hArr:8660, forall:8704, part:8706, exist:8707, empty:8709, nabla:8711, isin:8712, notin:8713, ni:8715, prod:8719, sum:8721, minus:8722, lowast:8727, radic:8730, prop:8733, infin:8734, ang:8736, and:8743, or:8744, cap:8745, cup:8746, int:8747, there4:8756, sim:8764, cong:8773, asymp:8776, ne:8800, equiv:8801, le:8804, ge:8805, sub:8834, sup:8835, nsub:8836, sube:8838, supe:8839, oplus:8853, otimes:8855, perp:8869, sdot:8901, lceil:8968, rceil:8969, lfloor:8970, rfloor:8971, lang:9001, rang:9002, loz:9674, spades:9824, clubs:9827, hearts:9829, diams:9830 };
|
||||||
|
|
||||||
exports.htmlVoidElements = "area,base,br,col,command,embed,hr,img,input,keygen,link,meta,param,source,track,wbr".split(",");
|
exports.htmlVoidElements = "area,base,br,col,command,embed,hr,img,input,keygen,link,meta,param,source,track,wbr".split(",");
|
||||||
|
|
||||||
exports.htmlBlockElements = "address,article,aside,audio,blockquote,canvas,dd,details,div,dl,dt,fieldset,figcaption,figure,footer,form,h1,h2,h3,h4,h5,h6,header,hgroup,hr,li,nav,ol,p,pre,section,summary,table,tfoot,ul,video".split(",");
|
exports.htmlBlockElements = "address,article,aside,audio,blockquote,canvas,dd,div,dl,fieldset,figcaption,figure,footer,form,h1,h2,h3,h4,h5,h6,header,hgroup,hr,li,noscript,ol,output,p,pre,section,table,tfoot,ul,video".split(",");
|
||||||
|
|
||||||
exports.htmlUnsafeElements = "script".split(",");
|
exports.htmlUnsafeElements = "script".split(",");
|
||||||
|
|
||||||
|
|||||||
@@ -12,121 +12,6 @@ Functions to deserialise tiddlers from a block of text
|
|||||||
/*global $tw: false */
|
/*global $tw: false */
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
exports["application/x-tiddler-html-div"] = function(text,fields) {
|
|
||||||
return [deserializeTiddlerDiv(text,fields)];
|
|
||||||
};
|
|
||||||
|
|
||||||
exports["application/json"] = function(text,fields) {
|
|
||||||
var results = [],
|
|
||||||
incoming = $tw.utils.parseJSONSafe(text,function(err) {
|
|
||||||
return [{
|
|
||||||
title: "JSON error: " + err,
|
|
||||||
text: ""
|
|
||||||
}];
|
|
||||||
});
|
|
||||||
if(!$tw.utils.isArray(incoming)) {
|
|
||||||
incoming = [incoming];
|
|
||||||
}
|
|
||||||
for(var t=0; t<incoming.length; t++) {
|
|
||||||
var incomingFields = incoming[t],
|
|
||||||
fields = {};
|
|
||||||
for(var f in incomingFields) {
|
|
||||||
if(typeof incomingFields[f] === "string") {
|
|
||||||
fields[f] = incomingFields[f];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
results.push(fields);
|
|
||||||
}
|
|
||||||
return results;
|
|
||||||
};
|
|
||||||
|
|
||||||
/*
|
|
||||||
Parse an HTML file into tiddlers. There are three possibilities:
|
|
||||||
# A TiddlyWiki classic HTML file containing `text/x-tiddlywiki` tiddlers
|
|
||||||
# A TiddlyWiki5 HTML file containing `text/vnd.tiddlywiki` tiddlers
|
|
||||||
# An ordinary HTML file
|
|
||||||
*/
|
|
||||||
exports["text/html"] = function(text,fields) {
|
|
||||||
var results = [];
|
|
||||||
// Check if we've got an old-style store area
|
|
||||||
var storeAreaMarkerRegExp = /<div id=["']?storeArea['"]?( style=["']?display:none;["']?)?>/gi,
|
|
||||||
storeAreaMatch = storeAreaMarkerRegExp.exec(text);
|
|
||||||
if(storeAreaMatch) {
|
|
||||||
// If so, we've got tiddlers in classic TiddlyWiki format or unencrypted old-style TW5 format
|
|
||||||
results.push.apply(results,deserializeStoreArea(text,storeAreaMarkerRegExp.lastIndex,!!storeAreaMatch[1],fields));
|
|
||||||
}
|
|
||||||
// Check for new-style store areas
|
|
||||||
var newStoreAreaMarkerRegExp = /<script class="tiddlywiki-tiddler-store" type="([^"]*)">/gi,
|
|
||||||
newStoreAreaMatch = newStoreAreaMarkerRegExp.exec(text),
|
|
||||||
haveHadNewStoreArea = !!newStoreAreaMatch;
|
|
||||||
while(newStoreAreaMatch) {
|
|
||||||
results.push.apply(results,deserializeNewStoreArea(text,newStoreAreaMarkerRegExp.lastIndex,newStoreAreaMatch[1],fields));
|
|
||||||
newStoreAreaMatch = newStoreAreaMarkerRegExp.exec(text);
|
|
||||||
}
|
|
||||||
// Return if we had either an old-style or a new-style store area
|
|
||||||
if(storeAreaMatch || haveHadNewStoreArea) {
|
|
||||||
return results;
|
|
||||||
}
|
|
||||||
// Otherwise, check whether we've got an encrypted file
|
|
||||||
var encryptedStoreArea = $tw.utils.extractEncryptedStoreArea(text);
|
|
||||||
if(encryptedStoreArea) {
|
|
||||||
// If so, attempt to decrypt it using the current password
|
|
||||||
return $tw.utils.decryptStoreArea(encryptedStoreArea);
|
|
||||||
} else {
|
|
||||||
// It's not a TiddlyWiki so we'll return the entire HTML file as a tiddler
|
|
||||||
return deserializeHtmlFile(text,fields);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
function deserializeHtmlFile(text,fields) {
|
|
||||||
var result = {};
|
|
||||||
$tw.utils.each(fields,function(value,name) {
|
|
||||||
result[name] = value;
|
|
||||||
});
|
|
||||||
result.text = text;
|
|
||||||
result.type = "text/html";
|
|
||||||
return [result];
|
|
||||||
}
|
|
||||||
|
|
||||||
function deserializeNewStoreArea(text,storeAreaEnd,type,fields) {
|
|
||||||
var endOfScriptRegExp = /<\/script>/gi;
|
|
||||||
endOfScriptRegExp.lastIndex = storeAreaEnd;
|
|
||||||
var match = endOfScriptRegExp.exec(text);
|
|
||||||
if(match) {
|
|
||||||
var scriptContent = text.substring(storeAreaEnd,match.index);
|
|
||||||
return $tw.wiki.deserializeTiddlers(type,scriptContent);
|
|
||||||
} else {
|
|
||||||
return [];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function deserializeStoreArea(text,storeAreaEnd,isTiddlyWiki5,fields) {
|
|
||||||
var results = [],
|
|
||||||
endOfDivRegExp = /(<\/div>\s*)/gi,
|
|
||||||
startPos = storeAreaEnd,
|
|
||||||
defaultType = isTiddlyWiki5 ? undefined : "text/x-tiddlywiki";
|
|
||||||
endOfDivRegExp.lastIndex = startPos;
|
|
||||||
var match = endOfDivRegExp.exec(text);
|
|
||||||
while(match) {
|
|
||||||
var endPos = endOfDivRegExp.lastIndex,
|
|
||||||
tiddlerFields = deserializeTiddlerDiv(text.substring(startPos,endPos),fields,{type: defaultType});
|
|
||||||
if(!tiddlerFields) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
$tw.utils.each(tiddlerFields,function(value,name) {
|
|
||||||
if(typeof value === "string") {
|
|
||||||
tiddlerFields[name] = $tw.utils.htmlDecode(value);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
if(tiddlerFields.text !== null) {
|
|
||||||
results.push(tiddlerFields);
|
|
||||||
}
|
|
||||||
startPos = endPos;
|
|
||||||
match = endOfDivRegExp.exec(text);
|
|
||||||
}
|
|
||||||
return results;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Utility function to parse an old-style tiddler DIV in a *.tid file. It looks like this:
|
Utility function to parse an old-style tiddler DIV in a *.tid file. It looks like this:
|
||||||
|
|
||||||
@@ -139,7 +24,7 @@ Note that the field attributes are HTML encoded, but that the body of the <PRE>
|
|||||||
|
|
||||||
When these tiddler DIVs are encountered within a TiddlyWiki HTML file then the body is encoded in the usual way.
|
When these tiddler DIVs are encountered within a TiddlyWiki HTML file then the body is encoded in the usual way.
|
||||||
*/
|
*/
|
||||||
var deserializeTiddlerDiv = function(text /* [,fields] */) {
|
var parseTiddlerDiv = function(text /* [,fields] */) {
|
||||||
// Slot together the default results
|
// Slot together the default results
|
||||||
var result = {};
|
var result = {};
|
||||||
if(arguments.length > 1) {
|
if(arguments.length > 1) {
|
||||||
@@ -182,4 +67,106 @@ var deserializeTiddlerDiv = function(text /* [,fields] */) {
|
|||||||
return undefined;
|
return undefined;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
exports["application/x-tiddler-html-div"] = function(text,fields) {
|
||||||
|
return [parseTiddlerDiv(text,fields)];
|
||||||
|
};
|
||||||
|
|
||||||
|
exports["application/json"] = function(text,fields) {
|
||||||
|
var incoming,
|
||||||
|
results = [];
|
||||||
|
try {
|
||||||
|
incoming = JSON.parse(text);
|
||||||
|
} catch(e) {
|
||||||
|
incoming = [{
|
||||||
|
title: "JSON error: " + e,
|
||||||
|
text: ""
|
||||||
|
}]
|
||||||
|
}
|
||||||
|
if(!$tw.utils.isArray(incoming)) {
|
||||||
|
incoming = [incoming];
|
||||||
|
}
|
||||||
|
for(var t=0; t<incoming.length; t++) {
|
||||||
|
var incomingFields = incoming[t],
|
||||||
|
fields = {};
|
||||||
|
for(var f in incomingFields) {
|
||||||
|
if(typeof incomingFields[f] === "string") {
|
||||||
|
fields[f] = incomingFields[f];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
results.push(fields);
|
||||||
|
}
|
||||||
|
return results;
|
||||||
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
Parse an HTML file into tiddlers. There are three possibilities:
|
||||||
|
# A TiddlyWiki classic HTML file containing `text/x-tiddlywiki` tiddlers
|
||||||
|
# A TiddlyWiki5 HTML file containing `text/vnd.tiddlywiki` tiddlers
|
||||||
|
# An ordinary HTML file
|
||||||
|
*/
|
||||||
|
exports["text/html"] = function(text,fields) {
|
||||||
|
// Check if we've got a store area
|
||||||
|
var storeAreaMarkerRegExp = /<div id=["']?storeArea['"]?( style=["']?display:none;["']?)?>/gi,
|
||||||
|
match = storeAreaMarkerRegExp.exec(text);
|
||||||
|
if(match) {
|
||||||
|
// If so, it's either a classic TiddlyWiki file or an unencrypted TW5 file
|
||||||
|
// First read the normal tiddlers
|
||||||
|
var results = deserializeTiddlyWikiFile(text,storeAreaMarkerRegExp.lastIndex,!!match[1],fields);
|
||||||
|
// Then any system tiddlers
|
||||||
|
var systemAreaMarkerRegExp = /<div id=["']?systemArea['"]?( style=["']?display:none;["']?)?>/gi,
|
||||||
|
sysMatch = systemAreaMarkerRegExp.exec(text);
|
||||||
|
if(sysMatch) {
|
||||||
|
results.push.apply(results,deserializeTiddlyWikiFile(text,systemAreaMarkerRegExp.lastIndex,!!sysMatch[1],fields));
|
||||||
|
}
|
||||||
|
return results;
|
||||||
|
} else {
|
||||||
|
// Check whether we've got an encrypted file
|
||||||
|
var encryptedStoreArea = $tw.utils.extractEncryptedStoreArea(text);
|
||||||
|
if(encryptedStoreArea) {
|
||||||
|
// If so, attempt to decrypt it using the current password
|
||||||
|
return $tw.utils.decryptStoreArea(encryptedStoreArea);
|
||||||
|
} else {
|
||||||
|
// It's not a TiddlyWiki so we'll return the entire HTML file as a tiddler
|
||||||
|
return deserializeHtmlFile(text,fields);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
function deserializeHtmlFile(text,fields) {
|
||||||
|
var result = {};
|
||||||
|
$tw.utils.each(fields,function(value,name) {
|
||||||
|
result[name] = value;
|
||||||
|
});
|
||||||
|
result.text = text;
|
||||||
|
result.type = "text/html";
|
||||||
|
return [result];
|
||||||
|
}
|
||||||
|
|
||||||
|
function deserializeTiddlyWikiFile(text,storeAreaEnd,isTiddlyWiki5,fields) {
|
||||||
|
var results = [],
|
||||||
|
endOfDivRegExp = /(<\/div>\s*)/gi,
|
||||||
|
startPos = storeAreaEnd,
|
||||||
|
defaultType = isTiddlyWiki5 ? undefined : "text/x-tiddlywiki";
|
||||||
|
endOfDivRegExp.lastIndex = startPos;
|
||||||
|
var match = endOfDivRegExp.exec(text);
|
||||||
|
while(match) {
|
||||||
|
var endPos = endOfDivRegExp.lastIndex,
|
||||||
|
tiddlerFields = parseTiddlerDiv(text.substring(startPos,endPos),fields,{type: defaultType});
|
||||||
|
if(!tiddlerFields) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
$tw.utils.each(tiddlerFields,function(value,name) {
|
||||||
|
if(typeof value === "string") {
|
||||||
|
tiddlerFields[name] = $tw.utils.htmlDecode(value);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
if(tiddlerFields.text !== null) {
|
||||||
|
results.push(tiddlerFields);
|
||||||
|
}
|
||||||
|
startPos = endPos;
|
||||||
|
match = endOfDivRegExp.exec(text);
|
||||||
|
}
|
||||||
|
return results;
|
||||||
|
}
|
||||||
|
|
||||||
})();
|
})();
|
||||||
|
|||||||
@@ -34,16 +34,15 @@ function FramedEngine(options) {
|
|||||||
this.parentNode.insertBefore(this.iframeNode,this.nextSibling);
|
this.parentNode.insertBefore(this.iframeNode,this.nextSibling);
|
||||||
this.iframeDoc = this.iframeNode.contentWindow.document;
|
this.iframeDoc = this.iframeNode.contentWindow.document;
|
||||||
// (Firefox requires us to put some empty content in the iframe)
|
// (Firefox requires us to put some empty content in the iframe)
|
||||||
var paletteTitle = this.widget.wiki.getTiddlerText("$:/palette");
|
|
||||||
var colorScheme = (this.widget.wiki.getTiddler(paletteTitle) || {fields: {}}).fields["color-scheme"] || "light";
|
|
||||||
this.iframeDoc.open();
|
this.iframeDoc.open();
|
||||||
this.iframeDoc.write("<meta name='color-scheme' content='" + colorScheme + "'>");
|
this.iframeDoc.write("");
|
||||||
this.iframeDoc.close();
|
this.iframeDoc.close();
|
||||||
// Style the iframe
|
// Style the iframe
|
||||||
this.iframeNode.className = this.dummyTextArea.className;
|
this.iframeNode.className = this.dummyTextArea.className;
|
||||||
this.iframeNode.style.border = "none";
|
this.iframeNode.style.border = "none";
|
||||||
this.iframeNode.style.padding = "0";
|
this.iframeNode.style.padding = "0";
|
||||||
this.iframeNode.style.resize = "none";
|
this.iframeNode.style.resize = "none";
|
||||||
|
this.iframeNode.style["background-color"] = this.widget.wiki.extractTiddlerDataItem(this.widget.wiki.getTiddlerText("$:/palette"),"tiddler-editor-background");
|
||||||
this.iframeDoc.body.style.margin = "0";
|
this.iframeDoc.body.style.margin = "0";
|
||||||
this.iframeDoc.body.style.padding = "0";
|
this.iframeDoc.body.style.padding = "0";
|
||||||
this.widget.domNodes.push(this.iframeNode);
|
this.widget.domNodes.push(this.iframeNode);
|
||||||
@@ -75,33 +74,15 @@ function FramedEngine(options) {
|
|||||||
if(this.widget.editTabIndex) {
|
if(this.widget.editTabIndex) {
|
||||||
this.iframeNode.setAttribute("tabindex",this.widget.editTabIndex);
|
this.iframeNode.setAttribute("tabindex",this.widget.editTabIndex);
|
||||||
}
|
}
|
||||||
if(this.widget.editAutoComplete) {
|
|
||||||
this.domNode.setAttribute("autocomplete",this.widget.editAutoComplete);
|
|
||||||
}
|
|
||||||
if(this.widget.isDisabled === "yes") {
|
|
||||||
this.domNode.setAttribute("disabled",true);
|
|
||||||
}
|
|
||||||
// Copy the styles from the dummy textarea
|
// Copy the styles from the dummy textarea
|
||||||
this.copyStyles();
|
this.copyStyles();
|
||||||
// Add event listeners
|
// Add event listeners
|
||||||
$tw.utils.addEventListeners(this.domNode,[
|
$tw.utils.addEventListeners(this.domNode,[
|
||||||
{name: "click",handlerObject: this,handlerMethod: "handleClickEvent"},
|
{name: "click",handlerObject: this,handlerMethod: "handleClickEvent"},
|
||||||
{name: "input",handlerObject: this,handlerMethod: "handleInputEvent"},
|
{name: "input",handlerObject: this,handlerMethod: "handleInputEvent"},
|
||||||
{name: "keydown",handlerObject: this,handlerMethod: "handleKeydownEvent"},
|
{name: "keydown",handlerObject: this.widget,handlerMethod: "handleKeydownEvent"},
|
||||||
{name: "focus",handlerObject: this,handlerMethod: "handleFocusEvent"}
|
{name: "focus",handlerObject: this,handlerMethod: "handleFocusEvent"}
|
||||||
]);
|
]);
|
||||||
// Add drag and drop event listeners if fileDrop is enabled
|
|
||||||
if(this.widget.isFileDropEnabled) {
|
|
||||||
$tw.utils.addEventListeners(this.domNode,[
|
|
||||||
{name: "dragenter",handlerObject: this.widget,handlerMethod: "handleDragEnterEvent"},
|
|
||||||
{name: "dragover",handlerObject: this.widget,handlerMethod: "handleDragOverEvent"},
|
|
||||||
{name: "dragleave",handlerObject: this.widget,handlerMethod: "handleDragLeaveEvent"},
|
|
||||||
{name: "dragend",handlerObject: this.widget,handlerMethod: "handleDragEndEvent"},
|
|
||||||
{name: "drop", handlerObject: this.widget,handlerMethod: "handleDropEvent"},
|
|
||||||
{name: "paste", handlerObject: this.widget,handlerMethod: "handlePasteEvent"},
|
|
||||||
{name: "click",handlerObject: this.widget,handlerMethod: "handleClickEvent"}
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
// Insert the element into the DOM
|
// Insert the element into the DOM
|
||||||
this.iframeDoc.body.appendChild(this.domNode);
|
this.iframeDoc.body.appendChild(this.domNode);
|
||||||
}
|
}
|
||||||
@@ -116,6 +97,7 @@ FramedEngine.prototype.copyStyles = function() {
|
|||||||
this.domNode.style.display = "block";
|
this.domNode.style.display = "block";
|
||||||
this.domNode.style.width = "100%";
|
this.domNode.style.width = "100%";
|
||||||
this.domNode.style.margin = "0";
|
this.domNode.style.margin = "0";
|
||||||
|
this.domNode.style["background-color"] = this.widget.wiki.extractTiddlerDataItem(this.widget.wiki.getTiddlerText("$:/palette"),"tiddler-editor-background");
|
||||||
// In Chrome setting -webkit-text-fill-color overrides the placeholder text colour
|
// In Chrome setting -webkit-text-fill-color overrides the placeholder text colour
|
||||||
this.domNode.style["-webkit-text-fill-color"] = "currentcolor";
|
this.domNode.style["-webkit-text-fill-color"] = "currentcolor";
|
||||||
};
|
};
|
||||||
@@ -137,11 +119,7 @@ FramedEngine.prototype.setText = function(text,type) {
|
|||||||
Update the DomNode with the new text
|
Update the DomNode with the new text
|
||||||
*/
|
*/
|
||||||
FramedEngine.prototype.updateDomNodeText = function(text) {
|
FramedEngine.prototype.updateDomNodeText = function(text) {
|
||||||
try {
|
this.domNode.value = text;
|
||||||
this.domNode.value = text;
|
|
||||||
} catch(e) {
|
|
||||||
// Ignore
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -162,13 +140,13 @@ FramedEngine.prototype.fixHeight = function() {
|
|||||||
if(this.widget.editAutoHeight) {
|
if(this.widget.editAutoHeight) {
|
||||||
if(this.domNode && !this.domNode.isTiddlyWikiFakeDom) {
|
if(this.domNode && !this.domNode.isTiddlyWikiFakeDom) {
|
||||||
var newHeight = $tw.utils.resizeTextAreaToFit(this.domNode,this.widget.editMinHeight);
|
var newHeight = $tw.utils.resizeTextAreaToFit(this.domNode,this.widget.editMinHeight);
|
||||||
this.iframeNode.style.height = newHeight + "px";
|
this.iframeNode.style.height = (newHeight + 14) + "px"; // +14 for the border on the textarea
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
var fixedHeight = parseInt(this.widget.wiki.getTiddlerText(HEIGHT_VALUE_TITLE,"400px"),10);
|
var fixedHeight = parseInt(this.widget.wiki.getTiddlerText(HEIGHT_VALUE_TITLE,"400px"),10);
|
||||||
fixedHeight = Math.max(fixedHeight,20);
|
fixedHeight = Math.max(fixedHeight,20);
|
||||||
this.domNode.style.height = fixedHeight + "px";
|
this.domNode.style.height = fixedHeight + "px";
|
||||||
this.iframeNode.style.height = fixedHeight + "px";
|
this.iframeNode.style.height = (fixedHeight + 14) + "px";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -177,11 +155,9 @@ FramedEngine.prototype.fixHeight = function() {
|
|||||||
Focus the engine node
|
Focus the engine node
|
||||||
*/
|
*/
|
||||||
FramedEngine.prototype.focus = function() {
|
FramedEngine.prototype.focus = function() {
|
||||||
if(this.domNode.focus) {
|
if(this.domNode.focus && this.domNode.select) {
|
||||||
this.domNode.focus();
|
this.domNode.focus();
|
||||||
}
|
this.domNode.select();
|
||||||
if(this.domNode.select) {
|
|
||||||
$tw.utils.setSelectionByPosition(this.domNode,this.widget.editFocusSelectFromStart,this.widget.editFocusSelectFromEnd);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -190,21 +166,10 @@ Handle a focus event
|
|||||||
*/
|
*/
|
||||||
FramedEngine.prototype.handleFocusEvent = function(event) {
|
FramedEngine.prototype.handleFocusEvent = function(event) {
|
||||||
if(this.widget.editCancelPopups) {
|
if(this.widget.editCancelPopups) {
|
||||||
$tw.popup.cancel(0);
|
$tw.popup.cancel(0);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
|
||||||
Handle a keydown event
|
|
||||||
*/
|
|
||||||
FramedEngine.prototype.handleKeydownEvent = function(event) {
|
|
||||||
if ($tw.keyboardManager.handleKeydownEvent(event, {onlyPriority: true})) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return this.widget.handleKeydownEvent(event);
|
|
||||||
};
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Handle a click
|
Handle a click
|
||||||
*/
|
*/
|
||||||
@@ -220,7 +185,7 @@ FramedEngine.prototype.handleInputEvent = function(event) {
|
|||||||
this.widget.saveChanges(this.getText());
|
this.widget.saveChanges(this.getText());
|
||||||
this.fixHeight();
|
this.fixHeight();
|
||||||
if(this.widget.editInputActions) {
|
if(this.widget.editInputActions) {
|
||||||
this.widget.invokeActionString(this.widget.editInputActions,this,event,{actionValue: this.getText()});
|
this.widget.invokeActionString(this.widget.editInputActions);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -52,12 +52,6 @@ function SimpleEngine(options) {
|
|||||||
if(this.widget.editTabIndex) {
|
if(this.widget.editTabIndex) {
|
||||||
this.domNode.setAttribute("tabindex",this.widget.editTabIndex);
|
this.domNode.setAttribute("tabindex",this.widget.editTabIndex);
|
||||||
}
|
}
|
||||||
if(this.widget.editAutoComplete) {
|
|
||||||
this.domNode.setAttribute("autocomplete",this.widget.editAutoComplete);
|
|
||||||
}
|
|
||||||
if(this.widget.isDisabled === "yes") {
|
|
||||||
this.domNode.setAttribute("disabled",true);
|
|
||||||
}
|
|
||||||
// Add an input event handler
|
// Add an input event handler
|
||||||
$tw.utils.addEventListeners(this.domNode,[
|
$tw.utils.addEventListeners(this.domNode,[
|
||||||
{name: "focus", handlerObject: this, handlerMethod: "handleFocusEvent"},
|
{name: "focus", handlerObject: this, handlerMethod: "handleFocusEvent"},
|
||||||
@@ -85,11 +79,7 @@ SimpleEngine.prototype.setText = function(text,type) {
|
|||||||
Update the DomNode with the new text
|
Update the DomNode with the new text
|
||||||
*/
|
*/
|
||||||
SimpleEngine.prototype.updateDomNodeText = function(text) {
|
SimpleEngine.prototype.updateDomNodeText = function(text) {
|
||||||
try {
|
this.domNode.value = text;
|
||||||
this.domNode.value = text;
|
|
||||||
} catch(e) {
|
|
||||||
// Ignore
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -119,12 +109,10 @@ SimpleEngine.prototype.fixHeight = function() {
|
|||||||
/*
|
/*
|
||||||
Focus the engine node
|
Focus the engine node
|
||||||
*/
|
*/
|
||||||
SimpleEngine.prototype.focus = function() {
|
SimpleEngine.prototype.focus = function() {
|
||||||
if(this.domNode.focus) {
|
if(this.domNode.focus && this.domNode.select) {
|
||||||
this.domNode.focus();
|
this.domNode.focus();
|
||||||
}
|
this.domNode.select();
|
||||||
if(this.domNode.select) {
|
|
||||||
$tw.utils.setSelectionByPosition(this.domNode,this.widget.editFocusSelectFromStart,this.widget.editFocusSelectFromEnd);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -135,7 +123,7 @@ SimpleEngine.prototype.handleInputEvent = function(event) {
|
|||||||
this.widget.saveChanges(this.getText());
|
this.widget.saveChanges(this.getText());
|
||||||
this.fixHeight();
|
this.fixHeight();
|
||||||
if(this.widget.editInputActions) {
|
if(this.widget.editInputActions) {
|
||||||
this.widget.invokeActionString(this.widget.editInputActions,this,event,{actionValue: this.getText()});
|
this.widget.invokeActionString(this.widget.editInputActions);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -103,11 +103,7 @@ function editTextWidgetFactory(toolbarEngine,nonToolbarEngine) {
|
|||||||
var tiddler = this.wiki.getTiddler(this.editTitle);
|
var tiddler = this.wiki.getTiddler(this.editTitle);
|
||||||
if(tiddler) {
|
if(tiddler) {
|
||||||
// If we've got a tiddler, the value to display is the field string value
|
// If we've got a tiddler, the value to display is the field string value
|
||||||
if(tiddler.hasField(this.editField)) {
|
value = tiddler.getFieldString(this.editField);
|
||||||
value = tiddler.getFieldString(this.editField);
|
|
||||||
} else {
|
|
||||||
value = this.editDefault || "";
|
|
||||||
}
|
|
||||||
if(this.editField === "text") {
|
if(this.editField === "text") {
|
||||||
type = tiddler.fields.type || "text/vnd.tiddlywiki";
|
type = tiddler.fields.type || "text/vnd.tiddlywiki";
|
||||||
}
|
}
|
||||||
@@ -115,7 +111,7 @@ function editTextWidgetFactory(toolbarEngine,nonToolbarEngine) {
|
|||||||
// Otherwise, we need to construct a default value for the editor
|
// Otherwise, we need to construct a default value for the editor
|
||||||
switch(this.editField) {
|
switch(this.editField) {
|
||||||
case "text":
|
case "text":
|
||||||
value = "";
|
value = "Type the text for the tiddler '" + this.editTitle + "'";
|
||||||
type = "text/vnd.tiddlywiki";
|
type = "text/vnd.tiddlywiki";
|
||||||
break;
|
break;
|
||||||
case "title":
|
case "title":
|
||||||
@@ -180,15 +176,10 @@ function editTextWidgetFactory(toolbarEngine,nonToolbarEngine) {
|
|||||||
this.editMinHeight = this.getAttribute("minHeight",DEFAULT_MIN_TEXT_AREA_HEIGHT);
|
this.editMinHeight = this.getAttribute("minHeight",DEFAULT_MIN_TEXT_AREA_HEIGHT);
|
||||||
this.editFocusPopup = this.getAttribute("focusPopup");
|
this.editFocusPopup = this.getAttribute("focusPopup");
|
||||||
this.editFocus = this.getAttribute("focus");
|
this.editFocus = this.getAttribute("focus");
|
||||||
this.editFocusSelectFromStart = $tw.utils.parseNumber(this.getAttribute("focusSelectFromStart","0"));
|
|
||||||
this.editFocusSelectFromEnd = $tw.utils.parseNumber(this.getAttribute("focusSelectFromEnd","0"));
|
|
||||||
this.editTabIndex = this.getAttribute("tabindex");
|
this.editTabIndex = this.getAttribute("tabindex");
|
||||||
this.editCancelPopups = this.getAttribute("cancelPopups","") === "yes";
|
this.editCancelPopups = this.getAttribute("cancelPopups","") === "yes";
|
||||||
this.editInputActions = this.getAttribute("inputActions");
|
this.editInputActions = this.getAttribute("inputActions");
|
||||||
this.editRefreshTitle = this.getAttribute("refreshTitle");
|
this.editRefreshTitle = this.getAttribute("refreshTitle");
|
||||||
this.editAutoComplete = this.getAttribute("autocomplete");
|
|
||||||
this.isDisabled = this.getAttribute("disabled","no");
|
|
||||||
this.isFileDropEnabled = this.getAttribute("fileDrop","no") === "yes";
|
|
||||||
// Get the default editor element tag and type
|
// Get the default editor element tag and type
|
||||||
var tag,type;
|
var tag,type;
|
||||||
if(this.editField === "text") {
|
if(this.editField === "text") {
|
||||||
@@ -220,7 +211,7 @@ function editTextWidgetFactory(toolbarEngine,nonToolbarEngine) {
|
|||||||
EditTextWidget.prototype.refresh = function(changedTiddlers) {
|
EditTextWidget.prototype.refresh = function(changedTiddlers) {
|
||||||
var changedAttributes = this.computeAttributes();
|
var changedAttributes = this.computeAttributes();
|
||||||
// Completely rerender if any of our attributes have changed
|
// Completely rerender if any of our attributes have changed
|
||||||
if(changedAttributes.tiddler || changedAttributes.field || changedAttributes.index || changedAttributes["default"] || changedAttributes["class"] || changedAttributes.placeholder || changedAttributes.size || changedAttributes.autoHeight || changedAttributes.minHeight || changedAttributes.focusPopup || changedAttributes.rows || changedAttributes.tabindex || changedAttributes.cancelPopups || changedAttributes.inputActions || changedAttributes.refreshTitle || changedAttributes.autocomplete || changedTiddlers[HEIGHT_MODE_TITLE] || changedTiddlers[ENABLE_TOOLBAR_TITLE] || changedTiddlers["$:/palette"] || changedAttributes.disabled || changedAttributes.fileDrop) {
|
if(changedAttributes.tiddler || changedAttributes.field || changedAttributes.index || changedAttributes["default"] || changedAttributes["class"] || changedAttributes.placeholder || changedAttributes.size || changedAttributes.autoHeight || changedAttributes.minHeight || changedAttributes.focusPopup || changedAttributes.rows || changedAttributes.tabindex || changedAttributes.cancelPopups || changedAttributes.inputActions || changedAttributes.refreshTitle || changedTiddlers[HEIGHT_MODE_TITLE] || changedTiddlers[ENABLE_TOOLBAR_TITLE]) {
|
||||||
this.refreshSelf();
|
this.refreshSelf();
|
||||||
return true;
|
return true;
|
||||||
} else if (changedTiddlers[this.editRefreshTitle]) {
|
} else if (changedTiddlers[this.editRefreshTitle]) {
|
||||||
@@ -300,89 +291,21 @@ function editTextWidgetFactory(toolbarEngine,nonToolbarEngine) {
|
|||||||
Propogate keydown events to our container for the keyboard widgets benefit
|
Propogate keydown events to our container for the keyboard widgets benefit
|
||||||
*/
|
*/
|
||||||
EditTextWidget.prototype.propogateKeydownEvent = function(event) {
|
EditTextWidget.prototype.propogateKeydownEvent = function(event) {
|
||||||
var newEvent = this.cloneEvent(event,["keyCode","code","which","key","metaKey","ctrlKey","altKey","shiftKey"]);
|
var newEvent = this.document.createEventObject ? this.document.createEventObject() : this.document.createEvent("Events");
|
||||||
|
if(newEvent.initEvent) {
|
||||||
|
newEvent.initEvent("keydown", true, true);
|
||||||
|
}
|
||||||
|
newEvent.keyCode = event.keyCode;
|
||||||
|
newEvent.which = event.which;
|
||||||
|
newEvent.metaKey = event.metaKey;
|
||||||
|
newEvent.ctrlKey = event.ctrlKey;
|
||||||
|
newEvent.altKey = event.altKey;
|
||||||
|
newEvent.shiftKey = event.shiftKey;
|
||||||
return !this.parentDomNode.dispatchEvent(newEvent);
|
return !this.parentDomNode.dispatchEvent(newEvent);
|
||||||
};
|
};
|
||||||
|
|
||||||
EditTextWidget.prototype.cloneEvent = function(event,propertiesToCopy) {
|
|
||||||
var propertiesToCopy = propertiesToCopy || [],
|
|
||||||
newEvent = this.document.createEventObject ? this.document.createEventObject() : this.document.createEvent("Events");
|
|
||||||
if(newEvent.initEvent) {
|
|
||||||
newEvent.initEvent(event.type, true, true);
|
|
||||||
}
|
|
||||||
$tw.utils.each(propertiesToCopy,function(prop){
|
|
||||||
newEvent[prop] = event[prop];
|
|
||||||
});
|
|
||||||
return newEvent;
|
|
||||||
};
|
|
||||||
|
|
||||||
EditTextWidget.prototype.dispatchDOMEvent = function(newEvent) {
|
|
||||||
var dispatchNode = this.engine.iframeNode || this.engine.parentNode;
|
|
||||||
return dispatchNode.dispatchEvent(newEvent);
|
|
||||||
};
|
|
||||||
|
|
||||||
/*
|
|
||||||
Propogate drag and drop events with File data to our container for the dropzone widgets benefit.
|
|
||||||
If there are no Files, let the browser handle it.
|
|
||||||
*/
|
|
||||||
EditTextWidget.prototype.handleDropEvent = function(event) {
|
|
||||||
if($tw.utils.dragEventContainsFiles(event)) {
|
|
||||||
event.preventDefault();
|
|
||||||
event.stopPropagation();
|
|
||||||
this.dispatchDOMEvent(this.cloneEvent(event,["dataTransfer"]));
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
EditTextWidget.prototype.handlePasteEvent = function(event) {
|
|
||||||
if(event.clipboardData && event.clipboardData.files && event.clipboardData.files.length) {
|
|
||||||
event.preventDefault();
|
|
||||||
event.stopPropagation();
|
|
||||||
this.dispatchDOMEvent(this.cloneEvent(event,["clipboardData"]));
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
EditTextWidget.prototype.handleDragEnterEvent = function(event) {
|
|
||||||
if($tw.utils.dragEventContainsFiles(event)) {
|
|
||||||
// Ignore excessive events fired by FF when entering and leaving text nodes in a text area.
|
|
||||||
if( event.relatedTarget && (event.relatedTarget.nodeType === 3 || event.target === event.relatedTarget)) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
event.preventDefault();
|
|
||||||
return this.dispatchDOMEvent(this.cloneEvent(event,["dataTransfer"]));
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
};
|
|
||||||
|
|
||||||
EditTextWidget.prototype.handleDragOverEvent = function(event) {
|
|
||||||
if($tw.utils.dragEventContainsFiles(event)) {
|
|
||||||
// Call preventDefault() in browsers that default to not allowing drop events on textarea
|
|
||||||
if($tw.browser.isFirefox || $tw.browser.isIE) {
|
|
||||||
event.preventDefault();
|
|
||||||
}
|
|
||||||
event.dataTransfer.dropEffect = "copy";
|
|
||||||
return this.dispatchDOMEvent(this.cloneEvent(event,["dataTransfer"]));
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
};
|
|
||||||
|
|
||||||
EditTextWidget.prototype.handleDragLeaveEvent = function(event) {
|
|
||||||
// Ignore excessive events fired by FF when entering and leaving text nodes in a text area.
|
|
||||||
if(event.relatedTarget && ((event.relatedTarget.nodeType === 3) || (event.target === event.relatedTarget))) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
event.preventDefault();
|
|
||||||
this.dispatchDOMEvent(this.cloneEvent(event,["dataTransfer"]));
|
|
||||||
};
|
|
||||||
|
|
||||||
EditTextWidget.prototype.handleDragEndEvent = function(event) {
|
|
||||||
this.dispatchDOMEvent(this.cloneEvent(event));
|
|
||||||
};
|
|
||||||
|
|
||||||
EditTextWidget.prototype.handleClickEvent = function(event) {
|
|
||||||
return !this.dispatchDOMEvent(this.cloneEvent(event));
|
|
||||||
};
|
|
||||||
|
|
||||||
return EditTextWidget;
|
return EditTextWidget;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.editTextWidgetFactory = editTextWidgetFactory;
|
exports.editTextWidgetFactory = editTextWidgetFactory;
|
||||||
|
|||||||
@@ -1,17 +0,0 @@
|
|||||||
/*\
|
|
||||||
title: $:/core/modules/editor/operations/text/focus-editor.js
|
|
||||||
type: application/javascript
|
|
||||||
module-type: texteditoroperation
|
|
||||||
Simply focus the Text editor
|
|
||||||
\*/
|
|
||||||
(function(){
|
|
||||||
|
|
||||||
/*jslint node: true, browser: true */
|
|
||||||
/*global $tw: false */
|
|
||||||
"use strict";
|
|
||||||
|
|
||||||
exports["focus-editor"] = function(event,operation) {
|
|
||||||
operation = null;
|
|
||||||
};
|
|
||||||
|
|
||||||
})();
|
|
||||||
@@ -1,23 +0,0 @@
|
|||||||
/*\
|
|
||||||
title: $:/core/modules/editor/operations/text/insert-text.js
|
|
||||||
type: application/javascript
|
|
||||||
module-type: texteditoroperation
|
|
||||||
|
|
||||||
Text editor operation insert text at the caret position. If there is a selection it is replaced.
|
|
||||||
|
|
||||||
\*/
|
|
||||||
(function(){
|
|
||||||
|
|
||||||
/*jslint node: true, browser: true */
|
|
||||||
/*global $tw: false */
|
|
||||||
"use strict";
|
|
||||||
|
|
||||||
exports["insert-text"] = function(event,operation) {
|
|
||||||
operation.replacement = event.paramObject.text;
|
|
||||||
operation.cutStart = operation.selStart;
|
|
||||||
operation.cutEnd = operation.selEnd;
|
|
||||||
operation.newSelStart = operation.selStart + operation.replacement.length;
|
|
||||||
operation.newSelEnd = operation.newSelStart;
|
|
||||||
};
|
|
||||||
|
|
||||||
})();
|
|
||||||
@@ -25,8 +25,8 @@ exports["prefix-lines"] = function(event,operation) {
|
|||||||
$tw.utils.each(lines,function(line,index) {
|
$tw.utils.each(lines,function(line,index) {
|
||||||
// Remove and count any existing prefix characters
|
// Remove and count any existing prefix characters
|
||||||
var count = 0;
|
var count = 0;
|
||||||
while($tw.utils.startsWith(line,event.paramObject.character)) {
|
while(line.charAt(0) === event.paramObject.character) {
|
||||||
line = line.substring(event.paramObject.character.length);
|
line = line.substring(1);
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
// Remove any whitespace
|
// Remove any whitespace
|
||||||
|
|||||||
@@ -13,35 +13,16 @@ Text editor operation to wrap the selected lines with a prefix and suffix
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
exports["wrap-lines"] = function(event,operation) {
|
exports["wrap-lines"] = function(event,operation) {
|
||||||
var prefix = event.paramObject.prefix || "",
|
// Cut just past the preceding line break, or the start of the text
|
||||||
suffix = event.paramObject.suffix || "";
|
operation.cutStart = $tw.utils.findPrecedingLineBreak(operation.text,operation.selStart);
|
||||||
if($tw.utils.endsWith(operation.text.substring(0,operation.selStart), prefix + "\n") &&
|
// Cut to just past the following line break, or to the end of the text
|
||||||
$tw.utils.startsWith(operation.text.substring(operation.selEnd), "\n" + suffix)) {
|
operation.cutEnd = $tw.utils.findFollowingLineBreak(operation.text,operation.selEnd);
|
||||||
// Selected text is already surrounded by prefix and suffix: Remove them
|
// Add the prefix and suffix
|
||||||
// Cut selected text plus prefix and suffix
|
operation.replacement = event.paramObject.prefix + "\n" +
|
||||||
operation.cutStart = operation.selStart - (prefix.length + 1);
|
operation.text.substring(operation.cutStart,operation.cutEnd) + "\n" +
|
||||||
operation.cutEnd = operation.selEnd + suffix.length + 1;
|
event.paramObject.suffix + "\n";
|
||||||
// Also cut the following newline (if there is any)
|
operation.newSelStart = operation.cutStart + event.paramObject.prefix.length + 1;
|
||||||
if (operation.text[operation.cutEnd] === "\n") {
|
operation.newSelEnd = operation.newSelStart + (operation.cutEnd - operation.cutStart);
|
||||||
operation.cutEnd++;
|
|
||||||
}
|
|
||||||
// Replace with selection
|
|
||||||
operation.replacement = operation.text.substring(operation.selStart,operation.selEnd);
|
|
||||||
// Select text that was in between prefix and suffix
|
|
||||||
operation.newSelStart = operation.cutStart;
|
|
||||||
operation.newSelEnd = operation.selEnd - (prefix.length + 1);
|
|
||||||
} else {
|
|
||||||
// Cut just past the preceding line break, or the start of the text
|
|
||||||
operation.cutStart = $tw.utils.findPrecedingLineBreak(operation.text,operation.selStart);
|
|
||||||
// Cut to just past the following line break, or to the end of the text
|
|
||||||
operation.cutEnd = $tw.utils.findFollowingLineBreak(operation.text,operation.selEnd);
|
|
||||||
// Add the prefix and suffix
|
|
||||||
operation.replacement = prefix + "\n" +
|
|
||||||
operation.text.substring(operation.cutStart,operation.cutEnd) + "\n" +
|
|
||||||
suffix + "\n";
|
|
||||||
operation.newSelStart = operation.cutStart + prefix.length + 1;
|
|
||||||
operation.newSelEnd = operation.newSelStart + (operation.cutEnd - operation.cutStart);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
})();
|
})();
|
||||||
|
|||||||
@@ -1,25 +0,0 @@
|
|||||||
/*\
|
|
||||||
title: $:/core/modules/filterrunprefixes/all.js
|
|
||||||
type: application/javascript
|
|
||||||
module-type: filterrunprefix
|
|
||||||
|
|
||||||
Union of sets without de-duplication.
|
|
||||||
Equivalent to = filter run prefix.
|
|
||||||
|
|
||||||
\*/
|
|
||||||
(function(){
|
|
||||||
|
|
||||||
/*jslint node: true, browser: true */
|
|
||||||
/*global $tw: false */
|
|
||||||
"use strict";
|
|
||||||
|
|
||||||
/*
|
|
||||||
Export our filter prefix function
|
|
||||||
*/
|
|
||||||
exports.all = function(operationSubFunction) {
|
|
||||||
return function(results,source,widget) {
|
|
||||||
results.push.apply(results, operationSubFunction(source,widget));
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
})();
|
|
||||||
@@ -1,28 +0,0 @@
|
|||||||
/*\
|
|
||||||
title: $:/core/modules/filterrunprefixes/and.js
|
|
||||||
type: application/javascript
|
|
||||||
module-type: filterrunprefix
|
|
||||||
|
|
||||||
Intersection of sets.
|
|
||||||
Equivalent to + filter run prefix.
|
|
||||||
|
|
||||||
\*/
|
|
||||||
(function(){
|
|
||||||
|
|
||||||
/*jslint node: true, browser: true */
|
|
||||||
/*global $tw: false */
|
|
||||||
"use strict";
|
|
||||||
|
|
||||||
/*
|
|
||||||
Export our filter prefix function
|
|
||||||
*/
|
|
||||||
exports.and = function(operationSubFunction,options) {
|
|
||||||
return function(results,source,widget) {
|
|
||||||
// This replaces all the elements of the array, but keeps the actual array so that references to it are preserved
|
|
||||||
source = options.wiki.makeTiddlerIterator(results.toArray());
|
|
||||||
results.clear();
|
|
||||||
results.pushTop(operationSubFunction(source,widget));
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
})();
|
|
||||||
@@ -1,43 +0,0 @@
|
|||||||
/*\
|
|
||||||
title: $:/core/modules/filterrunprefixes/cascade.js
|
|
||||||
type: application/javascript
|
|
||||||
module-type: filterrunprefix
|
|
||||||
\*/
|
|
||||||
(function(){
|
|
||||||
|
|
||||||
/*jslint node: true, browser: true */
|
|
||||||
/*global $tw: false */
|
|
||||||
"use strict";
|
|
||||||
|
|
||||||
/*
|
|
||||||
Export our filter prefix function
|
|
||||||
*/
|
|
||||||
exports.cascade = function(operationSubFunction,options) {
|
|
||||||
return function(results,source,widget) {
|
|
||||||
if(results.length !== 0) {
|
|
||||||
var filterList = operationSubFunction(source,widget),
|
|
||||||
filterFnList = [];
|
|
||||||
var inputResults = results.toArray();
|
|
||||||
results.clear();
|
|
||||||
$tw.utils.each(inputResults,function(title) {
|
|
||||||
var result = ""; // If no filter matches, we return an empty string
|
|
||||||
$tw.utils.each(filterList,function(filter,index) {
|
|
||||||
if(!filterFnList[index]) {
|
|
||||||
filterFnList[index] = options.wiki.compileFilter(filter);
|
|
||||||
}
|
|
||||||
var output = filterFnList[index](options.wiki.makeTiddlerIterator([title]),widget.makeFakeWidgetWithVariables({
|
|
||||||
"currentTiddler": "" + title,
|
|
||||||
"..currentTiddler": widget.getVariable("currentTiddler","")
|
|
||||||
}));
|
|
||||||
if(output.length !== 0) {
|
|
||||||
result = output[0];
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
results.push(result);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
})();
|
|
||||||
@@ -1,27 +0,0 @@
|
|||||||
/*\
|
|
||||||
title: $:/core/modules/filterrunprefixes/else.js
|
|
||||||
type: application/javascript
|
|
||||||
module-type: filterrunprefix
|
|
||||||
|
|
||||||
Equivalent to ~ filter run prefix.
|
|
||||||
|
|
||||||
\*/
|
|
||||||
(function(){
|
|
||||||
|
|
||||||
/*jslint node: true, browser: true */
|
|
||||||
/*global $tw: false */
|
|
||||||
"use strict";
|
|
||||||
|
|
||||||
/*
|
|
||||||
Export our filter prefix function
|
|
||||||
*/
|
|
||||||
exports.else = function(operationSubFunction) {
|
|
||||||
return function(results,source,widget) {
|
|
||||||
if(results.length === 0) {
|
|
||||||
// Main result so far is empty
|
|
||||||
results.pushTop(operationSubFunction(source,widget));
|
|
||||||
}
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
})();
|
|
||||||
@@ -1,25 +0,0 @@
|
|||||||
/*\
|
|
||||||
title: $:/core/modules/filterrunprefixes/except.js
|
|
||||||
type: application/javascript
|
|
||||||
module-type: filterrunprefix
|
|
||||||
|
|
||||||
Difference of sets.
|
|
||||||
Equivalent to - filter run prefix.
|
|
||||||
|
|
||||||
\*/
|
|
||||||
(function(){
|
|
||||||
|
|
||||||
/*jslint node: true, browser: true */
|
|
||||||
/*global $tw: false */
|
|
||||||
"use strict";
|
|
||||||
|
|
||||||
/*
|
|
||||||
Export our filter prefix function
|
|
||||||
*/
|
|
||||||
exports.except = function(operationSubFunction) {
|
|
||||||
return function(results,source,widget) {
|
|
||||||
results.remove(operationSubFunction(source,widget));
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
})();
|
|
||||||
@@ -1,39 +0,0 @@
|
|||||||
/*\
|
|
||||||
title: $:/core/modules/filterrunprefixes/filter.js
|
|
||||||
type: application/javascript
|
|
||||||
module-type: filterrunprefix
|
|
||||||
|
|
||||||
\*/
|
|
||||||
(function(){
|
|
||||||
|
|
||||||
/*jslint node: true, browser: true */
|
|
||||||
/*global $tw: false */
|
|
||||||
"use strict";
|
|
||||||
|
|
||||||
/*
|
|
||||||
Export our filter function
|
|
||||||
*/
|
|
||||||
exports.filter = function(operationSubFunction,options) {
|
|
||||||
return function(results,source,widget) {
|
|
||||||
if(results.length > 0) {
|
|
||||||
var resultsToRemove = [],
|
|
||||||
index = 0;
|
|
||||||
results.each(function(title) {
|
|
||||||
var filtered = operationSubFunction(options.wiki.makeTiddlerIterator([title]),widget.makeFakeWidgetWithVariables({
|
|
||||||
"currentTiddler": "" + title,
|
|
||||||
"..currentTiddler": widget.getVariable("currentTiddler",""),
|
|
||||||
"index": "" + index,
|
|
||||||
"revIndex": "" + (results.length - 1 - index),
|
|
||||||
"length": "" + results.length
|
|
||||||
}));
|
|
||||||
if(filtered.length === 0) {
|
|
||||||
resultsToRemove.push(title);
|
|
||||||
}
|
|
||||||
++index;
|
|
||||||
});
|
|
||||||
results.remove(resultsToRemove);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
})();
|
|
||||||
@@ -1,31 +0,0 @@
|
|||||||
/*\
|
|
||||||
title: $:/core/modules/filterrunprefixes/intersection.js
|
|
||||||
type: application/javascript
|
|
||||||
module-type: filterrunprefix
|
|
||||||
|
|
||||||
\*/
|
|
||||||
(function(){
|
|
||||||
|
|
||||||
/*jslint node: true, browser: true */
|
|
||||||
/*global $tw: false */
|
|
||||||
"use strict";
|
|
||||||
|
|
||||||
/*
|
|
||||||
Export our filter prefix function
|
|
||||||
*/
|
|
||||||
exports.intersection = function(operationSubFunction) {
|
|
||||||
return function(results,source,widget) {
|
|
||||||
if(results.length !== 0) {
|
|
||||||
var secondRunResults = operationSubFunction(source,widget);
|
|
||||||
var firstRunResults = results.toArray();
|
|
||||||
results.clear();
|
|
||||||
$tw.utils.each(firstRunResults,function(title) {
|
|
||||||
if(secondRunResults.indexOf(title) !== -1) {
|
|
||||||
results.push(title);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
})();
|
|
||||||
@@ -1,44 +0,0 @@
|
|||||||
/*\
|
|
||||||
title: $:/core/modules/filterrunprefixes/map.js
|
|
||||||
type: application/javascript
|
|
||||||
module-type: filterrunprefix
|
|
||||||
\*/
|
|
||||||
(function(){
|
|
||||||
|
|
||||||
/*jslint node: true, browser: true */
|
|
||||||
/*global $tw: false */
|
|
||||||
"use strict";
|
|
||||||
|
|
||||||
/*
|
|
||||||
Export our filter prefix function
|
|
||||||
*/
|
|
||||||
exports.map = function(operationSubFunction,options) {
|
|
||||||
return function(results,source,widget) {
|
|
||||||
if(results.length > 0) {
|
|
||||||
var inputTitles = results.toArray(),
|
|
||||||
index = 0,
|
|
||||||
suffixes = options.suffixes,
|
|
||||||
flatten = (suffixes[0] && suffixes[0][0] === "flat") ? true : false;
|
|
||||||
results.clear();
|
|
||||||
$tw.utils.each(inputTitles,function(title) {
|
|
||||||
var filtered = operationSubFunction(options.wiki.makeTiddlerIterator([title]),widget.makeFakeWidgetWithVariables({
|
|
||||||
"currentTiddler": "" + title,
|
|
||||||
"..currentTiddler": widget.getVariable("currentTiddler",""),
|
|
||||||
"index": "" + index,
|
|
||||||
"revIndex": "" + (inputTitles.length - 1 - index),
|
|
||||||
"length": "" + inputTitles.length
|
|
||||||
}));
|
|
||||||
if(filtered.length && flatten) {
|
|
||||||
$tw.utils.each(filtered,function(value) {
|
|
||||||
results.push(value);
|
|
||||||
})
|
|
||||||
} else {
|
|
||||||
results.push(filtered[0]||"");
|
|
||||||
}
|
|
||||||
++index;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
})();
|
|
||||||
@@ -1,24 +0,0 @@
|
|||||||
/*\
|
|
||||||
title: $:/core/modules/filterrunprefixes/or.js
|
|
||||||
type: application/javascript
|
|
||||||
module-type: filterrunprefix
|
|
||||||
|
|
||||||
Equivalent to a filter run with no prefix.
|
|
||||||
|
|
||||||
\*/
|
|
||||||
(function(){
|
|
||||||
|
|
||||||
/*jslint node: true, browser: true */
|
|
||||||
/*global $tw: false */
|
|
||||||
"use strict";
|
|
||||||
|
|
||||||
/*
|
|
||||||
Export our filter prefix function
|
|
||||||
*/
|
|
||||||
exports.or = function(operationSubFunction) {
|
|
||||||
return function(results,source,widget) {
|
|
||||||
results.pushTop(operationSubFunction(source,widget));
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
})();
|
|
||||||
@@ -1,40 +0,0 @@
|
|||||||
/*\
|
|
||||||
title: $:/core/modules/filterrunprefixes/reduce.js
|
|
||||||
type: application/javascript
|
|
||||||
module-type: filterrunprefix
|
|
||||||
\*/
|
|
||||||
(function(){
|
|
||||||
|
|
||||||
/*jslint node: true, browser: true */
|
|
||||||
/*global $tw: false */
|
|
||||||
"use strict";
|
|
||||||
|
|
||||||
/*
|
|
||||||
Export our filter prefix function
|
|
||||||
*/
|
|
||||||
exports.reduce = function(operationSubFunction,options) {
|
|
||||||
return function(results,source,widget) {
|
|
||||||
if(results.length > 0) {
|
|
||||||
var accumulator = "",
|
|
||||||
index = 0;
|
|
||||||
results.each(function(title) {
|
|
||||||
var list = operationSubFunction(options.wiki.makeTiddlerIterator([title]),widget.makeFakeWidgetWithVariables({
|
|
||||||
"currentTiddler": "" + title,
|
|
||||||
"..currentTiddler": widget.getVariable("currentTiddler"),
|
|
||||||
"index": "" + index,
|
|
||||||
"revIndex": "" + (results.length - 1 - index),
|
|
||||||
"length": "" + results.length,
|
|
||||||
"accumulator": "" + accumulator
|
|
||||||
}));
|
|
||||||
if(list.length > 0) {
|
|
||||||
accumulator = "" + list[0];
|
|
||||||
}
|
|
||||||
++index;
|
|
||||||
});
|
|
||||||
results.clear();
|
|
||||||
results.push(accumulator);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
})();
|
|
||||||
@@ -1,52 +0,0 @@
|
|||||||
/*\
|
|
||||||
title: $:/core/modules/filterrunprefixes/sort.js
|
|
||||||
type: application/javascript
|
|
||||||
module-type: filterrunprefix
|
|
||||||
|
|
||||||
\*/
|
|
||||||
(function(){
|
|
||||||
|
|
||||||
/*jslint node: true, browser: true */
|
|
||||||
/*global $tw: false */
|
|
||||||
"use strict";
|
|
||||||
|
|
||||||
/*
|
|
||||||
Export our filter prefix function
|
|
||||||
*/
|
|
||||||
exports.sort = function(operationSubFunction,options) {
|
|
||||||
return function(results,source,widget) {
|
|
||||||
if(results.length > 0) {
|
|
||||||
var suffixes = options.suffixes,
|
|
||||||
sortType = (suffixes[0] && suffixes[0][0]) ? suffixes[0][0] : "string",
|
|
||||||
invert = suffixes[1] ? (suffixes[1].indexOf("reverse") !== -1) : false,
|
|
||||||
isCaseSensitive = suffixes[1] ? (suffixes[1].indexOf("casesensitive") !== -1) : false,
|
|
||||||
inputTitles = results.toArray(),
|
|
||||||
sortKeys = [],
|
|
||||||
indexes = new Array(inputTitles.length),
|
|
||||||
compareFn;
|
|
||||||
results.each(function(title) {
|
|
||||||
var key = operationSubFunction(options.wiki.makeTiddlerIterator([title]),widget.makeFakeWidgetWithVariables({
|
|
||||||
"currentTiddler": "" + title,
|
|
||||||
"..currentTiddler": widget.getVariable("currentTiddler")
|
|
||||||
}));
|
|
||||||
sortKeys.push(key[0] || "");
|
|
||||||
});
|
|
||||||
results.clear();
|
|
||||||
// Prepare an array of indexes to sort
|
|
||||||
for(var t=0; t<inputTitles.length; t++) {
|
|
||||||
indexes[t] = t;
|
|
||||||
}
|
|
||||||
// Sort the indexes
|
|
||||||
compareFn = $tw.utils.makeCompareFunction(sortType,{defaultType: "string", invert:invert, isCaseSensitive:isCaseSensitive});
|
|
||||||
indexes = indexes.sort(function(a,b) {
|
|
||||||
return compareFn(sortKeys[a],sortKeys[b]);
|
|
||||||
});
|
|
||||||
// Add to results in correct order
|
|
||||||
$tw.utils.each(indexes,function(index) {
|
|
||||||
results.push(inputTitles[index]);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
})();
|
|
||||||
@@ -12,9 +12,6 @@ Adds tiddler filtering methods to the $tw.Wiki object.
|
|||||||
/*global $tw: false */
|
/*global $tw: false */
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
/* Maximum permitted filter recursion depth */
|
|
||||||
var MAX_FILTER_DEPTH = 300;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Parses an operation (i.e. a run) within a filter string
|
Parses an operation (i.e. a run) within a filter string
|
||||||
operators: Array of array of operator nodes into which results should be inserted
|
operators: Array of array of operator nodes into which results should be inserted
|
||||||
@@ -65,63 +62,43 @@ function parseFilterOperation(operators,filterString,p) {
|
|||||||
else if(operator.operator === "") {
|
else if(operator.operator === "") {
|
||||||
operator.operator = "title";
|
operator.operator = "title";
|
||||||
}
|
}
|
||||||
operator.operands = [];
|
|
||||||
var parseOperand = function(bracketType) {
|
|
||||||
var operand = {};
|
|
||||||
switch (bracketType) {
|
|
||||||
case "{": // Curly brackets
|
|
||||||
operand.indirect = true;
|
|
||||||
nextBracketPos = filterString.indexOf("}",p);
|
|
||||||
break;
|
|
||||||
case "[": // Square brackets
|
|
||||||
nextBracketPos = filterString.indexOf("]",p);
|
|
||||||
break;
|
|
||||||
case "<": // Angle brackets
|
|
||||||
operand.variable = true;
|
|
||||||
nextBracketPos = filterString.indexOf(">",p);
|
|
||||||
break;
|
|
||||||
case "/": // regexp brackets
|
|
||||||
var rex = /^((?:[^\\\/]|\\.)*)\/(?:\(([mygi]+)\))?/g,
|
|
||||||
rexMatch = rex.exec(filterString.substring(p));
|
|
||||||
if(rexMatch) {
|
|
||||||
operator.regexp = new RegExp(rexMatch[1], rexMatch[2]);
|
|
||||||
// DEPRECATION WARNING
|
|
||||||
console.log("WARNING: Filter",operator.operator,"has a deprecated regexp operand",operator.regexp);
|
|
||||||
nextBracketPos = p + rex.lastIndex - 1;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
throw "Unterminated regular expression in filter expression";
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(nextBracketPos === -1) {
|
|
||||||
throw "Missing closing bracket in filter expression";
|
|
||||||
}
|
|
||||||
if(operator.regexp) {
|
|
||||||
operand.text = "";
|
|
||||||
} else {
|
|
||||||
operand.text = filterString.substring(p,nextBracketPos);
|
|
||||||
}
|
|
||||||
operator.operands.push(operand);
|
|
||||||
p = nextBracketPos + 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
p = nextBracketPos + 1;
|
p = nextBracketPos + 1;
|
||||||
parseOperand(bracket);
|
switch (bracket) {
|
||||||
|
case "{": // Curly brackets
|
||||||
// Check for multiple operands
|
operator.indirect = true;
|
||||||
while(filterString.charAt(p) === ",") {
|
nextBracketPos = filterString.indexOf("}",p);
|
||||||
p++;
|
break;
|
||||||
if(/^[\[\{<\/]/.test(filterString.substring(p))) {
|
case "[": // Square brackets
|
||||||
nextBracketPos = p;
|
nextBracketPos = filterString.indexOf("]",p);
|
||||||
p++;
|
break;
|
||||||
parseOperand(filterString.charAt(nextBracketPos));
|
case "<": // Angle brackets
|
||||||
} else {
|
operator.variable = true;
|
||||||
throw "Missing [ in filter expression";
|
nextBracketPos = filterString.indexOf(">",p);
|
||||||
}
|
break;
|
||||||
|
case "/": // regexp brackets
|
||||||
|
var rex = /^((?:[^\\\/]*|\\.)*)\/(?:\(([mygi]+)\))?/g,
|
||||||
|
rexMatch = rex.exec(filterString.substring(p));
|
||||||
|
if(rexMatch) {
|
||||||
|
operator.regexp = new RegExp(rexMatch[1], rexMatch[2]);
|
||||||
|
// DEPRECATION WARNING
|
||||||
|
console.log("WARNING: Filter",operator.operator,"has a deprecated regexp operand",operator.regexp);
|
||||||
|
nextBracketPos = p + rex.lastIndex - 1;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
throw "Unterminated regular expression in filter expression";
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(nextBracketPos === -1) {
|
||||||
|
throw "Missing closing bracket in filter expression";
|
||||||
|
}
|
||||||
|
if(!operator.regexp) {
|
||||||
|
operator.operand = filterString.substring(p,nextBracketPos);
|
||||||
|
}
|
||||||
|
p = nextBracketPos + 1;
|
||||||
|
|
||||||
// Push this operator
|
// Push this operator
|
||||||
operators.push(operator);
|
operators.push(operator);
|
||||||
} while(filterString.charAt(p) !== "]");
|
} while(filterString.charAt(p) !== "]");
|
||||||
@@ -142,7 +119,7 @@ exports.parseFilter = function(filterString) {
|
|||||||
p = 0, // Current position in the filter string
|
p = 0, // Current position in the filter string
|
||||||
match;
|
match;
|
||||||
var whitespaceRegExp = /(\s+)/mg,
|
var whitespaceRegExp = /(\s+)/mg,
|
||||||
operandRegExp = /((?:\+|\-|~|=|\:(\w+)(?:\:([\w\:, ]*))?)?)(?:(\[)|(?:"([^"]*)")|(?:'([^']*)')|([^\s\[\]]+))/mg;
|
operandRegExp = /((?:\+|\-|~|=)?)(?:(\[)|(?:"([^"]*)")|(?:'([^']*)')|([^\s\[\]]+))/mg;
|
||||||
while(p < filterString.length) {
|
while(p < filterString.length) {
|
||||||
// Skip any whitespace
|
// Skip any whitespace
|
||||||
whitespaceRegExp.lastIndex = p;
|
whitespaceRegExp.lastIndex = p;
|
||||||
@@ -163,31 +140,16 @@ exports.parseFilter = function(filterString) {
|
|||||||
};
|
};
|
||||||
if(match[1]) {
|
if(match[1]) {
|
||||||
operation.prefix = match[1];
|
operation.prefix = match[1];
|
||||||
p = p + operation.prefix.length;
|
p++;
|
||||||
if(match[2]) {
|
|
||||||
operation.namedPrefix = match[2];
|
|
||||||
}
|
|
||||||
if(match[3]) {
|
|
||||||
operation.suffixes = [];
|
|
||||||
$tw.utils.each(match[3].split(":"),function(subsuffix) {
|
|
||||||
operation.suffixes.push([]);
|
|
||||||
$tw.utils.each(subsuffix.split(","),function(entry) {
|
|
||||||
entry = $tw.utils.trim(entry);
|
|
||||||
if(entry) {
|
|
||||||
operation.suffixes[operation.suffixes.length -1].push(entry);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if(match[4]) { // Opening square bracket
|
if(match[2]) { // Opening square bracket
|
||||||
p = parseFilterOperation(operation.operators,filterString,p);
|
p = parseFilterOperation(operation.operators,filterString,p);
|
||||||
} else {
|
} else {
|
||||||
p = match.index + match[0].length;
|
p = match.index + match[0].length;
|
||||||
}
|
}
|
||||||
if(match[5] || match[6] || match[7]) { // Double quoted string, single quoted string or unquoted title
|
if(match[3] || match[4] || match[5]) { // Double quoted string, single quoted string or unquoted title
|
||||||
operation.operators.push(
|
operation.operators.push(
|
||||||
{operator: "title", operands: [{text: match[5] || match[6] || match[7]}]}
|
{operator: "title", operand: match[3] || match[4] || match[5]}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
results.push(operation);
|
results.push(operation);
|
||||||
@@ -204,14 +166,6 @@ exports.getFilterOperators = function() {
|
|||||||
return this.filterOperators;
|
return this.filterOperators;
|
||||||
};
|
};
|
||||||
|
|
||||||
exports.getFilterRunPrefixes = function() {
|
|
||||||
if(!this.filterRunPrefixes) {
|
|
||||||
$tw.Wiki.prototype.filterRunPrefixes = {};
|
|
||||||
$tw.modules.applyMethods("filterrunprefix",this.filterRunPrefixes);
|
|
||||||
}
|
|
||||||
return this.filterRunPrefixes;
|
|
||||||
}
|
|
||||||
|
|
||||||
exports.filterTiddlers = function(filterString,widget,source) {
|
exports.filterTiddlers = function(filterString,widget,source) {
|
||||||
var fn = this.compileFilter(filterString);
|
var fn = this.compileFilter(filterString);
|
||||||
return fn.call(this,source,widget);
|
return fn.call(this,source,widget);
|
||||||
@@ -223,18 +177,10 @@ source: an iterator function for the source tiddlers, called source(iterator), w
|
|||||||
widget: an optional widget node for retrieving the current tiddler etc.
|
widget: an optional widget node for retrieving the current tiddler etc.
|
||||||
*/
|
*/
|
||||||
exports.compileFilter = function(filterString) {
|
exports.compileFilter = function(filterString) {
|
||||||
if(!this.filterCache) {
|
|
||||||
this.filterCache = Object.create(null);
|
|
||||||
this.filterCacheCount = 0;
|
|
||||||
}
|
|
||||||
if(this.filterCache[filterString] !== undefined) {
|
|
||||||
return this.filterCache[filterString];
|
|
||||||
}
|
|
||||||
var filterParseTree;
|
var filterParseTree;
|
||||||
try {
|
try {
|
||||||
filterParseTree = this.parseFilter(filterString);
|
filterParseTree = this.parseFilter(filterString);
|
||||||
} catch(e) {
|
} catch(e) {
|
||||||
// We do not cache this result, so it adjusts along with localization changes
|
|
||||||
return function(source,widget) {
|
return function(source,widget) {
|
||||||
return [$tw.language.getString("Error/Filter") + ": " + e];
|
return [$tw.language.getString("Error/Filter") + ": " + e];
|
||||||
};
|
};
|
||||||
@@ -252,35 +198,25 @@ exports.compileFilter = function(filterString) {
|
|||||||
results = [],
|
results = [],
|
||||||
currTiddlerTitle = widget && widget.getVariable("currentTiddler");
|
currTiddlerTitle = widget && widget.getVariable("currentTiddler");
|
||||||
$tw.utils.each(operation.operators,function(operator) {
|
$tw.utils.each(operation.operators,function(operator) {
|
||||||
var operands = [],
|
var operand = operator.operand,
|
||||||
operatorFunction;
|
operatorFunction;
|
||||||
if(!operator.operator) {
|
if(!operator.operator) {
|
||||||
// Use the "title" operator if no operator is specified
|
|
||||||
operatorFunction = filterOperators.title;
|
operatorFunction = filterOperators.title;
|
||||||
} else if(!filterOperators[operator.operator]) {
|
} else if(!filterOperators[operator.operator]) {
|
||||||
// Unknown operators treated as "[unknown]" - at run time we can distinguish between a custom operator and falling back to the default "field" operator
|
operatorFunction = filterOperators.field;
|
||||||
operatorFunction = filterOperators["[unknown]"];
|
|
||||||
} else {
|
} else {
|
||||||
// Use the operator function
|
|
||||||
operatorFunction = filterOperators[operator.operator];
|
operatorFunction = filterOperators[operator.operator];
|
||||||
}
|
}
|
||||||
$tw.utils.each(operator.operands,function(operand) {
|
if(operator.indirect) {
|
||||||
if(operand.indirect) {
|
operand = self.getTextReference(operator.operand,"",currTiddlerTitle);
|
||||||
operand.value = self.getTextReference(operand.text,"",currTiddlerTitle);
|
}
|
||||||
} else if(operand.variable) {
|
if(operator.variable) {
|
||||||
var varTree = $tw.utils.parseFilterVariable(operand.text);
|
operand = widget.getVariable(operator.operand,{defaultValue: ""});
|
||||||
operand.value = widget.evaluateVariable(varTree.name,{params: varTree.params, source: source})[0] || "";
|
}
|
||||||
} else {
|
|
||||||
operand.value = operand.text;
|
|
||||||
}
|
|
||||||
operands.push(operand.value);
|
|
||||||
});
|
|
||||||
|
|
||||||
// Invoke the appropriate filteroperator module
|
// Invoke the appropriate filteroperator module
|
||||||
results = operatorFunction(accumulator,{
|
results = operatorFunction(accumulator,{
|
||||||
operator: operator.operator,
|
operator: operator.operator,
|
||||||
operand: operands.length > 0 ? operands[0] : undefined,
|
operand: operand,
|
||||||
operands: operands,
|
|
||||||
prefix: operator.prefix,
|
prefix: operator.prefix,
|
||||||
suffix: operator.suffix,
|
suffix: operator.suffix,
|
||||||
suffixes: operator.suffixes,
|
suffixes: operator.suffixes,
|
||||||
@@ -305,65 +241,51 @@ exports.compileFilter = function(filterString) {
|
|||||||
return resultArray;
|
return resultArray;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
var filterRunPrefixes = self.getFilterRunPrefixes();
|
|
||||||
// Wrap the operator functions in a wrapper function that depends on the prefix
|
// Wrap the operator functions in a wrapper function that depends on the prefix
|
||||||
operationFunctions.push((function() {
|
operationFunctions.push((function() {
|
||||||
var options = {wiki: self, suffixes: operation.suffixes || []};
|
|
||||||
switch(operation.prefix || "") {
|
switch(operation.prefix || "") {
|
||||||
case "": // No prefix means that the operation is unioned into the result
|
case "": // No prefix means that the operation is unioned into the result
|
||||||
return filterRunPrefixes["or"](operationSubFunction, options);
|
return function(results,source,widget) {
|
||||||
|
$tw.utils.pushTop(results,operationSubFunction(source,widget));
|
||||||
|
};
|
||||||
case "=": // The results of the operation are pushed into the result without deduplication
|
case "=": // The results of the operation are pushed into the result without deduplication
|
||||||
return filterRunPrefixes["all"](operationSubFunction, options);
|
return function(results,source,widget) {
|
||||||
|
Array.prototype.push.apply(results,operationSubFunction(source,widget));
|
||||||
|
};
|
||||||
case "-": // The results of this operation are removed from the main result
|
case "-": // The results of this operation are removed from the main result
|
||||||
return filterRunPrefixes["except"](operationSubFunction, options);
|
return function(results,source,widget) {
|
||||||
|
$tw.utils.removeArrayEntries(results,operationSubFunction(source,widget));
|
||||||
|
};
|
||||||
case "+": // This operation is applied to the main results so far
|
case "+": // This operation is applied to the main results so far
|
||||||
return filterRunPrefixes["and"](operationSubFunction, options);
|
return function(results,source,widget) {
|
||||||
|
// This replaces all the elements of the array, but keeps the actual array so that references to it are preserved
|
||||||
|
source = self.makeTiddlerIterator(results);
|
||||||
|
results.splice(0,results.length);
|
||||||
|
$tw.utils.pushTop(results,operationSubFunction(source,widget));
|
||||||
|
};
|
||||||
case "~": // This operation is unioned into the result only if the main result so far is empty
|
case "~": // This operation is unioned into the result only if the main result so far is empty
|
||||||
return filterRunPrefixes["else"](operationSubFunction, options);
|
return function(results,source,widget) {
|
||||||
default:
|
if(results.length === 0) {
|
||||||
if(operation.namedPrefix && filterRunPrefixes[operation.namedPrefix]) {
|
// Main result so far is empty
|
||||||
return filterRunPrefixes[operation.namedPrefix](operationSubFunction, options);
|
$tw.utils.pushTop(results,operationSubFunction(source,widget));
|
||||||
} else {
|
}
|
||||||
return function(results,source,widget) {
|
};
|
||||||
results.clear();
|
|
||||||
results.push($tw.language.getString("Error/FilterRunPrefix"));
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
})());
|
})());
|
||||||
});
|
});
|
||||||
// Return a function that applies the operations to a source iterator of tiddler titles
|
// Return a function that applies the operations to a source iterator of tiddler titles
|
||||||
var fnMeasured = $tw.perf.measure("filter: " + filterString,function filterFunction(source,widget) {
|
return $tw.perf.measure("filter: " + filterString,function filterFunction(source,widget) {
|
||||||
if(!source) {
|
if(!source) {
|
||||||
source = self.each;
|
source = self.each;
|
||||||
} else if(typeof source === "object") { // Array or hashmap
|
} else if(typeof source === "object") { // Array or hashmap
|
||||||
source = self.makeTiddlerIterator(source);
|
source = self.makeTiddlerIterator(source);
|
||||||
}
|
}
|
||||||
if(!widget) {
|
var results = [];
|
||||||
widget = $tw.rootWidget;
|
$tw.utils.each(operationFunctions,function(operationFunction) {
|
||||||
}
|
operationFunction(results,source,widget);
|
||||||
var results = new $tw.utils.LinkedList();
|
});
|
||||||
self.filterRecursionCount = (self.filterRecursionCount || 0) + 1;
|
return results;
|
||||||
if(self.filterRecursionCount < MAX_FILTER_DEPTH) {
|
|
||||||
$tw.utils.each(operationFunctions,function(operationFunction) {
|
|
||||||
operationFunction(results,source,widget);
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
results.push("/**-- Excessive filter recursion --**/");
|
|
||||||
}
|
|
||||||
self.filterRecursionCount = self.filterRecursionCount - 1;
|
|
||||||
return results.toArray();
|
|
||||||
});
|
});
|
||||||
if(this.filterCacheCount >= 2000) {
|
|
||||||
// To prevent memory leak, we maintain an upper limit for cache size.
|
|
||||||
// Reset if exceeded. This should give us 95% of the benefit
|
|
||||||
// that no cache limit would give us.
|
|
||||||
this.filterCache = Object.create(null);
|
|
||||||
this.filterCacheCount = 0;
|
|
||||||
}
|
|
||||||
this.filterCache[filterString] = fnMeasured;
|
|
||||||
this.filterCacheCount++;
|
|
||||||
return fnMeasured;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
})();
|
})();
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ exports.all = function(source,operator,options) {
|
|||||||
// Get our suboperators
|
// Get our suboperators
|
||||||
var allFilterOperators = getAllFilterOperators();
|
var allFilterOperators = getAllFilterOperators();
|
||||||
// Cycle through the suboperators accumulating their results
|
// Cycle through the suboperators accumulating their results
|
||||||
var results = new $tw.utils.LinkedList(),
|
var results = [],
|
||||||
subops = operator.operand.split("+");
|
subops = operator.operand.split("+");
|
||||||
// Check for common optimisations
|
// Check for common optimisations
|
||||||
if(subops.length === 1 && subops[0] === "") {
|
if(subops.length === 1 && subops[0] === "") {
|
||||||
@@ -49,10 +49,10 @@ exports.all = function(source,operator,options) {
|
|||||||
for(var t=0; t<subops.length; t++) {
|
for(var t=0; t<subops.length; t++) {
|
||||||
var subop = allFilterOperators[subops[t]];
|
var subop = allFilterOperators[subops[t]];
|
||||||
if(subop) {
|
if(subop) {
|
||||||
results.pushTop(subop(source,operator.prefix,options));
|
$tw.utils.pushTop(results,subop(source,operator.prefix,options));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return results.makeTiddlerIterator(options.wiki);
|
return results;
|
||||||
};
|
};
|
||||||
|
|
||||||
})();
|
})();
|
||||||
|
|||||||
@@ -16,11 +16,11 @@ Filter operator for returning all the backlinks from a tiddler
|
|||||||
Export our filter function
|
Export our filter function
|
||||||
*/
|
*/
|
||||||
exports.backlinks = function(source,operator,options) {
|
exports.backlinks = function(source,operator,options) {
|
||||||
var results = new $tw.utils.LinkedList();
|
var results = [];
|
||||||
source(function(tiddler,title) {
|
source(function(tiddler,title) {
|
||||||
results.pushTop(options.wiki.getTiddlerBacklinks(title));
|
$tw.utils.pushTop(results,options.wiki.getTiddlerBacklinks(title));
|
||||||
});
|
});
|
||||||
return results.makeTiddlerIterator(options.wiki);
|
return results;
|
||||||
};
|
};
|
||||||
|
|
||||||
})();
|
})();
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ Export our filter function
|
|||||||
*/
|
*/
|
||||||
exports.contains = function(source,operator,options) {
|
exports.contains = function(source,operator,options) {
|
||||||
var results = [],
|
var results = [],
|
||||||
fieldname = operator.suffix || "list";
|
fieldname = (operator.suffix || "list").toLowerCase();
|
||||||
if(operator.prefix === "!") {
|
if(operator.prefix === "!") {
|
||||||
source(function(tiddler,title) {
|
source(function(tiddler,title) {
|
||||||
if(tiddler) {
|
if(tiddler) {
|
||||||
|
|||||||
@@ -1,27 +0,0 @@
|
|||||||
/*\
|
|
||||||
title: $:/core/modules/filters/crypto.js
|
|
||||||
type: application/javascript
|
|
||||||
module-type: filteroperator
|
|
||||||
|
|
||||||
Filter operators for cryptography, using the Stanford JavaScript library
|
|
||||||
|
|
||||||
\*/
|
|
||||||
(function(){
|
|
||||||
|
|
||||||
/*jslint node: true, browser: true */
|
|
||||||
/*global $tw: false */
|
|
||||||
"use strict";
|
|
||||||
|
|
||||||
exports.sha256 = function(source,operator,options) {
|
|
||||||
var results = [],
|
|
||||||
length = parseInt(operator.operand,10) || 20,
|
|
||||||
sha256 = function(text) {
|
|
||||||
return sjcl.codec.hex.fromBits(sjcl.hash.sha256.hash(text)).substr(0,length);
|
|
||||||
};
|
|
||||||
source(function(tiddler,title) {
|
|
||||||
results.push(sha256(title));
|
|
||||||
});
|
|
||||||
return results;
|
|
||||||
};
|
|
||||||
|
|
||||||
})();
|
|
||||||
@@ -1,27 +0,0 @@
|
|||||||
/*\
|
|
||||||
title: $:/core/modules/filters/deserializers.js
|
|
||||||
type: application/javascript
|
|
||||||
module-type: filteroperator
|
|
||||||
|
|
||||||
Filter operator for returning the names of the deserializers in this wiki
|
|
||||||
|
|
||||||
\*/
|
|
||||||
(function(){
|
|
||||||
|
|
||||||
/*jslint node: true, browser: true */
|
|
||||||
/*global $tw: false */
|
|
||||||
"use strict";
|
|
||||||
|
|
||||||
/*
|
|
||||||
Export our filter function
|
|
||||||
*/
|
|
||||||
exports.deserializers = function(source,operator,options) {
|
|
||||||
var results = [];
|
|
||||||
$tw.utils.each($tw.Wiki.tiddlerDeserializerModules,function(deserializer,type) {
|
|
||||||
results.push(type);
|
|
||||||
});
|
|
||||||
results.sort();
|
|
||||||
return results;
|
|
||||||
};
|
|
||||||
|
|
||||||
})();
|
|
||||||
@@ -16,16 +16,14 @@ Filter operator for returning the descriptions of the specified edition names
|
|||||||
Export our filter function
|
Export our filter function
|
||||||
*/
|
*/
|
||||||
exports.editiondescription = function(source,operator,options) {
|
exports.editiondescription = function(source,operator,options) {
|
||||||
var results = [];
|
var results = [],
|
||||||
if($tw.node) {
|
editionInfo = $tw.utils.getEditionInfo();
|
||||||
var editionInfo = $tw.utils.getEditionInfo();
|
if(editionInfo) {
|
||||||
if(editionInfo) {
|
source(function(tiddler,title) {
|
||||||
source(function(tiddler,title) {
|
if($tw.utils.hop(editionInfo,title)) {
|
||||||
if($tw.utils.hop(editionInfo,title)) {
|
results.push(editionInfo[title].description || "");
|
||||||
results.push(editionInfo[title].description || "");
|
}
|
||||||
}
|
});
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return results;
|
return results;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -16,16 +16,14 @@ Filter operator for returning the names of the available editions in this wiki
|
|||||||
Export our filter function
|
Export our filter function
|
||||||
*/
|
*/
|
||||||
exports.editions = function(source,operator,options) {
|
exports.editions = function(source,operator,options) {
|
||||||
var results = [];
|
var results = [],
|
||||||
if($tw.node) {
|
editionInfo = $tw.utils.getEditionInfo();
|
||||||
var editionInfo = $tw.utils.getEditionInfo();
|
if(editionInfo) {
|
||||||
if(editionInfo) {
|
$tw.utils.each(editionInfo,function(info,name) {
|
||||||
$tw.utils.each(editionInfo,function(info,name) {
|
results.push(name);
|
||||||
results.push(name);
|
});
|
||||||
});
|
|
||||||
}
|
|
||||||
results.sort();
|
|
||||||
}
|
}
|
||||||
|
results.sort();
|
||||||
return results;
|
return results;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -16,26 +16,15 @@ Filter operator for applying decodeURIComponent() to each item.
|
|||||||
Export our filter functions
|
Export our filter functions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
exports.decodebase64 = function(source,operator,options) {
|
|
||||||
var results = [];
|
|
||||||
source(function(tiddler,title) {
|
|
||||||
results.push($tw.utils.base64Decode(title));
|
|
||||||
});
|
|
||||||
return results;
|
|
||||||
};
|
|
||||||
|
|
||||||
exports.encodebase64 = function(source,operator,options) {
|
|
||||||
var results = [];
|
|
||||||
source(function(tiddler,title) {
|
|
||||||
results.push($tw.utils.base64Encode(title));
|
|
||||||
});
|
|
||||||
return results;
|
|
||||||
};
|
|
||||||
|
|
||||||
exports.decodeuricomponent = function(source,operator,options) {
|
exports.decodeuricomponent = function(source,operator,options) {
|
||||||
var results = [];
|
var results = [];
|
||||||
source(function(tiddler,title) {
|
source(function(tiddler,title) {
|
||||||
results.push($tw.utils.decodeURIComponentSafe(title));
|
var value = title;
|
||||||
|
try {
|
||||||
|
value = decodeURIComponent(title);
|
||||||
|
} catch(e) {
|
||||||
|
}
|
||||||
|
results.push(value);
|
||||||
});
|
});
|
||||||
return results;
|
return results;
|
||||||
};
|
};
|
||||||
@@ -43,7 +32,7 @@ exports.decodeuricomponent = function(source,operator,options) {
|
|||||||
exports.encodeuricomponent = function(source,operator,options) {
|
exports.encodeuricomponent = function(source,operator,options) {
|
||||||
var results = [];
|
var results = [];
|
||||||
source(function(tiddler,title) {
|
source(function(tiddler,title) {
|
||||||
results.push($tw.utils.encodeURIComponentExtended(title));
|
results.push(encodeURIComponent(title));
|
||||||
});
|
});
|
||||||
return results;
|
return results;
|
||||||
};
|
};
|
||||||
@@ -51,7 +40,12 @@ exports.encodeuricomponent = function(source,operator,options) {
|
|||||||
exports.decodeuri = function(source,operator,options) {
|
exports.decodeuri = function(source,operator,options) {
|
||||||
var results = [];
|
var results = [];
|
||||||
source(function(tiddler,title) {
|
source(function(tiddler,title) {
|
||||||
results.push($tw.utils.decodeURISafe(title));
|
var value = title;
|
||||||
|
try {
|
||||||
|
value = decodeURI(title);
|
||||||
|
} catch(e) {
|
||||||
|
}
|
||||||
|
results.push(value);
|
||||||
});
|
});
|
||||||
return results;
|
return results;
|
||||||
};
|
};
|
||||||
@@ -83,7 +77,7 @@ exports.encodehtml = function(source,operator,options) {
|
|||||||
exports.stringify = function(source,operator,options) {
|
exports.stringify = function(source,operator,options) {
|
||||||
var results = [];
|
var results = [];
|
||||||
source(function(tiddler,title) {
|
source(function(tiddler,title) {
|
||||||
results.push($tw.utils.stringify(title,(operator.suffix === "rawunicode")));
|
results.push($tw.utils.stringify(title));
|
||||||
});
|
});
|
||||||
return results;
|
return results;
|
||||||
};
|
};
|
||||||
@@ -91,7 +85,7 @@ exports.stringify = function(source,operator,options) {
|
|||||||
exports.jsonstringify = function(source,operator,options) {
|
exports.jsonstringify = function(source,operator,options) {
|
||||||
var results = [];
|
var results = [];
|
||||||
source(function(tiddler,title) {
|
source(function(tiddler,title) {
|
||||||
results.push($tw.utils.jsonStringify(title,(operator.suffix === "rawunicode")));
|
results.push($tw.utils.jsonStringify(title));
|
||||||
});
|
});
|
||||||
return results;
|
return results;
|
||||||
};
|
};
|
||||||
@@ -108,7 +102,7 @@ exports.escapecss = function(source,operator,options) {
|
|||||||
var results = [];
|
var results = [];
|
||||||
source(function(tiddler,title) {
|
source(function(tiddler,title) {
|
||||||
// escape any character with a special meaning in CSS using CSS.escape()
|
// escape any character with a special meaning in CSS using CSS.escape()
|
||||||
results.push($tw.utils.escapeCSS(title));
|
results.push(CSS.escape(title));
|
||||||
});
|
});
|
||||||
return results;
|
return results;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ Export our filter function
|
|||||||
*/
|
*/
|
||||||
exports.field = function(source,operator,options) {
|
exports.field = function(source,operator,options) {
|
||||||
var results = [],indexedResults,
|
var results = [],indexedResults,
|
||||||
fieldname = operator.suffix || operator.operator || "title";
|
fieldname = (operator.suffix || operator.operator || "title").toLowerCase();
|
||||||
if(operator.prefix === "!") {
|
if(operator.prefix === "!") {
|
||||||
if(operator.regexp) {
|
if(operator.regexp) {
|
||||||
source(function(tiddler,title) {
|
source(function(tiddler,title) {
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ exports.fields = function(source,operator,options) {
|
|||||||
fieldName,
|
fieldName,
|
||||||
suffixes = (operator.suffixes || [])[0] || [],
|
suffixes = (operator.suffixes || [])[0] || [],
|
||||||
operand = $tw.utils.parseStringArray(operator.operand);
|
operand = $tw.utils.parseStringArray(operator.operand);
|
||||||
|
|
||||||
source(function(tiddler,title) {
|
source(function(tiddler,title) {
|
||||||
if(tiddler) {
|
if(tiddler) {
|
||||||
if(suffixes.indexOf("include") !== -1) {
|
if(suffixes.indexOf("include") !== -1) {
|
||||||
|
|||||||
@@ -20,10 +20,7 @@ exports.filter = function(source,operator,options) {
|
|||||||
results = [],
|
results = [],
|
||||||
target = operator.prefix !== "!";
|
target = operator.prefix !== "!";
|
||||||
source(function(tiddler,title) {
|
source(function(tiddler,title) {
|
||||||
var list = filterFn.call(options.wiki,options.wiki.makeTiddlerIterator([title]),options.widget.makeFakeWidgetWithVariables({
|
var list = filterFn.call(options.wiki,options.wiki.makeTiddlerIterator([title]));
|
||||||
"currentTiddler": "" + title,
|
|
||||||
"..currentTiddler": options.widget.getVariable("currentTiddler","")
|
|
||||||
}));
|
|
||||||
if((list.length > 0) === target) {
|
if((list.length > 0) === target) {
|
||||||
results.push(title);
|
results.push(title);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,13 +13,13 @@ module-type: formatfilteroperator
|
|||||||
Export our filter function
|
Export our filter function
|
||||||
*/
|
*/
|
||||||
exports.date = function(source,operand,options) {
|
exports.date = function(source,operand,options) {
|
||||||
var results = [];
|
var results = [];
|
||||||
source(function(tiddler,title) {
|
source(function(tiddler,title) {
|
||||||
var value = $tw.utils.parseDate(title);
|
var value = $tw.utils.parseDate(title);
|
||||||
if(value && $tw.utils.isDate(value) && value.toString() !== "Invalid Date") {
|
if(value && $tw.utils.isDate(value) && value.toString() !== "Invalid Date") {
|
||||||
results.push($tw.utils.formatDateString(value,operand || "YYYY MM DD 0hh:0mm"));
|
results.push($tw.utils.formatDateString(value,operand || "YYYY MM DD 0hh:0mm"));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return results;
|
return results;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -1,35 +0,0 @@
|
|||||||
/*\
|
|
||||||
title: $:/core/modules/filters/format/json.js
|
|
||||||
type: application/javascript
|
|
||||||
module-type: formatfilteroperator
|
|
||||||
\*/
|
|
||||||
(function(){
|
|
||||||
|
|
||||||
/*jslint node: true, browser: true */
|
|
||||||
/*global $tw: false */
|
|
||||||
"use strict";
|
|
||||||
|
|
||||||
/*
|
|
||||||
Export our filter function
|
|
||||||
*/
|
|
||||||
exports.json = function(source,operand,options) {
|
|
||||||
var results = [],
|
|
||||||
spaces = null;
|
|
||||||
if(operand) {
|
|
||||||
spaces = /^\d+$/.test(operand) ? parseInt(operand,10) : operand;
|
|
||||||
}
|
|
||||||
source(function(tiddler,title) {
|
|
||||||
var data = $tw.utils.parseJSONSafe(title);
|
|
||||||
try {
|
|
||||||
data = JSON.parse(title);
|
|
||||||
} catch(e) {
|
|
||||||
data = undefined;
|
|
||||||
}
|
|
||||||
if(data !== undefined) {
|
|
||||||
results.push(JSON.stringify(data,null,spaces));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
return results;
|
|
||||||
};
|
|
||||||
|
|
||||||
})();
|
|
||||||
@@ -13,13 +13,13 @@ module-type: formatfilteroperator
|
|||||||
Export our filter function
|
Export our filter function
|
||||||
*/
|
*/
|
||||||
exports.relativedate = function(source,operand,options) {
|
exports.relativedate = function(source,operand,options) {
|
||||||
var results = [];
|
var results = [];
|
||||||
source(function(tiddler,title) {
|
source(function(tiddler,title) {
|
||||||
var value = $tw.utils.parseDate(title);
|
var value = $tw.utils.parseDate(title);
|
||||||
if(value && $tw.utils.isDate(value) && value.toString() !== "Invalid Date") {
|
if(value && $tw.utils.isDate(value) && value.toString() !== "Invalid Date") {
|
||||||
results.push($tw.utils.getRelativeDate((new Date()) - (new Date(value))).description);
|
results.push($tw.utils.getRelativeDate((new Date()) - (new Date(value))).description);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return results;
|
return results;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -1,25 +0,0 @@
|
|||||||
/*\
|
|
||||||
title: $:/core/modules/filters/format/titlelist.js
|
|
||||||
type: application/javascript
|
|
||||||
module-type: formatfilteroperator
|
|
||||||
\*/
|
|
||||||
(function(){
|
|
||||||
|
|
||||||
/*jslint node: true, browser: true */
|
|
||||||
/*global $tw: false */
|
|
||||||
"use strict";
|
|
||||||
|
|
||||||
/*
|
|
||||||
Export our filter function
|
|
||||||
*/
|
|
||||||
exports.titlelist = function(source,operand,options) {
|
|
||||||
var results = [];
|
|
||||||
source(function(tiddler,title) {
|
|
||||||
if(title && title.length) {
|
|
||||||
results.push($tw.utils.stringifyList([title]));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
return results;
|
|
||||||
};
|
|
||||||
|
|
||||||
})();
|
|
||||||
@@ -1,32 +0,0 @@
|
|||||||
/*\
|
|
||||||
title: $:/core/modules/filters/function.js
|
|
||||||
type: application/javascript
|
|
||||||
module-type: filteroperator
|
|
||||||
|
|
||||||
Filter operator returning those input titles that are returned from a function
|
|
||||||
|
|
||||||
\*/
|
|
||||||
(function(){
|
|
||||||
|
|
||||||
/*jslint node: true, browser: true */
|
|
||||||
/*global $tw: false */
|
|
||||||
"use strict";
|
|
||||||
|
|
||||||
/*
|
|
||||||
Export our filter function
|
|
||||||
*/
|
|
||||||
exports.function = function(source,operator,options) {
|
|
||||||
var functionName = operator.operands[0],
|
|
||||||
variableInfo = options.widget && options.widget.getVariableInfo && options.widget.getVariableInfo(functionName);
|
|
||||||
if(variableInfo && variableInfo.srcVariable && variableInfo.srcVariable.isFunctionDefinition) {
|
|
||||||
return options.widget.evaluateVariable(functionName,{params: operator.operands.slice(1), source: source});
|
|
||||||
}
|
|
||||||
// Return the input list if the function wasn't found
|
|
||||||
var results = [];
|
|
||||||
source(function(tiddler,title) {
|
|
||||||
results.push(title);
|
|
||||||
});
|
|
||||||
return results;
|
|
||||||
};
|
|
||||||
|
|
||||||
})();
|
|
||||||
@@ -61,7 +61,7 @@ exports.has = function(source,operator,options) {
|
|||||||
if(tiddler && $tw.utils.hop(tiddler.fields,operator.operand) && (tiddler.fields[operator.operand].length !== 0)) {
|
if(tiddler && $tw.utils.hop(tiddler.fields,operator.operand) && (tiddler.fields[operator.operand].length !== 0)) {
|
||||||
results.push(title);
|
results.push(title);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return results;
|
return results;
|
||||||
|
|||||||
@@ -1,46 +0,0 @@
|
|||||||
/*\
|
|
||||||
title: $:/core/modules/filters/insertafter.js
|
|
||||||
type: application/javascript
|
|
||||||
module-type: filteroperator
|
|
||||||
|
|
||||||
Insert an item after another item in a list
|
|
||||||
|
|
||||||
\*/
|
|
||||||
(function(){
|
|
||||||
|
|
||||||
/*jslint node: true, browser: true */
|
|
||||||
/*global $tw: false */
|
|
||||||
"use strict";
|
|
||||||
|
|
||||||
/*
|
|
||||||
Order a list
|
|
||||||
*/
|
|
||||||
exports.insertafter = function(source,operator,options) {
|
|
||||||
var results = [];
|
|
||||||
source(function(tiddler,title) {
|
|
||||||
results.push(title);
|
|
||||||
});
|
|
||||||
var target = operator.operands[1] || (options.widget && options.widget.getVariable(operator.suffix || "currentTiddler"));
|
|
||||||
if(target !== operator.operand) {
|
|
||||||
// Remove the entry from the list if it is present
|
|
||||||
var pos = results.indexOf(operator.operand);
|
|
||||||
if(pos !== -1) {
|
|
||||||
results.splice(pos,1);
|
|
||||||
}
|
|
||||||
// Insert the entry after the target marker
|
|
||||||
pos = results.indexOf(target);
|
|
||||||
if(pos !== -1) {
|
|
||||||
results.splice(pos+1,0,operator.operand);
|
|
||||||
} else {
|
|
||||||
var suffix = operator.operands.length > 1 ? operator.suffix : "";
|
|
||||||
if(suffix === "start") {
|
|
||||||
results.splice(0,0,operator.operand);
|
|
||||||
} else {
|
|
||||||
results.push(operator.operand);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return results;
|
|
||||||
};
|
|
||||||
|
|
||||||
})();
|
|
||||||
@@ -20,7 +20,7 @@ exports.insertbefore = function(source,operator,options) {
|
|||||||
source(function(tiddler,title) {
|
source(function(tiddler,title) {
|
||||||
results.push(title);
|
results.push(title);
|
||||||
});
|
});
|
||||||
var target = operator.operands[1] || (options.widget && options.widget.getVariable(operator.suffix || "currentTiddler"));
|
var target = options.widget && options.widget.getVariable(operator.suffix || "currentTiddler");
|
||||||
if(target !== operator.operand) {
|
if(target !== operator.operand) {
|
||||||
// Remove the entry from the list if it is present
|
// Remove the entry from the list if it is present
|
||||||
var pos = results.indexOf(operator.operand);
|
var pos = results.indexOf(operator.operand);
|
||||||
@@ -32,12 +32,7 @@ exports.insertbefore = function(source,operator,options) {
|
|||||||
if(pos !== -1) {
|
if(pos !== -1) {
|
||||||
results.splice(pos,0,operator.operand);
|
results.splice(pos,0,operator.operand);
|
||||||
} else {
|
} else {
|
||||||
var suffix = operator.operands.length > 1 ? operator.suffix : "";
|
results.push(operator.operand);
|
||||||
if(suffix == "start") {
|
|
||||||
results.splice(0,0,operator.operand);
|
|
||||||
} else {
|
|
||||||
results.push(operator.operand);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return results;
|
return results;
|
||||||
|
|||||||
@@ -1,36 +0,0 @@
|
|||||||
/*\
|
|
||||||
title: $:/core/modules/filters/is/draft.js
|
|
||||||
type: application/javascript
|
|
||||||
module-type: isfilteroperator
|
|
||||||
|
|
||||||
Filter function for [is[draft]] analagous to [has[draft.of]]
|
|
||||||
|
|
||||||
\*/
|
|
||||||
(function(){
|
|
||||||
|
|
||||||
/*jslint node: true, browser: true */
|
|
||||||
/*global $tw: false */
|
|
||||||
"use strict";
|
|
||||||
|
|
||||||
/*
|
|
||||||
Export our filter function
|
|
||||||
*/
|
|
||||||
exports.draft = function(source,prefix,options) {
|
|
||||||
var results = [];
|
|
||||||
if(prefix === "!") {
|
|
||||||
source(function(tiddler,title) {
|
|
||||||
if(!tiddler || !tiddler.isDraft()) {
|
|
||||||
results.push(title);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
source(function(tiddler,title) {
|
|
||||||
if(tiddler && tiddler.isDraft()) {
|
|
||||||
results.push(title);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
return results;
|
|
||||||
};
|
|
||||||
|
|
||||||
})();
|
|
||||||
@@ -19,13 +19,13 @@ exports.variable = function(source,prefix,options) {
|
|||||||
var results = [];
|
var results = [];
|
||||||
if(prefix === "!") {
|
if(prefix === "!") {
|
||||||
source(function(tiddler,title) {
|
source(function(tiddler,title) {
|
||||||
if(options.widget.getVariable(title) === undefined) {
|
if(!(title in options.widget.variables)) {
|
||||||
results.push(title);
|
results.push(title);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
source(function(tiddler,title) {
|
source(function(tiddler,title) {
|
||||||
if(options.widget.getVariable(title) !== undefined) {
|
if(title in options.widget.variables) {
|
||||||
results.push(title);
|
results.push(title);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,190 +0,0 @@
|
|||||||
/*\
|
|
||||||
title: $:/core/modules/filters/json-ops.js
|
|
||||||
type: application/javascript
|
|
||||||
module-type: filteroperator
|
|
||||||
|
|
||||||
Filter operators for JSON operations
|
|
||||||
|
|
||||||
\*/
|
|
||||||
(function(){
|
|
||||||
|
|
||||||
/*jslint node: true, browser: true */
|
|
||||||
/*global $tw: false */
|
|
||||||
"use strict";
|
|
||||||
|
|
||||||
exports["jsonget"] = function(source,operator,options) {
|
|
||||||
var results = [];
|
|
||||||
source(function(tiddler,title) {
|
|
||||||
var data = $tw.utils.parseJSONSafe(title,title);
|
|
||||||
if(data) {
|
|
||||||
var items = getDataItemValueAsStrings(data,operator.operands);
|
|
||||||
if(items !== undefined) {
|
|
||||||
results.push.apply(results,items);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
return results;
|
|
||||||
};
|
|
||||||
|
|
||||||
exports["jsonextract"] = function(source,operator,options) {
|
|
||||||
var results = [];
|
|
||||||
source(function(tiddler,title) {
|
|
||||||
var data = $tw.utils.parseJSONSafe(title,title);
|
|
||||||
if(data) {
|
|
||||||
var item = getDataItem(data,operator.operands);
|
|
||||||
if(item !== undefined) {
|
|
||||||
results.push(JSON.stringify(item));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
return results;
|
|
||||||
};
|
|
||||||
|
|
||||||
exports["jsonindexes"] = function(source,operator,options) {
|
|
||||||
var results = [];
|
|
||||||
source(function(tiddler,title) {
|
|
||||||
var data = $tw.utils.parseJSONSafe(title,title);
|
|
||||||
if(data) {
|
|
||||||
var items = getDataItemKeysAsStrings(data,operator.operands);
|
|
||||||
if(items !== undefined) {
|
|
||||||
results.push.apply(results,items);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
return results;
|
|
||||||
};
|
|
||||||
|
|
||||||
exports["jsontype"] = function(source,operator,options) {
|
|
||||||
var results = [];
|
|
||||||
source(function(tiddler,title) {
|
|
||||||
var data = $tw.utils.parseJSONSafe(title,title);
|
|
||||||
if(data) {
|
|
||||||
var item = getDataItemType(data,operator.operands);
|
|
||||||
if(item !== undefined) {
|
|
||||||
results.push(item);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
return results;
|
|
||||||
};
|
|
||||||
|
|
||||||
/*
|
|
||||||
Given a JSON data structure and an array of index strings, return an array of the string representation of the values at the end of the index chain, or "undefined" if any of the index strings are invalid
|
|
||||||
*/
|
|
||||||
function getDataItemValueAsStrings(data,indexes) {
|
|
||||||
// Get the item
|
|
||||||
var item = getDataItem(data,indexes);
|
|
||||||
// Return the item as a string list
|
|
||||||
return convertDataItemValueToStrings(item);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
Given a JSON data structure and an array of index strings, return an array of the string representation of the keys of the item at the end of the index chain, or "undefined" if any of the index strings are invalid
|
|
||||||
*/
|
|
||||||
function getDataItemKeysAsStrings(data,indexes) {
|
|
||||||
// Get the item
|
|
||||||
var item = getDataItem(data,indexes);
|
|
||||||
// Return the item keys as a string
|
|
||||||
return convertDataItemKeysToStrings(item);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
Return an array of the string representation of the values of a data item, or "undefined" if the item is undefined
|
|
||||||
*/
|
|
||||||
function convertDataItemValueToStrings(item) {
|
|
||||||
// Return the item as a string
|
|
||||||
if(item === undefined) {
|
|
||||||
return undefined;
|
|
||||||
} else if(item === null) {
|
|
||||||
return ["null"]
|
|
||||||
} else if(typeof item === "object") {
|
|
||||||
var results = [],i,t;
|
|
||||||
if($tw.utils.isArray(item)) {
|
|
||||||
// Return all the items in arrays recursively
|
|
||||||
for(i=0; i<item.length; i++) {
|
|
||||||
t = convertDataItemValueToStrings(item[i])
|
|
||||||
if(t !== undefined) {
|
|
||||||
results.push.apply(results,t);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
// Return all the values in objects recursively
|
|
||||||
$tw.utils.each(Object.keys(item).sort(),function(key) {
|
|
||||||
t = convertDataItemValueToStrings(item[key]);
|
|
||||||
if(t !== undefined) {
|
|
||||||
results.push.apply(results,t);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
return results;
|
|
||||||
}
|
|
||||||
return [item.toString()];
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
Return an array of the string representation of the keys of a data item, or "undefined" if the item is undefined
|
|
||||||
*/
|
|
||||||
function convertDataItemKeysToStrings(item) {
|
|
||||||
// Return the item as a string
|
|
||||||
if(item === undefined) {
|
|
||||||
return item;
|
|
||||||
} else if(typeof item === "object") {
|
|
||||||
if(item === null) {
|
|
||||||
return [];
|
|
||||||
}
|
|
||||||
var results = [];
|
|
||||||
if($tw.utils.isArray(item)) {
|
|
||||||
for(var i=0; i<item.length; i++) {
|
|
||||||
results.push(i.toString());
|
|
||||||
}
|
|
||||||
return results;
|
|
||||||
} else {
|
|
||||||
$tw.utils.each(Object.keys(item).sort(),function(key) {
|
|
||||||
results.push(key);
|
|
||||||
});
|
|
||||||
return results;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return [];
|
|
||||||
}
|
|
||||||
|
|
||||||
function getDataItemType(data,indexes) {
|
|
||||||
// Get the item
|
|
||||||
var item = getDataItem(data,indexes);
|
|
||||||
// Return the item type
|
|
||||||
if(item === undefined) {
|
|
||||||
return item;
|
|
||||||
} else if(item === null) {
|
|
||||||
return "null";
|
|
||||||
} else if($tw.utils.isArray(item)) {
|
|
||||||
return "array";
|
|
||||||
} else if(typeof item === "object") {
|
|
||||||
return "object";
|
|
||||||
} else {
|
|
||||||
return typeof item;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
Given a JSON data structure and an array of index strings, return the value at the end of the index chain, or "undefined" if any of the index strings are invalid
|
|
||||||
*/
|
|
||||||
function getDataItem(data,indexes) {
|
|
||||||
if(indexes.length === 0 || (indexes.length === 1 && indexes[0] === "")) {
|
|
||||||
return data;
|
|
||||||
}
|
|
||||||
// Get the item
|
|
||||||
var item = data;
|
|
||||||
for(var i=0; i<indexes.length; i++) {
|
|
||||||
if(item !== undefined) {
|
|
||||||
if(item !== null && ["number","string","boolean"].indexOf(typeof item) === -1) {
|
|
||||||
item = item[indexes[i]];
|
|
||||||
} else {
|
|
||||||
item = undefined;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return item;
|
|
||||||
}
|
|
||||||
|
|
||||||
})();
|
|
||||||
|
|
||||||
@@ -16,11 +16,11 @@ Filter operator for returning all the links from a tiddler
|
|||||||
Export our filter function
|
Export our filter function
|
||||||
*/
|
*/
|
||||||
exports.links = function(source,operator,options) {
|
exports.links = function(source,operator,options) {
|
||||||
var results = new $tw.utils.LinkedList();
|
var results = [];
|
||||||
source(function(tiddler,title) {
|
source(function(tiddler,title) {
|
||||||
results.pushTop(options.wiki.getTiddlerLinks(title));
|
$tw.utils.pushTop(results,options.wiki.getTiddlerLinks(title));
|
||||||
});
|
});
|
||||||
return results.makeTiddlerIterator(options.wiki);
|
return results;
|
||||||
};
|
};
|
||||||
|
|
||||||
})();
|
})();
|
||||||
|
|||||||
@@ -87,8 +87,7 @@ exports.butlast = function(source,operator,options) {
|
|||||||
source(function(tiddler,title) {
|
source(function(tiddler,title) {
|
||||||
results.push(title);
|
results.push(title);
|
||||||
});
|
});
|
||||||
var index = count === 0 ? results.length : -count;
|
return results.slice(0,-count);
|
||||||
return results.slice(0,index);
|
|
||||||
};
|
};
|
||||||
exports.bl = exports.butlast;
|
exports.bl = exports.butlast;
|
||||||
|
|
||||||
@@ -104,16 +103,4 @@ exports.nth = function(source,operator,options) {
|
|||||||
return results.slice(count - 1,count);
|
return results.slice(count - 1,count);
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
|
||||||
The zero based nth member of the list
|
|
||||||
*/
|
|
||||||
exports.zth = function(source,operator,options) {
|
|
||||||
var count = $tw.utils.getInt(operator.operand,0),
|
|
||||||
results = [];
|
|
||||||
source(function(tiddler,title) {
|
|
||||||
results.push(title);
|
|
||||||
});
|
|
||||||
return results.slice(count,count + 1);
|
|
||||||
};
|
|
||||||
|
|
||||||
})();
|
})();
|
||||||
|
|||||||
@@ -5,11 +5,9 @@ module-type: filteroperator
|
|||||||
|
|
||||||
Filter operator that looks up values via a title prefix
|
Filter operator that looks up values via a title prefix
|
||||||
|
|
||||||
[lookup:<defaultvalue>:<field OR index>[<prefix>],[<field-name OR index-name>]]
|
[lookup:<field>[<prefix>]]
|
||||||
|
|
||||||
Prepends the prefix to the selected items and returns the specified
|
Prepends the prefix to the selected items and returns the specified field value
|
||||||
field or index value. If the 2nd suffix does not exist, it defaults to field.
|
|
||||||
If the second operand is missing it defaults to "text" for fields, and "0" for indexes
|
|
||||||
|
|
||||||
\*/
|
\*/
|
||||||
(function(){
|
(function(){
|
||||||
@@ -22,31 +20,10 @@ If the second operand is missing it defaults to "text" for fields, and "0" for i
|
|||||||
Export our filter function
|
Export our filter function
|
||||||
*/
|
*/
|
||||||
exports.lookup = function(source,operator,options) {
|
exports.lookup = function(source,operator,options) {
|
||||||
var results = [],
|
var results = [];
|
||||||
suffixes = operator.suffixes || [],
|
source(function(tiddler,title) {
|
||||||
defaultSuffix = suffixes[0] ? (suffixes[0][0] || "") : "",
|
results.push(options.wiki.getTiddlerText(operator.operand + title) || options.wiki.getTiddlerText(operator.operand + operator.suffix));
|
||||||
indexSuffix = (suffixes[1] && suffixes[1][0] === "index") ? true : false,
|
});
|
||||||
target;
|
|
||||||
if(operator.operands.length == 2) {
|
|
||||||
target = operator.operands[1]
|
|
||||||
} else {
|
|
||||||
target = indexSuffix ? "0": "text";
|
|
||||||
}
|
|
||||||
if(indexSuffix) {
|
|
||||||
source(function(tiddler,title) {
|
|
||||||
var data = options.wiki.extractTiddlerDataItem(operator.operands[0]+title,target,defaultSuffix);
|
|
||||||
results.push(data);
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
source(function(tiddler,title) {
|
|
||||||
var value = defaultSuffix;
|
|
||||||
var targetTiddler = options.wiki.getTiddler(operator.operands[0]+title);
|
|
||||||
if(targetTiddler && targetTiddler.getFieldString(target)) {
|
|
||||||
value = targetTiddler.getFieldString(target);
|
|
||||||
}
|
|
||||||
results.push(value);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
return results;
|
return results;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user