mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-11-16 14:54:51 +00:00
Compare commits
No commits in common. "master" and "v5.3.0" have entirely different histories.
8
.eslintignore
Normal file
8
.eslintignore
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
# Ignore "third party" code whose style we will not change.
|
||||||
|
/boot/sjcl.js
|
||||||
|
/core/modules/utils/base64-utf8/base64-utf8.module.js
|
||||||
|
/core/modules/utils/base64-utf8/base64-utf8.module.min.js
|
||||||
|
/core/modules/utils/diff-match-patch/diff_match_patch.js
|
||||||
|
/core/modules/utils/diff-match-patch/diff_match_patch_uncompressed.js
|
||||||
|
/core/modules/utils/dom/csscolorparser.js
|
||||||
|
/plugins/tiddlywiki/*/files/
|
283
.eslintrc.yml
Normal file
283
.eslintrc.yml
Normal file
@ -0,0 +1,283 @@
|
|||||||
|
env:
|
||||||
|
browser: true
|
||||||
|
commonjs: true
|
||||||
|
es2021: true
|
||||||
|
node: true
|
||||||
|
extends: 'eslint:recommended'
|
||||||
|
globals:
|
||||||
|
"$tw": "writable" # temporary
|
||||||
|
parserOptions:
|
||||||
|
ecmaVersion: 5
|
||||||
|
rules:
|
||||||
|
array-bracket-newline: 'off'
|
||||||
|
array-bracket-spacing: 'off'
|
||||||
|
array-callback-return: 'off'
|
||||||
|
array-element-newline: 'off'
|
||||||
|
arrow-body-style: error
|
||||||
|
arrow-parens:
|
||||||
|
- error
|
||||||
|
- as-needed
|
||||||
|
arrow-spacing:
|
||||||
|
- error
|
||||||
|
- after: true
|
||||||
|
before: true
|
||||||
|
block-scoped-var: 'off'
|
||||||
|
block-spacing: 'off'
|
||||||
|
brace-style: 'off'
|
||||||
|
callback-return: 'off'
|
||||||
|
camelcase: 'off'
|
||||||
|
capitalized-comments: 'off'
|
||||||
|
class-methods-use-this: error
|
||||||
|
comma-dangle: 'off'
|
||||||
|
comma-spacing: 'off'
|
||||||
|
comma-style: 'off'
|
||||||
|
complexity: 'off'
|
||||||
|
computed-property-spacing: 'off'
|
||||||
|
consistent-return: 'off'
|
||||||
|
consistent-this: 'off'
|
||||||
|
curly: 'off'
|
||||||
|
default-case: 'off'
|
||||||
|
default-case-last: error
|
||||||
|
default-param-last: error
|
||||||
|
dot-location: 'off'
|
||||||
|
dot-notation: 'off'
|
||||||
|
eol-last: 'off'
|
||||||
|
eqeqeq: 'off'
|
||||||
|
func-call-spacing: 'off'
|
||||||
|
func-name-matching: 'off'
|
||||||
|
func-names: 'off'
|
||||||
|
func-style: 'off'
|
||||||
|
function-call-argument-newline: 'off'
|
||||||
|
function-paren-newline: 'off'
|
||||||
|
generator-star-spacing: error
|
||||||
|
global-require: 'off'
|
||||||
|
grouped-accessor-pairs: error
|
||||||
|
guard-for-in: 'off'
|
||||||
|
handle-callback-err: 'off'
|
||||||
|
id-blacklist: error
|
||||||
|
id-denylist: error
|
||||||
|
id-length: 'off'
|
||||||
|
id-match: error
|
||||||
|
implicit-arrow-linebreak: error
|
||||||
|
indent: 'off'
|
||||||
|
indent-legacy: 'off'
|
||||||
|
init-declarations: 'off'
|
||||||
|
jsx-quotes: error
|
||||||
|
key-spacing: 'off'
|
||||||
|
keyword-spacing:
|
||||||
|
- error
|
||||||
|
- before: true
|
||||||
|
after: false
|
||||||
|
overrides:
|
||||||
|
'case':
|
||||||
|
after: true
|
||||||
|
'do':
|
||||||
|
'after': true
|
||||||
|
'else':
|
||||||
|
after: true
|
||||||
|
'return':
|
||||||
|
after: true
|
||||||
|
'throw':
|
||||||
|
after: true
|
||||||
|
'try':
|
||||||
|
after: true
|
||||||
|
line-comment-position: 'off'
|
||||||
|
linebreak-style: 'off'
|
||||||
|
lines-around-comment: 'off'
|
||||||
|
lines-around-directive: 'off'
|
||||||
|
lines-between-class-members: error
|
||||||
|
max-classes-per-file: error
|
||||||
|
max-depth: 'off'
|
||||||
|
max-len: 'off'
|
||||||
|
max-lines: 'off'
|
||||||
|
max-lines-per-function: 'off'
|
||||||
|
max-nested-callbacks: error
|
||||||
|
max-params: 'off'
|
||||||
|
max-statements: 'off'
|
||||||
|
max-statements-per-line: 'off'
|
||||||
|
multiline-comment-style: 'off'
|
||||||
|
multiline-ternary: 'off'
|
||||||
|
new-parens: 'off'
|
||||||
|
newline-after-var: 'off'
|
||||||
|
newline-before-return: 'off'
|
||||||
|
newline-per-chained-call: 'off'
|
||||||
|
no-alert: 'off'
|
||||||
|
no-array-constructor: 'off'
|
||||||
|
no-await-in-loop: error
|
||||||
|
no-bitwise: 'off'
|
||||||
|
no-buffer-constructor: 'off'
|
||||||
|
no-caller: error
|
||||||
|
no-catch-shadow: 'off'
|
||||||
|
no-confusing-arrow: error
|
||||||
|
no-console: 'off'
|
||||||
|
no-constant-condition:
|
||||||
|
- error
|
||||||
|
- checkLoops: false
|
||||||
|
no-constructor-return: error
|
||||||
|
no-continue: 'off'
|
||||||
|
no-div-regex: 'off'
|
||||||
|
no-duplicate-imports: error
|
||||||
|
no-else-return: 'off'
|
||||||
|
no-empty-function: 'off'
|
||||||
|
no-eq-null: 'off'
|
||||||
|
no-eval: 'off'
|
||||||
|
no-extend-native: 'off'
|
||||||
|
no-extra-bind: 'off'
|
||||||
|
no-extra-label: 'off'
|
||||||
|
no-extra-parens: 'off'
|
||||||
|
no-floating-decimal: 'off'
|
||||||
|
no-implicit-coercion:
|
||||||
|
- error
|
||||||
|
- boolean: false
|
||||||
|
number: false
|
||||||
|
string: false
|
||||||
|
no-implicit-globals: 'off'
|
||||||
|
no-implied-eval: error
|
||||||
|
no-inline-comments: 'off'
|
||||||
|
no-invalid-this: 'off'
|
||||||
|
no-iterator: error
|
||||||
|
no-label-var: 'off'
|
||||||
|
no-labels: 'off'
|
||||||
|
no-lone-blocks: 'off'
|
||||||
|
no-lonely-if: 'off'
|
||||||
|
no-loop-func: 'off'
|
||||||
|
no-loss-of-precision: error
|
||||||
|
no-magic-numbers: 'off'
|
||||||
|
no-mixed-operators: 'off'
|
||||||
|
no-mixed-requires: 'off'
|
||||||
|
no-multi-assign: 'off'
|
||||||
|
no-multi-spaces: 'off'
|
||||||
|
no-multi-str: error
|
||||||
|
no-multiple-empty-lines: 'off'
|
||||||
|
no-native-reassign: 'off'
|
||||||
|
no-negated-condition: 'off'
|
||||||
|
no-negated-in-lhs: error
|
||||||
|
no-nested-ternary: 'off'
|
||||||
|
no-new: 'off'
|
||||||
|
no-new-func: 'off'
|
||||||
|
no-new-object: 'off'
|
||||||
|
no-new-require: error
|
||||||
|
no-new-wrappers: error
|
||||||
|
no-octal-escape: error
|
||||||
|
no-param-reassign: 'off'
|
||||||
|
no-path-concat: error
|
||||||
|
no-plusplus: 'off'
|
||||||
|
no-process-env: 'off'
|
||||||
|
no-process-exit: 'off'
|
||||||
|
no-promise-executor-return: error
|
||||||
|
no-proto: 'off'
|
||||||
|
no-restricted-exports: error
|
||||||
|
no-restricted-globals: error
|
||||||
|
no-restricted-imports: error
|
||||||
|
no-restricted-modules: error
|
||||||
|
no-restricted-properties: error
|
||||||
|
no-restricted-syntax: error
|
||||||
|
no-return-assign: 'off'
|
||||||
|
no-return-await: error
|
||||||
|
no-script-url: 'off'
|
||||||
|
no-self-compare: 'off'
|
||||||
|
no-sequences: 'off'
|
||||||
|
no-shadow: 'off'
|
||||||
|
no-spaced-func: 'off'
|
||||||
|
no-sync: 'off'
|
||||||
|
no-tabs: 'off'
|
||||||
|
no-template-curly-in-string: error
|
||||||
|
no-ternary: 'off'
|
||||||
|
no-throw-literal: 'off'
|
||||||
|
no-trailing-spaces: 'off'
|
||||||
|
no-undef-init: 'off'
|
||||||
|
no-undefined: 'off'
|
||||||
|
no-underscore-dangle: 'off'
|
||||||
|
no-unmodified-loop-condition: 'off'
|
||||||
|
no-unneeded-ternary: 'off'
|
||||||
|
no-unreachable-loop: error
|
||||||
|
no-unused-expressions: 'off'
|
||||||
|
no-use-before-define: 'off'
|
||||||
|
no-useless-backreference: error
|
||||||
|
no-useless-call: 'off'
|
||||||
|
no-useless-computed-key: error
|
||||||
|
no-useless-concat: 'off'
|
||||||
|
no-useless-constructor: error
|
||||||
|
no-useless-rename: error
|
||||||
|
no-useless-return: 'off'
|
||||||
|
no-var: 'off'
|
||||||
|
no-void: 'off'
|
||||||
|
no-warning-comments: 'off'
|
||||||
|
no-whitespace-before-property: error
|
||||||
|
nonblock-statement-body-position:
|
||||||
|
- error
|
||||||
|
- any
|
||||||
|
object-curly-newline: 'off'
|
||||||
|
object-curly-spacing: 'off'
|
||||||
|
object-property-newline: 'off'
|
||||||
|
object-shorthand: 'off'
|
||||||
|
one-var: 'off'
|
||||||
|
one-var-declaration-per-line: 'off'
|
||||||
|
operator-assignment: 'off'
|
||||||
|
operator-linebreak: 'off'
|
||||||
|
padded-blocks: 'off'
|
||||||
|
padding-line-between-statements: error
|
||||||
|
prefer-arrow-callback: 'off'
|
||||||
|
prefer-const: 'off'
|
||||||
|
prefer-destructuring: 'off'
|
||||||
|
prefer-exponentiation-operator: 'off'
|
||||||
|
prefer-named-capture-group: 'off'
|
||||||
|
prefer-numeric-literals: error
|
||||||
|
prefer-object-spread: 'off'
|
||||||
|
prefer-promise-reject-errors: error
|
||||||
|
prefer-reflect: 'off'
|
||||||
|
prefer-regex-literals: 'off'
|
||||||
|
prefer-rest-params: 'off'
|
||||||
|
prefer-spread: 'off'
|
||||||
|
prefer-template: 'off'
|
||||||
|
quote-props: 'off'
|
||||||
|
quotes: 'off'
|
||||||
|
radix: 'off'
|
||||||
|
require-atomic-updates: error
|
||||||
|
require-await: error
|
||||||
|
require-jsdoc: 'off'
|
||||||
|
require-unicode-regexp: 'off'
|
||||||
|
rest-spread-spacing: error
|
||||||
|
semi: 'off'
|
||||||
|
semi-spacing: 'off'
|
||||||
|
semi-style: 'off'
|
||||||
|
sort-imports: error
|
||||||
|
sort-keys: 'off'
|
||||||
|
sort-vars: 'off'
|
||||||
|
space-before-blocks: 'off'
|
||||||
|
space-before-function-paren: 'off'
|
||||||
|
space-in-parens: 'off'
|
||||||
|
space-infix-ops: 'off'
|
||||||
|
space-unary-ops: 'off'
|
||||||
|
spaced-comment: 'off'
|
||||||
|
strict: 'off'
|
||||||
|
switch-colon-spacing: 'off'
|
||||||
|
symbol-description: error
|
||||||
|
template-curly-spacing: error
|
||||||
|
template-tag-spacing: error
|
||||||
|
unicode-bom:
|
||||||
|
- error
|
||||||
|
- never
|
||||||
|
valid-jsdoc: 'off'
|
||||||
|
valid-typeof:
|
||||||
|
- error
|
||||||
|
- requireStringLiterals: false
|
||||||
|
vars-on-top: 'off'
|
||||||
|
wrap-iife: 'off'
|
||||||
|
wrap-regex: 'off'
|
||||||
|
yield-star-spacing: error
|
||||||
|
yoda: 'off'
|
||||||
|
|
||||||
|
# temporary rules
|
||||||
|
no-useless-escape: 'off'
|
||||||
|
no-unused-vars: 'off'
|
||||||
|
no-empty: 'off'
|
||||||
|
no-extra-semi: 'off'
|
||||||
|
no-redeclare: 'off'
|
||||||
|
no-control-regex: "off"
|
||||||
|
no-mixed-spaces-and-tabs: "off"
|
||||||
|
no-extra-boolean-cast: "off"
|
||||||
|
no-prototype-builtins: "off"
|
||||||
|
no-undef: "off"
|
||||||
|
no-unreachable: "off"
|
||||||
|
no-self-assign: "off"
|
4
.github/ISSUE_TEMPLATE/bug_report.yml
vendored
4
.github/ISSUE_TEMPLATE/bug_report.yml
vendored
@ -21,7 +21,7 @@ body:
|
|||||||
attributes:
|
attributes:
|
||||||
label: To Reproduce
|
label: To Reproduce
|
||||||
description: "Steps to reproduce the behavior:"
|
description: "Steps to reproduce the behavior:"
|
||||||
placeholder: |
|
value: |
|
||||||
1. Go to '...'
|
1. Go to '...'
|
||||||
2. Click on '....'
|
2. Click on '....'
|
||||||
3. Scroll down to '....'
|
3. Scroll down to '....'
|
||||||
@ -41,7 +41,7 @@ body:
|
|||||||
attributes:
|
attributes:
|
||||||
label: TiddlyWiki Configuration
|
label: TiddlyWiki Configuration
|
||||||
description: please complete the following information
|
description: please complete the following information
|
||||||
placeholder: |
|
value: |
|
||||||
- Version [e.g. v5.1.24]
|
- Version [e.g. v5.1.24]
|
||||||
- Saving mechanism [e.g. Node.js, TiddlyDesktop, TiddlyHost etc]
|
- Saving mechanism [e.g. Node.js, TiddlyDesktop, TiddlyHost etc]
|
||||||
- Plugins installed [e.g. Freelinks, TiddlyMap]
|
- Plugins installed [e.g. Freelinks, TiddlyMap]
|
||||||
|
2
.github/ISSUE_TEMPLATE/config.yml
vendored
2
.github/ISSUE_TEMPLATE/config.yml
vendored
@ -1,7 +1,7 @@
|
|||||||
blank_issues_enabled: false
|
blank_issues_enabled: false
|
||||||
contact_links:
|
contact_links:
|
||||||
- name: Discuss feature request
|
- name: Discuss feature request
|
||||||
url: https://github.com/TiddlyWiki/TiddlyWiki5/discussions
|
url: https://github.com/Jermolene/TiddlyWiki5/discussions
|
||||||
about: Open new discussion about new feature
|
about: Open new discussion about new feature
|
||||||
- name: Talk.Tiddlywiki Forum
|
- name: Talk.Tiddlywiki Forum
|
||||||
url: https://talk.tiddlywiki.org
|
url: https://talk.tiddlywiki.org
|
||||||
|
11
.github/workflows/ci.yml
vendored
11
.github/workflows/ci.yml
vendored
@ -5,7 +5,7 @@ on:
|
|||||||
- master
|
- master
|
||||||
- tiddlywiki-com
|
- tiddlywiki-com
|
||||||
env:
|
env:
|
||||||
NODE_VERSION: "22"
|
NODE_VERSION: "12"
|
||||||
jobs:
|
jobs:
|
||||||
test:
|
test:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
@ -14,13 +14,7 @@ jobs:
|
|||||||
- uses: actions/setup-node@v1
|
- uses: actions/setup-node@v1
|
||||||
with:
|
with:
|
||||||
node-version: "${{ env.NODE_VERSION }}"
|
node-version: "${{ env.NODE_VERSION }}"
|
||||||
- run: "./bin/ci-test.sh"
|
- run: "./bin/test.sh"
|
||||||
- uses: actions/upload-artifact@v3
|
|
||||||
if: always()
|
|
||||||
with:
|
|
||||||
name: playwright-report
|
|
||||||
path: playwright-report/
|
|
||||||
retention-days: 30
|
|
||||||
build-prerelease:
|
build-prerelease:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
if: github.ref == 'refs/heads/master'
|
if: github.ref == 'refs/heads/master'
|
||||||
@ -60,7 +54,6 @@ jobs:
|
|||||||
TW5_BUILD_TIDDLYWIKI: "./node_modules/tiddlywiki/tiddlywiki.js"
|
TW5_BUILD_TIDDLYWIKI: "./node_modules/tiddlywiki/tiddlywiki.js"
|
||||||
TW5_BUILD_MAIN_EDITION: "./editions/tw5.com"
|
TW5_BUILD_MAIN_EDITION: "./editions/tw5.com"
|
||||||
TW5_BUILD_OUTPUT: "./output"
|
TW5_BUILD_OUTPUT: "./output"
|
||||||
TW5_BUILD_ARCHIVE: "./output"
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
- uses: actions/setup-node@v1
|
- uses: actions/setup-node@v1
|
||||||
|
30
.github/workflows/cla-check.yml
vendored
30
.github/workflows/cla-check.yml
vendored
@ -1,30 +0,0 @@
|
|||||||
name: Check CLA Signature
|
|
||||||
on:
|
|
||||||
pull_request_target:
|
|
||||||
types:
|
|
||||||
- opened
|
|
||||||
- reopened
|
|
||||||
paths-ignore:
|
|
||||||
- 'licenses/cla-individual.md'
|
|
||||||
jobs:
|
|
||||||
check_cla:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
permissions:
|
|
||||||
pull-requests: write
|
|
||||||
if: ${{ (github.event.pull_request.user.login != github.repository_owner) }}
|
|
||||||
steps:
|
|
||||||
- run: |
|
|
||||||
if ! curl -s https://raw.githubusercontent.com/Jermolene/TiddlyWiki5/tiddlywiki-com/licenses/cla-individual.md | grep -io "@$USER,"; then
|
|
||||||
echo "CLA not signed"
|
|
||||||
gh pr comment "$NUMBER" -b "@$USER It appears that this is your first contribution to the project, welcome.
|
|
||||||
|
|
||||||
With apologies for the bureaucracy, please could you prepare a separate PR to the 'tiddlywiki-com' branch with your signature for the Contributor License Agreement (see [contributing.md](https://github.com/TiddlyWiki/TiddlyWiki5/blob/master/contributing.md))."
|
|
||||||
else
|
|
||||||
echo "CLA already signed"
|
|
||||||
gh pr comment "$NUMBER" -b "Confirmed: **$USER** has already signed the Contributor License Agreement (see [contributing.md](https://github.com/TiddlyWiki/TiddlyWiki5/blob/master/contributing.md))"
|
|
||||||
fi
|
|
||||||
env:
|
|
||||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
GH_REPO: ${{ github.repository }}
|
|
||||||
NUMBER: ${{ github.event.pull_request.number }}
|
|
||||||
USER: ${{ github.actor }}
|
|
70
.github/workflows/cla-signed.yml
vendored
70
.github/workflows/cla-signed.yml
vendored
@ -1,70 +0,0 @@
|
|||||||
name: CLA Signed
|
|
||||||
|
|
||||||
on:
|
|
||||||
pull_request_target:
|
|
||||||
types:
|
|
||||||
- opened
|
|
||||||
- closed
|
|
||||||
paths:
|
|
||||||
- 'licenses/cla-individual.md'
|
|
||||||
|
|
||||||
env:
|
|
||||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
GH_REPO: ${{ github.repository }}
|
|
||||||
NUMBER: ${{ github.event.pull_request.number }}
|
|
||||||
AUTHOR: ${{ github.event.pull_request.user.login }}
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
# check if PRs updating the CLA are targetting the tiddlywiki-com branch
|
|
||||||
check-signature-branch:
|
|
||||||
if: (github.event.pull_request.merged != true) && (github.event.pull_request.user.login != github.repository_owner)
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
permissions:
|
|
||||||
pull-requests: write
|
|
||||||
steps:
|
|
||||||
- run: |
|
|
||||||
if [[ "$BRANCH" != "tiddlywiki-com" ]]; then
|
|
||||||
echo "This CLA signature targets the wrong branch: $BRANCH"
|
|
||||||
gh pr comment "$NUMBER" -b "@$AUTHOR Signatures to the CLA must target the 'tiddlywiki-com' branch."
|
|
||||||
fi
|
|
||||||
env:
|
|
||||||
BRANCH: ${{ github.event.pull_request.base.ref }}
|
|
||||||
|
|
||||||
# leave a comment on each open PR by a given author when their signature is added to the CLA
|
|
||||||
cla-signed:
|
|
||||||
if: (github.event.pull_request.merged == true) && (github.event.pull_request.user.login != github.repository_owner)
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
permissions:
|
|
||||||
pull-requests: write
|
|
||||||
steps:
|
|
||||||
- name: List open PRs by user
|
|
||||||
id: list-prs
|
|
||||||
uses: actions/github-script@v6
|
|
||||||
with:
|
|
||||||
result-encoding: string
|
|
||||||
script: |
|
|
||||||
const owner = context.repo.owner,
|
|
||||||
repo = context.repo.repo,
|
|
||||||
author = context.payload.pull_request.user.login;
|
|
||||||
|
|
||||||
const { data: pullRequests } = await github.rest.pulls.list({
|
|
||||||
owner: owner,
|
|
||||||
repo: repo,
|
|
||||||
state: 'open',
|
|
||||||
sort: 'created',
|
|
||||||
direction: 'desc',
|
|
||||||
per_page: 100
|
|
||||||
});
|
|
||||||
const userPullRequests = pullRequests.filter(pr => pr.user.login === author),
|
|
||||||
prNumbers = userPullRequests.map(pr => pr.number).join(',');
|
|
||||||
console.log(`Open pull requests by ${author}:${prNumbers}`);
|
|
||||||
return prNumbers;
|
|
||||||
|
|
||||||
- name: Comment open PRs by the same author
|
|
||||||
run: |
|
|
||||||
prs=($(echo ${{ steps.list-prs.outputs.result }} | tr "," "\n"))
|
|
||||||
|
|
||||||
for number in "${prs[@]}"
|
|
||||||
do
|
|
||||||
gh pr comment "$number" -b "**$AUTHOR** has signed the Contributor License Agreement (see [contributing.md](https://github.com/TiddlyWiki/TiddlyWiki5/blob/master/contributing.md))"
|
|
||||||
done
|
|
5
.gitignore
vendored
5
.gitignore
vendored
@ -5,7 +5,4 @@
|
|||||||
tmp/
|
tmp/
|
||||||
output/
|
output/
|
||||||
node_modules/
|
node_modules/
|
||||||
/test-results/
|
|
||||||
/playwright-report/
|
|
||||||
/playwright/.cache/
|
|
||||||
$__StoryList.tid
|
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
# Default to the current version number for building the plugin library
|
# Default to the current version number for building the plugin library
|
||||||
|
|
||||||
if [ -z "$TW5_BUILD_VERSION" ]; then
|
if [ -z "$TW5_BUILD_VERSION" ]; then
|
||||||
TW5_BUILD_VERSION=v5.3.7
|
TW5_BUILD_VERSION=v5.3.0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Using TW5_BUILD_VERSION as [$TW5_BUILD_VERSION]"
|
echo "Using TW5_BUILD_VERSION as [$TW5_BUILD_VERSION]"
|
||||||
@ -84,26 +84,10 @@ echo -e -n "title: $:/build\ncommit: $TW5_BUILD_COMMIT\n\n$TW5_BUILD_DETAILS\n"
|
|||||||
|
|
||||||
######################################################
|
######################################################
|
||||||
#
|
#
|
||||||
# Core distributions
|
# Core distribution
|
||||||
#
|
#
|
||||||
######################################################
|
######################################################
|
||||||
|
|
||||||
# Conditionally build archive if $TW5_BUILD_ARCHIVE variable is set, otherwise do nothing
|
|
||||||
#
|
|
||||||
# /archive/Empty-TiddlyWiki-<version>.html Empty archived version
|
|
||||||
# /archive/TiddlyWiki-<version>.html Full archived version
|
|
||||||
|
|
||||||
if [ -n "$TW5_BUILD_ARCHIVE" ]; then
|
|
||||||
|
|
||||||
node $TW5_BUILD_TIDDLYWIKI \
|
|
||||||
$TW5_BUILD_MAIN_EDITION \
|
|
||||||
--version \
|
|
||||||
--load $TW5_BUILD_OUTPUT/build.tid \
|
|
||||||
--output $TW5_BUILD_ARCHIVE \
|
|
||||||
--build archive \
|
|
||||||
|| exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# /index.html Main site
|
# /index.html Main site
|
||||||
# /favicon.ico Favicon for main site
|
# /favicon.ico Favicon for main site
|
||||||
# /static.html Static rendering of default tiddlers
|
# /static.html Static rendering of default tiddlers
|
||||||
@ -111,29 +95,29 @@ fi
|
|||||||
# /static/* Static single tiddlers
|
# /static/* Static single tiddlers
|
||||||
# /static/static.css Static stylesheet
|
# /static/static.css Static stylesheet
|
||||||
# /static/favicon.ico Favicon for static pages
|
# /static/favicon.ico Favicon for static pages
|
||||||
|
|
||||||
node $TW5_BUILD_TIDDLYWIKI \
|
node $TW5_BUILD_TIDDLYWIKI \
|
||||||
$TW5_BUILD_MAIN_EDITION \
|
$TW5_BUILD_MAIN_EDITION \
|
||||||
|
--verbose \
|
||||||
--version \
|
--version \
|
||||||
--load $TW5_BUILD_OUTPUT/build.tid \
|
--load $TW5_BUILD_OUTPUT/build.tid \
|
||||||
--output $TW5_BUILD_OUTPUT \
|
--output $TW5_BUILD_OUTPUT \
|
||||||
--build favicon static index \
|
--build favicon static index \
|
||||||
|| exit 1
|
|| exit 1
|
||||||
|
|
||||||
# /empty.html Empty
|
# /empty.html Empty
|
||||||
# /empty.hta For Internet Explorer
|
# /empty.hta For Internet Explorer
|
||||||
# /empty-external-core.html External core empty
|
|
||||||
# /tiddlywikicore-<version>.js Core plugin javascript
|
|
||||||
node $TW5_BUILD_TIDDLYWIKI \
|
node $TW5_BUILD_TIDDLYWIKI \
|
||||||
./editions/empty \
|
./editions/empty \
|
||||||
|
--verbose \
|
||||||
--output $TW5_BUILD_OUTPUT \
|
--output $TW5_BUILD_OUTPUT \
|
||||||
--build empty emptyexternalcore \
|
--build empty \
|
||||||
|| exit 1
|
|| exit 1
|
||||||
|
|
||||||
|
|
||||||
# /test.html Test edition
|
# /test.html Test edition
|
||||||
node $TW5_BUILD_TIDDLYWIKI \
|
node $TW5_BUILD_TIDDLYWIKI \
|
||||||
./editions/test \
|
./editions/test \
|
||||||
|
--verbose \
|
||||||
--output $TW5_BUILD_OUTPUT \
|
--output $TW5_BUILD_OUTPUT \
|
||||||
--rendertiddler $:/core/save/all test.html text/plain \
|
--rendertiddler $:/core/save/all test.html text/plain \
|
||||||
|| exit 1
|
|| exit 1
|
||||||
@ -146,21 +130,16 @@ node $TW5_BUILD_TIDDLYWIKI \
|
|||||||
# /dev/static/static.css Static stylesheet
|
# /dev/static/static.css Static stylesheet
|
||||||
node $TW5_BUILD_TIDDLYWIKI \
|
node $TW5_BUILD_TIDDLYWIKI \
|
||||||
./editions/dev \
|
./editions/dev \
|
||||||
|
--verbose \
|
||||||
--load $TW5_BUILD_OUTPUT/build.tid \
|
--load $TW5_BUILD_OUTPUT/build.tid \
|
||||||
--output $TW5_BUILD_OUTPUT/dev \
|
--output $TW5_BUILD_OUTPUT/dev \
|
||||||
--build index favicon static \
|
--build index favicon static \
|
||||||
|| exit 1
|
|| exit 1
|
||||||
|
|
||||||
# /tour.html tour edition
|
|
||||||
node $TW5_BUILD_TIDDLYWIKI \
|
|
||||||
./editions/tour \
|
|
||||||
--output $TW5_BUILD_OUTPUT \
|
|
||||||
--rendertiddler $:/core/save/all tour.html text/plain \
|
|
||||||
|| exit 1
|
|
||||||
|
|
||||||
# /share.html Custom edition for sharing via the URL
|
# /share.html Custom edition for sharing via the URL
|
||||||
node $TW5_BUILD_TIDDLYWIKI \
|
node $TW5_BUILD_TIDDLYWIKI \
|
||||||
./editions/share \
|
./editions/share \
|
||||||
|
--verbose \
|
||||||
--load $TW5_BUILD_OUTPUT/build.tid \
|
--load $TW5_BUILD_OUTPUT/build.tid \
|
||||||
--output $TW5_BUILD_OUTPUT \
|
--output $TW5_BUILD_OUTPUT \
|
||||||
--build share \
|
--build share \
|
||||||
@ -169,6 +148,7 @@ node $TW5_BUILD_TIDDLYWIKI \
|
|||||||
# /upgrade.html Custom edition for performing upgrades
|
# /upgrade.html Custom edition for performing upgrades
|
||||||
node $TW5_BUILD_TIDDLYWIKI \
|
node $TW5_BUILD_TIDDLYWIKI \
|
||||||
./editions/upgrade \
|
./editions/upgrade \
|
||||||
|
--verbose \
|
||||||
--load $TW5_BUILD_OUTPUT/build.tid \
|
--load $TW5_BUILD_OUTPUT/build.tid \
|
||||||
--output $TW5_BUILD_OUTPUT \
|
--output $TW5_BUILD_OUTPUT \
|
||||||
--build upgrade \
|
--build upgrade \
|
||||||
@ -177,6 +157,7 @@ node $TW5_BUILD_TIDDLYWIKI \
|
|||||||
# /encrypted.html Copy of the main file encrypted with the password "password"
|
# /encrypted.html Copy of the main file encrypted with the password "password"
|
||||||
node $TW5_BUILD_TIDDLYWIKI \
|
node $TW5_BUILD_TIDDLYWIKI \
|
||||||
$TW5_BUILD_MAIN_EDITION \
|
$TW5_BUILD_MAIN_EDITION \
|
||||||
|
--verbose \
|
||||||
--load $TW5_BUILD_OUTPUT/build.tid \
|
--load $TW5_BUILD_OUTPUT/build.tid \
|
||||||
--output $TW5_BUILD_OUTPUT \
|
--output $TW5_BUILD_OUTPUT \
|
||||||
--build encrypted \
|
--build encrypted \
|
||||||
@ -192,6 +173,7 @@ node $TW5_BUILD_TIDDLYWIKI \
|
|||||||
# /editions/xlsx-utils/index.html xlsx-utils edition
|
# /editions/xlsx-utils/index.html xlsx-utils edition
|
||||||
node $TW5_BUILD_TIDDLYWIKI \
|
node $TW5_BUILD_TIDDLYWIKI \
|
||||||
./editions/xlsx-utils \
|
./editions/xlsx-utils \
|
||||||
|
--verbose \
|
||||||
--load $TW5_BUILD_OUTPUT/build.tid \
|
--load $TW5_BUILD_OUTPUT/build.tid \
|
||||||
--output $TW5_BUILD_OUTPUT/editions/xlsx-utils/ \
|
--output $TW5_BUILD_OUTPUT/editions/xlsx-utils/ \
|
||||||
--build index \
|
--build index \
|
||||||
@ -200,6 +182,7 @@ node $TW5_BUILD_TIDDLYWIKI \
|
|||||||
# /editions/resumebuilder/index.html Resume builder edition
|
# /editions/resumebuilder/index.html Resume builder edition
|
||||||
node $TW5_BUILD_TIDDLYWIKI \
|
node $TW5_BUILD_TIDDLYWIKI \
|
||||||
./editions/resumebuilder \
|
./editions/resumebuilder \
|
||||||
|
--verbose \
|
||||||
--load $TW5_BUILD_OUTPUT/build.tid \
|
--load $TW5_BUILD_OUTPUT/build.tid \
|
||||||
--output $TW5_BUILD_OUTPUT/editions/resumebuilder/ \
|
--output $TW5_BUILD_OUTPUT/editions/resumebuilder/ \
|
||||||
--build index \
|
--build index \
|
||||||
@ -208,6 +191,7 @@ node $TW5_BUILD_TIDDLYWIKI \
|
|||||||
# /editions/text-slicer/index.html Text slicer edition
|
# /editions/text-slicer/index.html Text slicer edition
|
||||||
node $TW5_BUILD_TIDDLYWIKI \
|
node $TW5_BUILD_TIDDLYWIKI \
|
||||||
./editions/text-slicer \
|
./editions/text-slicer \
|
||||||
|
--verbose \
|
||||||
--load $TW5_BUILD_OUTPUT/build.tid \
|
--load $TW5_BUILD_OUTPUT/build.tid \
|
||||||
--output $TW5_BUILD_OUTPUT/editions/text-slicer/ \
|
--output $TW5_BUILD_OUTPUT/editions/text-slicer/ \
|
||||||
--build index \
|
--build index \
|
||||||
@ -216,6 +200,7 @@ node $TW5_BUILD_TIDDLYWIKI \
|
|||||||
# /editions/translators/index.html Translators edition
|
# /editions/translators/index.html Translators edition
|
||||||
node $TW5_BUILD_TIDDLYWIKI \
|
node $TW5_BUILD_TIDDLYWIKI \
|
||||||
./editions/translators \
|
./editions/translators \
|
||||||
|
--verbose \
|
||||||
--load $TW5_BUILD_OUTPUT/build.tid \
|
--load $TW5_BUILD_OUTPUT/build.tid \
|
||||||
--output $TW5_BUILD_OUTPUT/editions/translators/ \
|
--output $TW5_BUILD_OUTPUT/editions/translators/ \
|
||||||
--build index \
|
--build index \
|
||||||
@ -224,6 +209,7 @@ node $TW5_BUILD_TIDDLYWIKI \
|
|||||||
# /editions/introduction/index.html Introduction edition
|
# /editions/introduction/index.html Introduction edition
|
||||||
node $TW5_BUILD_TIDDLYWIKI \
|
node $TW5_BUILD_TIDDLYWIKI \
|
||||||
./editions/introduction \
|
./editions/introduction \
|
||||||
|
--verbose \
|
||||||
--load $TW5_BUILD_OUTPUT/build.tid \
|
--load $TW5_BUILD_OUTPUT/build.tid \
|
||||||
--output $TW5_BUILD_OUTPUT/editions/introduction/ \
|
--output $TW5_BUILD_OUTPUT/editions/introduction/ \
|
||||||
--build index \
|
--build index \
|
||||||
@ -232,6 +218,7 @@ node $TW5_BUILD_TIDDLYWIKI \
|
|||||||
# /editions/full/index.html Full edition
|
# /editions/full/index.html Full edition
|
||||||
node $TW5_BUILD_TIDDLYWIKI \
|
node $TW5_BUILD_TIDDLYWIKI \
|
||||||
./editions/full \
|
./editions/full \
|
||||||
|
--verbose \
|
||||||
--load $TW5_BUILD_OUTPUT/build.tid \
|
--load $TW5_BUILD_OUTPUT/build.tid \
|
||||||
--output $TW5_BUILD_OUTPUT/editions/full/ \
|
--output $TW5_BUILD_OUTPUT/editions/full/ \
|
||||||
--build index \
|
--build index \
|
||||||
@ -240,6 +227,7 @@ node $TW5_BUILD_TIDDLYWIKI \
|
|||||||
# /editions/tw5.com-docs/index.html tiddlywiki.com docs edition
|
# /editions/tw5.com-docs/index.html tiddlywiki.com docs edition
|
||||||
node $TW5_BUILD_TIDDLYWIKI \
|
node $TW5_BUILD_TIDDLYWIKI \
|
||||||
./editions/tw5.com-docs \
|
./editions/tw5.com-docs \
|
||||||
|
--verbose \
|
||||||
--load $TW5_BUILD_OUTPUT/build.tid \
|
--load $TW5_BUILD_OUTPUT/build.tid \
|
||||||
--output $TW5_BUILD_OUTPUT/editions/tw5.com-docs/ \
|
--output $TW5_BUILD_OUTPUT/editions/tw5.com-docs/ \
|
||||||
--build index \
|
--build index \
|
||||||
@ -248,6 +236,7 @@ node $TW5_BUILD_TIDDLYWIKI \
|
|||||||
# /editions/twitter-archivist/index.html Twitter Archivist edition
|
# /editions/twitter-archivist/index.html Twitter Archivist edition
|
||||||
node $TW5_BUILD_TIDDLYWIKI \
|
node $TW5_BUILD_TIDDLYWIKI \
|
||||||
./editions/twitter-archivist \
|
./editions/twitter-archivist \
|
||||||
|
--verbose \
|
||||||
--load $TW5_BUILD_OUTPUT/build.tid \
|
--load $TW5_BUILD_OUTPUT/build.tid \
|
||||||
--output $TW5_BUILD_OUTPUT/editions/twitter-archivist/ \
|
--output $TW5_BUILD_OUTPUT/editions/twitter-archivist/ \
|
||||||
--build index \
|
--build index \
|
||||||
@ -263,6 +252,7 @@ node $TW5_BUILD_TIDDLYWIKI \
|
|||||||
|
|
||||||
node $TW5_BUILD_TIDDLYWIKI \
|
node $TW5_BUILD_TIDDLYWIKI \
|
||||||
./editions/innerwikidemo \
|
./editions/innerwikidemo \
|
||||||
|
--verbose \
|
||||||
--load $TW5_BUILD_OUTPUT/build.tid \
|
--load $TW5_BUILD_OUTPUT/build.tid \
|
||||||
--output $TW5_BUILD_OUTPUT \
|
--output $TW5_BUILD_OUTPUT \
|
||||||
--rendertiddler $:/core/save/all plugins/tiddlywiki/innerwiki/index.html text/plain \
|
--rendertiddler $:/core/save/all plugins/tiddlywiki/innerwiki/index.html text/plain \
|
||||||
@ -273,6 +263,7 @@ node $TW5_BUILD_TIDDLYWIKI \
|
|||||||
|
|
||||||
node $TW5_BUILD_TIDDLYWIKI \
|
node $TW5_BUILD_TIDDLYWIKI \
|
||||||
./editions/dynaviewdemo \
|
./editions/dynaviewdemo \
|
||||||
|
--verbose \
|
||||||
--load $TW5_BUILD_OUTPUT/build.tid \
|
--load $TW5_BUILD_OUTPUT/build.tid \
|
||||||
--output $TW5_BUILD_OUTPUT \
|
--output $TW5_BUILD_OUTPUT \
|
||||||
--rendertiddler $:/core/save/all plugins/tiddlywiki/dynaview/index.html text/plain \
|
--rendertiddler $:/core/save/all plugins/tiddlywiki/dynaview/index.html text/plain \
|
||||||
@ -287,6 +278,7 @@ node $TW5_BUILD_TIDDLYWIKI \
|
|||||||
|
|
||||||
node $TW5_BUILD_TIDDLYWIKI \
|
node $TW5_BUILD_TIDDLYWIKI \
|
||||||
./editions/katexdemo \
|
./editions/katexdemo \
|
||||||
|
--verbose \
|
||||||
--load $TW5_BUILD_OUTPUT/build.tid \
|
--load $TW5_BUILD_OUTPUT/build.tid \
|
||||||
--output $TW5_BUILD_OUTPUT \
|
--output $TW5_BUILD_OUTPUT \
|
||||||
--rendertiddler $:/core/save/all plugins/tiddlywiki/katex/index.html text/plain \
|
--rendertiddler $:/core/save/all plugins/tiddlywiki/katex/index.html text/plain \
|
||||||
@ -297,6 +289,7 @@ node $TW5_BUILD_TIDDLYWIKI \
|
|||||||
# /plugins/tiddlywiki/tahoelafs/empty.html Empty wiki with Tahoe-LAFS plugin
|
# /plugins/tiddlywiki/tahoelafs/empty.html Empty wiki with Tahoe-LAFS plugin
|
||||||
node $TW5_BUILD_TIDDLYWIKI \
|
node $TW5_BUILD_TIDDLYWIKI \
|
||||||
./editions/tahoelafs \
|
./editions/tahoelafs \
|
||||||
|
--verbose \
|
||||||
--load $TW5_BUILD_OUTPUT/build.tid \
|
--load $TW5_BUILD_OUTPUT/build.tid \
|
||||||
--output $TW5_BUILD_OUTPUT \
|
--output $TW5_BUILD_OUTPUT \
|
||||||
--rendertiddler $:/core/save/all plugins/tiddlywiki/tahoelafs/index.html text/plain \
|
--rendertiddler $:/core/save/all plugins/tiddlywiki/tahoelafs/index.html text/plain \
|
||||||
@ -307,6 +300,7 @@ node $TW5_BUILD_TIDDLYWIKI \
|
|||||||
# /plugins/tiddlywiki/d3/empty.html Empty wiki with D3 plugin
|
# /plugins/tiddlywiki/d3/empty.html Empty wiki with D3 plugin
|
||||||
node $TW5_BUILD_TIDDLYWIKI \
|
node $TW5_BUILD_TIDDLYWIKI \
|
||||||
./editions/d3demo \
|
./editions/d3demo \
|
||||||
|
--verbose \
|
||||||
--load $TW5_BUILD_OUTPUT/build.tid \
|
--load $TW5_BUILD_OUTPUT/build.tid \
|
||||||
--output $TW5_BUILD_OUTPUT \
|
--output $TW5_BUILD_OUTPUT \
|
||||||
--rendertiddler $:/core/save/all plugins/tiddlywiki/d3/index.html text/plain \
|
--rendertiddler $:/core/save/all plugins/tiddlywiki/d3/index.html text/plain \
|
||||||
@ -317,6 +311,7 @@ node $TW5_BUILD_TIDDLYWIKI \
|
|||||||
# /plugins/tiddlywiki/codemirror/empty.html Empty wiki with codemirror plugin
|
# /plugins/tiddlywiki/codemirror/empty.html Empty wiki with codemirror plugin
|
||||||
node $TW5_BUILD_TIDDLYWIKI \
|
node $TW5_BUILD_TIDDLYWIKI \
|
||||||
./editions/codemirrordemo \
|
./editions/codemirrordemo \
|
||||||
|
--verbose \
|
||||||
--load $TW5_BUILD_OUTPUT/build.tid \
|
--load $TW5_BUILD_OUTPUT/build.tid \
|
||||||
--output $TW5_BUILD_OUTPUT \
|
--output $TW5_BUILD_OUTPUT \
|
||||||
--rendertiddler $:/core/save/all plugins/tiddlywiki/codemirror/index.html text/plain \
|
--rendertiddler $:/core/save/all plugins/tiddlywiki/codemirror/index.html text/plain \
|
||||||
@ -327,6 +322,7 @@ node $TW5_BUILD_TIDDLYWIKI \
|
|||||||
# /plugins/tiddlywiki/markdown/empty.html Empty wiki with Markdown plugin
|
# /plugins/tiddlywiki/markdown/empty.html Empty wiki with Markdown plugin
|
||||||
node $TW5_BUILD_TIDDLYWIKI \
|
node $TW5_BUILD_TIDDLYWIKI \
|
||||||
./editions/markdowndemo \
|
./editions/markdowndemo \
|
||||||
|
--verbose \
|
||||||
--load $TW5_BUILD_OUTPUT/build.tid \
|
--load $TW5_BUILD_OUTPUT/build.tid \
|
||||||
--output $TW5_BUILD_OUTPUT \
|
--output $TW5_BUILD_OUTPUT \
|
||||||
--rendertiddler $:/core/save/all plugins/tiddlywiki/markdown/index.html text/plain \
|
--rendertiddler $:/core/save/all plugins/tiddlywiki/markdown/index.html text/plain \
|
||||||
@ -337,6 +333,7 @@ node $TW5_BUILD_TIDDLYWIKI \
|
|||||||
# /plugins/tiddlywiki/tw2parser/empty.html Empty wiki with tw2parser plugin
|
# /plugins/tiddlywiki/tw2parser/empty.html Empty wiki with tw2parser plugin
|
||||||
node $TW5_BUILD_TIDDLYWIKI \
|
node $TW5_BUILD_TIDDLYWIKI \
|
||||||
./editions/classicparserdemo \
|
./editions/classicparserdemo \
|
||||||
|
--verbose \
|
||||||
--load $TW5_BUILD_OUTPUT/build.tid \
|
--load $TW5_BUILD_OUTPUT/build.tid \
|
||||||
--output $TW5_BUILD_OUTPUT \
|
--output $TW5_BUILD_OUTPUT \
|
||||||
--rendertiddler $:/core/save/all plugins/tiddlywiki/tw2parser/index.html text/plain \
|
--rendertiddler $:/core/save/all plugins/tiddlywiki/tw2parser/index.html text/plain \
|
||||||
@ -347,22 +344,13 @@ node $TW5_BUILD_TIDDLYWIKI \
|
|||||||
# /plugins/tiddlywiki/highlight/empty.html Empty wiki with highlight plugin
|
# /plugins/tiddlywiki/highlight/empty.html Empty wiki with highlight plugin
|
||||||
node $TW5_BUILD_TIDDLYWIKI \
|
node $TW5_BUILD_TIDDLYWIKI \
|
||||||
./editions/highlightdemo \
|
./editions/highlightdemo \
|
||||||
|
--verbose \
|
||||||
--load $TW5_BUILD_OUTPUT/build.tid \
|
--load $TW5_BUILD_OUTPUT/build.tid \
|
||||||
--output $TW5_BUILD_OUTPUT \
|
--output $TW5_BUILD_OUTPUT \
|
||||||
--rendertiddler $:/core/save/all plugins/tiddlywiki/highlight/index.html text/plain \
|
--rendertiddler $:/core/save/all plugins/tiddlywiki/highlight/index.html text/plain \
|
||||||
--rendertiddler $:/core/save/empty plugins/tiddlywiki/highlight/empty.html text/plain \
|
--rendertiddler $:/core/save/empty plugins/tiddlywiki/highlight/empty.html text/plain \
|
||||||
|| exit 1
|
|| exit 1
|
||||||
|
|
||||||
# /plugins/tiddlywiki/geospatial/index.html Demo wiki with geospatial plugin
|
|
||||||
# /plugins/tiddlywiki/geospatial/empty.html Empty wiki with geospatial plugin
|
|
||||||
node $TW5_BUILD_TIDDLYWIKI \
|
|
||||||
./editions/geospatialdemo \
|
|
||||||
--load $TW5_BUILD_OUTPUT/build.tid \
|
|
||||||
--output $TW5_BUILD_OUTPUT \
|
|
||||||
--rendertiddler $:/core/save/all plugins/tiddlywiki/geospatial/index.html text/plain \
|
|
||||||
--rendertiddler $:/core/save/empty plugins/tiddlywiki/geospatial/empty.html text/plain \
|
|
||||||
|| exit 1
|
|
||||||
|
|
||||||
######################################################
|
######################################################
|
||||||
#
|
#
|
||||||
# Language editions
|
# Language editions
|
||||||
@ -384,6 +372,7 @@ rm -rf $TW5_BUILD_OUTPUT/languages/zh-Hant/static/*
|
|||||||
# /languages/de-AT/empty.html Empty wiki with de-AT language
|
# /languages/de-AT/empty.html Empty wiki with de-AT language
|
||||||
node $TW5_BUILD_TIDDLYWIKI \
|
node $TW5_BUILD_TIDDLYWIKI \
|
||||||
./editions/de-AT \
|
./editions/de-AT \
|
||||||
|
--verbose \
|
||||||
--load $TW5_BUILD_OUTPUT/build.tid \
|
--load $TW5_BUILD_OUTPUT/build.tid \
|
||||||
--output $TW5_BUILD_OUTPUT/languages/de-AT \
|
--output $TW5_BUILD_OUTPUT/languages/de-AT \
|
||||||
--build favicon empty static index \
|
--build favicon empty static index \
|
||||||
@ -393,6 +382,7 @@ node $TW5_BUILD_TIDDLYWIKI \
|
|||||||
# /languages/de-DE/empty.html Empty wiki with de-DE language
|
# /languages/de-DE/empty.html Empty wiki with de-DE language
|
||||||
node $TW5_BUILD_TIDDLYWIKI \
|
node $TW5_BUILD_TIDDLYWIKI \
|
||||||
./editions/de-DE \
|
./editions/de-DE \
|
||||||
|
--verbose \
|
||||||
--load $TW5_BUILD_OUTPUT/build.tid \
|
--load $TW5_BUILD_OUTPUT/build.tid \
|
||||||
--output $TW5_BUILD_OUTPUT/languages/de-DE \
|
--output $TW5_BUILD_OUTPUT/languages/de-DE \
|
||||||
--build favicon empty static index \
|
--build favicon empty static index \
|
||||||
@ -402,6 +392,7 @@ node $TW5_BUILD_TIDDLYWIKI \
|
|||||||
# /languages/es-ES/empty.html Empty wiki with es-ES language
|
# /languages/es-ES/empty.html Empty wiki with es-ES language
|
||||||
node $TW5_BUILD_TIDDLYWIKI \
|
node $TW5_BUILD_TIDDLYWIKI \
|
||||||
./editions/es-ES \
|
./editions/es-ES \
|
||||||
|
--verbose \
|
||||||
--load $TW5_BUILD_OUTPUT/build.tid \
|
--load $TW5_BUILD_OUTPUT/build.tid \
|
||||||
--output $TW5_BUILD_OUTPUT/languages/es-ES \
|
--output $TW5_BUILD_OUTPUT/languages/es-ES \
|
||||||
--build favicon empty static index \
|
--build favicon empty static index \
|
||||||
@ -411,6 +402,7 @@ node $TW5_BUILD_TIDDLYWIKI \
|
|||||||
# /languages/fr-FR/empty.html Empty wiki with fr-FR language
|
# /languages/fr-FR/empty.html Empty wiki with fr-FR language
|
||||||
node $TW5_BUILD_TIDDLYWIKI \
|
node $TW5_BUILD_TIDDLYWIKI \
|
||||||
./editions/fr-FR \
|
./editions/fr-FR \
|
||||||
|
--verbose \
|
||||||
--load $TW5_BUILD_OUTPUT/build.tid \
|
--load $TW5_BUILD_OUTPUT/build.tid \
|
||||||
--output $TW5_BUILD_OUTPUT/languages/fr-FR \
|
--output $TW5_BUILD_OUTPUT/languages/fr-FR \
|
||||||
--build favicon empty static index \
|
--build favicon empty static index \
|
||||||
@ -420,6 +412,7 @@ node $TW5_BUILD_TIDDLYWIKI \
|
|||||||
# /languages/ja-JP/empty.html Empty wiki with ja-JP language
|
# /languages/ja-JP/empty.html Empty wiki with ja-JP language
|
||||||
node $TW5_BUILD_TIDDLYWIKI \
|
node $TW5_BUILD_TIDDLYWIKI \
|
||||||
./editions/ja-JP \
|
./editions/ja-JP \
|
||||||
|
--verbose \
|
||||||
--load $TW5_BUILD_OUTPUT/build.tid \
|
--load $TW5_BUILD_OUTPUT/build.tid \
|
||||||
--output $TW5_BUILD_OUTPUT/languages/ja-JP \
|
--output $TW5_BUILD_OUTPUT/languages/ja-JP \
|
||||||
--build empty index \
|
--build empty index \
|
||||||
@ -429,6 +422,7 @@ node $TW5_BUILD_TIDDLYWIKI \
|
|||||||
# /languages/ko-KR/empty.html Empty wiki with ko-KR language
|
# /languages/ko-KR/empty.html Empty wiki with ko-KR language
|
||||||
node $TW5_BUILD_TIDDLYWIKI \
|
node $TW5_BUILD_TIDDLYWIKI \
|
||||||
./editions/ko-KR \
|
./editions/ko-KR \
|
||||||
|
--verbose \
|
||||||
--load $TW5_BUILD_OUTPUT/build.tid \
|
--load $TW5_BUILD_OUTPUT/build.tid \
|
||||||
--output $TW5_BUILD_OUTPUT/languages/ko-KR \
|
--output $TW5_BUILD_OUTPUT/languages/ko-KR \
|
||||||
--build favicon empty static index \
|
--build favicon empty static index \
|
||||||
@ -438,6 +432,7 @@ node $TW5_BUILD_TIDDLYWIKI \
|
|||||||
# /languages/zh-Hans/empty.html Empty wiki with zh-Hans language
|
# /languages/zh-Hans/empty.html Empty wiki with zh-Hans language
|
||||||
node $TW5_BUILD_TIDDLYWIKI \
|
node $TW5_BUILD_TIDDLYWIKI \
|
||||||
./editions/zh-Hans \
|
./editions/zh-Hans \
|
||||||
|
--verbose \
|
||||||
--load $TW5_BUILD_OUTPUT/build.tid \
|
--load $TW5_BUILD_OUTPUT/build.tid \
|
||||||
--output $TW5_BUILD_OUTPUT/languages/zh-Hans \
|
--output $TW5_BUILD_OUTPUT/languages/zh-Hans \
|
||||||
--build empty index \
|
--build empty index \
|
||||||
@ -447,6 +442,7 @@ node $TW5_BUILD_TIDDLYWIKI \
|
|||||||
# /languages/zh-Hant/empty.html Empty wiki with zh-Hant language
|
# /languages/zh-Hant/empty.html Empty wiki with zh-Hant language
|
||||||
node $TW5_BUILD_TIDDLYWIKI \
|
node $TW5_BUILD_TIDDLYWIKI \
|
||||||
./editions/zh-Hant \
|
./editions/zh-Hant \
|
||||||
|
--verbose \
|
||||||
--load $TW5_BUILD_OUTPUT/build.tid \
|
--load $TW5_BUILD_OUTPUT/build.tid \
|
||||||
--output $TW5_BUILD_OUTPUT/languages/zh-Hant \
|
--output $TW5_BUILD_OUTPUT/languages/zh-Hant \
|
||||||
--build empty index \
|
--build empty index \
|
||||||
@ -460,6 +456,7 @@ node $TW5_BUILD_TIDDLYWIKI \
|
|||||||
|
|
||||||
node $TW5_BUILD_TIDDLYWIKI \
|
node $TW5_BUILD_TIDDLYWIKI \
|
||||||
./editions/pluginlibrary \
|
./editions/pluginlibrary \
|
||||||
|
--verbose \
|
||||||
--load $TW5_BUILD_OUTPUT/build.tid \
|
--load $TW5_BUILD_OUTPUT/build.tid \
|
||||||
--output $TW5_BUILD_OUTPUT/library/$TW5_BUILD_VERSION \
|
--output $TW5_BUILD_OUTPUT/library/$TW5_BUILD_VERSION \
|
||||||
--build library\
|
--build library\
|
||||||
|
@ -7,4 +7,4 @@ npm --force install tiddlywiki || exit 1
|
|||||||
|
|
||||||
# Pull existing GitHub pages content
|
# Pull existing GitHub pages content
|
||||||
|
|
||||||
git clone --depth=1 --branch=master "https://github.com/TiddlyWiki/tiddlywiki.com-gh-pages.git" output
|
git clone --depth=1 --branch=master "https://github.com/Jermolene/jermolene.github.io.git" output
|
||||||
|
@ -10,6 +10,6 @@ git config --global user.email "actions@github.com"
|
|||||||
git config --global user.name "GitHub Actions"
|
git config --global user.name "GitHub Actions"
|
||||||
git add -A .
|
git add -A .
|
||||||
git commit --message "GitHub build: $GITHUB_RUN_NUMBER of $TW5_BUILD_BRANCH ($(date +'%F %T %Z'))"
|
git commit --message "GitHub build: $GITHUB_RUN_NUMBER of $TW5_BUILD_BRANCH ($(date +'%F %T %Z'))"
|
||||||
git remote add deploy "https://$GH_TOKEN@github.com/TiddlyWiki/tiddlywiki.com-gh-pages.git" &>/dev/null
|
git remote add deploy "https://$GH_TOKEN@github.com/Jermolene/jermolene.github.io.git" &>/dev/null
|
||||||
git push deploy master &>/dev/null
|
git push deploy master &>/dev/null
|
||||||
cd ..
|
cd ..
|
||||||
|
@ -1,16 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# test TiddlyWiki5 for tiddlywiki.com
|
|
||||||
|
|
||||||
node ./tiddlywiki.js \
|
|
||||||
./editions/test \
|
|
||||||
--verbose \
|
|
||||||
--version \
|
|
||||||
--rendertiddler $:/core/save/all test.html text/plain \
|
|
||||||
--test \
|
|
||||||
|| exit 1
|
|
||||||
|
|
||||||
npm install playwright @playwright/test
|
|
||||||
npx playwright install chromium firefox --with-deps
|
|
||||||
|
|
||||||
npx playwright test
|
|
@ -15,11 +15,3 @@ node $TW5_BUILD_TIDDLYWIKI \
|
|||||||
--output . \
|
--output . \
|
||||||
--build readmes \
|
--build readmes \
|
||||||
|| exit 1
|
|| exit 1
|
||||||
|
|
||||||
# tw.org readmes
|
|
||||||
node $TW5_BUILD_TIDDLYWIKI \
|
|
||||||
editions/tw.org \
|
|
||||||
--verbose \
|
|
||||||
--output . \
|
|
||||||
--build readmes \
|
|
||||||
|| exit 1
|
|
||||||
|
116
boot/boot.js
116
boot/boot.js
@ -142,15 +142,15 @@ $tw.utils.each = function(object,callback) {
|
|||||||
var next,f,length;
|
var next,f,length;
|
||||||
if(object) {
|
if(object) {
|
||||||
if(Object.prototype.toString.call(object) == "[object Array]") {
|
if(Object.prototype.toString.call(object) == "[object Array]") {
|
||||||
for(f=0, length=object.length; f<length; f++) {
|
for (f=0, length=object.length; f<length; f++) {
|
||||||
next = callback(object[f],f,object);
|
next = callback(object[f],f,object);
|
||||||
if(next === false) {
|
if(next === false) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
var keys = Object.keys(object);
|
var keys = Object.keys(object);
|
||||||
for(f=0, length=keys.length; f<length; f++) {
|
for (f=0, length=keys.length; f<length; f++) {
|
||||||
var key = keys[f];
|
var key = keys[f];
|
||||||
next = callback(object[key],key,object);
|
next = callback(object[key],key,object);
|
||||||
if(next === false) {
|
if(next === false) {
|
||||||
@ -177,7 +177,6 @@ document: defaults to current document
|
|||||||
eventListeners: array of event listeners (this option won't work until $tw.utils.addEventListeners() has been loaded)
|
eventListeners: array of event listeners (this option won't work until $tw.utils.addEventListeners() has been loaded)
|
||||||
*/
|
*/
|
||||||
$tw.utils.domMaker = function(tag,options) {
|
$tw.utils.domMaker = function(tag,options) {
|
||||||
var options = options || {};
|
|
||||||
var doc = options.document || document;
|
var doc = options.document || document;
|
||||||
var element = doc.createElementNS(options.namespace || "http://www.w3.org/1999/xhtml",tag);
|
var element = doc.createElementNS(options.namespace || "http://www.w3.org/1999/xhtml",tag);
|
||||||
if(options["class"]) {
|
if(options["class"]) {
|
||||||
@ -219,34 +218,9 @@ $tw.utils.error = function(err) {
|
|||||||
heading = dm("h1",{text: errHeading}),
|
heading = dm("h1",{text: errHeading}),
|
||||||
prompt = dm("div",{text: promptMsg, "class": "tc-error-prompt"}),
|
prompt = dm("div",{text: promptMsg, "class": "tc-error-prompt"}),
|
||||||
message = dm("div",{text: err, "class":"tc-error-message"}),
|
message = dm("div",{text: err, "class":"tc-error-message"}),
|
||||||
closeButton = dm("div",{children: [dm("button",{text: ( $tw.language == undefined ? "close" : $tw.language.getString("Buttons/Close/Caption") )})], "class": "tc-error-prompt"}),
|
button = dm("div",{children: [dm("button",{text: ( $tw.language == undefined ? "close" : $tw.language.getString("Buttons/Close/Caption") )})], "class": "tc-error-prompt"}),
|
||||||
downloadButton = dm("div",{children: [dm("button",{text: ( $tw.language == undefined ? "download tiddlers" : $tw.language.getString("Buttons/EmergencyDownload/Caption") )})], "class": "tc-error-prompt"}),
|
form = dm("form",{children: [heading,prompt,message,button], "class": "tc-error-form"});
|
||||||
form = dm("form",{children: [heading,prompt,downloadButton,message,closeButton], "class": "tc-error-form"});
|
|
||||||
document.body.insertBefore(form,document.body.firstChild);
|
document.body.insertBefore(form,document.body.firstChild);
|
||||||
downloadButton.addEventListener("click",function(event) {
|
|
||||||
if($tw && $tw.wiki) {
|
|
||||||
var tiddlers = [];
|
|
||||||
$tw.wiki.each(function(tiddler,title) {
|
|
||||||
tiddlers.push(tiddler.fields);
|
|
||||||
});
|
|
||||||
var link = dm("a"),
|
|
||||||
text = JSON.stringify(tiddlers);
|
|
||||||
if(Blob !== undefined) {
|
|
||||||
var blob = new Blob([text], {type: "text/html"});
|
|
||||||
link.setAttribute("href", URL.createObjectURL(blob));
|
|
||||||
} else {
|
|
||||||
link.setAttribute("href","data:text/html," + encodeURIComponent(text));
|
|
||||||
}
|
|
||||||
link.setAttribute("download","emergency-tiddlers-" + (new Date()) + ".json");
|
|
||||||
document.body.appendChild(link);
|
|
||||||
link.click();
|
|
||||||
document.body.removeChild(link);
|
|
||||||
} else {
|
|
||||||
alert("Emergency tiddler download is not available");
|
|
||||||
}
|
|
||||||
event.preventDefault();
|
|
||||||
return false;
|
|
||||||
},true);
|
|
||||||
form.addEventListener("submit",function(event) {
|
form.addEventListener("submit",function(event) {
|
||||||
document.body.removeChild(form);
|
document.body.removeChild(form);
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
@ -275,7 +249,7 @@ Extend an object with the properties from a list of source objects
|
|||||||
$tw.utils.extend = function(object /*, sourceObjectList */) {
|
$tw.utils.extend = function(object /*, sourceObjectList */) {
|
||||||
$tw.utils.each(Array.prototype.slice.call(arguments,1),function(source) {
|
$tw.utils.each(Array.prototype.slice.call(arguments,1),function(source) {
|
||||||
if(source) {
|
if(source) {
|
||||||
for(var p in source) {
|
for (var p in source) {
|
||||||
object[p] = source[p];
|
object[p] = source[p];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -289,7 +263,7 @@ Fill in any null or undefined properties of an object with the properties from a
|
|||||||
$tw.utils.deepDefaults = function(object /*, sourceObjectList */) {
|
$tw.utils.deepDefaults = function(object /*, sourceObjectList */) {
|
||||||
$tw.utils.each(Array.prototype.slice.call(arguments,1),function(source) {
|
$tw.utils.each(Array.prototype.slice.call(arguments,1),function(source) {
|
||||||
if(source) {
|
if(source) {
|
||||||
for(var p in source) {
|
for (var p in source) {
|
||||||
if(object[p] === null || object[p] === undefined) {
|
if(object[p] === null || object[p] === undefined) {
|
||||||
object[p] = source[p];
|
object[p] = source[p];
|
||||||
}
|
}
|
||||||
@ -386,8 +360,8 @@ $tw.utils.parseDate = function(value) {
|
|||||||
parseInt(value.substr(10,2)||"00",10),
|
parseInt(value.substr(10,2)||"00",10),
|
||||||
parseInt(value.substr(12,2)||"00",10),
|
parseInt(value.substr(12,2)||"00",10),
|
||||||
parseInt(value.substr(14,3)||"000",10)));
|
parseInt(value.substr(14,3)||"000",10)));
|
||||||
d.setUTCFullYear(year); // See https://stackoverflow.com/a/5870822
|
d.setUTCFullYear(year); // See https://stackoverflow.com/a/5870822
|
||||||
return d;
|
return d;
|
||||||
} else if($tw.utils.isDate(value)) {
|
} else if($tw.utils.isDate(value)) {
|
||||||
return value;
|
return value;
|
||||||
} else {
|
} else {
|
||||||
@ -601,8 +575,9 @@ var globalCheck =[
|
|||||||
" configurable: true",
|
" configurable: true",
|
||||||
" });",
|
" });",
|
||||||
" if(Object.keys(__temp__).length){",
|
" if(Object.keys(__temp__).length){",
|
||||||
" console.log(\"Warning: Global assignment detected\",Object.keys(__temp__));",
|
" console.log(Object.keys(__temp__));",
|
||||||
" delete Object.prototype.__temp__;",
|
" delete Object.prototype.__temp__;",
|
||||||
|
" throw \"Global assignment is not allowed within modules on node.\";",
|
||||||
" }",
|
" }",
|
||||||
" delete Object.prototype.__temp__;",
|
" delete Object.prototype.__temp__;",
|
||||||
].join('\n');
|
].join('\n');
|
||||||
@ -621,11 +596,11 @@ $tw.utils.evalGlobal = function(code,context,filename,sandbox,allowGlobals) {
|
|||||||
// Add the code prologue and epilogue
|
// Add the code prologue and epilogue
|
||||||
code = [
|
code = [
|
||||||
"(function(" + contextNames.join(",") + ") {",
|
"(function(" + contextNames.join(",") + ") {",
|
||||||
" (function(){" + code + "\n;})();\n",
|
" (function(){\n" + code + "\n;})();",
|
||||||
(!$tw.browser && sandbox && !allowGlobals) ? globalCheck : "",
|
(!$tw.browser && sandbox && !allowGlobals) ? globalCheck : "",
|
||||||
"\nreturn exports;\n",
|
" return exports;\n",
|
||||||
"})"
|
"})"
|
||||||
].join("");
|
].join("\n");
|
||||||
|
|
||||||
// Compile the code into a function
|
// Compile the code into a function
|
||||||
var fn;
|
var fn;
|
||||||
@ -812,7 +787,6 @@ $tw.utils.Crypto = function() {
|
|||||||
}
|
}
|
||||||
return outputText;
|
return outputText;
|
||||||
};
|
};
|
||||||
$tw.sjcl = sjcl;
|
|
||||||
this.setPassword = function(newPassword) {
|
this.setPassword = function(newPassword) {
|
||||||
currentPassword = newPassword;
|
currentPassword = newPassword;
|
||||||
this.updateCryptoStateTiddler();
|
this.updateCryptoStateTiddler();
|
||||||
@ -893,8 +867,8 @@ $tw.modules.execute = function(moduleName,moduleRoot) {
|
|||||||
} else {
|
} else {
|
||||||
/*
|
/*
|
||||||
CommonJS optional require.main property:
|
CommonJS optional require.main property:
|
||||||
In a browser we offer a fake main module which points back to the boot function
|
In a browser we offer a fake main module which points back to the boot function
|
||||||
(Theoretically, this may allow TW to eventually load itself as a module in the browser)
|
(Theoretically, this may allow TW to eventually load itself as a module in the browser)
|
||||||
*/
|
*/
|
||||||
Object.defineProperty(sandbox.require, "main", {
|
Object.defineProperty(sandbox.require, "main", {
|
||||||
value: (typeof(require) !== "undefined") ? require.main : {TiddlyWiki: _boot},
|
value: (typeof(require) !== "undefined") ? require.main : {TiddlyWiki: _boot},
|
||||||
@ -936,9 +910,9 @@ $tw.modules.execute = function(moduleName,moduleRoot) {
|
|||||||
moduleInfo.exports = moduleInfo.definition;
|
moduleInfo.exports = moduleInfo.definition;
|
||||||
}
|
}
|
||||||
} catch(e) {
|
} catch(e) {
|
||||||
if(e instanceof SyntaxError) {
|
if (e instanceof SyntaxError) {
|
||||||
var line = e.lineNumber || e.line; // Firefox || Safari
|
var line = e.lineNumber || e.line; // Firefox || Safari
|
||||||
if(typeof(line) != "undefined" && line !== null) {
|
if (typeof(line) != "undefined" && line !== null) {
|
||||||
$tw.utils.error("Syntax error in boot module " + name + ":" + line + ":\n" + e.stack);
|
$tw.utils.error("Syntax error in boot module " + name + ":" + line + ":\n" + e.stack);
|
||||||
} else if(!$tw.browser) {
|
} else if(!$tw.browser) {
|
||||||
// this is the only way to get node.js to display the line at which the syntax error appeared,
|
// this is the only way to get node.js to display the line at which the syntax error appeared,
|
||||||
@ -952,7 +926,7 @@ $tw.modules.execute = function(moduleName,moduleRoot) {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// line number should be included in e.stack for runtime errors
|
// line number should be included in e.stack for runtime errors
|
||||||
$tw.utils.error("Error executing boot module " + name + ": " + String(e) + "\n\n" + e.stack);
|
$tw.utils.error("Error executing boot module " + name + ": " + JSON.stringify(e) + "\n\n" + e.stack);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1176,7 +1150,7 @@ $tw.Wiki = function(options) {
|
|||||||
shadowTiddlerTitles = null,
|
shadowTiddlerTitles = null,
|
||||||
getShadowTiddlerTitles = function() {
|
getShadowTiddlerTitles = function() {
|
||||||
if(!shadowTiddlerTitles) {
|
if(!shadowTiddlerTitles) {
|
||||||
shadowTiddlerTitles = Object.keys(shadowTiddlers).sort(function(a,b) {return a.localeCompare(b);});
|
shadowTiddlerTitles = Object.keys(shadowTiddlers);
|
||||||
}
|
}
|
||||||
return shadowTiddlerTitles;
|
return shadowTiddlerTitles;
|
||||||
},
|
},
|
||||||
@ -1533,7 +1507,7 @@ Define all modules stored in ordinary tiddlers
|
|||||||
$tw.Wiki.prototype.defineTiddlerModules = function() {
|
$tw.Wiki.prototype.defineTiddlerModules = function() {
|
||||||
this.each(function(tiddler,title) {
|
this.each(function(tiddler,title) {
|
||||||
if(tiddler.hasField("module-type")) {
|
if(tiddler.hasField("module-type")) {
|
||||||
switch(tiddler.fields.type) {
|
switch (tiddler.fields.type) {
|
||||||
case "application/javascript":
|
case "application/javascript":
|
||||||
// We only define modules that haven't already been defined, because in the browser modules in system tiddlers are defined in inline script
|
// We only define modules that haven't already been defined, because in the browser modules in system tiddlers are defined in inline script
|
||||||
if(!$tw.utils.hop($tw.modules.titles,tiddler.fields.title)) {
|
if(!$tw.utils.hop($tw.modules.titles,tiddler.fields.title)) {
|
||||||
@ -1994,10 +1968,10 @@ $tw.loadTiddlersFromSpecification = function(filepath,excludeRegExp) {
|
|||||||
var value = tiddler[name];
|
var value = tiddler[name];
|
||||||
switch(fieldInfo.source) {
|
switch(fieldInfo.source) {
|
||||||
case "subdirectories":
|
case "subdirectories":
|
||||||
value = path.relative(rootPath, filename).split(path.sep).slice(0, -1);
|
value = path.relative(rootPath, filename).split('/').slice(0, -1);
|
||||||
break;
|
break;
|
||||||
case "filepath":
|
case "filepath":
|
||||||
value = path.relative(rootPath, filename).split(path.sep).join('/');
|
value = path.relative(rootPath, filename);
|
||||||
break;
|
break;
|
||||||
case "filename":
|
case "filename":
|
||||||
value = path.basename(filename);
|
value = path.basename(filename);
|
||||||
@ -2043,7 +2017,7 @@ $tw.loadTiddlersFromSpecification = function(filepath,excludeRegExp) {
|
|||||||
arrayOfFiles = arrayOfFiles || [];
|
arrayOfFiles = arrayOfFiles || [];
|
||||||
var files = fs.readdirSync(dirPath);
|
var files = fs.readdirSync(dirPath);
|
||||||
files.forEach(function(file) {
|
files.forEach(function(file) {
|
||||||
if(recurse && fs.statSync(dirPath + path.sep + file).isDirectory()) {
|
if (recurse && fs.statSync(dirPath + path.sep + file).isDirectory()) {
|
||||||
arrayOfFiles = getAllFiles(dirPath + path.sep + file, recurse, arrayOfFiles);
|
arrayOfFiles = getAllFiles(dirPath + path.sep + file, recurse, arrayOfFiles);
|
||||||
} else if(fs.statSync(dirPath + path.sep + file).isFile()){
|
} else if(fs.statSync(dirPath + path.sep + file).isFile()){
|
||||||
arrayOfFiles.push(path.join(dirPath, path.sep, file));
|
arrayOfFiles.push(path.join(dirPath, path.sep, file));
|
||||||
@ -2188,16 +2162,13 @@ Returns an array of search paths
|
|||||||
*/
|
*/
|
||||||
$tw.getLibraryItemSearchPaths = function(libraryPath,envVar) {
|
$tw.getLibraryItemSearchPaths = function(libraryPath,envVar) {
|
||||||
var pluginPaths = [path.resolve($tw.boot.corePath,libraryPath)],
|
var pluginPaths = [path.resolve($tw.boot.corePath,libraryPath)],
|
||||||
env;
|
|
||||||
if(envVar) {
|
|
||||||
env = process.env[envVar];
|
env = process.env[envVar];
|
||||||
if(env) {
|
if(env) {
|
||||||
env.split(path.delimiter).map(function(item) {
|
env.split(path.delimiter).map(function(item) {
|
||||||
if(item) {
|
if(item) {
|
||||||
pluginPaths.push(item);
|
pluginPaths.push(item);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return pluginPaths;
|
return pluginPaths;
|
||||||
};
|
};
|
||||||
@ -2283,7 +2254,7 @@ $tw.loadWikiTiddlers = function(wikiPath,options) {
|
|||||||
}
|
}
|
||||||
$tw.wiki.addTiddlers(tiddlerFile.tiddlers);
|
$tw.wiki.addTiddlers(tiddlerFile.tiddlers);
|
||||||
});
|
});
|
||||||
if($tw.boot.wikiPath == wikiPath) {
|
if ($tw.boot.wikiPath == wikiPath) {
|
||||||
// Save the original tiddler file locations if requested
|
// Save the original tiddler file locations if requested
|
||||||
var output = {}, relativePath, fileInfo;
|
var output = {}, relativePath, fileInfo;
|
||||||
for(var title in $tw.boot.files) {
|
for(var title in $tw.boot.files) {
|
||||||
@ -2468,7 +2439,6 @@ $tw.boot.initStartup = function(options) {
|
|||||||
$tw.utils.registerFileType("image/svg+xml","utf8",".svg",{flags:["image"]});
|
$tw.utils.registerFileType("image/svg+xml","utf8",".svg",{flags:["image"]});
|
||||||
$tw.utils.registerFileType("image/vnd.microsoft.icon","base64",".ico",{flags:["image"]});
|
$tw.utils.registerFileType("image/vnd.microsoft.icon","base64",".ico",{flags:["image"]});
|
||||||
$tw.utils.registerFileType("image/x-icon","base64",".ico",{flags:["image"]});
|
$tw.utils.registerFileType("image/x-icon","base64",".ico",{flags:["image"]});
|
||||||
$tw.utils.registerFileType("application/wasm","base64",".wasm");
|
|
||||||
$tw.utils.registerFileType("application/font-woff","base64",".woff");
|
$tw.utils.registerFileType("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");
|
||||||
@ -2483,12 +2453,8 @@ $tw.boot.initStartup = function(options) {
|
|||||||
$tw.utils.registerFileType("text/x-markdown","utf8",[".md",".markdown"]);
|
$tw.utils.registerFileType("text/x-markdown","utf8",[".md",".markdown"]);
|
||||||
$tw.utils.registerFileType("application/enex+xml","utf8",".enex");
|
$tw.utils.registerFileType("application/enex+xml","utf8",".enex");
|
||||||
$tw.utils.registerFileType("application/vnd.openxmlformats-officedocument.wordprocessingml.document","base64",".docx");
|
$tw.utils.registerFileType("application/vnd.openxmlformats-officedocument.wordprocessingml.document","base64",".docx");
|
||||||
$tw.utils.registerFileType("application/msword","base64",".doc");
|
|
||||||
$tw.utils.registerFileType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","base64",".xlsx");
|
$tw.utils.registerFileType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","base64",".xlsx");
|
||||||
$tw.utils.registerFileType("application/excel","base64",".xls");
|
|
||||||
$tw.utils.registerFileType("application/vnd.ms-excel","base64",".xls");
|
|
||||||
$tw.utils.registerFileType("application/vnd.openxmlformats-officedocument.presentationml.presentation","base64",".pptx");
|
$tw.utils.registerFileType("application/vnd.openxmlformats-officedocument.presentationml.presentation","base64",".pptx");
|
||||||
$tw.utils.registerFileType("application/mspowerpoint","base64",".ppt");
|
|
||||||
$tw.utils.registerFileType("text/x-bibtex","utf8",".bib",{deserializerType:"application/x-bibtex"});
|
$tw.utils.registerFileType("text/x-bibtex","utf8",".bib",{deserializerType:"application/x-bibtex"});
|
||||||
$tw.utils.registerFileType("application/x-bibtex","utf8",".bib");
|
$tw.utils.registerFileType("application/x-bibtex","utf8",".bib");
|
||||||
$tw.utils.registerFileType("application/epub+zip","base64",".epub");
|
$tw.utils.registerFileType("application/epub+zip","base64",".epub");
|
||||||
@ -2637,14 +2603,14 @@ $tw.boot.doesTaskMatchPlatform = function(taskModule) {
|
|||||||
var platforms = taskModule.platforms;
|
var platforms = taskModule.platforms;
|
||||||
if(platforms) {
|
if(platforms) {
|
||||||
for(var t=0; t<platforms.length; t++) {
|
for(var t=0; t<platforms.length; t++) {
|
||||||
switch(platforms[t]) {
|
switch (platforms[t]) {
|
||||||
case "browser":
|
case "browser":
|
||||||
if($tw.browser) {
|
if ($tw.browser) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case "node":
|
case "node":
|
||||||
if($tw.node) {
|
if ($tw.node) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -2709,25 +2675,13 @@ $tw.hooks.addHook = function(hookName,definition) {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
|
||||||
Delete hooks from the hashmap
|
|
||||||
*/
|
|
||||||
$tw.hooks.removeHook = function(hookName,definition) {
|
|
||||||
if($tw.utils.hop($tw.hooks.names,hookName)) {
|
|
||||||
var p = $tw.hooks.names[hookName].indexOf(definition);
|
|
||||||
if(p !== -1) {
|
|
||||||
$tw.hooks.names[hookName].splice(p, 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Invoke the hook by key
|
Invoke the hook by key
|
||||||
*/
|
*/
|
||||||
$tw.hooks.invokeHook = function(hookName /*, value,... */) {
|
$tw.hooks.invokeHook = function(hookName /*, value,... */) {
|
||||||
var args = Array.prototype.slice.call(arguments,1);
|
var args = Array.prototype.slice.call(arguments,1);
|
||||||
if($tw.utils.hop($tw.hooks.names,hookName)) {
|
if($tw.utils.hop($tw.hooks.names,hookName)) {
|
||||||
for(var i = 0; i < $tw.hooks.names[hookName].length; i++) {
|
for (var i = 0; i < $tw.hooks.names[hookName].length; i++) {
|
||||||
args[0] = $tw.hooks.names[hookName][i].apply(null,args);
|
args[0] = $tw.hooks.names[hookName][i].apply(null,args);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -21,7 +21,7 @@ $tw.boot = $tw.boot || Object.create(null);
|
|||||||
|
|
||||||
// Detect platforms
|
// Detect platforms
|
||||||
if(!("browser" in $tw)) {
|
if(!("browser" in $tw)) {
|
||||||
$tw.browser = typeof(window) !== "undefined" && typeof(document) !== "undefined" ? {} : null;
|
$tw.browser = typeof(window) !== "undefined" ? {} : null;
|
||||||
}
|
}
|
||||||
if(!("node" in $tw)) {
|
if(!("node" in $tw)) {
|
||||||
$tw.node = typeof(process) === "object" ? {} : null;
|
$tw.node = typeof(process) === "object" ? {} : null;
|
||||||
|
3
boot/sjcl.js.meta
Normal file
3
boot/sjcl.js.meta
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
title: $:/library/sjcl.js
|
||||||
|
type: application/javascript
|
||||||
|
library: yes
|
@ -1,32 +0,0 @@
|
|||||||
{
|
|
||||||
"tiddlers": [
|
|
||||||
{
|
|
||||||
"file": "sjcl.js",
|
|
||||||
"fields": {
|
|
||||||
"title": "$:/library/sjcl.js",
|
|
||||||
"type": "application/javascript",
|
|
||||||
"library": "yes"
|
|
||||||
},
|
|
||||||
"prefix": "(function(define) {\n",
|
|
||||||
"suffix": "\n})(function (_,defined){window.sjcl = defined()})\n"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"file": "boot.js",
|
|
||||||
"fields": {
|
|
||||||
"title": "$:/boot/boot.js",
|
|
||||||
"type": "application/javascript"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"file": "bootprefix.js",
|
|
||||||
"fields": {
|
|
||||||
"title": "$:/boot/bootprefix.js",
|
|
||||||
"type": "application/javascript"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"file": "boot.css.tid",
|
|
||||||
"isTiddlerFile": true
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
@ -1 +0,0 @@
|
|||||||
<p>This community exists because TiddlyWiki is more useful when people share and work together.</p><p>This community is a beautiful but fragile thing: a collection of diverse people from all over the planet, united in their interest in the project, and their commitment to helping one another achieve and learn more.</p><p>We try to make the community as broad and welcoming as possible by remembering some basic principles of culture and behaviour.</p><p>These principles guide technical and non-technical decisions, and help contributors and leaders support our project and community.</p><ul><li>We are optimistic and hopeful</li><li>We aim to foster a learning environment that is collaborative and safe for everyone</li><li>We recognise that the motivation for sharing and helping is usually for appreciation, and not financial gain, and so we take care to acknowledge and <strong>thank the people who enrich the community by sharing what they have created</strong></li><li>While we are united in our interest in TiddlyWiki, we differ in every other conceivable way. We choose to focus on what unites us, and <strong>avoid unnecessarily mixing contentious topics like religion and politics</strong></li><li>We treat each other with respect, and start with the assumption that <strong>others are acting in good faith</strong></li><li>We avoid discriminatory language</li><li>We try to use our strength as a community to help others</li><li>We avoid responding when angry or upset because we try to de-escalate conflict</li><li>We make sure we critique ideas, not people</li><li>When we disagree with others we do so graciously, and treat others with dignity and respoect</li><li>We do not tolerate intolerance towards others</li><li>We seek first to understand others, and then to be understood</li><li>We have fun</li></ul><p>Our discussions are in English. It is not the first language of many people in the community, nor do we all share the same cultural background and reference points. So we take care to use language that is clear and unambigous, and avoid cultural references or jokes that will not be widely understood.</p><p>It is not acceptable to make jokes or other comments that discriminate by race, gender, sexuality, or other protected characteristic.</p><p>As an inclusive community, we are committed to making sure that TiddlyWiki is an accessible tool that understands the needs of people with disabilities.</p>
|
|
File diff suppressed because one or more lines are too long
@ -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-2024, UnaMesa Association
|
Copyright (c) 2007-2023, UnaMesa Association
|
||||||
All rights reserved.
|
All rights reserved.
|
||||||
|
|
||||||
Redistribution and use in source and binary forms, with or without
|
Redistribution and use in source and binary forms, with or without
|
||||||
|
@ -1,5 +0,0 @@
|
|||||||
title: $:/core/images/discord
|
|
||||||
tags: $:/tags/Image
|
|
||||||
|
|
||||||
\parameters (size:"22pt")
|
|
||||||
<svg width=<<size>> height=<<size>> class="tc-image-discord tc-image-button" viewBox="0 -28.5 256 256"><path d="M216.856 16.597A208.502 208.502 0 0 0 164.042 0c-2.275 4.113-4.933 9.645-6.766 14.046-19.692-2.961-39.203-2.961-58.533 0-1.832-4.4-4.55-9.933-6.846-14.046a207.809 207.809 0 0 0-52.855 16.638C5.618 67.147-3.443 116.4 1.087 164.956c22.169 16.555 43.653 26.612 64.775 33.193A161.094 161.094 0 0 0 79.735 175.3a136.413 136.413 0 0 1-21.846-10.632 108.636 108.636 0 0 0 5.356-4.237c42.122 19.702 87.89 19.702 129.51 0a131.66 131.66 0 0 0 5.355 4.237 136.07 136.07 0 0 1-21.886 10.653c4.006 8.02 8.638 15.67 13.873 22.848 21.142-6.58 42.646-16.637 64.815-33.213 5.316-56.288-9.08-105.09-38.056-148.36ZM85.474 135.095c-12.645 0-23.015-11.805-23.015-26.18s10.149-26.2 23.015-26.2c12.867 0 23.236 11.804 23.015 26.2.02 14.375-10.148 26.18-23.015 26.18Zm85.051 0c-12.645 0-23.014-11.805-23.014-26.18s10.148-26.2 23.014-26.2c12.867 0 23.236 11.804 23.015 26.2 0 14.375-10.148 26.18-23.015 26.18Z"/></svg>
|
|
@ -1,5 +0,0 @@
|
|||||||
title: $:/core/images/input-button
|
|
||||||
tags: $:/tags/Image
|
|
||||||
|
|
||||||
\parameters (size:"22pt")
|
|
||||||
<svg width=<<size>> height=<<size>> class="tc-image-input-button tc-image-button" viewBox="0 0 22 22"><path d="M1.375 22h19.249c.365 0 .716-.145.973-.404v.001c.258-.257.404-.607.403-.972v-11a1.376 1.376 0 0 0-2.75 0v9.625H2.75V9.625a1.376 1.376 0 0 0-2.75 0v11C0 21.384.617 22 1.375 22Z"/><path d="m9.732 11.904-1.541-1.541a1.375 1.375 0 1 0-1.944 1.944l3.887 3.888c.258.258.608.402.973.402h-.001c.353 0 .705-.134.974-.402l3.888-3.889a1.376 1.376 0 0 0 .001-1.944 1.377 1.377 0 0 0-1.946 0l-1.541 1.542V1.376a1.375 1.375 0 1 0-2.75 0v10.528Z"/></svg>
|
|
@ -1,4 +1,6 @@
|
|||||||
title: $:/core/images/new-journal-button
|
title: $:/core/images/new-journal-button
|
||||||
tags: $:/tags/Image
|
tags: $:/tags/Image
|
||||||
|
|
||||||
<$parameters size="22pt" day=<<now "DD">>><svg width=<<size>> height=<<size>> class="tc-image-new-journal-button tc-image-button" viewBox="0 0 128 128"><g fill-rule="evenodd"><path d="M102.545 112.818v11.818c0 1.306 1.086 2.364 2.425 2.364h6.06c1.34 0 2.425-1.058 2.425-2.364v-11.818h12.12c1.34 0 2.425-1.058 2.425-2.363v-5.91c0-1.305-1.085-2.363-2.424-2.363h-12.121V90.364c0-1.306-1.086-2.364-2.425-2.364h-6.06c-1.34 0-2.425 1.058-2.425 2.364v11.818h-12.12c-1.34 0-2.425 1.058-2.425 2.363v5.91c0 1.305 1.085 2.363 2.424 2.363h12.121zM60.016 4.965c-4.781-2.76-10.897-1.118-13.656 3.66L5.553 79.305A9.993 9.993 0 009.21 92.963l51.04 29.468c4.78 2.76 10.897 1.118 13.655-3.66l40.808-70.681a9.993 9.993 0 00-3.658-13.656L60.016 4.965zm-3.567 27.963a6 6 0 106-10.393 6 6 0 00-6 10.393zm31.697 17.928a6 6 0 106-10.392 6 6 0 00-6 10.392z"/><text class="tc-fill-background" font-family="Helvetica" font-size="47.172" font-weight="bold" transform="rotate(30 25.742 95.82)"><tspan x="42" y="77.485" text-anchor="middle"><$text text=<<day>>/></tspan></text></g></svg></$parameters>
|
<$parameters size="22pt" day=<<now "DD">>>
|
||||||
|
<svg width=<<size>> height=<<size>> class="tc-image-new-journal-button tc-image-button" viewBox="0 0 128 128"><g fill-rule="evenodd"><path d="M102.545 112.818v11.818c0 1.306 1.086 2.364 2.425 2.364h6.06c1.34 0 2.425-1.058 2.425-2.364v-11.818h12.12c1.34 0 2.425-1.058 2.425-2.363v-5.91c0-1.305-1.085-2.363-2.424-2.363h-12.121V90.364c0-1.306-1.086-2.364-2.425-2.364h-6.06c-1.34 0-2.425 1.058-2.425 2.364v11.818h-12.12c-1.34 0-2.425 1.058-2.425 2.363v5.91c0 1.305 1.085 2.363 2.424 2.363h12.121zM60.016 4.965c-4.781-2.76-10.897-1.118-13.656 3.66L5.553 79.305A9.993 9.993 0 009.21 92.963l51.04 29.468c4.78 2.76 10.897 1.118 13.655-3.66l40.808-70.681a9.993 9.993 0 00-3.658-13.656L60.016 4.965zm-3.567 27.963a6 6 0 106-10.393 6 6 0 00-6 10.393zm31.697 17.928a6 6 0 106-10.392 6 6 0 00-6 10.392z"/><text class="tc-fill-background" font-family="Helvetica" font-size="47.172" font-weight="bold" transform="rotate(30 25.742 95.82)"><tspan x="42" y="77.485" text-anchor="middle"><$text text=<<day>>/></tspan></text></g></svg>
|
||||||
|
</$parameters>
|
@ -1,7 +0,0 @@
|
|||||||
title: $:/core/images/standard-layout
|
|
||||||
tags: $:/tags/Image
|
|
||||||
|
|
||||||
\parameters (size:"22pt")
|
|
||||||
<svg width=<<size>> height=<<size>> class="tc-image-standard-layout tc-image-button" viewBox="0 0 128 128">
|
|
||||||
<path d="M71.93 72A8.07 8.07 0 0 1 80 80.07v7.86A8.071 8.071 0 0 1 71.93 96H8.07A8.067 8.067 0 0 1 0 87.93v-7.86A8.072 8.072 0 0 1 8.07 72h63.86Zm0 32a8.07 8.07 0 0 1 8.07 8.07v7.86a8.071 8.071 0 0 1-8.07 8.07H8.07A8.067 8.067 0 0 1 0 119.93v-7.86A8.072 8.072 0 0 1 8.07 104h63.86Zm0-104A8.068 8.068 0 0 1 80 8.07v47.86A8.073 8.073 0 0 1 71.93 64H8.07A8.07 8.07 0 0 1 0 55.93V8.07A8.072 8.072 0 0 1 8.07 0h63.86Zm48 0c2.14 0 4.193.85 5.706 2.364A8.067 8.067 0 0 1 128 8.07v111.86c0 2.14-.85 4.193-2.364 5.706A8.067 8.067 0 0 1 119.93 128H96.07c-2.14 0-4.193-.85-5.706-2.364A8.067 8.067 0 0 1 88 119.93V8.07c0-2.14.85-4.193 2.364-5.706A8.067 8.067 0 0 1 96.07 0h23.86ZM116 24h-16a3.995 3.995 0 0 0-2.828 1.172 3.995 3.995 0 0 0 0 5.656A3.995 3.995 0 0 0 100 32h16a3.995 3.995 0 0 0 2.828-1.172 3.995 3.995 0 0 0 0-5.656A3.995 3.995 0 0 0 116 24Z"/>
|
|
||||||
</svg>
|
|
@ -28,7 +28,6 @@ Encryption/ClearPassword/Caption: clear password
|
|||||||
Encryption/ClearPassword/Hint: Clear the password and save this wiki without encryption
|
Encryption/ClearPassword/Hint: Clear the password and save this wiki without encryption
|
||||||
Encryption/SetPassword/Caption: set password
|
Encryption/SetPassword/Caption: set password
|
||||||
Encryption/SetPassword/Hint: Set a password for saving this wiki with encryption
|
Encryption/SetPassword/Hint: Set a password for saving this wiki with encryption
|
||||||
EmergencyDownload/Caption: download tiddlers as json
|
|
||||||
ExportPage/Caption: export all
|
ExportPage/Caption: export all
|
||||||
ExportPage/Hint: Export all tiddlers
|
ExportPage/Hint: Export all tiddlers
|
||||||
ExportTiddler/Caption: export tiddler
|
ExportTiddler/Caption: export tiddler
|
||||||
@ -80,7 +79,6 @@ NewMarkdown/Caption: new Markdown tiddler
|
|||||||
NewMarkdown/Hint: Create a new Markdown tiddler
|
NewMarkdown/Hint: Create a new Markdown tiddler
|
||||||
NewTiddler/Caption: new tiddler
|
NewTiddler/Caption: new tiddler
|
||||||
NewTiddler/Hint: Create a new tiddler
|
NewTiddler/Hint: Create a new tiddler
|
||||||
OpenControlPanel/Hint: Open control panel
|
|
||||||
OpenWindow/Caption: open in new window
|
OpenWindow/Caption: open in new window
|
||||||
OpenWindow/Hint: Open tiddler in new window
|
OpenWindow/Hint: Open tiddler in new window
|
||||||
Palette/Caption: palette
|
Palette/Caption: palette
|
||||||
@ -105,8 +103,6 @@ ShowSideBar/Caption: show sidebar
|
|||||||
ShowSideBar/Hint: Show sidebar
|
ShowSideBar/Hint: Show sidebar
|
||||||
TagManager/Caption: tag manager
|
TagManager/Caption: tag manager
|
||||||
TagManager/Hint: Open tag manager
|
TagManager/Hint: Open tag manager
|
||||||
TestCaseImport/Caption: import tiddlers
|
|
||||||
TestCaseImport/Hint: Import tiddlers
|
|
||||||
Timestamp/Caption: timestamps
|
Timestamp/Caption: timestamps
|
||||||
Timestamp/Hint: Choose whether modifications update timestamps
|
Timestamp/Hint: Choose whether modifications update timestamps
|
||||||
Timestamp/On/Caption: timestamps are on
|
Timestamp/On/Caption: timestamps are on
|
||||||
@ -133,7 +129,6 @@ Excise/Caption/Replace/Link: link
|
|||||||
Excise/Caption/Replace/Transclusion: transclusion
|
Excise/Caption/Replace/Transclusion: transclusion
|
||||||
Excise/Caption/Tag: Tag new tiddler with the title of this tiddler
|
Excise/Caption/Tag: Tag new tiddler with the title of this tiddler
|
||||||
Excise/Caption/TiddlerExists: Warning: tiddler already exists
|
Excise/Caption/TiddlerExists: Warning: tiddler already exists
|
||||||
Excise/DefaultTitle: New Excision
|
|
||||||
Excise/Hint: Excise the selected text into a new tiddler
|
Excise/Hint: Excise the selected text into a new tiddler
|
||||||
Heading1/Caption: heading 1
|
Heading1/Caption: heading 1
|
||||||
Heading1/Hint: Apply heading level 1 formatting to lines containing selection
|
Heading1/Hint: Apply heading level 1 formatting to lines containing selection
|
||||||
|
@ -96,10 +96,6 @@ Plugins/PluginWillRequireReload: (requires reload)
|
|||||||
Plugins/Plugins/Caption: Plugins
|
Plugins/Plugins/Caption: Plugins
|
||||||
Plugins/Plugins/Hint: Plugins
|
Plugins/Plugins/Hint: Plugins
|
||||||
Plugins/Reinstall/Caption: reinstall
|
Plugins/Reinstall/Caption: reinstall
|
||||||
Plugins/Stability/Deprecated: DEPRECATED
|
|
||||||
Plugins/Stability/Experimental: EXPERIMENTAL
|
|
||||||
Plugins/Stability/Legacy: LEGACY
|
|
||||||
Plugins/Stability/Stable: STABLE
|
|
||||||
Plugins/Themes/Caption: Themes
|
Plugins/Themes/Caption: Themes
|
||||||
Plugins/Themes/Hint: Theme plugins
|
Plugins/Themes/Hint: Theme plugins
|
||||||
Plugins/Update/Caption: update
|
Plugins/Update/Caption: update
|
||||||
@ -175,8 +171,6 @@ Settings/NavigationPermalinkviewMode/UpdateAddressBar/Description: Update addres
|
|||||||
Settings/PerformanceInstrumentation/Caption: Performance Instrumentation
|
Settings/PerformanceInstrumentation/Caption: Performance Instrumentation
|
||||||
Settings/PerformanceInstrumentation/Hint: Displays performance statistics in the browser developer console. Requires reload to take effect
|
Settings/PerformanceInstrumentation/Hint: Displays performance statistics in the browser developer console. Requires reload to take effect
|
||||||
Settings/PerformanceInstrumentation/Description: Enable performance instrumentation
|
Settings/PerformanceInstrumentation/Description: Enable performance instrumentation
|
||||||
Settings/RecentLimit/Caption: Recent Tab Limit
|
|
||||||
Settings/RecentLimit/Hint: Maximum number of tiddlers to be displayed under the sidebar "Recent" tab
|
|
||||||
Settings/ToolbarButtonStyle/Caption: Toolbar Button Style
|
Settings/ToolbarButtonStyle/Caption: Toolbar Button Style
|
||||||
Settings/ToolbarButtonStyle/Hint: Choose the style for toolbar buttons:
|
Settings/ToolbarButtonStyle/Hint: Choose the style for toolbar buttons:
|
||||||
Settings/ToolbarButtonStyle/Styles/Borderless: Borderless
|
Settings/ToolbarButtonStyle/Styles/Borderless: Borderless
|
||||||
@ -204,12 +198,6 @@ Settings/TitleLinks/Yes/Description: Display tiddler titles as links
|
|||||||
Settings/MissingLinks/Caption: Wiki Links
|
Settings/MissingLinks/Caption: Wiki Links
|
||||||
Settings/MissingLinks/Hint: Choose whether to link to tiddlers that do not exist yet
|
Settings/MissingLinks/Hint: Choose whether to link to tiddlers that do not exist yet
|
||||||
Settings/MissingLinks/Description: Enable links to missing tiddlers
|
Settings/MissingLinks/Description: Enable links to missing tiddlers
|
||||||
SocialCard/Caption: Social Media Card
|
|
||||||
SocialCard/Domain/Prompt: Domain name to display for the link (for example, ''tiddlywiki.com'')
|
|
||||||
SocialCard/Hint: This information is used by social and messaging services to display a preview card for links to this ~TiddlyWiki when hosted online
|
|
||||||
SocialCard/PreviewUrl/Prompt: Full URL to preview image for this ~TiddlyWiki
|
|
||||||
SocialCard/PreviewUrl/Preview: Preview image:
|
|
||||||
SocialCard/Url/Prompt: Full URL of this ~TiddlyWiki
|
|
||||||
StoryTiddler/Caption: Story Tiddler
|
StoryTiddler/Caption: Story Tiddler
|
||||||
StoryTiddler/Hint: This rule cascade is used to dynamically choose the template for displaying a tiddler in the story river.
|
StoryTiddler/Hint: This rule cascade is used to dynamically choose the template for displaying a tiddler in the story river.
|
||||||
StoryView/Caption: Story View
|
StoryView/Caption: Story View
|
||||||
@ -218,12 +206,6 @@ Stylesheets/Caption: Stylesheets
|
|||||||
Stylesheets/Expand/Caption: Expand All
|
Stylesheets/Expand/Caption: Expand All
|
||||||
Stylesheets/Hint: This is the rendered CSS of the current stylesheet tiddlers tagged with <<tag "$:/tags/Stylesheet">>
|
Stylesheets/Hint: This is the rendered CSS of the current stylesheet tiddlers tagged with <<tag "$:/tags/Stylesheet">>
|
||||||
Stylesheets/Restore/Caption: Restore
|
Stylesheets/Restore/Caption: Restore
|
||||||
TestCases/Caption: Test Cases
|
|
||||||
TestCases/Hint: Test cases are self contained examples for testing and learning
|
|
||||||
TestCases/All/Caption: All Test Cases
|
|
||||||
TestCases/All/Hint: All Test Cases
|
|
||||||
TestCases/Failed/Caption: Failed Test Cases
|
|
||||||
TestCases/Failed/Hint: Only Failed Test Cases
|
|
||||||
Theme/Caption: Theme
|
Theme/Caption: Theme
|
||||||
Theme/Prompt: Current theme:
|
Theme/Prompt: Current theme:
|
||||||
TiddlerFields/Caption: Tiddler Fields
|
TiddlerFields/Caption: Tiddler Fields
|
||||||
@ -247,7 +229,3 @@ ViewTemplateBody/Caption: View Template Body
|
|||||||
ViewTemplateBody/Hint: This rule cascade is used by the default view template to dynamically choose the template for displaying the body of a tiddler.
|
ViewTemplateBody/Hint: This rule cascade is used by the default view template to dynamically choose the template for displaying the body of a tiddler.
|
||||||
ViewTemplateTitle/Caption: View Template Title
|
ViewTemplateTitle/Caption: View Template Title
|
||||||
ViewTemplateTitle/Hint: This rule cascade is used by the default view template to dynamically choose the template for displaying the title of a tiddler.
|
ViewTemplateTitle/Hint: This rule cascade is used by the default view template to dynamically choose the template for displaying the title of a tiddler.
|
||||||
ViewTemplateSubtitle/Caption: View Template Subtitle
|
|
||||||
ViewTemplateSubtitle/Hint: This rule cascade is used by the default view template to dynamically choose the template for displaying the subtitle of a tiddler.
|
|
||||||
ViewTemplateTags/Caption: View Template Tags
|
|
||||||
ViewTemplateTags/Hint: This rule cascade is used by the default view template to dynamically choose the template for displaying the tags area of a tiddler.
|
|
||||||
|
@ -9,7 +9,7 @@ config: Data to be inserted into `$tw.config`.
|
|||||||
filteroperator: Individual filter operator methods.
|
filteroperator: Individual filter operator methods.
|
||||||
global: Global data to be inserted into `$tw`.
|
global: Global data to be inserted into `$tw`.
|
||||||
info: Publishes system information via the [[$:/temp/info-plugin]] pseudo-plugin.
|
info: Publishes system information via the [[$:/temp/info-plugin]] pseudo-plugin.
|
||||||
isfilteroperator: Parameters for the ''is'' filter operator.
|
isfilteroperator: Operands for the ''is'' filter operator.
|
||||||
library: Generic module type for general purpose JavaScript modules.
|
library: Generic module type for general purpose JavaScript modules.
|
||||||
macro: JavaScript macro definitions.
|
macro: JavaScript macro definitions.
|
||||||
parser: Parsers for different content types.
|
parser: Parsers for different content types.
|
||||||
|
@ -65,13 +65,6 @@ sidebar-tab-foreground-selected: Sidebar tab foreground for selected tabs
|
|||||||
sidebar-tab-foreground: Sidebar tab foreground
|
sidebar-tab-foreground: Sidebar tab foreground
|
||||||
sidebar-tiddler-link-foreground-hover: Sidebar tiddler link foreground hover
|
sidebar-tiddler-link-foreground-hover: Sidebar tiddler link foreground hover
|
||||||
sidebar-tiddler-link-foreground: Sidebar tiddler link foreground
|
sidebar-tiddler-link-foreground: Sidebar tiddler link foreground
|
||||||
stability-stable: Badge for stability level "stable"
|
|
||||||
stability-experimental: Badge for stability level "experimental"
|
|
||||||
stability-deprecated: Badge for stability level "deprecated"
|
|
||||||
stability-legacy: Badge for stability level "legacy"
|
|
||||||
testcase-accent-level-1: Test case accent colour with no nesting
|
|
||||||
testcase-accent-level-2: Test case accent colour with 2nd level nesting
|
|
||||||
testcase-accent-level-3: Test case accent colour with 3rd level nesting or higher
|
|
||||||
site-title-foreground: Site title foreground
|
site-title-foreground: Site title foreground
|
||||||
static-alert-foreground: Static alert foreground
|
static-alert-foreground: Static alert foreground
|
||||||
tab-background-selected: Tab background for selected tabs
|
tab-background-selected: Tab background for selected tabs
|
||||||
|
@ -26,8 +26,6 @@ Tags/ClearInput/Caption: clear input
|
|||||||
Tags/ClearInput/Hint: Clear tag input
|
Tags/ClearInput/Hint: Clear tag input
|
||||||
Tags/Dropdown/Caption: tag list
|
Tags/Dropdown/Caption: tag list
|
||||||
Tags/Dropdown/Hint: Show tag list
|
Tags/Dropdown/Hint: Show tag list
|
||||||
Tags/EmptyMessage: No tags found
|
|
||||||
Tags/EmptyMessage/System: No system tags found
|
|
||||||
Title/BadCharacterWarning: Warning: avoid using any of the characters <<bad-chars>> in tiddler titles
|
Title/BadCharacterWarning: Warning: avoid using any of the characters <<bad-chars>> in tiddler titles
|
||||||
Title/Exists/Prompt: Target tiddler already exists
|
Title/Exists/Prompt: Target tiddler already exists
|
||||||
Title/Relink/Prompt: Update ''<$text text=<<fromTitle>>/>'' to ''<$text text=<<toTitle>>/>'' in the //tags// and //list// fields of other tiddlers
|
Title/Relink/Prompt: Update ''<$text text=<<fromTitle>>/>'' to ''<$text text=<<toTitle>>/>'' in the //tags// and //list// fields of other tiddlers
|
||||||
|
@ -3,4 +3,4 @@ title: $:/language/Exporters/
|
|||||||
StaticRiver: Static HTML
|
StaticRiver: Static HTML
|
||||||
JsonFile: JSON file
|
JsonFile: JSON file
|
||||||
CsvFile: CSV file
|
CsvFile: CSV file
|
||||||
TidFile: TID text file
|
TidFile: ".tid" file
|
||||||
|
@ -4,7 +4,6 @@ _canonical_uri: The full URI of an external image tiddler
|
|||||||
author: Name of the author of a plugin
|
author: Name of the author of a plugin
|
||||||
bag: The name of the bag from which a tiddler came
|
bag: The name of the bag from which a tiddler came
|
||||||
caption: The text to be displayed on a tab or button
|
caption: The text to be displayed on a tab or button
|
||||||
class: The CSS class applied to a tiddler when rendering it - see [[Custom styles by user-class]]. Also used for [[Modals]]
|
|
||||||
code-body: The view template will display the tiddler as code if set to ''yes''
|
code-body: The view template will display the tiddler as code if set to ''yes''
|
||||||
color: The CSS color value associated with a tiddler
|
color: The CSS color value associated with a tiddler
|
||||||
component: The name of the component responsible for an [[alert tiddler|AlertMechanism]]
|
component: The name of the component responsible for an [[alert tiddler|AlertMechanism]]
|
||||||
@ -30,7 +29,6 @@ name: The human readable name associated with a plugin tiddler
|
|||||||
parent-plugin: For a plugin, specifies which plugin of which it is a sub-plugin
|
parent-plugin: For a plugin, specifies which plugin of which it is a sub-plugin
|
||||||
plugin-priority: A numerical value indicating the priority of a plugin tiddler
|
plugin-priority: A numerical value indicating the priority of a plugin tiddler
|
||||||
plugin-type: The type of plugin in a plugin tiddler
|
plugin-type: The type of plugin in a plugin tiddler
|
||||||
stability: The development status of a plugin: deprecated, experimental, stable, or legacy
|
|
||||||
revision: The revision of the tiddler held at the server
|
revision: The revision of the tiddler held at the server
|
||||||
released: Date of a TiddlyWiki release
|
released: Date of a TiddlyWiki release
|
||||||
source: The source URL associated with a tiddler
|
source: The source URL associated with a tiddler
|
||||||
|
@ -10,7 +10,7 @@ Sequentially run the command tokens returned from a filter
|
|||||||
Examples
|
Examples
|
||||||
|
|
||||||
```
|
```
|
||||||
--commands "[enlist:raw{$:/build-commands-as-text}]"
|
--commands "[enlist{$:/build-commands-as-text}]"
|
||||||
```
|
```
|
||||||
|
|
||||||
```
|
```
|
||||||
|
@ -19,7 +19,7 @@ The following options are supported:
|
|||||||
** ''yes'' will "explode" plugins into separate tiddler files and save them to the plugin directory within the wiki folder
|
** ''yes'' will "explode" plugins into separate tiddler files and save them to the plugin directory within the wiki folder
|
||||||
** ''no'' will suppress exploding plugins into their constituent tiddler files. It will save the plugin as a single JSON tiddler in the tiddlers folder
|
** ''no'' will suppress exploding plugins into their constituent tiddler files. It will save the plugin as a single JSON tiddler in the tiddlers folder
|
||||||
|
|
||||||
Note that both ''explodePlugins'' options will produce wiki folders that build the exact same original wiki. The difference lies in how plugins are represented in the wiki folder.
|
Note that both ''explodePlugins'' options will produce wiki folders that build the same exact same original wiki. The difference lies in how plugins are represented in the wiki folder.
|
||||||
|
|
||||||
A common usage is to convert a TiddlyWiki HTML file into a wiki folder:
|
A common usage is to convert a TiddlyWiki HTML file into a wiki folder:
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
title: $:/language/Help/server
|
title: $:/language/Help/server
|
||||||
description: (deprecated: see 'listen' command) Provides an HTTP server interface to TiddlyWiki
|
description: Provides an HTTP server interface to TiddlyWiki (deprecated in favour of the new listen command)
|
||||||
|
|
||||||
Legacy command to serve a wiki over HTTP.
|
Legacy command to serve a wiki over HTTP.
|
||||||
|
|
||||||
|
@ -30,7 +30,7 @@ Error/DeserializeOperator/UnknownDeserializer: Filter Error: Unknown deserialize
|
|||||||
Error/Filter: Filter error
|
Error/Filter: Filter error
|
||||||
Error/FilterSyntax: Syntax error in filter expression
|
Error/FilterSyntax: Syntax error in filter expression
|
||||||
Error/FilterRunPrefix: Filter Error: Unknown prefix for filter run
|
Error/FilterRunPrefix: Filter Error: Unknown prefix for filter run
|
||||||
Error/IsFilterOperator: Filter Error: Unknown parameter for the 'is' filter operator
|
Error/IsFilterOperator: Filter Error: Unknown operand for the 'is' filter operator
|
||||||
Error/FormatFilterOperator: Filter Error: Unknown suffix for the 'format' filter operator
|
Error/FormatFilterOperator: Filter Error: Unknown suffix for the 'format' filter operator
|
||||||
Error/LoadingPluginLibrary: Error loading plugin library
|
Error/LoadingPluginLibrary: Error loading plugin library
|
||||||
Error/NetworkErrorAlert: `<h2>''Network Error''</h2>It looks like the connection to the server has been lost. This may indicate a problem with your network connection. Please attempt to restore network connectivity before continuing.<br><br>''Any unsaved changes will be automatically synchronised when connectivity is restored''.`
|
Error/NetworkErrorAlert: `<h2>''Network Error''</h2>It looks like the connection to the server has been lost. This may indicate a problem with your network connection. Please attempt to restore network connectivity before continuing.<br><br>''Any unsaved changes will be automatically synchronised when connectivity is restored''.`
|
||||||
@ -70,7 +70,7 @@ No: No
|
|||||||
OfficialPluginLibrary: Official ~TiddlyWiki Plugin Library
|
OfficialPluginLibrary: Official ~TiddlyWiki Plugin Library
|
||||||
OfficialPluginLibrary/Hint: The official ~TiddlyWiki plugin library at tiddlywiki.com. Plugins, themes and language packs are maintained by the core team.
|
OfficialPluginLibrary/Hint: The official ~TiddlyWiki plugin library at tiddlywiki.com. Plugins, themes and language packs are maintained by the core team.
|
||||||
PageTemplate/Description: the default ~TiddlyWiki layout
|
PageTemplate/Description: the default ~TiddlyWiki layout
|
||||||
PageTemplate/Name: Standard Layout
|
PageTemplate/Name: Default ~PageTemplate
|
||||||
PluginReloadWarning: Please save {{$:/core/ui/Buttons/save-wiki}} and reload {{$:/core/ui/Buttons/refresh}} to allow changes to ~JavaScript plugins to take effect
|
PluginReloadWarning: Please save {{$:/core/ui/Buttons/save-wiki}} and reload {{$:/core/ui/Buttons/refresh}} to allow changes to ~JavaScript plugins to take effect
|
||||||
RecentChanges/DateFormat: DDth MMM YYYY
|
RecentChanges/DateFormat: DDth MMM YYYY
|
||||||
Shortcuts/Input/AdvancedSearch/Hint: Open the ~AdvancedSearch panel from within the sidebar search field
|
Shortcuts/Input/AdvancedSearch/Hint: Open the ~AdvancedSearch panel from within the sidebar search field
|
||||||
|
@ -6,8 +6,6 @@ Filter/Hint: Search via a [[filter expression|https://tiddlywiki.com/static/Filt
|
|||||||
Filter/Matches: //<small><<resultCount>> matches</small>//
|
Filter/Matches: //<small><<resultCount>> matches</small>//
|
||||||
Matches: //<small><<resultCount>> matches</small>//
|
Matches: //<small><<resultCount>> matches</small>//
|
||||||
Matches/All: All matches:
|
Matches/All: All matches:
|
||||||
Matches/NoMatch: //No match//
|
|
||||||
Matches/NoResult: //No search result//
|
|
||||||
Matches/Title: Title matches:
|
Matches/Title: Title matches:
|
||||||
Search: Search
|
Search: Search
|
||||||
Search/TooShort: Search text too short
|
Search/TooShort: Search text too short
|
||||||
|
@ -1,7 +0,0 @@
|
|||||||
title: $:/language/Snippets/FunctionDefinition
|
|
||||||
tags: $:/tags/TextEditor/Snippet
|
|
||||||
caption: Function definition
|
|
||||||
|
|
||||||
\function f.name(param1,param2:"default value") [<param1>!is[blank]else<param2>]
|
|
||||||
|
|
||||||
<<f.name>>
|
|
@ -1,7 +0,0 @@
|
|||||||
title: $:/language/Snippets/ProcedureDefinition
|
|
||||||
tags: $:/tags/TextEditor/Snippet
|
|
||||||
caption: Procedure definition
|
|
||||||
|
|
||||||
\procedure procName(param1:"default value",param2)
|
|
||||||
Your text comes here.
|
|
||||||
\end
|
|
@ -1,5 +1,5 @@
|
|||||||
title: $:/language/Docs/Types/image/svg+xml
|
title: $:/language/Docs/Types/image/svg+xml
|
||||||
description: SVG image
|
description: Structured Vector Graphics image
|
||||||
name: image/svg+xml
|
name: image/svg+xml
|
||||||
group: Image
|
group: Image
|
||||||
group-sort: 1
|
group-sort: 1
|
||||||
|
5
core/language/en-GB/Types/image_x-icon.tid
Normal file
5
core/language/en-GB/Types/image_x-icon.tid
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
title: $:/language/Docs/Types/image/x-icon
|
||||||
|
description: ICO format icon file
|
||||||
|
name: image/x-icon
|
||||||
|
group: Image
|
||||||
|
group-sort: 1
|
@ -1,5 +0,0 @@
|
|||||||
title: $:/language/Docs/Types/text/vnd.tiddlywiki-multiple
|
|
||||||
description: Compound tiddler
|
|
||||||
name: text/vnd.tiddlywiki-multiple
|
|
||||||
group: Developer
|
|
||||||
group-sort: 2
|
|
@ -24,7 +24,7 @@ var Command = function(params,commander) {
|
|||||||
|
|
||||||
Command.prototype.execute = function() {
|
Command.prototype.execute = function() {
|
||||||
// Get the build targets defined in the wiki
|
// Get the build targets defined in the wiki
|
||||||
var buildTargets = $tw.boot.wikiInfo && $tw.boot.wikiInfo.build;
|
var buildTargets = $tw.boot.wikiInfo.build;
|
||||||
if(!buildTargets) {
|
if(!buildTargets) {
|
||||||
return "No build targets defined";
|
return "No build targets defined";
|
||||||
}
|
}
|
||||||
|
@ -18,7 +18,7 @@ exports.info = {
|
|||||||
name: "listen",
|
name: "listen",
|
||||||
synchronous: true,
|
synchronous: true,
|
||||||
namedParameterMode: true,
|
namedParameterMode: true,
|
||||||
mandatoryParameters: []
|
mandatoryParameters: [],
|
||||||
};
|
};
|
||||||
|
|
||||||
var Command = function(params,commander,callback) {
|
var Command = function(params,commander,callback) {
|
||||||
|
@ -27,8 +27,33 @@ var Command = function(params,commander,callback) {
|
|||||||
|
|
||||||
Command.prototype.execute = function() {
|
Command.prototype.execute = function() {
|
||||||
var wiki = this.commander.wiki,
|
var wiki = this.commander.wiki,
|
||||||
|
fs = require("fs"),
|
||||||
|
path = require("path"),
|
||||||
upgradeLibraryTitle = this.params[0] || UPGRADE_LIBRARY_TITLE,
|
upgradeLibraryTitle = this.params[0] || UPGRADE_LIBRARY_TITLE,
|
||||||
tiddlers = $tw.utils.getAllPlugins();
|
tiddlers = {};
|
||||||
|
// Collect up the library plugins
|
||||||
|
var collectPlugins = function(folder) {
|
||||||
|
var pluginFolders = $tw.utils.getSubdirectories(folder) || [];
|
||||||
|
for(var p=0; p<pluginFolders.length; p++) {
|
||||||
|
if(!$tw.boot.excludeRegExp.test(pluginFolders[p])) {
|
||||||
|
pluginFields = $tw.loadPluginFolder(path.resolve(folder,"./" + pluginFolders[p]));
|
||||||
|
if(pluginFields && pluginFields.title) {
|
||||||
|
tiddlers[pluginFields.title] = pluginFields;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
collectPublisherPlugins = function(folder) {
|
||||||
|
var publisherFolders = $tw.utils.getSubdirectories(folder) || [];
|
||||||
|
for(var t=0; t<publisherFolders.length; t++) {
|
||||||
|
if(!$tw.boot.excludeRegExp.test(publisherFolders[t])) {
|
||||||
|
collectPlugins(path.resolve(folder,"./" + publisherFolders[t]));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
$tw.utils.each($tw.getLibraryItemSearchPaths($tw.config.pluginsPath,$tw.config.pluginsEnvVar),collectPublisherPlugins);
|
||||||
|
$tw.utils.each($tw.getLibraryItemSearchPaths($tw.config.themesPath,$tw.config.themesEnvVar),collectPublisherPlugins);
|
||||||
|
$tw.utils.each($tw.getLibraryItemSearchPaths($tw.config.languagesPath,$tw.config.languagesEnvVar),collectPlugins);
|
||||||
// Save the upgrade library tiddler
|
// Save the upgrade library tiddler
|
||||||
var pluginFields = {
|
var pluginFields = {
|
||||||
title: upgradeLibraryTitle,
|
title: upgradeLibraryTitle,
|
||||||
|
@ -45,22 +45,17 @@ Render individual tiddlers and save the results to the specified files
|
|||||||
variableList = variableList.slice(2);
|
variableList = variableList.slice(2);
|
||||||
}
|
}
|
||||||
$tw.utils.each(tiddlers,function(title) {
|
$tw.utils.each(tiddlers,function(title) {
|
||||||
var filenameResults = wiki.filterTiddlers(filenameFilter,$tw.rootWidget,wiki.makeTiddlerIterator([title]));
|
var filepath = path.resolve(self.commander.outputPath,wiki.filterTiddlers(filenameFilter,$tw.rootWidget,wiki.makeTiddlerIterator([title]))[0]);
|
||||||
if(filenameResults.length > 0) {
|
if(self.commander.verbose) {
|
||||||
var filepath = path.resolve(self.commander.outputPath,filenameResults[0]);
|
console.log("Rendering \"" + title + "\" to \"" + filepath + "\"");
|
||||||
if(self.commander.verbose) {
|
|
||||||
console.log("Rendering \"" + title + "\" to \"" + filepath + "\"");
|
|
||||||
}
|
|
||||||
var parser = wiki.parseTiddler(template || title),
|
|
||||||
widgetNode = wiki.makeWidget(parser,{variables: $tw.utils.extend({},variables,{currentTiddler: title,storyTiddler: title})}),
|
|
||||||
container = $tw.fakeDocument.createElement("div");
|
|
||||||
widgetNode.render(container,null);
|
|
||||||
var text = type === "text/html" ? container.innerHTML : container.textContent;
|
|
||||||
$tw.utils.createFileDirectories(filepath);
|
|
||||||
fs.writeFileSync(filepath,text,"utf8");
|
|
||||||
} else {
|
|
||||||
console.log("Not rendering \"" + title + "\" because the filename filter returned an empty result");
|
|
||||||
}
|
}
|
||||||
|
var parser = wiki.parseTiddler(template || title),
|
||||||
|
widgetNode = wiki.makeWidget(parser,{variables: $tw.utils.extend({},variables,{currentTiddler: title,storyTiddler: title})}),
|
||||||
|
container = $tw.fakeDocument.createElement("div");
|
||||||
|
widgetNode.render(container,null);
|
||||||
|
var text = type === "text/html" ? container.innerHTML : container.textContent;
|
||||||
|
$tw.utils.createFileDirectories(filepath);
|
||||||
|
fs.writeFileSync(filepath,text,"utf8");
|
||||||
});
|
});
|
||||||
return null;
|
return null;
|
||||||
};
|
};
|
||||||
|
@ -43,9 +43,7 @@ Saves individual tiddlers in their raw text or binary format to the specified fi
|
|||||||
directory: path.resolve(self.commander.outputPath),
|
directory: path.resolve(self.commander.outputPath),
|
||||||
pathFilters: [filenameFilter],
|
pathFilters: [filenameFilter],
|
||||||
wiki: wiki,
|
wiki: wiki,
|
||||||
fileInfo: {
|
fileInfo: {}
|
||||||
overwrite: true
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
if(self.commander.verbose) {
|
if(self.commander.verbose) {
|
||||||
console.log("Saving \"" + title + "\" to \"" + fileInfo.filepath + "\"");
|
console.log("Saving \"" + title + "\" to \"" + fileInfo.filepath + "\"");
|
||||||
|
@ -46,7 +46,7 @@ Command.prototype.execute = function() {
|
|||||||
type = tiddler.fields.type || "text/vnd.tiddlywiki",
|
type = tiddler.fields.type || "text/vnd.tiddlywiki",
|
||||||
contentTypeInfo = $tw.config.contentTypeInfo[type] || {encoding: "utf8"},
|
contentTypeInfo = $tw.config.contentTypeInfo[type] || {encoding: "utf8"},
|
||||||
filename = path.resolve(pathname,$tw.utils.encodeURIComponentExtended(title));
|
filename = path.resolve(pathname,$tw.utils.encodeURIComponentExtended(title));
|
||||||
fs.writeFileSync(filename,tiddler.fields.text || "",contentTypeInfo.encoding);
|
fs.writeFileSync(filename,tiddler.fields.text,contentTypeInfo.encoding);
|
||||||
});
|
});
|
||||||
return null;
|
return null;
|
||||||
};
|
};
|
||||||
|
@ -176,10 +176,7 @@ WikiFolderMaker.prototype.saveCustomPlugin = function(pluginTiddler) {
|
|||||||
this.saveJSONFile(directory + path.sep + "plugin.info",pluginInfo);
|
this.saveJSONFile(directory + path.sep + "plugin.info",pluginInfo);
|
||||||
self.log("Writing " + directory + path.sep + "plugin.info: " + JSON.stringify(pluginInfo,null,$tw.config.preferences.jsonSpaces));
|
self.log("Writing " + directory + path.sep + "plugin.info: " + JSON.stringify(pluginInfo,null,$tw.config.preferences.jsonSpaces));
|
||||||
var pluginTiddlers = $tw.utils.parseJSONSafe(pluginTiddler.fields.text).tiddlers; // A hashmap of tiddlers in the plugin
|
var pluginTiddlers = $tw.utils.parseJSONSafe(pluginTiddler.fields.text).tiddlers; // A hashmap of tiddlers in the plugin
|
||||||
$tw.utils.each(pluginTiddlers,function(tiddler,title) {
|
$tw.utils.each(pluginTiddlers,function(tiddler) {
|
||||||
if(!tiddler.title) {
|
|
||||||
tiddler.title = title;
|
|
||||||
}
|
|
||||||
self.saveTiddler(directory,new $tw.Tiddler(tiddler));
|
self.saveTiddler(directory,new $tw.Tiddler(tiddler));
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
@ -30,7 +30,7 @@ exports.textPrimitives.wikiLink = exports.textPrimitives.upperLetter + "+" +
|
|||||||
exports.textPrimitives.upperLetter +
|
exports.textPrimitives.upperLetter +
|
||||||
exports.textPrimitives.anyLetter + "*";
|
exports.textPrimitives.anyLetter + "*";
|
||||||
|
|
||||||
exports.htmlEntities = {quot:34, dollar:36, amp:38, apos:39, lt:60, gt:62, nbsp:160, iexcl:161, cent:162, pound:163, curren:164, yen:165, brvbar:166, sect:167, uml:168, copy:169, ordf:170, laquo:171, not:172, shy:173, reg:174, macr:175, deg:176, plusmn:177, sup2:178, sup3:179, acute:180, micro:181, para:182, middot:183, cedil:184, sup1:185, ordm:186, raquo:187, frac14:188, frac12:189, frac34:190, iquest:191, Agrave:192, Aacute:193, Acirc:194, Atilde:195, Auml:196, Aring:197, AElig:198, Ccedil:199, Egrave:200, Eacute:201, Ecirc:202, Euml:203, Igrave:204, Iacute:205, Icirc:206, Iuml:207, ETH:208, Ntilde:209, Ograve:210, Oacute:211, Ocirc:212, Otilde:213, Ouml:214, times:215, Oslash:216, Ugrave:217, Uacute:218, Ucirc:219, Uuml:220, Yacute:221, THORN:222, szlig:223, agrave:224, aacute:225, acirc:226, atilde:227, auml:228, aring:229, aelig:230, ccedil:231, egrave:232, eacute:233, ecirc:234, euml:235, igrave:236, iacute:237, icirc:238, iuml:239, eth:240, ntilde:241, ograve:242, oacute:243, ocirc:244, otilde:245, ouml:246, divide:247, oslash:248, ugrave:249, uacute:250, ucirc:251, uuml:252, yacute:253, thorn:254, yuml:255, OElig:338, oelig:339, Scaron:352, scaron:353, Yuml:376, fnof:402, circ:710, tilde:732, Alpha:913, Beta:914, Gamma:915, Delta:916, Epsilon:917, Zeta:918, Eta:919, Theta:920, Iota:921, Kappa:922, Lambda:923, Mu:924, Nu:925, Xi:926, Omicron:927, Pi:928, Rho:929, Sigma:931, Tau:932, Upsilon:933, Phi:934, Chi:935, Psi:936, Omega:937, alpha:945, beta:946, gamma:947, delta:948, epsilon:949, zeta:950, eta:951, theta:952, iota:953, kappa:954, lambda:955, mu:956, nu:957, xi:958, omicron:959, pi:960, rho:961, sigmaf:962, sigma:963, tau:964, upsilon:965, phi:966, chi:967, psi:968, omega:969, thetasym:977, upsih:978, piv:982, ensp:8194, emsp:8195, thinsp:8201, zwnj:8204, zwj:8205, lrm:8206, rlm:8207, ndash:8211, mdash:8212, lsquo:8216, rsquo:8217, sbquo:8218, ldquo:8220, rdquo:8221, bdquo:8222, dagger:8224, Dagger:8225, bull:8226, hellip:8230, permil:8240, prime:8242, Prime:8243, lsaquo:8249, rsaquo:8250, oline:8254, frasl:8260, nobreak:8288, NoBreak:8288, euro:8364, image:8465, weierp:8472, real:8476, trade:8482, alefsym:8501, larr:8592, uarr:8593, rarr:8594, darr:8595, harr:8596, crarr:8629, lArr:8656, uArr:8657, rArr:8658, dArr:8659, hArr:8660, forall:8704, part:8706, exist:8707, empty:8709, nabla:8711, isin:8712, notin:8713, ni:8715, prod:8719, sum:8721, minus:8722, lowast:8727, radic:8730, prop:8733, infin:8734, ang:8736, and:8743, or:8744, cap:8745, cup:8746, int:8747, there4:8756, sim:8764, cong:8773, asymp:8776, ne:8800, equiv:8801, le:8804, ge:8805, sub:8834, sup:8835, nsub:8836, sube:8838, supe:8839, oplus:8853, otimes:8855, perp:8869, sdot:8901, lceil:8968, rceil:8969, lfloor:8970, rfloor:8971, lang:9001, rang:9002, loz:9674, spades:9824, clubs:9827, hearts:9829, diams:9830 };
|
exports.htmlEntities = {quot:34, dollar:36, amp:38, apos:39, lt:60, gt:62, nbsp:160, iexcl:161, cent:162, pound:163, curren:164, yen:165, brvbar:166, sect:167, uml:168, copy:169, ordf:170, laquo:171, not:172, shy:173, reg:174, macr:175, deg:176, plusmn:177, sup2:178, sup3:179, acute:180, micro:181, para:182, middot:183, cedil:184, sup1:185, ordm:186, raquo:187, frac14:188, frac12:189, frac34:190, iquest:191, Agrave:192, Aacute:193, Acirc:194, Atilde:195, Auml:196, Aring:197, AElig:198, Ccedil:199, Egrave:200, Eacute:201, Ecirc:202, Euml:203, Igrave:204, Iacute:205, Icirc:206, Iuml:207, ETH:208, Ntilde:209, Ograve:210, Oacute:211, Ocirc:212, Otilde:213, Ouml:214, times:215, Oslash:216, Ugrave:217, Uacute:218, Ucirc:219, Uuml:220, Yacute:221, THORN:222, szlig:223, agrave:224, aacute:225, acirc:226, atilde:227, auml:228, aring:229, aelig:230, ccedil:231, egrave:232, eacute:233, ecirc:234, euml:235, igrave:236, iacute:237, icirc:238, iuml:239, eth:240, ntilde:241, ograve:242, oacute:243, ocirc:244, otilde:245, ouml:246, divide:247, oslash:248, ugrave:249, uacute:250, ucirc:251, uuml:252, yacute:253, thorn:254, yuml:255, OElig:338, oelig:339, Scaron:352, scaron:353, Yuml:376, fnof:402, circ:710, tilde:732, Alpha:913, Beta:914, Gamma:915, Delta:916, Epsilon:917, Zeta:918, Eta:919, Theta:920, Iota:921, Kappa:922, Lambda:923, Mu:924, Nu:925, Xi:926, Omicron:927, Pi:928, Rho:929, Sigma:931, Tau:932, Upsilon:933, Phi:934, Chi:935, Psi:936, Omega:937, alpha:945, beta:946, gamma:947, delta:948, epsilon:949, zeta:950, eta:951, theta:952, iota:953, kappa:954, lambda:955, mu:956, nu:957, xi:958, omicron:959, pi:960, rho:961, sigmaf:962, sigma:963, tau:964, upsilon:965, phi:966, chi:967, psi:968, omega:969, thetasym:977, upsih:978, piv:982, ensp:8194, emsp:8195, thinsp:8201, zwnj:8204, zwj:8205, lrm:8206, rlm:8207, ndash:8211, mdash:8212, lsquo:8216, rsquo:8217, sbquo:8218, ldquo:8220, rdquo:8221, bdquo:8222, dagger:8224, Dagger:8225, bull:8226, hellip:8230, permil:8240, prime:8242, Prime:8243, lsaquo:8249, rsaquo:8250, oline:8254, frasl:8260, euro:8364, image:8465, weierp:8472, real:8476, trade:8482, alefsym:8501, larr:8592, uarr:8593, rarr:8594, darr:8595, harr:8596, crarr:8629, lArr:8656, uArr:8657, rArr:8658, dArr:8659, hArr:8660, forall:8704, part:8706, exist:8707, empty:8709, nabla:8711, isin:8712, notin:8713, ni:8715, prod:8719, sum:8721, minus:8722, lowast:8727, radic:8730, prop:8733, infin:8734, ang:8736, and:8743, or:8744, cap:8745, cup:8746, int:8747, there4:8756, sim:8764, cong:8773, asymp:8776, ne:8800, equiv:8801, le:8804, ge:8805, sub:8834, sup:8835, nsub:8836, sube:8838, supe:8839, oplus:8853, otimes:8855, perp:8869, sdot:8901, lceil:8968, rceil:8969, lfloor:8970, rfloor:8971, lang:9001, rang:9002, loz:9674, spades:9824, clubs:9827, hearts:9829, diams:9830 };
|
||||||
|
|
||||||
exports.htmlVoidElements = "area,base,br,col,command,embed,hr,img,input,keygen,link,meta,param,source,track,wbr".split(",");
|
exports.htmlVoidElements = "area,base,br,col,command,embed,hr,img,input,keygen,link,meta,param,source,track,wbr".split(",");
|
||||||
|
|
||||||
|
@ -60,7 +60,7 @@ function FramedEngine(options) {
|
|||||||
this.domNode.value = this.value;
|
this.domNode.value = this.value;
|
||||||
}
|
}
|
||||||
// Set the attributes
|
// Set the attributes
|
||||||
if(this.widget.editType && this.widget.editTag !== "textarea") {
|
if(this.widget.editType) {
|
||||||
this.domNode.setAttribute("type",this.widget.editType);
|
this.domNode.setAttribute("type",this.widget.editType);
|
||||||
}
|
}
|
||||||
if(this.widget.editPlaceholder) {
|
if(this.widget.editPlaceholder) {
|
||||||
|
@ -34,7 +34,7 @@ function SimpleEngine(options) {
|
|||||||
this.domNode.value = this.value;
|
this.domNode.value = this.value;
|
||||||
}
|
}
|
||||||
// Set the attributes
|
// Set the attributes
|
||||||
if(this.widget.editType && this.widget.editTag !== "textarea") {
|
if(this.widget.editType) {
|
||||||
this.domNode.setAttribute("type",this.widget.editType);
|
this.domNode.setAttribute("type",this.widget.editType);
|
||||||
}
|
}
|
||||||
if(this.widget.editPlaceholder) {
|
if(this.widget.editPlaceholder) {
|
||||||
|
@ -12,27 +12,20 @@ Text editor operation to excise the selection to a new tiddler
|
|||||||
/*global $tw: false */
|
/*global $tw: false */
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
function isMarkdown(mediaType) {
|
|
||||||
return mediaType === 'text/markdown' || mediaType === 'text/x-markdown';
|
|
||||||
}
|
|
||||||
|
|
||||||
exports["excise"] = function(event,operation) {
|
exports["excise"] = function(event,operation) {
|
||||||
var editTiddler = this.wiki.getTiddler(this.editTitle),
|
var editTiddler = this.wiki.getTiddler(this.editTitle),
|
||||||
editTiddlerTitle = this.editTitle,
|
editTiddlerTitle = this.editTitle;
|
||||||
wikiLinks = !isMarkdown(editTiddler.fields.type),
|
|
||||||
excisionBaseTitle = $tw.language.getString("Buttons/Excise/DefaultTitle");
|
|
||||||
if(editTiddler && editTiddler.fields["draft.of"]) {
|
if(editTiddler && editTiddler.fields["draft.of"]) {
|
||||||
editTiddlerTitle = editTiddler.fields["draft.of"];
|
editTiddlerTitle = editTiddler.fields["draft.of"];
|
||||||
}
|
}
|
||||||
var excisionTitle = event.paramObject.title || this.wiki.generateNewTitle(excisionBaseTitle);
|
var excisionTitle = event.paramObject.title || this.wiki.generateNewTitle("New Excision");
|
||||||
this.wiki.addTiddler(new $tw.Tiddler(
|
this.wiki.addTiddler(new $tw.Tiddler(
|
||||||
this.wiki.getCreationFields(),
|
this.wiki.getCreationFields(),
|
||||||
this.wiki.getModificationFields(),
|
this.wiki.getModificationFields(),
|
||||||
{
|
{
|
||||||
title: excisionTitle,
|
title: excisionTitle,
|
||||||
text: operation.selection,
|
text: operation.selection,
|
||||||
tags: event.paramObject.tagnew === "yes" ? [editTiddlerTitle] : [],
|
tags: event.paramObject.tagnew === "yes" ? [editTiddlerTitle] : []
|
||||||
type: editTiddler.fields.type
|
|
||||||
}
|
}
|
||||||
));
|
));
|
||||||
operation.replacement = excisionTitle;
|
operation.replacement = excisionTitle;
|
||||||
@ -41,8 +34,7 @@ exports["excise"] = function(event,operation) {
|
|||||||
operation.replacement = "{{" + operation.replacement+ "}}";
|
operation.replacement = "{{" + operation.replacement+ "}}";
|
||||||
break;
|
break;
|
||||||
case "link":
|
case "link":
|
||||||
operation.replacement = wikiLinks ? "[[" + operation.replacement+ "]]"
|
operation.replacement = "[[" + operation.replacement+ "]]";
|
||||||
: ("[" + operation.replacement + "](<#" + operation.replacement + ">)");
|
|
||||||
break;
|
break;
|
||||||
case "macro":
|
case "macro":
|
||||||
operation.replacement = "<<" + (event.paramObject.macro || "translink") + " \"\"\"" + operation.replacement + "\"\"\">>";
|
operation.replacement = "<<" + (event.paramObject.macro || "translink") + " \"\"\"" + operation.replacement + "\"\"\">>";
|
||||||
|
@ -13,125 +13,37 @@ Text editor operation to wrap the selection with the specified prefix and suffix
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
exports["wrap-selection"] = function(event,operation) {
|
exports["wrap-selection"] = function(event,operation) {
|
||||||
var o = operation,
|
if(operation.selStart === operation.selEnd) {
|
||||||
prefix = event.paramObject.prefix,
|
// No selection; check if we're within the prefix/suffix
|
||||||
suffix = event.paramObject.suffix,
|
if(operation.text.substring(operation.selStart - event.paramObject.prefix.length,operation.selStart + event.paramObject.suffix.length) === event.paramObject.prefix + event.paramObject.suffix) {
|
||||||
trimSelection = event.paramObject.trimSelection || "no",
|
|
||||||
selLength = o.selEnd - o.selStart;
|
|
||||||
|
|
||||||
// This function detects, if trailing spaces are part of the selection __and__ if the user wants to handle them
|
|
||||||
// Returns "yes", "start", "end", "no" (default)
|
|
||||||
// yes .. there are trailing spaces at both ends
|
|
||||||
// start .. there are trailing spaces at the start
|
|
||||||
// end .. there are trailing spaces at the end
|
|
||||||
// no .. no trailing spaces are taken into account
|
|
||||||
var trailingSpaceAt = function(sel) {
|
|
||||||
var _start,
|
|
||||||
_end,
|
|
||||||
result;
|
|
||||||
// trimSelection is a user parameter, which this evaluations takes into account
|
|
||||||
switch(trimSelection) {
|
|
||||||
case "end":
|
|
||||||
result = (sel.trimEnd().length !== selLength) ? "end" : "no";
|
|
||||||
break;
|
|
||||||
case "yes":
|
|
||||||
_start = sel.trimStart().length !== selLength;
|
|
||||||
_end = sel.trimEnd().length !== selLength;
|
|
||||||
result = (_start && _end) ? "yes" : (_start) ? "start" : (_end) ? "end" : "no";
|
|
||||||
break;
|
|
||||||
case "start":
|
|
||||||
result = (sel.trimStart().length !== selLength) ? "start" : "no";
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
result = "no";
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
function togglePrefixSuffix() {
|
|
||||||
if(o.text.substring(o.selStart - prefix.length, o.selStart + suffix.length) === prefix + suffix) {
|
|
||||||
// Remove the prefix and suffix
|
// Remove the prefix and suffix
|
||||||
o.cutStart = o.selStart - prefix.length;
|
operation.cutStart = operation.selStart - event.paramObject.prefix.length;
|
||||||
o.cutEnd = o.selEnd + suffix.length;
|
operation.cutEnd = operation.selEnd + event.paramObject.suffix.length;
|
||||||
o.replacement = "";
|
operation.replacement = "";
|
||||||
o.newSelStart = o.cutStart;
|
operation.newSelStart = operation.cutStart;
|
||||||
o.newSelEnd = o.newSelStart;
|
operation.newSelEnd = operation.newSelStart;
|
||||||
} else {
|
} else {
|
||||||
// Wrap the cursor instead
|
// Wrap the cursor instead
|
||||||
o.cutStart = o.selStart;
|
operation.cutStart = operation.selStart;
|
||||||
o.cutEnd = o.selEnd;
|
operation.cutEnd = operation.selEnd;
|
||||||
o.replacement = prefix + suffix;
|
operation.replacement = event.paramObject.prefix + event.paramObject.suffix;
|
||||||
o.newSelStart = o.selStart + prefix.length;
|
operation.newSelStart = operation.selStart + event.paramObject.prefix.length;
|
||||||
o.newSelEnd = o.newSelStart;
|
operation.newSelEnd = operation.newSelStart;
|
||||||
}
|
}
|
||||||
}
|
} else if(operation.text.substring(operation.selStart,operation.selStart + event.paramObject.prefix.length) === event.paramObject.prefix && operation.text.substring(operation.selEnd - event.paramObject.suffix.length,operation.selEnd) === event.paramObject.suffix) {
|
||||||
|
|
||||||
// options: lenPrefix, lenSuffix
|
|
||||||
function removePrefixSuffix(options) {
|
|
||||||
options = options || {};
|
|
||||||
var _lenPrefix = options.lenPrefix || 0;
|
|
||||||
var _lenSuffix = options.lenSuffix || 0;
|
|
||||||
|
|
||||||
o.cutStart = o.selStart - _lenPrefix;
|
|
||||||
o.cutEnd = o.selEnd + _lenSuffix;
|
|
||||||
o.replacement = (_lenPrefix || _lenSuffix) ? o.selection : o.selection.substring(prefix.length, o.selection.length - suffix.length);
|
|
||||||
o.newSelStart = o.cutStart;
|
|
||||||
o.newSelEnd = o.cutStart + o.replacement.length;
|
|
||||||
}
|
|
||||||
|
|
||||||
function addPrefixSuffix() {
|
|
||||||
// remove trailing space if requested
|
|
||||||
switch(trailingSpaceAt(o.selection)) {
|
|
||||||
case "no":
|
|
||||||
// has no trailing spaces
|
|
||||||
o.cutStart = o.selStart;
|
|
||||||
o.cutEnd = o.selEnd;
|
|
||||||
o.replacement = prefix + o.selection + suffix;
|
|
||||||
o.newSelStart = o.selStart;
|
|
||||||
o.newSelEnd = o.selStart + o.replacement.length;
|
|
||||||
break;
|
|
||||||
case "yes":
|
|
||||||
// handle both ends
|
|
||||||
o.cutStart = o.selEnd - (o.selection.trimStart().length);
|
|
||||||
o.cutEnd = o.selection.trimEnd().length + o.selStart;
|
|
||||||
o.replacement = prefix + o.selection.trim() + suffix;
|
|
||||||
o.newSelStart = o.cutStart;
|
|
||||||
o.newSelEnd = o.cutStart + o.replacement.length;
|
|
||||||
break;
|
|
||||||
case "start":
|
|
||||||
// handle leading
|
|
||||||
o.cutStart = o.selEnd - (o.selection.trimStart().length);
|
|
||||||
o.cutEnd = o.selEnd;
|
|
||||||
o.replacement = prefix + o.selection.trimStart() + suffix;
|
|
||||||
o.newSelStart = o.cutStart;
|
|
||||||
o.newSelEnd = o.cutStart + o.replacement.length;
|
|
||||||
break;
|
|
||||||
case "end":
|
|
||||||
// handle trailing
|
|
||||||
o.cutStart = o.selStart;
|
|
||||||
o.cutEnd = o.selection.trimEnd().length + o.selStart;
|
|
||||||
o.replacement = prefix + o.selection.trimEnd() + suffix;
|
|
||||||
o.newSelStart = o.selStart;
|
|
||||||
o.newSelEnd = o.selStart + o.replacement.length;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(o.selStart === o.selEnd) {
|
|
||||||
// No selection; Create prefix and suffix. Set cursor in between them: ""|""
|
|
||||||
togglePrefixSuffix();
|
|
||||||
} else if(o.text.substring(o.selStart, o.selStart + prefix.length) === prefix &&
|
|
||||||
o.text.substring(o.selEnd - suffix.length,o.selEnd) === suffix) {
|
|
||||||
// Prefix and suffix are already present, so remove them
|
// Prefix and suffix are already present, so remove them
|
||||||
removePrefixSuffix();
|
operation.cutStart = operation.selStart;
|
||||||
} else if(o.text.substring(o.selStart - prefix.length, o.selStart) === prefix &&
|
operation.cutEnd = operation.selEnd;
|
||||||
o.text.substring(o.selEnd, o.selEnd + suffix.length) === suffix) {
|
operation.replacement = operation.selection.substring(event.paramObject.prefix.length,operation.selection.length - event.paramObject.suffix.length);
|
||||||
// Prefix and suffix are present BUT not selected -> remove them
|
operation.newSelStart = operation.selStart;
|
||||||
removePrefixSuffix({"lenPrefix": prefix.length, "lenSuffix": suffix.length});
|
operation.newSelEnd = operation.selStart + operation.replacement.length;
|
||||||
} else {
|
} else {
|
||||||
// Add the prefix and suffix
|
// Add the prefix and suffix
|
||||||
addPrefixSuffix();
|
operation.cutStart = operation.selStart;
|
||||||
|
operation.cutEnd = operation.selEnd;
|
||||||
|
operation.replacement = event.paramObject.prefix + operation.selection + event.paramObject.suffix;
|
||||||
|
operation.newSelStart = operation.selStart;
|
||||||
|
operation.newSelEnd = operation.selStart + operation.replacement.length;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -28,8 +28,12 @@ function getAllFilterOperators() {
|
|||||||
Export our filter function
|
Export our filter function
|
||||||
*/
|
*/
|
||||||
exports.all = function(source,operator,options) {
|
exports.all = function(source,operator,options) {
|
||||||
|
// Get our suboperators
|
||||||
|
var allFilterOperators = getAllFilterOperators();
|
||||||
|
// Cycle through the suboperators accumulating their results
|
||||||
|
var results = new $tw.utils.LinkedList(),
|
||||||
|
subops = operator.operand.split("+");
|
||||||
// Check for common optimisations
|
// Check for common optimisations
|
||||||
var subops = operator.operand.split("+");
|
|
||||||
if(subops.length === 1 && subops[0] === "") {
|
if(subops.length === 1 && subops[0] === "") {
|
||||||
return source;
|
return source;
|
||||||
} else if(subops.length === 1 && subops[0] === "tiddlers") {
|
} else if(subops.length === 1 && subops[0] === "tiddlers") {
|
||||||
@ -42,10 +46,6 @@ exports.all = function(source,operator,options) {
|
|||||||
return options.wiki.eachShadowPlusTiddlers;
|
return options.wiki.eachShadowPlusTiddlers;
|
||||||
}
|
}
|
||||||
// Do it the hard way
|
// Do it the hard way
|
||||||
// Get our suboperators
|
|
||||||
var allFilterOperators = getAllFilterOperators();
|
|
||||||
// Cycle through the suboperators accumulating their results
|
|
||||||
var results = new $tw.utils.LinkedList();
|
|
||||||
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) {
|
||||||
|
@ -1,26 +0,0 @@
|
|||||||
/*\
|
|
||||||
title: $:/core/modules/filters/backtranscludes.js
|
|
||||||
type: application/javascript
|
|
||||||
module-type: filteroperator
|
|
||||||
|
|
||||||
Filter operator for returning all the backtranscludes from a tiddler
|
|
||||||
|
|
||||||
\*/
|
|
||||||
(function(){
|
|
||||||
|
|
||||||
/*jslint node: true, browser: true */
|
|
||||||
/*global $tw: false */
|
|
||||||
"use strict";
|
|
||||||
|
|
||||||
/*
|
|
||||||
Export our filter function
|
|
||||||
*/
|
|
||||||
exports.backtranscludes = function(source,operator,options) {
|
|
||||||
var results = new $tw.utils.LinkedList();
|
|
||||||
source(function(tiddler,title) {
|
|
||||||
results.pushTop(options.wiki.getTiddlerBacktranscludes(title));
|
|
||||||
});
|
|
||||||
return results.makeTiddlerIterator(options.wiki);
|
|
||||||
};
|
|
||||||
|
|
||||||
})();
|
|
@ -14,9 +14,12 @@ Filter operators for cryptography, using the Stanford JavaScript library
|
|||||||
|
|
||||||
exports.sha256 = function(source,operator,options) {
|
exports.sha256 = function(source,operator,options) {
|
||||||
var results = [],
|
var results = [],
|
||||||
length = parseInt(operator.operand,10) || 20;
|
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) {
|
source(function(tiddler,title) {
|
||||||
results.push($tw.utils.sha256(title,{length: length}));
|
results.push(sha256(title));
|
||||||
});
|
});
|
||||||
return results;
|
return results;
|
||||||
};
|
};
|
||||||
|
@ -18,20 +18,16 @@ Export our filter functions
|
|||||||
|
|
||||||
exports.decodebase64 = function(source,operator,options) {
|
exports.decodebase64 = function(source,operator,options) {
|
||||||
var results = [];
|
var results = [];
|
||||||
var binary = operator.suffixes && operator.suffixes[0].indexOf("binary") !== -1;
|
|
||||||
var urlsafe = operator.suffixes && operator.suffixes[0].indexOf("urlsafe") !== -1;
|
|
||||||
source(function(tiddler,title) {
|
source(function(tiddler,title) {
|
||||||
results.push($tw.utils.base64Decode(title,binary,urlsafe));
|
results.push($tw.utils.base64Decode(title));
|
||||||
});
|
});
|
||||||
return results;
|
return results;
|
||||||
};
|
};
|
||||||
|
|
||||||
exports.encodebase64 = function(source,operator,options) {
|
exports.encodebase64 = function(source,operator,options) {
|
||||||
var results = [];
|
var results = [];
|
||||||
var binary = operator.suffixes && operator.suffixes[0].indexOf("binary") !== -1;
|
|
||||||
var urlsafe = operator.suffixes && operator.suffixes[0].indexOf("urlsafe") !== -1;
|
|
||||||
source(function(tiddler,title) {
|
source(function(tiddler,title) {
|
||||||
results.push($tw.utils.base64Encode(title,binary,urlsafe));
|
results.push($tw.utils.base64Encode(title));
|
||||||
});
|
});
|
||||||
return results;
|
return results;
|
||||||
};
|
};
|
||||||
|
@ -68,54 +68,6 @@ exports["jsontype"] = function(source,operator,options) {
|
|||||||
return results;
|
return results;
|
||||||
};
|
};
|
||||||
|
|
||||||
exports["jsonset"] = function(source,operator,options) {
|
|
||||||
var suffixes = operator.suffixes || [],
|
|
||||||
type = suffixes[0] && suffixes[0][0],
|
|
||||||
indexes = operator.operands.slice(0,-1),
|
|
||||||
value = operator.operands[operator.operands.length - 1],
|
|
||||||
results = [];
|
|
||||||
if(operator.operands.length === 1 && operator.operands[0] === "") {
|
|
||||||
value = undefined; // Prevents the value from being assigned
|
|
||||||
}
|
|
||||||
switch(type) {
|
|
||||||
case "string":
|
|
||||||
// Use value unchanged
|
|
||||||
break;
|
|
||||||
case "boolean":
|
|
||||||
value = (value === "true" ? true : (value === "false" ? false : undefined));
|
|
||||||
break;
|
|
||||||
case "number":
|
|
||||||
value = $tw.utils.parseNumber(value);
|
|
||||||
break;
|
|
||||||
case "array":
|
|
||||||
indexes = operator.operands;
|
|
||||||
value = [];
|
|
||||||
break;
|
|
||||||
case "object":
|
|
||||||
indexes = operator.operands;
|
|
||||||
value = {};
|
|
||||||
break;
|
|
||||||
case "null":
|
|
||||||
indexes = operator.operands;
|
|
||||||
value = null;
|
|
||||||
break;
|
|
||||||
case "json":
|
|
||||||
value = $tw.utils.parseJSONSafe(value,function() {return undefined;});
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
// Use value unchanged
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
source(function(tiddler,title) {
|
|
||||||
var data = $tw.utils.parseJSONSafe(title,title);
|
|
||||||
if(data) {
|
|
||||||
data = setDataItem(data,indexes,value);
|
|
||||||
results.push(JSON.stringify(data));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
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
|
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
|
||||||
*/
|
*/
|
||||||
@ -213,18 +165,6 @@ function getDataItemType(data,indexes) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function getItemAtIndex(item,index) {
|
|
||||||
if($tw.utils.hop(item,index)) {
|
|
||||||
return item[index];
|
|
||||||
} else if($tw.utils.isArray(item)) {
|
|
||||||
index = $tw.utils.parseInt(index);
|
|
||||||
if(index < 0) { index = index + item.length };
|
|
||||||
return item[index]; // Will be undefined if index was out-of-bounds
|
|
||||||
} else {
|
|
||||||
return undefined;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
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
|
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
|
||||||
*/
|
*/
|
||||||
@ -237,7 +177,7 @@ function getDataItem(data,indexes) {
|
|||||||
for(var i=0; i<indexes.length; i++) {
|
for(var i=0; i<indexes.length; i++) {
|
||||||
if(item !== undefined) {
|
if(item !== undefined) {
|
||||||
if(item !== null && ["number","string","boolean"].indexOf(typeof item) === -1) {
|
if(item !== null && ["number","string","boolean"].indexOf(typeof item) === -1) {
|
||||||
item = getItemAtIndex(item,indexes[i]);
|
item = item[indexes[i]];
|
||||||
} else {
|
} else {
|
||||||
item = undefined;
|
item = undefined;
|
||||||
}
|
}
|
||||||
@ -246,39 +186,5 @@ function getDataItem(data,indexes) {
|
|||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
Given a JSON data structure, an array of index strings and a value, return the data structure with the value added at the end of the index chain. If any of the index strings are invalid then the JSON data structure is returned unmodified. If the root item is targetted then a different data object will be returned
|
|
||||||
*/
|
|
||||||
function setDataItem(data,indexes,value) {
|
|
||||||
// Ignore attempts to assign undefined
|
|
||||||
if(value === undefined) {
|
|
||||||
return data;
|
|
||||||
}
|
|
||||||
// Check for the root item
|
|
||||||
if(indexes.length === 0 || (indexes.length === 1 && indexes[0] === "")) {
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
// Traverse the JSON data structure using the index chain
|
|
||||||
var current = data;
|
|
||||||
for(var i = 0; i < indexes.length - 1; i++) {
|
|
||||||
current = getItemAtIndex(current,indexes[i]);
|
|
||||||
if(current === undefined) {
|
|
||||||
// Return the original JSON data structure if any of the index strings are invalid
|
|
||||||
return data;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// Add the value to the end of the index chain
|
|
||||||
var lastIndex = indexes[indexes.length - 1];
|
|
||||||
if($tw.utils.isArray(current)) {
|
|
||||||
lastIndex = $tw.utils.parseInt(lastIndex);
|
|
||||||
if(lastIndex < 0) { lastIndex = lastIndex + current.length };
|
|
||||||
}
|
|
||||||
// Only set indexes on objects and arrays
|
|
||||||
if(typeof current === "object") {
|
|
||||||
current[lastIndex] = value;
|
|
||||||
}
|
|
||||||
return data;
|
|
||||||
}
|
|
||||||
|
|
||||||
})();
|
})();
|
||||||
|
|
@ -58,7 +58,6 @@ Last entry/entries in list
|
|||||||
exports.last = function(source,operator,options) {
|
exports.last = function(source,operator,options) {
|
||||||
var count = $tw.utils.getInt(operator.operand,1),
|
var count = $tw.utils.getInt(operator.operand,1),
|
||||||
results = [];
|
results = [];
|
||||||
if(count === 0) return results;
|
|
||||||
source(function(tiddler,title) {
|
source(function(tiddler,title) {
|
||||||
results.push(title);
|
results.push(title);
|
||||||
});
|
});
|
||||||
|
@ -127,7 +127,7 @@ function diffPartsToChars(text1,text2,mode) {
|
|||||||
if(lineHash.hasOwnProperty ? lineHash.hasOwnProperty(line) : (lineHash[line] !== undefined)) {
|
if(lineHash.hasOwnProperty ? lineHash.hasOwnProperty(line) : (lineHash[line] !== undefined)) {
|
||||||
chars += String.fromCharCode(lineHash[line]);
|
chars += String.fromCharCode(lineHash[line]);
|
||||||
} else {
|
} else {
|
||||||
if(lineArrayLength == maxLines) {
|
if (lineArrayLength == maxLines) {
|
||||||
line = text.substring(lineStart);
|
line = text.substring(lineStart);
|
||||||
lineEnd = text.length;
|
lineEnd = text.length;
|
||||||
}
|
}
|
||||||
@ -217,10 +217,7 @@ exports.splitregexp = function(source,operator,options) {
|
|||||||
return ["RegExp error: " + ex];
|
return ["RegExp error: " + ex];
|
||||||
}
|
}
|
||||||
source(function(tiddler,title) {
|
source(function(tiddler,title) {
|
||||||
var parts = title.split(regExp).map(function(part){
|
Array.prototype.push.apply(result,title.split(regExp));
|
||||||
return part || ""; // make sure it's a string
|
|
||||||
});
|
|
||||||
Array.prototype.push.apply(result,parts);
|
|
||||||
});
|
});
|
||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
@ -267,7 +264,7 @@ exports.pad = function(source,operator,options) {
|
|||||||
} else {
|
} else {
|
||||||
var padString = "",
|
var padString = "",
|
||||||
padStringLength = targetLength - title.length;
|
padStringLength = targetLength - title.length;
|
||||||
while(padStringLength > padString.length) {
|
while (padStringLength > padString.length) {
|
||||||
padString += fill;
|
padString += fill;
|
||||||
}
|
}
|
||||||
//make sure we do not exceed the specified length
|
//make sure we do not exceed the specified length
|
||||||
|
@ -1,26 +0,0 @@
|
|||||||
/*\
|
|
||||||
title: $:/core/modules/filters/transcludes.js
|
|
||||||
type: application/javascript
|
|
||||||
module-type: filteroperator
|
|
||||||
|
|
||||||
Filter operator for returning all the transcludes from a tiddler
|
|
||||||
|
|
||||||
\*/
|
|
||||||
(function(){
|
|
||||||
|
|
||||||
/*jslint node: true, browser: true */
|
|
||||||
/*global $tw: false */
|
|
||||||
"use strict";
|
|
||||||
|
|
||||||
/*
|
|
||||||
Export our filter function
|
|
||||||
*/
|
|
||||||
exports.transcludes = function(source,operator,options) {
|
|
||||||
var results = new $tw.utils.LinkedList();
|
|
||||||
source(function(tiddler,title) {
|
|
||||||
results.pushTop(options.wiki.getTiddlerTranscludes(title));
|
|
||||||
});
|
|
||||||
return results.makeTiddlerIterator(options.wiki);
|
|
||||||
};
|
|
||||||
|
|
||||||
})();
|
|
@ -202,7 +202,7 @@ Extended filter operators to manipulate the current list.
|
|||||||
}
|
}
|
||||||
if(resultsIndex !== -1) {
|
if(resultsIndex !== -1) {
|
||||||
i = i + step;
|
i = i + step;
|
||||||
nextOperandIndex = (i < opLength ? i : i % opLength);
|
nextOperandIndex = (i < opLength ? i : i - opLength);
|
||||||
if(operands.length > 1) {
|
if(operands.length > 1) {
|
||||||
results.splice(resultsIndex,1,operands[nextOperandIndex]);
|
results.splice(resultsIndex,1,operands[nextOperandIndex]);
|
||||||
} else {
|
} else {
|
||||||
|
@ -1,122 +0,0 @@
|
|||||||
/*\
|
|
||||||
title: $:/core/modules/indexers/back-indexer.js
|
|
||||||
type: application/javascript
|
|
||||||
module-type: indexer
|
|
||||||
|
|
||||||
By parsing the tiddler text, indexes the tiddlers' back links, back transclusions, block level back links.
|
|
||||||
|
|
||||||
\*/
|
|
||||||
function BackIndexer(wiki) {
|
|
||||||
this.wiki = wiki;
|
|
||||||
}
|
|
||||||
|
|
||||||
BackIndexer.prototype.init = function() {
|
|
||||||
this.subIndexers = {
|
|
||||||
link: new BackSubIndexer(this,"extractLinks"),
|
|
||||||
transclude: new BackSubIndexer(this,"extractTranscludes"),
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
BackIndexer.prototype.rebuild = function() {
|
|
||||||
$tw.utils.each(this.subIndexers,function(subIndexer) {
|
|
||||||
subIndexer.rebuild();
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
BackIndexer.prototype.update = function(updateDescriptor) {
|
|
||||||
$tw.utils.each(this.subIndexers,function(subIndexer) {
|
|
||||||
subIndexer.update(updateDescriptor);
|
|
||||||
});
|
|
||||||
};
|
|
||||||
function BackSubIndexer(indexer,extractor) {
|
|
||||||
this.wiki = indexer.wiki;
|
|
||||||
this.indexer = indexer;
|
|
||||||
this.extractor = extractor;
|
|
||||||
/**
|
|
||||||
* {
|
|
||||||
* [target title, e.g. tiddler title being linked to]:
|
|
||||||
* {
|
|
||||||
* [source title, e.g. tiddler title that has link syntax in its text]: true
|
|
||||||
* }
|
|
||||||
* }
|
|
||||||
*/
|
|
||||||
this.index = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
BackSubIndexer.prototype.init = function() {
|
|
||||||
// lazy init until first lookup
|
|
||||||
this.index = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
BackSubIndexer.prototype._init = function() {
|
|
||||||
this.index = Object.create(null);
|
|
||||||
var self = this;
|
|
||||||
this.wiki.forEachTiddler(function(sourceTitle,tiddler) {
|
|
||||||
var newTargets = self._getTarget(tiddler);
|
|
||||||
$tw.utils.each(newTargets, function(target) {
|
|
||||||
if(!self.index[target]) {
|
|
||||||
self.index[target] = Object.create(null);
|
|
||||||
}
|
|
||||||
self.index[target][sourceTitle] = true;
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
BackSubIndexer.prototype.rebuild = function() {
|
|
||||||
this.index = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Get things that is being referenced in the text, e.g. tiddler names in the link syntax.
|
|
||||||
*/
|
|
||||||
BackSubIndexer.prototype._getTarget = function(tiddler) {
|
|
||||||
if(this.wiki.isBinaryTiddler(tiddler.fields.text)) {
|
|
||||||
return [];
|
|
||||||
}
|
|
||||||
var parser = this.wiki.parseText(tiddler.fields.type, tiddler.fields.text, {});
|
|
||||||
if(parser) {
|
|
||||||
return this.wiki[this.extractor](parser.tree, tiddler.fields.title);
|
|
||||||
}
|
|
||||||
return [];
|
|
||||||
}
|
|
||||||
|
|
||||||
BackSubIndexer.prototype.update = function(updateDescriptor) {
|
|
||||||
// lazy init/update until first lookup
|
|
||||||
if(!this.index) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
var newTargets = [],
|
|
||||||
oldTargets = [],
|
|
||||||
self = this;
|
|
||||||
if(updateDescriptor.old.exists) {
|
|
||||||
oldTargets = this._getTarget(updateDescriptor.old.tiddler);
|
|
||||||
}
|
|
||||||
if(updateDescriptor.new.exists) {
|
|
||||||
newTargets = this._getTarget(updateDescriptor.new.tiddler);
|
|
||||||
}
|
|
||||||
|
|
||||||
$tw.utils.each(oldTargets,function(target) {
|
|
||||||
if(self.index[target]) {
|
|
||||||
delete self.index[target][updateDescriptor.old.tiddler.fields.title];
|
|
||||||
}
|
|
||||||
});
|
|
||||||
$tw.utils.each(newTargets,function(target) {
|
|
||||||
if(!self.index[target]) {
|
|
||||||
self.index[target] = Object.create(null);
|
|
||||||
}
|
|
||||||
self.index[target][updateDescriptor.new.tiddler.fields.title] = true;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
BackSubIndexer.prototype.lookup = function(title) {
|
|
||||||
if(!this.index) {
|
|
||||||
this._init();
|
|
||||||
}
|
|
||||||
if(this.index[title]) {
|
|
||||||
return Object.keys(this.index[title]);
|
|
||||||
} else {
|
|
||||||
return [];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
exports.BackIndexer = BackIndexer;
|
|
86
core/modules/indexers/backlinks-index.js
Normal file
86
core/modules/indexers/backlinks-index.js
Normal file
@ -0,0 +1,86 @@
|
|||||||
|
/*\
|
||||||
|
title: $:/core/modules/indexers/backlinks-indexer.js
|
||||||
|
type: application/javascript
|
||||||
|
module-type: indexer
|
||||||
|
|
||||||
|
Indexes the tiddlers' backlinks
|
||||||
|
|
||||||
|
\*/
|
||||||
|
(function(){
|
||||||
|
|
||||||
|
/*jslint node: true, browser: true */
|
||||||
|
/*global modules: false */
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
|
||||||
|
function BacklinksIndexer(wiki) {
|
||||||
|
this.wiki = wiki;
|
||||||
|
}
|
||||||
|
|
||||||
|
BacklinksIndexer.prototype.init = function() {
|
||||||
|
this.index = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
BacklinksIndexer.prototype.rebuild = function() {
|
||||||
|
this.index = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
BacklinksIndexer.prototype._getLinks = function(tiddler) {
|
||||||
|
var parser = this.wiki.parseText(tiddler.fields.type, tiddler.fields.text, {});
|
||||||
|
if(parser) {
|
||||||
|
return this.wiki.extractLinks(parser.tree);
|
||||||
|
}
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
BacklinksIndexer.prototype.update = function(updateDescriptor) {
|
||||||
|
if(!this.index) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var newLinks = [],
|
||||||
|
oldLinks = [],
|
||||||
|
self = this;
|
||||||
|
if(updateDescriptor.old.exists) {
|
||||||
|
oldLinks = this._getLinks(updateDescriptor.old.tiddler);
|
||||||
|
}
|
||||||
|
if(updateDescriptor.new.exists) {
|
||||||
|
newLinks = this._getLinks(updateDescriptor.new.tiddler);
|
||||||
|
}
|
||||||
|
|
||||||
|
$tw.utils.each(oldLinks,function(link) {
|
||||||
|
if(self.index[link]) {
|
||||||
|
delete self.index[link][updateDescriptor.old.tiddler.fields.title];
|
||||||
|
}
|
||||||
|
});
|
||||||
|
$tw.utils.each(newLinks,function(link) {
|
||||||
|
if(!self.index[link]) {
|
||||||
|
self.index[link] = Object.create(null);
|
||||||
|
}
|
||||||
|
self.index[link][updateDescriptor.new.tiddler.fields.title] = true;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
BacklinksIndexer.prototype.lookup = function(title) {
|
||||||
|
if(!this.index) {
|
||||||
|
this.index = Object.create(null);
|
||||||
|
var self = this;
|
||||||
|
this.wiki.forEachTiddler(function(title,tiddler) {
|
||||||
|
var links = self._getLinks(tiddler);
|
||||||
|
$tw.utils.each(links, function(link) {
|
||||||
|
if(!self.index[link]) {
|
||||||
|
self.index[link] = Object.create(null);
|
||||||
|
}
|
||||||
|
self.index[link][title] = true;
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if(this.index[title]) {
|
||||||
|
return Object.keys(this.index[title]);
|
||||||
|
} else {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
exports.BacklinksIndexer = BacklinksIndexer;
|
||||||
|
|
||||||
|
})();
|
@ -35,11 +35,9 @@ exports.run = function(filter,format) {
|
|||||||
// Collect all the fields
|
// Collect all the fields
|
||||||
for(t=0;t<tiddlers.length; t++) {
|
for(t=0;t<tiddlers.length; t++) {
|
||||||
tiddler = this.wiki.getTiddler(tiddlers[t]);
|
tiddler = this.wiki.getTiddler(tiddlers[t]);
|
||||||
if(tiddler) {
|
for(f in tiddler.fields) {
|
||||||
for(f in tiddler.fields) {
|
if(fields.indexOf(f) === -1) {
|
||||||
if(fields.indexOf(f) === -1) {
|
fields.push(f);
|
||||||
fields.push(f);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -62,10 +60,8 @@ exports.run = function(filter,format) {
|
|||||||
for(var t=0;t<tiddlers.length; t++) {
|
for(var t=0;t<tiddlers.length; t++) {
|
||||||
row = [];
|
row = [];
|
||||||
tiddler = this.wiki.getTiddler(tiddlers[t]);
|
tiddler = this.wiki.getTiddler(tiddlers[t]);
|
||||||
if(tiddler) {
|
for(f=0; f<fields.length; f++) {
|
||||||
for(f=0; f<fields.length; f++) {
|
row.push(quoteAndEscape(tiddler ? tiddler.getFieldString(fields[f]) || "" : ""));
|
||||||
row.push(quoteAndEscape(tiddler ? tiddler.getFieldString(fields[f]) || "" : ""));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
output.push(row.join(","));
|
output.push(row.join(","));
|
||||||
}
|
}
|
||||||
|
@ -16,22 +16,20 @@ exports.name = "unusedtitle";
|
|||||||
exports.params = [
|
exports.params = [
|
||||||
{name: "baseName"},
|
{name: "baseName"},
|
||||||
{name: "separator"},
|
{name: "separator"},
|
||||||
{name: "template"},
|
{name: "template"}
|
||||||
{name: "startCount"}
|
|
||||||
];
|
];
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Run the macro
|
Run the macro
|
||||||
*/
|
*/
|
||||||
exports.run = function(baseName,separator,template,startCount) {
|
exports.run = function(baseName,separator,template) {
|
||||||
separator = separator || " ";
|
separator = separator || " ";
|
||||||
startCount = startCount || 0;
|
|
||||||
if(!baseName) {
|
if(!baseName) {
|
||||||
baseName = $tw.language.getString("DefaultNewTiddlerTitle");
|
baseName = $tw.language.getString("DefaultNewTiddlerTitle");
|
||||||
}
|
}
|
||||||
// $tw.wiki.generateNewTitle = function(baseTitle,options)
|
// $tw.wiki.generateNewTitle = function(baseTitle,options)
|
||||||
// options.prefix must be a string!
|
// options.prefix must be a string!
|
||||||
return this.wiki.generateNewTitle(baseName, {"prefix": separator, "template": template, "startCount": startCount});
|
return this.wiki.generateNewTitle(baseName, {"prefix": separator, "template": template});
|
||||||
};
|
};
|
||||||
|
|
||||||
})();
|
})();
|
||||||
|
@ -14,12 +14,10 @@ The plain text parser processes blocks of source text into a degenerate parse tr
|
|||||||
|
|
||||||
var TextParser = function(type,text,options) {
|
var TextParser = function(type,text,options) {
|
||||||
this.tree = [{
|
this.tree = [{
|
||||||
type: "genesis",
|
type: "codeblock",
|
||||||
attributes: {
|
attributes: {
|
||||||
$type: {name: "$type", type: "string", value: "$codeblock"},
|
code: {type: "string", value: text},
|
||||||
code: {name: "code", type: "string", value: text},
|
language: {type: "string", value: type}
|
||||||
language: {name: "language", type: "string", value: type},
|
|
||||||
$remappable: {name: "$remappable", type:"string", value: "no"}
|
|
||||||
}
|
}
|
||||||
}];
|
}];
|
||||||
this.source = text;
|
this.source = text;
|
||||||
@ -34,3 +32,4 @@ exports["text/css"] = TextParser;
|
|||||||
exports["application/x-tiddler-dictionary"] = TextParser;
|
exports["application/x-tiddler-dictionary"] = TextParser;
|
||||||
|
|
||||||
})();
|
})();
|
||||||
|
|
||||||
|
@ -29,16 +29,13 @@ exports.init = function(parser) {
|
|||||||
|
|
||||||
exports.parse = function() {
|
exports.parse = function() {
|
||||||
var reEnd = /(\r?\n```$)/mg;
|
var reEnd = /(\r?\n```$)/mg;
|
||||||
var languageStart = this.parser.pos + 3,
|
|
||||||
languageEnd = languageStart + this.match[1].length;
|
|
||||||
// Move past the match
|
// Move past the match
|
||||||
this.parser.pos = this.matchRegExp.lastIndex;
|
this.parser.pos = this.matchRegExp.lastIndex;
|
||||||
|
|
||||||
// Look for the end of the block
|
// Look for the end of the block
|
||||||
reEnd.lastIndex = this.parser.pos;
|
reEnd.lastIndex = this.parser.pos;
|
||||||
var match = reEnd.exec(this.parser.source),
|
var match = reEnd.exec(this.parser.source),
|
||||||
text,
|
text;
|
||||||
codeStart = this.parser.pos;
|
|
||||||
// Process the block
|
// Process the block
|
||||||
if(match) {
|
if(match) {
|
||||||
text = this.parser.source.substring(this.parser.pos,match.index);
|
text = this.parser.source.substring(this.parser.pos,match.index);
|
||||||
@ -51,8 +48,8 @@ exports.parse = function() {
|
|||||||
return [{
|
return [{
|
||||||
type: "codeblock",
|
type: "codeblock",
|
||||||
attributes: {
|
attributes: {
|
||||||
code: {type: "string", value: text, start: codeStart, end: this.parser.pos},
|
code: {type: "string", value: text},
|
||||||
language: {type: "string", value: this.match[1], start: languageStart, end: languageEnd}
|
language: {type: "string", value: this.match[1]}
|
||||||
}
|
}
|
||||||
}];
|
}];
|
||||||
};
|
};
|
||||||
|
@ -33,8 +33,7 @@ exports.parse = function() {
|
|||||||
// Look for the end marker
|
// Look for the end marker
|
||||||
reEnd.lastIndex = this.parser.pos;
|
reEnd.lastIndex = this.parser.pos;
|
||||||
var match = reEnd.exec(this.parser.source),
|
var match = reEnd.exec(this.parser.source),
|
||||||
text,
|
text;
|
||||||
start = this.parser.pos;
|
|
||||||
// Process the text
|
// Process the text
|
||||||
if(match) {
|
if(match) {
|
||||||
text = this.parser.source.substring(this.parser.pos,match.index);
|
text = this.parser.source.substring(this.parser.pos,match.index);
|
||||||
@ -48,9 +47,7 @@ exports.parse = function() {
|
|||||||
tag: "code",
|
tag: "code",
|
||||||
children: [{
|
children: [{
|
||||||
type: "text",
|
type: "text",
|
||||||
text: text,
|
text: text
|
||||||
start: start,
|
|
||||||
end: this.parser.pos
|
|
||||||
}]
|
}]
|
||||||
}];
|
}];
|
||||||
};
|
};
|
||||||
|
@ -1,120 +0,0 @@
|
|||||||
/*\
|
|
||||||
title: $:/core/modules/parsers/wikiparser/rules/conditional.js
|
|
||||||
type: application/javascript
|
|
||||||
module-type: wikirule
|
|
||||||
|
|
||||||
Conditional shortcut syntax
|
|
||||||
|
|
||||||
```
|
|
||||||
This is a <%if [{something}] %>Elephant<%elseif [{else}] %>Pelican<%else%>Crocodile<%endif%>
|
|
||||||
```
|
|
||||||
|
|
||||||
\*/
|
|
||||||
(function(){
|
|
||||||
|
|
||||||
/*jslint node: true, browser: true */
|
|
||||||
/*global $tw: false */
|
|
||||||
"use strict";
|
|
||||||
|
|
||||||
exports.name = "conditional";
|
|
||||||
exports.types = {inline: true, block: true};
|
|
||||||
|
|
||||||
exports.init = function(parser) {
|
|
||||||
this.parser = parser;
|
|
||||||
// Regexp to match
|
|
||||||
this.matchRegExp = /\<\%\s*if\s+/mg;
|
|
||||||
this.terminateIfRegExp = /\%\>/mg;
|
|
||||||
};
|
|
||||||
|
|
||||||
exports.findNextMatch = function(startPos) {
|
|
||||||
// Look for the next <%if shortcut
|
|
||||||
this.matchRegExp.lastIndex = startPos;
|
|
||||||
this.match = this.matchRegExp.exec(this.parser.source);
|
|
||||||
// If not found then return no match
|
|
||||||
if(!this.match) {
|
|
||||||
return undefined;
|
|
||||||
}
|
|
||||||
// Check for the next %>
|
|
||||||
this.terminateIfRegExp.lastIndex = this.match.index;
|
|
||||||
this.terminateIfMatch = this.terminateIfRegExp.exec(this.parser.source);
|
|
||||||
// If not found then return no match
|
|
||||||
if(!this.terminateIfMatch) {
|
|
||||||
return undefined;
|
|
||||||
}
|
|
||||||
// Return the position at which the construction was found
|
|
||||||
return this.match.index;
|
|
||||||
};
|
|
||||||
|
|
||||||
/*
|
|
||||||
Parse the most recent match
|
|
||||||
*/
|
|
||||||
exports.parse = function() {
|
|
||||||
// Get the filter condition
|
|
||||||
var filterCondition = this.parser.source.substring(this.match.index + this.match[0].length,this.terminateIfMatch.index);
|
|
||||||
// Advance the parser position to past the %>
|
|
||||||
this.parser.pos = this.terminateIfMatch.index + this.terminateIfMatch[0].length;
|
|
||||||
// Parse the if clause
|
|
||||||
return this.parseIfClause(filterCondition);
|
|
||||||
};
|
|
||||||
|
|
||||||
exports.parseIfClause = function(filterCondition) {
|
|
||||||
// Create the list widget
|
|
||||||
var listWidget = {
|
|
||||||
type: "list",
|
|
||||||
tag: "$list",
|
|
||||||
isBlock: this.is.block,
|
|
||||||
children: [
|
|
||||||
{
|
|
||||||
type: "list-template",
|
|
||||||
tag: "$list-template"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
type: "list-empty",
|
|
||||||
tag: "$list-empty"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
};
|
|
||||||
$tw.utils.addAttributeToParseTreeNode(listWidget,"filter",filterCondition);
|
|
||||||
$tw.utils.addAttributeToParseTreeNode(listWidget,"variable","condition");
|
|
||||||
$tw.utils.addAttributeToParseTreeNode(listWidget,"limit","1");
|
|
||||||
// Check for an immediately following double linebreak
|
|
||||||
var hasLineBreak = !!$tw.utils.parseTokenRegExp(this.parser.source,this.parser.pos,/([^\S\n\r]*\r?\n(?:[^\S\n\r]*\r?\n|$))/g);
|
|
||||||
// Parse the body looking for else or endif
|
|
||||||
var reEndString = "\\<\\%\\s*(endif)\\s*\\%\\>|\\<\\%\\s*(else)\\s*\\%\\>|\\<\\%\\s*(elseif)\\s+([\\s\\S]+?)\\%\\>",
|
|
||||||
ex;
|
|
||||||
if(hasLineBreak) {
|
|
||||||
ex = this.parser.parseBlocksTerminatedExtended(reEndString);
|
|
||||||
} else {
|
|
||||||
var reEnd = new RegExp(reEndString,"mg");
|
|
||||||
ex = this.parser.parseInlineRunTerminatedExtended(reEnd,{eatTerminator: true});
|
|
||||||
}
|
|
||||||
// Put the body into the list template
|
|
||||||
listWidget.children[0].children = ex.tree;
|
|
||||||
// Check for an else or elseif
|
|
||||||
if(ex.match) {
|
|
||||||
if(ex.match[1] === "endif") {
|
|
||||||
// Nothing to do if we just found an endif
|
|
||||||
} else if(ex.match[2] === "else") {
|
|
||||||
// Check for an immediately following double linebreak
|
|
||||||
hasLineBreak = !!$tw.utils.parseTokenRegExp(this.parser.source,this.parser.pos,/([^\S\n\r]*\r?\n(?:[^\S\n\r]*\r?\n|$))/g);
|
|
||||||
// If we found an else then we need to parse the body looking for the endif
|
|
||||||
var reEndString = "\\<\\%\\s*(endif)\\s*\\%\\>",
|
|
||||||
ex;
|
|
||||||
if(hasLineBreak) {
|
|
||||||
ex = this.parser.parseBlocksTerminatedExtended(reEndString);
|
|
||||||
} else {
|
|
||||||
var reEnd = new RegExp(reEndString,"mg");
|
|
||||||
ex = this.parser.parseInlineRunTerminatedExtended(reEnd,{eatTerminator: true});
|
|
||||||
}
|
|
||||||
// Put the parsed content inside the list empty template
|
|
||||||
listWidget.children[1].children = ex.tree;
|
|
||||||
} else if(ex.match[3] === "elseif") {
|
|
||||||
// Parse the elseif clause by reusing this parser, passing the new filter condition
|
|
||||||
listWidget.children[1].children = this.parseIfClause(ex.match[4]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// Return the parse tree node
|
|
||||||
return [listWidget];
|
|
||||||
};
|
|
||||||
|
|
||||||
})();
|
|
@ -31,7 +31,6 @@ exports.init = function(parser) {
|
|||||||
|
|
||||||
exports.parse = function() {
|
exports.parse = function() {
|
||||||
// Move past the match
|
// Move past the match
|
||||||
var start = this.parser.pos;
|
|
||||||
this.parser.pos = this.matchRegExp.lastIndex;
|
this.parser.pos = this.matchRegExp.lastIndex;
|
||||||
// Create the link unless it is suppressed
|
// Create the link unless it is suppressed
|
||||||
if(this.match[0].substr(0,1) === "~") {
|
if(this.match[0].substr(0,1) === "~") {
|
||||||
@ -47,7 +46,7 @@ exports.parse = function() {
|
|||||||
rel: {type: "string", value: "noopener noreferrer"}
|
rel: {type: "string", value: "noopener noreferrer"}
|
||||||
},
|
},
|
||||||
children: [{
|
children: [{
|
||||||
type: "text", text: this.match[0], start: start, end: this.parser.pos
|
type: "text", text: this.match[0]
|
||||||
}]
|
}]
|
||||||
}];
|
}];
|
||||||
}
|
}
|
||||||
|
@ -31,16 +31,6 @@ exports.init = function(parser) {
|
|||||||
|
|
||||||
exports.parse = function() {
|
exports.parse = function() {
|
||||||
// Move past the match
|
// Move past the match
|
||||||
var filterStart = this.parser.pos + 3;
|
|
||||||
var filterEnd = filterStart + this.match[1].length;
|
|
||||||
var toolTipStart = filterEnd + 1;
|
|
||||||
var toolTipEnd = toolTipStart + (this.match[2] ? this.match[2].length : 0);
|
|
||||||
var templateStart = toolTipEnd + 2;
|
|
||||||
var templateEnd = templateStart + (this.match[3] ? this.match[3].length : 0);
|
|
||||||
var styleStart = templateEnd + 2;
|
|
||||||
var styleEnd = styleStart + (this.match[4] ? this.match[4].length : 0);
|
|
||||||
var classesStart = styleEnd + 1;
|
|
||||||
var classesEnd = classesStart + (this.match[5] ? this.match[5].length : 0);
|
|
||||||
this.parser.pos = this.matchRegExp.lastIndex;
|
this.parser.pos = this.matchRegExp.lastIndex;
|
||||||
// Get the match details
|
// Get the match details
|
||||||
var filter = this.match[1],
|
var filter = this.match[1],
|
||||||
@ -52,21 +42,21 @@ exports.parse = function() {
|
|||||||
var node = {
|
var node = {
|
||||||
type: "list",
|
type: "list",
|
||||||
attributes: {
|
attributes: {
|
||||||
filter: {type: "string", value: filter, start: filterStart, end: filterEnd},
|
filter: {type: "string", value: filter}
|
||||||
},
|
},
|
||||||
isBlock: true
|
isBlock: true
|
||||||
};
|
};
|
||||||
if(tooltip) {
|
if(tooltip) {
|
||||||
node.attributes.tooltip = {type: "string", value: tooltip, start: toolTipStart, end: toolTipEnd};
|
node.attributes.tooltip = {type: "string", value: tooltip};
|
||||||
}
|
}
|
||||||
if(template) {
|
if(template) {
|
||||||
node.attributes.template = {type: "string", value: template, start: templateStart, end: templateEnd};
|
node.attributes.template = {type: "string", value: template};
|
||||||
}
|
}
|
||||||
if(style) {
|
if(style) {
|
||||||
node.attributes.style = {type: "string", value: style, start: styleStart, end: styleEnd};
|
node.attributes.style = {type: "string", value: style};
|
||||||
}
|
}
|
||||||
if(classes) {
|
if(classes) {
|
||||||
node.attributes.itemClass = {type: "string", value: classes.split(".").join(" "), start: classesStart, end: classesEnd};
|
node.attributes.itemClass = {type: "string", value: classes.split(".").join(" ")};
|
||||||
}
|
}
|
||||||
return [node];
|
return [node];
|
||||||
};
|
};
|
||||||
|
@ -30,16 +30,6 @@ exports.init = function(parser) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
exports.parse = function() {
|
exports.parse = function() {
|
||||||
var filterStart = this.parser.pos + 3;
|
|
||||||
var filterEnd = filterStart + this.match[1].length;
|
|
||||||
var toolTipStart = filterEnd + 1;
|
|
||||||
var toolTipEnd = toolTipStart + (this.match[2] ? this.match[2].length : 0);
|
|
||||||
var templateStart = toolTipEnd + 2;
|
|
||||||
var templateEnd = templateStart + (this.match[3] ? this.match[3].length : 0);
|
|
||||||
var styleStart = templateEnd + 2;
|
|
||||||
var styleEnd = styleStart + (this.match[4] ? this.match[4].length : 0);
|
|
||||||
var classesStart = styleEnd + 1;
|
|
||||||
var classesEnd = classesStart + (this.match[5] ? this.match[5].length : 0);
|
|
||||||
// Move past the match
|
// Move past the match
|
||||||
this.parser.pos = this.matchRegExp.lastIndex;
|
this.parser.pos = this.matchRegExp.lastIndex;
|
||||||
// Get the match details
|
// Get the match details
|
||||||
@ -52,20 +42,20 @@ exports.parse = function() {
|
|||||||
var node = {
|
var node = {
|
||||||
type: "list",
|
type: "list",
|
||||||
attributes: {
|
attributes: {
|
||||||
filter: {type: "string", value: filter, start: filterStart, end: filterEnd},
|
filter: {type: "string", value: filter}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
if(tooltip) {
|
if(tooltip) {
|
||||||
node.attributes.tooltip = {type: "string", value: tooltip, start: toolTipStart, end: toolTipEnd};
|
node.attributes.tooltip = {type: "string", value: tooltip};
|
||||||
}
|
}
|
||||||
if(template) {
|
if(template) {
|
||||||
node.attributes.template = {type: "string", value: template, start: templateStart, end: templateEnd};
|
node.attributes.template = {type: "string", value: template};
|
||||||
}
|
}
|
||||||
if(style) {
|
if(style) {
|
||||||
node.attributes.style = {type: "string", value: style, start: styleStart, end: styleEnd};
|
node.attributes.style = {type: "string", value: style};
|
||||||
}
|
}
|
||||||
if(classes) {
|
if(classes) {
|
||||||
node.attributes.itemClass = {type: "string", value: classes.split(".").join(" "), start: classesStart, end: classesEnd};
|
node.attributes.itemClass = {type: "string", value: classes.split(".").join(" ")};
|
||||||
}
|
}
|
||||||
return [node];
|
return [node];
|
||||||
};
|
};
|
||||||
|
@ -35,7 +35,7 @@ Instantiate parse rule
|
|||||||
exports.init = function(parser) {
|
exports.init = function(parser) {
|
||||||
this.parser = parser;
|
this.parser = parser;
|
||||||
// Regexp to match
|
// Regexp to match
|
||||||
this.matchRegExp = /\\(function|procedure|widget)\s+([^(\s]+)\((\s*([^)]*))?\)(\s*\r?\n)?/mg;
|
this.matchRegExp = /^\\(function|procedure|widget)\s+([^(\s]+)\((\s*([^)]*))?\)(\s*\r?\n)?/mg;
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -49,11 +49,11 @@ exports.parse = function() {
|
|||||||
if(this.match[3]) {
|
if(this.match[3]) {
|
||||||
params = $tw.utils.parseParameterDefinition(this.match[4]);
|
params = $tw.utils.parseParameterDefinition(this.match[4]);
|
||||||
}
|
}
|
||||||
// Is the remainder of the line blank after the parameter close paren?
|
// Is this a multiline definition?
|
||||||
var reEnd;
|
var reEnd;
|
||||||
if(this.match[5]) {
|
if(this.match[5]) {
|
||||||
// If so, it is a multiline definition and the end of the body is marked with \end
|
// If so, the end of the body is marked with \end
|
||||||
reEnd = new RegExp("((:?^|\\r?\\n)[^\\S\\n\\r]*\\\\end[^\\S\\n\\r]*(?:" + $tw.utils.escapeRegExp(this.match[2]) + ")?(?:$|\\r?\\n))","mg");
|
reEnd = new RegExp("(\\r?\\n\\\\end[^\\S\\n\\r]*(?:" + $tw.utils.escapeRegExp(this.match[2]) + ")?(?:$|\\r?\\n))","mg");
|
||||||
} else {
|
} else {
|
||||||
// Otherwise, the end of the definition is marked by the end of the line
|
// Otherwise, the end of the definition is marked by the end of the line
|
||||||
reEnd = /($|\r?\n)/mg;
|
reEnd = /($|\r?\n)/mg;
|
||||||
|
@ -45,11 +45,10 @@ exports.parse = function() {
|
|||||||
reEnd.lastIndex = this.parser.pos;
|
reEnd.lastIndex = this.parser.pos;
|
||||||
match = reEnd.exec(this.parser.source);
|
match = reEnd.exec(this.parser.source);
|
||||||
if(match) {
|
if(match) {
|
||||||
var start = this.parser.pos;
|
|
||||||
this.parser.pos = reEnd.lastIndex;
|
this.parser.pos = reEnd.lastIndex;
|
||||||
// Add a line break if the terminator was a line break
|
// Add a line break if the terminator was a line break
|
||||||
if(match[2]) {
|
if(match[2]) {
|
||||||
tree.push({type: "element", tag: "br", start: start, end: this.parser.pos});
|
tree.push({type: "element", tag: "br"});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} while(match && !match[1]);
|
} while(match && !match[1]);
|
||||||
|
@ -30,9 +30,7 @@ exports.parse = function() {
|
|||||||
// Move past the !s
|
// Move past the !s
|
||||||
this.parser.pos = this.matchRegExp.lastIndex;
|
this.parser.pos = this.matchRegExp.lastIndex;
|
||||||
// Parse any classes, whitespace and then the heading itself
|
// Parse any classes, whitespace and then the heading itself
|
||||||
var classStart = this.parser.pos;
|
|
||||||
var classes = this.parser.parseClasses();
|
var classes = this.parser.parseClasses();
|
||||||
var classEnd = this.parser.pos;
|
|
||||||
this.parser.skipWhitespace({treatNewlinesAsNonWhitespace: true});
|
this.parser.skipWhitespace({treatNewlinesAsNonWhitespace: true});
|
||||||
var tree = this.parser.parseInlineRun(/(\r?\n)/mg);
|
var tree = this.parser.parseInlineRun(/(\r?\n)/mg);
|
||||||
// Return the heading
|
// Return the heading
|
||||||
@ -40,7 +38,7 @@ exports.parse = function() {
|
|||||||
type: "element",
|
type: "element",
|
||||||
tag: "h" + headingLevel,
|
tag: "h" + headingLevel,
|
||||||
attributes: {
|
attributes: {
|
||||||
"class": {type: "string", value: classes.join(" "), start: classStart, end: classEnd}
|
"class": {type: "string", value: classes.join(" ")}
|
||||||
},
|
},
|
||||||
children: tree
|
children: tree
|
||||||
}];
|
}];
|
||||||
|
@ -44,10 +44,6 @@ Parse the most recent match
|
|||||||
exports.parse = function() {
|
exports.parse = function() {
|
||||||
// Retrieve the most recent match so that recursive calls don't overwrite it
|
// Retrieve the most recent match so that recursive calls don't overwrite it
|
||||||
var tag = this.nextTag;
|
var tag = this.nextTag;
|
||||||
if (!tag.isSelfClosing) {
|
|
||||||
tag.openTagStart = tag.start;
|
|
||||||
tag.openTagEnd = tag.end;
|
|
||||||
}
|
|
||||||
this.nextTag = null;
|
this.nextTag = null;
|
||||||
// Advance the parser position to past the tag
|
// Advance the parser position to past the tag
|
||||||
this.parser.pos = tag.end;
|
this.parser.pos = tag.end;
|
||||||
@ -64,27 +60,6 @@ exports.parse = function() {
|
|||||||
var reEnd = new RegExp("(" + reEndString + ")","mg");
|
var reEnd = new RegExp("(" + reEndString + ")","mg");
|
||||||
tag.children = this.parser.parseInlineRun(reEnd,{eatTerminator: true});
|
tag.children = this.parser.parseInlineRun(reEnd,{eatTerminator: true});
|
||||||
}
|
}
|
||||||
tag.end = this.parser.pos;
|
|
||||||
tag.closeTagEnd = tag.end;
|
|
||||||
if (tag.closeTagEnd === tag.openTagEnd || this.parser.source[tag.closeTagEnd - 1] !== '>') {
|
|
||||||
tag.closeTagStart = tag.end;
|
|
||||||
} else {
|
|
||||||
tag.closeTagStart = tag.closeTagEnd - 2;
|
|
||||||
var closeTagMinPos = tag.children.length > 0 ? tag.children[tag.children.length-1].end : tag.openTagEnd;
|
|
||||||
if (!Number.isSafeInteger(closeTagMinPos)) closeTagMinPos = tag.openTagEnd;
|
|
||||||
while (tag.closeTagStart >= closeTagMinPos) {
|
|
||||||
var char = this.parser.source[tag.closeTagStart];
|
|
||||||
if (char === '>') {
|
|
||||||
tag.closeTagStart = -1;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (char === '<') break;
|
|
||||||
tag.closeTagStart -= 1;
|
|
||||||
}
|
|
||||||
if (tag.closeTagStart < closeTagMinPos) {
|
|
||||||
tag.closeTagStart = tag.end;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
// Return the tag
|
// Return the tag
|
||||||
return [tag];
|
return [tag];
|
||||||
|
@ -122,9 +122,9 @@ exports.parseImage = function(source,pos) {
|
|||||||
}
|
}
|
||||||
pos = token.end;
|
pos = token.end;
|
||||||
if(token.match[1]) {
|
if(token.match[1]) {
|
||||||
node.attributes.tooltip = {type: "string", value: token.match[1].trim(),start: token.start,end:token.start + token.match[1].length - 1};
|
node.attributes.tooltip = {type: "string", value: token.match[1].trim()};
|
||||||
}
|
}
|
||||||
node.attributes.source = {type: "string", value: (token.match[2] || "").trim(), start: token.start + (token.match[1] ? token.match[1].length : 0), end: token.end - 2};
|
node.attributes.source = {type: "string", value: (token.match[2] || "").trim()};
|
||||||
// Update the end position
|
// Update the end position
|
||||||
node.end = pos;
|
node.end = pos;
|
||||||
return node;
|
return node;
|
||||||
|
@ -38,14 +38,13 @@ exports.parse = function() {
|
|||||||
// Parse the filter terminated by a line break
|
// Parse the filter terminated by a line break
|
||||||
var reMatch = /(.*)(?:$|\r?\n)/mg;
|
var reMatch = /(.*)(?:$|\r?\n)/mg;
|
||||||
reMatch.lastIndex = this.parser.pos;
|
reMatch.lastIndex = this.parser.pos;
|
||||||
var filterStart = this.parser.source;
|
|
||||||
var match = reMatch.exec(this.parser.source);
|
var match = reMatch.exec(this.parser.source);
|
||||||
this.parser.pos = reMatch.lastIndex;
|
this.parser.pos = reMatch.lastIndex;
|
||||||
// Parse tree nodes to return
|
// Parse tree nodes to return
|
||||||
return [{
|
return [{
|
||||||
type: "importvariables",
|
type: "importvariables",
|
||||||
attributes: {
|
attributes: {
|
||||||
filter: {type: "string", value: match[1], start: filterStart, end: this.parser.pos}
|
filter: {type: "string", value: match[1]}
|
||||||
},
|
},
|
||||||
children: []
|
children: []
|
||||||
}];
|
}];
|
||||||
|
@ -74,7 +74,6 @@ exports.parse = function() {
|
|||||||
// Match the list marker
|
// Match the list marker
|
||||||
var reMatch = /([\*#;:>]+)/mg;
|
var reMatch = /([\*#;:>]+)/mg;
|
||||||
reMatch.lastIndex = this.parser.pos;
|
reMatch.lastIndex = this.parser.pos;
|
||||||
var start = this.parser.pos;
|
|
||||||
var match = reMatch.exec(this.parser.source);
|
var match = reMatch.exec(this.parser.source);
|
||||||
if(!match || match.index !== this.parser.pos) {
|
if(!match || match.index !== this.parser.pos) {
|
||||||
break;
|
break;
|
||||||
@ -95,21 +94,9 @@ exports.parse = function() {
|
|||||||
}
|
}
|
||||||
// Construct the list element or reuse the previous one at this level
|
// Construct the list element or reuse the previous one at this level
|
||||||
if(listStack.length <= t) {
|
if(listStack.length <= t) {
|
||||||
var listElement = {
|
var listElement = {type: "element", tag: listInfo.listTag, children: [
|
||||||
type: "element",
|
{type: "element", tag: listInfo.itemTag, children: []}
|
||||||
tag: listInfo.listTag,
|
]};
|
||||||
children: [
|
|
||||||
{
|
|
||||||
type: "element",
|
|
||||||
tag: listInfo.itemTag,
|
|
||||||
children: [],
|
|
||||||
start: start,
|
|
||||||
end: this.parser.pos,
|
|
||||||
}
|
|
||||||
],
|
|
||||||
start: start,
|
|
||||||
end: this.parser.pos,
|
|
||||||
};
|
|
||||||
// Link this list element into the last child item of the parent list item
|
// Link this list element into the last child item of the parent list item
|
||||||
if(t) {
|
if(t) {
|
||||||
var prevListItem = listStack[t-1].children[listStack[t-1].children.length-1];
|
var prevListItem = listStack[t-1].children[listStack[t-1].children.length-1];
|
||||||
@ -118,33 +105,21 @@ exports.parse = function() {
|
|||||||
// Save this element in the stack
|
// Save this element in the stack
|
||||||
listStack[t] = listElement;
|
listStack[t] = listElement;
|
||||||
} else if(t === (match[0].length - 1)) {
|
} else if(t === (match[0].length - 1)) {
|
||||||
listStack[t].children.push({
|
listStack[t].children.push({type: "element", tag: listInfo.itemTag, children: []});
|
||||||
type: "element",
|
|
||||||
tag: listInfo.itemTag,
|
|
||||||
children: [],
|
|
||||||
start: start,
|
|
||||||
end: this.parser.pos,
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(listStack.length > match[0].length) {
|
if(listStack.length > match[0].length) {
|
||||||
listStack.splice(match[0].length,listStack.length - match[0].length);
|
listStack.splice(match[0].length,listStack.length - match[0].length);
|
||||||
}
|
}
|
||||||
// Process the body of the list item into the last list item
|
// Process the body of the list item into the last list item
|
||||||
var classStart = this.parser.pos;
|
|
||||||
var lastListChildren = listStack[listStack.length-1].children,
|
var lastListChildren = listStack[listStack.length-1].children,
|
||||||
lastListItem = lastListChildren[lastListChildren.length-1],
|
lastListItem = lastListChildren[lastListChildren.length-1],
|
||||||
classes = this.parser.parseClasses();
|
classes = this.parser.parseClasses();
|
||||||
var classEnd = this.parser.pos;
|
|
||||||
this.parser.skipWhitespace({treatNewlinesAsNonWhitespace: true});
|
this.parser.skipWhitespace({treatNewlinesAsNonWhitespace: true});
|
||||||
var tree = this.parser.parseInlineRun(/(\r?\n)/mg);
|
var tree = this.parser.parseInlineRun(/(\r?\n)/mg);
|
||||||
lastListItem.children.push.apply(lastListItem.children,tree);
|
lastListItem.children.push.apply(lastListItem.children,tree);
|
||||||
lastListItem.end = this.parser.pos;
|
|
||||||
listStack[listStack.length-1].end = this.parser.pos;
|
|
||||||
if(classes.length > 0) {
|
if(classes.length > 0) {
|
||||||
$tw.utils.addClassToParseTreeNode(lastListItem,classes.join(" "));
|
$tw.utils.addClassToParseTreeNode(lastListItem,classes.join(" "));
|
||||||
lastListItem.attributes.class.start = classStart;
|
|
||||||
lastListItem.attributes.class.end = classEnd;
|
|
||||||
}
|
}
|
||||||
// Consume any whitespace following the list item
|
// Consume any whitespace following the list item
|
||||||
this.parser.skipWhitespace();
|
this.parser.skipWhitespace();
|
||||||
|
@ -54,11 +54,11 @@ exports.parse = function() {
|
|||||||
paramMatch = reParam.exec(paramString);
|
paramMatch = reParam.exec(paramString);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Is the remainder of the \define line blank after the parameter close paren?
|
// Is this a multiline definition?
|
||||||
var reEnd;
|
var reEnd;
|
||||||
if(this.match[3]) {
|
if(this.match[3]) {
|
||||||
// If so, it is a multiline definition and the end of the body is marked with \end
|
// If so, the end of the body is marked with \end
|
||||||
reEnd = new RegExp("((?:^|\\r?\\n)[^\\S\\n\\r]*\\\\end[^\\S\\n\\r]*(?:" + $tw.utils.escapeRegExp(this.match[1]) + ")?(?:$|\\r?\\n))","mg");
|
reEnd = new RegExp("(\\r?\\n[^\\S\\n\\r]*\\\\end[^\\S\\n\\r]*(?:" + $tw.utils.escapeRegExp(this.match[1]) + ")?(?:$|\\r?\\n))","mg");
|
||||||
} else {
|
} else {
|
||||||
// Otherwise, the end of the definition is marked by the end of the line
|
// Otherwise, the end of the definition is marked by the end of the line
|
||||||
reEnd = /($|\r?\n)/mg;
|
reEnd = /($|\r?\n)/mg;
|
||||||
|
@ -26,7 +26,7 @@ Instantiate parse rule
|
|||||||
exports.init = function(parser) {
|
exports.init = function(parser) {
|
||||||
this.parser = parser;
|
this.parser = parser;
|
||||||
// Regexp to match
|
// Regexp to match
|
||||||
this.matchRegExp = /\\parameters\s*\(([^)]*)\)(\s*\r?\n)?/mg;
|
this.matchRegExp = /^\\parameters\s*\(([^)]*)\)(\s*\r?\n)?/mg;
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -96,20 +96,15 @@ exports.parseLink = function(source,pos) {
|
|||||||
splitPos = null;
|
splitPos = null;
|
||||||
}
|
}
|
||||||
// Pull out the tooltip and URL
|
// Pull out the tooltip and URL
|
||||||
var tooltip, URL, urlStart;
|
var tooltip, URL;
|
||||||
textNode.start = pos;
|
|
||||||
if(splitPos) {
|
if(splitPos) {
|
||||||
urlStart = splitPos + 1;
|
|
||||||
URL = source.substring(splitPos + 1,closePos).trim();
|
URL = source.substring(splitPos + 1,closePos).trim();
|
||||||
textNode.text = source.substring(pos,splitPos).trim();
|
textNode.text = source.substring(pos,splitPos).trim();
|
||||||
textNode.end = splitPos;
|
|
||||||
} else {
|
} else {
|
||||||
urlStart = pos;
|
|
||||||
URL = source.substring(pos,closePos).trim();
|
URL = source.substring(pos,closePos).trim();
|
||||||
textNode.text = URL;
|
textNode.text = URL;
|
||||||
textNode.end = closePos;
|
|
||||||
}
|
}
|
||||||
node.attributes.href = {type: "string", value: URL, start: urlStart, end: closePos};
|
node.attributes.href = {type: "string", value: URL};
|
||||||
node.attributes.target = {type: "string", value: "_blank"};
|
node.attributes.target = {type: "string", value: "_blank"};
|
||||||
node.attributes.rel = {type: "string", value: "noopener noreferrer"};
|
node.attributes.rel = {type: "string", value: "noopener noreferrer"};
|
||||||
// Update the end position
|
// Update the end position
|
||||||
|
@ -29,39 +29,32 @@ exports.init = function(parser) {
|
|||||||
|
|
||||||
exports.parse = function() {
|
exports.parse = function() {
|
||||||
// Move past the match
|
// Move past the match
|
||||||
var start = this.parser.pos + 2;
|
|
||||||
this.parser.pos = this.matchRegExp.lastIndex;
|
this.parser.pos = this.matchRegExp.lastIndex;
|
||||||
// Process the link
|
// Process the link
|
||||||
var text = this.match[1],
|
var text = this.match[1],
|
||||||
link = this.match[2] || text,
|
link = this.match[2] || text;
|
||||||
textEndPos = this.parser.source.indexOf("|", start);
|
|
||||||
if (textEndPos < 0 || textEndPos > this.matchRegExp.lastIndex) {
|
|
||||||
textEndPos = this.matchRegExp.lastIndex - 2;
|
|
||||||
}
|
|
||||||
var linkStart = this.match[2] ? (start + this.match[1].length + 1) : start;
|
|
||||||
var linkEnd = linkStart + link.length;
|
|
||||||
if($tw.utils.isLinkExternal(link)) {
|
if($tw.utils.isLinkExternal(link)) {
|
||||||
return [{
|
return [{
|
||||||
type: "element",
|
type: "element",
|
||||||
tag: "a",
|
tag: "a",
|
||||||
attributes: {
|
attributes: {
|
||||||
href: {type: "string", value: link, start: linkStart, end: linkEnd},
|
href: {type: "string", value: link},
|
||||||
"class": {type: "string", value: "tc-tiddlylink-external"},
|
"class": {type: "string", value: "tc-tiddlylink-external"},
|
||||||
target: {type: "string", value: "_blank"},
|
target: {type: "string", value: "_blank"},
|
||||||
rel: {type: "string", value: "noopener noreferrer"}
|
rel: {type: "string", value: "noopener noreferrer"}
|
||||||
},
|
},
|
||||||
children: [{
|
children: [{
|
||||||
type: "text", text: text, start: start, end: textEndPos
|
type: "text", text: text
|
||||||
}]
|
}]
|
||||||
}];
|
}];
|
||||||
} else {
|
} else {
|
||||||
return [{
|
return [{
|
||||||
type: "link",
|
type: "link",
|
||||||
attributes: {
|
attributes: {
|
||||||
to: {type: "string", value: link, start: linkStart, end: linkEnd}
|
to: {type: "string", value: link}
|
||||||
},
|
},
|
||||||
children: [{
|
children: [{
|
||||||
type: "text", text: text, start: start, end: textEndPos
|
type: "text", text: text
|
||||||
}]
|
}]
|
||||||
}];
|
}];
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,30 @@ title: $:/core/modules/parsers/wikiparser/rules/quoteblock.js
|
|||||||
type: application/javascript
|
type: application/javascript
|
||||||
module-type: wikirule
|
module-type: wikirule
|
||||||
|
|
||||||
Wiki text rule for quote blocks.
|
Wiki text rule for quote blocks. For example:
|
||||||
|
|
||||||
|
```
|
||||||
|
<<<.optionalClass(es) optional cited from
|
||||||
|
a quote
|
||||||
|
<<<
|
||||||
|
|
||||||
|
<<<.optionalClass(es)
|
||||||
|
a quote
|
||||||
|
<<< optional cited from
|
||||||
|
```
|
||||||
|
|
||||||
|
Quotes can be quoted by putting more <s
|
||||||
|
|
||||||
|
```
|
||||||
|
<<<
|
||||||
|
Quote Level 1
|
||||||
|
|
||||||
|
<<<<
|
||||||
|
QuoteLevel 2
|
||||||
|
<<<<
|
||||||
|
|
||||||
|
<<<
|
||||||
|
```
|
||||||
|
|
||||||
\*/
|
\*/
|
||||||
(function(){
|
(function(){
|
||||||
@ -24,42 +47,33 @@ exports.init = function(parser) {
|
|||||||
exports.parse = function() {
|
exports.parse = function() {
|
||||||
var classes = ["tc-quote"];
|
var classes = ["tc-quote"];
|
||||||
// Get all the details of the match
|
// Get all the details of the match
|
||||||
var reEndString = "^\\s*" + this.match[1] + "(?!<)";
|
var reEndString = "^" + this.match[1] + "(?!<)";
|
||||||
// Move past the <s
|
// Move past the <s
|
||||||
this.parser.pos = this.matchRegExp.lastIndex;
|
this.parser.pos = this.matchRegExp.lastIndex;
|
||||||
|
|
||||||
// Parse any classes, whitespace and then the optional cite itself
|
// Parse any classes, whitespace and then the optional cite itself
|
||||||
var classStart = this.parser.pos;
|
|
||||||
classes.push.apply(classes, this.parser.parseClasses());
|
classes.push.apply(classes, this.parser.parseClasses());
|
||||||
var classEnd = this.parser.pos;
|
|
||||||
this.parser.skipWhitespace({treatNewlinesAsNonWhitespace: true});
|
this.parser.skipWhitespace({treatNewlinesAsNonWhitespace: true});
|
||||||
var citeStart = this.parser.pos;
|
|
||||||
var cite = this.parser.parseInlineRun(/(\r?\n)/mg);
|
var cite = this.parser.parseInlineRun(/(\r?\n)/mg);
|
||||||
var citeEnd = this.parser.pos;
|
|
||||||
// before handling the cite, parse the body of the quote
|
// before handling the cite, parse the body of the quote
|
||||||
var tree = this.parser.parseBlocks(reEndString);
|
var tree= this.parser.parseBlocks(reEndString);
|
||||||
// If we got a cite, put it before the text
|
// If we got a cite, put it before the text
|
||||||
if(cite.length > 0) {
|
if(cite.length > 0) {
|
||||||
tree.unshift({
|
tree.unshift({
|
||||||
type: "element",
|
type: "element",
|
||||||
tag: "cite",
|
tag: "cite",
|
||||||
children: cite,
|
children: cite
|
||||||
start: citeStart,
|
|
||||||
end: citeEnd
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
// Parse any optional cite
|
// Parse any optional cite
|
||||||
this.parser.skipWhitespace({treatNewlinesAsNonWhitespace: true});
|
this.parser.skipWhitespace({treatNewlinesAsNonWhitespace: true});
|
||||||
citeStart = this.parser.pos;
|
|
||||||
cite = this.parser.parseInlineRun(/(\r?\n)/mg);
|
cite = this.parser.parseInlineRun(/(\r?\n)/mg);
|
||||||
citeEnd = this.parser.pos;
|
|
||||||
// If we got a cite, push it
|
// If we got a cite, push it
|
||||||
if(cite.length > 0) {
|
if(cite.length > 0) {
|
||||||
tree.push({
|
tree.push({
|
||||||
type: "element",
|
type: "element",
|
||||||
tag: "cite",
|
tag: "cite",
|
||||||
children: cite,
|
children: cite
|
||||||
start: citeStart,
|
|
||||||
end: citeEnd
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
// Return the blockquote element
|
// Return the blockquote element
|
||||||
@ -67,7 +81,7 @@ exports.parse = function() {
|
|||||||
type: "element",
|
type: "element",
|
||||||
tag: "blockquote",
|
tag: "blockquote",
|
||||||
attributes: {
|
attributes: {
|
||||||
class: { type: "string", value: classes.join(" "), start: classStart, end: classEnd },
|
class: { type: "string", value: classes.join(" ") },
|
||||||
},
|
},
|
||||||
children: tree
|
children: tree
|
||||||
}];
|
}];
|
||||||
|
@ -29,11 +29,10 @@ exports.init = function(parser) {
|
|||||||
exports.parse = function() {
|
exports.parse = function() {
|
||||||
var match = this.match[0];
|
var match = this.match[0];
|
||||||
// Move past the match
|
// Move past the match
|
||||||
var start = this.parser.pos;
|
|
||||||
this.parser.pos = this.matchRegExp.lastIndex;
|
this.parser.pos = this.matchRegExp.lastIndex;
|
||||||
// Create the link unless it is suppressed
|
// Create the link unless it is suppressed
|
||||||
if(match.substr(0,1) === "~") {
|
if(match.substr(0,1) === "~") {
|
||||||
return [{type: "text", text: match.substr(1), start: start+1, end: this.parser.pos}];
|
return [{type: "text", text: match.substr(1)}];
|
||||||
} else {
|
} else {
|
||||||
return [{
|
return [{
|
||||||
type: "link",
|
type: "link",
|
||||||
@ -42,9 +41,7 @@ exports.parse = function() {
|
|||||||
},
|
},
|
||||||
children: [{
|
children: [{
|
||||||
type: "text",
|
type: "text",
|
||||||
text: match,
|
text: match
|
||||||
start: start,
|
|
||||||
end: this.parser.pos
|
|
||||||
}]
|
}]
|
||||||
}];
|
}];
|
||||||
}
|
}
|
||||||
|
@ -93,12 +93,11 @@ var processRow = function(prevColumns) {
|
|||||||
}
|
}
|
||||||
// Check whether this is a heading cell
|
// Check whether this is a heading cell
|
||||||
var cell;
|
var cell;
|
||||||
var start = this.parser.pos;
|
|
||||||
if(chr === "!") {
|
if(chr === "!") {
|
||||||
this.parser.pos++;
|
this.parser.pos++;
|
||||||
cell = {type: "element", tag: "th", start: start, children: []};
|
cell = {type: "element", tag: "th", children: []};
|
||||||
} else {
|
} else {
|
||||||
cell = {type: "element", tag: "td", start: start, children: []};
|
cell = {type: "element", tag: "td", children: []};
|
||||||
}
|
}
|
||||||
tree.push(cell);
|
tree.push(cell);
|
||||||
// Record information about this cell
|
// Record information about this cell
|
||||||
@ -122,7 +121,6 @@ var processRow = function(prevColumns) {
|
|||||||
}
|
}
|
||||||
// Move back to the closing `|`
|
// Move back to the closing `|`
|
||||||
this.parser.pos--;
|
this.parser.pos--;
|
||||||
cell.end = this.parser.pos;
|
|
||||||
}
|
}
|
||||||
col++;
|
col++;
|
||||||
cellRegExp.lastIndex = this.parser.pos;
|
cellRegExp.lastIndex = this.parser.pos;
|
||||||
@ -152,7 +150,7 @@ exports.parse = function() {
|
|||||||
} else {
|
} else {
|
||||||
// Otherwise, create a new row if this one is of a different type
|
// Otherwise, create a new row if this one is of a different type
|
||||||
if(rowType !== currRowType) {
|
if(rowType !== currRowType) {
|
||||||
rowContainer = {type: "element", tag: rowContainerTypes[rowType], children: [], start: this.parser.pos, end: this.parser.pos};
|
rowContainer = {type: "element", tag: rowContainerTypes[rowType], children: []};
|
||||||
table.children.push(rowContainer);
|
table.children.push(rowContainer);
|
||||||
currRowType = rowType;
|
currRowType = rowType;
|
||||||
}
|
}
|
||||||
@ -171,17 +169,15 @@ exports.parse = function() {
|
|||||||
rowContainer.children = this.parser.parseInlineRun(rowTermRegExp,{eatTerminator: true});
|
rowContainer.children = this.parser.parseInlineRun(rowTermRegExp,{eatTerminator: true});
|
||||||
} else {
|
} else {
|
||||||
// Create the row
|
// Create the row
|
||||||
var theRow = {type: "element", tag: "tr", children: [], start: rowMatch.index};
|
var theRow = {type: "element", tag: "tr", children: []};
|
||||||
$tw.utils.addClassToParseTreeNode(theRow,rowCount%2 ? "oddRow" : "evenRow");
|
$tw.utils.addClassToParseTreeNode(theRow,rowCount%2 ? "oddRow" : "evenRow");
|
||||||
rowContainer.children.push(theRow);
|
rowContainer.children.push(theRow);
|
||||||
// Process the row
|
// Process the row
|
||||||
theRow.children = processRow.call(this,prevColumns);
|
theRow.children = processRow.call(this,prevColumns);
|
||||||
this.parser.pos = rowMatch.index + rowMatch[0].length;
|
this.parser.pos = rowMatch.index + rowMatch[0].length;
|
||||||
theRow.end = this.parser.pos;
|
|
||||||
// Increment the row count
|
// Increment the row count
|
||||||
rowCount++;
|
rowCount++;
|
||||||
}
|
}
|
||||||
rowContainer.end = this.parser.pos;
|
|
||||||
}
|
}
|
||||||
rowMatch = rowRegExp.exec(this.parser.source);
|
rowMatch = rowRegExp.exec(this.parser.source);
|
||||||
}
|
}
|
||||||
|
@ -46,7 +46,6 @@ exports.parse = function() {
|
|||||||
renderType = this.match[2];
|
renderType = this.match[2];
|
||||||
// Move past the match
|
// Move past the match
|
||||||
this.parser.pos = this.matchRegExp.lastIndex;
|
this.parser.pos = this.matchRegExp.lastIndex;
|
||||||
var start = this.parser.pos;
|
|
||||||
// Look for the end of the block
|
// Look for the end of the block
|
||||||
reEnd.lastIndex = this.parser.pos;
|
reEnd.lastIndex = this.parser.pos;
|
||||||
var match = reEnd.exec(this.parser.source),
|
var match = reEnd.exec(this.parser.source),
|
||||||
@ -75,9 +74,7 @@ exports.parse = function() {
|
|||||||
tag: "pre",
|
tag: "pre",
|
||||||
children: [{
|
children: [{
|
||||||
type: "text",
|
type: "text",
|
||||||
text: text,
|
text: text
|
||||||
start: start,
|
|
||||||
end: this.parser.pos
|
|
||||||
}]
|
}]
|
||||||
}];
|
}];
|
||||||
}
|
}
|
||||||
|
@ -36,7 +36,6 @@ exports.parse = function() {
|
|||||||
// Get the details of the match
|
// Get the details of the match
|
||||||
var linkText = this.match[0];
|
var linkText = this.match[0];
|
||||||
// Move past the macro call
|
// Move past the macro call
|
||||||
var start = this.parser.pos;
|
|
||||||
this.parser.pos = this.matchRegExp.lastIndex;
|
this.parser.pos = this.matchRegExp.lastIndex;
|
||||||
// If the link starts with the unwikilink character then just output it as plain text
|
// If the link starts with the unwikilink character then just output it as plain text
|
||||||
if(linkText.substr(0,1) === $tw.config.textPrimitives.unWikiLink) {
|
if(linkText.substr(0,1) === $tw.config.textPrimitives.unWikiLink) {
|
||||||
@ -58,9 +57,7 @@ exports.parse = function() {
|
|||||||
},
|
},
|
||||||
children: [{
|
children: [{
|
||||||
type: "text",
|
type: "text",
|
||||||
text: linkText,
|
text: linkText
|
||||||
start: start,
|
|
||||||
end: this.parser.pos
|
|
||||||
}]
|
}]
|
||||||
}];
|
}];
|
||||||
};
|
};
|
||||||
|
@ -91,11 +91,6 @@ var WikiParser = function(type,text,options) {
|
|||||||
} else {
|
} else {
|
||||||
topBranch.push.apply(topBranch,this.parseBlocks());
|
topBranch.push.apply(topBranch,this.parseBlocks());
|
||||||
}
|
}
|
||||||
// Build rules' name map
|
|
||||||
this.usingRuleMap = {};
|
|
||||||
$tw.utils.each(this.pragmaRules, function (ruleInfo) { self.usingRuleMap[ruleInfo.rule.name] = Object.getPrototypeOf(ruleInfo.rule); });
|
|
||||||
$tw.utils.each(this.blockRules, function (ruleInfo) { self.usingRuleMap[ruleInfo.rule.name] = Object.getPrototypeOf(ruleInfo.rule); });
|
|
||||||
$tw.utils.each(this.inlineRules, function (ruleInfo) { self.usingRuleMap[ruleInfo.rule.name] = Object.getPrototypeOf(ruleInfo.rule); });
|
|
||||||
// Return the parse tree
|
// Return the parse tree
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -199,7 +194,6 @@ Parse any pragmas at the beginning of a block of parse text
|
|||||||
WikiParser.prototype.parsePragmas = function() {
|
WikiParser.prototype.parsePragmas = function() {
|
||||||
var currentTreeBranch = this.tree;
|
var currentTreeBranch = this.tree;
|
||||||
while(true) {
|
while(true) {
|
||||||
var savedPos = this.pos;
|
|
||||||
// Skip whitespace
|
// Skip whitespace
|
||||||
this.skipWhitespace();
|
this.skipWhitespace();
|
||||||
// Check for the end of the text
|
// Check for the end of the text
|
||||||
@ -210,24 +204,16 @@ WikiParser.prototype.parsePragmas = function() {
|
|||||||
var nextMatch = this.findNextMatch(this.pragmaRules,this.pos);
|
var nextMatch = this.findNextMatch(this.pragmaRules,this.pos);
|
||||||
// If not, just exit
|
// If not, just exit
|
||||||
if(!nextMatch || nextMatch.matchIndex !== this.pos) {
|
if(!nextMatch || nextMatch.matchIndex !== this.pos) {
|
||||||
this.pos = savedPos;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
// Process the pragma rule
|
// Process the pragma rule
|
||||||
var start = this.pos;
|
|
||||||
var subTree = nextMatch.rule.parse();
|
var subTree = nextMatch.rule.parse();
|
||||||
if(subTree.length > 0) {
|
if(subTree.length > 0) {
|
||||||
// Set the start and end positions of the pragma rule if
|
|
||||||
if (subTree[0].start === undefined) subTree[0].start = start;
|
|
||||||
if (subTree[subTree.length - 1].end === undefined) subTree[subTree.length - 1].end = this.pos;
|
|
||||||
$tw.utils.each(subTree, function (node) { node.rule = nextMatch.rule.name; });
|
|
||||||
// Quick hack; we only cope with a single parse tree node being returned, which is true at the moment
|
// Quick hack; we only cope with a single parse tree node being returned, which is true at the moment
|
||||||
currentTreeBranch.push.apply(currentTreeBranch,subTree);
|
currentTreeBranch.push.apply(currentTreeBranch,subTree);
|
||||||
subTree[0].children = [];
|
subTree[0].children = [];
|
||||||
currentTreeBranch = subTree[0].children;
|
currentTreeBranch = subTree[0].children;
|
||||||
}
|
}
|
||||||
// Skip whitespace after the pragma
|
|
||||||
this.skipWhitespace();
|
|
||||||
}
|
}
|
||||||
return currentTreeBranch;
|
return currentTreeBranch;
|
||||||
};
|
};
|
||||||
@ -237,7 +223,7 @@ Parse a block from the current position
|
|||||||
terminatorRegExpString: optional regular expression string that identifies the end of plain paragraphs. Must not include capturing parenthesis
|
terminatorRegExpString: optional regular expression string that identifies the end of plain paragraphs. Must not include capturing parenthesis
|
||||||
*/
|
*/
|
||||||
WikiParser.prototype.parseBlock = function(terminatorRegExpString) {
|
WikiParser.prototype.parseBlock = function(terminatorRegExpString) {
|
||||||
var terminatorRegExp = terminatorRegExpString ? new RegExp(terminatorRegExpString + "|\\r?\\n\\r?\\n","mg") : /(\r?\n\r?\n)/mg;
|
var terminatorRegExp = terminatorRegExpString ? new RegExp("(" + terminatorRegExpString + "|\\r?\\n\\r?\\n)","mg") : /(\r?\n\r?\n)/mg;
|
||||||
this.skipWhitespace();
|
this.skipWhitespace();
|
||||||
if(this.pos >= this.sourceLength) {
|
if(this.pos >= this.sourceLength) {
|
||||||
return [];
|
return [];
|
||||||
@ -245,15 +231,7 @@ WikiParser.prototype.parseBlock = function(terminatorRegExpString) {
|
|||||||
// Look for a block rule that applies at the current position
|
// Look for a block rule that applies at the current position
|
||||||
var nextMatch = this.findNextMatch(this.blockRules,this.pos);
|
var nextMatch = this.findNextMatch(this.blockRules,this.pos);
|
||||||
if(nextMatch && nextMatch.matchIndex === this.pos) {
|
if(nextMatch && nextMatch.matchIndex === this.pos) {
|
||||||
var start = this.pos;
|
return nextMatch.rule.parse();
|
||||||
var subTree = nextMatch.rule.parse();
|
|
||||||
// Set the start and end positions of the first and last blocks if they're not already set
|
|
||||||
if (subTree.length > 0) {
|
|
||||||
if (subTree[0].start === undefined) subTree[0].start = start;
|
|
||||||
if (subTree[subTree.length - 1].end === undefined) subTree[subTree.length - 1].end = this.pos;
|
|
||||||
}
|
|
||||||
$tw.utils.each(subTree, function (node) { node.rule = nextMatch.rule.name; });
|
|
||||||
return subTree;
|
|
||||||
}
|
}
|
||||||
// Treat it as a paragraph if we didn't find a block rule
|
// Treat it as a paragraph if we didn't find a block rule
|
||||||
var start = this.pos;
|
var start = this.pos;
|
||||||
@ -285,22 +263,12 @@ WikiParser.prototype.parseBlocksUnterminated = function() {
|
|||||||
return tree;
|
return tree;
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
|
||||||
Parse blocks of text until a terminating regexp is encountered. Wrapper for parseBlocksTerminatedExtended that just returns the parse tree
|
|
||||||
*/
|
|
||||||
WikiParser.prototype.parseBlocksTerminated = function(terminatorRegExpString) {
|
|
||||||
var ex = this.parseBlocksTerminatedExtended(terminatorRegExpString);
|
|
||||||
return ex.tree;
|
|
||||||
};
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Parse blocks of text until a terminating regexp is encountered
|
Parse blocks of text until a terminating regexp is encountered
|
||||||
*/
|
*/
|
||||||
WikiParser.prototype.parseBlocksTerminatedExtended = function(terminatorRegExpString) {
|
WikiParser.prototype.parseBlocksTerminated = function(terminatorRegExpString) {
|
||||||
var terminatorRegExp = new RegExp(terminatorRegExpString,"mg"),
|
var terminatorRegExp = new RegExp("(" + terminatorRegExpString + ")","mg"),
|
||||||
result = {
|
tree = [];
|
||||||
tree: []
|
|
||||||
};
|
|
||||||
// Skip any whitespace
|
// Skip any whitespace
|
||||||
this.skipWhitespace();
|
this.skipWhitespace();
|
||||||
// Check if we've got the end marker
|
// Check if we've got the end marker
|
||||||
@ -309,7 +277,7 @@ WikiParser.prototype.parseBlocksTerminatedExtended = function(terminatorRegExpSt
|
|||||||
// Parse the text into blocks
|
// Parse the text into blocks
|
||||||
while(this.pos < this.sourceLength && !(match && match.index === this.pos)) {
|
while(this.pos < this.sourceLength && !(match && match.index === this.pos)) {
|
||||||
var blocks = this.parseBlock(terminatorRegExpString);
|
var blocks = this.parseBlock(terminatorRegExpString);
|
||||||
result.tree.push.apply(result.tree,blocks);
|
tree.push.apply(tree,blocks);
|
||||||
// Skip any whitespace
|
// Skip any whitespace
|
||||||
this.skipWhitespace();
|
this.skipWhitespace();
|
||||||
// Check if we've got the end marker
|
// Check if we've got the end marker
|
||||||
@ -318,9 +286,8 @@ WikiParser.prototype.parseBlocksTerminatedExtended = function(terminatorRegExpSt
|
|||||||
}
|
}
|
||||||
if(match && match.index === this.pos) {
|
if(match && match.index === this.pos) {
|
||||||
this.pos = match.index + match[0].length;
|
this.pos = match.index + match[0].length;
|
||||||
result.match = match;
|
|
||||||
}
|
}
|
||||||
return result;
|
return tree;
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -350,16 +317,7 @@ WikiParser.prototype.parseInlineRunUnterminated = function(options) {
|
|||||||
this.pos = nextMatch.matchIndex;
|
this.pos = nextMatch.matchIndex;
|
||||||
}
|
}
|
||||||
// Process the run rule
|
// Process the run rule
|
||||||
var start = this.pos;
|
tree.push.apply(tree,nextMatch.rule.parse());
|
||||||
var subTree = nextMatch.rule.parse();
|
|
||||||
// Set the start and end positions of the first and last child if they're not already set
|
|
||||||
if (subTree.length > 0) {
|
|
||||||
// Set the start and end positions of the first and last child if they're not already set
|
|
||||||
if (subTree[0].start === undefined) subTree[0].start = start;
|
|
||||||
if (subTree[subTree.length - 1].end === undefined) subTree[subTree.length - 1].end = this.pos;
|
|
||||||
}
|
|
||||||
$tw.utils.each(subTree, function (node) { node.rule = nextMatch.rule.name; });
|
|
||||||
tree.push.apply(tree,subTree);
|
|
||||||
// Look for the next run rule
|
// Look for the next run rule
|
||||||
nextMatch = this.findNextMatch(this.inlineRules,this.pos);
|
nextMatch = this.findNextMatch(this.inlineRules,this.pos);
|
||||||
}
|
}
|
||||||
@ -372,11 +330,6 @@ WikiParser.prototype.parseInlineRunUnterminated = function(options) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
WikiParser.prototype.parseInlineRunTerminated = function(terminatorRegExp,options) {
|
WikiParser.prototype.parseInlineRunTerminated = function(terminatorRegExp,options) {
|
||||||
var ex = this.parseInlineRunTerminatedExtended(terminatorRegExp,options);
|
|
||||||
return ex.tree;
|
|
||||||
};
|
|
||||||
|
|
||||||
WikiParser.prototype.parseInlineRunTerminatedExtended = function(terminatorRegExp,options) {
|
|
||||||
options = options || {};
|
options = options || {};
|
||||||
var tree = [];
|
var tree = [];
|
||||||
// Find the next occurrence of the terminator
|
// Find the next occurrence of the terminator
|
||||||
@ -396,10 +349,7 @@ WikiParser.prototype.parseInlineRunTerminatedExtended = function(terminatorRegEx
|
|||||||
if(options.eatTerminator) {
|
if(options.eatTerminator) {
|
||||||
this.pos += terminatorMatch[0].length;
|
this.pos += terminatorMatch[0].length;
|
||||||
}
|
}
|
||||||
return {
|
return tree;
|
||||||
match: terminatorMatch,
|
|
||||||
tree: tree
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Process any inline rule, along with the text preceding it
|
// Process any inline rule, along with the text preceding it
|
||||||
@ -410,15 +360,7 @@ WikiParser.prototype.parseInlineRunTerminatedExtended = function(terminatorRegEx
|
|||||||
this.pos = inlineRuleMatch.matchIndex;
|
this.pos = inlineRuleMatch.matchIndex;
|
||||||
}
|
}
|
||||||
// Process the inline rule
|
// Process the inline rule
|
||||||
var start = this.pos;
|
tree.push.apply(tree,inlineRuleMatch.rule.parse());
|
||||||
var subTree = inlineRuleMatch.rule.parse();
|
|
||||||
// Set the start and end positions of the first and last child if they're not already set
|
|
||||||
if (subTree.length > 0) {
|
|
||||||
if (subTree[0].start === undefined) subTree[0].start = start;
|
|
||||||
if (subTree[subTree.length - 1].end === undefined) subTree[subTree.length - 1].end = this.pos;
|
|
||||||
}
|
|
||||||
$tw.utils.each(subTree, function (node) { node.rule = inlineRuleMatch.rule.name; });
|
|
||||||
tree.push.apply(tree,subTree);
|
|
||||||
// Look for the next inline rule
|
// Look for the next inline rule
|
||||||
inlineRuleMatch = this.findNextMatch(this.inlineRules,this.pos);
|
inlineRuleMatch = this.findNextMatch(this.inlineRules,this.pos);
|
||||||
// Look for the next terminator match
|
// Look for the next terminator match
|
||||||
@ -431,9 +373,7 @@ WikiParser.prototype.parseInlineRunTerminatedExtended = function(terminatorRegEx
|
|||||||
this.pushTextWidget(tree,this.source.substr(this.pos),this.pos,this.sourceLength);
|
this.pushTextWidget(tree,this.source.substr(this.pos),this.pos,this.sourceLength);
|
||||||
}
|
}
|
||||||
this.pos = this.sourceLength;
|
this.pos = this.sourceLength;
|
||||||
return {
|
return tree;
|
||||||
tree: tree
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -497,3 +437,4 @@ WikiParser.prototype.amendRules = function(type,names) {
|
|||||||
exports["text/vnd.tiddlywiki"] = WikiParser;
|
exports["text/vnd.tiddlywiki"] = WikiParser;
|
||||||
|
|
||||||
})();
|
})();
|
||||||
|
|
||||||
|
@ -95,7 +95,6 @@ function SaverHandler(options) {
|
|||||||
if($tw.browser) {
|
if($tw.browser) {
|
||||||
$tw.rootWidget.addEventListener("tm-save-wiki",function(event) {
|
$tw.rootWidget.addEventListener("tm-save-wiki",function(event) {
|
||||||
self.saveWiki({
|
self.saveWiki({
|
||||||
wiki: event.widget.wiki,
|
|
||||||
template: event.param,
|
template: event.param,
|
||||||
downloadType: "text/plain",
|
downloadType: "text/plain",
|
||||||
variables: event.paramObject
|
variables: event.paramObject
|
||||||
@ -103,7 +102,6 @@ function SaverHandler(options) {
|
|||||||
});
|
});
|
||||||
$tw.rootWidget.addEventListener("tm-download-file",function(event) {
|
$tw.rootWidget.addEventListener("tm-download-file",function(event) {
|
||||||
self.saveWiki({
|
self.saveWiki({
|
||||||
wiki: event.widget.wiki,
|
|
||||||
method: "download",
|
method: "download",
|
||||||
template: event.param,
|
template: event.param,
|
||||||
downloadType: "text/plain",
|
downloadType: "text/plain",
|
||||||
@ -149,22 +147,20 @@ Save the wiki contents. Options are:
|
|||||||
method: "save", "autosave" or "download"
|
method: "save", "autosave" or "download"
|
||||||
template: the tiddler containing the template to save
|
template: the tiddler containing the template to save
|
||||||
downloadType: the content type for the saved file
|
downloadType: the content type for the saved file
|
||||||
wiki: optional wiki, overriding the default wiki specified in the constructor
|
|
||||||
*/
|
*/
|
||||||
SaverHandler.prototype.saveWiki = function(options) {
|
SaverHandler.prototype.saveWiki = function(options) {
|
||||||
options = options || {};
|
options = options || {};
|
||||||
var self = this,
|
var self = this,
|
||||||
wiki = options.wiki || this.wiki,
|
|
||||||
method = options.method || "save";
|
method = options.method || "save";
|
||||||
// Ignore autosave if disabled
|
// Ignore autosave if disabled
|
||||||
if(method === "autosave" && ($tw.config.disableAutoSave || wiki.getTiddlerText(this.titleAutoSave,"yes") !== "yes")) {
|
if(method === "autosave" && ($tw.config.disableAutoSave || this.wiki.getTiddlerText(this.titleAutoSave,"yes") !== "yes")) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
var variables = options.variables || {},
|
var variables = options.variables || {},
|
||||||
template = (options.template ||
|
template = (options.template ||
|
||||||
wiki.getTiddlerText("$:/config/SaveWikiButton/Template","$:/core/save/all")).trim(),
|
this.wiki.getTiddlerText("$:/config/SaveWikiButton/Template","$:/core/save/all")).trim(),
|
||||||
downloadType = options.downloadType || "text/plain",
|
downloadType = options.downloadType || "text/plain",
|
||||||
text = wiki.renderTiddler(downloadType,template,options),
|
text = this.wiki.renderTiddler(downloadType,template,options),
|
||||||
callback = function(err) {
|
callback = function(err) {
|
||||||
if(err) {
|
if(err) {
|
||||||
alert($tw.language.getString("Error/WhileSaving") + ":\n\n" + err);
|
alert($tw.language.getString("Error/WhileSaving") + ":\n\n" + err);
|
||||||
|
@ -31,7 +31,7 @@ GitHubSaver.prototype.save = function(text,method,callback) {
|
|||||||
headers = {
|
headers = {
|
||||||
"Accept": "application/vnd.github.v3+json",
|
"Accept": "application/vnd.github.v3+json",
|
||||||
"Content-Type": "application/json;charset=UTF-8",
|
"Content-Type": "application/json;charset=UTF-8",
|
||||||
"Authorization": "Basic " + $tw.utils.base64Encode(username + ":" + password),
|
"Authorization": "Basic " + window.btoa(username + ":" + password),
|
||||||
"If-None-Match": ""
|
"If-None-Match": ""
|
||||||
};
|
};
|
||||||
// Bail if we don't have everything we need
|
// Bail if we don't have everything we need
|
||||||
|
@ -20,7 +20,7 @@ Retrieve ETag if available
|
|||||||
*/
|
*/
|
||||||
var retrieveETag = function(self) {
|
var retrieveETag = function(self) {
|
||||||
var headers = {
|
var headers = {
|
||||||
Accept: "*/*"
|
Accept: "*/*;charset=UTF-8"
|
||||||
};
|
};
|
||||||
$tw.utils.httpRequest({
|
$tw.utils.httpRequest({
|
||||||
url: self.uri(),
|
url: self.uri(),
|
||||||
@ -48,14 +48,14 @@ var PutSaver = function(wiki) {
|
|||||||
var self = this;
|
var self = this;
|
||||||
var uri = this.uri();
|
var uri = this.uri();
|
||||||
// Async server probe. Until probe finishes, save will fail fast
|
// Async server probe. Until probe finishes, save will fail fast
|
||||||
// See also https://github.com/TiddlyWiki/TiddlyWiki5/issues/2276
|
// See also https://github.com/Jermolene/TiddlyWiki5/issues/2276
|
||||||
$tw.utils.httpRequest({
|
$tw.utils.httpRequest({
|
||||||
url: uri,
|
url: uri,
|
||||||
type: "OPTIONS",
|
type: "OPTIONS",
|
||||||
callback: function(err,data,xhr) {
|
callback: function(err,data,xhr) {
|
||||||
// Check DAV header http://www.webdav.org/specs/rfc2518.html#rfc.section.9.1
|
// Check DAV header http://www.webdav.org/specs/rfc2518.html#rfc.section.9.1
|
||||||
if(!err) {
|
if(!err) {
|
||||||
self.serverAcceptsPuts = xhr.status >= 200 && xhr.status < 300 && !!xhr.getResponseHeader("dav");
|
self.serverAcceptsPuts = xhr.status === 200 && !!xhr.getResponseHeader("dav");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -37,9 +37,7 @@ HeaderAuthenticator.prototype.authenticateRequest = function(request,response,st
|
|||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
// authenticatedUsername will be undefined for anonymous users
|
// authenticatedUsername will be undefined for anonymous users
|
||||||
if(username) {
|
state.authenticatedUsername = $tw.utils.decodeURIComponentSafe(username);
|
||||||
state.authenticatedUsername = $tw.utils.decodeURIComponentSafe(username);
|
|
||||||
}
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -140,11 +140,6 @@ function sendResponse(request,response,statusCode,headers,data,encoding) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
// RFC 7231, 6.1. Overview of Status Codes:
|
|
||||||
// Browser clients may cache 200, 203, 204, 206, 300, 301,
|
|
||||||
// 404, 405, 410, 414, and 501 unless given explicit cache controls
|
|
||||||
headers["Cache-Control"] = headers["Cache-Control"] || "no-store";
|
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
If the gzip=yes is set, check if the user agent permits compression. If so,
|
If the gzip=yes is set, check if the user agent permits compression. If so,
|
||||||
|
@ -61,7 +61,7 @@ exports.startup = function() {
|
|||||||
// Collect the shadow tiddlers of any modified plugins
|
// Collect the shadow tiddlers of any modified plugins
|
||||||
$tw.utils.each(changes.modifiedPlugins,function(pluginTitle) {
|
$tw.utils.each(changes.modifiedPlugins,function(pluginTitle) {
|
||||||
var pluginInfo = $tw.wiki.getPluginInfo(pluginTitle);
|
var pluginInfo = $tw.wiki.getPluginInfo(pluginTitle);
|
||||||
if(pluginInfo && pluginInfo.tiddlers) {
|
if(pluginInfo) {
|
||||||
$tw.utils.each(Object.keys(pluginInfo.tiddlers),function(title) {
|
$tw.utils.each(Object.keys(pluginInfo.tiddlers),function(title) {
|
||||||
changedShadowTiddlers[title] = false;
|
changedShadowTiddlers[title] = false;
|
||||||
});
|
});
|
||||||
|
@ -29,11 +29,7 @@ var THROTTLE_REFRESH_TIMEOUT = 400;
|
|||||||
|
|
||||||
exports.startup = function() {
|
exports.startup = function() {
|
||||||
// Set up the title
|
// Set up the title
|
||||||
$tw.titleWidgetNode = $tw.wiki.makeTranscludeWidget(PAGE_TITLE_TITLE, {
|
$tw.titleWidgetNode = $tw.wiki.makeTranscludeWidget(PAGE_TITLE_TITLE,{document: $tw.fakeDocument, parseAsInline: true});
|
||||||
document: $tw.fakeDocument,
|
|
||||||
parseAsInline: true,
|
|
||||||
importPageMacros: true,
|
|
||||||
});
|
|
||||||
$tw.titleContainer = $tw.fakeDocument.createElement("div");
|
$tw.titleContainer = $tw.fakeDocument.createElement("div");
|
||||||
$tw.titleWidgetNode.render($tw.titleContainer,null);
|
$tw.titleWidgetNode.render($tw.titleContainer,null);
|
||||||
document.title = $tw.titleContainer.textContent;
|
document.title = $tw.titleContainer.textContent;
|
||||||
@ -85,8 +81,6 @@ exports.startup = function() {
|
|||||||
deferredChanges = Object.create(null);
|
deferredChanges = Object.create(null);
|
||||||
$tw.hooks.invokeHook("th-page-refreshed");
|
$tw.hooks.invokeHook("th-page-refreshed");
|
||||||
}
|
}
|
||||||
var throttledRefresh = $tw.perf.report("throttledRefresh",refresh);
|
|
||||||
|
|
||||||
// Add the change event handler
|
// Add the change event handler
|
||||||
$tw.wiki.addEventListener("change",$tw.perf.report("mainRefresh",function(changes) {
|
$tw.wiki.addEventListener("change",$tw.perf.report("mainRefresh",function(changes) {
|
||||||
// Check if only tiddlers that are throttled have changed
|
// Check if only tiddlers that are throttled have changed
|
||||||
@ -107,7 +101,7 @@ exports.startup = function() {
|
|||||||
if(isNaN(timeout)) {
|
if(isNaN(timeout)) {
|
||||||
timeout = THROTTLE_REFRESH_TIMEOUT;
|
timeout = THROTTLE_REFRESH_TIMEOUT;
|
||||||
}
|
}
|
||||||
timerId = setTimeout(throttledRefresh,timeout);
|
timerId = setTimeout(refresh,timeout);
|
||||||
$tw.utils.extend(deferredChanges,changes);
|
$tw.utils.extend(deferredChanges,changes);
|
||||||
} else {
|
} else {
|
||||||
$tw.utils.extend(deferredChanges,changes);
|
$tw.utils.extend(deferredChanges,changes);
|
||||||
|
@ -38,8 +38,6 @@ exports.startup = function() {
|
|||||||
url: params.url,
|
url: params.url,
|
||||||
method: params.method,
|
method: params.method,
|
||||||
body: params.body,
|
body: params.body,
|
||||||
binary: params.binary,
|
|
||||||
useDefaultHeaders: params.useDefaultHeaders,
|
|
||||||
oncompletion: params.oncompletion,
|
oncompletion: params.oncompletion,
|
||||||
onprogress: params.onprogress,
|
onprogress: params.onprogress,
|
||||||
bindStatus: params["bind-status"],
|
bindStatus: params["bind-status"],
|
||||||
@ -48,13 +46,7 @@ exports.startup = function() {
|
|||||||
headers: getPropertiesWithPrefix(params,"header-"),
|
headers: getPropertiesWithPrefix(params,"header-"),
|
||||||
passwordHeaders: getPropertiesWithPrefix(params,"password-header-"),
|
passwordHeaders: getPropertiesWithPrefix(params,"password-header-"),
|
||||||
queryStrings: getPropertiesWithPrefix(params,"query-"),
|
queryStrings: getPropertiesWithPrefix(params,"query-"),
|
||||||
passwordQueryStrings: getPropertiesWithPrefix(params,"password-query-"),
|
passwordQueryStrings: getPropertiesWithPrefix(params,"password-query-")
|
||||||
basicAuthUsername: params["basic-auth-username"],
|
|
||||||
basicAuthUsernameFromStore: params["basic-auth-username-from-store"],
|
|
||||||
basicAuthPassword: params["basic-auth-password"],
|
|
||||||
basicAuthPasswordFromStore: params["basic-auth-password-from-store"],
|
|
||||||
bearerAuthToken: params["bearer-auth-token"],
|
|
||||||
bearerAuthTokenFromStore: params["bearer-auth-token-from-store"]
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
$tw.rootWidget.addEventListener("tm-http-cancel-all-requests",function(event) {
|
$tw.rootWidget.addEventListener("tm-http-cancel-all-requests",function(event) {
|
||||||
@ -75,10 +67,7 @@ exports.startup = function() {
|
|||||||
});
|
});
|
||||||
// Install the copy-to-clipboard mechanism
|
// Install the copy-to-clipboard mechanism
|
||||||
$tw.rootWidget.addEventListener("tm-copy-to-clipboard",function(event) {
|
$tw.rootWidget.addEventListener("tm-copy-to-clipboard",function(event) {
|
||||||
$tw.utils.copyToClipboard(event.param,{
|
$tw.utils.copyToClipboard(event.param);
|
||||||
successNotification: event.paramObject && event.paramObject.successNotification,
|
|
||||||
failureNotification: event.paramObject && event.paramObject.failureNotification
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
// Install the tm-focus-selector message
|
// Install the tm-focus-selector message
|
||||||
$tw.rootWidget.addEventListener("tm-focus-selector",function(event) {
|
$tw.rootWidget.addEventListener("tm-focus-selector",function(event) {
|
||||||
|
@ -27,11 +27,6 @@ exports.startup = function() {
|
|||||||
if($tw.browser) {
|
if($tw.browser) {
|
||||||
$tw.browser.isIE = (/msie|trident/i.test(navigator.userAgent));
|
$tw.browser.isIE = (/msie|trident/i.test(navigator.userAgent));
|
||||||
$tw.browser.isFirefox = !!document.mozFullScreenEnabled;
|
$tw.browser.isFirefox = !!document.mozFullScreenEnabled;
|
||||||
// 2023-07-21 Edge returns UA below. So we use "isChromeLike"
|
|
||||||
//'mozilla/5.0 (windows nt 10.0; win64; x64) applewebkit/537.36 (khtml, like gecko) chrome/114.0.0.0 safari/537.36 edg/114.0.1823.82'
|
|
||||||
$tw.browser.isChromeLike = navigator.userAgent.toLowerCase().indexOf("chrome") > -1;
|
|
||||||
$tw.browser.hasTouch = !!window.matchMedia && window.matchMedia("(pointer: coarse)").matches;
|
|
||||||
$tw.browser.isMobileChrome = $tw.browser.isChromeLike && $tw.browser.hasTouch;
|
|
||||||
}
|
}
|
||||||
// Platform detection
|
// Platform detection
|
||||||
$tw.platform = {};
|
$tw.platform = {};
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user