diff --git a/bin/lazy.sh b/bin/lazy.sh index eb0603701..372799288 100755 --- a/bin/lazy.sh +++ b/bin/lazy.sh @@ -5,7 +5,7 @@ # Optional parameter is the username for signing edits node ./tiddlywiki.js \ - editions/server \ + editions/tw5.com-server \ --verbose \ --server 8080 $:/core/save/lazy-images text/plain text/html $1 $2\ || exit 1 diff --git a/bin/readme.md b/bin/readme.md index c611d2b7b..28064f02d 100644 --- a/bin/readme.md +++ b/bin/readme.md @@ -1,3 +1,3 @@ -

Script Files

The TiddlyWiki5 repository contains several scripts in the bin folder that you can use to automate common tasks, or as a useful starting point for your own scripts. See Scripts for building tiddlywiki.com for details of the scripts used to build and release http://tiddlywiki.com/.

All the scripts expect to be run from the root folder of the repository.

serve: serves tw5.com

./bin/serve.sh -h
+

Script Files

The TiddlyWiki5 repository contains several scripts in the bin folder that you can use to automate common tasks, or as a useful starting point for your own scripts. See Scripts for building tiddlywiki.com for details of the scripts used to build and release http://tiddlywiki.com/.

All the scripts expect to be run from the root folder of the repository.

serve: serves tw5.com

./bin/serve.sh -h
 ./bin/serve.sh [edition dir] [username] [password] [host] [port]

Or:

./bin/serve.cmd -h
 ./bin/serve.cmd [edition dir] [username] [password] [host] [port]

This script starts TiddlyWiki5 running as an HTTP server, defaulting to the content from the tw5.com-server edition. By default, the Node.js serves on port 8080. If the optional username parameter is provided, it is used for signing edits. If the password is provided then HTTP basic authentication is used. Run the script with the -h parameter to see online help.

To experiment with this configuration, run the script and then visit http://127.0.0.1:8080 in a browser.

Changes made in the browser propagate to the server over HTTP (use the browser developer console to see these requests). The server then syncs changes to the file system (and logs each change to the screen).

test: build and run tests

This script runs the test edition of TiddlyWiki on the server to perform the server-side tests and to build test.html for running the tests in the browser.

lazy: serves tw5.com with lazily loaded images

./bin/lazy.sh <username> [<password>]

Or:

./bin/lazy.cmd <username> [<password>]

This script serves the tw5.com-server edition content with LazyLoading applied to images.

2bld: builds TiddlyWiki 2.6.5

This script builds TiddlyWiki 2.6.5 from the original source and then displays the differences between them (diff is used for *nix, fc for Windows).

\ No newline at end of file diff --git a/boot/boot.js b/boot/boot.js index 9d47c9ba8..e5f6c775e 100644 --- a/boot/boot.js +++ b/boot/boot.js @@ -136,7 +136,7 @@ $tw.utils.error = function(err) { heading = dm("h1",{text: errHeading}), prompt = dm("div",{text: promptMsg, "class": "tc-error-prompt"}), message = dm("div",{text: err}), - button = dm("button",{text: "close"}), + button = dm("button",{text: ( $tw.language == undefined ? "close" : $tw.language.getString("Buttons/Close/Caption") )}), form = dm("form",{children: [heading,prompt,message,button], "class": "tc-error-form"}); document.body.insertBefore(form,document.body.firstChild); form.addEventListener("submit",function(event) { @@ -251,15 +251,20 @@ $tw.utils.parseDate = function(value) { // Stringify an array of tiddler titles into a list string $tw.utils.stringifyList = function(value) { - var result = []; - for(var t=0; tContributing to TiddlyWiki5

We welcome contributions to the code and documentation of TiddlyWiki in several ways:

There are other ways to help TiddlyWiki too.

Contributor License Agreement

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

How to sign the CLA

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

step by step

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

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

Remarks +

Contributing to TiddlyWiki5

We welcome contributions to the code and documentation of TiddlyWiki in several ways:

There are other ways to help TiddlyWiki too.

Contributor License Agreement

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

How to sign the CLA

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

step by step

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

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

Remarks ----—

    • When not owning the copyright in the entire work of authorship**

In this case, please clearly state so, since otherwise we assume that you are the legal copyright holder of the contributed work! Please provide links and additional information that clarify under which license the rest of the code is distributed.

This file was automatically generated by TiddlyWiki5

\ No newline at end of file diff --git a/core/images/advanced-search-button.tid b/core/images/advanced-search-button.tid old mode 100644 new mode 100755 diff --git a/core/images/auto-height.tid b/core/images/auto-height.tid new file mode 100755 index 000000000..e65b9c5b6 --- /dev/null +++ b/core/images/auto-height.tid @@ -0,0 +1,6 @@ +title: $:/core/images/auto-height +tags: $:/tags/Image + + + + \ No newline at end of file diff --git a/core/images/blank.tid b/core/images/blank.tid old mode 100644 new mode 100755 diff --git a/core/images/bold.tid b/core/images/bold.tid new file mode 100755 index 000000000..0e5d9d8d6 --- /dev/null +++ b/core/images/bold.tid @@ -0,0 +1,8 @@ +title: $:/core/images/bold +tags: $:/tags/Image + + + + + + \ No newline at end of file diff --git a/core/images/cancel-button.tid b/core/images/cancel-button.tid old mode 100644 new mode 100755 diff --git a/core/images/chevron-down.tid b/core/images/chevron-down.tid old mode 100644 new mode 100755 diff --git a/core/images/chevron-left.tid b/core/images/chevron-left.tid old mode 100644 new mode 100755 diff --git a/core/images/chevron-right.tid b/core/images/chevron-right.tid old mode 100644 new mode 100755 diff --git a/core/images/chevron-up.tid b/core/images/chevron-up.tid old mode 100644 new mode 100755 diff --git a/core/images/clone-button.tid b/core/images/clone-button.tid old mode 100644 new mode 100755 diff --git a/core/images/close-all-button.tid b/core/images/close-all-button.tid old mode 100644 new mode 100755 diff --git a/core/images/close-button.tid b/core/images/close-button.tid old mode 100644 new mode 100755 diff --git a/core/images/close-others-button.tid b/core/images/close-others-button.tid old mode 100644 new mode 100755 diff --git a/core/images/copy-clipboard.tid b/core/images/copy-clipboard.tid new file mode 100644 index 000000000..583808bd4 --- /dev/null +++ b/core/images/copy-clipboard.tid @@ -0,0 +1,15 @@ +title: $:/core/images/copy-clipboard +tags: $:/tags/Image + + + + + + + + + + + + + \ No newline at end of file diff --git a/core/images/delete-button.tid b/core/images/delete-button.tid old mode 100644 new mode 100755 diff --git a/core/images/done-button.tid b/core/images/done-button.tid old mode 100644 new mode 100755 diff --git a/core/images/down-arrow.tid b/core/images/down-arrow.tid old mode 100644 new mode 100755 diff --git a/core/images/download-button.tid b/core/images/download-button.tid old mode 100644 new mode 100755 diff --git a/core/images/edit-button.tid b/core/images/edit-button.tid old mode 100644 new mode 100755 diff --git a/core/images/erase.tid b/core/images/erase.tid new file mode 100755 index 000000000..ba18f5bd0 --- /dev/null +++ b/core/images/erase.tid @@ -0,0 +1,8 @@ +title: $:/core/images/erase +tags: $:/tags/Image + + + + + + \ No newline at end of file diff --git a/core/images/excise.tid b/core/images/excise.tid new file mode 100755 index 000000000..2360cb5a7 --- /dev/null +++ b/core/images/excise.tid @@ -0,0 +1,8 @@ +title: $:/core/images/excise +tags: $:/tags/Image + + + + + + \ No newline at end of file diff --git a/core/images/export-button.tid b/core/images/export-button.tid old mode 100644 new mode 100755 diff --git a/core/images/file.tid b/core/images/file.tid old mode 100644 new mode 100755 index bc91d4208..d66b19e50 --- a/core/images/file.tid +++ b/core/images/file.tid @@ -4,11 +4,11 @@ tags: $:/tags/Image - - - - - - + + + + + + \ No newline at end of file diff --git a/core/images/fixed-height.tid b/core/images/fixed-height.tid new file mode 100755 index 000000000..3b53256ab --- /dev/null +++ b/core/images/fixed-height.tid @@ -0,0 +1,8 @@ +title: $:/core/images/fixed-height +tags: $:/tags/Image + + + + + + \ No newline at end of file diff --git a/core/images/fold-all-button.tid b/core/images/fold-all-button.tid old mode 100644 new mode 100755 diff --git a/core/images/fold-button.tid b/core/images/fold-button.tid old mode 100644 new mode 100755 diff --git a/core/images/fold-others-button.tid b/core/images/fold-others-button.tid old mode 100644 new mode 100755 diff --git a/core/images/folder.tid b/core/images/folder.tid old mode 100644 new mode 100755 diff --git a/core/images/full-screen-button.tid b/core/images/full-screen-button.tid old mode 100644 new mode 100755 diff --git a/core/images/github.tid b/core/images/github.tid old mode 100644 new mode 100755 diff --git a/core/images/globe.tid b/core/images/globe.tid old mode 100644 new mode 100755 diff --git a/core/images/heading-1.tid b/core/images/heading-1.tid new file mode 100755 index 000000000..94d57dee9 --- /dev/null +++ b/core/images/heading-1.tid @@ -0,0 +1,8 @@ +title: $:/core/images/heading-1 +tags: $:/tags/Image + + + + + + \ No newline at end of file diff --git a/core/images/heading-2.tid b/core/images/heading-2.tid new file mode 100755 index 000000000..65b2e3750 --- /dev/null +++ b/core/images/heading-2.tid @@ -0,0 +1,8 @@ +title: $:/core/images/heading-2 +tags: $:/tags/Image + + + + + + \ No newline at end of file diff --git a/core/images/heading-3.tid b/core/images/heading-3.tid new file mode 100755 index 000000000..6899440a7 --- /dev/null +++ b/core/images/heading-3.tid @@ -0,0 +1,8 @@ +title: $:/core/images/heading-3 +tags: $:/tags/Image + + + + + + \ No newline at end of file diff --git a/core/images/heading-4.tid b/core/images/heading-4.tid new file mode 100755 index 000000000..c30a44692 --- /dev/null +++ b/core/images/heading-4.tid @@ -0,0 +1,8 @@ +title: $:/core/images/heading-4 +tags: $:/tags/Image + + + + + + \ No newline at end of file diff --git a/core/images/heading-5.tid b/core/images/heading-5.tid new file mode 100755 index 000000000..8e0a7fdc8 --- /dev/null +++ b/core/images/heading-5.tid @@ -0,0 +1,8 @@ +title: $:/core/images/heading-5 +tags: $:/tags/Image + + + + + + \ No newline at end of file diff --git a/core/images/heading-6.tid b/core/images/heading-6.tid new file mode 100755 index 000000000..93f7bcfd7 --- /dev/null +++ b/core/images/heading-6.tid @@ -0,0 +1,8 @@ +title: $:/core/images/heading-6 +tags: $:/tags/Image + + + + + + \ No newline at end of file diff --git a/core/images/help.tid b/core/images/help.tid old mode 100644 new mode 100755 diff --git a/core/images/home-button.tid b/core/images/home-button.tid old mode 100644 new mode 100755 diff --git a/core/images/import-button.tid b/core/images/import-button.tid old mode 100644 new mode 100755 diff --git a/core/images/info-button.tid b/core/images/info-button.tid old mode 100644 new mode 100755 index 2d9c2cb5c..263fe9056 --- a/core/images/info-button.tid +++ b/core/images/info-button.tid @@ -9,5 +9,4 @@ tags: $:/tags/Image - \ No newline at end of file diff --git a/core/images/italic.tid b/core/images/italic.tid new file mode 100755 index 000000000..f7c46b55c --- /dev/null +++ b/core/images/italic.tid @@ -0,0 +1,8 @@ +title: $:/core/images/italic +tags: $:/tags/Image + + + + + + \ No newline at end of file diff --git a/core/images/left-arrow.tid b/core/images/left-arrow.tid old mode 100644 new mode 100755 diff --git a/core/images/line-width.tid b/core/images/line-width.tid new file mode 100755 index 000000000..1e8854c4e --- /dev/null +++ b/core/images/line-width.tid @@ -0,0 +1,9 @@ +title: $:/core/images/line-width +tags: $:/tags/Image + + + + + + + \ No newline at end of file diff --git a/core/images/link.tid b/core/images/link.tid new file mode 100644 index 000000000..1e094a9b0 --- /dev/null +++ b/core/images/link.tid @@ -0,0 +1,9 @@ +title: $:/core/images/link +tags: $:/tags/Image + + + + + + + \ No newline at end of file diff --git a/core/images/list-bullet.tid b/core/images/list-bullet.tid new file mode 100755 index 000000000..7951ad229 --- /dev/null +++ b/core/images/list-bullet.tid @@ -0,0 +1,8 @@ +title: $:/core/images/list-bullet +tags: $:/tags/Image + + + + + + \ No newline at end of file diff --git a/core/images/list-number.tid b/core/images/list-number.tid new file mode 100755 index 000000000..768f16d25 --- /dev/null +++ b/core/images/list-number.tid @@ -0,0 +1,8 @@ +title: $:/core/images/list-number +tags: $:/tags/Image + + + + + + \ No newline at end of file diff --git a/core/images/locked-padlock.tid b/core/images/locked-padlock.tid old mode 100644 new mode 100755 diff --git a/core/images/mail.tid b/core/images/mail.tid old mode 100644 new mode 100755 diff --git a/core/images/menu-button.tid b/core/images/menu-button.tid old mode 100644 new mode 100755 diff --git a/core/images/mono-block.tid b/core/images/mono-block.tid new file mode 100755 index 000000000..1675e3854 --- /dev/null +++ b/core/images/mono-block.tid @@ -0,0 +1,8 @@ +title: $:/core/images/mono-block +tags: $:/tags/Image + + + + + + \ No newline at end of file diff --git a/core/images/mono-line.tid b/core/images/mono-line.tid new file mode 100755 index 000000000..81d0faf3f --- /dev/null +++ b/core/images/mono-line.tid @@ -0,0 +1,8 @@ +title: $:/core/images/mono-line +tags: $:/tags/Image + + + + + + \ No newline at end of file diff --git a/core/images/new-button.tid b/core/images/new-button.tid old mode 100644 new mode 100755 diff --git a/core/images/new-here-button.tid b/core/images/new-here-button.tid old mode 100644 new mode 100755 diff --git a/core/images/new-image-button.tid b/core/images/new-image-button.tid new file mode 100755 index 000000000..5109bf98d --- /dev/null +++ b/core/images/new-image-button.tid @@ -0,0 +1,8 @@ +title: $:/core/images/new-image-button +tags: $:/tags/Image + + + + + + \ No newline at end of file diff --git a/core/images/new-journal-button.tid b/core/images/new-journal-button.tid old mode 100644 new mode 100755 diff --git a/core/images/opacity.tid b/core/images/opacity.tid new file mode 100755 index 000000000..e9bb732e1 --- /dev/null +++ b/core/images/opacity.tid @@ -0,0 +1,10 @@ +title: $:/core/images/opacity +tags: $:/tags/Image + + + + + + + + \ No newline at end of file diff --git a/core/images/open-window.tid b/core/images/open-window.tid old mode 100644 new mode 100755 diff --git a/core/images/options-button.tid b/core/images/options-button.tid old mode 100644 new mode 100755 diff --git a/core/images/paint.tid b/core/images/paint.tid new file mode 100755 index 000000000..c6dcab834 --- /dev/null +++ b/core/images/paint.tid @@ -0,0 +1,8 @@ +title: $:/core/images/paint +tags: $:/tags/Image + + + + + + \ No newline at end of file diff --git a/core/images/palette.tid b/core/images/palette.tid old mode 100644 new mode 100755 diff --git a/core/images/permalink-button.tid b/core/images/permalink-button.tid old mode 100644 new mode 100755 diff --git a/core/images/permaview-button.tid b/core/images/permaview-button.tid old mode 100644 new mode 100755 diff --git a/core/images/picture.tid b/core/images/picture.tid new file mode 100755 index 000000000..71d2bf1a6 --- /dev/null +++ b/core/images/picture.tid @@ -0,0 +1,8 @@ +title: $:/core/images/picture +tags: $:/tags/Image + + + + + + \ No newline at end of file diff --git a/core/images/plugin-generic-language.tid b/core/images/plugin-generic-language.tid old mode 100644 new mode 100755 diff --git a/core/images/plugin-generic-plugin.tid b/core/images/plugin-generic-plugin.tid old mode 100644 new mode 100755 diff --git a/core/images/plugin-generic-theme.tid b/core/images/plugin-generic-theme.tid old mode 100644 new mode 100755 diff --git a/core/images/preview-closed.tid b/core/images/preview-closed.tid new file mode 100755 index 000000000..1ca8f24ba --- /dev/null +++ b/core/images/preview-closed.tid @@ -0,0 +1,15 @@ +title: $:/core/images/preview-closed +tags: $:/tags/Image + + + + + + + + + + + + + \ No newline at end of file diff --git a/core/images/preview-open.tid b/core/images/preview-open.tid new file mode 100755 index 000000000..17f2319e1 --- /dev/null +++ b/core/images/preview-open.tid @@ -0,0 +1,9 @@ +title: $:/core/images/preview-open +tags: $:/tags/Image + + + + + + + \ No newline at end of file diff --git a/core/images/print-button.tid b/core/images/print-button.tid new file mode 100644 index 000000000..5e7c1d8e0 --- /dev/null +++ b/core/images/print-button.tid @@ -0,0 +1,12 @@ +title: $:/core/images/print-button +tags: $:/tags/Image + + + + + + + + + + \ No newline at end of file diff --git a/core/images/quote.tid b/core/images/quote.tid new file mode 100755 index 000000000..882b1debc --- /dev/null +++ b/core/images/quote.tid @@ -0,0 +1,8 @@ +title: $:/core/images/quote +tags: $:/tags/Image + + + + + + \ No newline at end of file diff --git a/core/images/refresh-button.tid b/core/images/refresh-button.tid old mode 100644 new mode 100755 diff --git a/core/images/right-arrow.tid b/core/images/right-arrow.tid old mode 100644 new mode 100755 diff --git a/core/images/save-button.tid b/core/images/save-button.tid old mode 100644 new mode 100755 diff --git a/core/images/size.tid b/core/images/size.tid new file mode 100755 index 000000000..4822dbb50 --- /dev/null +++ b/core/images/size.tid @@ -0,0 +1,6 @@ +title: $:/core/images/size +tags: $:/tags/Image + + + + \ No newline at end of file diff --git a/core/images/spiral.tid b/core/images/spiral.tid old mode 100644 new mode 100755 diff --git a/core/images/stamp.tid b/core/images/stamp.tid new file mode 100755 index 000000000..ab8949c1d --- /dev/null +++ b/core/images/stamp.tid @@ -0,0 +1,8 @@ +title: $:/core/images/stamp +tags: $:/tags/Image + + + + + + \ No newline at end of file diff --git a/core/images/star-filled.tid b/core/images/star-filled.tid old mode 100644 new mode 100755 diff --git a/core/images/storyview-classic.tid b/core/images/storyview-classic.tid old mode 100644 new mode 100755 diff --git a/core/images/storyview-pop.tid b/core/images/storyview-pop.tid old mode 100644 new mode 100755 diff --git a/core/images/storyview-zoomin.tid b/core/images/storyview-zoomin.tid old mode 100644 new mode 100755 diff --git a/core/images/strikethrough.tid b/core/images/strikethrough.tid new file mode 100755 index 000000000..80898c870 --- /dev/null +++ b/core/images/strikethrough.tid @@ -0,0 +1,9 @@ +title: $:/core/images/strikethrough +tags: $:/tags/Image + + + + + + + \ No newline at end of file diff --git a/core/images/subscript.tid b/core/images/subscript.tid new file mode 100755 index 000000000..a56aa2f1d --- /dev/null +++ b/core/images/subscript.tid @@ -0,0 +1,8 @@ +title: $:/core/images/subscript +tags: $:/tags/Image + + + + + + \ No newline at end of file diff --git a/core/images/superscript.tid b/core/images/superscript.tid new file mode 100755 index 000000000..ca48636e0 --- /dev/null +++ b/core/images/superscript.tid @@ -0,0 +1,8 @@ +title: $:/core/images/superscript +tags: $:/tags/Image + + + + + + \ No newline at end of file diff --git a/core/images/tag-button.tid b/core/images/tag-button.tid old mode 100644 new mode 100755 diff --git a/core/images/theme-button.tid b/core/images/theme-button.tid old mode 100644 new mode 100755 diff --git a/core/images/tip.tid b/core/images/tip.tid old mode 100644 new mode 100755 diff --git a/core/images/twitter.tid b/core/images/twitter.tid old mode 100644 new mode 100755 diff --git a/core/images/underline.tid b/core/images/underline.tid new file mode 100755 index 000000000..22465748b --- /dev/null +++ b/core/images/underline.tid @@ -0,0 +1,8 @@ +title: $:/core/images/underline +tags: $:/tags/Image + + + + + + \ No newline at end of file diff --git a/core/images/unfold-all-button.tid b/core/images/unfold-all-button.tid old mode 100644 new mode 100755 diff --git a/core/images/unfold-button.tid b/core/images/unfold-button.tid old mode 100644 new mode 100755 diff --git a/core/images/unlocked-padlock.tid b/core/images/unlocked-padlock.tid old mode 100644 new mode 100755 diff --git a/core/images/up-arrow.tid b/core/images/up-arrow.tid old mode 100644 new mode 100755 diff --git a/core/images/video.tid b/core/images/video.tid old mode 100644 new mode 100755 diff --git a/core/images/warning.tid b/core/images/warning.tid old mode 100644 new mode 100755 diff --git a/core/language/en-GB/Buttons.multids b/core/language/en-GB/Buttons.multids index 1c1c23c50..412e35f8f 100644 --- a/core/language/en-GB/Buttons.multids +++ b/core/language/en-GB/Buttons.multids @@ -62,6 +62,10 @@ NewJournal/Caption: new journal NewJournal/Hint: Create a new journal tiddler NewJournalHere/Caption: new journal here NewJournalHere/Hint: Create a new journal tiddler tagged with this one +NewImage/Caption: new image +NewImage/Hint: Create a new image tiddler +NewMarkdown/Caption: new Markdown tiddler +NewMarkdown/Hint: Create a new Markdown tiddler NewTiddler/Caption: new tiddler NewTiddler/Hint: Create a new tiddler OpenWindow/Caption: open in new window @@ -72,6 +76,8 @@ Permalink/Caption: permalink Permalink/Hint: Set browser address bar to a direct link to this tiddler Permaview/Caption: permaview Permaview/Hint: Set browser address bar to a direct link to all the tiddlers in this story +Print/Caption: print page +Print/Hint: Print the current page Refresh/Caption: refresh Refresh/Hint: Perform a full refresh of the wiki Save/Caption: ok @@ -88,3 +94,78 @@ TagManager/Caption: tag manager TagManager/Hint: Open tag manager Theme/Caption: theme Theme/Hint: Choose the display theme +Bold/Caption: bold +Bold/Hint: Apply bold formatting to selection +Clear/Caption: clear +Clear/Hint: Clear image to solid colour +EditorHeight/Caption: editor height +EditorHeight/Caption/Auto: Automatically adjust height to fit content +EditorHeight/Caption/Fixed: Fixed height: +EditorHeight/Hint: Choose the height of the text editor +Excise/Caption: excise +Excise/Caption/Excise: Perform excision +Excise/Caption/MacroName: Macro name: +Excise/Caption/NewTitle: Title of new tiddler: +Excise/Caption/Replace: Replace excised text with: +Excise/Caption/Replace/Macro: macro +Excise/Caption/Replace/Link: link +Excise/Caption/Replace/Transclusion: transclusion +Excise/Caption/Tag: Tag new tiddler with the title of this tiddler +Excise/Caption/TiddlerExists: Warning: tiddler already exists +Excise/Hint: Excise the selected text into a new tiddler +Heading1/Caption: heading 1 +Heading1/Hint: Apply heading level 1 formatting to lines containing selection +Heading2/Caption: heading 2 +Heading2/Hint: Apply heading level 2 formatting to lines containing selection +Heading3/Caption: heading 3 +Heading3/Hint: Apply heading level 3 formatting to lines containing selection +Heading4/Caption: heading 4 +Heading4/Hint: Apply heading level 4 formatting to lines containing selection +Heading5/Caption: heading 5 +Heading5/Hint: Apply heading level 5 formatting to lines containing selection +Heading6/Caption: heading 6 +Heading6/Hint: Apply heading level 6 formatting to lines containing selection +Italic/Caption: italic +Italic/Hint: Apply italic formatting to selection +LineWidth/Caption: line width +LineWidth/Hint: Set line width for painting +Link/Caption: link +Link/Hint: Create wikitext link +ListBullet/Caption: bulleted list +ListBullet/Hint: Apply bulleted list formatting to lines containing selection +ListNumber/Caption: numbered list +ListNumber/Hint: Apply numbered list formatting to lines containing selection +MonoBlock/Caption: monospaced block +MonoBlock/Hint: Apply monospaced block formatting to lines containing selection +MonoLine/Caption: monospaced +MonoLine/Hint: Apply monospaced character formatting to selection +Opacity/Caption: opacity +Opacity/Hint: Set painting opacity +Paint/Caption: paint colour +Paint/Hint: Set painting colour +Picture/Caption: picture +Picture/Hint: Insert picture +Preview/Caption: preview +Preview/Hint: Show preview pane +PreviewType/Caption: preview type +PreviewType/Hint: Choose preview type +Quote/Caption: quote +Quote/Hint: Apply quoted text formatting to lines containing selection +Size/Caption: image size +Size/Caption/Height: Height: +Size/Caption/Resize: Resize image +Size/Caption/Width: Width: +Size/Hint: Set image size +Stamp/Caption: stamp +Stamp/Caption/New: Add your own +Stamp/Hint: Insert a preconfigured snippet of text +Stamp/New/Title: Name as shown in menu +Stamp/New/Text: Text of snippet. (Remember to add a descriptive title in the caption field). +Strikethrough/Caption: strikethrough +Strikethrough/Hint: Apply strikethrough formatting to selection +Subscript/Caption: subscript +Subscript/Hint: Apply subscript formatting to selection +Superscript/Caption: superscript +Superscript/Hint: Apply superscript formatting to selection +Underline/Caption: underline +Underline/Hint: Apply underline formatting to selection diff --git a/core/language/en-GB/ControlPanel.multids b/core/language/en-GB/ControlPanel.multids index abd4e9ae7..5204d62aa 100644 --- a/core/language/en-GB/ControlPanel.multids +++ b/core/language/en-GB/ControlPanel.multids @@ -27,6 +27,19 @@ EditorTypes/Hint: These tiddlers determine which editor is used to edit specific EditorTypes/Type/Caption: Type Info/Caption: Info Info/Hint: Information about this TiddlyWiki +KeyboardShortcuts/Add/Prompt: Type shortcut here +KeyboardShortcuts/Add/Caption: add shortcut +KeyboardShortcuts/Caption: Keyboard Shortcuts +KeyboardShortcuts/Hint: Manage keyboard shortcut assignments +KeyboardShortcuts/NoShortcuts/Caption: No keyboard shortcuts assigned +KeyboardShortcuts/Remove/Hint: remove keyboard shortcut +KeyboardShortcuts/Platform/All: All platforms +KeyboardShortcuts/Platform/Mac: Macintosh platform only +KeyboardShortcuts/Platform/NonMac: Non-Macintosh platforms only +KeyboardShortcuts/Platform/Linux: Linux platform only +KeyboardShortcuts/Platform/NonLinux: Non-Linux platforms only +KeyboardShortcuts/Platform/Windows: Windows platform only +KeyboardShortcuts/Platform/NonWindows: Non-Windows platforms only LoadedModules/Caption: Loaded Modules LoadedModules/Hint: These are the currently loaded tiddler modules linked to their source tiddlers. Any italicised modules lack a source tiddler, typically because they were setup during the boot process. Palette/Caption: Palette @@ -39,12 +52,13 @@ Palette/HideEditor/Caption: hide editor Palette/Prompt: Current palette: Palette/ShowEditor/Caption: show editor Parsing/Caption: Parsing -Parsing/Hint: Here you can globally disable individual wiki parser rules. Take care as disabling some parser rules can prevent ~TiddlyWiki functioning correctly (you can restore normal operation with [[safe mode|http://tiddlywiki.com/#SafeMode]] ) +Parsing/Hint: Here you can globally disable/enable wiki parser rules. For changes to take effect, save and reload your wiki. Disabling certain parser rules can prevent <$text text="TiddlyWiki"/> from functioning correctly. Use [[safe mode|http://tiddlywiki.com/#SafeMode]] to restore normal operation. Parsing/Block/Caption: Block Parse Rules Parsing/Inline/Caption: Inline Parse Rules Parsing/Pragma/Caption: Pragma Parse Rules -Plugins/Add/Hint: Install plugins from the official library Plugins/Add/Caption: Get more plugins +Plugins/Add/Hint: Install plugins from the official library +Plugins/AlreadyInstalled/Hint: This plugin is already installed at version <$text text=<>/> Plugins/Caption: Plugins Plugins/Disable/Caption: disable Plugins/Disable/Hint: Disable this plugin when reloading page @@ -52,14 +66,17 @@ Plugins/Disabled/Status: (disabled) Plugins/Empty/Hint: None Plugins/Enable/Caption: enable Plugins/Enable/Hint: Enable this plugin when reloading page -Plugins/Install: install +Plugins/Install/Caption: install Plugins/Installed/Hint: Currently installed plugins: Plugins/Languages/Caption: Languages Plugins/Languages/Hint: Language pack plugins +Plugins/NoInfoFound/Hint: No ''"<$text text=<>/>"'' found +Plugins/NoInformation/Hint: No information provided +Plugins/NotInstalled/Hint: This plugin is not currently installed Plugins/OpenPluginLibrary: open plugin library Plugins/Plugins/Caption: Plugins Plugins/Plugins/Hint: Plugins -Plugins/Reinstall: reinstall +Plugins/Reinstall/Caption: reinstall Plugins/Themes/Caption: Themes Plugins/Themes/Hint: Theme plugins Saving/Caption: Saving @@ -83,6 +100,9 @@ Settings/CamelCase/Caption: Camel Case Wiki Links Settings/CamelCase/Hint: You can globally disable automatic linking of ~CamelCase phrases. Requires reload to take effect Settings/CamelCase/Description: Enable automatic ~CamelCase linking Settings/Caption: Settings +Settings/EditorToolbar/Caption: Editor Toolbar +Settings/EditorToolbar/Hint: Enable or disable the editor toolbar: +Settings/EditorToolbar/Description: Show editor toolbar Settings/Hint: These settings let you customise the behaviour of TiddlyWiki. Settings/NavigationAddressBar/Caption: Navigation Address Bar Settings/NavigationAddressBar/Hint: Behaviour of the browser address bar when navigating to a tiddler: @@ -118,6 +138,9 @@ Settings/TitleLinks/Caption: Tiddler Titles Settings/TitleLinks/Hint: Optionally display tiddler titles as links Settings/TitleLinks/No/Description: Do not display tiddler titles as links Settings/TitleLinks/Yes/Description: Display tiddler titles as links +Settings/MissingLinks/Caption: Wiki Links +Settings/MissingLinks/Hint: Choose whether to link to tiddlers that do not exist yet +Settings/MissingLinks/Description: Enable links to missing tiddlers StoryView/Caption: Story View StoryView/Prompt: Current view: Theme/Caption: Theme @@ -130,6 +153,8 @@ Toolbars/EditToolbar/Hint: Choose which buttons are displayed for tiddlers in ed Toolbars/Hint: Select which toolbar buttons are displayed Toolbars/PageControls/Caption: Page Toolbar Toolbars/PageControls/Hint: Choose which buttons are displayed on the main page toolbar +Toolbars/EditorToolbar/Caption: Editor Toolbar +Toolbars/EditorToolbar/Hint: Choose which buttons are displayed in the editor toolbar. Note that some buttons will only appear when editing tiddlers of a certain type Toolbars/ViewToolbar/Caption: View Toolbar Toolbars/ViewToolbar/Hint: Choose which buttons are displayed for tiddlers in view mode Tools/Download/Full/Caption: Download full wiki diff --git a/core/language/en-GB/Docs/ModuleTypes.multids b/core/language/en-GB/Docs/ModuleTypes.multids index 7d666e309..b58c85ad8 100644 --- a/core/language/en-GB/Docs/ModuleTypes.multids +++ b/core/language/en-GB/Docs/ModuleTypes.multids @@ -1,16 +1,21 @@ title: $:/language/Docs/ModuleTypes/ +allfilteroperator: A sub-operator for the ''all'' filter operator. animation: Animations that may be used with the RevealWidget. +bitmapeditoroperation: A bitmap editor toolbar operation. command: Commands that can be executed under Node.js. config: Data to be inserted into `$tw.config`. filteroperator: Individual filter operator methods. global: Global data to be inserted into `$tw`. +info: Publishes system information via the [[$:/temp/info-plugin]] pseudo-plugin. isfilteroperator: Operands for the ''is'' filter operator. +library: Generic module type for general purpose JavaScript modules. macro: JavaScript macro definitions. parser: Parsers for different content types. saver: Savers handle different methods for saving files from the browser. startup: Startup functions. storyview: Story views customise the animation and behaviour of list widgets. +texteditoroperation: A text editor toolbar operation. tiddlerdeserializer: Converts different content types into tiddlers. tiddlerfield: Defines the behaviour of an individual tiddler field. tiddlermethod: Adds methods to the `$tw.Tiddler` prototype. diff --git a/core/language/en-GB/EditTemplate.multids b/core/language/en-GB/EditTemplate.multids index 2125495e2..8d8801af9 100644 --- a/core/language/en-GB/EditTemplate.multids +++ b/core/language/en-GB/EditTemplate.multids @@ -1,10 +1,8 @@ title: $:/language/EditTemplate/ Body/External/Hint: This is an external tiddler stored outside of the main TiddlyWiki file. You can edit the tags and fields but cannot directly edit the content itself -Body/Hint: Use [[wiki text|http://tiddlywiki.com/static/WikiText.html]] to add formatting, images, and dynamic features Body/Placeholder: Type the text for this tiddler -Body/Preview/Button/Hide: hide preview -Body/Preview/Button/Show: show preview +Body/Preview/Type/Output: output Field/Remove/Caption: remove field Field/Remove/Hint: Remove field Fields/Add/Button: add @@ -19,6 +17,7 @@ Tags/Add/Button: add Tags/Add/Placeholder: tag name Tags/Dropdown/Caption: tag list Tags/Dropdown/Hint: Show tag list +Title/BadCharacterWarning: Warning: avoid using any of the characters <> in tiddler titles Type/Dropdown/Caption: content type list Type/Dropdown/Hint: Show content type list Type/Delete/Caption: delete content type diff --git a/core/language/en-GB/GettingStarted.tid b/core/language/en-GB/GettingStarted.tid index 2be983442..5911f04d7 100644 --- a/core/language/en-GB/GettingStarted.tid +++ b/core/language/en-GB/GettingStarted.tid @@ -11,7 +11,7 @@ Before you start storing important information in ~TiddlyWiki it is important to |<$link to="$:/SiteTitle"><> |<$edit-text tiddler="$:/SiteTitle" default="" tag="input"/> | |<$link to="$:/SiteSubtitle"><> |<$edit-text tiddler="$:/SiteSubtitle" default="" tag="input"/> | -|<$link to="$:/DefaultTiddlers"><> |<>
<$edit-text tag="textarea" tiddler="$:/DefaultTiddlers"/>
//<>// | +|<$link to="$:/DefaultTiddlers"><> |<>
<$edit tag="textarea" tiddler="$:/DefaultTiddlers"/>
//<>// | See the [[control panel|$:/ControlPanel]] for more options. diff --git a/core/language/en-GB/Import.multids b/core/language/en-GB/Import.multids index 9475d6a2c..697d3b510 100644 --- a/core/language/en-GB/Import.multids +++ b/core/language/en-GB/Import.multids @@ -1,6 +1,6 @@ title: $:/language/Import/ -Imported: The following tiddlers were imported: +Imported/Hint: The following tiddlers were imported: Listing/Cancel/Caption: Cancel Listing/Hint: These tiddlers are ready to import: Listing/Import/Caption: Import diff --git a/core/language/en-GB/Misc.multids b/core/language/en-GB/Misc.multids index d953eb01f..c21b68326 100644 --- a/core/language/en-GB/Misc.multids +++ b/core/language/en-GB/Misc.multids @@ -5,10 +5,12 @@ BinaryWarning/Prompt: This tiddler contains binary data ClassicWarning/Hint: This tiddler is written in TiddlyWiki Classic wiki text format, which is not fully compatible with TiddlyWiki version 5. See http://tiddlywiki.com/static/Upgrading.html for more details. ClassicWarning/Upgrade/Caption: upgrade CloseAll/Button: close all +ColourPicker/Recent: Recent: ConfirmCancelTiddler: Do you wish to discard changes to the tiddler "<$text text=<>/>"? ConfirmDeleteTiddler: Do you wish to delete the tiddler "<$text text=<<title>>/>"? ConfirmOverwriteTiddler: Do you wish to overwrite the tiddler "<$text text=<<title>>/>"? ConfirmEditShadowTiddler: You are about to edit a ShadowTiddler. Any changes will override the default system making future upgrades non-trivial. Are you sure you want to edit "<$text text=<<title>>/>"? +Count: count DefaultNewTiddlerTitle: New Tiddler DropMessage: Drop here (or use the 'Escape' key to cancel) Encryption/Cancel: Cancel @@ -19,11 +21,23 @@ Encryption/Password: Password Encryption/RepeatPassword: Repeat password Encryption/PasswordNoMatch: Passwords do not match Encryption/SetPassword: Set password +Error/Caption: Error +Error/Filter: Filter error +Error/FilterSyntax: Syntax error in filter expression +Error/IsFilterOperator: Filter Error: Unknown operand for the 'is' filter operator +Error/LoadingPluginLibrary: Error loading plugin library +Error/RecursiveTransclusion: Recursive transclusion error in transclude widget +Error/RetrievingSkinny: Error retrieving skinny tiddler list +Error/SavingToTWEdit: Error saving to TWEdit +Error/WhileSaving: Error while saving +Error/XMLHttpRequest: XMLHttpRequest error code InternalJavaScriptError/Title: Internal JavaScript Error InternalJavaScriptError/Hint: Well, this is embarrassing. It is recommended that you restart TiddlyWiki by refreshing your browser InvalidFieldName: Illegal characters in field name "<$text text=<<fieldName>>/>". Fields can only contain lowercase letters, digits and the characters underscore (`_`), hyphen (`-`) and period (`.`) LazyLoadingWarning: <p>Loading external text from ''<$text text={{!!_canonical_uri}}/>''</p><p>If this message doesn't disappear you may be using a browser that doesn't support external text in this configuration. See http://tiddlywiki.com/#ExternalText</p> +LoginToTiddlySpace: Login to TiddlySpace MissingTiddler/Hint: Missing tiddler "<$text text=<<currentTiddler>>/>" - click {{$:/core/images/edit-button}} to create +No: No 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. PluginReloadWarning: Please save {{$:/core/ui/Buttons/save-wiki}} and reload {{$:/core/ui/Buttons/refresh}} to allow changes to plugins to take effect @@ -36,3 +50,4 @@ TagManager/Info/Heading: Info TagManager/Tag/Heading: Tag Tiddler/DateFormat: DDth MMM YYYY at hh12:0mmam UnsavedChangesWarning: You have unsaved changes in TiddlyWiki +Yes: Yes diff --git a/core/language/en-GB/Search.multids b/core/language/en-GB/Search.multids index fd6eadc7e..f6b207000 100644 --- a/core/language/en-GB/Search.multids +++ b/core/language/en-GB/Search.multids @@ -8,6 +8,7 @@ Matches: //<small><<resultCount>> matches</small>// Matches/All: All matches: Matches/Title: Title matches: Search: Search +Search/TooShort: Search text too short Shadows/Caption: Shadows Shadows/Hint: Search for shadow tiddlers Shadows/Matches: //<small><<resultCount>> matches</small>// diff --git a/core/language/en-GB/Snippets/ListByTag.tid b/core/language/en-GB/Snippets/ListByTag.tid new file mode 100644 index 000000000..e8f9cef49 --- /dev/null +++ b/core/language/en-GB/Snippets/ListByTag.tid @@ -0,0 +1,5 @@ +title: $:/language/Snippets/ListByTag +tags: $:/tags/TextEditor/Snippet +caption: List of tiddlers by tag + +<<list-links "[tag[task]sort[title]]">> diff --git a/core/language/en-GB/Snippets/MacroDefinition.tid b/core/language/en-GB/Snippets/MacroDefinition.tid new file mode 100644 index 000000000..3829ac903 --- /dev/null +++ b/core/language/en-GB/Snippets/MacroDefinition.tid @@ -0,0 +1,7 @@ +title: $:/language/Snippets/MacroDefinition +tags: $:/tags/TextEditor/Snippet +caption: Macro definition + +\define macroName(param1:"default value",param2) +Text of the macro +\end diff --git a/core/language/en-GB/Snippets/Table 4x3.tid b/core/language/en-GB/Snippets/Table 4x3.tid new file mode 100644 index 000000000..99f64a68d --- /dev/null +++ b/core/language/en-GB/Snippets/Table 4x3.tid @@ -0,0 +1,8 @@ +title: $:/language/Snippets/Table4x3 +tags: $:/tags/TextEditor/Snippet +caption: Table with 4 columns by 3 rows + +|! |!Alpha |!Beta |!Gamma |!Delta | +|!One | | | | | +|!Two | | | | | +|!Three | | | | | diff --git a/core/language/en-GB/Snippets/TableOfContents.tid b/core/language/en-GB/Snippets/TableOfContents.tid new file mode 100644 index 000000000..40fe4aafb --- /dev/null +++ b/core/language/en-GB/Snippets/TableOfContents.tid @@ -0,0 +1,9 @@ +title: $:/language/Snippets/TableOfContents +tags: $:/tags/TextEditor/Snippet +caption: Table of Contents + +<div class="tc-table-of-contents"> + +<<toc-selective-expandable 'TableOfContents'>> + +</div> \ No newline at end of file diff --git a/core/language/en-GB/ThemeTweaks.multids b/core/language/en-GB/ThemeTweaks.multids new file mode 100644 index 000000000..694d56b13 --- /dev/null +++ b/core/language/en-GB/ThemeTweaks.multids @@ -0,0 +1,41 @@ +title: $:/language/ThemeTweaks/ + +ThemeTweaks: Theme Tweaks +ThemeTweaks/Hint: You can tweak certain aspects of the ''Vanilla'' theme. +Options: Options +Options/SidebarLayout: Sidebar layout +Options/SidebarLayout/Fixed-Fluid: Fixed story, fluid sidebar +Options/SidebarLayout/Fluid-Fixed: Fluid story, fixed sidebar +Options/StickyTitles: Sticky titles +Options/StickyTitles/Hint: Causes tiddler titles to "stick" to the top of the browser window. Caution: Does not work at all with Chrome, and causes some layout issues in Firefox +Options/CodeWrapping: Wrap long lines in code blocks +Settings: Settings +Settings/FontFamily: Font family +Settings/CodeFontFamily: Code font family +Settings/BackgroundImage: Page background image +Settings/BackgroundImageAttachment: Page background image attachment +Settings/BackgroundImageAttachment/Scroll: Scroll with tiddlers +Settings/BackgroundImageAttachment/Fixed: Fixed to window +Settings/BackgroundImageSize: Page background image size +Settings/BackgroundImageSize/Auto: Auto +Settings/BackgroundImageSize/Cover: Cover +Settings/BackgroundImageSize/Contain: Contain +Metrics: Sizes +Metrics/FontSize: Font size +Metrics/LineHeight: Line height +Metrics/BodyFontSize: Font size for tiddler body +Metrics/BodyLineHeight: Line height for tiddler body +Metrics/StoryLeft: Story left position +Metrics/StoryLeft/Hint: how far the left margin of the story river<br>(tiddler area) is from the left of the page +Metrics/StoryTop: Story top position +Metrics/StoryTop/Hint: how far the top margin of the story river<br>is from the top of the page +Metrics/StoryRight: Story right +Metrics/StoryRight/Hint: how far the left margin of the sidebar <br>is from the left of the page +Metrics/StoryWidth: Story width +Metrics/StoryWidth/Hint: the overall width of the story river +Metrics/TiddlerWidth: Tiddler width +Metrics/TiddlerWidth/Hint: within the story river +Metrics/SidebarBreakpoint: Sidebar breakpoint +Metrics/SidebarBreakpoint/Hint: the minimum page width at which the story<br>river and sidebar will appear side by side +Metrics/SidebarWidth: Sidebar width +Metrics/SidebarWidth/Hint: the width of the sidebar in fluid-fixed layout diff --git a/core/modules/commands/savetiddler.js b/core/modules/commands/savetiddler.js index b6c6ac376..efc484ec7 100644 --- a/core/modules/commands/savetiddler.js +++ b/core/modules/commands/savetiddler.js @@ -32,13 +32,17 @@ Command.prototype.execute = function() { path = require("path"), title = this.params[0], filename = path.resolve(this.commander.outputPath,this.params[1]), - tiddler = this.commander.wiki.getTiddler(title), - type = tiddler.fields.type || "text/vnd.tiddlywiki", - contentTypeInfo = $tw.config.contentTypeInfo[type] || {encoding: "utf8"}; - $tw.utils.createFileDirectories(filename); - fs.writeFile(filename,tiddler.fields.text,contentTypeInfo.encoding,function(err) { - self.callback(err); - }); + tiddler = this.commander.wiki.getTiddler(title); + if(tiddler) { + var type = tiddler.fields.type || "text/vnd.tiddlywiki", + contentTypeInfo = $tw.config.contentTypeInfo[type] || {encoding: "utf8"}; + $tw.utils.createFileDirectories(filename); + fs.writeFile(filename,tiddler.fields.text,contentTypeInfo.encoding,function(err) { + self.callback(err); + }); + } else { + return "Missing tiddler: " + title; + } return null; }; diff --git a/core/modules/deserializers.js b/core/modules/deserializers.js index 00815f831..16f5a373f 100644 --- a/core/modules/deserializers.js +++ b/core/modules/deserializers.js @@ -72,8 +72,16 @@ exports["application/x-tiddler-html-div"] = function(text,fields) { }; exports["application/json"] = function(text,fields) { - var incoming = JSON.parse(text), + var incoming, results = []; + try { + incoming = JSON.parse(text); + } catch(e) { + incoming = [{ + title: "JSON error: " + e, + text: "" + }] + } if($tw.utils.isArray(incoming)) { for(var t=0; t<incoming.length; t++) { var incomingFields = incoming[t], diff --git a/core/modules/editor/engines/framed.js b/core/modules/editor/engines/framed.js new file mode 100644 index 000000000..d4328c509 --- /dev/null +++ b/core/modules/editor/engines/framed.js @@ -0,0 +1,206 @@ +/*\ +title: $:/core/modules/editor/engines/framed.js +type: application/javascript +module-type: library + +Text editor engine based on a simple input or textarea within an iframe. This is done so that the selection is preserved even when clicking away from the textarea + +\*/ +(function(){ + +/*jslint node: true,browser: true */ +/*global $tw: false */ +"use strict"; + +var HEIGHT_VALUE_TITLE = "$:/config/TextEditor/EditorHeight/Height"; + +function FramedEngine(options) { + // Save our options + options = options || {}; + this.widget = options.widget; + this.value = options.value; + this.parentNode = options.parentNode; + this.nextSibling = options.nextSibling; + // Create our hidden dummy text area for reading styles + this.dummyTextArea = this.widget.document.createElement("textarea"); + if(this.widget.editClass) { + this.dummyTextArea.className = this.widget.editClass; + } + this.dummyTextArea.setAttribute("hidden","true"); + this.parentNode.insertBefore(this.dummyTextArea,this.nextSibling); + this.widget.domNodes.push(this.dummyTextArea); + // Create the iframe + this.iframeNode = this.widget.document.createElement("iframe"); + this.parentNode.insertBefore(this.iframeNode,this.nextSibling); + this.iframeDoc = this.iframeNode.contentWindow.document; + // (Firefox requires us to put some empty content in the iframe) + this.iframeDoc.open(); + this.iframeDoc.write(""); + this.iframeDoc.close(); + // Style the iframe + this.iframeNode.className = this.dummyTextArea.className; + this.iframeNode.style.border = "none"; + this.iframeNode.style.padding = "0"; + this.iframeNode.style.resize = "none"; + this.iframeDoc.body.style.margin = "0"; + this.iframeDoc.body.style.padding = "0"; + this.widget.domNodes.push(this.iframeNode); + // Construct the textarea or input node + var tag = this.widget.editTag; + if($tw.config.htmlUnsafeElements.indexOf(tag) !== -1) { + tag = "input"; + } + this.domNode = this.iframeDoc.createElement(tag); + // Set the text + if(this.widget.editTag === "textarea") { + this.domNode.appendChild(this.iframeDoc.createTextNode(this.value)); + } else { + this.domNode.value = this.value; + } + // Set the attributes + if(this.widget.editType) { + this.domNode.setAttribute("type",this.widget.editType); + } + if(this.widget.editPlaceholder) { + this.domNode.setAttribute("placeholder",this.widget.editPlaceholder); + } + if(this.widget.editSize) { + this.domNode.setAttribute("size",this.widget.editSize); + } + if(this.widget.editRows) { + this.domNode.setAttribute("rows",this.widget.editRows); + } + // Copy the styles from the dummy textarea + this.copyStyles(); + // Add event listeners + $tw.utils.addEventListeners(this.domNode,[ + {name: "input",handlerObject: this,handlerMethod: "handleInputEvent"}, + {name: "keydown",handlerObject: this.widget,handlerMethod: "handleKeydownEvent"} + ]); + // Insert the element into the DOM + this.iframeDoc.body.appendChild(this.domNode); +} + +/* +Copy styles from the dummy text area to the textarea in the iframe +*/ +FramedEngine.prototype.copyStyles = function() { + // Copy all styles + $tw.utils.copyStyles(this.dummyTextArea,this.domNode); + // Override the ones that should not be set the same as the dummy textarea + this.domNode.style.display = "block"; + this.domNode.style.width = "100%"; + this.domNode.style.margin = "0"; + // In Chrome setting -webkit-text-fill-color overrides the placeholder text colour + this.domNode.style["-webkit-text-fill-color"] = "currentcolor"; +}; + +/* +Set the text of the engine if it doesn't currently have focus +*/ +FramedEngine.prototype.setText = function(text,type) { + if(!this.domNode.isTiddlyWikiFakeDom) { + if(this.domNode.ownerDocument.activeElement !== this.domNode) { + this.domNode.value = text; + } + // Fix the height if needed + this.fixHeight(); + } +}; + +/* +Get the text of the engine +*/ +FramedEngine.prototype.getText = function() { + return this.domNode.value; +}; + +/* +Fix the height of textarea to fit content +*/ +FramedEngine.prototype.fixHeight = function() { + // Make sure styles are updated + this.copyStyles(); + // Adjust height + if(this.widget.editTag === "textarea") { + if(this.widget.editAutoHeight) { + if(this.domNode && !this.domNode.isTiddlyWikiFakeDom) { + var newHeight = $tw.utils.resizeTextAreaToFit(this.domNode,this.widget.editMinHeight); + this.iframeNode.style.height = (newHeight + 14) + "px"; // +14 for the border on the textarea + } + } else { + var fixedHeight = parseInt(this.widget.wiki.getTiddlerText(HEIGHT_VALUE_TITLE,"400px"),10); + fixedHeight = Math.max(fixedHeight,20); + this.domNode.style.height = fixedHeight + "px"; + this.iframeNode.style.height = (fixedHeight + 14) + "px"; + } + } +}; + +/* +Focus the engine node +*/ +FramedEngine.prototype.focus = function() { + if(this.domNode.focus && this.domNode.select) { + this.domNode.focus(); + this.domNode.select(); + } +}; + +/* +Handle a dom "input" event which occurs when the text has changed +*/ +FramedEngine.prototype.handleInputEvent = function(event) { + this.widget.saveChanges(this.getText()); + this.fixHeight(); + return true; +}; + +/* +Create a blank structure representing a text operation +*/ +FramedEngine.prototype.createTextOperation = function() { + var operation = { + text: this.domNode.value, + selStart: this.domNode.selectionStart, + selEnd: this.domNode.selectionEnd, + cutStart: null, + cutEnd: null, + replacement: null, + newSelStart: null, + newSelEnd: null + }; + operation.selection = operation.text.substring(operation.selStart,operation.selEnd); + return operation; +}; + +/* +Execute a text operation +*/ +FramedEngine.prototype.executeTextOperation = function(operation) { + // Perform the required changes to the text area and the underlying tiddler + var newText = operation.text; + if(operation.replacement !== null) { + newText = operation.text.substring(0,operation.cutStart) + operation.replacement + operation.text.substring(operation.cutEnd); + // Attempt to use a execCommand to modify the value of the control + if(this.iframeDoc.queryCommandSupported("insertText") && this.iframeDoc.queryCommandSupported("delete") && !$tw.browser.isFirefox) { + this.domNode.focus(); + this.domNode.setSelectionRange(operation.cutStart,operation.cutEnd); + if(operation.replacement === "") { + this.iframeDoc.execCommand("delete",false,""); + } else { + this.iframeDoc.execCommand("insertText",false,operation.replacement); + } + } else { + this.domNode.value = newText; + } + this.domNode.focus(); + this.domNode.setSelectionRange(operation.newSelStart,operation.newSelEnd); + } + this.domNode.focus(); + return newText; +}; + +exports.FramedEngine = FramedEngine; + +})(); diff --git a/core/modules/editor/engines/simple.js b/core/modules/editor/engines/simple.js new file mode 100644 index 000000000..900d95276 --- /dev/null +++ b/core/modules/editor/engines/simple.js @@ -0,0 +1,148 @@ +/*\ +title: $:/core/modules/editor/engines/simple.js +type: application/javascript +module-type: library + +Text editor engine based on a simple input or textarea tag + +\*/ +(function(){ + +/*jslint node: true, browser: true */ +/*global $tw: false */ +"use strict"; + +var HEIGHT_VALUE_TITLE = "$:/config/TextEditor/EditorHeight/Height"; + +function SimpleEngine(options) { + // Save our options + options = options || {}; + this.widget = options.widget; + this.value = options.value; + this.parentNode = options.parentNode; + this.nextSibling = options.nextSibling; + // Construct the textarea or input node + var tag = this.widget.editTag; + if($tw.config.htmlUnsafeElements.indexOf(tag) !== -1) { + tag = "input"; + } + this.domNode = this.widget.document.createElement(tag); + // Set the text + if(this.widget.editTag === "textarea") { + this.domNode.appendChild(this.widget.document.createTextNode(this.value)); + } else { + this.domNode.value = this.value; + } + // Set the attributes + if(this.widget.editType) { + this.domNode.setAttribute("type",this.widget.editType); + } + if(this.widget.editPlaceholder) { + this.domNode.setAttribute("placeholder",this.widget.editPlaceholder); + } + if(this.widget.editSize) { + this.domNode.setAttribute("size",this.widget.editSize); + } + if(this.widget.editRows) { + this.domNode.setAttribute("rows",this.widget.editRows); + } + if(this.widget.editClass) { + this.domNode.className = this.widget.editClass; + } + // Add an input event handler + $tw.utils.addEventListeners(this.domNode,[ + {name: "focus", handlerObject: this, handlerMethod: "handleFocusEvent"}, + {name: "input", handlerObject: this, handlerMethod: "handleInputEvent"} + ]); + // Insert the element into the DOM + this.parentNode.insertBefore(this.domNode,this.nextSibling); + this.widget.domNodes.push(this.domNode); +} + +/* +Set the text of the engine if it doesn't currently have focus +*/ +SimpleEngine.prototype.setText = function(text,type) { + if(!this.domNode.isTiddlyWikiFakeDom) { + if(this.domNode.ownerDocument.activeElement !== this.domNode) { + this.domNode.value = text; + } + // Fix the height if needed + this.fixHeight(); + } +}; + +/* +Get the text of the engine +*/ +SimpleEngine.prototype.getText = function() { + return this.domNode.value; +}; + +/* +Fix the height of textarea to fit content +*/ +SimpleEngine.prototype.fixHeight = function() { + if(this.widget.editTag === "textarea") { + if(this.widget.editAutoHeight) { + if(this.domNode && !this.domNode.isTiddlyWikiFakeDom) { + $tw.utils.resizeTextAreaToFit(this.domNode,this.widget.editMinHeight); + } + } else { + var fixedHeight = parseInt(this.widget.wiki.getTiddlerText(HEIGHT_VALUE_TITLE,"400px"),10); + fixedHeight = Math.max(fixedHeight,20); + this.domNode.style.height = fixedHeight + "px"; + } + } +}; + +/* +Focus the engine node +*/ +SimpleEngine.prototype.focus = function() { + if(this.domNode.focus && this.domNode.select) { + this.domNode.focus(); + this.domNode.select(); + } +}; + +/* +Handle a dom "input" event which occurs when the text has changed +*/ +SimpleEngine.prototype.handleInputEvent = function(event) { + this.widget.saveChanges(this.getText()); + this.fixHeight(); + return true; +}; + +/* +Handle a dom "focus" event +*/ +SimpleEngine.prototype.handleFocusEvent = function(event) { + if(this.widget.editFocusPopup) { + $tw.popup.triggerPopup({ + domNode: this.domNode, + title: this.widget.editFocusPopup, + wiki: this.widget.wiki, + force: true + }); + } + return true; +}; + +/* +Create a blank structure representing a text operation +*/ +SimpleEngine.prototype.createTextOperation = function() { + return null; +}; + +/* +Execute a text operation +*/ +SimpleEngine.prototype.executeTextOperation = function(operation) { +}; + +exports.SimpleEngine = SimpleEngine; + +})(); diff --git a/core/modules/editor/factory.js b/core/modules/editor/factory.js new file mode 100644 index 000000000..baad9ef94 --- /dev/null +++ b/core/modules/editor/factory.js @@ -0,0 +1,307 @@ +/*\ +title: $:/core/modules/editor/factory.js +type: application/javascript +module-type: library + +Factory for constructing text editor widgets with specified engines for the toolbar and non-toolbar cases + +\*/ +(function(){ + +/*jslint node: true, browser: true */ +/*global $tw: false */ +"use strict"; + +var DEFAULT_MIN_TEXT_AREA_HEIGHT = "100px"; // Minimum height of textareas in pixels + +// Configuration tiddlers +var HEIGHT_MODE_TITLE = "$:/config/TextEditor/EditorHeight/Mode"; +var ENABLE_TOOLBAR_TITLE = "$:/config/TextEditor/EnableToolbar"; + +var Widget = require("$:/core/modules/widgets/widget.js").widget; + +function editTextWidgetFactory(toolbarEngine,nonToolbarEngine) { + + var EditTextWidget = function(parseTreeNode,options) { + // Initialise the editor operations if they've not been done already + if(!this.editorOperations) { + EditTextWidget.prototype.editorOperations = {}; + $tw.modules.applyMethods("texteditoroperation",this.editorOperations); + } + this.initialise(parseTreeNode,options); + }; + + /* + Inherit from the base widget class + */ + EditTextWidget.prototype = new Widget(); + + /* + Render this widget into the DOM + */ + EditTextWidget.prototype.render = function(parent,nextSibling) { + // Save the parent dom node + this.parentDomNode = parent; + // Compute our attributes + this.computeAttributes(); + // Execute our logic + this.execute(); + // Create the wrapper for the toolbar and render its content + if(this.editShowToolbar) { + this.toolbarNode = this.document.createElement("div"); + this.toolbarNode.className = "tc-editor-toolbar"; + parent.insertBefore(this.toolbarNode,nextSibling); + this.renderChildren(this.toolbarNode,null); + this.domNodes.push(this.toolbarNode); + } + // Create our element + var editInfo = this.getEditInfo(), + Engine = this.editShowToolbar ? toolbarEngine : nonToolbarEngine; + this.engine = new Engine({ + widget: this, + value: editInfo.value, + type: editInfo.type, + parentNode: parent, + nextSibling: nextSibling + }); + // Call the postRender hook + if(this.postRender) { + this.postRender(); + } + // Fix height + this.engine.fixHeight(); + // Focus if required + if(this.editFocus === "true" || this.editFocus === "yes") { + this.engine.focus(); + } + // Add widget message listeners + this.addEventListeners([ + {type: "tm-edit-text-operation", handler: "handleEditTextOperationMessage"} + ]); + }; + + /* + Get the tiddler being edited and current value + */ + EditTextWidget.prototype.getEditInfo = function() { + // Get the edit value + var self = this, + value, + type = "text/plain", + update; + if(this.editIndex) { + value = this.wiki.extractTiddlerDataItem(this.editTitle,this.editIndex,this.editDefault); + update = function(value) { + var data = self.wiki.getTiddlerData(self.editTitle,{}); + if(data[self.editIndex] !== value) { + data[self.editIndex] = value; + self.wiki.setTiddlerData(self.editTitle,data); + } + }; + } else { + // Get the current tiddler and the field name + var tiddler = this.wiki.getTiddler(this.editTitle); + if(tiddler) { + // If we've got a tiddler, the value to display is the field string value + value = tiddler.getFieldString(this.editField); + if(this.editField === "text") { + type = tiddler.fields.type || "text/vnd.tiddlywiki"; + } + } else { + // Otherwise, we need to construct a default value for the editor + switch(this.editField) { + case "text": + value = "Type the text for the tiddler '" + this.editTitle + "'"; + type = "text/vnd.tiddlywiki"; + break; + case "title": + value = this.editTitle; + break; + default: + value = ""; + break; + } + if(this.editDefault !== undefined) { + value = this.editDefault; + } + } + update = function(value) { + var tiddler = self.wiki.getTiddler(self.editTitle), + updateFields = { + title: self.editTitle + }; + updateFields[self.editField] = value; + self.wiki.addTiddler(new $tw.Tiddler(self.wiki.getCreationFields(),tiddler,updateFields,self.wiki.getModificationFields())); + }; + } + if(this.editType) { + type = this.editType; + } + return {value: value || "", type: type, update: update}; + }; + + /* + Handle an edit text operation message from the toolbar + */ + EditTextWidget.prototype.handleEditTextOperationMessage = function(event) { + // Prepare information about the operation + var operation = this.engine.createTextOperation(); + // Invoke the handler for the selected operation + var handler = this.editorOperations[event.param]; + if(handler) { + handler.call(this,event,operation); + } + // Execute the operation via the engine + var newText = this.engine.executeTextOperation(operation); + // Fix the tiddler height and save changes + this.engine.fixHeight(); + this.saveChanges(newText); + }; + + /* + Compute the internal state of the widget + */ + EditTextWidget.prototype.execute = function() { + // Get our parameters + this.editTitle = this.getAttribute("tiddler",this.getVariable("currentTiddler")); + this.editField = this.getAttribute("field","text"); + this.editIndex = this.getAttribute("index"); + this.editDefault = this.getAttribute("default"); + this.editClass = this.getAttribute("class"); + this.editPlaceholder = this.getAttribute("placeholder"); + this.editSize = this.getAttribute("size"); + this.editRows = this.getAttribute("rows"); + this.editAutoHeight = this.wiki.getTiddlerText(HEIGHT_MODE_TITLE,"auto"); + this.editAutoHeight = this.getAttribute("autoHeight",this.editAutoHeight === "auto" ? "yes" : "no") === "yes"; + this.editMinHeight = this.getAttribute("minHeight",DEFAULT_MIN_TEXT_AREA_HEIGHT); + this.editFocusPopup = this.getAttribute("focusPopup"); + this.editFocus = this.getAttribute("focus"); + // Get the default editor element tag and type + var tag,type; + if(this.editField === "text") { + tag = "textarea"; + } else { + tag = "input"; + var fieldModule = $tw.Tiddler.fieldModules[this.editField]; + if(fieldModule && fieldModule.editTag) { + tag = fieldModule.editTag; + } + if(fieldModule && fieldModule.editType) { + type = fieldModule.editType; + } + type = type || "text"; + } + // Get the rest of our parameters + this.editTag = this.getAttribute("tag",tag); + this.editType = this.getAttribute("type",type); + // Make the child widgets + this.makeChildWidgets(); + // Determine whether to show the toolbar + this.editShowToolbar = this.wiki.getTiddlerText(ENABLE_TOOLBAR_TITLE,"yes"); + this.editShowToolbar = (this.editShowToolbar === "yes") && !!(this.children && this.children.length > 0); + }; + + /* + Selectively refreshes the widget if needed. Returns true if the widget or any of its children needed re-rendering + */ + EditTextWidget.prototype.refresh = function(changedTiddlers) { + var changedAttributes = this.computeAttributes(); + // Completely rerender if any of our attributes have changed + if(changedAttributes.tiddler || changedAttributes.field || changedAttributes.index || changedAttributes["default"] || changedAttributes["class"] || changedAttributes.placeholder || changedAttributes.size || changedAttributes.autoHeight || changedAttributes.minHeight || changedAttributes.focusPopup || changedAttributes.rows || changedTiddlers[HEIGHT_MODE_TITLE] || changedTiddlers[ENABLE_TOOLBAR_TITLE]) { + this.refreshSelf(); + return true; + } else if(changedTiddlers[this.editTitle]) { + var editInfo = this.getEditInfo(); + this.updateEditor(editInfo.value,editInfo.type); + } + this.engine.fixHeight(); + if(this.editShowToolbar) { + return this.refreshChildren(changedTiddlers); + } else { + return false; + } + }; + + /* + Update the editor with new text. This method is separate from updateEditorDomNode() + so that subclasses can override updateEditor() and still use updateEditorDomNode() + */ + EditTextWidget.prototype.updateEditor = function(text,type) { + this.updateEditorDomNode(text,type); + }; + + /* + Update the editor dom node with new text + */ + EditTextWidget.prototype.updateEditorDomNode = function(text,type) { + this.engine.setText(text,type); + }; + + /* + Save changes back to the tiddler store + */ + EditTextWidget.prototype.saveChanges = function(text) { + var editInfo = this.getEditInfo(); + if(text !== editInfo.value) { + editInfo.update(text); + } + }; + + /* + Handle a dom "keydown" event, which we'll bubble up to our container for the keyboard widgets benefit + */ + EditTextWidget.prototype.handleKeydownEvent = function(event) { + // Check for a keyboard shortcut + if(this.toolbarNode) { + var shortcutElements = this.toolbarNode.querySelectorAll("[data-tw-keyboard-shortcut]"); + for(var index=0; index<shortcutElements.length; index++) { + var el = shortcutElements[index], + shortcutData = el.getAttribute("data-tw-keyboard-shortcut"), + keyInfoArray = $tw.keyboardManager.parseKeyDescriptors(shortcutData,{ + wiki: this.wiki + }); + if($tw.keyboardManager.checkKeyDescriptors(event,keyInfoArray)) { + var clickEvent = this.document.createEvent("Events"); + clickEvent.initEvent("click",true,false); + el.dispatchEvent(clickEvent); + event.preventDefault(); + event.stopPropagation(); + return true; + } + } + } + // Propogate the event to the container + if(this.propogateKeydownEvent(event)) { + // Ignore the keydown if it was already handled + event.preventDefault(); + event.stopPropagation(); + return true; + } + // Otherwise, process the keydown normally + return false; + }; + + /* + Propogate keydown events to our container for the keyboard widgets benefit + */ + EditTextWidget.prototype.propogateKeydownEvent = function(event) { + var newEvent = this.document.createEventObject ? this.document.createEventObject() : this.document.createEvent("Events"); + if(newEvent.initEvent) { + newEvent.initEvent("keydown", true, true); + } + newEvent.keyCode = event.keyCode; + newEvent.which = event.which; + newEvent.metaKey = event.metaKey; + newEvent.ctrlKey = event.ctrlKey; + newEvent.altKey = event.altKey; + newEvent.shiftKey = event.shiftKey; + return !this.parentDomNode.dispatchEvent(newEvent); + }; + + return EditTextWidget; + +} + +exports.editTextWidgetFactory = editTextWidgetFactory; + +})(); diff --git a/core/modules/editor/operations/bitmap/clear.js b/core/modules/editor/operations/bitmap/clear.js new file mode 100644 index 000000000..cb86b43a1 --- /dev/null +++ b/core/modules/editor/operations/bitmap/clear.js @@ -0,0 +1,24 @@ +/*\ +title: $:/core/modules/editor/operations/bitmap/clear.js +type: application/javascript +module-type: bitmapeditoroperation + +Bitmap editor operation to clear the image + +\*/ +(function(){ + +/*jslint node: true, browser: true */ +/*global $tw: false */ +"use strict"; + +exports["clear"] = function(event) { + var ctx = this.canvasDomNode.getContext("2d"); + ctx.globalAlpha = 1; + ctx.fillStyle = event.paramObject.colour || "white"; + ctx.fillRect(0,0,this.canvasDomNode.width,this.canvasDomNode.height); + // Save changes + this.strokeEnd(); +}; + +})(); diff --git a/core/modules/editor/operations/bitmap/resize.js b/core/modules/editor/operations/bitmap/resize.js new file mode 100644 index 000000000..12059a5cb --- /dev/null +++ b/core/modules/editor/operations/bitmap/resize.js @@ -0,0 +1,29 @@ +/*\ +title: $:/core/modules/editor/operations/bitmap/resize.js +type: application/javascript +module-type: bitmapeditoroperation + +Bitmap editor operation to resize the image + +\*/ +(function(){ + +/*jslint node: true, browser: true */ +/*global $tw: false */ +"use strict"; + +exports["resize"] = function(event) { + // Get the new width + var newWidth = parseInt(event.paramObject.width || this.canvasDomNode.width,10), + newHeight = parseInt(event.paramObject.height || this.canvasDomNode.height,10); + // Update if necessary + if(newWidth > 0 && newHeight > 0 && !(newWidth === this.currCanvas.width && newHeight === this.currCanvas.height)) { + this.changeCanvasSize(newWidth,newHeight); + } + // Update the input controls + this.refreshToolbar(); + // Save the image into the tiddler + this.saveChanges(); +}; + +})(); diff --git a/core/modules/editor/operations/text/excise.js b/core/modules/editor/operations/text/excise.js new file mode 100644 index 000000000..ced771719 --- /dev/null +++ b/core/modules/editor/operations/text/excise.js @@ -0,0 +1,49 @@ +/*\ +title: $:/core/modules/editor/operations/text/excise.js +type: application/javascript +module-type: texteditoroperation + +Text editor operation to excise the selection to a new tiddler + +\*/ +(function(){ + +/*jslint node: true, browser: true */ +/*global $tw: false */ +"use strict"; + +exports["excise"] = function(event,operation) { + var editTiddler = this.wiki.getTiddler(this.editTitle), + editTiddlerTitle = this.editTitle; + if(editTiddler && editTiddler.fields["draft.of"]) { + editTiddlerTitle = editTiddler.fields["draft.of"]; + } + var excisionTitle = event.paramObject.title || this.wiki.generateNewTitle("New Excision"); + this.wiki.addTiddler(new $tw.Tiddler( + this.wiki.getCreationFields(), + this.wiki.getModificationFields(), + { + title: excisionTitle, + text: operation.selection, + tags: event.paramObject.tagnew === "yes" ? [editTiddlerTitle] : [] + } + )); + operation.replacement = excisionTitle; + switch(event.paramObject.type || "transclude") { + case "transclude": + operation.replacement = "{{" + operation.replacement+ "}}"; + break; + case "link": + operation.replacement = "[[" + operation.replacement+ "]]"; + break; + case "macro": + operation.replacement = "<<" + (event.paramObject.macro || "translink") + " \"\"\"" + operation.replacement + "\"\"\">>"; + break; + } + operation.cutStart = operation.selStart; + operation.cutEnd = operation.selEnd; + operation.newSelStart = operation.selStart; + operation.newSelEnd = operation.selStart + operation.replacement.length; +}; + +})(); diff --git a/core/modules/editor/operations/text/make-link.js b/core/modules/editor/operations/text/make-link.js new file mode 100644 index 000000000..e8caf21c5 --- /dev/null +++ b/core/modules/editor/operations/text/make-link.js @@ -0,0 +1,29 @@ +/*\ +title: $:/core/modules/editor/operations/text/make-link.js +type: application/javascript +module-type: texteditoroperation + +Text editor operation to make a link + +\*/ +(function(){ + +/*jslint node: true, browser: true */ +/*global $tw: false */ +"use strict"; + +exports["make-link"] = function(event,operation) { + if(operation.selection) { + operation.replacement = "[[" + operation.selection + "|" + event.paramObject.text + "]]"; + operation.cutStart = operation.selStart; + operation.cutEnd = operation.selEnd; + } else { + operation.replacement = "[[" + event.paramObject.text + "]]"; + operation.cutStart = operation.selStart; + operation.cutEnd = operation.selEnd; + } + operation.newSelStart = operation.selStart + operation.replacement.length; + operation.newSelEnd = operation.newSelStart; +}; + +})(); diff --git a/core/modules/editor/operations/text/prefix-lines.js b/core/modules/editor/operations/text/prefix-lines.js new file mode 100644 index 000000000..ad67232fc --- /dev/null +++ b/core/modules/editor/operations/text/prefix-lines.js @@ -0,0 +1,54 @@ +/*\ +title: $:/core/modules/editor/operations/text/prefix-lines.js +type: application/javascript +module-type: texteditoroperation + +Text editor operation to add a prefix to the selected lines + +\*/ +(function(){ + +/*jslint node: true, browser: true */ +/*global $tw: false */ +"use strict"; + +exports["prefix-lines"] = function(event,operation) { + // Cut just past the preceding line break, or the start of the text + operation.cutStart = $tw.utils.findPrecedingLineBreak(operation.text,operation.selStart); + // Cut to just past the following line break, or to the end of the text + operation.cutEnd = $tw.utils.findFollowingLineBreak(operation.text,operation.selEnd); + // Compose the required prefix + var prefix = $tw.utils.repeat(event.paramObject.character,event.paramObject.count); + // Process each line + var lines = operation.text.substring(operation.cutStart,operation.cutEnd).split(/\r?\n/mg); + $tw.utils.each(lines,function(line,index) { + // Remove and count any existing prefix characters + var count = 0; + while(line.charAt(0) === event.paramObject.character) { + line = line.substring(1); + count++; + } + // Remove any whitespace + while(line.charAt(0) === " ") { + line = line.substring(1); + } + // We're done if we removed the exact required prefix, otherwise add it + if(count !== event.paramObject.count) { + // Apply the prefix + line = prefix + " " + line; + } + // Save the modified line + lines[index] = line; + }); + // Stitch the replacement text together and set the selection + operation.replacement = lines.join("\n"); + if(lines.length === 1) { + operation.newSelStart = operation.cutStart + operation.replacement.length; + operation.newSelEnd = operation.newSelStart; + } else { + operation.newSelStart = operation.cutStart; + operation.newSelEnd = operation.newSelStart + operation.replacement.length; + } +}; + +})(); diff --git a/core/modules/editor/operations/text/replace-all.js b/core/modules/editor/operations/text/replace-all.js new file mode 100644 index 000000000..fc1541935 --- /dev/null +++ b/core/modules/editor/operations/text/replace-all.js @@ -0,0 +1,23 @@ +/*\ +title: $:/core/modules/editor/operations/text/replace-all.js +type: application/javascript +module-type: texteditoroperation + +Text editor operation to replace the entire text + +\*/ +(function(){ + +/*jslint node: true, browser: true */ +/*global $tw: false */ +"use strict"; + +exports["replace-all"] = function(event,operation) { + operation.cutStart = 0; + operation.cutEnd = operation.text.length; + operation.replacement = event.paramObject.text; + operation.newSelStart = 0; + operation.newSelEnd = operation.replacement.length; +}; + +})(); diff --git a/core/modules/editor/operations/text/replace-selection.js b/core/modules/editor/operations/text/replace-selection.js new file mode 100644 index 000000000..740a41fb1 --- /dev/null +++ b/core/modules/editor/operations/text/replace-selection.js @@ -0,0 +1,23 @@ +/*\ +title: $:/core/modules/editor/operations/text/replace-selection.js +type: application/javascript +module-type: texteditoroperation + +Text editor operation to replace the selection + +\*/ +(function(){ + +/*jslint node: true, browser: true */ +/*global $tw: false */ +"use strict"; + +exports["replace-selection"] = function(event,operation) { + operation.replacement = event.paramObject.text; + operation.cutStart = operation.selStart; + operation.cutEnd = operation.selEnd; + operation.newSelStart = operation.selStart; + operation.newSelEnd = operation.selStart + operation.replacement.length; +}; + +})(); diff --git a/core/modules/editor/operations/text/wrap-lines.js b/core/modules/editor/operations/text/wrap-lines.js new file mode 100644 index 000000000..521811f50 --- /dev/null +++ b/core/modules/editor/operations/text/wrap-lines.js @@ -0,0 +1,28 @@ +/*\ +title: $:/core/modules/editor/operations/text/wrap-lines.js +type: application/javascript +module-type: texteditoroperation + +Text editor operation to wrap the selected lines with a prefix and suffix + +\*/ +(function(){ + +/*jslint node: true, browser: true */ +/*global $tw: false */ +"use strict"; + +exports["wrap-lines"] = function(event,operation) { + // Cut just past the preceding line break, or the start of the text + operation.cutStart = $tw.utils.findPrecedingLineBreak(operation.text,operation.selStart); + // Cut to just past the following line break, or to the end of the text + operation.cutEnd = $tw.utils.findFollowingLineBreak(operation.text,operation.selEnd); + // Add the prefix and suffix + operation.replacement = event.paramObject.prefix + "\n" + + operation.text.substring(operation.cutStart,operation.cutEnd) + "\n" + + event.paramObject.suffix + "\n"; + operation.newSelStart = operation.cutStart + event.paramObject.prefix.length + 1; + operation.newSelEnd = operation.newSelStart + (operation.cutEnd - operation.cutStart); +}; + +})(); diff --git a/core/modules/editor/operations/text/wrap-selection.js b/core/modules/editor/operations/text/wrap-selection.js new file mode 100644 index 000000000..30e41e841 --- /dev/null +++ b/core/modules/editor/operations/text/wrap-selection.js @@ -0,0 +1,52 @@ +/*\ +title: $:/core/modules/editor/operations/text/wrap-selection.js +type: application/javascript +module-type: texteditoroperation + +Text editor operation to wrap the selection with the specified prefix and suffix + +\*/ +(function(){ + +/*jslint node: true, browser: true */ +/*global $tw: false */ +"use strict"; + +exports["wrap-selection"] = function(event,operation) { + if(operation.selStart === operation.selEnd) { + // No selection; check if we're within the prefix/suffix + if(operation.text.substring(operation.selStart - event.paramObject.prefix.length,operation.selStart + event.paramObject.suffix.length) === event.paramObject.prefix + event.paramObject.suffix) { + // Remove the prefix and suffix unless they comprise the entire text + if(operation.selStart > event.paramObject.prefix.length || (operation.selEnd + event.paramObject.suffix.length) < operation.text.length ) { + operation.cutStart = operation.selStart - event.paramObject.prefix.length; + operation.cutEnd = operation.selEnd + event.paramObject.suffix.length; + operation.replacement = ""; + operation.newSelStart = operation.cutStart; + operation.newSelEnd = operation.newSelStart; + } + } else { + // Wrap the cursor instead + operation.cutStart = operation.selStart; + operation.cutEnd = operation.selEnd; + operation.replacement = event.paramObject.prefix + event.paramObject.suffix; + operation.newSelStart = operation.selStart + event.paramObject.prefix.length; + operation.newSelEnd = operation.newSelStart; + } + } 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) { + // Prefix and suffix are already present, so remove them + operation.cutStart = operation.selStart; + operation.cutEnd = operation.selEnd; + operation.replacement = operation.selection.substring(event.paramObject.prefix.length,operation.selection.length - event.paramObject.suffix.length); + operation.newSelStart = operation.selStart; + operation.newSelEnd = operation.selStart + operation.replacement.length; + } else { + // Add the prefix and suffix + operation.cutStart = operation.selStart; + operation.cutEnd = operation.selEnd; + operation.replacement = event.paramObject.prefix + operation.selection + event.paramObject.suffix; + operation.newSelStart = operation.selStart; + operation.newSelEnd = operation.selStart + operation.replacement.length; + } +}; + +})(); diff --git a/core/modules/filters.js b/core/modules/filters.js index 8fbcac587..76046b828 100644 --- a/core/modules/filters.js +++ b/core/modules/filters.js @@ -20,7 +20,7 @@ Parses an operation (i.e. a run) within a filter string Returns the new start position, after the parsed operation */ function parseFilterOperation(operators,filterString,p) { - var operator, operand, bracketPos, curlyBracketPos; + var nextBracketPos, operator; // Skip the starting square bracket if(filterString.charAt(p++) !== "[") { throw "Missing [ in filter expression"; @@ -33,14 +33,14 @@ function parseFilterOperation(operators,filterString,p) { operator.prefix = filterString.charAt(p++); } // Get the operator name - var nextBracketPos = filterString.substring(p).search(/[\[\{<\/]/); + nextBracketPos = filterString.substring(p).search(/[\[\{<\/]/); if(nextBracketPos === -1) { throw "Missing [ in filter expression"; } nextBracketPos += p; var bracket = filterString.charAt(nextBracketPos); operator.operator = filterString.substring(p,nextBracketPos); - + // Any suffix? var colon = operator.operator.indexOf(':'); if(colon > -1) { @@ -79,7 +79,7 @@ console.log("WARNING: Filter",operator.operator,"has a deprecated regexp operand } break; } - + if(nextBracketPos === -1) { throw "Missing closing bracket in filter expression"; } @@ -87,7 +87,7 @@ console.log("WARNING: Filter",operator.operator,"has a deprecated regexp operand operator.operand = filterString.substring(p,nextBracketPos); } p = nextBracketPos + 1; - + // Push this operator operators.push(operator); } while(filterString.charAt(p) !== "]"); @@ -121,7 +121,7 @@ exports.parseFilter = function(filterString) { operandRegExp.lastIndex = p; match = operandRegExp.exec(filterString); if(!match || match.index !== p) { - throw "Syntax error in filter expression"; + throw $tw.language.getString("Error/FilterSyntax"); } var operation = { prefix: "", @@ -171,7 +171,7 @@ exports.compileFilter = function(filterString) { filterParseTree = this.parseFilter(filterString); } catch(e) { return function(source,widget) { - return ["Filter error: " + e]; + return [$tw.language.getString("Error/Filter") + ": " + e]; }; } // Get the hashmap of filter operator functions diff --git a/core/modules/filters/days.js b/core/modules/filters/days.js index 39cd375f7..318d72567 100644 --- a/core/modules/filters/days.js +++ b/core/modules/filters/days.js @@ -27,6 +27,7 @@ exports.days = function(source,operator,options) { }; if(operator.prefix === "!") { + targetTimeStamp = targetTimeStamp - 1000*60*60*24*dayIntervalSign; source(function(tiddler,title) { if(tiddler && tiddler.fields[fieldName]) { if(!isWithinDays($tw.utils.parseDate(tiddler.fields[fieldName]))) { diff --git a/core/modules/filters/encodings.js b/core/modules/filters/encodings.js new file mode 100644 index 000000000..24c44aaa3 --- /dev/null +++ b/core/modules/filters/encodings.js @@ -0,0 +1,83 @@ +/*\ +title: $:/core/modules/filters/decodeuricomponent.js +type: application/javascript +module-type: filteroperator + +Filter operator for applying decodeURIComponent() to each item. + +\*/ +(function(){ + +/*jslint node: true, browser: true */ +/*global $tw: false */ +"use strict"; + +/* +Export our filter functions +*/ + +exports.decodeuricomponent = function(source,operator,options) { + var results = []; + source(function(tiddler,title) { + results.push(decodeURIComponent(title)); + }); + return results; +}; + +exports.encodeuricomponent = function(source,operator,options) { + var results = []; + source(function(tiddler,title) { + results.push(encodeURIComponent(title)); + }); + return results; +}; + +exports.decodeuri = function(source,operator,options) { + var results = []; + source(function(tiddler,title) { + results.push(decodeURI(title)); + }); + return results; +}; + +exports.encodeuri = function(source,operator,options) { + var results = []; + source(function(tiddler,title) { + results.push(encodeURI(title)); + }); + return results; +}; + +exports.decodehtml = function(source,operator,options) { + var results = []; + source(function(tiddler,title) { + results.push($tw.utils.htmlDecode(title)); + }); + return results; +}; + +exports.encodehtml = function(source,operator,options) { + var results = []; + source(function(tiddler,title) { + results.push($tw.utils.htmlEncode(title)); + }); + return results; +}; + +exports.stringify = function(source,operator,options) { + var results = []; + source(function(tiddler,title) { + results.push($tw.utils.stringify(title)); + }); + return results; +}; + +exports.escaperegexp = function(source,operator,options) { + var results = []; + source(function(tiddler,title) { + results.push($tw.utils.escapeRegExp(title)); + }); + return results; +}; + +})(); diff --git a/core/modules/filters/has.js b/core/modules/filters/has.js index 9a82f3111..7a1738782 100644 --- a/core/modules/filters/has.js +++ b/core/modules/filters/has.js @@ -25,7 +25,7 @@ exports.has = function(source,operator,options) { }); } else { source(function(tiddler,title) { - if(tiddler && $tw.utils.hop(tiddler.fields,operator.operand) && tiddler.fields[operator.operand] !== "") { + if(tiddler && $tw.utils.hop(tiddler.fields,operator.operand) && !(tiddler.fields[operator.operand] === "" || tiddler.fields[operator.operand].length === 0)) { results.push(title); } }); diff --git a/core/modules/filters/is.js b/core/modules/filters/is.js index d27d00907..0db243044 100644 --- a/core/modules/filters/is.js +++ b/core/modules/filters/is.js @@ -32,7 +32,7 @@ exports.is = function(source,operator,options) { if(isFilterOperator) { return isFilterOperator(source,operator.prefix,options); } else { - return ["Filter Error: Unknown operand for the 'is' filter operator"]; + return [$tw.language.getString("Error/IsFilterOperator")]; } }; diff --git a/core/modules/filters/minlength.js b/core/modules/filters/minlength.js new file mode 100644 index 000000000..d4e679bef --- /dev/null +++ b/core/modules/filters/minlength.js @@ -0,0 +1,29 @@ +/*\ +title: $:/core/modules/filters/minlength.js +type: application/javascript +module-type: filteroperator + +Filter operator for filtering out titles that don't meet the minimum length in the operand + +\*/ +(function(){ + +/*jslint node: true, browser: true */ +/*global $tw: false */ +"use strict"; + +/* +Export our filter function +*/ +exports.minlength = function(source,operator,options) { + var results = [], + minLength = parseInt(operator.operand || "",10) || 0; + source(function(tiddler,title) { + if(title.length >= minLength) { + results.push(title); + } + }); + return results; +}; + +})(); diff --git a/core/modules/filters/wikiparserrules.js b/core/modules/filters/wikiparserrules.js index ee57113c8..213298515 100644 --- a/core/modules/filters/wikiparserrules.js +++ b/core/modules/filters/wikiparserrules.js @@ -16,10 +16,11 @@ Filter operator for returning the names of the wiki parser rules in this wiki Export our filter function */ exports.wikiparserrules = function(source,operator,options) { - var results = []; + var results = [], + operand = operator.operand; $tw.utils.each($tw.modules.types.wikirule,function(mod) { var exp = mod.exports; - if(exp.types[operator.operand]) { + if(!operand || exp.types[operand]) { results.push(exp.name); } }); diff --git a/core/modules/info/platform.js b/core/modules/info/platform.js index 9f6097f74..c30f5b83c 100644 --- a/core/modules/info/platform.js +++ b/core/modules/info/platform.js @@ -18,6 +18,21 @@ exports.getInfoTiddlerFields = function() { // Basics infoTiddlerFields.push({title: "$:/info/browser", text: mapBoolean(!!$tw.browser)}); infoTiddlerFields.push({title: "$:/info/node", text: mapBoolean(!!$tw.node)}); + // Document location + if($tw.browser) { + var setLocationProperty = function(name,value) { + infoTiddlerFields.push({title: "$:/info/url/" + name, text: value}); + }, + location = document.location; + setLocationProperty("full", (location.toString()).split("#")[0]); + setLocationProperty("host", location.host); + setLocationProperty("hostname", location.hostname); + setLocationProperty("protocol", location.protocol); + setLocationProperty("port", location.port); + setLocationProperty("pathname", location.pathname); + setLocationProperty("search", location.search); + setLocationProperty("origin", location.origin); + } return infoTiddlerFields; }; diff --git a/core/modules/keyboard.js b/core/modules/keyboard.js new file mode 100644 index 000000000..bfa76d7e2 --- /dev/null +++ b/core/modules/keyboard.js @@ -0,0 +1,279 @@ +/*\ +title: $:/core/modules/keyboard.js +type: application/javascript +module-type: global + +Keyboard handling utilities + +\*/ +(function(){ + +/*jslint node: true, browser: true */ +/*global $tw: false */ +"use strict"; + +var namedKeys = { + "cancel": 3, + "help": 6, + "backspace": 8, + "tab": 9, + "clear": 12, + "return": 13, + "enter": 13, + "pause": 19, + "escape": 27, + "space": 32, + "page_up": 33, + "page_down": 34, + "end": 35, + "home": 36, + "left": 37, + "up": 38, + "right": 39, + "down": 40, + "printscreen": 44, + "insert": 45, + "delete": 46, + "0": 48, + "1": 49, + "2": 50, + "3": 51, + "4": 52, + "5": 53, + "6": 54, + "7": 55, + "8": 56, + "9": 57, + "firefoxsemicolon": 59, + "firefoxequals": 61, + "a": 65, + "b": 66, + "c": 67, + "d": 68, + "e": 69, + "f": 70, + "g": 71, + "h": 72, + "i": 73, + "j": 74, + "k": 75, + "l": 76, + "m": 77, + "n": 78, + "o": 79, + "p": 80, + "q": 81, + "r": 82, + "s": 83, + "t": 84, + "u": 85, + "v": 86, + "w": 87, + "x": 88, + "y": 89, + "z": 90, + "numpad0": 96, + "numpad1": 97, + "numpad2": 98, + "numpad3": 99, + "numpad4": 100, + "numpad5": 101, + "numpad6": 102, + "numpad7": 103, + "numpad8": 104, + "numpad9": 105, + "multiply": 106, + "add": 107, + "separator": 108, + "subtract": 109, + "decimal": 110, + "divide": 111, + "f1": 112, + "f2": 113, + "f3": 114, + "f4": 115, + "f5": 116, + "f6": 117, + "f7": 118, + "f8": 119, + "f9": 120, + "f10": 121, + "f11": 122, + "f12": 123, + "f13": 124, + "f14": 125, + "f15": 126, + "f16": 127, + "f17": 128, + "f18": 129, + "f19": 130, + "f20": 131, + "f21": 132, + "f22": 133, + "f23": 134, + "f24": 135, + "firefoxminus": 173, + "semicolon": 186, + "equals": 187, + "comma": 188, + "dash": 189, + "period": 190, + "slash": 191, + "backquote": 192, + "openbracket": 219, + "backslash": 220, + "closebracket": 221, + "quote": 222 +}; + +function KeyboardManager(options) { + var self = this; + options = options || ""; + // Save the named key hashmap + this.namedKeys = namedKeys; + // Create a reverse mapping of code to keyname + this.keyNames = []; + $tw.utils.each(namedKeys,function(keyCode,name) { + self.keyNames[keyCode] = name.substr(0,1).toUpperCase() + name.substr(1); + }); + // Save the platform-specific name of the "meta" key + this.metaKeyName = $tw.platform.isMac ? "cmd-" : "win-"; +} + +/* +Return an array of keycodes for the modifier keys ctrl, shift, alt, meta +*/ +KeyboardManager.prototype.getModifierKeys = function() { + return [ + 16, // Shift + 17, // Ctrl + 18, // Alt + 20, // CAPS LOCK + 91, // Meta (left) + 93, // Meta (right) + 224 // Meta (Firefox) + ] +}; + +/* +Parses a key descriptor into the structure: +{ + keyCode: numeric keycode + shiftKey: boolean + altKey: boolean + ctrlKey: boolean + metaKey: boolean +} +Key descriptors have the following format: + ctrl+enter + ctrl+shift+alt+A +*/ +KeyboardManager.prototype.parseKeyDescriptor = function(keyDescriptor) { + var components = keyDescriptor.split(/\+|\-/), + info = { + keyCode: 0, + shiftKey: false, + altKey: false, + ctrlKey: false, + metaKey: false + }; + for(var t=0; t<components.length; t++) { + var s = components[t].toLowerCase(), + c = s.charCodeAt(0); + // Look for modifier keys + if(s === "ctrl") { + info.ctrlKey = true; + } else if(s === "shift") { + info.shiftKey = true; + } else if(s === "alt") { + info.altKey = true; + } else if(s === "meta" || s === "cmd" || s === "win") { + info.metaKey = true; + } + // Replace named keys with their code + if(this.namedKeys[s]) { + info.keyCode = this.namedKeys[s]; + } + } + if(info.keyCode) { + return info; + } else { + return null; + } +}; + +/* +Parse a list of key descriptors into an array of keyInfo objects. The key descriptors can be passed as an array of strings or a space separated string +*/ +KeyboardManager.prototype.parseKeyDescriptors = function(keyDescriptors,options) { + var self = this; + options = options || {}; + options.stack = options.stack || []; + var wiki = options.wiki || $tw.wiki; + if(typeof keyDescriptors === "string" && keyDescriptors === "") { + return []; + } + if(!$tw.utils.isArray(keyDescriptors)) { + keyDescriptors = keyDescriptors.split(" "); + } + var result = []; + $tw.utils.each(keyDescriptors,function(keyDescriptor) { + // Look for a named shortcut + if(keyDescriptor.substr(0,2) === "((" && keyDescriptor.substr(-2,2) === "))") { + if(options.stack.indexOf(keyDescriptor) === -1) { + options.stack.push(keyDescriptor); + var name = keyDescriptor.substring(2,keyDescriptor.length - 2), + lookupName = function(configName) { + var keyDescriptors = wiki.getTiddlerText("$:/config/" + configName + "/" + name); + if(keyDescriptors) { + result.push.apply(result,self.parseKeyDescriptors(keyDescriptors,options)); + } + }; + lookupName("shortcuts"); + lookupName($tw.platform.isMac ? "shortcuts-mac" : "shortcuts-not-mac"); + lookupName($tw.platform.isWindows ? "shortcuts-windows" : "shortcuts-not-windows"); + lookupName($tw.platform.isLinux ? "shortcuts-linux" : "shortcuts-not-linux"); + } + } else { + result.push(self.parseKeyDescriptor(keyDescriptor)); + } + }); + return result; +}; + +KeyboardManager.prototype.getPrintableShortcuts = function(keyInfoArray) { + var self = this, + result = []; + $tw.utils.each(keyInfoArray,function(keyInfo) { + if(keyInfo) { + result.push((keyInfo.ctrlKey ? "ctrl-" : "") + + (keyInfo.shiftKey ? "shift-" : "") + + (keyInfo.altKey ? "alt-" : "") + + (keyInfo.metaKey ? self.metaKeyName : "") + + (self.keyNames[keyInfo.keyCode])); + } + }); + return result; +} + +KeyboardManager.prototype.checkKeyDescriptor = function(event,keyInfo) { + return keyInfo && + event.keyCode === keyInfo.keyCode && + event.shiftKey === keyInfo.shiftKey && + event.altKey === keyInfo.altKey && + event.ctrlKey === keyInfo.ctrlKey && + event.metaKey === keyInfo.metaKey; +}; + +KeyboardManager.prototype.checkKeyDescriptors = function(event,keyInfoArray) { + for(var t=0; t<keyInfoArray.length; t++) { + if(this.checkKeyDescriptor(event,keyInfoArray[t])) { + return true; + } + } + return false; +}; + +exports.KeyboardManager = KeyboardManager; + +})(); diff --git a/core/modules/macros/displayshortcuts.js b/core/modules/macros/displayshortcuts.js new file mode 100644 index 000000000..b18297238 --- /dev/null +++ b/core/modules/macros/displayshortcuts.js @@ -0,0 +1,45 @@ +/*\ +title: $:/core/modules/macros/displayshortcuts.js +type: application/javascript +module-type: macro + +Macro to display a list of keyboard shortcuts in human readable form. Notably, it resolves named shortcuts like `((bold))` to the underlying keystrokes. + +\*/ +(function(){ + +/*jslint node: true, browser: true */ +/*global $tw: false */ +"use strict"; + +/* +Information about this macro +*/ + +exports.name = "displayshortcuts"; + +exports.params = [ + {name: "shortcuts"}, + {name: "prefix"}, + {name: "separator"}, + {name: "suffix"} +]; + +/* +Run the macro +*/ +exports.run = function(shortcuts,prefix,separator,suffix) { + var shortcutArray = $tw.keyboardManager.getPrintableShortcuts($tw.keyboardManager.parseKeyDescriptors(shortcuts,{ + wiki: this.wiki + })); + if(shortcutArray.length > 0) { + shortcutArray.sort(function(a,b) { + return a.toLowerCase().localeCompare(b.toLowerCase()); + }) + return prefix + shortcutArray.join(separator) + suffix; + } else { + return ""; + } +}; + +})(); diff --git a/core/modules/macros/makedatauri.js b/core/modules/macros/makedatauri.js index 4b578f466..a7474bdf0 100644 --- a/core/modules/macros/makedatauri.js +++ b/core/modules/macros/makedatauri.js @@ -3,7 +3,7 @@ title: $:/core/modules/macros/makedatauri.js type: application/javascript module-type: macro -Macro to convert the content of a tiddler to a data URI +Macro to convert a string of text to a data URI <<makedatauri text:"Text to be converted" type:"text/vnd.tiddlywiki">> diff --git a/core/modules/parsers/htmlparser.js b/core/modules/parsers/htmlparser.js index b2528e961..39b0c21df 100644 --- a/core/modules/parsers/htmlparser.js +++ b/core/modules/parsers/htmlparser.js @@ -24,7 +24,7 @@ var HtmlParser = function(type,text,options) { tag: "iframe", attributes: { src: {type: "string", value: src}, - sandbox: {type: "string", value: "sandbox"} + sandbox: {type: "string", value: ""} } }]; }; diff --git a/core/modules/parsers/parseutils.js b/core/modules/parsers/parseutils.js index 97c994050..0d74355f7 100644 --- a/core/modules/parsers/parseutils.js +++ b/core/modules/parsers/parseutils.js @@ -218,6 +218,7 @@ exports.parseAttribute = function(source,pos) { // Define our regexps var reAttributeName = /([^\/\s>"'=]+)/g, reUnquotedAttribute = /([^\/\s<>"'=]+)/g, + reFilteredValue = /\{\{\{(.+?)\}\}\}/g, reIndirectValue = /\{\{([^\}]+)\}\}/g; // Skip whitespace pos = $tw.utils.skipWhiteSpace(source,pos); @@ -243,29 +244,37 @@ exports.parseAttribute = function(source,pos) { node.type = "string"; node.value = stringLiteral.value; } else { - // Look for an indirect value - var indirectValue = $tw.utils.parseTokenRegExp(source,pos,reIndirectValue); - if(indirectValue) { - pos = indirectValue.end; - node.type = "indirect"; - node.textReference = indirectValue.match[1]; + // Look for a filtered value + var filteredValue = $tw.utils.parseTokenRegExp(source,pos,reFilteredValue); + if(filteredValue) { + pos = filteredValue.end; + node.type = "filtered"; + node.filter = filteredValue.match[1]; } else { - // Look for a unquoted value - var unquotedValue = $tw.utils.parseTokenRegExp(source,pos,reUnquotedAttribute); - if(unquotedValue) { - pos = unquotedValue.end; - node.type = "string"; - node.value = unquotedValue.match[1]; + // Look for an indirect value + var indirectValue = $tw.utils.parseTokenRegExp(source,pos,reIndirectValue); + if(indirectValue) { + pos = indirectValue.end; + node.type = "indirect"; + node.textReference = indirectValue.match[1]; } else { - // Look for a macro invocation value - var macroInvocation = $tw.utils.parseMacroInvocation(source,pos); - if(macroInvocation) { - pos = macroInvocation.end; - node.type = "macro"; - node.value = macroInvocation; - } else { + // Look for a unquoted value + var unquotedValue = $tw.utils.parseTokenRegExp(source,pos,reUnquotedAttribute); + if(unquotedValue) { + pos = unquotedValue.end; node.type = "string"; - node.value = "true"; + node.value = unquotedValue.match[1]; + } else { + // Look for a macro invocation value + var macroInvocation = $tw.utils.parseMacroInvocation(source,pos); + if(macroInvocation) { + pos = macroInvocation.end; + node.type = "macro"; + node.value = macroInvocation; + } else { + node.type = "string"; + node.value = "true"; + } } } } diff --git a/core/modules/parsers/wikiparser/rules/extlink.js b/core/modules/parsers/wikiparser/rules/extlink.js index 539d0f11b..07ddbfb88 100644 --- a/core/modules/parsers/wikiparser/rules/extlink.js +++ b/core/modules/parsers/wikiparser/rules/extlink.js @@ -26,7 +26,7 @@ exports.types = {inline: true}; exports.init = function(parser) { this.parser = parser; // Regexp to match - this.matchRegExp = /~?(?:file|http|https|mailto|ftp|irc|news|data|skype):[^\s<>{}\[\]`|'"\\^~]+(?:\/|\b)/mg; + this.matchRegExp = /~?(?:file|http|https|mailto|ftp|irc|news|data|skype):[^\s<>{}\[\]`|"\\^]+(?:\/|\b)/mg; }; exports.parse = function() { @@ -42,7 +42,8 @@ exports.parse = function() { attributes: { href: {type: "string", value: this.match[0]}, "class": {type: "string", value: "tc-tiddlylink-external"}, - target: {type: "string", value: "_blank"} + target: {type: "string", value: "_blank"}, + rel: {type: "string", value: "noopener noreferrer"} }, children: [{ type: "text", text: this.match[0] diff --git a/core/modules/parsers/wikiparser/rules/html.js b/core/modules/parsers/wikiparser/rules/html.js index 71cdfd5dc..dd1ea4540 100644 --- a/core/modules/parsers/wikiparser/rules/html.js +++ b/core/modules/parsers/wikiparser/rules/html.js @@ -101,6 +101,10 @@ exports.parseTag = function(source,pos,options) { node.type = node.tag.substr(1); } pos = token.end; + // Check that the tag is terminated by a space, / or > + if(!$tw.utils.parseWhiteSpace(source,pos) && !(source.charAt(pos) === "/") && !(source.charAt(pos) === ">") ) { + return null; + } // Process attributes var attribute = $tw.utils.parseAttribute(source,pos); while(attribute) { diff --git a/core/modules/parsers/wikiparser/rules/macrodef.js b/core/modules/parsers/wikiparser/rules/macrodef.js index 1a0f34e01..daf854cab 100644 --- a/core/modules/parsers/wikiparser/rules/macrodef.js +++ b/core/modules/parsers/wikiparser/rules/macrodef.js @@ -61,7 +61,7 @@ exports.parse = function() { reEnd = /(\r?\n\\end[^\S\n\r]*(?:$|\r?\n))/mg; } else { // Otherwise, the end of the definition is marked by the end of the line - reEnd = /(\r?\n)/mg; + reEnd = /($|\r?\n)/mg; // Move past any whitespace this.parser.pos = $tw.utils.skipWhiteSpace(this.parser.source,this.parser.pos); } diff --git a/core/modules/parsers/wikiparser/rules/prettyextlink.js b/core/modules/parsers/wikiparser/rules/prettyextlink.js index 45bcbbf43..19b4f725b 100644 --- a/core/modules/parsers/wikiparser/rules/prettyextlink.js +++ b/core/modules/parsers/wikiparser/rules/prettyextlink.js @@ -106,6 +106,7 @@ exports.parseLink = function(source,pos) { } node.attributes.href = {type: "string", value: URL}; node.attributes.target = {type: "string", value: "_blank"}; + node.attributes.rel = {type: "string", value: "noopener noreferrer"}; // Update the end position node.end = closePos + 2; return node; diff --git a/core/modules/parsers/wikiparser/rules/prettylink.js b/core/modules/parsers/wikiparser/rules/prettylink.js index 33841f116..56a2850a3 100644 --- a/core/modules/parsers/wikiparser/rules/prettylink.js +++ b/core/modules/parsers/wikiparser/rules/prettylink.js @@ -40,7 +40,8 @@ exports.parse = function() { attributes: { href: {type: "string", value: link}, "class": {type: "string", value: "tc-tiddlylink-external"}, - target: {type: "string", value: "_blank"} + target: {type: "string", value: "_blank"}, + rel: {type: "string", value: "noopener noreferrer"} }, children: [{ type: "text", text: text diff --git a/core/modules/parsers/wikiparser/rules/syslink.js b/core/modules/parsers/wikiparser/rules/syslink.js index 441fe2aa5..6eb2cdcd4 100644 --- a/core/modules/parsers/wikiparser/rules/syslink.js +++ b/core/modules/parsers/wikiparser/rules/syslink.js @@ -18,7 +18,12 @@ exports.types = {inline: true}; exports.init = function(parser) { this.parser = parser; // Regexp to match - this.matchRegExp = /~?\$:\/[a-zA-Z0-9/.\-_]+/mg; + this.matchRegExp = new RegExp( + "~?\\$:\\/[" + + $tw.config.textPrimitives.anyLetter.substr(1,$tw.config.textPrimitives.anyLetter.length - 2) + + "\/._-]+", + "mg" + ); }; exports.parse = function() { diff --git a/core/modules/parsers/wikiparser/wikiparser.js b/core/modules/parsers/wikiparser/wikiparser.js index 736e2dbdf..2a55399dd 100644 --- a/core/modules/parsers/wikiparser/wikiparser.js +++ b/core/modules/parsers/wikiparser/wikiparser.js @@ -16,6 +16,7 @@ Attributes are stored as hashmaps of the following objects: {type: "string", value: <string>} - literal string {type: "indirect", textReference: <textReference>} - indirect through a text reference + {type: "macro", macro: <TBD>} - indirect through a macro invocation \*/ (function(){ diff --git a/core/modules/pluginswitcher.js b/core/modules/pluginswitcher.js index 9c05d375f..ab82be933 100644 --- a/core/modules/pluginswitcher.js +++ b/core/modules/pluginswitcher.js @@ -18,12 +18,14 @@ wiki: wiki store to be used pluginType: type of plugin to be switched controllerTitle: title of tiddler used to control switching of this resource defaultPlugins: array of default plugins to be used if nominated plugin isn't found +onSwitch: callback when plugin is switched (single parameter is array of plugin titles) */ function PluginSwitcher(options) { this.wiki = options.wiki; this.pluginType = options.pluginType; this.controllerTitle = options.controllerTitle; this.defaultPlugins = options.defaultPlugins || []; + this.onSwitch = options.onSwitch; // Switch to the current plugin this.switchPlugins(); // Listen for changes to the selected plugin @@ -64,6 +66,10 @@ PluginSwitcher.prototype.switchPlugins = function() { var registeredTiddlers = $tw.wiki.registerPluginTiddlers(this.pluginType,plugins); // Unpack the current theme tiddlers $tw.wiki.unpackPluginTiddlers(); + // Call the switch handler + if(this.onSwitch) { + this.onSwitch(plugins); + } }; exports.PluginSwitcher = PluginSwitcher; diff --git a/core/modules/saver-handler.js b/core/modules/saver-handler.js index 78e0598a6..4c938f7af 100644 --- a/core/modules/saver-handler.js +++ b/core/modules/saver-handler.js @@ -151,7 +151,7 @@ SaverHandler.prototype.saveWiki = function(options) { text = this.wiki.renderTiddler(downloadType,template,options), callback = function(err) { if(err) { - alert("Error while saving:\n\n" + err); + alert($tw.language.getString("Error/WhileSaving") + ":\n\n" + err); } else { // Clear the task queue if we're saving (rather than downloading) if(method !== "download") { diff --git a/core/modules/savers/download.js b/core/modules/savers/download.js index 8d1436f29..ea7c62f58 100644 --- a/core/modules/savers/download.js +++ b/core/modules/savers/download.js @@ -34,6 +34,7 @@ DownloadSaver.prototype.save = function(text,method,callback,options) { // Set up the link var link = document.createElement("a"); link.setAttribute("target","_blank"); + link.setAttribute("rel","noopener noreferrer"); if(Blob !== undefined) { var blob = new Blob([text], {type: "text/html"}); link.setAttribute("href", URL.createObjectURL(blob)); diff --git a/core/modules/savers/put.js b/core/modules/savers/put.js new file mode 100644 index 000000000..39f1ca18c --- /dev/null +++ b/core/modules/savers/put.js @@ -0,0 +1,80 @@ +/*\ +title: $:/core/modules/savers/put.js +type: application/javascript +module-type: saver + +Saves wiki by performing a PUT request to the server + +Works with any server which accepts a PUT request +to the current URL, such as a WebDAV server. + +\*/ +(function(){ + +/*jslint node: true, browser: true */ +/*global $tw: false */ +"use strict"; + +/* +Select the appropriate saver module and set it up +*/ +var PutSaver = function(wiki) { + this.wiki = wiki; + var self = this; + // Async server probe. Until probe finishes, save will fail fast + // See also https://github.com/Jermolene/TiddlyWiki5/issues/2276 + var req = new XMLHttpRequest(); + req.open("OPTIONS",encodeURI(document.location.protocol + "//" + document.location.hostname + ":" + document.location.port + document.location.pathname)); + req.onload = function() { + // Check DAV header http://www.webdav.org/specs/rfc2518.html#rfc.section.9.1 + self.serverAcceptsPuts = (this.status === 200 && !!this.getResponseHeader('dav')); + }; + req.send(); +}; + +PutSaver.prototype.save = function(text,method,callback) { + if (!this.serverAcceptsPuts) { + return false; + } + var req = new XMLHttpRequest(); + // TODO: store/check ETags if supported by server, to protect against overwrites + // Prompt: Do you want to save over this? Y/N + // Merging would be ideal, and may be possible using future generic merge flow + req.onload = function() { + if (this.status === 200 || this.status === 201) { + callback(null); // success + } + else { + callback(this.responseText); // fail + } + }; + req.open("PUT", encodeURI(window.location.href)); + req.setRequestHeader("Content-Type", "text/html;charset=UTF-8"); + req.send(text); + return true; +}; + +/* +Information about this saver +*/ +PutSaver.prototype.info = { + name: "put", + priority: 2000, + capabilities: ["save", "autosave"] +}; + +/* +Static method that returns true if this saver is capable of working +*/ +exports.canSave = function(wiki) { + return /^https?:/.test(location.protocol); +}; + +/* +Create an instance of this saver +*/ +exports.create = function(wiki) { + return new PutSaver(wiki); +}; + +})(); diff --git a/core/modules/savers/twedit.js b/core/modules/savers/twedit.js index 33d748f67..6907a542c 100644 --- a/core/modules/savers/twedit.js +++ b/core/modules/savers/twedit.js @@ -39,7 +39,7 @@ TWEditSaver.prototype.save = function(text,method,callback) { // Error handler var errorHandler = function(event) { // Error - callback("Error saving to TWEdit: " + event.target.error.code); + callback($tw.language.getString("Error/SavingToTWEdit") + ": " + event.target.error.code); }; // Get the file system window.requestFileSystem(LocalFileSystem.PERSISTENT,0,function(fileSystem) { diff --git a/core/modules/savers/upload.js b/core/modules/savers/upload.js index 897496b6a..bcf4b9d54 100644 --- a/core/modules/savers/upload.js +++ b/core/modules/savers/upload.js @@ -54,7 +54,7 @@ UploadSaver.prototype.save = function(text,method,callback) { // Do the HTTP post var http = new XMLHttpRequest(); http.open("POST",url,true,username,password); - http.setRequestHeader("Content-Type","multipart/form-data; ;charset=UTF-8; boundary=" + boundary); + http.setRequestHeader("Content-Type","multipart/form-data; charset=UTF-8; boundary=" + boundary); http.onreadystatechange = function() { if(http.readyState == 4 && http.status == 200) { if(http.responseText.substr(0,4) === "0 - ") { @@ -67,7 +67,7 @@ UploadSaver.prototype.save = function(text,method,callback) { try { http.send(data); } catch(ex) { - return callback("Error:" + ex); + return callback($tw.language.getString("Error/Caption") + ":" + ex); } $tw.notifier.display("$:/language/Notifications/Save/Starting"); return true; diff --git a/core/modules/startup/browser-messaging.js b/core/modules/startup/browser-messaging.js index 481449c74..c38ba7b85 100644 --- a/core/modules/startup/browser-messaging.js +++ b/core/modules/startup/browser-messaging.js @@ -78,7 +78,7 @@ exports.startup = function() { if(url) { loadIFrame(url,function(err,iframeInfo) { if(err) { - alert("Error loading plugin library: " + url); + alert($tw.language.getString("Error/LoadingPluginLibrary") + ": " + url); } else { iframeInfo.domNode.contentWindow.postMessage({ verb: "GET", @@ -100,7 +100,7 @@ exports.startup = function() { if(url && title) { loadIFrame(url,function(err,iframeInfo) { if(err) { - alert("Error loading plugin library: " + url); + alert($tw.language.getString("Error/LoadingPluginLibrary") + ": " + url); } else { iframeInfo.domNode.contentWindow.postMessage({ verb: "GET", diff --git a/core/modules/startup/rootwidget.js b/core/modules/startup/rootwidget.js index fdc6c738e..2b5111aff 100644 --- a/core/modules/startup/rootwidget.js +++ b/core/modules/startup/rootwidget.js @@ -28,7 +28,7 @@ exports.startup = function() { // Install the notification mechanism $tw.notifier = new $tw.utils.Notifier($tw.wiki); $tw.rootWidget.addEventListener("tm-notify",function(event) { - $tw.notifier.display(event.param); + $tw.notifier.display(event.param,{variables: event.paramObject}); }); // Install the scroller $tw.pageScroller = new $tw.utils.PageScroller(); diff --git a/core/modules/startup/startup.js b/core/modules/startup/startup.js index 08f9641e3..56d780159 100755 --- a/core/modules/startup/startup.js +++ b/core/modules/startup/startup.js @@ -24,9 +24,34 @@ var widget = require("$:/core/modules/widgets/widget.js"); exports.startup = function() { var modules,n,m,f; + // Minimal browser detection if($tw.browser) { $tw.browser.isIE = (/msie|trident/i.test(navigator.userAgent)); + $tw.browser.isFirefox = !!document.mozFullScreenEnabled; } + // Platform detection + $tw.platform = {}; + if($tw.browser) { + $tw.platform.isMac = /Mac/.test(navigator.platform); + $tw.platform.isWindows = /win/i.test(navigator.platform); + $tw.platform.isLinux = /Linux/i.test(navigator.appVersion); + } else { + switch(require("os").platform()) { + case "darwin": + $tw.platform.isMac = true; + break; + case "win32": + $tw.platform.isWindows = true; + break; + case "freebsd": + $tw.platform.isLinux = true; + break; + case "linux": + $tw.platform.isLinux = true; + break; + } + } + // Initialise version $tw.version = $tw.utils.extractVersionInfo(); // Set up the performance framework $tw.perf = new $tw.Performance($tw.wiki.getTiddlerText(PERFORMANCE_INSTRUMENTATION_CONFIG_TITLE,"no") === "yes"); @@ -38,7 +63,17 @@ exports.startup = function() { controllerTitle: "$:/language", defaultPlugins: [ "$:/languages/en-US" - ] + ], + onSwitch: function(plugins) { + if($tw.browser) { + var pluginTiddler = $tw.wiki.getTiddler(plugins[0]); + if(pluginTiddler) { + document.documentElement.setAttribute("dir",pluginTiddler.getFieldString("text-direction") || "auto"); + } else { + document.documentElement.removeAttribute("dir"); + } + } + } }); // Kick off the theme manager $tw.themeManager = new $tw.PluginSwitcher({ @@ -50,6 +85,8 @@ exports.startup = function() { "$:/themes/tiddlywiki/vanilla" ] }); + // Kick off the keyboard manager + $tw.keyboardManager = new $tw.KeyboardManager(); // Clear outstanding tiddler store change events to avoid an unnecessary refresh cycle at startup $tw.wiki.clearTiddlerEventQueue(); // Create a root widget for attaching event handlers. By using it as the parentWidget for another widget tree, one can reuse the event handlers diff --git a/core/modules/startup/story.js b/core/modules/startup/story.js index 987bee216..8ef57076f 100644 --- a/core/modules/startup/story.js +++ b/core/modules/startup/story.js @@ -53,6 +53,10 @@ exports.startup = function() { $tw.rootWidget.addEventListener("tm-browser-refresh",function(event) { window.location.reload(true); }); + // Listen for the tm-print message + $tw.rootWidget.addEventListener("tm-print",function(event) { + (event.event.view || window).print(); + }); // Listen for the tm-home message $tw.rootWidget.addEventListener("tm-home",function(event) { window.location.hash = ""; diff --git a/core/modules/startup/windows.js b/core/modules/startup/windows.js index 9ce34f842..69966f346 100644 --- a/core/modules/startup/windows.js +++ b/core/modules/startup/windows.js @@ -49,7 +49,10 @@ exports.startup = function() { $tw.wiki.removeEventListener("change",refreshHandler); },false); // Set up the styles - var styleWidgetNode = $tw.wiki.makeTranscludeWidget("$:/core/ui/PageStylesheet",{document: $tw.fakeDocument, variables: variables}), + var styleWidgetNode = $tw.wiki.makeTranscludeWidget("$:/core/ui/PageStylesheet",{ + document: $tw.fakeDocument, + variables: variables, + importPageMacros: true}), styleContainer = $tw.fakeDocument.createElement("style"); styleWidgetNode.render(styleContainer,null); var styleElement = srcDocument.createElement("style"); diff --git a/core/modules/syncer.js b/core/modules/syncer.js index 223998e1c..cb1191f16 100644 --- a/core/modules/syncer.js +++ b/core/modules/syncer.js @@ -96,11 +96,26 @@ Syncer.prototype.readTiddlerInfo = function() { self.tiddlerInfo[title] = { revision: tiddler.fields.revision, adaptorInfo: self.syncadaptor && self.syncadaptor.getTiddlerInfo(tiddler), - changeCount: self.wiki.getChangeCount(title) + changeCount: self.wiki.getChangeCount(title), + hasBeenLazyLoaded: false }; }); }; +/* +Create an tiddlerInfo structure if it doesn't already exist +*/ +Syncer.prototype.createTiddlerInfo = function(title) { + if(!$tw.utils.hop(this.tiddlerInfo,title)) { + this.tiddlerInfo[title] = { + revision: null, + adaptorInfo: {}, + changeCount: -1, + hasBeenLazyLoaded: false + }; + } +}; + /* Checks whether the wiki is dirty (ie the window shouldn't be closed) */ @@ -120,7 +135,7 @@ Syncer.prototype.updateDirtyStatus = function() { /* Save an incoming tiddler in the store, and updates the associated tiddlerInfo */ -Syncer.prototype.storeTiddler = function(tiddlerFields) { +Syncer.prototype.storeTiddler = function(tiddlerFields,hasBeenLazyLoaded) { // Save the tiddler var tiddler = new $tw.Tiddler(this.wiki.getTiddler(tiddlerFields.title),tiddlerFields); this.wiki.addTiddler(tiddler); @@ -128,7 +143,8 @@ Syncer.prototype.storeTiddler = function(tiddlerFields) { this.tiddlerInfo[tiddlerFields.title] = { revision: tiddlerFields.revision, adaptorInfo: this.syncadaptor.getTiddlerInfo(tiddler), - changeCount: this.wiki.getChangeCount(tiddlerFields.title) + changeCount: this.wiki.getChangeCount(tiddlerFields.title), + hasBeenLazyLoaded: hasBeenLazyLoaded !== undefined ? hasBeenLazyLoaded : true }; }; @@ -180,7 +196,7 @@ Syncer.prototype.syncFromServer = function() { },self.pollTimerInterval); // Check for errors if(err) { - self.logger.alert("Error retrieving skinny tiddler list:",err); + self.logger.alert($tw.language.getString("Error/RetrievingSkinny") + ":",err); return; } // Process each incoming tiddler @@ -202,7 +218,7 @@ Syncer.prototype.syncFromServer = function() { }); } else { // Load the skinny version of the tiddler - self.storeTiddler(tiddlerFields); + self.storeTiddler(tiddlerFields,false); } } } @@ -238,11 +254,17 @@ Syncer.prototype.syncToServer = function(changes) { Lazily load a skinny tiddler if we can */ Syncer.prototype.handleLazyLoadEvent = function(title) { - // Queue up a sync task to load this tiddler - this.enqueueSyncTask({ - type: "load", - title: title - }); + // Don't lazy load the same tiddler twice + var info = this.tiddlerInfo[title]; + if(!info || !info.hasBeenLazyLoaded) { + this.createTiddlerInfo(title); + this.tiddlerInfo[title].hasBeenLazyLoaded = true; + // Queue up a sync task to load this tiddler + this.enqueueSyncTask({ + type: "load", + title: title + }); + } }; /* @@ -253,7 +275,7 @@ Syncer.prototype.handleLoginEvent = function() { this.getStatus(function(err,isLoggedIn,username) { if(!isLoggedIn) { $tw.passwordPrompt.createPrompt({ - serviceName: "Login to TiddlySpace", + serviceName: $tw.language.getString("LoginToTiddlySpace"), callback: function(data) { self.login(data.username,data.password,function(err,isLoggedIn) { self.syncFromServer(); @@ -324,13 +346,7 @@ Syncer.prototype.enqueueSyncTask = function(task) { task.queueTime = now; task.lastModificationTime = now; // Fill in some tiddlerInfo if the tiddler is one we haven't seen before - if(!$tw.utils.hop(this.tiddlerInfo,task.title)) { - this.tiddlerInfo[task.title] = { - revision: null, - adaptorInfo: {}, - changeCount: -1 - }; - } + this.createTiddlerInfo(task.title); // Bail if this is a save and the tiddler is already at the changeCount that the server has if(task.type === "save" && this.wiki.getChangeCount(task.title) <= this.tiddlerInfo[task.title].changeCount) { return; @@ -387,8 +403,8 @@ Process the task queue, performing the next task if appropriate */ Syncer.prototype.processTaskQueue = function() { var self = this; - // Only process a task if we're not already performing a task. If we are already performing a task then we'll dispatch the next one when it completes - if(this.numTasksInProgress() === 0) { + // Only process a task if the sync adaptor is fully initialised and we're not already performing a task. If we are already performing a task then we'll dispatch the next one when it completes + if((!this.syncadaptor.isReady || this.syncadaptor.isReady()) && this.numTasksInProgress() === 0) { // Choose the next task to perform var task = this.chooseNextTask(); // Perform the task if we had one @@ -483,7 +499,7 @@ Syncer.prototype.dispatchTask = function(task,callback) { } // Store the tiddler if(tiddlerFields) { - self.storeTiddler(tiddlerFields); + self.storeTiddler(tiddlerFields,true); } // Invoke the callback callback(null); diff --git a/core/modules/utils/dom/dom.js b/core/modules/utils/dom/dom.js index 35f556262..118498bc3 100644 --- a/core/modules/utils/dom/dom.js +++ b/core/modules/utils/dom/dom.js @@ -60,6 +60,20 @@ exports.toggleClass = function(el,className,status) { } }; +/* +Get the first parent element that has scrollbars or use the body as fallback. +*/ +exports.getScrollContainer = function(el) { + var doc = el.ownerDocument; + while(el.parentNode) { + el = el.parentNode; + if(el.scrollTop) { + return el; + } + } + return doc.body; +}; + /* Get the scroll position of the viewport Returns: @@ -76,6 +90,31 @@ exports.getScrollPosition = function() { } }; +/* +Adjust the height of a textarea to fit its content, preserving scroll position, and return the height +*/ +exports.resizeTextAreaToFit = function(domNode,minHeight) { + // Get the scroll container and register the current scroll position + var container = $tw.utils.getScrollContainer(domNode), + scrollTop = container.scrollTop; + // Measure the specified minimum height + domNode.style.height = minHeight; + var measuredHeight = domNode.offsetHeight; + // Set its height to auto so that it snaps to the correct height + domNode.style.height = "auto"; + // Calculate the revised height + var newHeight = Math.max(domNode.scrollHeight + domNode.offsetHeight - domNode.clientHeight,measuredHeight); + // Only try to change the height if it has changed + if(newHeight !== domNode.offsetHeight) { + domNode.style.height = newHeight + "px"; + // Make sure that the dimensions of the textarea are recalculated + $tw.utils.forceLayout(domNode); + // Set the container to the position we registered at the beginning + container.scrollTop = scrollTop; + } + return newHeight; +}; + /* Gets the bounding rectangle of an element in absolute page coordinates */ @@ -164,5 +203,32 @@ exports.addEventListeners = function(domNode,events) { }); }; +/* +Get the computed styles applied to an element as an array of strings of individual CSS properties +*/ +exports.getComputedStyles = function(domNode) { + var textAreaStyles = window.getComputedStyle(domNode,null), + styleDefs = [], + name; + for(var t=0; t<textAreaStyles.length; t++) { + name = textAreaStyles[t]; + styleDefs.push(name + ": " + textAreaStyles.getPropertyValue(name) + ";"); + } + return styleDefs; +}; + +/* +Apply a set of styles passed as an array of strings of individual CSS properties +*/ +exports.setStyles = function(domNode,styleDefs) { + domNode.style.cssText = styleDefs.join(""); +}; + +/* +Copy the computed styles from a source element to a destination element +*/ +exports.copyStyles = function(srcDomNode,dstDomNode) { + $tw.utils.setStyles(dstDomNode,$tw.utils.getComputedStyles(srcDomNode)); +}; })(); diff --git a/core/modules/utils/dom/http.js b/core/modules/utils/dom/http.js index 2e6b3e9b0..990109249 100644 --- a/core/modules/utils/dom/http.js +++ b/core/modules/utils/dom/http.js @@ -45,7 +45,7 @@ exports.httpRequest = function(options) { return; } // Something went wrong - options.callback("XMLHttpRequest error code: " + this.status); + options.callback($tw.language.getString("Error/XMLHttpRequest") + ": " + this.status); } }; // Make the request diff --git a/core/modules/utils/dom/keyboard.js b/core/modules/utils/dom/keyboard.js index fda8e012a..0ba1af5a0 100644 --- a/core/modules/utils/dom/keyboard.js +++ b/core/modules/utils/dom/keyboard.js @@ -3,7 +3,7 @@ title: $:/core/modules/utils/dom/keyboard.js type: application/javascript module-type: utils -Keyboard utilities +Keyboard utilities; now deprecated. Instead, use $tw.keyboardManager \*/ (function(){ @@ -12,60 +12,14 @@ Keyboard utilities /*global $tw: false */ "use strict"; -var namedKeys = { - "backspace": 8, - "tab": 9, - "enter": 13, - "escape": 27 -}; - -/* -Parses a key descriptor into the structure: -{ - keyCode: numeric keycode - shiftKey: boolean - altKey: boolean - ctrlKey: boolean -} -Key descriptors have the following format: - ctrl+enter - ctrl+shift+alt+A -*/ -exports.parseKeyDescriptor = function(keyDescriptor) { - var components = keyDescriptor.split("+"), - info = { - keyCode: 0, - shiftKey: false, - altKey: false, - ctrlKey: false - }; - for(var t=0; t<components.length; t++) { - var s = components[t].toLowerCase(); - // Look for modifier keys - if(s === "ctrl") { - info.ctrlKey = true; - } else if(s === "shift") { - info.shiftKey = true; - } else if(s === "alt") { - info.altKey = true; - } else if(s === "meta") { - info.metaKey = true; +["parseKeyDescriptor","checkKeyDescriptor"].forEach(function(method) { + exports[method] = function() { + if($tw.keyboardManager) { + return $tw.keyboardManager[method].apply($tw.keyboardManager,Array.prototype.slice.call(arguments,0)); + } else { + return null } - // Replace named keys with their code - if(namedKeys[s]) { - info.keyCode = namedKeys[s]; - } - } - return info; -}; - -exports.checkKeyDescriptor = function(event,keyInfo) { - var metaKeyStatus = !!keyInfo.metaKey; // Using a temporary variable to keep JSHint happy - return event.keyCode === keyInfo.keyCode && - event.shiftKey === keyInfo.shiftKey && - event.altKey === keyInfo.altKey && - event.ctrlKey === keyInfo.ctrlKey && - event.metaKey === metaKeyStatus; -}; + }; +}); })(); diff --git a/core/modules/utils/dom/modal.js b/core/modules/utils/dom/modal.js index 2a966a7db..74fceb1ba 100644 --- a/core/modules/utils/dom/modal.js +++ b/core/modules/utils/dom/modal.js @@ -81,14 +81,16 @@ Modal.prototype.display = function(title,options) { }}}], parentWidget: $tw.rootWidget, document: document, - variables: variables + variables: variables, + importPageMacros: true }); headerWidgetNode.render(headerTitle,null); // Render the body of the message var bodyWidgetNode = this.wiki.makeTranscludeWidget(title,{ parentWidget: $tw.rootWidget, document: document, - variables: variables + variables: variables, + importPageMacros: true }); bodyWidgetNode.render(modalBody,null); // Setup the link if present @@ -102,6 +104,7 @@ Modal.prototype.display = function(title,options) { var link = document.createElement("a"); link.setAttribute("href",tiddler.fields.help); link.setAttribute("target","_blank"); + link.setAttribute("rel","noopener noreferrer"); link.appendChild(document.createTextNode("Help")); modalFooterHelp.appendChild(link); modalFooterHelp.style.float = "left"; @@ -122,12 +125,13 @@ Modal.prototype.display = function(title,options) { attributes: { text: { type: "string", - value: "Close" + value: $tw.language.getString("Buttons/Close/Caption") }}} ]}], parentWidget: $tw.rootWidget, document: document, - variables: variables + variables: variables, + importPageMacros: true }); footerWidgetNode.render(modalFooterButtons,null); // Set up the refresh handler diff --git a/core/modules/utils/dom/notifier.js b/core/modules/utils/dom/notifier.js index ca8e54ad7..3897b0e52 100644 --- a/core/modules/utils/dom/notifier.js +++ b/core/modules/utils/dom/notifier.js @@ -41,7 +41,11 @@ Notifier.prototype.display = function(title,options) { // Create the variables var variables = $tw.utils.extend({currentTiddler: title},options.variables); // Render the body of the notification - var widgetNode = this.wiki.makeTranscludeWidget(title,{parentWidget: $tw.rootWidget, document: document, variables: variables}); + var widgetNode = this.wiki.makeTranscludeWidget(title,{ + parentWidget: $tw.rootWidget, + document: document, + variables: variables, + importPageMacros: true}); widgetNode.render(notification,null); refreshHandler = function(changes) { widgetNode.refresh(changes,notification,null); diff --git a/core/modules/utils/filesystem.js b/core/modules/utils/filesystem.js index 553209c6b..7ffe07ee7 100644 --- a/core/modules/utils/filesystem.js +++ b/core/modules/utils/filesystem.js @@ -160,4 +160,25 @@ exports.isDirectoryEmpty = function(dirPath) { return empty; }; +/* +Recursively delete a tree of empty directories +*/ +exports.deleteEmptyDirs = function(dirpath,callback) { + var self = this; + fs.readdir(dirpath,function(err,files) { + if(err) { + return callback(err); + } + if(files.length > 0) { + return callback(null); + } + fs.rmdir(dirpath,function(err) { + if(err) { + return callback(err); + } + self.deleteEmptyDirs(path.dirname(dirpath),callback); + }); + }); +}; + })(); diff --git a/core/modules/utils/pluginmaker.js b/core/modules/utils/pluginmaker.js index 559f5aada..1fc1a3986 100644 --- a/core/modules/utils/pluginmaker.js +++ b/core/modules/utils/pluginmaker.js @@ -28,7 +28,7 @@ exports.repackPlugin = function(title,additionalTiddlers,excludeTiddlers) { try { jsonPluginTiddler = JSON.parse(pluginTiddler.fields.text); } catch(e) { - throw "Cannot parse plugin tiddler " + title + "\nError: " + e; + throw "Cannot parse plugin tiddler " + title + "\n" + $tw.language.getString("Error/Caption") + ": " + e; } // Get the list of tiddlers var tiddlers = Object.keys(jsonPluginTiddler.tiddlers); diff --git a/core/modules/utils/utils.js b/core/modules/utils/utils.js index 90015609d..94c08f329 100644 --- a/core/modules/utils/utils.js +++ b/core/modules/utils/utils.js @@ -17,7 +17,27 @@ Display a warning, in colour if we're on a terminal */ exports.warning = function(text) { console.log($tw.node ? "\x1b[1;33m" + text + "\x1b[0m" : text); -} +}; + +/* +Repeatedly replaces a substring within a string. Like String.prototype.replace, but without any of the default special handling of $ sequences in the replace string +*/ +exports.replaceString = function(text,search,replace) { + return text.replace(search,function() { + return replace; + }); +}; + +/* +Repeats a string +*/ +exports.repeat = function(str,count) { + var result = ""; + for(var t=0;t<count;t++) { + result += str; + } + return result; +}; /* Trim whitespace from the start and end of a string @@ -31,6 +51,39 @@ exports.trim = function(str) { } }; +/* +Find the line break preceding a given position in a string +Returns position immediately after that line break, or the start of the string +*/ +exports.findPrecedingLineBreak = function(text,pos) { + var result = text.lastIndexOf("\n",pos - 1); + if(result === -1) { + result = 0; + } else { + result++; + if(text.charAt(result) === "\r") { + result++; + } + } + return result; +}; + +/* +Find the line break following a given position in a string +*/ +exports.findFollowingLineBreak = function(text,pos) { + // Cut to just past the following line break, or to the end of the text + var result = text.indexOf("\n",pos); + if(result === -1) { + result = text.length; + } else { + if(text.charAt(result) === "\r") { + result++; + } + } + return result; +}; + /* Return the number of keys in an object */ @@ -383,17 +436,18 @@ exports.htmlEncode = function(s) { // Converts all HTML entities to their character equivalents exports.entityDecode = function(s) { - var e = s.substr(1,s.length-2); // Strip the & and the ; + var converter = String.fromCodePoint || String.fromCharCode, + e = s.substr(1,s.length-2); // Strip the & and the ; if(e.charAt(0) === "#") { if(e.charAt(1) === "x" || e.charAt(1) === "X") { - return String.fromCharCode(parseInt(e.substr(2),16)); + return converter(parseInt(e.substr(2),16)); } else { - return String.fromCharCode(parseInt(e.substr(1),10)); + return converter(parseInt(e.substr(1),10)); } } else { var c = $tw.config.htmlEntities[e]; if(c) { - return String.fromCharCode(c); + return converter(c); } else { return s; // Couldn't convert it as an entity, just return it raw } @@ -450,7 +504,7 @@ exports.escapeRegExp = function(s) { // Checks whether a link target is external, i.e. not a tiddler title exports.isLinkExternal = function(to) { - var externalRegExp = /(?:file|http|https|mailto|ftp|irc|news|data|skype):[^\s<>{}\[\]`|'"\\^~]+(?:\/|\b)/i; + var externalRegExp = /^(?:file|http|https|mailto|ftp|irc|news|data|skype):[^\s<>{}\[\]`|"\\^]+(?:\/|\b)/i; return externalRegExp.test(to); }; @@ -654,4 +708,20 @@ exports.sign = Math.sign || function(x) { return x > 0 ? 1 : -1; }; +/* +IE does not have an endsWith function +*/ +exports.strEndsWith = function(str,ending,position) { + if(str.endsWith) { + return str.endsWith(ending,position); + } else { + if (typeof position !== 'number' || !isFinite(position) || Math.floor(position) !== position || position > str.length) { + position = str.length; + } + position -= ending.length; + var lastIndex = str.indexOf(ending, position); + return lastIndex !== -1 && lastIndex === position; + } +}; + })(); diff --git a/core/modules/widgets/action-createtiddler.js b/core/modules/widgets/action-createtiddler.js new file mode 100644 index 000000000..01010b940 --- /dev/null +++ b/core/modules/widgets/action-createtiddler.js @@ -0,0 +1,81 @@ +/*\ +title: $:/core/modules/widgets/action-createtiddler.js +type: application/javascript +module-type: widget + +Action widget to create a new tiddler with a unique name and specified fields. + +\*/ +(function(){ + +/*jslint node: true, browser: true */ +/*global $tw: false */ +"use strict"; + +var Widget = require("$:/core/modules/widgets/widget.js").widget; + +var CreateTiddlerWidget = function(parseTreeNode,options) { + this.initialise(parseTreeNode,options); +}; + +/* +Inherit from the base widget class +*/ +CreateTiddlerWidget.prototype = new Widget(); + +/* +Render this widget into the DOM +*/ +CreateTiddlerWidget.prototype.render = function(parent,nextSibling) { + this.computeAttributes(); + this.execute(); +}; + +/* +Compute the internal state of the widget +*/ +CreateTiddlerWidget.prototype.execute = function() { + this.actionBaseTitle = this.getAttribute("$basetitle"); + this.actionSaveTitle = this.getAttribute("$savetitle"); + this.actionTimestamp = this.getAttribute("$timestamp","yes") === "yes"; +}; + +/* +Refresh the widget by ensuring our attributes are up to date +*/ +CreateTiddlerWidget.prototype.refresh = function(changedTiddlers) { + var changedAttributes = this.computeAttributes(); + if($tw.utils.count(changedAttributes) > 0) { + this.refreshSelf(); + return true; + } + return this.refreshChildren(changedTiddlers); +}; + +/* +Invoke the action associated with this widget +*/ +CreateTiddlerWidget.prototype.invokeAction = function(triggeringWidget,event) { + var title = this.wiki.generateNewTitle(this.actionBaseTitle), + fields = {}, + creationFields, + modificationFields; + $tw.utils.each(this.attributes,function(attribute,name) { + if(name.charAt(0) !== "$") { + fields[name] = attribute; + } + }); + if(this.actionTimestamp) { + creationFields = this.wiki.getCreationFields(); + modificationFields = this.wiki.getModificationFields(); + } + var tiddler = this.wiki.addTiddler(new $tw.Tiddler(creationFields,fields,modificationFields,{title: title})); + if(this.actionSaveTitle) { + this.wiki.setTextReference(this.actionSaveTitle,title,this.getVariable("currentTiddler")); + } + return true; // Action was invoked +}; + +exports["action-createtiddler"] = CreateTiddlerWidget; + +})(); diff --git a/core/modules/widgets/action-deletefield.js b/core/modules/widgets/action-deletefield.js index 8e9080f91..93b45b40a 100644 --- a/core/modules/widgets/action-deletefield.js +++ b/core/modules/widgets/action-deletefield.js @@ -67,7 +67,7 @@ DeleteFieldWidget.prototype.invokeAction = function(triggeringWidget,event) { removeFields[name] = undefined; } }); - this.wiki.addTiddler(new $tw.Tiddler(this.wiki.getModificationFields(),tiddler,removeFields,this.wiki.getCreationFields())); + this.wiki.addTiddler(new $tw.Tiddler(this.wiki.getCreationFields(),tiddler,removeFields,this.wiki.getModificationFields())); } return true; // Action was invoked }; diff --git a/core/modules/widgets/action-sendmessage.js b/core/modules/widgets/action-sendmessage.js index 2f1b9cae4..c53314b2d 100644 --- a/core/modules/widgets/action-sendmessage.js +++ b/core/modules/widgets/action-sendmessage.js @@ -78,7 +78,8 @@ SendMessageWidget.prototype.invokeAction = function(triggeringWidget,event) { param: param, paramObject: paramObject, tiddlerTitle: this.getVariable("currentTiddler"), - navigateFromTitle: this.getVariable("storyTiddler") + navigateFromTitle: this.getVariable("storyTiddler"), + event: event }); return true; // Action was invoked }; diff --git a/core/modules/widgets/button.js b/core/modules/widgets/button.js index da4ba5a01..07c0c5ac1 100644 --- a/core/modules/widgets/button.js +++ b/core/modules/widgets/button.js @@ -86,6 +86,9 @@ ButtonWidget.prototype.render = function(parent,nextSibling) { self.setTiddler(); handled = true; } + if(self.actions) { + self.invokeActionString(self.actions,self,event); + } if(handled) { event.preventDefault(); event.stopPropagation(); @@ -128,12 +131,13 @@ ButtonWidget.prototype.navigateTo = function(event) { navigateFromNode: this, navigateFromClientRect: { top: bounds.top, left: bounds.left, width: bounds.width, right: bounds.right, bottom: bounds.bottom, height: bounds.height }, - navigateSuppressNavigation: event.metaKey || event.ctrlKey || (event.button === 1) + navigateSuppressNavigation: event.metaKey || event.ctrlKey || (event.button === 1), + event: event }); }; ButtonWidget.prototype.dispatchMessage = function(event) { - this.dispatchEvent({type: this.message, param: this.param, tiddlerTitle: this.getVariable("currentTiddler")}); + this.dispatchEvent({type: this.message, param: this.param, tiddlerTitle: this.getVariable("currentTiddler"), event: event}); }; ButtonWidget.prototype.triggerPopup = function(event) { @@ -153,6 +157,7 @@ Compute the internal state of the widget */ ButtonWidget.prototype.execute = function() { // Get attributes + this.actions = this.getAttribute("actions"); this.to = this.getAttribute("to"); this.message = this.getAttribute("message"); this.param = this.getAttribute("param"); diff --git a/core/modules/widgets/edit-bitmap.js b/core/modules/widgets/edit-bitmap.js index aaac6c696..f094d9464 100644 --- a/core/modules/widgets/edit-bitmap.js +++ b/core/modules/widgets/edit-bitmap.js @@ -13,16 +13,22 @@ Edit-bitmap widget "use strict"; // Default image sizes -var DEFAULT_IMAGE_WIDTH = 300, - DEFAULT_IMAGE_HEIGHT = 185; +var DEFAULT_IMAGE_WIDTH = 600, + DEFAULT_IMAGE_HEIGHT = 370; // Configuration tiddlers var LINE_WIDTH_TITLE = "$:/config/BitmapEditor/LineWidth", - LINE_COLOUR_TITLE = "$:/config/BitmapEditor/Colour"; + LINE_COLOUR_TITLE = "$:/config/BitmapEditor/Colour", + LINE_OPACITY_TITLE = "$:/config/BitmapEditor/Opacity"; var Widget = require("$:/core/modules/widgets/widget.js").widget; var EditBitmapWidget = function(parseTreeNode,options) { + // Initialise the editor operations if they've not been done already + if(!this.editorOperations) { + EditBitmapWidget.prototype.editorOperations = {}; + $tw.modules.applyMethods("bitmapeditoroperation",this.editorOperations); + } this.initialise(parseTreeNode,options); }; @@ -42,7 +48,12 @@ EditBitmapWidget.prototype.render = function(parent,nextSibling) { this.computeAttributes(); // Execute our logic this.execute(); - // Create our element + // Create the wrapper for the toolbar and render its content + this.toolbarNode = this.document.createElement("div"); + this.toolbarNode.className = "tc-editor-toolbar"; + parent.insertBefore(this.toolbarNode,nextSibling); + this.domNodes.push(this.toolbarNode); + // Create the on-screen canvas this.canvasDomNode = $tw.utils.domMaker("canvas",{ document: this.document, "class":"tc-edit-bitmapeditor", @@ -60,29 +71,33 @@ EditBitmapWidget.prototype.render = function(parent,nextSibling) { name: "mouseup", handlerObject: this, handlerMethod: "handleMouseUpEvent" }] }); - this.widthDomNode = $tw.utils.domMaker("input",{ - document: this.document, - "class":"tc-edit-bitmapeditor-width", - eventListeners: [{ - name: "change", handlerObject: this, handlerMethod: "handleWidthChangeEvent" - }] - }); - this.heightDomNode = $tw.utils.domMaker("input",{ - document: this.document, - "class":"tc-edit-bitmapeditor-height", - eventListeners: [{ - name: "change", handlerObject: this, handlerMethod: "handleHeightChangeEvent" - }] - }); - // Insert the elements into the DOM + // Set the width and height variables + this.setVariable("tv-bitmap-editor-width",this.canvasDomNode.width + "px"); + this.setVariable("tv-bitmap-editor-height",this.canvasDomNode.height + "px"); + // Render toolbar child widgets + this.renderChildren(this.toolbarNode,null); + // // Insert the elements into the DOM parent.insertBefore(this.canvasDomNode,nextSibling); - parent.insertBefore(this.widthDomNode,nextSibling); - parent.insertBefore(this.heightDomNode,nextSibling); - this.domNodes.push(this.canvasDomNode,this.widthDomNode,this.heightDomNode); + this.domNodes.push(this.canvasDomNode); // Load the image into the canvas if($tw.browser) { this.loadCanvas(); } + // Add widget message listeners + this.addEventListeners([ + {type: "tm-edit-bitmap-operation", handler: "handleEditBitmapOperationMessage"} + ]); +}; + +/* +Handle an edit bitmap operation message from the toolbar +*/ +EditBitmapWidget.prototype.handleEditBitmapOperationMessage = function(event) { + // Invoke the handler + var handler = this.editorOperations[event.param]; + if(handler) { + handler.call(this,event); + } }; /* @@ -91,13 +106,28 @@ Compute the internal state of the widget EditBitmapWidget.prototype.execute = function() { // Get our parameters this.editTitle = this.getAttribute("tiddler",this.getVariable("currentTiddler")); + // Make the child widgets + this.makeChildWidgets(); }; /* -Note that the bitmap editor intentionally doesn't try to refresh itself because it would be confusing to have the image changing spontaneously while editting it +Just refresh the toolbar */ EditBitmapWidget.prototype.refresh = function(changedTiddlers) { - return false; + return this.refreshChildren(changedTiddlers); +}; + +/* +Set the bitmap size variables and refresh the toolbar +*/ +EditBitmapWidget.prototype.refreshToolbar = function() { + // Set the width and height variables + this.setVariable("tv-bitmap-editor-width",this.canvasDomNode.width + "px"); + this.setVariable("tv-bitmap-editor-height",this.canvasDomNode.height + "px"); + // Refresh each of our child widgets + $tw.utils.each(this.children,function(childWidget) { + childWidget.refreshSelf(); + }); }; EditBitmapWidget.prototype.loadCanvas = function() { @@ -112,7 +142,7 @@ EditBitmapWidget.prototype.loadCanvas = function() { self.currCanvas = self.document.createElement("canvas"); self.initCanvas(self.currCanvas,currImage.width,currImage.height,currImage); // Set the width and height input boxes - self.updateSize(); + self.refreshToolbar(); }; currImage.onerror = function() { // Set the on-screen canvas size and clear it @@ -121,7 +151,7 @@ EditBitmapWidget.prototype.loadCanvas = function() { self.currCanvas = self.document.createElement("canvas"); self.initCanvas(self.currCanvas,DEFAULT_IMAGE_WIDTH,DEFAULT_IMAGE_HEIGHT); // Set the width and height input boxes - self.updateSize(); + self.refreshToolbar(); }; // Get the current bitmap into an image object currImage.src = "data:" + tiddler.fields.type + ";base64," + tiddler.fields.text; @@ -139,14 +169,6 @@ EditBitmapWidget.prototype.initCanvas = function(canvas,width,height,image) { } }; -/* -** Update the input boxes with the actual size of the canvas -*/ -EditBitmapWidget.prototype.updateSize = function() { - this.widthDomNode.value = this.currCanvas.width; - this.heightDomNode.value = this.currCanvas.height; -}; - /* ** Change the size of the canvas, preserving the current image */ @@ -167,28 +189,6 @@ EditBitmapWidget.prototype.changeCanvasSize = function(newWidth,newHeight) { ctx.drawImage(this.currCanvas,0,0); }; -EditBitmapWidget.prototype.handleWidthChangeEvent = function(event) { - // Get the new width - var newWidth = parseInt(this.widthDomNode.value,10); - // Update if necessary - if(newWidth > 0 && newWidth !== this.currCanvas.width) { - this.changeCanvasSize(newWidth,this.currCanvas.height); - } - // Update the input controls - this.updateSize(); -}; - -EditBitmapWidget.prototype.handleHeightChangeEvent = function(event) { - // Get the new width - var newHeight = parseInt(this.heightDomNode.value,10); - // Update if necessary - if(newHeight > 0 && newHeight !== this.currCanvas.height) { - this.changeCanvasSize(this.currCanvas.width,newHeight); - } - // Update the input controls - this.updateSize(); -}; - EditBitmapWidget.prototype.handleTouchStartEvent = function(event) { this.brushDown = true; this.strokeStart(event.touches[0].clientX,event.touches[0].clientY); @@ -264,8 +264,9 @@ EditBitmapWidget.prototype.strokeMove = function(x,y) { // Redraw the previous image ctx.drawImage(this.currCanvas,0,0); // Render the stroke + ctx.globalAlpha = parseFloat(this.wiki.getTiddlerText(LINE_OPACITY_TITLE,"1.0")); ctx.strokeStyle = this.wiki.getTiddlerText(LINE_COLOUR_TITLE,"#ff0"); - ctx.lineWidth = parseInt(this.wiki.getTiddlerText(LINE_WIDTH_TITLE,"3"),10); + ctx.lineWidth = parseFloat(this.wiki.getTiddlerText(LINE_WIDTH_TITLE,"3")); ctx.lineCap = "round"; ctx.lineJoin = "round"; ctx.beginPath(); @@ -292,7 +293,7 @@ EditBitmapWidget.prototype.saveChanges = function() { var tiddler = this.wiki.getTiddler(this.editTitle); if(tiddler) { // data URIs look like "data:<type>;base64,<text>" - var dataURL = this.canvasDomNode.toDataURL(tiddler.fields.type,1.0), + var dataURL = this.canvasDomNode.toDataURL(tiddler.fields.type), posColon = dataURL.indexOf(":"), posSemiColon = dataURL.indexOf(";"), posComma = dataURL.indexOf(","), diff --git a/core/modules/widgets/edit-shortcut.js b/core/modules/widgets/edit-shortcut.js new file mode 100644 index 000000000..78f34839c --- /dev/null +++ b/core/modules/widgets/edit-shortcut.js @@ -0,0 +1,139 @@ +/*\ +title: $:/core/modules/widgets/edit-shortcut.js +type: application/javascript +module-type: widget + +Widget to display an editable keyboard shortcut + +\*/ +(function(){ + +/*jslint node: true, browser: true */ +/*global $tw: false */ +"use strict"; + +var Widget = require("$:/core/modules/widgets/widget.js").widget; + +var EditShortcutWidget = function(parseTreeNode,options) { + this.initialise(parseTreeNode,options); +}; + +/* +Inherit from the base widget class +*/ +EditShortcutWidget.prototype = new Widget(); + +/* +Render this widget into the DOM +*/ +EditShortcutWidget.prototype.render = function(parent,nextSibling) { + this.parentDomNode = parent; + this.computeAttributes(); + this.execute(); + this.inputNode = this.document.createElement("input"); + // Assign classes + if(this.shortcutClass) { + this.inputNode.className = this.shortcutClass; + } + // Assign other attributes + if(this.shortcutStyle) { + this.inputNode.setAttribute("style",this.shortcutStyle); + } + if(this.shortcutTooltip) { + this.inputNode.setAttribute("title",this.shortcutTooltip); + } + if(this.shortcutPlaceholder) { + this.inputNode.setAttribute("placeholder",this.shortcutPlaceholder); + } + if(this.shortcutAriaLabel) { + this.inputNode.setAttribute("aria-label",this.shortcutAriaLabel); + } + // Assign the current shortcut + this.updateInputNode(); + // Add event handlers + $tw.utils.addEventListeners(this.inputNode,[ + {name: "keydown", handlerObject: this, handlerMethod: "handleKeydownEvent"} + ]); + // Link into the DOM + parent.insertBefore(this.inputNode,nextSibling); + this.domNodes.push(this.inputNode); +}; + +/* +Compute the internal state of the widget +*/ +EditShortcutWidget.prototype.execute = function() { + this.shortcutTiddler = this.getAttribute("tiddler"); + this.shortcutField = this.getAttribute("field"); + this.shortcutIndex = this.getAttribute("index"); + this.shortcutPlaceholder = this.getAttribute("placeholder"); + this.shortcutDefault = this.getAttribute("default",""); + this.shortcutClass = this.getAttribute("class"); + this.shortcutStyle = this.getAttribute("style"); + this.shortcutTooltip = this.getAttribute("tooltip"); + this.shortcutAriaLabel = this.getAttribute("aria-label"); +}; + +/* +Update the value of the input node +*/ +EditShortcutWidget.prototype.updateInputNode = function() { + if(this.shortcutField) { + var tiddler = this.wiki.getTiddler(this.shortcutTiddler); + if(tiddler && $tw.utils.hop(tiddler.fields,this.shortcutField)) { + this.inputNode.value = tiddler.getFieldString(this.shortcutField); + } else { + this.inputNode.value = this.shortcutDefault; + } + } else if(this.shortcutIndex) { + this.inputNode.value = this.wiki.extractTiddlerDataItem(this.shortcutTiddler,this.shortcutIndex,this.shortcutDefault); + } else { + this.inputNode.value = this.wiki.getTiddlerText(this.shortcutTiddler,this.shortcutDefault); + } +}; + +/* +Handle a dom "keydown" event +*/ +EditShortcutWidget.prototype.handleKeydownEvent = function(event) { + // Ignore shift, ctrl, meta, alt + if(event.keyCode && $tw.keyboardManager.getModifierKeys().indexOf(event.keyCode) === -1) { + // Get the shortcut text representation + var value = $tw.keyboardManager.getPrintableShortcuts([{ + ctrlKey: event.ctrlKey, + shiftKey: event.shiftKey, + altKey: event.altKey, + metaKey: event.metaKey, + keyCode: event.keyCode + }]); + if(value.length > 0) { + this.wiki.setText(this.shortcutTiddler,this.shortcutField,this.shortcutIndex,value[0]); + } + // Ignore the keydown if it was already handled + event.preventDefault(); + event.stopPropagation(); + return true; + } else { + return false; + } +}; + +/* +Selectively refreshes the widget if needed. Returns true if the widget needed re-rendering +*/ +EditShortcutWidget.prototype.refresh = function(changedTiddlers) { + var changedAttributes = this.computeAttributes(); + if(changedAttributes.tiddler || changedAttributes.field || changedAttributes.index || changedAttributes.placeholder || changedAttributes["default"] || changedAttributes["class"] || changedAttributes.style || changedAttributes.tooltip || changedAttributes["aria-label"]) { + this.refreshSelf(); + return true; + } else if(changedTiddlers[this.shortcutTiddler]) { + this.updateInputNode(); + return true; + } else { + return false; + } +}; + +exports["edit-shortcut"] = EditShortcutWidget; + +})(); diff --git a/core/modules/widgets/edit-text.js b/core/modules/widgets/edit-text.js index c0588f93c..bc7b77490 100644 --- a/core/modules/widgets/edit-text.js +++ b/core/modules/widgets/edit-text.js @@ -12,280 +12,10 @@ Edit-text widget /*global $tw: false */ "use strict"; -var DEFAULT_MIN_TEXT_AREA_HEIGHT = "100px"; // Minimum height of textareas in pixels +var editTextWidgetFactory = require("$:/core/modules/editor/factory.js").editTextWidgetFactory, + FramedEngine = require("$:/core/modules/editor/engines/framed.js").FramedEngine, + SimpleEngine = require("$:/core/modules/editor/engines/simple.js").SimpleEngine; -var Widget = require("$:/core/modules/widgets/widget.js").widget; - -var EditTextWidget = function(parseTreeNode,options) { - this.initialise(parseTreeNode,options); -}; - -/* -Inherit from the base widget class -*/ -EditTextWidget.prototype = new Widget(); - -/* -Render this widget into the DOM -*/ -EditTextWidget.prototype.render = function(parent,nextSibling) { - var self = this; - // Save the parent dom node - this.parentDomNode = parent; - // Compute our attributes - this.computeAttributes(); - // Execute our logic - this.execute(); - // Create our element - var editInfo = this.getEditInfo(), - tag = this.editTag; - if($tw.config.htmlUnsafeElements.indexOf(tag) !== -1) { - tag = "input"; - } - var domNode = this.document.createElement(tag); - if(this.editType) { - domNode.setAttribute("type",this.editType); - } - if(editInfo.value === "" && this.editPlaceholder) { - domNode.setAttribute("placeholder",this.editPlaceholder); - } - if(this.editSize) { - domNode.setAttribute("size",this.editSize); - } - if(this.editRows) { - domNode.setAttribute("rows",this.editRows); - } - // Assign classes - if(this.editClass) { - domNode.className = this.editClass; - } - // Set the text - if(this.editTag === "textarea") { - domNode.appendChild(this.document.createTextNode(editInfo.value)); - } else { - domNode.value = editInfo.value; - } - // Add an input event handler - $tw.utils.addEventListeners(domNode,[ - {name: "focus", handlerObject: this, handlerMethod: "handleFocusEvent"}, - {name: "input", handlerObject: this, handlerMethod: "handleInputEvent"} - ]); - // Insert the element into the DOM - parent.insertBefore(domNode,nextSibling); - this.domNodes.push(domNode); - if(this.postRender) { - this.postRender(); - } - // Fix height - this.fixHeight(); - // Focus field - if(this.editFocus === "true") { - if(domNode.focus && domNode.select) { - domNode.focus(); - domNode.select(); - } - } -}; - -/* -Get the tiddler being edited and current value -*/ -EditTextWidget.prototype.getEditInfo = function() { - // Get the edit value - var self = this, - value, - update; - if(this.editIndex) { - value = this.wiki.extractTiddlerDataItem(this.editTitle,this.editIndex,this.editDefault); - update = function(value) { - var data = self.wiki.getTiddlerData(self.editTitle,{}); - if(data[self.editIndex] !== value) { - data[self.editIndex] = value; - self.wiki.setTiddlerData(self.editTitle,data); - } - }; - } else { - // Get the current tiddler and the field name - var tiddler = this.wiki.getTiddler(this.editTitle); - if(tiddler) { - // If we've got a tiddler, the value to display is the field string value - value = tiddler.getFieldString(this.editField); - } else { - // Otherwise, we need to construct a default value for the editor - switch(this.editField) { - case "text": - value = "Type the text for the tiddler '" + this.editTitle + "'"; - break; - case "title": - value = this.editTitle; - break; - default: - value = ""; - break; - } - if(this.editDefault !== undefined) { - value = this.editDefault; - } - } - update = function(value) { - var tiddler = self.wiki.getTiddler(self.editTitle), - updateFields = { - title: self.editTitle - }; - updateFields[self.editField] = value; - self.wiki.addTiddler(new $tw.Tiddler(self.wiki.getCreationFields(),tiddler,updateFields,self.wiki.getModificationFields())); - }; - } - return {value: value, update: update}; -}; - -/* -Compute the internal state of the widget -*/ -EditTextWidget.prototype.execute = function() { - // Get our parameters - this.editTitle = this.getAttribute("tiddler",this.getVariable("currentTiddler")); - this.editField = this.getAttribute("field","text"); - this.editIndex = this.getAttribute("index"); - this.editDefault = this.getAttribute("default"); - this.editClass = this.getAttribute("class"); - this.editPlaceholder = this.getAttribute("placeholder"); - this.editSize = this.getAttribute("size"); - this.editRows = this.getAttribute("rows"); - this.editAutoHeight = this.getAttribute("autoHeight","yes") === "yes"; - this.editMinHeight = this.getAttribute("minHeight",DEFAULT_MIN_TEXT_AREA_HEIGHT); - this.editFocusPopup = this.getAttribute("focusPopup"); - this.editFocus = this.getAttribute("focus"); - // Get the editor element tag and type - var tag,type; - if(this.editField === "text") { - tag = "textarea"; - } else { - tag = "input"; - var fieldModule = $tw.Tiddler.fieldModules[this.editField]; - if(fieldModule && fieldModule.editTag) { - tag = fieldModule.editTag; - } - if(fieldModule && fieldModule.editType) { - type = fieldModule.editType; - } - type = type || "text"; - } - // Get the rest of our parameters - this.editTag = this.getAttribute("tag",tag); - this.editType = this.getAttribute("type",type); -}; - -/* -Selectively refreshes the widget if needed. Returns true if the widget or any of its children needed re-rendering -*/ -EditTextWidget.prototype.refresh = function(changedTiddlers) { - var changedAttributes = this.computeAttributes(); - // Completely rerender if any of our attributes have changed - if(changedAttributes.tiddler || changedAttributes.field || changedAttributes.index || changedAttributes["default"] || changedAttributes["class"] || changedAttributes.placeholder || changedAttributes.size || changedAttributes.autoHeight || changedAttributes.minHeight || changedAttributes.focusPopup || changedAttributes.rows) { - this.refreshSelf(); - return true; - } else if(changedTiddlers[this.editTitle]) { - this.updateEditor(this.getEditInfo().value); - return true; - } - // Fix the height anyway in case there has been a reflow - this.fixHeight(); - return false; -}; - -/* -Update the editor with new text. This method is separate from updateEditorDomNode() -so that subclasses can override updateEditor() and still use updateEditorDomNode() -*/ -EditTextWidget.prototype.updateEditor = function(text) { - this.updateEditorDomNode(text); -}; - -/* -Update the editor dom node with new text -*/ -EditTextWidget.prototype.updateEditorDomNode = function(text) { - // Replace the edit value if the tiddler we're editing has changed - var domNode = this.domNodes[0]; - if(!domNode.isTiddlyWikiFakeDom) { - if(this.document.activeElement !== domNode) { - domNode.value = text; - } - // Fix the height if needed - this.fixHeight(); - } -}; - -/* -Get the first parent element that has scrollbars or use the body as fallback. -*/ -EditTextWidget.prototype.getScrollContainer = function(el) { - while(el.parentNode) { - el = el.parentNode; - if(el.scrollTop) { - return el; - } - } - return this.document.body; -}; - -/* -Fix the height of textareas to fit their content -*/ -EditTextWidget.prototype.fixHeight = function() { - var domNode = this.domNodes[0]; - if(this.editAutoHeight && domNode && !domNode.isTiddlyWikiFakeDom && this.editTag === "textarea") { - // Resize the textarea to fit its content, preserving scroll position - // Get the scroll container and register the current scroll position - var container = this.getScrollContainer(domNode), - scrollTop = container.scrollTop; - // Measure the specified minimum height - domNode.style.height = this.editMinHeight; - var minHeight = domNode.offsetHeight; - // Set its height to auto so that it snaps to the correct height - domNode.style.height = "auto"; - // Calculate the revised height - var newHeight = Math.max(domNode.scrollHeight + domNode.offsetHeight - domNode.clientHeight,minHeight); - // Only try to change the height if it has changed - if(newHeight !== domNode.offsetHeight) { - domNode.style.height = newHeight + "px"; - // Make sure that the dimensions of the textarea are recalculated - $tw.utils.forceLayout(domNode); - // Set the container to the position we registered at the beginning - container.scrollTop = scrollTop; - } - } -}; - -/* -Handle a dom "input" event -*/ -EditTextWidget.prototype.handleInputEvent = function(event) { - this.saveChanges(this.domNodes[0].value); - this.fixHeight(); - return true; -}; - -EditTextWidget.prototype.handleFocusEvent = function(event) { - if(this.editFocusPopup) { - $tw.popup.triggerPopup({ - domNode: this.domNodes[0], - title: this.editFocusPopup, - wiki: this.wiki, - force: true - }); - } - return true; -}; - -EditTextWidget.prototype.saveChanges = function(text) { - var editInfo = this.getEditInfo(); - if(text !== editInfo.value) { - editInfo.update(text); - } -}; - -exports["edit-text"] = EditTextWidget; +exports["edit-text"] = editTextWidgetFactory(FramedEngine,SimpleEngine); })(); diff --git a/core/modules/widgets/edit.js b/core/modules/widgets/edit.js index 38b676e57..ebcc775ca 100644 --- a/core/modules/widgets/edit.js +++ b/core/modules/widgets/edit.js @@ -57,7 +57,8 @@ EditWidget.prototype.execute = function() { index: {type: "string", value: this.editIndex}, "class": {type: "string", value: this.editClass}, "placeholder": {type: "string", value: this.editPlaceholder} - } + }, + children: this.parseTreeNode.children }]); }; diff --git a/core/modules/widgets/entity.js b/core/modules/widgets/entity.js index 7e2b9dc66..5c885baea 100755 --- a/core/modules/widgets/entity.js +++ b/core/modules/widgets/entity.js @@ -29,7 +29,8 @@ Render this widget into the DOM EntityWidget.prototype.render = function(parent,nextSibling) { this.parentDomNode = parent; this.execute(); - var textNode = this.document.createTextNode($tw.utils.entityDecode(this.parseTreeNode.entity)); + var entityString = this.getAttribute("entity",this.parseTreeNode.entity || ""), + textNode = this.document.createTextNode($tw.utils.entityDecode(entityString)); parent.insertBefore(textNode,nextSibling); this.domNodes.push(textNode); }; @@ -44,7 +45,13 @@ EntityWidget.prototype.execute = function() { Selectively refreshes the widget if needed. Returns true if the widget or any of its children needed re-rendering */ EntityWidget.prototype.refresh = function(changedTiddlers) { - return false; + var changedAttributes = this.computeAttributes(); + if(changedAttributes.entity) { + this.refreshSelf(); + return true; + } else { + return false; + } }; exports.entity = EntityWidget; diff --git a/core/modules/widgets/fields.js b/core/modules/widgets/fields.js index 511b6f7d5..d75a3b6e9 100755 --- a/core/modules/widgets/fields.js +++ b/core/modules/widgets/fields.js @@ -75,9 +75,9 @@ FieldsWidget.prototype.execute = function() { value = reMatch[1]; } } - row = row.replace("$name$",fieldName); - row = row.replace("$value$",value); - row = row.replace("$encoded_value$",$tw.utils.htmlEncode(value)); + row = $tw.utils.replaceString(row,"$name$",fieldName); + row = $tw.utils.replaceString(row,"$value$",value); + row = $tw.utils.replaceString(row,"$encoded_value$",$tw.utils.htmlEncode(value)); text.push(row); } } diff --git a/core/modules/widgets/image.js b/core/modules/widgets/image.js index 50c0703b1..4ecafbd2b 100644 --- a/core/modules/widgets/image.js +++ b/core/modules/widgets/image.js @@ -87,6 +87,9 @@ ImageWidget.prototype.render = function(parent,nextSibling) { src = _canonical_uri; break; } + } else { + // Just trigger loading of the tiddler + this.wiki.getTiddlerText(this.imageSource); } } } diff --git a/core/modules/widgets/keyboard.js b/core/modules/widgets/keyboard.js index df32cc5b8..8d2c105a7 100644 --- a/core/modules/widgets/keyboard.js +++ b/core/modules/widgets/keyboard.js @@ -41,8 +41,11 @@ KeyboardWidget.prototype.render = function(parent,nextSibling) { domNode.className = classes.join(" "); // Add a keyboard event handler domNode.addEventListener("keydown",function (event) { - if($tw.utils.checkKeyDescriptor(event,self.keyInfo)) { - self.invokeActions(this,event); + if($tw.keyboardManager.checkKeyDescriptors(event,self.keyInfoArray)) { + self.invokeActions(self,event); + if(self.actions) { + self.invokeActionString(self.actions,self,event); + } self.dispatchMessage(event); event.preventDefault(); event.stopPropagation(); @@ -65,10 +68,11 @@ Compute the internal state of the widget */ KeyboardWidget.prototype.execute = function() { // Get attributes + this.actions = this.getAttribute("actions"); this.message = this.getAttribute("message"); this.param = this.getAttribute("param"); this.key = this.getAttribute("key"); - this.keyInfo = $tw.utils.parseKeyDescriptor(this.key); + this.keyInfoArray = $tw.keyboardManager.parseKeyDescriptors(this.key); this["class"] = this.getAttribute("class"); // Make child widgets this.makeChildWidgets(); diff --git a/core/modules/widgets/link.js b/core/modules/widgets/link.js index c749ff945..e4596c72c 100755 --- a/core/modules/widgets/link.js +++ b/core/modules/widgets/link.js @@ -13,6 +13,7 @@ Link widget "use strict"; var Widget = require("$:/core/modules/widgets/widget.js").widget; +var MISSING_LINK_CONFIG_TITLE = "$:/config/MissingLinks"; var LinkWidget = function(parseTreeNode,options) { this.initialise(parseTreeNode,options); @@ -35,9 +36,10 @@ LinkWidget.prototype.render = function(parent,nextSibling) { this.execute(); // Get the value of the tv-wikilinks configuration macro var wikiLinksMacro = this.getVariable("tv-wikilinks"), - useWikiLinks = wikiLinksMacro ? (wikiLinksMacro.trim() !== "no") : true; + useWikiLinks = wikiLinksMacro ? (wikiLinksMacro.trim() !== "no") : true, + missingLinksEnabled = !(this.hideMissingLinks && this.isMissing && !this.isShadow); // Render the link if required - if(useWikiLinks) { + if(useWikiLinks && missingLinksEnabled) { this.renderLink(parent,nextSibling); } else { // Just insert the link text @@ -80,8 +82,8 @@ LinkWidget.prototype.renderLink = function(parent,nextSibling) { // Set an href var wikiLinkTemplateMacro = this.getVariable("tv-wikilink-template"), wikiLinkTemplate = wikiLinkTemplateMacro ? wikiLinkTemplateMacro.trim() : "#$uri_encoded$", - wikiLinkText = wikiLinkTemplate.replace("$uri_encoded$",encodeURIComponent(this.to)); - wikiLinkText = wikiLinkText.replace("$uri_doubleencoded$",encodeURIComponent(encodeURIComponent(this.to))); + wikiLinkText = $tw.utils.replaceString(wikiLinkTemplate,"$uri_encoded$",encodeURIComponent(this.to)); + wikiLinkText = $tw.utils.replaceString(wikiLinkText,"$uri_doubleencoded$",encodeURIComponent(encodeURIComponent(this.to))); wikiLinkText = this.getVariable("tv-get-export-link",{params: [{name: "to",value: this.to}],defaultValue: wikiLinkText}); if(tag === "a") { domNode.setAttribute("href",wikiLinkText); @@ -216,6 +218,7 @@ LinkWidget.prototype.execute = function() { // Determine the link characteristics this.isMissing = !this.wiki.tiddlerExists(this.to); this.isShadow = this.wiki.isShadowTiddler(this.to); + this.hideMissingLinks = ($tw.wiki.getTiddlerText(MISSING_LINK_CONFIG_TITLE,"yes") === "no"); // Make the child widgets this.makeChildWidgets(); }; @@ -225,7 +228,7 @@ Selectively refreshes the widget if needed. Returns true if the widget or any of */ LinkWidget.prototype.refresh = function(changedTiddlers) { var changedAttributes = this.computeAttributes(); - if(changedAttributes.to || changedTiddlers[this.to] || changedAttributes["aria-label"] || changedAttributes.tooltip) { + if(changedAttributes.to || changedTiddlers[this.to] || changedAttributes["aria-label"] || changedAttributes.tooltip || changedTiddlers[MISSING_LINK_CONFIG_TITLE]) { this.refreshSelf(); return true; } diff --git a/core/modules/widgets/linkcatcher.js b/core/modules/widgets/linkcatcher.js index 51738d6d8..d279140c0 100644 --- a/core/modules/widgets/linkcatcher.js +++ b/core/modules/widgets/linkcatcher.js @@ -45,6 +45,7 @@ LinkCatcherWidget.prototype.execute = function() { this.catchMessage = this.getAttribute("message"); this.catchSet = this.getAttribute("set"); this.catchSetTo = this.getAttribute("setTo"); + this.catchActions = this.getAttribute("actions"); // Construct the child widgets this.makeChildWidgets(); }; @@ -80,6 +81,9 @@ LinkCatcherWidget.prototype.handleNavigateEvent = function(event) { var tiddler = this.wiki.getTiddler(this.catchSet); this.wiki.addTiddler(new $tw.Tiddler(tiddler,{title: this.catchSet, text: this.catchSetTo})); } + if(this.catchActions) { + this.invokeActionString(this.catchActions,this); + } return false; }; diff --git a/core/modules/widgets/list.js b/core/modules/widgets/list.js index 4c5b265f2..f4981df33 100755 --- a/core/modules/widgets/list.js +++ b/core/modules/widgets/list.js @@ -43,6 +43,9 @@ ListWidget.prototype.render = function(parent,nextSibling) { this.renderChildren(parent,nextSibling); // Construct the storyview var StoryView = this.storyViews[this.storyViewName]; + if(this.storyViewName && !StoryView) { + StoryView = this.storyViews["classic"]; + } if(StoryView && !this.document.isTiddlyWikiFakeDom) { this.storyview = new StoryView(this); } else { diff --git a/core/modules/widgets/navigator.js b/core/modules/widgets/navigator.js index b6aab02f4..fa54a80d3 100755 --- a/core/modules/widgets/navigator.js +++ b/core/modules/widgets/navigator.js @@ -73,7 +73,7 @@ NavigatorWidget.prototype.refresh = function(changedTiddlers) { this.refreshSelf(); return true; } else { - return this.refreshChildren(changedTiddlers); + return this.refreshChildren(changedTiddlers); } }; @@ -355,6 +355,9 @@ NavigatorWidget.prototype.handleSaveTiddlerEvent = function(event) { if(isRename) { this.wiki.deleteTiddler(draftOf); } + // #2381 always remove new title & old + this.removeTitleFromStory(storyList,draftTitle); + this.removeTitleFromStory(storyList,draftOf); if(!event.paramObject || event.paramObject.suppressNavigation !== "yes") { // Replace the draft in the story with the original this.replaceFirstTitleInStory(storyList,title,draftTitle); @@ -451,7 +454,7 @@ NavigatorWidget.prototype.handleNewTiddlerEvent = function(event) { // Merge the tags var mergedTags = []; if(existingTiddler && existingTiddler.fields.tags) { - $tw.utils.pushTop(mergedTags,existingTiddler.fields.tags) + $tw.utils.pushTop(mergedTags,existingTiddler.fields.tags); } if(additionalFields && additionalFields.tags) { // Merge tags @@ -492,7 +495,6 @@ NavigatorWidget.prototype.handleNewTiddlerEvent = function(event) { // Import JSON tiddlers into a pending import tiddler NavigatorWidget.prototype.handleImportTiddlersEvent = function(event) { - var self = this; // Get the tiddlers var tiddlers = []; try { @@ -544,7 +546,7 @@ NavigatorWidget.prototype.handleImportTiddlersEvent = function(event) { history.push(IMPORT_TITLE); // Save the updated story and history this.saveStoryList(storyList); - this.addToHistory(history); + this.addToHistory(history); } return false; }; @@ -556,7 +558,7 @@ NavigatorWidget.prototype.handlePerformImportEvent = function(event) { importData = this.wiki.getTiddlerDataCached(event.param,{tiddlers: {}}), importReport = []; // Add the tiddlers to the store - importReport.push($tw.language.getString("Import/Imported") + "\n"); + importReport.push($tw.language.getString("Import/Imported/Hint") + "\n"); $tw.utils.each(importData.tiddlers,function(tiddlerFields) { var title = tiddlerFields.title; if(title && importTiddler && importTiddler.fields["selection-" + title] !== "unchecked") { @@ -577,8 +579,7 @@ NavigatorWidget.prototype.handlePerformImportEvent = function(event) { }; NavigatorWidget.prototype.handleFoldTiddlerEvent = function(event) { - var self = this, - paramObject = event.paramObject || {}; + var paramObject = event.paramObject || {}; if(paramObject.foldedState) { var foldedState = this.wiki.getTiddlerText(paramObject.foldedState,"show") === "show" ? "hide" : "show"; this.wiki.setText(paramObject.foldedState,"text",null,foldedState); @@ -613,8 +614,7 @@ NavigatorWidget.prototype.handleUnfoldAllTiddlersEvent = function(event) { }; NavigatorWidget.prototype.handleRenameTiddlerEvent = function(event) { - var self = this, - paramObject = event.paramObject || {}, + var paramObject = event.paramObject || {}, from = paramObject.from || event.tiddlerTitle, to = paramObject.to; $tw.wiki.renameTiddler(from,to); diff --git a/core/modules/widgets/select.js b/core/modules/widgets/select.js index b0d7385cb..4d1111730 100644 --- a/core/modules/widgets/select.js +++ b/core/modules/widgets/select.js @@ -51,6 +51,7 @@ SelectWidget.prototype.render = function(parent,nextSibling) { Handle a change event */ SelectWidget.prototype.handleChangeEvent = function(event) { + // Get the new value and assign it to the tiddler if(this.selectMultiple == false) { var value = this.getSelectDomNode().value; } else { @@ -58,6 +59,10 @@ SelectWidget.prototype.handleChangeEvent = function(event) { value = $tw.utils.stringifyList(value); } this.wiki.setText(this.selectTitle,this.selectField,this.selectIndex,value); + // Trigger actions + if(this.selectActions) { + this.invokeActionString(this.selectActions,this,event); + } }; /* @@ -132,6 +137,7 @@ Compute the internal state of the widget */ SelectWidget.prototype.execute = function() { // Get our parameters + this.selectActions = this.getAttribute("actions"); this.selectTitle = this.getAttribute("tiddler",this.getVariable("currentTiddler")); this.selectField = this.getAttribute("field","text"); this.selectIndex = this.getAttribute("index"); diff --git a/core/modules/widgets/setvariable.js b/core/modules/widgets/setvariable.js index f75fa2c98..76844b62d 100755 --- a/core/modules/widgets/setvariable.js +++ b/core/modules/widgets/setvariable.js @@ -40,6 +40,7 @@ SetWidget.prototype.execute = function() { // Get our parameters this.setName = this.getAttribute("name","currentTiddler"); this.setFilter = this.getAttribute("filter"); + this.setSelect = this.getAttribute("select"); this.setValue = this.getAttribute("value"); this.setEmptyValue = this.getAttribute("emptyValue"); // Set context variable @@ -56,7 +57,15 @@ SetWidget.prototype.getValue = function() { if(this.setFilter) { var results = this.wiki.filterTiddlers(this.setFilter,this); if(!this.setValue) { - value = $tw.utils.stringifyList(results); + var select; + if(this.setSelect) { + select = parseInt(this.setSelect,10); + } + if(select !== undefined) { + value = results[select] || ""; + } else { + value = $tw.utils.stringifyList(results); + } } if(results.length === 0 && this.setEmptyValue !== undefined) { value = this.setEmptyValue; @@ -72,7 +81,7 @@ Selectively refreshes the widget if needed. Returns true if the widget or any of */ SetWidget.prototype.refresh = function(changedTiddlers) { var changedAttributes = this.computeAttributes(); - if(changedAttributes.name || changedAttributes.filter || changedAttributes.value || changedAttributes.emptyValue || + if(changedAttributes.name || changedAttributes.filter || changedAttributes.select ||changedAttributes.value || changedAttributes.emptyValue || (this.setFilter && this.getValue() != this.variables[this.setName].value)) { this.refreshSelf(); return true; diff --git a/core/modules/widgets/transclude.js b/core/modules/widgets/transclude.js index 34a912851..7af61fc8e 100755 --- a/core/modules/widgets/transclude.js +++ b/core/modules/widgets/transclude.js @@ -68,7 +68,7 @@ TranscludeWidget.prototype.execute = function() { parseTreeNodes = [{type: "element", tag: "span", attributes: { "class": {type: "string", value: "tc-error"} }, children: [ - {type: "text", text: "Recursive transclusion error in transclude widget"} + {type: "text", text: $tw.language.getString("Error/RecursiveTransclusion")} ]}]; } } diff --git a/core/modules/widgets/view.js b/core/modules/widgets/view.js index 5e1fa9a01..bbe9106be 100755 --- a/core/modules/widgets/view.js +++ b/core/modules/widgets/view.js @@ -55,6 +55,9 @@ ViewWidget.prototype.execute = function() { case "htmlwikified": this.text = this.getValueAsHtmlWikified(); break; + case "plainwikified": + this.text = this.getValueAsPlainWikified(); + break; case "htmlencodedplainwikified": this.text = this.getValueAsHtmlEncodedPlainWikified(); break; @@ -135,6 +138,10 @@ ViewWidget.prototype.getValueAsHtmlWikified = function() { return this.wiki.renderText("text/html","text/vnd.tiddlywiki",this.getValueAsText(),{parentWidget: this}); }; +ViewWidget.prototype.getValueAsPlainWikified = function() { + return this.wiki.renderText("text/plain","text/vnd.tiddlywiki",this.getValueAsText(),{parentWidget: this}); +}; + ViewWidget.prototype.getValueAsHtmlEncodedPlainWikified = function() { return $tw.utils.htmlEncode(this.wiki.renderText("text/plain","text/vnd.tiddlywiki",this.getValueAsText(),{parentWidget: this})); }; diff --git a/core/modules/widgets/widget.js b/core/modules/widgets/widget.js index 679433071..f4905d433 100755 --- a/core/modules/widgets/widget.js +++ b/core/modules/widgets/widget.js @@ -125,7 +125,7 @@ Widget.prototype.substituteVariableParameters = function(text,formalParams,actua // If we've still not got a value, use the default, if any paramValue = paramValue || paramInfo["default"] || ""; // Replace any instances of this parameter - text = text.replace(new RegExp("\\$" + $tw.utils.escapeRegExp(paramInfo.name) + "\\$","mg"),paramValue); + text = $tw.utils.replaceString(text,new RegExp("\\$" + $tw.utils.escapeRegExp(paramInfo.name) + "\\$","mg"),paramValue); } } return text; @@ -222,7 +222,9 @@ Widget.prototype.computeAttributes = function() { self = this, value; $tw.utils.each(this.parseTreeNode.attributes,function(attribute,name) { - if(attribute.type === "indirect") { + if(attribute.type === "filtered") { + value = self.wiki.filterTiddlers(attribute.filter,self)[0] || ""; + } else if(attribute.type === "indirect") { value = self.wiki.getTextReference(attribute.textReference,"",self.getVariable("currentTiddler")); } else if(attribute.type === "macro") { value = self.getVariable(attribute.value.name,{params: attribute.value.params}); @@ -493,8 +495,11 @@ Widget.prototype.invokeActions = function(triggeringWidget,event) { for(var t=0; t<this.children.length; t++) { var child = this.children[t]; // Invoke the child if it is an action widget - if(child.invokeAction && child.invokeAction(triggeringWidget,event)) { - handled = true; + if(child.invokeAction) { + child.refreshSelf(); + if(child.invokeAction(triggeringWidget,event)) { + handled = true; + } } // Propagate through through the child if it permits it if(child.allowActionPropagation() && child.invokeActions(triggeringWidget,event)) { @@ -504,6 +509,23 @@ Widget.prototype.invokeActions = function(triggeringWidget,event) { return handled; }; +/* +Invoke the action widgets defined in a string +*/ +Widget.prototype.invokeActionString = function(actions,triggeringWidget,event) { + actions = actions || ""; + var parser = this.wiki.parseText("text/vnd.tiddlywiki",actions,{ + parentWidget: this, + document: this.document + }), + widgetNode = this.wiki.makeWidget(parser,{ + parentWidget: this, + document: this.document + }); + var container = this.document.createElement("div"); + widgetNode.render(container,null); + return widgetNode.invokeActions(this,event); +}; Widget.prototype.allowActionPropagation = function() { return true; diff --git a/core/modules/widgets/wikify.js b/core/modules/widgets/wikify.js new file mode 100644 index 000000000..853ebff1b --- /dev/null +++ b/core/modules/widgets/wikify.js @@ -0,0 +1,157 @@ +/*\ +title: $:/core/modules/widgets/wikify.js +type: application/javascript +module-type: widget + +Widget to wikify text into a variable + +\*/ +(function(){ + +/*jslint node: true, browser: true */ +/*global $tw: false */ +"use strict"; + +var Widget = require("$:/core/modules/widgets/widget.js").widget; + +var WikifyWidget = function(parseTreeNode,options) { + this.initialise(parseTreeNode,options); +}; + +/* +Inherit from the base widget class +*/ +WikifyWidget.prototype = new Widget(); + +/* +Render this widget into the DOM +*/ +WikifyWidget.prototype.render = function(parent,nextSibling) { + this.parentDomNode = parent; + this.computeAttributes(); + this.execute(); + this.renderChildren(parent,nextSibling); +}; + +/* +Compute the internal state of the widget +*/ +WikifyWidget.prototype.execute = function() { + // Get our parameters + this.wikifyName = this.getAttribute("name"); + this.wikifyText = this.getAttribute("text"); + this.wikifyType = this.getAttribute("type"); + this.wikifyMode = this.getAttribute("mode","block"); + this.wikifyOutput = this.getAttribute("output","text"); + // Create the parse tree + this.wikifyParser = this.wiki.parseText(this.wikifyType,this.wikifyText,{ + parseAsInline: this.wikifyMode === "inline" + }); + // Create the widget tree + this.wikifyWidgetNode = this.wiki.makeWidget(this.wikifyParser,{ + document: $tw.fakeDocument, + parentWidget: this + }); + // Render the widget tree to the container + this.wikifyContainer = $tw.fakeDocument.createElement("div"); + this.wikifyWidgetNode.render(this.wikifyContainer,null); + this.wikifyResult = this.getResult(); + // Set context variable + this.setVariable(this.wikifyName,this.wikifyResult); + // Construct the child widgets + this.makeChildWidgets(); +}; + +/* +Return the result string +*/ +WikifyWidget.prototype.getResult = function() { + var result; + switch(this.wikifyOutput) { + case "text": + result = this.wikifyContainer.textContent; + break; + case "formattedtext": + result = this.wikifyContainer.formattedTextContent; + break; + case "html": + result = this.wikifyContainer.innerHTML; + break; + case "parsetree": + result = JSON.stringify(this.wikifyParser.tree,0,$tw.config.preferences.jsonSpaces); + break; + case "widgettree": + result = JSON.stringify(this.getWidgetTree(),0,$tw.config.preferences.jsonSpaces); + break; + } + return result; +}; + +/* +Return a string of the widget tree +*/ +WikifyWidget.prototype.getWidgetTree = function() { + var copyNode = function(widgetNode,resultNode) { + var type = widgetNode.parseTreeNode.type; + resultNode.type = type; + switch(type) { + case "element": + resultNode.tag = widgetNode.parseTreeNode.tag; + break; + case "text": + resultNode.text = widgetNode.parseTreeNode.text; + break; + } + if(Object.keys(widgetNode.attributes || {}).length > 0) { + resultNode.attributes = {}; + $tw.utils.each(widgetNode.attributes,function(attr,attrName) { + resultNode.attributes[attrName] = widgetNode.getAttribute(attrName); + }); + } + if(Object.keys(widgetNode.children || {}).length > 0) { + resultNode.children = []; + $tw.utils.each(widgetNode.children,function(widgetChildNode) { + var node = {}; + resultNode.children.push(node); + copyNode(widgetChildNode,node); + }); + } + }, + results = {}; + copyNode(this.wikifyWidgetNode,results); + return results; +}; + +/* +Selectively refreshes the widget if needed. Returns true if the widget or any of its children needed re-rendering +*/ +WikifyWidget.prototype.refresh = function(changedTiddlers) { + var changedAttributes = this.computeAttributes(); + // Refresh ourselves entirely if any of our attributes have changed + if(changedAttributes.name || changedAttributes.text || changedAttributes.type || changedAttributes.mode || changedAttributes.output) { + this.refreshSelf(); + return true; + } else { + // Refresh the widget tree + if(this.wikifyWidgetNode.refresh(changedTiddlers)) { + // Check if there was any change + var result = this.getResult(); + if(result !== this.wikifyResult) { + // If so, save the change + this.wikifyResult = result; + this.setVariable(this.wikifyName,this.wikifyResult); + // Refresh each of our child widgets + $tw.utils.each(this.children,function(childWidget) { + childWidget.refreshSelf(); + }); + return true; + } + } + // Just refresh the children + return this.refreshChildren(changedTiddlers); + } +}; + +exports.wikify = WikifyWidget; + +})(); diff --git a/core/modules/wiki.js b/core/modules/wiki.js index 64abe9e89..63e31303c 100755 --- a/core/modules/wiki.js +++ b/core/modules/wiki.js @@ -328,7 +328,7 @@ exports.sortTiddlers = function(titles,sortField,isDescending,isCaseSensitive,is var result = isNaN(x) && !isNaN(y) ? (isDescending ? -1 : 1) : !isNaN(x) && isNaN(y) ? (isDescending ? 1 : -1) : - (isDescending ? y - x : x - y); + (isDescending ? y - x : x - y); return result; }; if(sortField !== "title") { @@ -784,6 +784,7 @@ Options include: _canonical_uri: optional string of the canonical URI of this content */ exports.parseText = function(type,text,options) { + text = text || ""; options = options || {}; // Select a parser var Parser = $tw.Wiki.parsers[type]; @@ -903,31 +904,54 @@ options: as for wiki.makeWidget() plus: options.field: optional field to transclude (defaults to "text") options.mode: transclusion mode "inline" or "block" options.children: optional array of children for the transclude widget +options.importVariables: optional importvariables filter string for macros to be included +options.importPageMacros: optional boolean; if true, equivalent to passing "[[$:/core/ui/PageMacros]] [all[shadows+tiddlers]tag[$:/tags/Macro]!has[draft.of]]" to options.importVariables */ exports.makeTranscludeWidget = function(title,options) { options = options || {}; - var parseTree = {tree: [{ + var parseTreeDiv = {tree: [{ type: "element", tag: "div", - children: [{ - type: "transclude", - attributes: { - tiddler: { - name: "tiddler", - type: "string", - value: title}}, - isBlock: !options.parseAsInline}]} - ]}; + children: []}]}, + parseTreeImportVariables = { + type: "importvariables", + attributes: { + filter: { + name: "filter", + type: "string" + } + }, + isBlock: false, + children: []}, + parseTreeTransclude = { + type: "transclude", + attributes: { + tiddler: { + name: "tiddler", + type: "string", + value: title}}, + isBlock: !options.parseAsInline}; + if(options.importVariables || options.importPageMacros) { + if(options.importVariables) { + parseTreeImportVariables.attributes.filter.value = options.importVariables; + } else if(options.importPageMacros) { + parseTreeImportVariables.attributes.filter.value = "[[$:/core/ui/PageMacros]] [all[shadows+tiddlers]tag[$:/tags/Macro]!has[draft.of]]"; + } + parseTreeDiv.tree[0].children.push(parseTreeImportVariables); + parseTreeImportVariables.children.push(parseTreeTransclude); + } else { + parseTreeDiv.tree[0].children.push(parseTreeTransclude); + } if(options.field) { - parseTree.tree[0].children[0].attributes.field = {type: "string", value: options.field}; + parseTreeTransclude.attributes.field = {type: "string", value: options.field}; } if(options.mode) { - parseTree.tree[0].children[0].attributes.mode = {type: "string", value: options.mode}; + parseTreeTransclude.attributes.mode = {type: "string", value: options.mode}; } if(options.children) { - parseTree.tree[0].children[0].children = options.children; + parseTreeTransclude.children = options.children; } - return $tw.wiki.makeWidget(parseTree,options); + return $tw.wiki.makeWidget(parseTreeDiv,options); }; /* @@ -1117,29 +1141,24 @@ exports.readFile = function(file,callback) { var reader = new FileReader(); // Onload reader.onload = function(event) { - // Deserialise the file contents var text = event.target.result, tiddlerFields = {title: file.name || "Untitled", type: type}; - // Are we binary? if(isBinary) { - // The base64 section starts after the first comma in the data URI var commaPos = text.indexOf(","); if(commaPos !== -1) { - tiddlerFields.text = text.substr(commaPos+1); - callback([tiddlerFields]); + text = text.substr(commaPos + 1); } + } + // Check whether this is an encrypted TiddlyWiki file + var encryptedJson = $tw.utils.extractEncryptedStoreArea(text); + if(encryptedJson) { + // If so, attempt to decrypt it with the current password + $tw.utils.decryptStoreAreaInteractive(encryptedJson,function(tiddlers) { + callback(tiddlers); + }); } else { - // Check whether this is an encrypted TiddlyWiki file - var encryptedJson = $tw.utils.extractEncryptedStoreArea(text); - if(encryptedJson) { - // If so, attempt to decrypt it with the current password - $tw.utils.decryptStoreAreaInteractive(encryptedJson,function(tiddlers) { - callback(tiddlers); - }); - } else { - // Otherwise, just try to deserialise any tiddlers in the file - callback(self.deserializeTiddlers(type,text,tiddlerFields)); - } + // Otherwise, just try to deserialise any tiddlers in the file + callback(self.deserializeTiddlers(type,text,tiddlerFields)); } }; // Kick off the read @@ -1164,7 +1183,9 @@ exports.findDraft = function(targetTitle) { } /* -Check whether the specified draft tiddler has been modified +Check whether the specified draft tiddler has been modified. +If the original tiddler doesn't exist, create a vanilla tiddler variable, +to check if additional fields have been added. */ exports.isDraftModified = function(title) { var tiddler = this.getTiddler(title); @@ -1172,11 +1193,9 @@ exports.isDraftModified = function(title) { return false; } var ignoredFields = ["created", "modified", "title", "draft.title", "draft.of"], - origTiddler = this.getTiddler(tiddler.fields["draft.of"]); - if(!origTiddler) { - return tiddler.fields.text !== ""; - } - return tiddler.fields["draft.title"] !== tiddler.fields["draft.of"] || !tiddler.isEqual(origTiddler,ignoredFields); + origTiddler = this.getTiddler(tiddler.fields["draft.of"]) || new $tw.Tiddler({text:"", tags:[]}), + titleModified = tiddler.fields["draft.title"] !== tiddler.fields["draft.of"]; + return titleModified || !tiddler.isEqual(origTiddler,ignoredFields); }; /* @@ -1218,3 +1237,4 @@ exports.invokeUpgraders = function(titles,tiddlers) { }; })(); + diff --git a/core/templates/raw-static-tiddler.tid b/core/templates/raw-static-tiddler.tid new file mode 100644 index 000000000..0531a391c --- /dev/null +++ b/core/templates/raw-static-tiddler.tid @@ -0,0 +1,7 @@ +title: $:/core/templates/raw-static-tiddler + +<!-- + +This template is used for saving tiddlers as static HTML + +--><$view field="text" format="plainwikified" /> \ No newline at end of file diff --git a/core/templates/static.area.tid b/core/templates/static.area.tid index a7fbdf7bc..d235ab4ed 100644 --- a/core/templates/static.area.tid +++ b/core/templates/static.area.tid @@ -1,6 +1,7 @@ title: $:/core/templates/static.area <$reveal type="nomatch" state="$:/isEncrypted" text="yes"> +{{{ [all[shadows+tiddlers]tag[$:/tags/RawStaticContent]!has[draft.of]] ||$:/core/templates/raw-static-tiddler}}} {{$:/core/templates/static.content||$:/core/templates/html-tiddler}} </$reveal> <$reveal type="match" state="$:/isEncrypted" text="yes"> diff --git a/core/templates/static.template.html.tid b/core/templates/static.template.html.tid index 27a2e324d..5da5fb752 100644 --- a/core/templates/static.template.html.tid +++ b/core/templates/static.template.html.tid @@ -15,6 +15,7 @@ type: text/vnd.tiddlywiki-html <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <meta name="apple-mobile-web-app-capable" content="yes" /> <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" /> +<meta name="mobile-web-app-capable" content="yes"/> <meta name="format-detection" content="telephone=no"> <link id="faviconLink" rel="shortcut icon" href="favicon.ico"> <title>{{$:/core/wiki/title}} diff --git a/core/templates/static.tiddler.html.tid b/core/templates/static.tiddler.html.tid index bcc008660..6fb56b6cd 100644 --- a/core/templates/static.tiddler.html.tid +++ b/core/templates/static.tiddler.html.tid @@ -13,6 +13,7 @@ title: $:/core/templates/static.tiddler.html + diff --git a/core/templates/tiddlywiki5.html.tid b/core/templates/tiddlywiki5.html.tid index 3f8701f18..160d5040b 100644 --- a/core/templates/tiddlywiki5.html.tid +++ b/core/templates/tiddlywiki5.html.tid @@ -12,6 +12,7 @@ title: $:/core/templates/tiddlywiki5.html + diff --git a/core/ui/AboveStory/tw2-plugin-check.tid b/core/ui/AboveStory/tw2-plugin-check.tid index cce2deb9c..6c3687ad2 100644 --- a/core/ui/AboveStory/tw2-plugin-check.tid +++ b/core/ui/AboveStory/tw2-plugin-check.tid @@ -10,7 +10,7 @@ tags: $:/tags/AboveStory
    -<$list filter="[all[system+tiddlers]tag[systemConfig]limit[1]]"> +<$list filter="[all[system+tiddlers]tag[systemConfig]]">
  • diff --git a/core/ui/AdvancedSearch/Filter.tid b/core/ui/AdvancedSearch/Filter.tid index 93179bbaa..f6f13a863 100644 --- a/core/ui/AdvancedSearch/Filter.tid +++ b/core/ui/AdvancedSearch/Filter.tid @@ -3,35 +3,13 @@ tags: $:/tags/AdvancedSearch caption: {{$:/language/Search/Filter/Caption}} \define lingo-base() $:/language/Search/ -<$linkcatcher to="$:/temp/advancedsearch"> - <> -
    -<$reveal state=<> type="nomatch" text="" default=""> -
    -<$list filter="[all[shadows+tiddlers]tag[$:/tags/Filter]]"><$link to={{!!filter}}><$transclude field="description"/> - -
    - -
    - - - <$reveal state="$:/temp/advancedsearch" type="nomatch" text=""> <$set name="resultCount" value="""<$count filter={{$:/temp/advancedsearch}}/>""">
    diff --git a/core/ui/AdvancedSearch/FilterButtons/clear.tid b/core/ui/AdvancedSearch/FilterButtons/clear.tid new file mode 100644 index 000000000..3dd22e03d --- /dev/null +++ b/core/ui/AdvancedSearch/FilterButtons/clear.tid @@ -0,0 +1,9 @@ +title: $:/core/ui/AdvancedSearch/Filter/FilterButtons/clear +tags: $:/tags/AdvancedSearch/FilterButton + +<$reveal state="$:/temp/advancedsearch" type="nomatch" text=""> +<$button class="tc-btn-invisible"> +<$action-setfield $tiddler="$:/temp/advancedsearch" $field="text" $value=""/> +{{$:/core/images/close-button}} + + diff --git a/core/ui/AdvancedSearch/FilterButtons/delete.tid b/core/ui/AdvancedSearch/FilterButtons/delete.tid new file mode 100644 index 000000000..fea48a667 --- /dev/null +++ b/core/ui/AdvancedSearch/FilterButtons/delete.tid @@ -0,0 +1,26 @@ +title: $:/core/ui/AdvancedSearch/Filter/FilterButtons/delete +tags: $:/tags/AdvancedSearch/FilterButton + +<$reveal state="$:/temp/advancedsearch" type="nomatch" text=""> +<$button popup=<> class="tc-btn-invisible"> +{{$:/core/images/delete-button}} + + + +<$reveal state=<> type="popup" position="belowleft" animate="yes"> +
    +
    +
    +<$set name="resultCount" value="""<$count filter={{$:/temp/advancedsearch}}/>"""> +Are you sure you wish to delete <> tiddler(s)? + +
    +
    +<$button class="tc-btn"> +<$action-deletetiddler $filter={{$:/temp/advancedsearch}}/> +Delete these tiddlers + +
    +
    +
    + diff --git a/core/ui/AdvancedSearch/FilterButtons/dropdown.tid b/core/ui/AdvancedSearch/FilterButtons/dropdown.tid new file mode 100644 index 000000000..ee1c5eb37 --- /dev/null +++ b/core/ui/AdvancedSearch/FilterButtons/dropdown.tid @@ -0,0 +1,19 @@ +title: $:/core/ui/AdvancedSearch/Filter/FilterButtons/dropdown +tags: $:/tags/AdvancedSearch/FilterButton + + +<$button popup=<> class="tc-btn-invisible"> +{{$:/core/images/down-arrow}} + + + +<$reveal state=<> type="popup" position="belowleft" animate="yes"> +<$linkcatcher to="$:/temp/advancedsearch"> +
    +
    +<$list filter="[all[shadows+tiddlers]tag[$:/tags/Filter]]"><$link to={{!!filter}}><$transclude field="description"/> + +
    +
    + + diff --git a/core/ui/AdvancedSearch/FilterButtons/export.tid b/core/ui/AdvancedSearch/FilterButtons/export.tid new file mode 100644 index 000000000..ec9ea91ac --- /dev/null +++ b/core/ui/AdvancedSearch/FilterButtons/export.tid @@ -0,0 +1,6 @@ +title: $:/core/ui/AdvancedSearch/Filter/FilterButtons/export +tags: $:/tags/AdvancedSearch/FilterButton + +<$reveal state="$:/temp/advancedsearch" type="nomatch" text=""> +<$macrocall $name="exportButton" exportFilter={{$:/temp/advancedsearch}} lingoBase="$:/language/Buttons/ExportTiddlers/"/> + diff --git a/core/ui/AdvancedSearch/Shadows.tid b/core/ui/AdvancedSearch/Shadows.tid index cd4a6cd38..b2455bfbb 100644 --- a/core/ui/AdvancedSearch/Shadows.tid +++ b/core/ui/AdvancedSearch/Shadows.tid @@ -21,6 +21,8 @@ caption: {{$:/language/Search/Shadows/Caption}} <$reveal state="$:/temp/advancedsearch" type="nomatch" text=""> +<$list filter="[{$:/temp/advancedsearch}minlength{$:/config/Search/MinLength}limit[1]]" emptyMessage="""
    {{$:/language/Search/Search/TooShort}}
    """ variable="listItem"> + <$set name="resultCount" value="""<$count filter="[all[shadows]search{$:/temp/advancedsearch}] -[[$:/temp/advancedsearch]]"/>""">
    @@ -33,6 +35,8 @@ caption: {{$:/language/Search/Shadows/Caption}} + + <$reveal state="$:/temp/advancedsearch" type="match" text=""> diff --git a/core/ui/AdvancedSearch/Standard.tid b/core/ui/AdvancedSearch/Standard.tid index 174e6b24a..2342cb5b7 100644 --- a/core/ui/AdvancedSearch/Standard.tid +++ b/core/ui/AdvancedSearch/Standard.tid @@ -20,6 +20,7 @@ caption: {{$:/language/Search/Standard/Caption}} <$reveal state="$:/temp/advancedsearch" type="nomatch" text=""> +<$list filter="[{$:/temp/advancedsearch}minlength{$:/config/Search/MinLength}limit[1]]" emptyMessage="""
    {{$:/language/Search/Search/TooShort}}
    """ variable="listItem"> <$set name="searchTiddler" value="$:/temp/advancedsearch"> <$list filter="[all[shadows+tiddlers]tag[$:/tags/SearchResults]!has[draft.of]butfirst[]limit[1]]" emptyMessage=""" <$list filter="[all[shadows+tiddlers]tag[$:/tags/SearchResults]!has[draft.of]]"> @@ -29,4 +30,5 @@ caption: {{$:/language/Search/Standard/Caption}} <$macrocall $name="tabs" tabsList="[all[shadows+tiddlers]tag[$:/tags/SearchResults]!has[draft.of]]" default={{$:/config/SearchResults/Default}}/> + diff --git a/core/ui/AdvancedSearch/System.tid b/core/ui/AdvancedSearch/System.tid index 19cdfa86e..6de9d0786 100644 --- a/core/ui/AdvancedSearch/System.tid +++ b/core/ui/AdvancedSearch/System.tid @@ -21,6 +21,8 @@ caption: {{$:/language/Search/System/Caption}} <$reveal state="$:/temp/advancedsearch" type="nomatch" text=""> +<$list filter="[{$:/temp/advancedsearch}minlength{$:/config/Search/MinLength}limit[1]]" emptyMessage="""
    {{$:/language/Search/Search/TooShort}}
    """ variable="listItem"> + <$set name="resultCount" value="""<$count filter="[is[system]search{$:/temp/advancedsearch}] -[[$:/temp/advancedsearch]]"/>""">
    @@ -33,6 +35,8 @@ caption: {{$:/language/Search/System/Caption}} + + <$reveal state="$:/temp/advancedsearch" type="match" text=""> diff --git a/core/ui/AlertTemplate.tid b/core/ui/AlertTemplate.tid index 87ddbd376..bcfc3c3fa 100644 --- a/core/ui/AlertTemplate.tid +++ b/core/ui/AlertTemplate.tid @@ -5,7 +5,7 @@ title: $:/core/ui/AlertTemplate <$button class="tc-btn-invisible"><$action-deletetiddler $tiddler=<>/>{{$:/core/images/delete-button}}
    -<$view field="component"/> - <$view field="modified" format="date" template="0hh:0mm:0ss DD MM YYYY"/> <$reveal type="nomatch" state="!!count" text="">(count: <$view field="count"/>) +<$view field="component"/> - <$view field="modified" format="date" template="0hh:0mm:0ss DD MM YYYY"/> <$reveal type="nomatch" state="!!count" text="">({{$:/language/Count}}: <$view field="count"/>)
    diff --git a/core/ui/Components/plugin-info.tid b/core/ui/Components/plugin-info.tid new file mode 100644 index 000000000..a5fbf141a --- /dev/null +++ b/core/ui/Components/plugin-info.tid @@ -0,0 +1,95 @@ +title: $:/core/ui/Components/plugin-info + +\define lingo-base() $:/language/ControlPanel/Plugins/ + +\define popup-state-macro() +$(qualified-state)$-$(currentTiddler)$ +\end + +\define tabs-state-macro() +$(popup-state)$-$(pluginInfoType)$ +\end + +\define plugin-icon-title() +$(currentTiddler)$/icon +\end + +\define plugin-disable-title() +$:/config/Plugins/Disabled/$(currentTiddler)$ +\end + +\define plugin-table-body(type,disabledMessage,default-popup-state) +
    +<$reveal type="nomatch" state=<> text="yes" default="""$default-popup-state$"""> +<$button class="tc-btn-invisible tc-btn-dropdown" set=<> setTo="yes"> +{{$:/core/images/right-arrow}} + + +<$reveal type="match" state=<> text="yes" default="""$default-popup-state$"""> +<$button class="tc-btn-invisible tc-btn-dropdown" set=<> setTo="no"> +{{$:/core/images/down-arrow}} + + +
    +
    +<$transclude tiddler=<> subtiddler=<>> +<$transclude tiddler="$:/core/images/plugin-generic-$type$"/> + +
    +
    +

    +''<$view field="description"><$view field="title"/>'' $disabledMessage$ +

    +

    +<$view field="title"/> +

    +

    +
    <$view field="version"/>
    +

    +
    +\end + +\define plugin-info(type,default-popup-state) +<$set name="popup-state" value=<>> +<$reveal type="nomatch" state=<> text="yes"> +<$link to={{!!title}} class="tc-plugin-info"> +<> + + +<$reveal type="match" state=<> text="yes"> +<$link to={{!!title}} class="tc-plugin-info tc-plugin-info-disabled"> +<">> + + +<$reveal type="match" text="yes" state=<> default="""$default-popup-state$"""> +
    +
    +<$list filter="[all[current]] -[[$:/core]]"> +
    +<$reveal type="nomatch" state=<> text="yes"> +<$button set=<> setTo="yes" tooltip={{$:/language/ControlPanel/Plugins/Disable/Hint}} aria-label={{$:/language/ControlPanel/Plugins/Disable/Caption}}> +<> + + +<$reveal type="match" state=<> text="yes"> +<$button set=<> setTo="no" tooltip={{$:/language/ControlPanel/Plugins/Enable/Hint}} aria-label={{$:/language/ControlPanel/Plugins/Enable/Caption}}> +<> + + +
    + +<$reveal type="nomatch" text="" state="!!list"> +<$set name="tabsList" filter="[list[]] contents"> +<$macrocall $name="tabs" state=<> tabsList=<> default="readme" template="$:/core/ui/PluginInfo"/> + + +<$reveal type="match" text="" state="!!list"> +<> + +
    +
    + + +\end + +<$macrocall $name="plugin-info" type=<> default-popup-state=<>/> diff --git a/core/ui/ControlPanel/Basics.tid b/core/ui/ControlPanel/Basics.tid index 714954a35..52ff077c3 100644 --- a/core/ui/ControlPanel/Basics.tid +++ b/core/ui/ControlPanel/Basics.tid @@ -19,7 +19,7 @@ caption: {{$:/language/ControlPanel/Basics/Caption}} |<$link to="$:/SiteSubtitle"><> |<$edit-text tiddler="$:/SiteSubtitle" default="" tag="input"/> | |<$link to="$:/status/UserName"><> |<$edit-text tiddler="$:/status/UserName" default="" tag="input"/> | |<$link to="$:/config/AnimationDuration"><> |<$edit-text tiddler="$:/config/AnimationDuration" default="" tag="input"/> | -|<$link to="$:/DefaultTiddlers"><> |<>
    <$edit-text tag="textarea" tiddler="$:/DefaultTiddlers"/>
    //<>// | +|<$link to="$:/DefaultTiddlers"><> |<>
    <$edit tag="textarea" tiddler="$:/DefaultTiddlers" class="tc-edit-texteditor"/>
    //<>// | |<$link to="$:/config/NewJournal/Title"><> |<$edit-text tiddler="$:/config/NewJournal/Title" default="" tag="input"/> | |<$link to="$:/config/NewJournal/Tags"><> |<$edit-text tiddler="$:/config/NewJournal/Tags" default="" tag="input"/> | |<> |{{$:/snippets/minilanguageswitcher}} | diff --git a/core/ui/ControlPanel/KeyboardShortcuts.tid b/core/ui/ControlPanel/KeyboardShortcuts.tid new file mode 100644 index 000000000..64301a4ac --- /dev/null +++ b/core/ui/ControlPanel/KeyboardShortcuts.tid @@ -0,0 +1,140 @@ +title: $:/core/ui/ControlPanel/KeyboardShortcuts +tags: $:/tags/ControlPanel +caption: {{$:/language/ControlPanel/KeyboardShortcuts/Caption}} + +\define lingo-base() $:/language/ControlPanel/KeyboardShortcuts/ + +\define new-shortcut(title) +
    +<$edit-shortcut tiddler="$title$" placeholder={{$:/language/ControlPanel/KeyboardShortcuts/Add/Prompt}} style="width:auto;"/> <$button> +<> +<$action-listops + $tiddler="$(shortcutTitle)$" + $field="text" + $subfilter="[{$title$}]" +/> +<$action-deletetiddler + $tiddler="$title$" +/> + +
    +\end + +\define shortcut-list-item(caption) + + + +<> + + +
    +<$button popup=<> class="tc-btn-invisible"> +{{$:/core/images/edit-button}} + +<$macrocall $name="displayshortcuts" $output="text/html" shortcuts={{$(shortcutTitle)$}} prefix="" separator=" " suffix=""/> + +<$reveal state=<> type="popup" position="below" animate="yes"> +
    +
    +<$list filter="[list[$(shortcutTitle)$!!text]sort[title]]" variable="shortcut" emptyMessage=""" +
    +//<>// +
    +"""> +
    +<$button class="tc-btn-invisible" tooltip=<>> +<$action-listops + $tiddler="$(shortcutTitle)$" + $field="text" + $subfilter="+[remove]" +/> +× + + +<$macrocall $name="displayshortcuts" $output="text/html" shortcuts=<>/> + +
    + +
    +<$macrocall $name="new-shortcut" title=<>/> +
    +
    + +
    + +\end + +\define shortcut-list(caption,prefix) + +<$list filter="[all[tiddlers+shadows][$prefix$$(shortcutName)$]]" variable="shortcutTitle"> +<> + + +\end + +\define shortcut-editor() +<> +<> +<> +<> +<> +<> +<> +\end + +\define shortcut-preview() +<$macrocall $name="displayshortcuts" $output="text/html" shortcuts={{$(shortcutPrefix)$$(shortcutName)$}} prefix="" separator=" " suffix=""/> +\end + +\define shortcut-item-inner() + + +<$reveal type="nomatch" state=<> text="open"> +<$button class="tc-btn-invisible"> +<$action-setfield + $tiddler=<> + $value="open" +/> +{{$:/core/images/right-arrow}} + + +<$reveal type="match" state=<> text="open"> +<$button class="tc-btn-invisible"> +<$action-setfield + $tiddler=<> + $value="close" +/> +{{$:/core/images/down-arrow}} + + +''<$text text=<>/>'' + + +<$transclude tiddler="$:/config/ShortcutInfo/$(shortcutName)$"/> + + +<$list filter="$:/config/shortcuts/ $:/config/shortcuts-mac/ $:/config/shortcuts-not-mac/ $:/config/shortcuts-linux/ $:/config/shortcuts-not-linux/ $:/config/shortcuts-windows/ $:/config/shortcuts-not-windows/" variable="shortcutPrefix"> +<> + + + +<$set name="dropdownState" value={{$(dropdownStateTitle)$}}> +<$list filter="[prefix[open]]" variable="listItem"> +<> + + +\end + +\define shortcut-item() +<$set name="dropdownStateTitle" value=<>> +<> + +\end + + + +<$list filter="[all[shadows+tiddlers]removeprefix[$:/config/ShortcutInfo/]]" variable="shortcutName"> +<> + + +
    diff --git a/core/ui/ControlPanel/Modals/AddPlugins.tid b/core/ui/ControlPanel/Modals/AddPlugins.tid index d05c41767..76305e4ed 100644 --- a/core/ui/ControlPanel/Modals/AddPlugins.tid +++ b/core/ui/ControlPanel/Modals/AddPlugins.tid @@ -1,13 +1,11 @@ title: $:/core/ui/ControlPanel/Modals/AddPlugins subtitle: {{$:/core/images/download-button}} {{$:/language/ControlPanel/Plugins/Add/Caption}} -\define lingo-base() $:/language/ControlPanel/Plugins/ - \define install-plugin-button() <$button> <$action-sendmessage $message="tm-load-plugin-from-library" url={{!!url}} title={{$(assetInfo)$!!original-title}}/> -<$list filter="[get[original-title]get[version]]" variable="installedVersion" emptyMessage="""{{$:/language/ControlPanel/Plugins/Install}}"""> -{{$:/language/ControlPanel/Plugins/Reinstall}} +<$list filter="[get[original-title]get[version]]" variable="installedVersion" emptyMessage="""{{$:/language/ControlPanel/Plugins/Install/Caption}}"""> +{{$:/language/ControlPanel/Plugins/Reinstall/Caption}} \end @@ -48,9 +46,9 @@ $:/state/add-plugin-info/$(connectionTiddler)$/$(assetInfo)$ <$reveal type="match" text="yes" state=<>>
    -<$list filter="[get[original-title]get[version]]" variable="installedVersion" emptyMessage="""This plugin is not currently installed"""> +<$list filter="[get[original-title]get[version]]" variable="installedVersion" emptyMessage="""{{$:/language/ControlPanel/Plugins/NotInstalled/Hint}}"""> -This plugin is already installed at version <$text text=<>/> +{{$:/language/ControlPanel/Plugins/AlreadyInstalled/Hint}}
    diff --git a/core/ui/ControlPanel/Parsing.tid b/core/ui/ControlPanel/Parsing.tid index de027f9c3..4ba0f0ae1 100644 --- a/core/ui/ControlPanel/Parsing.tid +++ b/core/ui/ControlPanel/Parsing.tid @@ -4,30 +4,30 @@ caption: {{$:/language/ControlPanel/Parsing/Caption}} \define lingo-base() $:/language/ControlPanel/Parsing/ -\define parsing-inner(typeCap) -
  • -<$checkbox tiddler="""$:/config/WikiParserRules/$typeCap$/$(currentTiddler)$""" field="text" checked="enable" unchecked="disable" default="enable"> ''<$text text=<>/>'': -
  • +\define toggle(Type) +<$checkbox +tiddler="""$:/config/WikiParserRules/$Type$/$(rule)$""" +field="text" +checked="enable" +unchecked="disable" +default="enable"> +<> + \end -\define parsing-outer(typeLower,typeCap) -
      -<$list filter="[wikiparserrules[$typeLower$]]"> -<> +\define rules(type,Type) +<$list filter="[wikiparserrules[$type$]]" variable="rule"> +
      <>
      -
    \end <> -! <> - -<> - -! <> - -<> - -! <> - -<> +
    +
    <>
    +<> +
    <>
    +<> +
    <>
    +<> +
    \ No newline at end of file diff --git a/core/ui/ControlPanel/Plugins.tid b/core/ui/ControlPanel/Plugins.tid index d91dead26..49ff58e5e 100644 --- a/core/ui/ControlPanel/Plugins.tid +++ b/core/ui/ControlPanel/Plugins.tid @@ -4,95 +4,11 @@ caption: {{$:/language/ControlPanel/Plugins/Caption}} \define lingo-base() $:/language/ControlPanel/Plugins/ -\define popup-state-macro() -$(qualified-state)$-$(currentTiddler)$ -\end - -\define tabs-state-macro() -$(popup-state)$-$(pluginInfoType)$ -\end - -\define plugin-icon-title() -$(currentTiddler)$/icon -\end - -\define plugin-disable-title() -$:/config/Plugins/Disabled/$(currentTiddler)$ -\end - -\define plugin-table-body(type,disabledMessage) -
    -<$reveal type="nomatch" state=<> text="yes"> -<$button class="tc-btn-invisible tc-btn-dropdown" set=<> setTo="yes"> -{{$:/core/images/right-arrow}} - - -<$reveal type="match" state=<> text="yes"> -<$button class="tc-btn-invisible tc-btn-dropdown" set=<> setTo="no"> -{{$:/core/images/down-arrow}} - - -
    -
    -<$transclude tiddler=<> subtiddler=<>> -<$transclude tiddler="$:/core/images/plugin-generic-$type$"/> - -
    -
    -

    -''<$view field="description"><$view field="title"/>'' $disabledMessage$ -

    -

    -<$view field="title"/> -

    -

    -
    <$view field="version"/>
    -

    -
    -\end - \define plugin-table(type) +<$set name="plugin-type" value="""$type$"""> <$set name="qualified-state" value=<>> -<$list filter="[!has[draft.of]plugin-type[$type$]sort[description]]" emptyMessage=<>> -<$set name="popup-state" value=<>> -<$reveal type="nomatch" state=<> text="yes"> -<$link to={{!!title}} class="tc-plugin-info"> -<> - - -<$reveal type="match" state=<> text="yes"> -<$link to={{!!title}} class="tc-plugin-info tc-plugin-info-disabled"> -<">> - - -<$reveal type="match" text="yes" state=<>> -
    -
    -<$list filter="[all[current]] -[[$:/core]]"> -
    -<$reveal type="nomatch" state=<> text="yes"> -<$button set=<> setTo="yes" tooltip={{$:/language/ControlPanel/Plugins/Disable/Hint}} aria-label={{$:/language/ControlPanel/Plugins/Disable/Caption}}> -<> - - -<$reveal type="match" state=<> text="yes"> -<$button set=<> setTo="no" tooltip={{$:/language/ControlPanel/Plugins/Enable/Hint}} aria-label={{$:/language/ControlPanel/Plugins/Enable/Caption}}> -<> - - -
    - -<$reveal type="nomatch" text="" state="!!list"> -<$macrocall $name="tabs" state=<> tabsList={{!!list}} default="readme" template="$:/core/ui/PluginInfo"/> - -<$reveal type="match" text="" state="!!list"> -No information provided - -
    -
    - +<$list filter="[!has[draft.of]plugin-type[$type$]sort[description]]" emptyMessage=<> template="$:/core/ui/Components/plugin-info"/> - \end diff --git a/core/ui/ControlPanel/Settings/EditorToolbar.tid b/core/ui/ControlPanel/Settings/EditorToolbar.tid new file mode 100644 index 000000000..aa142bf62 --- /dev/null +++ b/core/ui/ControlPanel/Settings/EditorToolbar.tid @@ -0,0 +1,9 @@ +title: $:/core/ui/ControlPanel/Settings/EditorToolbar +tags: $:/tags/ControlPanel/Settings +caption: {{$:/language/ControlPanel/Settings/EditorToolbar/Caption}} + +\define lingo-base() $:/language/ControlPanel/Settings/EditorToolbar/ +<> + +<$checkbox tiddler="$:/config/TextEditor/EnableToolbar" field="text" checked="yes" unchecked="no" default="yes"> <$link to="$:/config/TextEditor/EnableToolbar"><> + diff --git a/core/ui/ControlPanel/Settings/MissingLinks.tid b/core/ui/ControlPanel/Settings/MissingLinks.tid new file mode 100644 index 000000000..4a7ba5f2e --- /dev/null +++ b/core/ui/ControlPanel/Settings/MissingLinks.tid @@ -0,0 +1,9 @@ +title: $:/core/ui/ControlPanel/Settings/MissingLinks +tags: $:/tags/ControlPanel/Settings +caption: {{$:/language/ControlPanel/Settings/MissingLinks/Caption}} + +\define lingo-base() $:/language/ControlPanel/Settings/MissingLinks/ +<> + +<$checkbox tiddler="$:/config/MissingLinks" field="text" checked="yes" unchecked="no" default="yes"> <$link to="$:/config/MissingLinks"><> + diff --git a/core/ui/ControlPanel/Toolbars/EditorToolbar.tid b/core/ui/ControlPanel/Toolbars/EditorToolbar.tid new file mode 100644 index 000000000..ce700fa98 --- /dev/null +++ b/core/ui/ControlPanel/Toolbars/EditorToolbar.tid @@ -0,0 +1,21 @@ +title: $:/core/ui/ControlPanel/Toolbars/EditorToolbar +tags: $:/tags/ControlPanel/Toolbars +caption: {{$:/language/ControlPanel/Toolbars/EditorToolbar/Caption}} + +\define lingo-base() $:/language/TiddlerInfo/ + +\define config-title() +$:/config/EditorToolbarButtons/Visibility/$(listItem)$ +\end + +\define toolbar-button() +<$checkbox tiddler=<> field="text" checked="show" unchecked="hide" default="show"> <$transclude tiddler={{$(listItem)$!!icon}}/> <$transclude tiddler=<> field="caption"/> -- <$transclude tiddler=<> field="description"/> +\end + +{{$:/language/ControlPanel/Toolbars/EditorToolbar/Hint}} + +<$list filter="[all[shadows+tiddlers]tag[$:/tags/EditorToolbar]!has[draft.of]]" variable="listItem"> + +<> + + diff --git a/core/ui/EditTemplate.tid b/core/ui/EditTemplate.tid index 10c364681..184172214 100644 --- a/core/ui/EditTemplate.tid +++ b/core/ui/EditTemplate.tid @@ -1,16 +1,26 @@ title: $:/core/ui/EditTemplate +\define actions() +<$action-sendmessage $message="tm-add-tag" $param={{$:/temp/NewTagName}}/> +<$action-deletetiddler $tiddler="$:/temp/NewTagName"/> +<$action-sendmessage $message="tm-add-field" $name={{$:/temp/newfieldname}} $value={{$:/temp/newfieldvalue}}/> +<$action-deletetiddler $tiddler="$:/temp/newfieldname"/> +<$action-deletetiddler $tiddler="$:/temp/newfieldvalue"/> +<$action-sendmessage $message="tm-save-tiddler"/> +\end \define frame-classes() tc-tiddler-frame tc-tiddler-edit-frame $(missingTiddlerClass)$ $(shadowTiddlerClass)$ $(systemTiddlerClass)$ \end
    >> +<$fieldmangler> <$set name="storyTiddler" value=<>> -<$keyboard key={{$:/config/shortcuts/cancel-edit-tiddler}} message="tm-cancel-tiddler"> -<$keyboard key={{$:/config/shortcuts/save-tiddler}} message="tm-save-tiddler"> +<$keyboard key="((cancel-edit-tiddler))" message="tm-cancel-tiddler"> +<$keyboard key="((save-tiddler))" actions=<>> <$list filter="[all[shadows+tiddlers]tag[$:/tags/EditTemplate]!has[draft.of]]" variable="listItem"> <$transclude tiddler=<>/> +
    diff --git a/core/ui/EditTemplate/Preview/output.tid b/core/ui/EditTemplate/Preview/output.tid new file mode 100644 index 000000000..fa330b8c0 --- /dev/null +++ b/core/ui/EditTemplate/Preview/output.tid @@ -0,0 +1,9 @@ +title: $:/core/ui/EditTemplate/body/preview/output +tags: $:/tags/EditPreview +caption: {{$:/language/EditTemplate/Body/Preview/Type/Output}} + +<$set name="tv-tiddler-preview" value="yes"> + +<$transclude /> + + diff --git a/core/ui/EditTemplate/body-editor.tid b/core/ui/EditTemplate/body-editor.tid new file mode 100644 index 000000000..3de3beec9 --- /dev/null +++ b/core/ui/EditTemplate/body-editor.tid @@ -0,0 +1,30 @@ +title: $:/core/ui/EditTemplate/body/editor + +<$edit + + field="text" + class="tc-edit-texteditor" + placeholder={{$:/language/EditTemplate/Body/Placeholder}} + +><$set + + name="targetTiddler" + value=<> + +><$list + + filter="[all[shadows+tiddlers]tag[$:/tags/EditorToolbar]!has[draft.of]]" + +><$reveal + + type="nomatch" + state=<> + text="hide" + class="tc-text-editor-toolbar-item-wrapper" + +><$transclude + + tiddler="$:/core/ui/EditTemplate/body/toolbar/button" + mode="inline" + +/> diff --git a/core/ui/EditTemplate/body-toolbar-button.tid b/core/ui/EditTemplate/body-toolbar-button.tid new file mode 100644 index 000000000..4b273c2f0 --- /dev/null +++ b/core/ui/EditTemplate/body-toolbar-button.tid @@ -0,0 +1,107 @@ +title: $:/core/ui/EditTemplate/body/toolbar/button + +\define toolbar-button-icon() +<$list + + filter="[all[current]!has[custom-icon]]" + variable="no-custom-icon" + +><$transclude + + tiddler={{!!icon}} + +/> +\end + +\define toolbar-button-tooltip() +{{!!description}}<$macrocall $name="displayshortcuts" $output="text/plain" shortcuts={{!!shortcuts}} prefix="` - [" separator="] [" suffix="]`"/> +\end + +\define toolbar-button() +<$list + + filter={{!!condition}} + variable="list-condition" + +><$wikify + + name="tooltip-text" + text=<> + mode="inline" + output="text" + +><$list + + filter="[all[current]!has[dropdown]]" + variable="no-dropdown" + +><$button + + class="tc-btn-invisible $(buttonClasses)$" + tooltip=<> + +><><$transclude + + tiddler=<> + field="text" + +/><$list + + filter="[all[current]has[dropdown]]" + variable="dropdown" + +><$set + + name="dropdown-state" + value=<> + +><$button + + popup=<> + class="tc-popup-keep tc-btn-invisible $(buttonClasses)$" + selectedClass="tc-selected" + tooltip=<> + +><><$transclude + + tiddler=<> + field="text" + +/><$reveal + + state=<> + type="popup" + position="below" + animate="yes" + tag="span" + +>
    <$transclude + + tiddler={{!!dropdown}} + mode="block" + +/>
    +\end + +\define toolbar-button-outer() +<$set + + name="buttonClasses" + value={{!!button-classes}} + +><> +\end + +<> \ No newline at end of file diff --git a/core/ui/EditTemplate/body.tid b/core/ui/EditTemplate/body.tid index 24932c16e..f6cb3469e 100644 --- a/core/ui/EditTemplate/body.tid +++ b/core/ui/EditTemplate/body.tid @@ -2,6 +2,9 @@ title: $:/core/ui/EditTemplate/body tags: $:/tags/EditTemplate \define lingo-base() $:/language/EditTemplate/Body/ +\define config-visibility-title() +$:/config/EditorToolbarButtons/Visibility/$(currentTiddler)$ +\end <$list filter="[is[current]has[_canonical_uri]]">
    @@ -20,19 +23,17 @@ tags: $:/tags/EditTemplate <$reveal state="$:/state/showeditpreview" type="match" text="yes"> -<> <$button type="set" set="$:/state/showeditpreview" setTo="no"><> -
    + +<$transclude tiddler="$:/core/ui/EditTemplate/body/editor" mode="inline"/> +
    -<$set name="tv-tiddler-preview" value="yes"> -<$transclude /> +<$transclude tiddler={{$:/state/editpreviewtype}} mode="inline"> - -
    +<$transclude tiddler="$:/core/ui/EditTemplate/body/preview/output" mode="inline"/> -
    -<$edit field="text" class="tc-edit-texteditor" placeholder={{$:/language/EditTemplate/Body/Placeholder}}/> +
    @@ -42,8 +43,7 @@ tags: $:/tags/EditTemplate <$reveal state="$:/state/showeditpreview" type="nomatch" text="yes"> -<> <$button type="set" set="$:/state/showeditpreview" setTo="yes"><> -<$edit field="text" class="tc-edit-texteditor" placeholder={{$:/language/EditTemplate/Body/Placeholder}}/> +<$transclude tiddler="$:/core/ui/EditTemplate/body/editor" mode="inline"/> diff --git a/core/ui/EditTemplate/fields.tid b/core/ui/EditTemplate/fields.tid index fbd02e9ce..86de3a37d 100644 --- a/core/ui/EditTemplate/fields.tid +++ b/core/ui/EditTemplate/fields.tid @@ -73,7 +73,7 @@ $:/config/EditTemplateFields/Visibility/$(currentField)$
    <>
    -<$list filter="[!is[shadow]!is[system]fields[]sort[]] -created -creator -draft.of -draft.title -modified -modifier -tags -text -title -type" variable="currentField"> +<$list filter="[!is[shadow]!is[system]fields[]search:title{$:/temp/newfieldname}sort[]] -created -creator -draft.of -draft.title -modified -modifier -tags -text -title -type" variable="currentField"> <$link to=<>> <> @@ -81,7 +81,7 @@ $:/config/EditTemplateFields/Visibility/$(currentField)$
    <>
    -<$list filter="[fields[]sort[]] -[!is[shadow]!is[system]fields[]]" variable="currentField"> +<$list filter="[fields[]search:title{$:/temp/newfieldname}sort[]] -[!is[shadow]!is[system]fields[]]" variable="currentField"> <$link to=<>> <> @@ -97,4 +97,3 @@ $:/config/EditTemplateFields/Visibility/$(currentField)$
    - diff --git a/core/ui/EditTemplate/tags.tid b/core/ui/EditTemplate/tags.tid index c9f65e4c5..e806fd90c 100644 --- a/core/ui/EditTemplate/tags.tid +++ b/core/ui/EditTemplate/tags.tid @@ -4,13 +4,24 @@ tags: $:/tags/EditTemplate \define lingo-base() $:/language/EditTemplate/ \define tag-styles() background-color:$(backgroundColor)$; +fill:$(foregroundColor)$; +color:$(foregroundColor)$; +\end +\define tag-body-inner(colour,fallbackTarget,colourA,colourB) +<$vars foregroundColor=<> backgroundColor="""$colour$"""> +> class="tc-tag-label"> +<$view field="title" format="text" /> +<$button message="tm-remove-tag" param={{!!title}} class="tc-btn-invisible tc-remove-tag-button">× + + +\end +\define tag-body(colour,palette) +<$macrocall $name="tag-body-inner" colour="""$colour$""" fallbackTarget={{$palette$##tag-background}} colourA={{$palette$##foreground}} colourB={{$palette$##background}}/> \end
    <$fieldmangler> -<$list filter="[all[current]tags[]sort[title]]" storyview="pop"><$set name="backgroundColor" value={{!!color}}>> class="tc-tag-label"> -<$view field="title" format="text" /> -<$button message="tm-remove-tag" param={{!!title}} class="tc-btn-invisible tc-remove-tag-button">× - +<$list filter="[all[current]tags[]sort[title]]" storyview="pop"> +<$macrocall $name="tag-body" colour={{!!color}} palette={{$:/palette}}/>
    diff --git a/core/ui/EditTemplate/title.tid b/core/ui/EditTemplate/title.tid index 829f91afe..0eda4218d 100644 --- a/core/ui/EditTemplate/title.tid +++ b/core/ui/EditTemplate/title.tid @@ -1,4 +1,18 @@ title: $:/core/ui/EditTemplate/title tags: $:/tags/EditTemplate -<$edit-text field="draft.title" class="tc-titlebar tc-edit-texteditor" focus="true"/> \ No newline at end of file +<$vars pattern="""[\|\[\]{}]""" bad-chars="""`| [ ] { }`"""> + +<$list filter="[is[current]regexp:draft.title]" variable="listItem"> + +
    + +{{$:/language/EditTemplate/Title/BadCharacterWarning}} + +
    + + + + + +<$edit-text field="draft.title" class="tc-titlebar tc-edit-texteditor" focus="true"/> diff --git a/core/ui/EditToolbar/save.tid b/core/ui/EditToolbar/save.tid index 18a7c446a..38dd224ea 100644 --- a/core/ui/EditToolbar/save.tid +++ b/core/ui/EditToolbar/save.tid @@ -3,8 +3,7 @@ tags: $:/tags/EditToolbar caption: {{$:/core/images/done-button}} {{$:/language/Buttons/Save/Caption}} description: {{$:/language/Buttons/Save/Hint}} -<$fieldmangler> -<$button tooltip={{$:/language/Buttons/Save/Hint}} aria-label={{$:/language/Buttons/Save/Caption}} class=<>> +<$fieldmangler><$button tooltip={{$:/language/Buttons/Save/Hint}} aria-label={{$:/language/Buttons/Save/Caption}} class=<>> <$action-sendmessage $message="tm-add-tag" $param={{$:/temp/NewTagName}}/> <$action-deletetiddler $tiddler="$:/temp/NewTagName"/> <$action-sendmessage $message="tm-add-field" $name={{$:/temp/newfieldname}} $value={{$:/temp/newfieldvalue}}/> diff --git a/core/ui/EditorToolbar/bold.tid b/core/ui/EditorToolbar/bold.tid new file mode 100644 index 000000000..ffe84de61 --- /dev/null +++ b/core/ui/EditorToolbar/bold.tid @@ -0,0 +1,14 @@ +title: $:/core/ui/EditorToolbar/bold +tags: $:/tags/EditorToolbar +icon: $:/core/images/bold +caption: {{$:/language/Buttons/Bold/Caption}} +description: {{$:/language/Buttons/Bold/Hint}} +condition: [!has[type]] [type[text/vnd.tiddlywiki]] +shortcuts: ((bold)) + +<$action-sendmessage + $message="tm-edit-text-operation" + $param="wrap-selection" + prefix="''" + suffix="''" +/> diff --git a/core/ui/EditorToolbar/clear-dropdown.tid b/core/ui/EditorToolbar/clear-dropdown.tid new file mode 100644 index 000000000..8876ecf2b --- /dev/null +++ b/core/ui/EditorToolbar/clear-dropdown.tid @@ -0,0 +1,21 @@ +title: $:/core/ui/EditorToolbar/clear-dropdown + +''{{$:/language/Buttons/Clear/Hint}}'' + +
    + +<$macrocall $name="colour-picker" actions=""" + +<$action-sendmessage + $message="tm-edit-bitmap-operation" + $param="clear" + colour=<> +/> + +<$action-deletetiddler + $tiddler=<> +/> + +"""/> + +
    diff --git a/core/ui/EditorToolbar/clear.tid b/core/ui/EditorToolbar/clear.tid new file mode 100644 index 000000000..876c9f51c --- /dev/null +++ b/core/ui/EditorToolbar/clear.tid @@ -0,0 +1,8 @@ +title: $:/core/ui/EditorToolbar/clear +tags: $:/tags/EditorToolbar +icon: $:/core/images/erase +caption: {{$:/language/Buttons/Clear/Caption}} +description: {{$:/language/Buttons/Clear/Hint}} +condition: [is[image]] +dropdown: $:/core/ui/EditorToolbar/clear-dropdown + diff --git a/core/ui/EditorToolbar/editor-height-dropdown.tid b/core/ui/EditorToolbar/editor-height-dropdown.tid new file mode 100644 index 000000000..da1925b05 --- /dev/null +++ b/core/ui/EditorToolbar/editor-height-dropdown.tid @@ -0,0 +1,8 @@ +title: $:/core/ui/EditorToolbar/editor-height-dropdown + +\define lingo-base() $:/language/Buttons/EditorHeight/ +''<>'' + +<$radio tiddler="$:/config/TextEditor/EditorHeight/Mode" value="auto"> {{$:/core/images/auto-height}} <> + +<$radio tiddler="$:/config/TextEditor/EditorHeight/Mode" value="fixed"> {{$:/core/images/fixed-height}} <> <$edit-text tag="input" tiddler="$:/config/TextEditor/EditorHeight/Height" default="100px"/> diff --git a/core/ui/EditorToolbar/editor-height.tid b/core/ui/EditorToolbar/editor-height.tid new file mode 100644 index 000000000..c6c45775f --- /dev/null +++ b/core/ui/EditorToolbar/editor-height.tid @@ -0,0 +1,15 @@ +title: $:/core/ui/EditorToolbar/editor-height +tags: $:/tags/EditorToolbar +icon: $:/core/images/fixed-height +custom-icon: yes +caption: {{$:/language/Buttons/EditorHeight/Caption}} +description: {{$:/language/Buttons/EditorHeight/Hint}} +condition: [!is[image]] +dropdown: $:/core/ui/EditorToolbar/editor-height-dropdown + +<$reveal tag="span" state="$:/config/TextEditor/EditorHeight/Mode" type="match" text="fixed"> +{{$:/core/images/fixed-height}} + +<$reveal tag="span" state="$:/config/TextEditor/EditorHeight/Mode" type="match" text="auto"> +{{$:/core/images/auto-height}} + diff --git a/core/ui/EditorToolbar/excise-dropdown.tid b/core/ui/EditorToolbar/excise-dropdown.tid new file mode 100644 index 000000000..47aa27c8b --- /dev/null +++ b/core/ui/EditorToolbar/excise-dropdown.tid @@ -0,0 +1,49 @@ +title: $:/core/ui/EditorToolbar/excise-dropdown + +\define lingo-base() $:/language/Buttons/Excise/ + +\define body(config-title) +''<>'' + +<> <$edit-text tag="input" tiddler="$config-title$/new-title" default="" focus="true"/> + +<$set name="new-title" value={{$config-title$/new-title}}> +<$list filter="""[is[tiddler]]"""> +
    +<> +
    + + + +<$checkbox tiddler="""$config-title$/tagnew""" field="text" checked="yes" unchecked="no" default="false"> <> + +<> <$select tiddler="""$config-title$/type""" default="transclude"> + + + + + +<$reveal state="""$config-title$/type""" type="match" text="macro"> +<> <$edit-text tag="input" tiddler="""$config-title$/macro-title""" default="translink"/> + + +<$button> +<$action-sendmessage + $message="tm-edit-text-operation" + $param="excise" + title={{$config-title$/new-title}} + type={{$config-title$/type}} + macro={{$config-title$/macro-title}} + tagnew={{$config-title$/tagnew}} +/> +<$action-deletetiddler + $tiddler="$config-title$/new-title" +/> +<$action-deletetiddler + $tiddler=<> +/> +<> + +\end + +<$macrocall $name="body" config-title=<>/> diff --git a/core/ui/EditorToolbar/excise.tid b/core/ui/EditorToolbar/excise.tid new file mode 100644 index 000000000..dc2b34d3b --- /dev/null +++ b/core/ui/EditorToolbar/excise.tid @@ -0,0 +1,9 @@ +title: $:/core/ui/EditorToolbar/excise +tags: $:/tags/EditorToolbar +icon: $:/core/images/excise +caption: {{$:/language/Buttons/Excise/Caption}} +description: {{$:/language/Buttons/Excise/Hint}} +condition: [!is[image]] +shortcuts: ((excise)) +dropdown: $:/core/ui/EditorToolbar/excise-dropdown + diff --git a/core/ui/EditorToolbar/heading-1.tid b/core/ui/EditorToolbar/heading-1.tid new file mode 100644 index 000000000..2f0f41847 --- /dev/null +++ b/core/ui/EditorToolbar/heading-1.tid @@ -0,0 +1,15 @@ +title: $:/core/ui/EditorToolbar/heading-1 +tags: $:/tags/EditorToolbar +icon: $:/core/images/heading-1 +caption: {{$:/language/Buttons/Heading1/Caption}} +description: {{$:/language/Buttons/Heading1/Hint}} +condition: [!has[type]] [type[text/vnd.tiddlywiki]] +button-classes: tc-text-editor-toolbar-item-start-group +shortcuts: ((heading-1)) + +<$action-sendmessage + $message="tm-edit-text-operation" + $param="prefix-lines" + character="!" + count="1" +/> diff --git a/core/ui/EditorToolbar/heading-2.tid b/core/ui/EditorToolbar/heading-2.tid new file mode 100644 index 000000000..7139bf3d0 --- /dev/null +++ b/core/ui/EditorToolbar/heading-2.tid @@ -0,0 +1,14 @@ +title: $:/core/ui/EditorToolbar/heading-2 +tags: $:/tags/EditorToolbar +icon: $:/core/images/heading-2 +caption: {{$:/language/Buttons/Heading2/Caption}} +description: {{$:/language/Buttons/Heading2/Hint}} +condition: [!has[type]] [type[text/vnd.tiddlywiki]] +shortcuts: ((heading-2)) + +<$action-sendmessage + $message="tm-edit-text-operation" + $param="prefix-lines" + character="!" + count="2" +/> diff --git a/core/ui/EditorToolbar/heading-3.tid b/core/ui/EditorToolbar/heading-3.tid new file mode 100644 index 000000000..e00dd832b --- /dev/null +++ b/core/ui/EditorToolbar/heading-3.tid @@ -0,0 +1,14 @@ +title: $:/core/ui/EditorToolbar/heading-3 +tags: $:/tags/EditorToolbar +icon: $:/core/images/heading-3 +caption: {{$:/language/Buttons/Heading3/Caption}} +description: {{$:/language/Buttons/Heading3/Hint}} +condition: [!has[type]] [type[text/vnd.tiddlywiki]] +shortcuts: ((heading-3)) + +<$action-sendmessage + $message="tm-edit-text-operation" + $param="prefix-lines" + character="!" + count="3" +/> diff --git a/core/ui/EditorToolbar/heading-4.tid b/core/ui/EditorToolbar/heading-4.tid new file mode 100644 index 000000000..4a4b7a90b --- /dev/null +++ b/core/ui/EditorToolbar/heading-4.tid @@ -0,0 +1,14 @@ +title: $:/core/ui/EditorToolbar/heading-4 +tags: $:/tags/EditorToolbar +icon: $:/core/images/heading-4 +caption: {{$:/language/Buttons/Heading4/Caption}} +description: {{$:/language/Buttons/Heading4/Hint}} +condition: [!has[type]] [type[text/vnd.tiddlywiki]] +shortcuts: ((heading-4)) + +<$action-sendmessage + $message="tm-edit-text-operation" + $param="prefix-lines" + character="!" + count="4" +/> diff --git a/core/ui/EditorToolbar/heading-5.tid b/core/ui/EditorToolbar/heading-5.tid new file mode 100644 index 000000000..09f0bcf4c --- /dev/null +++ b/core/ui/EditorToolbar/heading-5.tid @@ -0,0 +1,14 @@ +title: $:/core/ui/EditorToolbar/heading-5 +tags: $:/tags/EditorToolbar +icon: $:/core/images/heading-5 +caption: {{$:/language/Buttons/Heading5/Caption}} +description: {{$:/language/Buttons/Heading5/Hint}} +condition: [!has[type]] [type[text/vnd.tiddlywiki]] +shortcuts: ((heading-5)) + +<$action-sendmessage + $message="tm-edit-text-operation" + $param="prefix-lines" + character="!" + count="5" +/> diff --git a/core/ui/EditorToolbar/heading-6.tid b/core/ui/EditorToolbar/heading-6.tid new file mode 100644 index 000000000..d5d8dc045 --- /dev/null +++ b/core/ui/EditorToolbar/heading-6.tid @@ -0,0 +1,14 @@ +title: $:/core/ui/EditorToolbar/heading-6 +tags: $:/tags/EditorToolbar +icon: $:/core/images/heading-6 +caption: {{$:/language/Buttons/Heading6/Caption}} +description: {{$:/language/Buttons/Heading6/Hint}} +condition: [!has[type]] [type[text/vnd.tiddlywiki]] +shortcuts: ((heading-6)) + +<$action-sendmessage + $message="tm-edit-text-operation" + $param="prefix-lines" + character="!" + count="6" +/> diff --git a/core/ui/EditorToolbar/italic.tid b/core/ui/EditorToolbar/italic.tid new file mode 100644 index 000000000..518f3d0c2 --- /dev/null +++ b/core/ui/EditorToolbar/italic.tid @@ -0,0 +1,14 @@ +title: $:/core/ui/EditorToolbar/italic +tags: $:/tags/EditorToolbar +icon: $:/core/images/italic +caption: {{$:/language/Buttons/Italic/Caption}} +description: {{$:/language/Buttons/Italic/Hint}} +condition: [!has[type]] [type[text/vnd.tiddlywiki]] +shortcuts: ((italic)) + +<$action-sendmessage + $message="tm-edit-text-operation" + $param="wrap-selection" + prefix="//" + suffix="//" +/> diff --git a/core/ui/EditorToolbar/line-width-dropdown.tid b/core/ui/EditorToolbar/line-width-dropdown.tid new file mode 100644 index 000000000..b99bdcde4 --- /dev/null +++ b/core/ui/EditorToolbar/line-width-dropdown.tid @@ -0,0 +1,42 @@ +title: $:/core/ui/EditorToolbar/line-width-dropdown + +\define lingo-base() $:/language/Buttons/LineWidth/ + +\define toolbar-line-width-inner() +<$button tag="a" tooltip="""$(line-width)$"""> + +<$action-setfield + $tiddler="$:/config/BitmapEditor/LineWidth" + $value="$(line-width)$" +/> + +<$action-deletetiddler + $tiddler=<> +/> + +
    + + + +<$text text="""$(line-width)$"""/> + +<$reveal state="$:/config/BitmapEditor/LineWidth" type="match" text="""$(line-width)$""" tag="span"> + +<$entity entity=" "/> + +<$entity entity="✓"/> + + + + + + +\end + +''<>'' + +<$list filter={{$:/config/BitmapEditor/LineWidths}} variable="line-width"> + +<> + + diff --git a/core/ui/EditorToolbar/line-width.tid b/core/ui/EditorToolbar/line-width.tid new file mode 100644 index 000000000..3910745a3 --- /dev/null +++ b/core/ui/EditorToolbar/line-width.tid @@ -0,0 +1,9 @@ +title: $:/core/ui/EditorToolbar/line-width +tags: $:/tags/EditorToolbar +icon: $:/core/images/line-width +caption: {{$:/language/Buttons/LineWidth/Caption}} +description: {{$:/language/Buttons/LineWidth/Hint}} +condition: [is[image]] +dropdown: $:/core/ui/EditorToolbar/line-width-dropdown + +<$text text={{$:/config/BitmapEditor/LineWidth}}/> \ No newline at end of file diff --git a/core/ui/EditorToolbar/link-dropdown.tid b/core/ui/EditorToolbar/link-dropdown.tid new file mode 100644 index 000000000..782bc6d6f --- /dev/null +++ b/core/ui/EditorToolbar/link-dropdown.tid @@ -0,0 +1,73 @@ +title: $:/core/ui/EditorToolbar/link-dropdown + +\define lingo-base() $:/language/Buttons/Link/ + +\define link-actions() +<$action-sendmessage + $message="tm-edit-text-operation" + $param="make-link" + text={{$(linkTiddler)$}} +/> + +<$action-deletetiddler + $tiddler=<> +/> + +<$action-deletetiddler + $tiddler=<> +/> + +<$action-deletetiddler + $tiddler=<> +/> +\end + +\define external-link() +<$button class="tc-btn-invisible" style="width: auto; display: inline-block; background-colour: inherit;"> +<$action-sendmessage $message="tm-edit-text-operation" $param="make-link" text={{$(searchTiddler)$}} +/> +{{$:/core/images/chevron-right}} +<$action-deletetiddler + $tiddler=<> +/> + +<$action-deletetiddler + $tiddler=<> +/> + +<$action-deletetiddler + $tiddler=<> +/> + +\end + + +\define body(config-title) +''<>'' + +<$vars searchTiddler="""$config-title$/search""" linkTiddler="""$config-title$/link""" linktext="" > + +<$edit-text tiddler=<> type="search" tag="input" focus="true" placeholder={{$:/language/Search/Search}} default=""/> +<$reveal tag="span" state=<> type="nomatch" text=""> +<> +<$button class="tc-btn-invisible" style="width: auto; display: inline-block; background-colour: inherit;"> +<$action-setfield $tiddler=<> text="" /> +{{$:/core/images/close-button}} + + + +<$reveal tag="div" state=<> type="nomatch" text=""> + +<$linkcatcher actions=<> to=<>> + +{{$:/core/ui/SearchResults}} + + + + + + + +\end + +<$macrocall $name="body" config-title=<>/> \ No newline at end of file diff --git a/core/ui/EditorToolbar/link.tid b/core/ui/EditorToolbar/link.tid new file mode 100644 index 000000000..e0527cfab --- /dev/null +++ b/core/ui/EditorToolbar/link.tid @@ -0,0 +1,10 @@ +title: $:/core/ui/EditorToolbar/link +tags: $:/tags/EditorToolbar +icon: $:/core/images/link +caption: {{$:/language/Buttons/Link/Caption}} +description: {{$:/language/Buttons/Link/Hint}} +condition: [!has[type]] [type[text/vnd.tiddlywiki]] +button-classes: tc-text-editor-toolbar-item-start-group +shortcuts: ((link)) +dropdown: $:/core/ui/EditorToolbar/link-dropdown + diff --git a/core/ui/EditorToolbar/list-bullet.tid b/core/ui/EditorToolbar/list-bullet.tid new file mode 100644 index 000000000..dfa14cc18 --- /dev/null +++ b/core/ui/EditorToolbar/list-bullet.tid @@ -0,0 +1,14 @@ +title: $:/core/ui/EditorToolbar/list-bullet +tags: $:/tags/EditorToolbar +icon: $:/core/images/list-bullet +caption: {{$:/language/Buttons/ListBullet/Caption}} +description: {{$:/language/Buttons/ListBullet/Hint}} +condition: [!has[type]] [type[text/vnd.tiddlywiki]] +shortcuts: ((list-bullet)) + +<$action-sendmessage + $message="tm-edit-text-operation" + $param="prefix-lines" + character="*" + count="1" +/> diff --git a/core/ui/EditorToolbar/list-number.tid b/core/ui/EditorToolbar/list-number.tid new file mode 100644 index 000000000..81b9152d0 --- /dev/null +++ b/core/ui/EditorToolbar/list-number.tid @@ -0,0 +1,14 @@ +title: $:/core/ui/EditorToolbar/list-number +tags: $:/tags/EditorToolbar +icon: $:/core/images/list-number +caption: {{$:/language/Buttons/ListNumber/Caption}} +description: {{$:/language/Buttons/ListNumber/Hint}} +condition: [!has[type]] [type[text/vnd.tiddlywiki]] +shortcuts: ((list-number)) + +<$action-sendmessage + $message="tm-edit-text-operation" + $param="prefix-lines" + character="#" + count="1" +/> diff --git a/core/ui/EditorToolbar/mono-block.tid b/core/ui/EditorToolbar/mono-block.tid new file mode 100644 index 000000000..4ef741695 --- /dev/null +++ b/core/ui/EditorToolbar/mono-block.tid @@ -0,0 +1,16 @@ +title: $:/core/ui/EditorToolbar/mono-block +tags: $:/tags/EditorToolbar +icon: $:/core/images/mono-block +caption: {{$:/language/Buttons/MonoBlock/Caption}} +description: {{$:/language/Buttons/MonoBlock/Hint}} +condition: [!has[type]] [type[text/vnd.tiddlywiki]] +button-classes: tc-text-editor-toolbar-item-start-group +shortcuts: ((mono-block)) + +<$action-sendmessage + $message="tm-edit-text-operation" + $param="wrap-lines" + prefix=" +```" + suffix="```" +/> diff --git a/core/ui/EditorToolbar/mono-line.tid b/core/ui/EditorToolbar/mono-line.tid new file mode 100644 index 000000000..15ca77de1 --- /dev/null +++ b/core/ui/EditorToolbar/mono-line.tid @@ -0,0 +1,14 @@ +title: $:/core/ui/EditorToolbar/mono-line +tags: $:/tags/EditorToolbar +icon: $:/core/images/mono-line +caption: {{$:/language/Buttons/MonoLine/Caption}} +description: {{$:/language/Buttons/MonoLine/Hint}} +condition: [!has[type]] [type[text/vnd.tiddlywiki]] +shortcuts: ((mono-line)) + +<$action-sendmessage + $message="tm-edit-text-operation" + $param="wrap-selection" + prefix="`" + suffix="`" +/> diff --git a/core/ui/EditorToolbar/more-dropdown.tid b/core/ui/EditorToolbar/more-dropdown.tid new file mode 100644 index 000000000..289f74011 --- /dev/null +++ b/core/ui/EditorToolbar/more-dropdown.tid @@ -0,0 +1,19 @@ +title: $:/core/ui/EditorToolbar/more-dropdown + +\define config-title() +$:/config/EditorToolbarButtons/Visibility/$(toolbarItem)$ +\end + +\define conditional-button() +<$list filter={{$(toolbarItem)$!!condition}} variable="condition"> +<$transclude tiddler="$:/core/ui/EditTemplate/body/toolbar/button" mode="inline"/> <$transclude tiddler=<> field="description"/> + +\end + +
    +<$list filter="[all[shadows+tiddlers]tag[$:/tags/EditorToolbar]!has[draft.of]] -[[$:/core/ui/EditorToolbar/more]]"> +<$reveal type="match" state=<> text="hide" tag="div"> +<> + + +
    diff --git a/core/ui/EditorToolbar/more.tid b/core/ui/EditorToolbar/more.tid new file mode 100644 index 000000000..8945f6def --- /dev/null +++ b/core/ui/EditorToolbar/more.tid @@ -0,0 +1,8 @@ +title: $:/core/ui/EditorToolbar/more +tags: $:/tags/EditorToolbar +icon: $:/core/images/down-arrow +caption: {{$:/language/Buttons/More/Caption}} +description: {{$:/language/Buttons/More/Hint}} +condition: [] +dropdown: $:/core/ui/EditorToolbar/more-dropdown +text: diff --git a/core/ui/EditorToolbar/opacity-dropdown.tid b/core/ui/EditorToolbar/opacity-dropdown.tid new file mode 100644 index 000000000..80d287342 --- /dev/null +++ b/core/ui/EditorToolbar/opacity-dropdown.tid @@ -0,0 +1,54 @@ +title: $:/core/ui/EditorToolbar/opacity-dropdown + +\define lingo-base() $:/language/Buttons/Opacity/ + +\define toolbar-opacity-inner() +<$button tag="a" tooltip="""$(opacity)$"""> + +<$action-setfield + $tiddler="$:/config/BitmapEditor/Opacity" + $value="$(opacity)$" +/> + +<$action-deletetiddler + $tiddler=<> +/> + +
    + + + +<$text text="""$(opacity)$"""/> + +<$reveal state="$:/config/BitmapEditor/Opacity" type="match" text="""$(opacity)$""" tag="span"> + +<$entity entity=" "/> + +<$entity entity="✓"/> + + + + + + +\end + +\define toolbar-opacity() +''<>'' + +<$list filter={{$:/config/BitmapEditor/Opacities}} variable="opacity"> + +<> + + +\end + +<$set name="current-paint-colour" value={{$:/config/BitmapEditor/Colour}}> + +<$set name="current-opacity" value={{$:/config/BitmapEditor/Opacity}}> + +<> + + + + diff --git a/core/ui/EditorToolbar/opacity.tid b/core/ui/EditorToolbar/opacity.tid new file mode 100644 index 000000000..4b2170c06 --- /dev/null +++ b/core/ui/EditorToolbar/opacity.tid @@ -0,0 +1,9 @@ +title: $:/core/ui/EditorToolbar/opacity +tags: $:/tags/EditorToolbar +icon: $:/core/images/opacity +caption: {{$:/language/Buttons/Opacity/Caption}} +description: {{$:/language/Buttons/Opacity/Hint}} +condition: [is[image]] +dropdown: $:/core/ui/EditorToolbar/opacity-dropdown + +<$text text={{$:/config/BitmapEditor/Opacity}}/> diff --git a/core/ui/EditorToolbar/paint-dropdown.tid b/core/ui/EditorToolbar/paint-dropdown.tid new file mode 100644 index 000000000..c2deaa757 --- /dev/null +++ b/core/ui/EditorToolbar/paint-dropdown.tid @@ -0,0 +1,16 @@ +title: $:/core/ui/EditorToolbar/paint-dropdown + +''{{$:/language/Buttons/Paint/Hint}}'' + +<$macrocall $name="colour-picker" actions=""" + +<$action-setfield + $tiddler="$:/config/BitmapEditor/Colour" + $value=<> +/> + +<$action-deletetiddler + $tiddler=<> +/> + +"""/> diff --git a/core/ui/EditorToolbar/paint.tid b/core/ui/EditorToolbar/paint.tid new file mode 100644 index 000000000..8ca488888 --- /dev/null +++ b/core/ui/EditorToolbar/paint.tid @@ -0,0 +1,14 @@ +title: $:/core/ui/EditorToolbar/paint +tags: $:/tags/EditorToolbar +icon: $:/core/images/paint +caption: {{$:/language/Buttons/Paint/Caption}} +description: {{$:/language/Buttons/Paint/Hint}} +condition: [is[image]] +dropdown: $:/core/ui/EditorToolbar/paint-dropdown + +\define toolbar-paint() +
    +\end +<$set name="colour-picker-value" value={{$:/config/BitmapEditor/Colour}}> +<> + diff --git a/core/ui/EditorToolbar/picture-dropdown.tid b/core/ui/EditorToolbar/picture-dropdown.tid new file mode 100644 index 000000000..89ba004e5 --- /dev/null +++ b/core/ui/EditorToolbar/picture-dropdown.tid @@ -0,0 +1,21 @@ +title: $:/core/ui/EditorToolbar/picture-dropdown + +\define replacement-text() +[img[$(imageTitle)$]] +\end + +''{{$:/language/Buttons/Picture/Hint}}'' + +<$macrocall $name="image-picker" actions=""" + +<$action-sendmessage + $message="tm-edit-text-operation" + $param="replace-selection" + text=<> +/> + +<$action-deletetiddler + $tiddler=<> +/> + +"""/> diff --git a/core/ui/EditorToolbar/picture.tid b/core/ui/EditorToolbar/picture.tid new file mode 100644 index 000000000..cf10c0017 --- /dev/null +++ b/core/ui/EditorToolbar/picture.tid @@ -0,0 +1,9 @@ +title: $:/core/ui/EditorToolbar/picture +tags: $:/tags/EditorToolbar +icon: $:/core/images/picture +caption: {{$:/language/Buttons/Picture/Caption}} +description: {{$:/language/Buttons/Picture/Hint}} +condition: [!has[type]] [type[text/vnd.tiddlywiki]] +shortcuts: ((picture)) +dropdown: $:/core/ui/EditorToolbar/picture-dropdown + diff --git a/core/ui/EditorToolbar/preview-type-dropdown.tid b/core/ui/EditorToolbar/preview-type-dropdown.tid new file mode 100644 index 000000000..0098aa034 --- /dev/null +++ b/core/ui/EditorToolbar/preview-type-dropdown.tid @@ -0,0 +1,33 @@ +title: $:/core/ui/EditorToolbar/preview-type-dropdown + +\define preview-type-button() +<$button tag="a"> + +<$action-setfield $tiddler="$:/state/editpreviewtype" $value="$(previewType)$"/> + +<$action-deletetiddler + $tiddler=<> +/> + +<$transclude tiddler=<> field="caption" mode="inline"> + +<$view tiddler=<> field="title" mode="inline"/> + + + +<$reveal tag="span" state="$:/state/editpreviewtype" type="match" text=<> default="$:/core/ui/EditTemplate/body/preview/output"> + +<$entity entity=" "/> + +<$entity entity="✓"/> + + + + +\end + +<$list filter="[all[shadows+tiddlers]tag[$:/tags/EditPreview]!has[draft.of]]" variable="previewType"> + +<> + + diff --git a/core/ui/EditorToolbar/preview-type.tid b/core/ui/EditorToolbar/preview-type.tid new file mode 100644 index 000000000..5e7d315ce --- /dev/null +++ b/core/ui/EditorToolbar/preview-type.tid @@ -0,0 +1,8 @@ +title: $:/core/ui/EditorToolbar/preview-type +tags: $:/tags/EditorToolbar +icon: $:/core/images/chevron-down +caption: {{$:/language/Buttons/PreviewType/Caption}} +description: {{$:/language/Buttons/PreviewType/Hint}} +condition: [all[shadows+tiddlers]tag[$:/tags/EditPreview]!has[draft.of]butfirst[]limit[1]] +button-classes: tc-text-editor-toolbar-item-adjunct +dropdown: $:/core/ui/EditorToolbar/preview-type-dropdown diff --git a/core/ui/EditorToolbar/preview.tid b/core/ui/EditorToolbar/preview.tid new file mode 100644 index 000000000..96cb14cac --- /dev/null +++ b/core/ui/EditorToolbar/preview.tid @@ -0,0 +1,18 @@ +title: $:/core/ui/EditorToolbar/preview +tags: $:/tags/EditorToolbar +icon: $:/core/images/preview-open +custom-icon: yes +caption: {{$:/language/Buttons/Preview/Caption}} +description: {{$:/language/Buttons/Preview/Hint}} +condition: [] +button-classes: tc-text-editor-toolbar-item-start-group +shortcuts: ((preview)) + +<$reveal state="$:/state/showeditpreview" type="match" text="yes" tag="span"> +{{$:/core/images/preview-open}} +<$action-setfield $tiddler="$:/state/showeditpreview" $value="no"/> + +<$reveal state="$:/state/showeditpreview" type="nomatch" text="yes" tag="span"> +{{$:/core/images/preview-closed}} +<$action-setfield $tiddler="$:/state/showeditpreview" $value="yes"/> + diff --git a/core/ui/EditorToolbar/quote.tid b/core/ui/EditorToolbar/quote.tid new file mode 100644 index 000000000..1fe5fd9e1 --- /dev/null +++ b/core/ui/EditorToolbar/quote.tid @@ -0,0 +1,15 @@ +title: $:/core/ui/EditorToolbar/quote +tags: $:/tags/EditorToolbar +icon: $:/core/images/quote +caption: {{$:/language/Buttons/Quote/Caption}} +description: {{$:/language/Buttons/Quote/Hint}} +condition: [!has[type]] [type[text/vnd.tiddlywiki]] +shortcuts: ((quote)) + +<$action-sendmessage + $message="tm-edit-text-operation" + $param="wrap-lines" + prefix=" +<<<" + suffix="<<<" +/> diff --git a/core/ui/EditorToolbar/size-dropdown.tid b/core/ui/EditorToolbar/size-dropdown.tid new file mode 100644 index 000000000..96e4ec7d9 --- /dev/null +++ b/core/ui/EditorToolbar/size-dropdown.tid @@ -0,0 +1,76 @@ +title: $:/core/ui/EditorToolbar/size-dropdown + +\define lingo-base() $:/language/Buttons/Size/ + +\define toolbar-button-size-preset(config-title) +<$set name="width" filter="$(sizePair)$ +[first[]]"> + +<$set name="height" filter="$(sizePair)$ +[last[]]"> + +<$button tag="a"> + +<$action-setfield + $tiddler="""$config-title$/new-width""" + $value=<> +/> + +<$action-setfield + $tiddler="""$config-title$/new-height""" + $value=<> +/> + +<$action-deletetiddler + $tiddler="""$config-title$/presets-popup""" +/> + +<$text text=<>/> × <$text text=<>/> + + + + + + +\end + +\define toolbar-button-size(config-title) +''{{$:/language/Buttons/Size/Hint}}'' + +<> <$edit-text tag="input" tiddler="""$config-title$/new-width""" default=<> focus="true" size="8"/> <> <$edit-text tag="input" tiddler="""$config-title$/new-height""" default=<> size="8"/> <$button popup="""$config-title$/presets-popup""" class="tc-btn-invisible tc-popup-keep" style="width: auto; display: inline-block; background-colour: inherit;" selectedClass="tc-selected"> +{{$:/core/images/down-arrow}} + + +<$reveal tag="span" state="""$config-title$/presets-popup""" type="popup" position="belowleft" animate="yes"> + +
    + +<$list filter={{$:/config/BitmapEditor/ImageSizes}} variable="sizePair"> + +<$macrocall $name="toolbar-button-size-preset" config-title="$config-title$"/> + + + +
    + + + +<$button> +<$action-sendmessage + $message="tm-edit-bitmap-operation" + $param="resize" + width={{$config-title$/new-width}} + height={{$config-title$/new-height}} +/> +<$action-deletetiddler + $tiddler="""$config-title$/new-width""" +/> +<$action-deletetiddler + $tiddler="""$config-title$/new-height""" +/> +<$action-deletetiddler + $tiddler=<> +/> +<> + +\end + +<$macrocall $name="toolbar-button-size" config-title=<>/> diff --git a/core/ui/EditorToolbar/size.tid b/core/ui/EditorToolbar/size.tid new file mode 100644 index 000000000..ca9d31331 --- /dev/null +++ b/core/ui/EditorToolbar/size.tid @@ -0,0 +1,8 @@ +title: $:/core/ui/EditorToolbar/size +tags: $:/tags/EditorToolbar +icon: $:/core/images/size +caption: {{$:/language/Buttons/Size/Caption}} +description: {{$:/language/Buttons/Size/Hint}} +condition: [is[image]] +dropdown: $:/core/ui/EditorToolbar/size-dropdown + diff --git a/core/ui/EditorToolbar/stamp-dropdown.tid b/core/ui/EditorToolbar/stamp-dropdown.tid new file mode 100644 index 000000000..01b3abd90 --- /dev/null +++ b/core/ui/EditorToolbar/stamp-dropdown.tid @@ -0,0 +1,52 @@ +title: $:/core/ui/EditorToolbar/stamp-dropdown + +\define toolbar-button-stamp-inner() +<$button tag="a"> + +<$action-sendmessage + $message="tm-edit-text-operation" + $param="replace-selection" + text={{$(snippetTitle)$}} +/> + +<$action-deletetiddler + $tiddler=<> +/> + +<$view tiddler=<> field="caption" mode="inline"> + +<$view tiddler=<> field="title" mode="inline"/> + + + + +\end + +<$list filter="[all[shadows+tiddlers]tag[$:/tags/TextEditor/Snippet]!has[draft.of]sort[caption]]" variable="snippetTitle"> + +<> + + + +---- + +<$button tag="a"> + +<$action-sendmessage + $message="tm-new-tiddler" + tags="$:/tags/TextEditor/Snippet" + caption={{$:/language/Buttons/Stamp/New/Title}} + text={{$:/language/Buttons/Stamp/New/Text}} +/> + +<$action-deletetiddler + $tiddler=<> +/> + + + +<$text text={{$:/language/Buttons/Stamp/Caption/New}}/> + + + + diff --git a/core/ui/EditorToolbar/stamp.tid b/core/ui/EditorToolbar/stamp.tid new file mode 100644 index 000000000..bd83a2928 --- /dev/null +++ b/core/ui/EditorToolbar/stamp.tid @@ -0,0 +1,9 @@ +title: $:/core/ui/EditorToolbar/stamp +tags: $:/tags/EditorToolbar +icon: $:/core/images/stamp +caption: {{$:/language/Buttons/Stamp/Caption}} +description: {{$:/language/Buttons/Stamp/Hint}} +condition: [!is[image]] +shortcuts: ((stamp)) +dropdown: $:/core/ui/EditorToolbar/stamp-dropdown +text: diff --git a/core/ui/EditorToolbar/strikethrough.tid b/core/ui/EditorToolbar/strikethrough.tid new file mode 100644 index 000000000..53808cac3 --- /dev/null +++ b/core/ui/EditorToolbar/strikethrough.tid @@ -0,0 +1,14 @@ +title: $:/core/ui/EditorToolbar/strikethrough +tags: $:/tags/EditorToolbar +icon: $:/core/images/strikethrough +caption: {{$:/language/Buttons/Strikethrough/Caption}} +description: {{$:/language/Buttons/Strikethrough/Hint}} +condition: [!has[type]] [type[text/vnd.tiddlywiki]] +shortcuts: ((strikethrough)) + +<$action-sendmessage + $message="tm-edit-text-operation" + $param="wrap-selection" + prefix="~~" + suffix="~~" +/> diff --git a/core/ui/EditorToolbar/subscript.tid b/core/ui/EditorToolbar/subscript.tid new file mode 100644 index 000000000..e2c83abbd --- /dev/null +++ b/core/ui/EditorToolbar/subscript.tid @@ -0,0 +1,14 @@ +title: $:/core/ui/EditorToolbar/subscript +tags: $:/tags/EditorToolbar +icon: $:/core/images/subscript +caption: {{$:/language/Buttons/Subscript/Caption}} +description: {{$:/language/Buttons/Subscript/Hint}} +condition: [!has[type]] [type[text/vnd.tiddlywiki]] +shortcuts: ((subscript)) + +<$action-sendmessage + $message="tm-edit-text-operation" + $param="wrap-selection" + prefix=",," + suffix=",," +/> diff --git a/core/ui/EditorToolbar/superscript.tid b/core/ui/EditorToolbar/superscript.tid new file mode 100644 index 000000000..c1a40efea --- /dev/null +++ b/core/ui/EditorToolbar/superscript.tid @@ -0,0 +1,14 @@ +title: $:/core/ui/EditorToolbar/superscript +tags: $:/tags/EditorToolbar +icon: $:/core/images/superscript +caption: {{$:/language/Buttons/Superscript/Caption}} +description: {{$:/language/Buttons/Superscript/Hint}} +condition: [!has[type]] [type[text/vnd.tiddlywiki]] +shortcuts: ((superscript)) + +<$action-sendmessage + $message="tm-edit-text-operation" + $param="wrap-selection" + prefix="^^" + suffix="^^" +/> diff --git a/core/ui/EditorToolbar/underline.tid b/core/ui/EditorToolbar/underline.tid new file mode 100644 index 000000000..ec6d63319 --- /dev/null +++ b/core/ui/EditorToolbar/underline.tid @@ -0,0 +1,14 @@ +title: $:/core/ui/EditorToolbar/underline +tags: $:/tags/EditorToolbar +icon: $:/core/images/underline +caption: {{$:/language/Buttons/Underline/Caption}} +description: {{$:/language/Buttons/Underline/Hint}} +condition: [!has[type]] [type[text/vnd.tiddlywiki]] +shortcuts: ((underline)) + +<$action-sendmessage + $message="tm-edit-text-operation" + $param="wrap-selection" + prefix="__" + suffix="__" +/> diff --git a/core/ui/MoreSideBar/Plugins.tid b/core/ui/MoreSideBar/Plugins.tid new file mode 100644 index 000000000..614bcaeee --- /dev/null +++ b/core/ui/MoreSideBar/Plugins.tid @@ -0,0 +1,8 @@ +title: $:/core/ui/MoreSideBar/Plugins +tags: $:/tags/MoreSideBar +caption: {{$:/language/ControlPanel/Plugins/Caption}} + + +{{$:/language/ControlPanel/Plugins/Installed/Hint}} + +<> diff --git a/core/ui/MoreSideBar/plugins/Languages.tid b/core/ui/MoreSideBar/plugins/Languages.tid new file mode 100644 index 000000000..2220f0124 --- /dev/null +++ b/core/ui/MoreSideBar/plugins/Languages.tid @@ -0,0 +1,5 @@ +title: $:/core/ui/MoreSideBar/Plugins/Languages +tags: $:/tags/MoreSideBar/Plugins +caption: {{$:/language/ControlPanel/Plugins/Languages/Caption}} + +<$list filter="[!has[draft.of]plugin-type[language]sort[description]]" template="$:/core/ui/PluginListItemTemplate" emptyMessage={{$:/language/ControlPanel/Plugins/Empty/Hint}}/> diff --git a/core/ui/MoreSideBar/plugins/Plugins.tid b/core/ui/MoreSideBar/plugins/Plugins.tid new file mode 100644 index 000000000..96933542a --- /dev/null +++ b/core/ui/MoreSideBar/plugins/Plugins.tid @@ -0,0 +1,5 @@ +title: $:/core/ui/MoreSideBar/Plugins/Plugins +tags: $:/tags/MoreSideBar/Plugins +caption: {{$:/language/ControlPanel/Plugins/Plugins/Caption}} + +<$list filter="[!has[draft.of]plugin-type[plugin]sort[description]]" template="$:/core/ui/PluginListItemTemplate" emptyMessage={{$:/language/ControlPanel/Plugins/Empty/Hint}}>>/> diff --git a/core/ui/MoreSideBar/plugins/Theme.tid b/core/ui/MoreSideBar/plugins/Theme.tid new file mode 100644 index 000000000..48447cd6e --- /dev/null +++ b/core/ui/MoreSideBar/plugins/Theme.tid @@ -0,0 +1,5 @@ +title: $:/core/ui/MoreSideBar/Plugins/Theme +tags: $:/tags/MoreSideBar/Plugins +caption: {{$:/language/ControlPanel/Plugins/Themes/Caption}} + +<$list filter="[!has[draft.of]plugin-type[theme]sort[description]]" template="$:/core/ui/PluginListItemTemplate" emptyMessage={{$:/language/ControlPanel/Plugins/Empty/Hint}}/> diff --git a/core/ui/PageControls/new-image.tid b/core/ui/PageControls/new-image.tid new file mode 100644 index 000000000..bb9d4cd9c --- /dev/null +++ b/core/ui/PageControls/new-image.tid @@ -0,0 +1,14 @@ +title: $:/core/ui/Buttons/new-image +tags: $:/tags/PageControls +caption: {{$:/core/images/new-image-button}} {{$:/language/Buttons/NewImage/Caption}} +description: {{$:/language/Buttons/NewImage/Hint}} + +<$button tooltip={{$:/language/Buttons/NewImage/Hint}} aria-label={{$:/language/Buttons/NewImage/Caption}} class=<>> +<$action-sendmessage $message="tm-new-tiddler" type="image/jpeg"/> +<$list filter="[prefix[yes]]"> +{{$:/core/images/new-image-button}} + +<$list filter="[prefix[yes]]"> +<$text text={{$:/language/Buttons/NewImage/Caption}}/> + + diff --git a/core/ui/PageControls/print.tid b/core/ui/PageControls/print.tid new file mode 100644 index 000000000..cc2709cd2 --- /dev/null +++ b/core/ui/PageControls/print.tid @@ -0,0 +1,13 @@ +title: $:/core/ui/Buttons/print +tags: $:/tags/PageControls +caption: {{$:/core/images/print-button}} {{$:/language/Buttons/Print/Caption}} +description: {{$:/language/Buttons/Print/Hint}} + +<$button message="tm-print" tooltip={{$:/language/Buttons/Print/Hint}} aria-label={{$:/language/Buttons/Print/Caption}} class=<>> +<$list filter="[prefix[yes]]"> +{{$:/core/images/print-button}} + +<$list filter="[prefix[yes]]"> +<$text text={{$:/language/Buttons/Print/Caption}}/> + + \ No newline at end of file diff --git a/core/ui/PluginInfo.tid b/core/ui/PluginInfo.tid index 08167f1ec..d8944bf35 100644 --- a/core/ui/PluginInfo.tid +++ b/core/ui/PluginInfo.tid @@ -6,10 +6,15 @@ $(currentTiddler)$/$(languageTitle)$/$(currentTab)$ \define info-tiddler-title() $(currentTiddler)$/$(currentTab)$ \end +\define default-tiddler-title() +$:/core/ui/PluginInfo/Default/$(currentTab)$ +\end <$transclude tiddler=<> mode="block"> <$transclude tiddler=<> subtiddler=<> mode="block"> <$transclude tiddler=<> subtiddler=<> mode="block"> -No ''"<$text text=<>/>"'' found +<$transclude tiddler=<> mode="block"> +{{$:/language/ControlPanel/Plugin/NoInfoFound/Hint}} + diff --git a/core/ui/PluginInfoDefaultContents.tid b/core/ui/PluginInfoDefaultContents.tid new file mode 100644 index 000000000..f006d0c60 --- /dev/null +++ b/core/ui/PluginInfoDefaultContents.tid @@ -0,0 +1,13 @@ +title: $:/core/ui/PluginInfo/Default/contents + +\define lingo-base() $:/language/TiddlerInfo/Advanced/PluginInfo/ +<> +
      +<$list filter="[all[current]plugintiddlers[]sort[title]]" emptyMessage=<>> +
    • +<$link to={{!!title}}> +<$view field="title"/> + +
    • + +
    diff --git a/core/ui/PluginListItemTemplate.tid b/core/ui/PluginListItemTemplate.tid new file mode 100644 index 000000000..f781bca92 --- /dev/null +++ b/core/ui/PluginListItemTemplate.tid @@ -0,0 +1,9 @@ +title: $:/core/ui/PluginListItemTemplate + +
    +<$link to={{!!title}}> +<$view field="description"> +<$view field="title"/> + + +
    \ No newline at end of file diff --git a/core/ui/SideBarLists.tid b/core/ui/SideBarLists.tid index dfe012502..f54380721 100644 --- a/core/ui/SideBarLists.tid +++ b/core/ui/SideBarLists.tid @@ -17,9 +17,12 @@ title: $:/core/ui/SideBarLists {{$:/core/images/close-button}} <$button popup=<> class="tc-btn-invisible"> +{{$:/core/images/down-arrow}} +<$list filter="[{$:/temp/search}minlength{$:/config/Search/MinLength}limit[1]]" variable="listItem"> <$set name="resultCount" value="""<$count filter="[!is[system]search{$(searchTiddler)$}]"/>"""> -{{$:/core/images/down-arrow}} {{$:/language/Search/Matches}} +{{$:/language/Search/Matches}} + <$reveal state="$:/temp/search" type="match" text=""> @@ -33,8 +36,12 @@ title: $:/core/ui/SideBarLists <$reveal tag="div" class="tc-block-dropdown tc-search-drop-down tc-popup-handle" state=<> type="nomatch" text="" default=""> +<$list filter="[{$:/temp/search}minlength{$:/config/Search/MinLength}limit[1]]" emptyMessage="""
    {{$:/language/Search/Search/TooShort}}
    """ variable="listItem"> + {{$:/core/ui/SearchResults}} + + diff --git a/core/ui/TagTemplate.tid b/core/ui/TagTemplate.tid index 006758f73..f302d8f3d 100644 --- a/core/ui/TagTemplate.tid +++ b/core/ui/TagTemplate.tid @@ -7,18 +7,18 @@ color:$(foregroundColor)$; \end \define tag-body-inner(colour,fallbackTarget,colourA,colourB) -<$set name="foregroundColor" value=<>> -<$set name="backgroundColor" value="""$colour$"""> +<$vars foregroundColor=<> backgroundColor="""$colour$"""> <$button popup=<> class="tc-btn-invisible tc-tag-label" style=<>> <$transclude tiddler={{!!icon}}/> <$view field="title" format="text" /> -<$reveal state=<> type="popup" position="below" animate="yes">
    <$transclude tiddler="$:/core/ui/ListItemTemplate"/> +<$reveal state=<> type="popup" position="below" animate="yes" class="tc-drop-down"><$transclude tiddler="$:/core/ui/ListItemTemplate"/> +<$list filter="[all[shadows+tiddlers]tag[$:/tags/TagDropdown]!has[draft.of]]" variable="listItem"> +<$transclude tiddler=<>/> +
    <$list filter="[all[current]tagging[]]" template="$:/core/ui/ListItemTemplate"/> -
    - - + \end \define tag-body(colour,palette) @@ -27,4 +27,4 @@ color:$(foregroundColor)$; \end -<$macrocall $name="tag-body" colour={{!!color}} palette={{$:/palette}}/> \ No newline at end of file +<$macrocall $name="tag-body" colour={{!!color}} palette={{$:/palette}}/> diff --git a/core/ui/ViewTemplate/plugin.tid b/core/ui/ViewTemplate/plugin.tid index 2c7d2081c..07bb3b618 100644 --- a/core/ui/ViewTemplate/plugin.tid +++ b/core/ui/ViewTemplate/plugin.tid @@ -2,7 +2,11 @@ title: $:/core/ui/ViewTemplate/plugin tags: $:/tags/ViewTemplate <$list filter="[all[current]has[plugin-type]] -[all[current]field:plugin-type[import]]"> - -{{||$:/core/ui/TiddlerInfo/Advanced/PluginInfo}} - +<$set name="plugin-type" value={{!!plugin-type}}> +<$set name="default-popup-state" value="yes"> +<$set name="qualified-state" value=<>> +{{||$:/core/ui/Components/plugin-info}} + + + diff --git a/core/ui/ViewToolbar/fold-bar.tid b/core/ui/ViewToolbar/fold-bar.tid index 6e813dbb4..1b62975c5 100644 --- a/core/ui/ViewToolbar/fold-bar.tid +++ b/core/ui/ViewToolbar/fold-bar.tid @@ -1,6 +1,6 @@ title: $:/core/ui/Buttons/fold-bar tags: $:/tags/ViewToolbar -caption: {{$:/language/Buttons/Fold/FoldBar/Caption}} +caption: {{$:/core/images/chevron-up}} {{$:/language/Buttons/Fold/FoldBar/Caption}} description: {{$:/language/Buttons/Fold/FoldBar/Hint}} \ No newline at end of file diff --git a/core/wiki/config/BitmapEditorColour.tid b/core/wiki/config/BitmapEditorColour.tid index 7c3902acb..de99f92fc 100644 --- a/core/wiki/config/BitmapEditorColour.tid +++ b/core/wiki/config/BitmapEditorColour.tid @@ -1,3 +1,3 @@ title: $:/config/BitmapEditor/Colour -#ff0 \ No newline at end of file +#444 \ No newline at end of file diff --git a/core/wiki/config/BitmapEditorImageSizes.tid b/core/wiki/config/BitmapEditorImageSizes.tid new file mode 100644 index 000000000..28de18611 --- /dev/null +++ b/core/wiki/config/BitmapEditorImageSizes.tid @@ -0,0 +1,3 @@ +title: $:/config/BitmapEditor/ImageSizes + +[[62px 100px]] [[100px 62px]] [[124px 200px]] [[200px 124px]] [[248px 400px]] [[371px 600px]] [[400px 248px]] [[556px 900px]] [[600px 371px]] [[742px 1200px]] [[900px 556px]] [[1200px 742px]] \ No newline at end of file diff --git a/core/wiki/config/BitmapEditorLineWidth.tid b/core/wiki/config/BitmapEditorLineWidth.tid index ba51e732c..bfd979d5f 100644 --- a/core/wiki/config/BitmapEditorLineWidth.tid +++ b/core/wiki/config/BitmapEditorLineWidth.tid @@ -1,3 +1,3 @@ title: $:/config/BitmapEditor/LineWidth -3 \ No newline at end of file +3px \ No newline at end of file diff --git a/core/wiki/config/BitmapEditorLineWidths.tid b/core/wiki/config/BitmapEditorLineWidths.tid new file mode 100644 index 000000000..b44e933cd --- /dev/null +++ b/core/wiki/config/BitmapEditorLineWidths.tid @@ -0,0 +1,3 @@ +title: $:/config/BitmapEditor/LineWidths + +0.25px 0.5px 1px 2px 3px 4px 6px 8px 10px 16px 20px 28px 40px 56px 80px \ No newline at end of file diff --git a/core/wiki/config/BitmapEditorOpacities.tid b/core/wiki/config/BitmapEditorOpacities.tid new file mode 100644 index 000000000..a9b7e251e --- /dev/null +++ b/core/wiki/config/BitmapEditorOpacities.tid @@ -0,0 +1,3 @@ +title: $:/config/BitmapEditor/Opacities + +0.01 0.025 0.05 0.075 0.1 0.15 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0 \ No newline at end of file diff --git a/core/wiki/config/BitmapEditorOpacity.tid b/core/wiki/config/BitmapEditorOpacity.tid new file mode 100644 index 000000000..9abdc4c5f --- /dev/null +++ b/core/wiki/config/BitmapEditorOpacity.tid @@ -0,0 +1,3 @@ +title: $:/config/BitmapEditor/Opacity + +1.0 \ No newline at end of file diff --git a/core/wiki/config/EditorToolbarButtons.multids b/core/wiki/config/EditorToolbarButtons.multids new file mode 100644 index 000000000..a80583d7d --- /dev/null +++ b/core/wiki/config/EditorToolbarButtons.multids @@ -0,0 +1,5 @@ +title: $:/config/EditorToolbarButtons/Visibility/$:/ + +core/ui/EditorToolbar/heading-4: hide +core/ui/EditorToolbar/heading-5: hide +core/ui/EditorToolbar/heading-6: hide diff --git a/core/wiki/config/MissingLinks.tid b/core/wiki/config/MissingLinks.tid new file mode 100644 index 000000000..99944224f --- /dev/null +++ b/core/wiki/config/MissingLinks.tid @@ -0,0 +1,2 @@ +title: $:/config/MissingLinks +text: yes diff --git a/core/wiki/config/OfficialPluginLibrary.tid b/core/wiki/config/OfficialPluginLibrary.tid index e4bfbc02c..78e513137 100644 --- a/core/wiki/config/OfficialPluginLibrary.tid +++ b/core/wiki/config/OfficialPluginLibrary.tid @@ -1,6 +1,6 @@ title: $:/config/OfficialPluginLibrary tags: $:/tags/PluginLibrary -url: http://tiddlywiki.com/library/v5.1.9/index.html +url: http://tiddlywiki.com/library/v5.1.13/index.html caption: {{$:/language/OfficialPluginLibrary}} {{$:/language/OfficialPluginLibrary/Hint}} diff --git a/core/wiki/config/PageControlButtons.multids b/core/wiki/config/PageControlButtons.multids index 393898551..9086e8f18 100644 --- a/core/wiki/config/PageControlButtons.multids +++ b/core/wiki/config/PageControlButtons.multids @@ -13,8 +13,10 @@ core/ui/Buttons/language: hide core/ui/Buttons/tag-manager: hide core/ui/Buttons/more-page-actions: hide core/ui/Buttons/new-journal: hide +core/ui/Buttons/new-image: hide core/ui/Buttons/palette: hide core/ui/Buttons/permaview: hide +core/ui/Buttons/print: hide core/ui/Buttons/storyview: hide core/ui/Buttons/theme: hide core/ui/Buttons/unfold-all: hide diff --git a/core/wiki/config/SearchMinLength.tid b/core/wiki/config/SearchMinLength.tid new file mode 100644 index 000000000..16acd5579 --- /dev/null +++ b/core/wiki/config/SearchMinLength.tid @@ -0,0 +1,3 @@ +title: $:/config/Search/MinLength + +3 \ No newline at end of file diff --git a/core/wiki/config/ShortcutInfo.multids b/core/wiki/config/ShortcutInfo.multids new file mode 100644 index 000000000..8cd3c488f --- /dev/null +++ b/core/wiki/config/ShortcutInfo.multids @@ -0,0 +1,26 @@ +title: $:/config/ShortcutInfo/ + +bold: {{$:/language/Buttons/Bold/Hint}} +cancel-edit-tiddler: {{$:/language/Buttons/Cancel/Hint}} +excise: {{$:/language/Buttons/Excise/Hint}} +heading-1: {{$:/language/Buttons/Heading1/Hint}} +heading-2: {{$:/language/Buttons/Heading2/Hint}} +heading-3: {{$:/language/Buttons/Heading3/Hint}} +heading-4: {{$:/language/Buttons/Heading4/Hint}} +heading-5: {{$:/language/Buttons/Heading5/Hint}} +heading-6: {{$:/language/Buttons/Heading6/Hint}} +italic: {{$:/language/Buttons/Italic/Hint}} +link: {{$:/language/Buttons/Link/Hint}} +list-bullet: {{$:/language/Buttons/ListBullet/Hint}} +list-number: {{$:/language/Buttons/ListNumber/Hint}} +mono-block: {{$:/language/Buttons/MonoBlock/Hint}} +mono-line: {{$:/language/Buttons/MonoLine/Hint}} +picture: {{$:/language/Buttons/Picture/Hint}} +preview: {{$:/language/Buttons/Preview/Hint}} +quote: {{$:/language/Buttons/Quote/Hint}} +save-tiddler: {{$:/language/Buttons/Save/Hint}} +stamp: {{$:/language/Buttons/Stamp/Hint}} +strikethrough: {{$:/language/Buttons/Strikethrough/Hint}} +subscript: {{$:/language/Buttons/Subscript/Hint}} +superscript: {{$:/language/Buttons/Superscript/Hint}} +underline: {{$:/language/Buttons/Underline/Hint}} diff --git a/core/wiki/config/TextEditorEditorHeightHeight.tid b/core/wiki/config/TextEditorEditorHeightHeight.tid new file mode 100644 index 000000000..208b2b3a7 --- /dev/null +++ b/core/wiki/config/TextEditorEditorHeightHeight.tid @@ -0,0 +1,3 @@ +title: $:/config/TextEditor/EditorHeight/Height + +400px \ No newline at end of file diff --git a/core/wiki/config/TextEditorEditorHeightMode.tid b/core/wiki/config/TextEditorEditorHeightMode.tid new file mode 100644 index 000000000..09449ffa2 --- /dev/null +++ b/core/wiki/config/TextEditorEditorHeightMode.tid @@ -0,0 +1,3 @@ +title: $:/config/TextEditor/EditorHeight/Mode + +auto \ No newline at end of file diff --git a/core/wiki/config/shortcuts/cancel-edit-tiddler.tid b/core/wiki/config/shortcuts/cancel-edit-tiddler.tid deleted file mode 100644 index dbb09ad0f..000000000 --- a/core/wiki/config/shortcuts/cancel-edit-tiddler.tid +++ /dev/null @@ -1,3 +0,0 @@ -title: $:/config/shortcuts/cancel-edit-tiddler - -escape \ No newline at end of file diff --git a/core/wiki/config/shortcuts/save-tiddler.tid b/core/wiki/config/shortcuts/save-tiddler.tid deleted file mode 100644 index da80be94c..000000000 --- a/core/wiki/config/shortcuts/save-tiddler.tid +++ /dev/null @@ -1,3 +0,0 @@ -title: $:/config/shortcuts/save-tiddler - -ctrl+enter \ No newline at end of file diff --git a/core/wiki/config/shortcuts/shortcuts-linux.multids b/core/wiki/config/shortcuts/shortcuts-linux.multids new file mode 100644 index 000000000..4fb8cb5fc --- /dev/null +++ b/core/wiki/config/shortcuts/shortcuts-linux.multids @@ -0,0 +1,2 @@ +title: $:/config/shortcuts-linux/ + diff --git a/core/wiki/config/shortcuts/shortcuts-mac.multids b/core/wiki/config/shortcuts/shortcuts-mac.multids new file mode 100644 index 000000000..adf3f8bd2 --- /dev/null +++ b/core/wiki/config/shortcuts/shortcuts-mac.multids @@ -0,0 +1,5 @@ +title: $:/config/shortcuts-mac/ + +bold: meta-B +italic: meta-I +underline: meta-U diff --git a/core/wiki/config/shortcuts/shortcuts-not-linux.multids b/core/wiki/config/shortcuts/shortcuts-not-linux.multids new file mode 100644 index 000000000..e0a175ec4 --- /dev/null +++ b/core/wiki/config/shortcuts/shortcuts-not-linux.multids @@ -0,0 +1,2 @@ +title: $:/config/shortcuts-not-linux/ + diff --git a/core/wiki/config/shortcuts/shortcuts-not-mac.multids b/core/wiki/config/shortcuts/shortcuts-not-mac.multids new file mode 100644 index 000000000..3d7e3a2d8 --- /dev/null +++ b/core/wiki/config/shortcuts/shortcuts-not-mac.multids @@ -0,0 +1,5 @@ +title: $:/config/shortcuts-not-mac/ + +bold: ctrl-B +italic: ctrl-I +underline: ctrl-U diff --git a/core/wiki/config/shortcuts/shortcuts-not-windows.multids b/core/wiki/config/shortcuts/shortcuts-not-windows.multids new file mode 100644 index 000000000..5a80888c5 --- /dev/null +++ b/core/wiki/config/shortcuts/shortcuts-not-windows.multids @@ -0,0 +1,2 @@ +title: $:/config/shortcuts-not-windows/ + diff --git a/core/wiki/config/shortcuts/shortcuts-windows.multids b/core/wiki/config/shortcuts/shortcuts-windows.multids new file mode 100644 index 000000000..45f0db02b --- /dev/null +++ b/core/wiki/config/shortcuts/shortcuts-windows.multids @@ -0,0 +1,2 @@ +title: $:/config/shortcuts-windows/ + diff --git a/core/wiki/config/shortcuts/shortcuts.multids b/core/wiki/config/shortcuts/shortcuts.multids new file mode 100644 index 000000000..84503a77b --- /dev/null +++ b/core/wiki/config/shortcuts/shortcuts.multids @@ -0,0 +1,23 @@ +title: $:/config/shortcuts/ + +cancel-edit-tiddler: escape +excise: ctrl-E +heading-1: ctrl-1 +heading-2: ctrl-2 +heading-3: ctrl-3 +heading-4: ctrl-4 +heading-5: ctrl-5 +heading-6: ctrl-6 +link: ctrl-L +list-bullet: ctrl-shift-L +list-number: ctrl-shift-N +mono-block: ctrl-shift-M +mono-line: ctrl-M +picture: ctrl-shift-I +preview: alt-P +quote: ctrl-Q +save-tiddler: ctrl+enter +stamp: ctrl-S +strikethrough: ctrl-T +subscript: ctrl-shift-B +superscript: ctrl-shift-P diff --git a/core/wiki/macros/CSS.tid b/core/wiki/macros/CSS.tid index 7aa5a2b51..1b7c35eff 100644 --- a/core/wiki/macros/CSS.tid +++ b/core/wiki/macros/CSS.tid @@ -51,6 +51,14 @@ background-image: -ms-linear-gradient($gradient$); `` \end +\define column-count(columns) +`` +-moz-column-count: $columns$; +-webkit-column-count: $columns$; +column-count: $columns$; +`` +\end + \define datauri(title) <$macrocall $name="makedatauri" type={{$title$!!type}} text={{$title$}}/> \end diff --git a/core/wiki/macros/colour-picker.tid b/core/wiki/macros/colour-picker.tid new file mode 100644 index 000000000..af74577e3 --- /dev/null +++ b/core/wiki/macros/colour-picker.tid @@ -0,0 +1,55 @@ +title: $:/core/macros/colour-picker +tags: $:/tags/Macro + +\define colour-picker-update-recent() +<$action-listops + $tiddler="$:/config/ColourPicker/Recent" + $subfilter="$(colour-picker-value)$ [list[$:/config/ColourPicker/Recent]remove[$(colour-picker-value)$]] +[limit[8]]" +/> +\end + +\define colour-picker-inner(actions) +<$button tag="a" tooltip="""$(colour-picker-value)$"""> + +$(colour-picker-update-recent)$ + +$actions$ + +
    + + +\end + +\define colour-picker-recent-inner(actions) +<$set name="colour-picker-value" value="$(recentColour)$"> +<$macrocall $name="colour-picker-inner" actions="""$actions$"""/> + +\end + +\define colour-picker-recent(actions) +{{$:/language/ColourPicker/Recent}} <$list filter="[list[$:/config/ColourPicker/Recent]]" variable="recentColour"> +<$macrocall $name="colour-picker-recent-inner" actions="""$actions$"""/> +\end + +\define colour-picker(actions) +
    + +<$macrocall $name="colour-picker-recent" actions="""$actions$"""/> + +--- + +<$list filter="LightPink Pink Crimson LavenderBlush PaleVioletRed HotPink DeepPink MediumVioletRed Orchid Thistle Plum Violet Magenta Fuchsia DarkMagenta Purple MediumOrchid DarkViolet DarkOrchid Indigo BlueViolet MediumPurple MediumSlateBlue SlateBlue DarkSlateBlue Lavender GhostWhite Blue MediumBlue MidnightBlue DarkBlue Navy RoyalBlue CornflowerBlue LightSteelBlue LightSlateGrey SlateGrey DodgerBlue AliceBlue SteelBlue LightSkyBlue SkyBlue DeepSkyBlue LightBlue PowderBlue CadetBlue Azure LightCyan PaleTurquoise Cyan Aqua DarkTurquoise DarkSlateGrey DarkCyan Teal MediumTurquoise LightSeaGreen Turquoise Aquamarine MediumAquamarine MediumSpringGreen MintCream SpringGreen MediumSeaGreen SeaGreen Honeydew LightGreen PaleGreen DarkSeaGreen LimeGreen Lime ForestGreen Green DarkGreen Chartreuse LawnGreen GreenYellow DarkOliveGreen YellowGreen OliveDrab Beige LightGoldenrodYellow Ivory LightYellow Yellow Olive DarkKhaki LemonChiffon PaleGoldenrod Khaki Gold Cornsilk Goldenrod DarkGoldenrod FloralWhite OldLace Wheat Moccasin Orange PapayaWhip BlanchedAlmond NavajoWhite AntiqueWhite Tan BurlyWood Bisque DarkOrange Linen Peru PeachPuff SandyBrown Chocolate SaddleBrown Seashell Sienna LightSalmon Coral OrangeRed DarkSalmon Tomato MistyRose Salmon Snow LightCoral RosyBrown IndianRed Red Brown FireBrick DarkRed Maroon White WhiteSmoke Gainsboro LightGrey Silver DarkGrey Grey DimGrey Black" variable="colour-picker-value"> +<$macrocall $name="colour-picker-inner" actions="""$actions$"""/> + + +--- + +<$edit-text tiddler="$:/config/ColourPicker/New" tag="input" default="" placeholder=""/> +<$edit-text tiddler="$:/config/ColourPicker/New" type="color" tag="input"/> +<$set name="colour-picker-value" value={{$:/config/ColourPicker/New}}> +<$macrocall $name="colour-picker-inner" actions="""$actions$"""/> + + +
    + +\end diff --git a/core/wiki/macros/image-picker.tid b/core/wiki/macros/image-picker.tid new file mode 100644 index 000000000..68bbba34d --- /dev/null +++ b/core/wiki/macros/image-picker.tid @@ -0,0 +1,26 @@ +title: $:/core/macros/image-picker +tags: $:/tags/Macro + +\define image-picker-inner(actions) +<$button tag="a" tooltip="""$(imageTitle)$"""> + +$actions$ + +<$transclude tiddler=<>/> + + +\end + +\define image-picker(actions,subfilter:"") +
    + +<$list filter="[all[shadows+tiddlers]is[image]$subfilter$!has[draft.of]] -[type[application/pdf]] +[sort[title]]" variable="imageTitle"> + +<$macrocall $name="image-picker-inner" actions="""$actions$"""/> + + + +
    + +\end + diff --git a/core/wiki/macros/toc.tid b/core/wiki/macros/toc.tid index 1be085ee9..75431c575 100644 --- a/core/wiki/macros/toc.tid +++ b/core/wiki/macros/toc.tid @@ -31,7 +31,7 @@ tags: $:/tags/Macro \end \define toc-linked-expandable-body(tag,sort:"",itemClassFilter) -<$set name="toc-state" value=<>> +<$set name="toc-state" value=<>> <$set name="toc-item-class" filter="""$itemClassFilter$""" value="toc-item-selected" emptyValue="toc-item">
  • >> <$link> @@ -56,7 +56,7 @@ tags: $:/tags/Macro \end \define toc-unlinked-expandable-body(tag,sort:"",itemClassFilter) -<$set name="toc-state" value=<>> +<$set name="toc-state" value=<>> <$set name="toc-item-class" filter="""$itemClassFilter$""" value="toc-item-selected" emptyValue="toc-item">
  • >> <$reveal type="nomatch" state=<> text="open"> @@ -79,18 +79,24 @@ tags: $:/tags/Macro \end +\define toc-expandable-empty-message() +<> +\end + \define toc-expandable(tag,sort:"",itemClassFilter) +<$vars tag="""$tag$""" sort="""$sort$""" itemClassFilter="""$itemClassFilter$""">
      <$list filter="[all[shadows+tiddlers]tag[$tag$]!has[draft.of]$sort$]"> -<$list filter="[all[current]toc-link[no]]" emptyMessage="<>"> +<$list filter="[all[current]toc-link[no]]" emptyMessage=<>> <>
    + \end \define toc-linked-selective-expandable-body(tag,sort:"",itemClassFilter) -<$set name="toc-state" value=<>> +<$set name="toc-state" value=<>> <$set name="toc-item-class" filter="""$itemClassFilter$""" value="toc-item-selected" emptyValue="toc-item">
  • >> <$link> @@ -117,7 +123,7 @@ tags: $:/tags/Macro \end \define toc-unlinked-selective-expandable-body(tag,sort:"",itemClassFilter) -<$set name="toc-state" value=<>> +<$set name="toc-state" value=<>> <$set name="toc-item-class" filter="""$itemClassFilter$""" value="toc-item-selected" emptyValue="toc-item">
  • >> <$list filter="[all[current]tagging[]limit[1]]" variable="ignore" emptyMessage="<$button class='tc-btn-invisible'>{{$:/core/images/blank}} <$view field='caption'><$view field='title'/>"> @@ -142,14 +148,20 @@ tags: $:/tags/Macro \end +\define toc-selective-expandable-empty-message() +<> +\end + \define toc-selective-expandable(tag,sort:"",itemClassFilter) +<$vars tag="""$tag$""" sort="""$sort$""" itemClassFilter="""$itemClassFilter$""">
      <$list filter="[all[shadows+tiddlers]tag[$tag$]!has[draft.of]$sort$]"> -<$list filter="[all[current]toc-link[no]]" variable="ignore" emptyMessage="<>"> +<$list filter="[all[current]toc-link[no]]" variable="ignore" emptyMessage=<>> <>
    + \end \define toc-tabbed-selected-item-filter(selectedTiddler) diff --git a/core/wiki/macros/translink.tid b/core/wiki/macros/translink.tid new file mode 100644 index 000000000..4c5018673 --- /dev/null +++ b/core/wiki/macros/translink.tid @@ -0,0 +1,15 @@ +title: $:/core/macros/translink +tags: $:/tags/Macro + +\define translink(title,mode:"block") +
    +<$link to="""$title$"""> +<$text text="""$title$"""/> + +
    +<$transclude tiddler="""$title$""" mode="$mode$"> +"<$text text="""$title$"""/>" is missing + +
    +
    +\end diff --git a/core/wiki/tags/AdvancedSearchFilterButton.tid b/core/wiki/tags/AdvancedSearchFilterButton.tid new file mode 100644 index 000000000..74d38bdc2 --- /dev/null +++ b/core/wiki/tags/AdvancedSearchFilterButton.tid @@ -0,0 +1,2 @@ +title: $:/tags/AdvancedSearch/FilterButton +list: $:/core/ui/AdvancedSearch/Filter/FilterButtons/dropdown $:/core/ui/AdvancedSearch/Filter/FilterButtons/clear $:/core/ui/AdvancedSearch/Filter/FilterButtons/export $:/core/ui/AdvancedSearch/Filter/FilterButtons/delete diff --git a/core/wiki/tags/EditorToolbar.tid b/core/wiki/tags/EditorToolbar.tid new file mode 100644 index 000000000..4611721ea --- /dev/null +++ b/core/wiki/tags/EditorToolbar.tid @@ -0,0 +1,2 @@ +title: $:/tags/EditorToolbar +list: $:/core/ui/EditorToolbar/paint $:/core/ui/EditorToolbar/opacity $:/core/ui/EditorToolbar/line-width $:/core/ui/EditorToolbar/clear $:/core/ui/EditorToolbar/bold $:/core/ui/EditorToolbar/italic $:/core/ui/EditorToolbar/strikethrough $:/core/ui/EditorToolbar/underline $:/core/ui/EditorToolbar/superscript $:/core/ui/EditorToolbar/subscript $:/core/ui/EditorToolbar/mono-line $:/core/ui/EditorToolbar/mono-block $:/core/ui/EditorToolbar/quote $:/core/ui/EditorToolbar/list-bullet $:/core/ui/EditorToolbar/list-number $:/core/ui/EditorToolbar/heading-1 $:/core/ui/EditorToolbar/heading-2 $:/core/ui/EditorToolbar/heading-3 $:/core/ui/EditorToolbar/heading-4 $:/core/ui/EditorToolbar/heading-5 $:/core/ui/EditorToolbar/heading-6 $:/core/ui/EditorToolbar/link $:/core/ui/EditorToolbar/excise $:/core/ui/EditorToolbar/picture $:/core/ui/EditorToolbar/stamp $:/core/ui/EditorToolbar/size $:/core/ui/EditorToolbar/editor-height $:/core/ui/EditorToolbar/more $:/core/ui/EditorToolbar/preview $:/core/ui/EditorToolbar/preview-type diff --git a/core/wiki/tags/MoreSideBar.tid b/core/wiki/tags/MoreSideBar.tid index b7f17dace..2dc0adb53 100644 --- a/core/wiki/tags/MoreSideBar.tid +++ b/core/wiki/tags/MoreSideBar.tid @@ -1,3 +1,3 @@ title: $:/tags/MoreSideBar -list: [[$:/core/ui/MoreSideBar/All]] [[$:/core/ui/MoreSideBar/Recent]] [[$:/core/ui/MoreSideBar/Tags]] [[$:/core/ui/MoreSideBar/Missing]] [[$:/core/ui/MoreSideBar/Drafts]] [[$:/core/ui/MoreSideBar/Orphans]] [[$:/core/ui/MoreSideBar/Types]] [[$:/core/ui/MoreSideBar/System]] [[$:/core/ui/MoreSideBar/Shadows]] +list: [[$:/core/ui/MoreSideBar/All]] [[$:/core/ui/MoreSideBar/Recent]] [[$:/core/ui/MoreSideBar/Tags]] [[$:/core/ui/MoreSideBar/Missing]] [[$:/core/ui/MoreSideBar/Drafts]] [[$:/core/ui/MoreSideBar/Orphans]] [[$:/core/ui/MoreSideBar/Types]] [[$:/core/ui/MoreSideBar/System]] [[$:/core/ui/MoreSideBar/Shadows]] [[$:/core/ui/MoreSideBar/Plugins]] diff --git a/core/wiki/tags/PageControls.tid b/core/wiki/tags/PageControls.tid index 9ed29e911..3bef09b7d 100644 --- a/core/wiki/tags/PageControls.tid +++ b/core/wiki/tags/PageControls.tid @@ -1,2 +1,2 @@ title: $:/tags/PageControls -list: [[$:/core/ui/Buttons/home]] [[$:/core/ui/Buttons/close-all]] [[$:/core/ui/Buttons/fold-all]] [[$:/core/ui/Buttons/unfold-all]] [[$:/core/ui/Buttons/permaview]] [[$:/core/ui/Buttons/new-tiddler]] [[$:/core/ui/Buttons/new-journal]] [[$:/core/ui/Buttons/import]] [[$:/core/ui/Buttons/export-page]] [[$:/core/ui/Buttons/control-panel]] [[$:/core/ui/Buttons/advanced-search]] [[$:/core/ui/Buttons/tag-manager]] [[$:/core/ui/Buttons/language]] [[$:/core/ui/Buttons/palette]] [[$:/core/ui/Buttons/theme]] [[$:/core/ui/Buttons/storyview]] [[$:/core/ui/Buttons/encryption]] [[$:/core/ui/Buttons/full-screen]] [[$:/core/ui/Buttons/save-wiki]] [[$:/core/ui/Buttons/refresh]] [[$:/core/ui/Buttons/more-page-actions]] +list: [[$:/core/ui/Buttons/home]] [[$:/core/ui/Buttons/close-all]] [[$:/core/ui/Buttons/fold-all]] [[$:/core/ui/Buttons/unfold-all]] [[$:/core/ui/Buttons/permaview]] [[$:/core/ui/Buttons/new-tiddler]] [[$:/core/ui/Buttons/new-journal]] [[$:/core/ui/Buttons/new-image]] [[$:/core/ui/Buttons/import]] [[$:/core/ui/Buttons/export-page]] [[$:/core/ui/Buttons/control-panel]] [[$:/core/ui/Buttons/advanced-search]] [[$:/core/ui/Buttons/tag-manager]] [[$:/core/ui/Buttons/language]] [[$:/core/ui/Buttons/palette]] [[$:/core/ui/Buttons/theme]] [[$:/core/ui/Buttons/storyview]] [[$:/core/ui/Buttons/encryption]] [[$:/core/ui/Buttons/full-screen]] [[$:/core/ui/Buttons/save-wiki]] [[$:/core/ui/Buttons/refresh]] [[$:/core/ui/Buttons/more-page-actions]] diff --git a/editions/de-AT-server/tiddlywiki.info b/editions/de-AT-server/tiddlywiki.info index 59780efac..12c109150 100644 --- a/editions/de-AT-server/tiddlywiki.info +++ b/editions/de-AT-server/tiddlywiki.info @@ -2,7 +2,8 @@ "description": "Server configuration of the German (Österreich) edition", "plugins": [ "tiddlywiki/tiddlyweb", - "tiddlywiki/filesystem" + "tiddlywiki/filesystem", + "tiddlywiki/highlight" ], "themes": [ "tiddlywiki/vanilla", diff --git a/editions/de-AT/tiddlywiki.info b/editions/de-AT/tiddlywiki.info index a04bf3087..57d062d9a 100755 --- a/editions/de-AT/tiddlywiki.info +++ b/editions/de-AT/tiddlywiki.info @@ -5,9 +5,10 @@ "themes": [ "tiddlywiki/vanilla", "tiddlywiki/snowwhite", - "tiddlywiki/nighttime", "tiddlywiki/starlight", + "tiddlywiki/seamless", "tiddlywiki/centralised", + "tiddlywiki/tight", "tiddlywiki/readonly" ], "languages": [ @@ -19,7 +20,8 @@ "index": [ "--rendertiddler","$:/core/save/all","index.html","text/plain"], "empty": [ - "--rendertiddler","$:/editions/de-AT-DE/download-empty","empty.html","text/plain"], + "--rendertiddler","$:/editions/de-AT-DE/download-empty","empty.html","text/plain", + "--rendertiddler","$:/editions/de-AT-DE/download-empty","empty.hta","text/plain"], "favicon": [ "--savetiddler","$:/favicon.ico","favicon.ico"], "static": [ @@ -28,4 +30,4 @@ "--rendertiddlers","[!is[system]]","$:/core/templates/static.tiddler.html","static","text/plain", "--rendertiddler","$:/core/templates/static.template.css","static/static.css","text/plain"] } -} +} \ No newline at end of file diff --git a/editions/de-DE/tiddlywiki.info b/editions/de-DE/tiddlywiki.info index 25c8e32ca..6138d40bb 100755 --- a/editions/de-DE/tiddlywiki.info +++ b/editions/de-DE/tiddlywiki.info @@ -5,9 +5,10 @@ "themes": [ "tiddlywiki/vanilla", "tiddlywiki/snowwhite", - "tiddlywiki/nighttime", "tiddlywiki/starlight", + "tiddlywiki/seamless", "tiddlywiki/centralised", + "tiddlywiki/tight", "tiddlywiki/readonly" ], "languages": [ @@ -22,7 +23,8 @@ "index": [ "--rendertiddler","$:/core/save/all","index.html","text/plain"], "empty": [ - "--rendertiddler","$:/editions/de-AT-DE/download-empty","empty.html","text/plain"], + "--rendertiddler","$:/editions/de-AT-DE/download-empty","empty.html","text/plain", + "--rendertiddler","$:/editions/de-AT-DE/download-empty","empty.hta","text/plain"], "favicon": [ "--savetiddler","$:/favicon.ico","favicon.ico"], "static": [ @@ -31,4 +33,4 @@ "--rendertiddlers","[!is[system]]","$:/core/templates/static.tiddler.html","static","text/plain", "--rendertiddler","$:/core/templates/static.template.css","static/static.css","text/plain"] } -} +} \ No newline at end of file diff --git a/editions/dev/tiddlers/from Heigele and Jurke/Data Management during Runtime.tid b/editions/dev/tiddlers/from Heigele and Jurke/Data Management during Runtime.tid index 80863bc56..dd746d45c 100644 --- a/editions/dev/tiddlers/from Heigele and Jurke/Data Management during Runtime.tid +++ b/editions/dev/tiddlers/from Heigele and Jurke/Data Management during Runtime.tid @@ -3,7 +3,7 @@ modified: 20140708085602231 tags: doc title: Data Management during Runtime -During the runtime the data of Tiddlywiki is stored in javascript objects. These objects are synchronized with the DOM-Representation of Tiddlywiki. This means every change of the original data of a Tiddler, fires an event which changes all DOM-Representations of the Tiddler and the javascript object. The barbone Wiki store is created during the boot process and is kept in a object called \$tw.Wiki. This object contains amongst others a hashmap of the different Tiddlers of Tiddlywiki. The Hashmap is used to store the javascript object representation of the different Tiddlers. Furthermore this object is used to manage the tiddlers during runtime, it provides methods for adding tiddlers, search tiddlers by name and delete tiddlers. +During the runtime the data of Tiddlywiki is stored in javascript objects. These objects are synchronized with the DOM-Representation of Tiddlywiki. This means every change of the original data of a Tiddler, fires an event which changes all DOM-Representations of the Tiddler and the javascript object. The bare-bones Wiki store is created during the boot process and is kept in a object called \$tw.Wiki. This object contains amongst others a hashmap of the different Tiddlers of Tiddlywiki. The Hashmap is used to store the javascript object representation of the different Tiddlers. Furthermore this object is used to manage the tiddlers during runtime, it provides methods for adding tiddlers, search tiddlers by name and delete tiddlers. As shown in the picture below, every change at the DOM triggers an event which changes the corresponding widget which again changes the store of the tiddlers. The whole image shows how WikiText is parsed by a set of rules into the parse tree and this parse tree is rendered as a tree of widgets. This Rendertree is synchronised to the DOM. Every modification on the Rendertree provokes a start of the rendering-pipeline. As well as every change on the wikiText triggers an event at the RenderTree. This Process uses a selective updating so that only the changed parts are updated. This means only widgets which have to change the DOM in consequence of a changed tiddler are refreshed. {{TiddlyWikiArchitecture.svg}} \ No newline at end of file diff --git a/editions/dev/tiddlers/from Heigele and Jurke/Microkernel and Datamodel.tid b/editions/dev/tiddlers/from Heigele and Jurke/Microkernel and Datamodel.tid index 3e13539ba..3a5461b90 100644 --- a/editions/dev/tiddlers/from Heigele and Jurke/Microkernel and Datamodel.tid +++ b/editions/dev/tiddlers/from Heigele and Jurke/Microkernel and Datamodel.tid @@ -3,7 +3,7 @@ modified: 20140709093651688 tags: redo title: Microkernel and Datamodel -The microkernel is responsible for creating a barbone TW environment. -It is running under Node.js or in a HTML5 Browser. The Bootkernel just loads enough functionality to load the modules containing the main logic of the application. This boot-kernel contains a few helper methods, the module mechanism as well as the function to create a tiddler and manage them. The boot-kernel also creates the barbone wiki store, which holds all the information of the wiki during the runtime. After creating the store, the boot-kernel is in charge of decrypting the encrypted tiddlers and extracting all the tiddlers e.g. the core module tiddlers embedded in the DOM structure of the HTML file. Furthermore the boot kernel offers the functionality to load tiddlers from a file, when you run TW with Node.js. +The microkernel is responsible for creating a bare-bones TW environment. +It is running under Node.js or in a HTML5 Browser. The Bootkernel just loads enough functionality to load the modules containing the main logic of the application. This boot-kernel contains a few helper methods, the module mechanism as well as the function to create a tiddler and manage them. The boot-kernel also creates the bare-bones wiki store, which holds all the information of the wiki during the runtime. After creating the store, the boot-kernel is in charge of decrypting the encrypted tiddlers and extracting all the tiddlers e.g. the core module tiddlers embedded in the DOM structure of the HTML file. Furthermore the boot kernel offers the functionality to load tiddlers from a file, when you run TW with Node.js. {{StartupTimeline.png}} \ No newline at end of file diff --git a/editions/dev/tiddlers/from Heigele and Jurke/The Heart of TiddlyWiki Boot-Kernel.tid b/editions/dev/tiddlers/from Heigele and Jurke/The Heart of TiddlyWiki Boot-Kernel.tid index 484e6bec6..ef0ad4deb 100644 --- a/editions/dev/tiddlers/from Heigele and Jurke/The Heart of TiddlyWiki Boot-Kernel.tid +++ b/editions/dev/tiddlers/from Heigele and Jurke/The Heart of TiddlyWiki Boot-Kernel.tid @@ -3,6 +3,6 @@ modified: 20140708090217085 tags: doc title: The Heart of TiddlyWiki (Boot-Kernel) -The boot-kernel is responsible for creating a barbone TW environment. It is running under Node.js or in a HTML5 Browser. The Bootkernel just loads enough functionality to load the modules containing the main logic of the application. This boot-kernel contains a few helper methods, the module mechanism as well as the function to create a tiddler and manage them. The boot-kernel also creates the barbone wiki store, which holds all the information of the wiki during the runtime. After creating the store, the boot-kernel is in charge of decrypting the encrypted tiddlers and extracting all the tiddlers e.g. the core module tiddlers embedded in the DOM structure of the HTML file. Furthermore the boot kernel offers the functionality to load tiddlers from a file, when you run TW with Node.js. All other functionality which is not a part of the boot kernel is added dynamically by modules and plugins. The boot kernel is able to load the core plugins and perform the startup plugins. The core contains the startup modules shown in the picture below. +The boot-kernel is responsible for creating a bare-bones TW environment. It is running under Node.js or in a HTML5 Browser. The Bootkernel just loads enough functionality to load the modules containing the main logic of the application. This boot-kernel contains a few helper methods, the module mechanism as well as the function to create a tiddler and manage them. The boot-kernel also creates the bare-bones wiki store, which holds all the information of the wiki during the runtime. After creating the store, the boot-kernel is in charge of decrypting the encrypted tiddlers and extracting all the tiddlers e.g. the core module tiddlers embedded in the DOM structure of the HTML file. Furthermore the boot kernel offers the functionality to load tiddlers from a file, when you run TW with Node.js. All other functionality which is not a part of the boot kernel is added dynamically by modules and plugins. The boot kernel is able to load the core plugins and perform the startup plugins. The core contains the startup modules shown in the picture below. {{index.svg}} \ No newline at end of file diff --git a/editions/dev/tiddlers/from tw5.com/How to customise the password prompt.tid b/editions/dev/tiddlers/from tw5.com/How to customise the password prompt.tid index 53eb35433..3848cdfca 100644 --- a/editions/dev/tiddlers/from tw5.com/How to customise the password prompt.tid +++ b/editions/dev/tiddlers/from tw5.com/How to customise the password prompt.tid @@ -5,11 +5,11 @@ modified: 20141006085526118 You can customise the text and appearance of the password prompt that is displayed when encrypted TiddlyWiki files are first opened. -To do so, create a tiddler tagged {{$:/core/wiki/rawmarkup|$:/core/ui/TagTemplate}} containing: +To do so, create a tiddler tagged {{$:/core/wiki/rawmarkup||$:/core/ui/TagTemplate}} containing: # A JavaScript ` + + ``` #### In-browser rendering diff --git a/plugins/tiddlywiki/katex/files/katex.min.css b/plugins/tiddlywiki/katex/files/katex.min.css index 408409dca..47dd09dab 100644 --- a/plugins/tiddlywiki/katex/files/katex.min.css +++ b/plugins/tiddlywiki/katex/files/katex.min.css @@ -1 +1 @@ -@font-face{font-family:KaTeX_AMS;src:url(fonts/KaTeX_AMS-Regular.eot);src:url(fonts/KaTeX_AMS-Regular.eot#iefix) format('embedded-opentype'),url(fonts/KaTeX_AMS-Regular.woff2) format('woff2'),url(fonts/KaTeX_AMS-Regular.woff) format('woff'),url(fonts/KaTeX_AMS-Regular.ttf) format('ttf');font-weight:400;font-style:normal}@font-face{font-family:KaTeX_Caligraphic;src:url(fonts/KaTeX_Caligraphic-Bold.eot);src:url(fonts/KaTeX_Caligraphic-Bold.eot#iefix) format('embedded-opentype'),url(fonts/KaTeX_Caligraphic-Bold.woff2) format('woff2'),url(fonts/KaTeX_Caligraphic-Bold.woff) format('woff'),url(fonts/KaTeX_Caligraphic-Bold.ttf) format('ttf');font-weight:700;font-style:normal}@font-face{font-family:KaTeX_Caligraphic;src:url(fonts/KaTeX_Caligraphic-Regular.eot);src:url(fonts/KaTeX_Caligraphic-Regular.eot#iefix) format('embedded-opentype'),url(fonts/KaTeX_Caligraphic-Regular.woff2) format('woff2'),url(fonts/KaTeX_Caligraphic-Regular.woff) format('woff'),url(fonts/KaTeX_Caligraphic-Regular.ttf) format('ttf');font-weight:400;font-style:normal}@font-face{font-family:KaTeX_Fraktur;src:url(fonts/KaTeX_Fraktur-Bold.eot);src:url(fonts/KaTeX_Fraktur-Bold.eot#iefix) format('embedded-opentype'),url(fonts/KaTeX_Fraktur-Bold.woff2) format('woff2'),url(fonts/KaTeX_Fraktur-Bold.woff) format('woff'),url(fonts/KaTeX_Fraktur-Bold.ttf) format('ttf');font-weight:700;font-style:normal}@font-face{font-family:KaTeX_Fraktur;src:url(fonts/KaTeX_Fraktur-Regular.eot);src:url(fonts/KaTeX_Fraktur-Regular.eot#iefix) format('embedded-opentype'),url(fonts/KaTeX_Fraktur-Regular.woff2) format('woff2'),url(fonts/KaTeX_Fraktur-Regular.woff) format('woff'),url(fonts/KaTeX_Fraktur-Regular.ttf) format('ttf');font-weight:400;font-style:normal}@font-face{font-family:KaTeX_Main;src:url(fonts/KaTeX_Main-Bold.eot);src:url(fonts/KaTeX_Main-Bold.eot#iefix) format('embedded-opentype'),url(fonts/KaTeX_Main-Bold.woff2) format('woff2'),url(fonts/KaTeX_Main-Bold.woff) format('woff'),url(fonts/KaTeX_Main-Bold.ttf) format('ttf');font-weight:700;font-style:normal}@font-face{font-family:KaTeX_Main;src:url(fonts/KaTeX_Main-Italic.eot);src:url(fonts/KaTeX_Main-Italic.eot#iefix) format('embedded-opentype'),url(fonts/KaTeX_Main-Italic.woff2) format('woff2'),url(fonts/KaTeX_Main-Italic.woff) format('woff'),url(fonts/KaTeX_Main-Italic.ttf) format('ttf');font-weight:400;font-style:italic}@font-face{font-family:KaTeX_Main;src:url(fonts/KaTeX_Main-Regular.eot);src:url(fonts/KaTeX_Main-Regular.eot#iefix) format('embedded-opentype'),url(fonts/KaTeX_Main-Regular.woff2) format('woff2'),url(fonts/KaTeX_Main-Regular.woff) format('woff'),url(fonts/KaTeX_Main-Regular.ttf) format('ttf');font-weight:400;font-style:normal}@font-face{font-family:KaTeX_Math;src:url(fonts/KaTeX_Math-Italic.eot);src:url(fonts/KaTeX_Math-Italic.eot#iefix) format('embedded-opentype'),url(fonts/KaTeX_Math-Italic.woff2) format('woff2'),url(fonts/KaTeX_Math-Italic.woff) format('woff'),url(fonts/KaTeX_Math-Italic.ttf) format('ttf');font-weight:400;font-style:italic}@font-face{font-family:KaTeX_SansSerif;src:url(fonts/KaTeX_SansSerif-Regular.eot);src:url(fonts/KaTeX_SansSerif-Regular.eot#iefix) format('embedded-opentype'),url(fonts/KaTeX_SansSerif-Regular.woff2) format('woff2'),url(fonts/KaTeX_SansSerif-Regular.woff) format('woff'),url(fonts/KaTeX_SansSerif-Regular.ttf) format('ttf');font-weight:400;font-style:normal}@font-face{font-family:KaTeX_Script;src:url(fonts/KaTeX_Script-Regular.eot);src:url(fonts/KaTeX_Script-Regular.eot#iefix) format('embedded-opentype'),url(fonts/KaTeX_Script-Regular.woff2) format('woff2'),url(fonts/KaTeX_Script-Regular.woff) format('woff'),url(fonts/KaTeX_Script-Regular.ttf) format('ttf');font-weight:400;font-style:normal}@font-face{font-family:KaTeX_Size1;src:url(fonts/KaTeX_Size1-Regular.eot);src:url(fonts/KaTeX_Size1-Regular.eot#iefix) format('embedded-opentype'),url(fonts/KaTeX_Size1-Regular.woff2) format('woff2'),url(fonts/KaTeX_Size1-Regular.woff) format('woff'),url(fonts/KaTeX_Size1-Regular.ttf) format('ttf');font-weight:400;font-style:normal}@font-face{font-family:KaTeX_Size2;src:url(fonts/KaTeX_Size2-Regular.eot);src:url(fonts/KaTeX_Size2-Regular.eot#iefix) format('embedded-opentype'),url(fonts/KaTeX_Size2-Regular.woff2) format('woff2'),url(fonts/KaTeX_Size2-Regular.woff) format('woff'),url(fonts/KaTeX_Size2-Regular.ttf) format('ttf');font-weight:400;font-style:normal}@font-face{font-family:KaTeX_Size3;src:url(fonts/KaTeX_Size3-Regular.eot);src:url(fonts/KaTeX_Size3-Regular.eot#iefix) format('embedded-opentype'),url(fonts/KaTeX_Size3-Regular.woff2) format('woff2'),url(fonts/KaTeX_Size3-Regular.woff) format('woff'),url(fonts/KaTeX_Size3-Regular.ttf) format('ttf');font-weight:400;font-style:normal}@font-face{font-family:KaTeX_Size4;src:url(fonts/KaTeX_Size4-Regular.eot);src:url(fonts/KaTeX_Size4-Regular.eot#iefix) format('embedded-opentype'),url(fonts/KaTeX_Size4-Regular.woff2) format('woff2'),url(fonts/KaTeX_Size4-Regular.woff) format('woff'),url(fonts/KaTeX_Size4-Regular.ttf) format('ttf');font-weight:400;font-style:normal}@font-face{font-family:KaTeX_Typewriter;src:url(fonts/KaTeX_Typewriter-Regular.eot);src:url(fonts/KaTeX_Typewriter-Regular.eot#iefix) format('embedded-opentype'),url(fonts/KaTeX_Typewriter-Regular.woff2) format('woff2'),url(fonts/KaTeX_Typewriter-Regular.woff) format('woff'),url(fonts/KaTeX_Typewriter-Regular.ttf) format('ttf');font-weight:400;font-style:normal}.katex-display{display:block;margin:1em 0;text-align:center}.katex-display>.katex{display:inline-block}.katex{font:400 1.21em KaTeX_Main;line-height:1.2;white-space:nowrap;text-indent:0}.katex .katex-html{display:inline-block}.katex .katex-mathml{position:absolute;clip:rect(1px,1px,1px,1px);padding:0;border:0;height:1px;width:1px;overflow:hidden}.katex .base,.katex .strut{display:inline-block}.katex .mathit{font-family:KaTeX_Math;font-style:italic}.katex .mathbf{font-family:KaTeX_Main;font-weight:700}.katex .amsrm,.katex .mathbb{font-family:KaTeX_AMS}.katex .mathcal{font-family:KaTeX_Caligraphic}.katex .mathfrak{font-family:KaTeX_Fraktur}.katex .mathtt{font-family:KaTeX_Typewriter}.katex .mathscr{font-family:KaTeX_Script}.katex .mathsf{font-family:KaTeX_SansSerif}.katex .mainit{font-family:KaTeX_Main;font-style:italic}.katex .textstyle>.mord+.mop{margin-left:.16667em}.katex .textstyle>.mord+.mbin{margin-left:.22222em}.katex .textstyle>.mord+.mrel{margin-left:.27778em}.katex .textstyle>.mop+.mop,.katex .textstyle>.mop+.mord,.katex .textstyle>.mord+.minner{margin-left:.16667em}.katex .textstyle>.mop+.mrel{margin-left:.27778em}.katex .textstyle>.mop+.minner{margin-left:.16667em}.katex .textstyle>.mbin+.minner,.katex .textstyle>.mbin+.mop,.katex .textstyle>.mbin+.mopen,.katex .textstyle>.mbin+.mord{margin-left:.22222em}.katex .textstyle>.mrel+.minner,.katex .textstyle>.mrel+.mop,.katex .textstyle>.mrel+.mopen,.katex .textstyle>.mrel+.mord{margin-left:.27778em}.katex .textstyle>.mclose+.mop{margin-left:.16667em}.katex .textstyle>.mclose+.mbin{margin-left:.22222em}.katex .textstyle>.mclose+.mrel{margin-left:.27778em}.katex .textstyle>.mclose+.minner,.katex .textstyle>.minner+.mop,.katex .textstyle>.minner+.mord,.katex .textstyle>.mpunct+.mclose,.katex .textstyle>.mpunct+.minner,.katex .textstyle>.mpunct+.mop,.katex .textstyle>.mpunct+.mopen,.katex .textstyle>.mpunct+.mord,.katex .textstyle>.mpunct+.mpunct,.katex .textstyle>.mpunct+.mrel{margin-left:.16667em}.katex .textstyle>.minner+.mbin{margin-left:.22222em}.katex .textstyle>.minner+.mrel{margin-left:.27778em}.katex .mclose+.mop,.katex .minner+.mop,.katex .mop+.mop,.katex .mop+.mord,.katex .mord+.mop,.katex .textstyle>.minner+.minner,.katex .textstyle>.minner+.mopen,.katex .textstyle>.minner+.mpunct{margin-left:.16667em}.katex .reset-textstyle.textstyle{font-size:1em}.katex .reset-textstyle.scriptstyle{font-size:.7em}.katex .reset-textstyle.scriptscriptstyle{font-size:.5em}.katex .reset-scriptstyle.textstyle{font-size:1.42857em}.katex .reset-scriptstyle.scriptstyle{font-size:1em}.katex .reset-scriptstyle.scriptscriptstyle{font-size:.71429em}.katex .reset-scriptscriptstyle.textstyle{font-size:2em}.katex .reset-scriptscriptstyle.scriptstyle{font-size:1.4em}.katex .reset-scriptscriptstyle.scriptscriptstyle{font-size:1em}.katex .style-wrap{position:relative}.katex .vlist{display:inline-block}.katex .vlist>span{display:block;height:0;position:relative}.katex .vlist>span>span{display:inline-block}.katex .vlist .baseline-fix{display:inline-table;table-layout:fixed}.katex .msupsub{text-align:left}.katex .mfrac>span>span{text-align:center}.katex .mfrac .frac-line{width:100%}.katex .mfrac .frac-line:before{border-bottom-style:solid;border-bottom-width:1px;content:"";display:block}.katex .mfrac .frac-line:after{border-bottom-style:solid;border-bottom-width:.04em;content:"";display:block;margin-top:-1px}.katex .mspace{display:inline-block}.katex .mspace.negativethinspace{margin-left:-.16667em}.katex .mspace.thinspace{width:.16667em}.katex .mspace.mediumspace{width:.22222em}.katex .mspace.thickspace{width:.27778em}.katex .mspace.enspace{width:.5em}.katex .mspace.quad{width:1em}.katex .mspace.qquad{width:2em}.katex .llap,.katex .rlap{width:0;position:relative}.katex .llap>.inner,.katex .rlap>.inner{position:absolute}.katex .llap>.fix,.katex .rlap>.fix{display:inline-block}.katex .llap>.inner{right:0}.katex .rlap>.inner{left:0}.katex .katex-logo .a{font-size:.75em;margin-left:-.32em;position:relative;top:-.2em}.katex .katex-logo .t{margin-left:-.23em}.katex .katex-logo .e{margin-left:-.1667em;position:relative;top:.2155em}.katex .katex-logo .x{margin-left:-.125em}.katex .rule{display:inline-block;border-style:solid;position:relative}.katex .overline .overline-line{width:100%}.katex .overline .overline-line:before{border-bottom-style:solid;border-bottom-width:1px;content:"";display:block}.katex .overline .overline-line:after{border-bottom-style:solid;border-bottom-width:.04em;content:"";display:block;margin-top:-1px}.katex .sqrt>.sqrt-sign{position:relative}.katex .sqrt .sqrt-line{width:100%}.katex .sqrt .sqrt-line:before{border-bottom-style:solid;border-bottom-width:1px;content:"";display:block}.katex .sqrt .sqrt-line:after{border-bottom-style:solid;border-bottom-width:.04em;content:"";display:block;margin-top:-1px}.katex .sqrt>.root{margin-left:.27777778em;margin-right:-.55555556em}.katex .fontsize-ensurer,.katex .sizing{display:inline-block}.katex .fontsize-ensurer.reset-size1.size1,.katex .sizing.reset-size1.size1{font-size:1em}.katex .fontsize-ensurer.reset-size1.size2,.katex .sizing.reset-size1.size2{font-size:1.4em}.katex .fontsize-ensurer.reset-size1.size3,.katex .sizing.reset-size1.size3{font-size:1.6em}.katex .fontsize-ensurer.reset-size1.size4,.katex .sizing.reset-size1.size4{font-size:1.8em}.katex .fontsize-ensurer.reset-size1.size5,.katex .sizing.reset-size1.size5{font-size:2em}.katex .fontsize-ensurer.reset-size1.size6,.katex .sizing.reset-size1.size6{font-size:2.4em}.katex .fontsize-ensurer.reset-size1.size7,.katex .sizing.reset-size1.size7{font-size:2.88em}.katex .fontsize-ensurer.reset-size1.size8,.katex .sizing.reset-size1.size8{font-size:3.46em}.katex .fontsize-ensurer.reset-size1.size9,.katex .sizing.reset-size1.size9{font-size:4.14em}.katex .fontsize-ensurer.reset-size1.size10,.katex .sizing.reset-size1.size10{font-size:4.98em}.katex .fontsize-ensurer.reset-size2.size1,.katex .sizing.reset-size2.size1{font-size:.71428571em}.katex .fontsize-ensurer.reset-size2.size2,.katex .sizing.reset-size2.size2{font-size:1em}.katex .fontsize-ensurer.reset-size2.size3,.katex .sizing.reset-size2.size3{font-size:1.14285714em}.katex .fontsize-ensurer.reset-size2.size4,.katex .sizing.reset-size2.size4{font-size:1.28571429em}.katex .fontsize-ensurer.reset-size2.size5,.katex .sizing.reset-size2.size5{font-size:1.42857143em}.katex .fontsize-ensurer.reset-size2.size6,.katex .sizing.reset-size2.size6{font-size:1.71428571em}.katex .fontsize-ensurer.reset-size2.size7,.katex .sizing.reset-size2.size7{font-size:2.05714286em}.katex .fontsize-ensurer.reset-size2.size8,.katex .sizing.reset-size2.size8{font-size:2.47142857em}.katex .fontsize-ensurer.reset-size2.size9,.katex .sizing.reset-size2.size9{font-size:2.95714286em}.katex .fontsize-ensurer.reset-size2.size10,.katex .sizing.reset-size2.size10{font-size:3.55714286em}.katex .fontsize-ensurer.reset-size3.size1,.katex .sizing.reset-size3.size1{font-size:.625em}.katex .fontsize-ensurer.reset-size3.size2,.katex .sizing.reset-size3.size2{font-size:.875em}.katex .fontsize-ensurer.reset-size3.size3,.katex .sizing.reset-size3.size3{font-size:1em}.katex .fontsize-ensurer.reset-size3.size4,.katex .sizing.reset-size3.size4{font-size:1.125em}.katex .fontsize-ensurer.reset-size3.size5,.katex .sizing.reset-size3.size5{font-size:1.25em}.katex .fontsize-ensurer.reset-size3.size6,.katex .sizing.reset-size3.size6{font-size:1.5em}.katex .fontsize-ensurer.reset-size3.size7,.katex .sizing.reset-size3.size7{font-size:1.8em}.katex .fontsize-ensurer.reset-size3.size8,.katex .sizing.reset-size3.size8{font-size:2.1625em}.katex .fontsize-ensurer.reset-size3.size9,.katex .sizing.reset-size3.size9{font-size:2.5875em}.katex .fontsize-ensurer.reset-size3.size10,.katex .sizing.reset-size3.size10{font-size:3.1125em}.katex .fontsize-ensurer.reset-size4.size1,.katex .sizing.reset-size4.size1{font-size:.55555556em}.katex .fontsize-ensurer.reset-size4.size2,.katex .sizing.reset-size4.size2{font-size:.77777778em}.katex .fontsize-ensurer.reset-size4.size3,.katex .sizing.reset-size4.size3{font-size:.88888889em}.katex .fontsize-ensurer.reset-size4.size4,.katex .sizing.reset-size4.size4{font-size:1em}.katex .fontsize-ensurer.reset-size4.size5,.katex .sizing.reset-size4.size5{font-size:1.11111111em}.katex .fontsize-ensurer.reset-size4.size6,.katex .sizing.reset-size4.size6{font-size:1.33333333em}.katex .fontsize-ensurer.reset-size4.size7,.katex .sizing.reset-size4.size7{font-size:1.6em}.katex .fontsize-ensurer.reset-size4.size8,.katex .sizing.reset-size4.size8{font-size:1.92222222em}.katex .fontsize-ensurer.reset-size4.size9,.katex .sizing.reset-size4.size9{font-size:2.3em}.katex .fontsize-ensurer.reset-size4.size10,.katex .sizing.reset-size4.size10{font-size:2.76666667em}.katex .fontsize-ensurer.reset-size5.size1,.katex .sizing.reset-size5.size1{font-size:.5em}.katex .fontsize-ensurer.reset-size5.size2,.katex .sizing.reset-size5.size2{font-size:.7em}.katex .fontsize-ensurer.reset-size5.size3,.katex .sizing.reset-size5.size3{font-size:.8em}.katex .fontsize-ensurer.reset-size5.size4,.katex .sizing.reset-size5.size4{font-size:.9em}.katex .fontsize-ensurer.reset-size5.size5,.katex .sizing.reset-size5.size5{font-size:1em}.katex .fontsize-ensurer.reset-size5.size6,.katex .sizing.reset-size5.size6{font-size:1.2em}.katex .fontsize-ensurer.reset-size5.size7,.katex .sizing.reset-size5.size7{font-size:1.44em}.katex .fontsize-ensurer.reset-size5.size8,.katex .sizing.reset-size5.size8{font-size:1.73em}.katex .fontsize-ensurer.reset-size5.size9,.katex .sizing.reset-size5.size9{font-size:2.07em}.katex .fontsize-ensurer.reset-size5.size10,.katex .sizing.reset-size5.size10{font-size:2.49em}.katex .fontsize-ensurer.reset-size6.size1,.katex .sizing.reset-size6.size1{font-size:.41666667em}.katex .fontsize-ensurer.reset-size6.size2,.katex .sizing.reset-size6.size2{font-size:.58333333em}.katex .fontsize-ensurer.reset-size6.size3,.katex .sizing.reset-size6.size3{font-size:.66666667em}.katex .fontsize-ensurer.reset-size6.size4,.katex .sizing.reset-size6.size4{font-size:.75em}.katex .fontsize-ensurer.reset-size6.size5,.katex .sizing.reset-size6.size5{font-size:.83333333em}.katex .fontsize-ensurer.reset-size6.size6,.katex .sizing.reset-size6.size6{font-size:1em}.katex .fontsize-ensurer.reset-size6.size7,.katex .sizing.reset-size6.size7{font-size:1.2em}.katex .fontsize-ensurer.reset-size6.size8,.katex .sizing.reset-size6.size8{font-size:1.44166667em}.katex .fontsize-ensurer.reset-size6.size9,.katex .sizing.reset-size6.size9{font-size:1.725em}.katex .fontsize-ensurer.reset-size6.size10,.katex .sizing.reset-size6.size10{font-size:2.075em}.katex .fontsize-ensurer.reset-size7.size1,.katex .sizing.reset-size7.size1{font-size:.34722222em}.katex .fontsize-ensurer.reset-size7.size2,.katex .sizing.reset-size7.size2{font-size:.48611111em}.katex .fontsize-ensurer.reset-size7.size3,.katex .sizing.reset-size7.size3{font-size:.55555556em}.katex .fontsize-ensurer.reset-size7.size4,.katex .sizing.reset-size7.size4{font-size:.625em}.katex .fontsize-ensurer.reset-size7.size5,.katex .sizing.reset-size7.size5{font-size:.69444444em}.katex .fontsize-ensurer.reset-size7.size6,.katex .sizing.reset-size7.size6{font-size:.83333333em}.katex .fontsize-ensurer.reset-size7.size7,.katex .sizing.reset-size7.size7{font-size:1em}.katex .fontsize-ensurer.reset-size7.size8,.katex .sizing.reset-size7.size8{font-size:1.20138889em}.katex .fontsize-ensurer.reset-size7.size9,.katex .sizing.reset-size7.size9{font-size:1.4375em}.katex .fontsize-ensurer.reset-size7.size10,.katex .sizing.reset-size7.size10{font-size:1.72916667em}.katex .fontsize-ensurer.reset-size8.size1,.katex .sizing.reset-size8.size1{font-size:.28901734em}.katex .fontsize-ensurer.reset-size8.size2,.katex .sizing.reset-size8.size2{font-size:.40462428em}.katex .fontsize-ensurer.reset-size8.size3,.katex .sizing.reset-size8.size3{font-size:.46242775em}.katex .fontsize-ensurer.reset-size8.size4,.katex .sizing.reset-size8.size4{font-size:.52023121em}.katex .fontsize-ensurer.reset-size8.size5,.katex .sizing.reset-size8.size5{font-size:.57803468em}.katex .fontsize-ensurer.reset-size8.size6,.katex .sizing.reset-size8.size6{font-size:.69364162em}.katex .fontsize-ensurer.reset-size8.size7,.katex .sizing.reset-size8.size7{font-size:.83236994em}.katex .fontsize-ensurer.reset-size8.size8,.katex .sizing.reset-size8.size8{font-size:1em}.katex .fontsize-ensurer.reset-size8.size9,.katex .sizing.reset-size8.size9{font-size:1.19653179em}.katex .fontsize-ensurer.reset-size8.size10,.katex .sizing.reset-size8.size10{font-size:1.43930636em}.katex .fontsize-ensurer.reset-size9.size1,.katex .sizing.reset-size9.size1{font-size:.24154589em}.katex .fontsize-ensurer.reset-size9.size2,.katex .sizing.reset-size9.size2{font-size:.33816425em}.katex .fontsize-ensurer.reset-size9.size3,.katex .sizing.reset-size9.size3{font-size:.38647343em}.katex .fontsize-ensurer.reset-size9.size4,.katex .sizing.reset-size9.size4{font-size:.43478261em}.katex .fontsize-ensurer.reset-size9.size5,.katex .sizing.reset-size9.size5{font-size:.48309179em}.katex .fontsize-ensurer.reset-size9.size6,.katex .sizing.reset-size9.size6{font-size:.57971014em}.katex .fontsize-ensurer.reset-size9.size7,.katex .sizing.reset-size9.size7{font-size:.69565217em}.katex .fontsize-ensurer.reset-size9.size8,.katex .sizing.reset-size9.size8{font-size:.83574879em}.katex .fontsize-ensurer.reset-size9.size9,.katex .sizing.reset-size9.size9{font-size:1em}.katex .fontsize-ensurer.reset-size9.size10,.katex .sizing.reset-size9.size10{font-size:1.20289855em}.katex .fontsize-ensurer.reset-size10.size1,.katex .sizing.reset-size10.size1{font-size:.20080321em}.katex .fontsize-ensurer.reset-size10.size2,.katex .sizing.reset-size10.size2{font-size:.2811245em}.katex .fontsize-ensurer.reset-size10.size3,.katex .sizing.reset-size10.size3{font-size:.32128514em}.katex .fontsize-ensurer.reset-size10.size4,.katex .sizing.reset-size10.size4{font-size:.36144578em}.katex .fontsize-ensurer.reset-size10.size5,.katex .sizing.reset-size10.size5{font-size:.40160643em}.katex .fontsize-ensurer.reset-size10.size6,.katex .sizing.reset-size10.size6{font-size:.48192771em}.katex .fontsize-ensurer.reset-size10.size7,.katex .sizing.reset-size10.size7{font-size:.57831325em}.katex .fontsize-ensurer.reset-size10.size8,.katex .sizing.reset-size10.size8{font-size:.69477912em}.katex .fontsize-ensurer.reset-size10.size9,.katex .sizing.reset-size10.size9{font-size:.8313253em}.katex .fontsize-ensurer.reset-size10.size10,.katex .sizing.reset-size10.size10{font-size:1em}.katex .delimsizing.size1{font-family:KaTeX_Size1}.katex .delimsizing.size2{font-family:KaTeX_Size2}.katex .delimsizing.size3{font-family:KaTeX_Size3}.katex .delimsizing.size4{font-family:KaTeX_Size4}.katex .delimsizing.mult .delim-size1>span{font-family:KaTeX_Size1}.katex .delimsizing.mult .delim-size4>span{font-family:KaTeX_Size4}.katex .nulldelimiter{display:inline-block;width:.12em}.katex .op-symbol{position:relative}.katex .op-symbol.small-op{font-family:KaTeX_Size1}.katex .op-symbol.large-op{font-family:KaTeX_Size2}.katex .accent>.vlist>span,.katex .op-limits>.vlist>span{text-align:center}.katex .accent .accent-body>span{width:0}.katex .accent .accent-body.accent-vec>span{position:relative;left:.326em}.katex .mtable .vertical-separator{display:inline-block;margin:0 -.025em;border-right:.05em solid #000}.katex .mtable .arraycolsep{display:inline-block}.katex .mtable .col-align-c>.vlist{text-align:center}.katex .mtable .col-align-l>.vlist{text-align:left}.katex .mtable .col-align-r>.vlist{text-align:right} \ No newline at end of file +@font-face{font-family:KaTeX_AMS;src:url(fonts/KaTeX_AMS-Regular.eot);src:url(fonts/KaTeX_AMS-Regular.eot#iefix) format('embedded-opentype'),url(fonts/KaTeX_AMS-Regular.woff2) format('woff2'),url(fonts/KaTeX_AMS-Regular.woff) format('woff'),url(fonts/KaTeX_AMS-Regular.ttf) format('ttf');font-weight:400;font-style:normal}@font-face{font-family:KaTeX_Caligraphic;src:url(fonts/KaTeX_Caligraphic-Bold.eot);src:url(fonts/KaTeX_Caligraphic-Bold.eot#iefix) format('embedded-opentype'),url(fonts/KaTeX_Caligraphic-Bold.woff2) format('woff2'),url(fonts/KaTeX_Caligraphic-Bold.woff) format('woff'),url(fonts/KaTeX_Caligraphic-Bold.ttf) format('ttf');font-weight:700;font-style:normal}@font-face{font-family:KaTeX_Caligraphic;src:url(fonts/KaTeX_Caligraphic-Regular.eot);src:url(fonts/KaTeX_Caligraphic-Regular.eot#iefix) format('embedded-opentype'),url(fonts/KaTeX_Caligraphic-Regular.woff2) format('woff2'),url(fonts/KaTeX_Caligraphic-Regular.woff) format('woff'),url(fonts/KaTeX_Caligraphic-Regular.ttf) format('ttf');font-weight:400;font-style:normal}@font-face{font-family:KaTeX_Fraktur;src:url(fonts/KaTeX_Fraktur-Bold.eot);src:url(fonts/KaTeX_Fraktur-Bold.eot#iefix) format('embedded-opentype'),url(fonts/KaTeX_Fraktur-Bold.woff2) format('woff2'),url(fonts/KaTeX_Fraktur-Bold.woff) format('woff'),url(fonts/KaTeX_Fraktur-Bold.ttf) format('ttf');font-weight:700;font-style:normal}@font-face{font-family:KaTeX_Fraktur;src:url(fonts/KaTeX_Fraktur-Regular.eot);src:url(fonts/KaTeX_Fraktur-Regular.eot#iefix) format('embedded-opentype'),url(fonts/KaTeX_Fraktur-Regular.woff2) format('woff2'),url(fonts/KaTeX_Fraktur-Regular.woff) format('woff'),url(fonts/KaTeX_Fraktur-Regular.ttf) format('ttf');font-weight:400;font-style:normal}@font-face{font-family:KaTeX_Main;src:url(fonts/KaTeX_Main-Bold.eot);src:url(fonts/KaTeX_Main-Bold.eot#iefix) format('embedded-opentype'),url(fonts/KaTeX_Main-Bold.woff2) format('woff2'),url(fonts/KaTeX_Main-Bold.woff) format('woff'),url(fonts/KaTeX_Main-Bold.ttf) format('ttf');font-weight:700;font-style:normal}@font-face{font-family:KaTeX_Main;src:url(fonts/KaTeX_Main-Italic.eot);src:url(fonts/KaTeX_Main-Italic.eot#iefix) format('embedded-opentype'),url(fonts/KaTeX_Main-Italic.woff2) format('woff2'),url(fonts/KaTeX_Main-Italic.woff) format('woff'),url(fonts/KaTeX_Main-Italic.ttf) format('ttf');font-weight:400;font-style:italic}@font-face{font-family:KaTeX_Main;src:url(fonts/KaTeX_Main-Regular.eot);src:url(fonts/KaTeX_Main-Regular.eot#iefix) format('embedded-opentype'),url(fonts/KaTeX_Main-Regular.woff2) format('woff2'),url(fonts/KaTeX_Main-Regular.woff) format('woff'),url(fonts/KaTeX_Main-Regular.ttf) format('ttf');font-weight:400;font-style:normal}@font-face{font-family:KaTeX_Math;src:url(fonts/KaTeX_Math-Italic.eot);src:url(fonts/KaTeX_Math-Italic.eot#iefix) format('embedded-opentype'),url(fonts/KaTeX_Math-Italic.woff2) format('woff2'),url(fonts/KaTeX_Math-Italic.woff) format('woff'),url(fonts/KaTeX_Math-Italic.ttf) format('ttf');font-weight:400;font-style:italic}@font-face{font-family:KaTeX_SansSerif;src:url(fonts/KaTeX_SansSerif-Regular.eot);src:url(fonts/KaTeX_SansSerif-Regular.eot#iefix) format('embedded-opentype'),url(fonts/KaTeX_SansSerif-Regular.woff2) format('woff2'),url(fonts/KaTeX_SansSerif-Regular.woff) format('woff'),url(fonts/KaTeX_SansSerif-Regular.ttf) format('ttf');font-weight:400;font-style:normal}@font-face{font-family:KaTeX_Script;src:url(fonts/KaTeX_Script-Regular.eot);src:url(fonts/KaTeX_Script-Regular.eot#iefix) format('embedded-opentype'),url(fonts/KaTeX_Script-Regular.woff2) format('woff2'),url(fonts/KaTeX_Script-Regular.woff) format('woff'),url(fonts/KaTeX_Script-Regular.ttf) format('ttf');font-weight:400;font-style:normal}@font-face{font-family:KaTeX_Size1;src:url(fonts/KaTeX_Size1-Regular.eot);src:url(fonts/KaTeX_Size1-Regular.eot#iefix) format('embedded-opentype'),url(fonts/KaTeX_Size1-Regular.woff2) format('woff2'),url(fonts/KaTeX_Size1-Regular.woff) format('woff'),url(fonts/KaTeX_Size1-Regular.ttf) format('ttf');font-weight:400;font-style:normal}@font-face{font-family:KaTeX_Size2;src:url(fonts/KaTeX_Size2-Regular.eot);src:url(fonts/KaTeX_Size2-Regular.eot#iefix) format('embedded-opentype'),url(fonts/KaTeX_Size2-Regular.woff2) format('woff2'),url(fonts/KaTeX_Size2-Regular.woff) format('woff'),url(fonts/KaTeX_Size2-Regular.ttf) format('ttf');font-weight:400;font-style:normal}@font-face{font-family:KaTeX_Size3;src:url(fonts/KaTeX_Size3-Regular.eot);src:url(fonts/KaTeX_Size3-Regular.eot#iefix) format('embedded-opentype'),url(fonts/KaTeX_Size3-Regular.woff2) format('woff2'),url(fonts/KaTeX_Size3-Regular.woff) format('woff'),url(fonts/KaTeX_Size3-Regular.ttf) format('ttf');font-weight:400;font-style:normal}@font-face{font-family:KaTeX_Size4;src:url(fonts/KaTeX_Size4-Regular.eot);src:url(fonts/KaTeX_Size4-Regular.eot#iefix) format('embedded-opentype'),url(fonts/KaTeX_Size4-Regular.woff2) format('woff2'),url(fonts/KaTeX_Size4-Regular.woff) format('woff'),url(fonts/KaTeX_Size4-Regular.ttf) format('ttf');font-weight:400;font-style:normal}@font-face{font-family:KaTeX_Typewriter;src:url(fonts/KaTeX_Typewriter-Regular.eot);src:url(fonts/KaTeX_Typewriter-Regular.eot#iefix) format('embedded-opentype'),url(fonts/KaTeX_Typewriter-Regular.woff2) format('woff2'),url(fonts/KaTeX_Typewriter-Regular.woff) format('woff'),url(fonts/KaTeX_Typewriter-Regular.ttf) format('ttf');font-weight:400;font-style:normal}.katex-display{display:block;margin:1em 0;text-align:center}.katex-display>.katex{display:inline-block;text-align:initial}.katex{font:400 1.21em KaTeX_Main;line-height:1.2;white-space:nowrap;text-indent:0}.katex .katex-html{display:inline-block}.katex .katex-mathml{position:absolute;clip:rect(1px,1px,1px,1px);padding:0;border:0;height:1px;width:1px;overflow:hidden}.katex .base,.katex .strut{display:inline-block}.katex .mathit{font-family:KaTeX_Math;font-style:italic}.katex .mathbf{font-family:KaTeX_Main;font-weight:700}.katex .amsrm,.katex .mathbb{font-family:KaTeX_AMS}.katex .mathcal{font-family:KaTeX_Caligraphic}.katex .mathfrak{font-family:KaTeX_Fraktur}.katex .mathtt{font-family:KaTeX_Typewriter}.katex .mathscr{font-family:KaTeX_Script}.katex .mathsf{font-family:KaTeX_SansSerif}.katex .mainit{font-family:KaTeX_Main;font-style:italic}.katex .textstyle>.mord+.mop{margin-left:.16667em}.katex .textstyle>.mord+.mbin{margin-left:.22222em}.katex .textstyle>.mord+.mrel{margin-left:.27778em}.katex .textstyle>.mop+.mop,.katex .textstyle>.mop+.mord,.katex .textstyle>.mord+.minner{margin-left:.16667em}.katex .textstyle>.mop+.mrel{margin-left:.27778em}.katex .textstyle>.mop+.minner{margin-left:.16667em}.katex .textstyle>.mbin+.minner,.katex .textstyle>.mbin+.mop,.katex .textstyle>.mbin+.mopen,.katex .textstyle>.mbin+.mord{margin-left:.22222em}.katex .textstyle>.mrel+.minner,.katex .textstyle>.mrel+.mop,.katex .textstyle>.mrel+.mopen,.katex .textstyle>.mrel+.mord{margin-left:.27778em}.katex .textstyle>.mclose+.mop{margin-left:.16667em}.katex .textstyle>.mclose+.mbin{margin-left:.22222em}.katex .textstyle>.mclose+.mrel{margin-left:.27778em}.katex .textstyle>.mclose+.minner,.katex .textstyle>.minner+.mop,.katex .textstyle>.minner+.mord,.katex .textstyle>.mpunct+.mclose,.katex .textstyle>.mpunct+.minner,.katex .textstyle>.mpunct+.mop,.katex .textstyle>.mpunct+.mopen,.katex .textstyle>.mpunct+.mord,.katex .textstyle>.mpunct+.mpunct,.katex .textstyle>.mpunct+.mrel{margin-left:.16667em}.katex .textstyle>.minner+.mbin{margin-left:.22222em}.katex .textstyle>.minner+.mrel{margin-left:.27778em}.katex .mclose+.mop,.katex .minner+.mop,.katex .mop+.mop,.katex .mop+.mord,.katex .mord+.mop,.katex .textstyle>.minner+.minner,.katex .textstyle>.minner+.mopen,.katex .textstyle>.minner+.mpunct{margin-left:.16667em}.katex .reset-textstyle.textstyle{font-size:1em}.katex .reset-textstyle.scriptstyle{font-size:.7em}.katex .reset-textstyle.scriptscriptstyle{font-size:.5em}.katex .reset-scriptstyle.textstyle{font-size:1.42857em}.katex .reset-scriptstyle.scriptstyle{font-size:1em}.katex .reset-scriptstyle.scriptscriptstyle{font-size:.71429em}.katex .reset-scriptscriptstyle.textstyle{font-size:2em}.katex .reset-scriptscriptstyle.scriptstyle{font-size:1.4em}.katex .reset-scriptscriptstyle.scriptscriptstyle{font-size:1em}.katex .style-wrap{position:relative}.katex .vlist{display:inline-block}.katex .vlist>span{display:block;height:0;position:relative}.katex .vlist>span>span{display:inline-block}.katex .vlist .baseline-fix{display:inline-table;table-layout:fixed}.katex .msupsub{text-align:left}.katex .mfrac>span>span{text-align:center}.katex .mfrac .frac-line{width:100%}.katex .mfrac .frac-line:before{border-bottom-style:solid;border-bottom-width:1px;content:"";display:block}.katex .mfrac .frac-line:after{border-bottom-style:solid;border-bottom-width:.04em;content:"";display:block;margin-top:-1px}.katex .mspace{display:inline-block}.katex .mspace.negativethinspace{margin-left:-.16667em}.katex .mspace.thinspace{width:.16667em}.katex .mspace.mediumspace{width:.22222em}.katex .mspace.thickspace{width:.27778em}.katex .mspace.enspace{width:.5em}.katex .mspace.quad{width:1em}.katex .mspace.qquad{width:2em}.katex .llap,.katex .rlap{width:0;position:relative}.katex .llap>.inner,.katex .rlap>.inner{position:absolute}.katex .llap>.fix,.katex .rlap>.fix{display:inline-block}.katex .llap>.inner{right:0}.katex .rlap>.inner{left:0}.katex .katex-logo .a{font-size:.75em;margin-left:-.32em;position:relative;top:-.2em}.katex .katex-logo .t{margin-left:-.23em}.katex .katex-logo .e{margin-left:-.1667em;position:relative;top:.2155em}.katex .katex-logo .x{margin-left:-.125em}.katex .rule{display:inline-block;border:0 solid;position:relative}.katex .overline .overline-line,.katex .underline .underline-line{width:100%}.katex .overline .overline-line:before,.katex .underline .underline-line:before{border-bottom-style:solid;border-bottom-width:1px;content:"";display:block}.katex .overline .overline-line:after,.katex .underline .underline-line:after{border-bottom-style:solid;border-bottom-width:.04em;content:"";display:block;margin-top:-1px}.katex .sqrt>.sqrt-sign{position:relative}.katex .sqrt .sqrt-line{width:100%}.katex .sqrt .sqrt-line:before{border-bottom-style:solid;border-bottom-width:1px;content:"";display:block}.katex .sqrt .sqrt-line:after{border-bottom-style:solid;border-bottom-width:.04em;content:"";display:block;margin-top:-1px}.katex .sqrt>.root{margin-left:.27777778em;margin-right:-.55555556em}.katex .fontsize-ensurer,.katex .sizing{display:inline-block}.katex .fontsize-ensurer.reset-size1.size1,.katex .sizing.reset-size1.size1{font-size:1em}.katex .fontsize-ensurer.reset-size1.size2,.katex .sizing.reset-size1.size2{font-size:1.4em}.katex .fontsize-ensurer.reset-size1.size3,.katex .sizing.reset-size1.size3{font-size:1.6em}.katex .fontsize-ensurer.reset-size1.size4,.katex .sizing.reset-size1.size4{font-size:1.8em}.katex .fontsize-ensurer.reset-size1.size5,.katex .sizing.reset-size1.size5{font-size:2em}.katex .fontsize-ensurer.reset-size1.size6,.katex .sizing.reset-size1.size6{font-size:2.4em}.katex .fontsize-ensurer.reset-size1.size7,.katex .sizing.reset-size1.size7{font-size:2.88em}.katex .fontsize-ensurer.reset-size1.size8,.katex .sizing.reset-size1.size8{font-size:3.46em}.katex .fontsize-ensurer.reset-size1.size9,.katex .sizing.reset-size1.size9{font-size:4.14em}.katex .fontsize-ensurer.reset-size1.size10,.katex .sizing.reset-size1.size10{font-size:4.98em}.katex .fontsize-ensurer.reset-size2.size1,.katex .sizing.reset-size2.size1{font-size:.71428571em}.katex .fontsize-ensurer.reset-size2.size2,.katex .sizing.reset-size2.size2{font-size:1em}.katex .fontsize-ensurer.reset-size2.size3,.katex .sizing.reset-size2.size3{font-size:1.14285714em}.katex .fontsize-ensurer.reset-size2.size4,.katex .sizing.reset-size2.size4{font-size:1.28571429em}.katex .fontsize-ensurer.reset-size2.size5,.katex .sizing.reset-size2.size5{font-size:1.42857143em}.katex .fontsize-ensurer.reset-size2.size6,.katex .sizing.reset-size2.size6{font-size:1.71428571em}.katex .fontsize-ensurer.reset-size2.size7,.katex .sizing.reset-size2.size7{font-size:2.05714286em}.katex .fontsize-ensurer.reset-size2.size8,.katex .sizing.reset-size2.size8{font-size:2.47142857em}.katex .fontsize-ensurer.reset-size2.size9,.katex .sizing.reset-size2.size9{font-size:2.95714286em}.katex .fontsize-ensurer.reset-size2.size10,.katex .sizing.reset-size2.size10{font-size:3.55714286em}.katex .fontsize-ensurer.reset-size3.size1,.katex .sizing.reset-size3.size1{font-size:.625em}.katex .fontsize-ensurer.reset-size3.size2,.katex .sizing.reset-size3.size2{font-size:.875em}.katex .fontsize-ensurer.reset-size3.size3,.katex .sizing.reset-size3.size3{font-size:1em}.katex .fontsize-ensurer.reset-size3.size4,.katex .sizing.reset-size3.size4{font-size:1.125em}.katex .fontsize-ensurer.reset-size3.size5,.katex .sizing.reset-size3.size5{font-size:1.25em}.katex .fontsize-ensurer.reset-size3.size6,.katex .sizing.reset-size3.size6{font-size:1.5em}.katex .fontsize-ensurer.reset-size3.size7,.katex .sizing.reset-size3.size7{font-size:1.8em}.katex .fontsize-ensurer.reset-size3.size8,.katex .sizing.reset-size3.size8{font-size:2.1625em}.katex .fontsize-ensurer.reset-size3.size9,.katex .sizing.reset-size3.size9{font-size:2.5875em}.katex .fontsize-ensurer.reset-size3.size10,.katex .sizing.reset-size3.size10{font-size:3.1125em}.katex .fontsize-ensurer.reset-size4.size1,.katex .sizing.reset-size4.size1{font-size:.55555556em}.katex .fontsize-ensurer.reset-size4.size2,.katex .sizing.reset-size4.size2{font-size:.77777778em}.katex .fontsize-ensurer.reset-size4.size3,.katex .sizing.reset-size4.size3{font-size:.88888889em}.katex .fontsize-ensurer.reset-size4.size4,.katex .sizing.reset-size4.size4{font-size:1em}.katex .fontsize-ensurer.reset-size4.size5,.katex .sizing.reset-size4.size5{font-size:1.11111111em}.katex .fontsize-ensurer.reset-size4.size6,.katex .sizing.reset-size4.size6{font-size:1.33333333em}.katex .fontsize-ensurer.reset-size4.size7,.katex .sizing.reset-size4.size7{font-size:1.6em}.katex .fontsize-ensurer.reset-size4.size8,.katex .sizing.reset-size4.size8{font-size:1.92222222em}.katex .fontsize-ensurer.reset-size4.size9,.katex .sizing.reset-size4.size9{font-size:2.3em}.katex .fontsize-ensurer.reset-size4.size10,.katex .sizing.reset-size4.size10{font-size:2.76666667em}.katex .fontsize-ensurer.reset-size5.size1,.katex .sizing.reset-size5.size1{font-size:.5em}.katex .fontsize-ensurer.reset-size5.size2,.katex .sizing.reset-size5.size2{font-size:.7em}.katex .fontsize-ensurer.reset-size5.size3,.katex .sizing.reset-size5.size3{font-size:.8em}.katex .fontsize-ensurer.reset-size5.size4,.katex .sizing.reset-size5.size4{font-size:.9em}.katex .fontsize-ensurer.reset-size5.size5,.katex .sizing.reset-size5.size5{font-size:1em}.katex .fontsize-ensurer.reset-size5.size6,.katex .sizing.reset-size5.size6{font-size:1.2em}.katex .fontsize-ensurer.reset-size5.size7,.katex .sizing.reset-size5.size7{font-size:1.44em}.katex .fontsize-ensurer.reset-size5.size8,.katex .sizing.reset-size5.size8{font-size:1.73em}.katex .fontsize-ensurer.reset-size5.size9,.katex .sizing.reset-size5.size9{font-size:2.07em}.katex .fontsize-ensurer.reset-size5.size10,.katex .sizing.reset-size5.size10{font-size:2.49em}.katex .fontsize-ensurer.reset-size6.size1,.katex .sizing.reset-size6.size1{font-size:.41666667em}.katex .fontsize-ensurer.reset-size6.size2,.katex .sizing.reset-size6.size2{font-size:.58333333em}.katex .fontsize-ensurer.reset-size6.size3,.katex .sizing.reset-size6.size3{font-size:.66666667em}.katex .fontsize-ensurer.reset-size6.size4,.katex .sizing.reset-size6.size4{font-size:.75em}.katex .fontsize-ensurer.reset-size6.size5,.katex .sizing.reset-size6.size5{font-size:.83333333em}.katex .fontsize-ensurer.reset-size6.size6,.katex .sizing.reset-size6.size6{font-size:1em}.katex .fontsize-ensurer.reset-size6.size7,.katex .sizing.reset-size6.size7{font-size:1.2em}.katex .fontsize-ensurer.reset-size6.size8,.katex .sizing.reset-size6.size8{font-size:1.44166667em}.katex .fontsize-ensurer.reset-size6.size9,.katex .sizing.reset-size6.size9{font-size:1.725em}.katex .fontsize-ensurer.reset-size6.size10,.katex .sizing.reset-size6.size10{font-size:2.075em}.katex .fontsize-ensurer.reset-size7.size1,.katex .sizing.reset-size7.size1{font-size:.34722222em}.katex .fontsize-ensurer.reset-size7.size2,.katex .sizing.reset-size7.size2{font-size:.48611111em}.katex .fontsize-ensurer.reset-size7.size3,.katex .sizing.reset-size7.size3{font-size:.55555556em}.katex .fontsize-ensurer.reset-size7.size4,.katex .sizing.reset-size7.size4{font-size:.625em}.katex .fontsize-ensurer.reset-size7.size5,.katex .sizing.reset-size7.size5{font-size:.69444444em}.katex .fontsize-ensurer.reset-size7.size6,.katex .sizing.reset-size7.size6{font-size:.83333333em}.katex .fontsize-ensurer.reset-size7.size7,.katex .sizing.reset-size7.size7{font-size:1em}.katex .fontsize-ensurer.reset-size7.size8,.katex .sizing.reset-size7.size8{font-size:1.20138889em}.katex .fontsize-ensurer.reset-size7.size9,.katex .sizing.reset-size7.size9{font-size:1.4375em}.katex .fontsize-ensurer.reset-size7.size10,.katex .sizing.reset-size7.size10{font-size:1.72916667em}.katex .fontsize-ensurer.reset-size8.size1,.katex .sizing.reset-size8.size1{font-size:.28901734em}.katex .fontsize-ensurer.reset-size8.size2,.katex .sizing.reset-size8.size2{font-size:.40462428em}.katex .fontsize-ensurer.reset-size8.size3,.katex .sizing.reset-size8.size3{font-size:.46242775em}.katex .fontsize-ensurer.reset-size8.size4,.katex .sizing.reset-size8.size4{font-size:.52023121em}.katex .fontsize-ensurer.reset-size8.size5,.katex .sizing.reset-size8.size5{font-size:.57803468em}.katex .fontsize-ensurer.reset-size8.size6,.katex .sizing.reset-size8.size6{font-size:.69364162em}.katex .fontsize-ensurer.reset-size8.size7,.katex .sizing.reset-size8.size7{font-size:.83236994em}.katex .fontsize-ensurer.reset-size8.size8,.katex .sizing.reset-size8.size8{font-size:1em}.katex .fontsize-ensurer.reset-size8.size9,.katex .sizing.reset-size8.size9{font-size:1.19653179em}.katex .fontsize-ensurer.reset-size8.size10,.katex .sizing.reset-size8.size10{font-size:1.43930636em}.katex .fontsize-ensurer.reset-size9.size1,.katex .sizing.reset-size9.size1{font-size:.24154589em}.katex .fontsize-ensurer.reset-size9.size2,.katex .sizing.reset-size9.size2{font-size:.33816425em}.katex .fontsize-ensurer.reset-size9.size3,.katex .sizing.reset-size9.size3{font-size:.38647343em}.katex .fontsize-ensurer.reset-size9.size4,.katex .sizing.reset-size9.size4{font-size:.43478261em}.katex .fontsize-ensurer.reset-size9.size5,.katex .sizing.reset-size9.size5{font-size:.48309179em}.katex .fontsize-ensurer.reset-size9.size6,.katex .sizing.reset-size9.size6{font-size:.57971014em}.katex .fontsize-ensurer.reset-size9.size7,.katex .sizing.reset-size9.size7{font-size:.69565217em}.katex .fontsize-ensurer.reset-size9.size8,.katex .sizing.reset-size9.size8{font-size:.83574879em}.katex .fontsize-ensurer.reset-size9.size9,.katex .sizing.reset-size9.size9{font-size:1em}.katex .fontsize-ensurer.reset-size9.size10,.katex .sizing.reset-size9.size10{font-size:1.20289855em}.katex .fontsize-ensurer.reset-size10.size1,.katex .sizing.reset-size10.size1{font-size:.20080321em}.katex .fontsize-ensurer.reset-size10.size2,.katex .sizing.reset-size10.size2{font-size:.2811245em}.katex .fontsize-ensurer.reset-size10.size3,.katex .sizing.reset-size10.size3{font-size:.32128514em}.katex .fontsize-ensurer.reset-size10.size4,.katex .sizing.reset-size10.size4{font-size:.36144578em}.katex .fontsize-ensurer.reset-size10.size5,.katex .sizing.reset-size10.size5{font-size:.40160643em}.katex .fontsize-ensurer.reset-size10.size6,.katex .sizing.reset-size10.size6{font-size:.48192771em}.katex .fontsize-ensurer.reset-size10.size7,.katex .sizing.reset-size10.size7{font-size:.57831325em}.katex .fontsize-ensurer.reset-size10.size8,.katex .sizing.reset-size10.size8{font-size:.69477912em}.katex .fontsize-ensurer.reset-size10.size9,.katex .sizing.reset-size10.size9{font-size:.8313253em}.katex .fontsize-ensurer.reset-size10.size10,.katex .sizing.reset-size10.size10{font-size:1em}.katex .delimsizing.size1{font-family:KaTeX_Size1}.katex .delimsizing.size2{font-family:KaTeX_Size2}.katex .delimsizing.size3{font-family:KaTeX_Size3}.katex .delimsizing.size4{font-family:KaTeX_Size4}.katex .delimsizing.mult .delim-size1>span{font-family:KaTeX_Size1}.katex .delimsizing.mult .delim-size4>span{font-family:KaTeX_Size4}.katex .nulldelimiter{display:inline-block;width:.12em}.katex .op-symbol{position:relative}.katex .op-symbol.small-op{font-family:KaTeX_Size1}.katex .op-symbol.large-op{font-family:KaTeX_Size2}.katex .accent>.vlist>span,.katex .op-limits>.vlist>span{text-align:center}.katex .accent .accent-body>span{width:0}.katex .accent .accent-body.accent-vec>span{position:relative;left:.326em}.katex .mtable .vertical-separator{display:inline-block;margin:0 -.025em;border-right:.05em solid #000}.katex .mtable .arraycolsep{display:inline-block}.katex .mtable .col-align-c>.vlist{text-align:center}.katex .mtable .col-align-l>.vlist{text-align:left}.katex .mtable .col-align-r>.vlist{text-align:right} \ No newline at end of file diff --git a/plugins/tiddlywiki/katex/files/katex.min.js b/plugins/tiddlywiki/katex/files/katex.min.js index 863b1e8ab..67be5b71c 100644 --- a/plugins/tiddlywiki/katex/files/katex.min.js +++ b/plugins/tiddlywiki/katex/files/katex.min.js @@ -1,6 +1,5 @@ -(function(e){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=e()}else if(typeof define==="function"&&define.amd){define([],e)}else{var t;if(typeof window!=="undefined"){t=window}else if(typeof global!=="undefined"){t=global}else if(typeof self!=="undefined"){t=self}else{t=this}t.katex=e()}})(function(){var e,t,i;return function h(e,t,i){function a(l,s){if(!t[l]){if(!e[l]){var p=typeof require=="function"&&require;if(!s&&p)return p(l,!0);if(r)return r(l,!0);var c=new Error("Cannot find module '"+l+"'");throw c.code="MODULE_NOT_FOUND",c}var n=t[l]={exports:{}};e[l][0].call(n.exports,function(t){var i=e[l][1][t];return a(i?i:t)},n,n.exports,h,e,t,i)}return t[l].exports}var r=typeof require=="function"&&require;for(var l=0;l:]/,/[,;]/,/['\^_{}]/,/[(\[]/,/[)\]?!]/,/~/,/&/,/\\\\/];var p=[/[a-zA-Z0-9`!@*()-=+\[\]'";:?\/.,]/,/[{}]/,/~/,/&/,/\\\\/];var c=/\s*/;var n=/ +|\\ +/;var o=/\\(?:[a-zA-Z]+|.)/;r.prototype._innerLex=function(e,t,i){var r=this._input;var s;if(i){s=h(c,r,e)[0];e+=s.length}else{s=h(n,r,e);if(s!==null){return new l(" ",null,e+s[0].length)}}if(e===r.length){return new l("EOF",null,e)}var p;if(p=h(o,r,e)){return new l(p[0],null,e+p[0].length)}else{for(var g=0;gu){return this.parseFunction(e,t)}else{throw new c("Got function '"+r.result.result+"' with no arguments "+"as "+a,this.lexer,e)}}else{return r.result}};n.prototype.handleUnsupportedCmd=function(e,t){var i=[];for(var h=0;hp){m=this.parseFunction(s,t)}else{throw new c("Got function '"+u.result.result+"' as "+"argument to '"+i+"'",this.lexer,u.result.position-1)}}else{m=u.result}r.push(m.result);n.push(m.position);s=m.position}r.push(n);return s};n.prototype.parseSpecialGroup=function(e,t,i,h){if(t==="original"){t=i}if(t==="color"||t==="size"){var a=this.lexer.lex(e,i);if(h&&a.text!=="["){return null}this.expect(a,h?"[":"{");var r=this.lexer.lex(a.position,t);var l;if(t==="color"){l=r.text}else{l=r.data}var s=this.lexer.lex(r.position,i);this.expect(s,h?"]":"}");return new d(new g(new o(t,l,i),s.position),false)}else if(t==="text"){var p=this.lexer.lex(e,"whitespace");e=p.position}if(h){return this.parseOptionalGroup(e,t)}else{return this.parseGroup(e,t)}};n.prototype.parseGroup=function(e,t){var i=this.lexer.lex(e,t);if(i.text==="{"){var h=this.parseExpression(i.position,t,false);var a=this.lexer.lex(h.position,t);this.expect(a,"}");return new d(new g(new o("ordgroup",h.result,t),a.position),false)}else{return this.parseSymbol(e,t)}};n.prototype.parseOptionalGroup=function(e,t){var i=this.lexer.lex(e,t);if(i.text==="["){var h=this.parseExpression(i.position,t,false,"]");var a=this.lexer.lex(h.position,t);this.expect(a,"]");return new d(new g(new o("ordgroup",h.result,t),a.position),false)}else{return null}};n.prototype.parseSymbol=function(e,t){var i=this.lexer.lex(e,t);if(h.funcs[i.text]){return new d(new g(i.text,i.position),true)}else if(l[t][i.text]){return new d(new g(new o(l[t][i.text].group,i.text,t),i.position),false)}else{return null}};n.prototype.ParseNode=o;t.exports=n},{"./Lexer":3,"./ParseError":5,"./environments":15,"./functions":18,"./parseData":20,"./symbols":22,"./utils":23}],7:[function(e,t,i){function h(e,t){return e===undefined?t:e}function a(e){e=e||{};this.displayMode=h(e.displayMode,false);this.throwOnError=h(e.throwOnError,true);this.errorColor=h(e.errorColor,"#cc0000")}t.exports=a},{}],8:[function(e,t,i){function h(e,t,i,h){this.id=e;this.size=t;this.cramped=h;this.sizeMultiplier=i}h.prototype.sup=function(){return w[u[this.id]]};h.prototype.sub=function(){return w[k[this.id]]};h.prototype.fracNum=function(){return w[m[this.id]]};h.prototype.fracDen=function(){return w[f[this.id]]};h.prototype.cramp=function(){return w[v[this.id]]};h.prototype.cls=function(){return g[this.size]+(this.cramped?" cramped":" uncramped")};h.prototype.reset=function(){return d[this.size]};var a=0;var r=1;var l=2;var s=3;var p=4;var c=5;var n=6;var o=7;var g=["displaystyle textstyle","textstyle","scriptstyle","scriptscriptstyle"];var d=["reset-textstyle","reset-textstyle","reset-scriptstyle","reset-scriptscriptstyle"];var w=[new h(a,0,1,false),new h(r,0,1,true),new h(l,1,1,false),new h(s,1,1,true),new h(p,2,.7,false),new h(c,2,.7,true),new h(n,3,.5,false),new h(o,3,.5,true)];var u=[p,c,p,c,n,o,n,o];var k=[c,c,c,c,o,o,o,o];var m=[l,s,p,c,n,o,n,o];var f=[s,s,c,c,o,o,o,o];var v=[r,r,s,s,c,c,o,o];t.exports={DISPLAY:w[a],TEXT:w[l],SCRIPT:w[p],SCRIPTSCRIPT:w[n]}},{}],9:[function(e,t,i){var h=e("./domTree");var a=e("./fontMetrics");var r=e("./symbols");var l=e("./utils");var s=["\\Gamma","\\Delta","\\Theta","\\Lambda","\\Xi","\\Pi","\\Sigma","\\Upsilon","\\Phi","\\Psi","\\Omega"];var p=["\u0131","\u0237"];var c=function(e,t,i,l,s){if(r[i][e]&&r[i][e].replace){e=r[i][e].replace}var p=a.getCharacterMetrics(e,t);var c;if(p){c=new h.symbolNode(e,p.height,p.depth,p.italic,p.skew,s)}else{typeof console!=="undefined"&&console.warn("No character metrics for '"+e+"' in style '"+t+"'");c=new h.symbolNode(e,0,0,0,0,s)}if(l){c.style.color=l}return c};var n=function(e,t,i,h){if(e==="\\"||r[t][e].font==="main"){return c(e,"Main-Regular",t,i,h)}else{return c(e,"AMS-Regular",t,i,h.concat(["amsrm"]))}};var o=function(e,t,i,h,a){if(a==="mathord"){return g(e,t,i,h)}else if(a==="textord"){return c(e,"Main-Regular",t,i,h.concat(["mathrm"]))}else{throw new Error("unexpected type: "+a+" in mathDefault")}};var g=function(e,t,i,h){if(/[0-9]/.test(e.charAt(0))||l.contains(p,e)||l.contains(s,e)){return c(e,"Main-Italic",t,i,h.concat(["mainit"]))}else{return c(e,"Math-Italic",t,i,h.concat(["mathit"]))}};var d=function(e,t,i){var h=e.mode;var s=e.value;if(r[h][s]&&r[h][s].replace){s=r[h][s].replace}var n=["mord"];var d=t.getColor();var w=t.font;if(w){if(w==="mathit"||l.contains(p,s)){return g(s,h,d,n)}else{var u=x[w].fontName;if(a.getCharacterMetrics(s,u)){return c(s,u,h,d,n.concat([w]))}else{return o(s,h,d,n,i)}}}else{return o(s,h,d,n,i)}};var w=function(e){var t=0;var i=0;var h=0;if(e.children){for(var a=0;at){t=e.children[a].height}if(e.children[a].depth>i){i=e.children[a].depth}if(e.children[a].maxFontSize>h){h=e.children[a].maxFontSize}}}e.height=t;e.depth=i;e.maxFontSize=h};var u=function(e,t,i){var a=new h.span(e,t);w(a);if(i){a.style.color=i}return a};var k=function(e){var t=new h.documentFragment(e);w(t);return t};var m=function(e,t){var i=u([],[new h.symbolNode("\u200b")]);i.style.fontSize=t/e.style.sizeMultiplier+"em";var a=u(["fontsize-ensurer","reset-"+e.size,"size5"],[i]);return a};var f=function(e,t,i,a){var r;var l;var s;if(t==="individualShift"){var p=e;e=[p[0]];r=-p[0].shift-p[0].elem.depth;l=r;for(s=1;s0){u+=M;m-=M}}z=r.makeVList([{type:"elem",elem:c,shift:m},{type:"elem",elem:l,shift:-u}],"individualShift",null,t);if(h instanceof s.symbolNode){z.children[0].style.marginLeft=-h.italic+"em"}z.children[0].style.marginRight=b;z.children[1].style.marginRight=b}return n([d(e.value.base)],[h,z])},genfrac:function(e,t,i){var h=t.style;if(e.value.size==="display"){h=a.DISPLAY}else if(e.value.size==="text"){h=a.TEXT}var s=h.fracNum();var c=h.fracDen();var o=v(e.value.numer,t.withStyle(s));var g=n([h.reset(),s.cls()],[o]);var d=v(e.value.denom,t.withStyle(c));var w=n([h.reset(),c.cls()],[d]);var u;if(e.value.hasBarLine){u=p.metrics.defaultRuleThickness/t.style.sizeMultiplier}else{u=0}var k;var f;var y;if(h.size===a.DISPLAY.size){k=p.metrics.num1;if(u>0){f=3*u}else{f=7*p.metrics.defaultRuleThickness}y=p.metrics.denom1}else{if(u>0){k=p.metrics.num2;f=u}else{k=p.metrics.num3;f=3*p.metrics.defaultRuleThickness}y=p.metrics.denom2}var x;if(u===0){var b=k-o.depth-(d.height-y);if(b0){A+=y;if(S=o){continue}var O;if(l>0||e.value.hskipBeforeAndAfter){O=c.deflt(P.pregap,w);if(O!==0){R=n(["arraycolsep"],[]);R.style.width=O+"em";C.push(R)}}var I=[];for(a=0;ah.height+h.depth+g){g=(g+k-h.height-h.depth)/2}var m=-(h.height+g+s)+u.height;u.style.top=m+"em";u.height-=m;u.depth+=m;var f;if(h.height===0&&h.depth===0){f=n()}else{f=r.makeVList([{type:"elem",elem:h},{type:"kern",size:g},{type:"elem",elem:c},{type:"kern",size:s}],"firstBaseline",null,t)}if(!e.value.index){return n(["sqrt","mord"],[u,f])}else{var y=v(e.value.index,t.withStyle(a.SCRIPTSCRIPT));var x=n([t.style.reset(),a.SCRIPTSCRIPT.cls()],[y]);var b=Math.max(u.height,f.height);var z=Math.max(u.depth,f.depth);var S=.6*(b-z);var M=r.makeVList([{type:"elem",elem:x}],"shift",-S,t);var q=n(["root"],[M]);return n(["sqrt","mord"],[q,u,f])}},sizing:function(e,t,i){var h=o(e.value.value,t.withSize(e.value.size),i);var a=n(["mord"],[n(["sizing","reset-"+t.size,e.value.size,t.style.cls()],h)]);var l=r.sizingMultiplier[e.value.size];a.maxFontSize=l*t.style.sizeMultiplier; -return a},styling:function(e,t,i){var h={display:a.DISPLAY,text:a.TEXT,script:a.SCRIPT,scriptscript:a.SCRIPTSCRIPT};var r=h[e.value.style];var l=o(e.value.value,t.withStyle(r),i);return n([t.style.reset(),r.cls()],l)},font:function(e,t,i){var h=e.value.font;return v(e.value.body,t.withFont(h),i)},delimsizing:function(e,t,i){var h=e.value.value;if(h==="."){return n([g[e.value.delimType]])}return n([g[e.value.delimType]],[l.sizedDelim(h,e.value.size,t,e.mode)])},leftright:function(e,t,i){var h=o(e.value.body,t.reset());var a=0;var r=0;for(var s=0;s","\\langle","\\rangle","/","\\backslash"];var y=[0,1.2,1.8,2.4,3];var x=function(e,t,i,a){if(e==="<"){e="\\langle"}else if(e===">"){e="\\rangle"}if(p.contains(m,e)||p.contains(v,e)){return w(e,t,false,i,a)}else if(p.contains(f,e)){return k(e,y[t],false,i,a)}else{throw new h("Illegal delimiter: '"+e+"'")}};var b=[{type:"small",style:a.SCRIPTSCRIPT},{type:"small",style:a.SCRIPT},{type:"small",style:a.TEXT},{type:"large",size:1},{type:"large",size:2},{type:"large",size:3},{type:"large",size:4}];var z=[{type:"small",style:a.SCRIPTSCRIPT},{type:"small",style:a.SCRIPT},{type:"small",style:a.TEXT},{type:"stack"}];var S=[{type:"small",style:a.SCRIPTSCRIPT},{type:"small",style:a.SCRIPT},{type:"small",style:a.TEXT},{type:"large",size:1},{type:"large",size:2},{type:"large",size:3},{type:"large",size:4},{type:"stack"}];var M=function(e){if(e.type==="small"){return"Main-Regular"}else if(e.type==="large"){return"Size"+e.size+"-Regular"}else if(e.type==="stack"){return"Size4-Regular"}};var q=function(e,t,i,h){var a=Math.min(2,3-h.style.size);for(var r=a;rt){return i[r]}}return i[i.length-1]};var A=function(e,t,i,h,a){if(e==="<"){e="\\langle"}else if(e===">"){e="\\rangle"}var r;if(p.contains(v,e)){r=b}else if(p.contains(m,e)){r=S}else{r=z}var l=q(e,t,r,h);if(l.type==="small"){return d(e,l.style,i,h,a)}else if(l.type==="large"){return w(e,l.size,i,h,a)}else if(l.type==="stack"){return k(e,t,i,h,a)}};var T=function(e,t,i,h,a){var r=l.metrics.axisHeight*h.style.sizeMultiplier;var s=901;var p=5/l.metrics.ptPerEm;var c=Math.max(t-r,i+r);var n=Math.max(c/500*s,2*c-p);return A(e,n,true,h,a)};t.exports={sizedDelim:x,customSizedDelim:A,leftRightDelim:T}},{"./ParseError":5,"./Style":8,"./buildCommon":9,"./fontMetrics":16,"./symbols":22,"./utils":23}],14:[function(e,t,i){var h=e("./utils");var a=function(e){e=e.slice();for(var t=e.length-1;t>=0;t--){if(!e[t]){e.splice(t,1)}}return e.join(" ")};function r(e,t,i,h,a,r){this.classes=e||[];this.children=t||[];this.height=i||0;this.depth=h||0;this.maxFontSize=a||0;this.style=r||{};this.attributes={}}r.prototype.setAttribute=function(e,t){this.attributes[e]=t};r.prototype.toNode=function(){var e=document.createElement("span");e.className=a(this.classes);for(var t in this.style){if(Object.prototype.hasOwnProperty.call(this.style,t)){e.style[t]=this.style[t]}}for(var i in this.attributes){if(Object.prototype.hasOwnProperty.call(this.attributes,i)){e.setAttribute(i,this.attributes[i])}}for(var h=0;h";return e};function l(e,t,i,h){this.children=e||[];this.height=t||0;this.depth=i||0;this.maxFontSize=h||0}l.prototype.toNode=function(){var e=document.createDocumentFragment();for(var t=0;t0){t=document.createElement("span");t.style.marginRight=this.italic+"em"}if(this.classes.length>0){t=t||document.createElement("span");t.className=a(this.classes)}for(var i in this.style){if(this.style.hasOwnProperty(i)){t=t||document.createElement("span");t.style[i]=this.style[i]}}if(t){t.appendChild(e);return t}else{return e}};s.prototype.toMarkup=function(){var e=false;var t="0){i+="margin-right:"+this.italic+"em;"}for(var r in this.style){if(this.style.hasOwnProperty(r)){i+=h.hyphenate(r)+":"+this.style[r]+";"}}if(i){e=true;t+=' style="'+h.escape(i)+'"'}var l=h.escape(this.value);if(e){t+=">";t+=l;t+="";return t}else{return l}};t.exports={span:r,documentFragment:l,symbolNode:s}},{"./utils":23}],15:[function(e,t,i){var h=e("./fontMetrics");var a=e("./parseData");var r=e("./ParseError");var l=a.ParseNode;var s=a.ParseResult;function p(e,t,i,h){var a=[],p=[a],c=[];while(true){var n=e.parseExpression(t,i,false,null);a.push(new l("ordgroup",n.result,i));t=n.position;var o=n.peek.text;if(o==="&"){t=n.peek.position}else if(o==="\\end"){break}else if(o==="\\\\"||o==="\\cr"){var g=e.parseFunction(t,i);c.push(g.result.value.size);t=g.position;a=[];p.push(a)}else{throw new r("Expected & or \\\\ or \\end",e.lexer,n.peek.position)}}h.body=p;h.rowGaps=c;return new s(new l(h.type,h,i),t)}var c=[{names:["array"],numArgs:1,handler:function(e,t,i,h,a){var l=this;h=h.value.map?h.value:[h];var s=h.map(function(e){var t=e.value;if("lcr".indexOf(t)!==-1){return{type:"align",align:t}}else if(t==="|"){return{type:"separator",separator:"|"}}throw new r("Unknown column alignment: "+e.value,l.lexer,a[1])});var c={type:"array",cols:s,hskipBeforeAndAfter:true};c=p(l,e,t,c);return c}},{names:["matrix","pmatrix","bmatrix","Bmatrix","vmatrix","Vmatrix"],handler:function(e,t,i){var h={matrix:null,pmatrix:["(",")"],bmatrix:["[","]"],Bmatrix:["\\{","\\}"],vmatrix:["|","|"],Vmatrix:["\\Vert","\\Vert"]}[i];var a={type:"array",hskipBeforeAndAfter:false};a=p(this,e,t,a);if(h){a.result=new l("leftright",{body:[a.result],left:h[0],right:h[1]},t)}return a}},{names:["cases"],handler:function(e,t,i){var a={type:"array",arraystretch:1.2,cols:[{type:"align",align:"l",pregap:0,postgap:h.metrics.quad},{type:"align",align:"l",pregap:0,postgap:0}]};a=p(this,e,t,a);a.result=new l("leftright",{body:[a.result],left:"\\{",right:"."},t);return a}}];t.exports=function(){var e={};for(var t=0;t","\\langle","\\rangle","\\lvert","\\rvert","\\lVert","\\rVert","\\lgroup","\\rgroup","\\lmoustache","\\rmoustache","/","\\backslash","|","\\vert","\\|","\\Vert","\\uparrow","\\Uparrow","\\downarrow","\\Downarrow","\\updownarrow","\\Updownarrow","."];var p={"\\Bbb":"\\mathbb","\\bold":"\\mathbf","\\frak":"\\mathfrak"};var c=[{funcs:["\\blue","\\orange","\\pink","\\red","\\green","\\gray","\\purple","\\blueA","\\blueB","\\blueC","\\blueD","\\blueE","\\tealA","\\tealB","\\tealC","\\tealD","\\tealE","\\greenA","\\greenB","\\greenC","\\greenD","\\greenE","\\goldA","\\goldB","\\goldC","\\goldD","\\goldE","\\redA","\\redB","\\redC","\\redD","\\redE","\\maroonA","\\maroonB","\\maroonC","\\maroonD","\\maroonE","\\purpleA","\\purpleB","\\purpleC","\\purpleD","\\purpleE","\\mintA","\\mintB","\\mintC","\\grayA","\\grayB","\\grayC","\\grayD","\\grayE","\\grayF","\\grayG","\\grayH","\\grayI","\\kaBlue","\\kaGreen"],data:{numArgs:1,allowedInText:true,greediness:3,handler:function(e,t){var i;if(t.type==="ordgroup"){i=t.value}else{i=[t]}return{type:"color",color:"katex-"+e.slice(1),value:i}}}},{funcs:["\\arcsin","\\arccos","\\arctan","\\arg","\\cos","\\cosh","\\cot","\\coth","\\csc","\\deg","\\dim","\\exp","\\hom","\\ker","\\lg","\\ln","\\log","\\sec","\\sin","\\sinh","\\tan","\\tanh"],data:{numArgs:0,handler:function(e){return{type:"op",limits:false,symbol:false,body:e}}}},{funcs:["\\det","\\gcd","\\inf","\\lim","\\liminf","\\limsup","\\max","\\min","\\Pr","\\sup"],data:{numArgs:0,handler:function(e){return{type:"op",limits:true,symbol:false,body:e}}}},{funcs:["\\int","\\iint","\\iiint","\\oint"],data:{numArgs:0,handler:function(e){return{type:"op",limits:false,symbol:true,body:e}}}},{funcs:["\\coprod","\\bigvee","\\bigwedge","\\biguplus","\\bigcap","\\bigcup","\\intop","\\prod","\\sum","\\bigotimes","\\bigoplus","\\bigodot","\\bigsqcup","\\smallint"],data:{numArgs:0,handler:function(e){return{type:"op",limits:true,symbol:true,body:e}}}},{funcs:["\\dfrac","\\frac","\\tfrac","\\dbinom","\\binom","\\tbinom"],data:{numArgs:2,greediness:2,handler:function(e,t,i){var h;var a=null;var r=null;var l="auto";switch(e){case"\\dfrac":case"\\frac":case"\\tfrac":h=true;break;case"\\dbinom":case"\\binom":case"\\tbinom":h=false;a="(";r=")";break;default:throw new Error("Unrecognized genfrac command")}switch(e){case"\\dfrac":case"\\dbinom":l="display";break;case"\\tfrac":case"\\tbinom":l="text";break}return{type:"genfrac",numer:t,denom:i,hasBarLine:h,leftDelim:a,rightDelim:r,size:l}}}},{funcs:["\\llap","\\rlap"],data:{numArgs:1,allowedInText:true,handler:function(e,t){return{type:e.slice(1),body:t}}}},{funcs:["\\bigl","\\Bigl","\\biggl","\\Biggl","\\bigr","\\Bigr","\\biggr","\\Biggr","\\bigm","\\Bigm","\\biggm","\\Biggm","\\big","\\Big","\\bigg","\\Bigg","\\left","\\right"],data:{numArgs:1,handler:function(e,t,i){if(!h.contains(s,t.value)){throw new a("Invalid delimiter: '"+t.value+"' after '"+e+"'",this.lexer,i[1])}if(e==="\\left"||e==="\\right"){return{type:"leftright",value:t.value}}else{return{type:"delimsizing",size:l[e].size,delimType:l[e].type,value:t.value}}}}},{funcs:["\\tiny","\\scriptsize","\\footnotesize","\\small","\\normalsize","\\large","\\Large","\\LARGE","\\huge","\\Huge"],data:{numArgs:0}},{funcs:["\\displaystyle","\\textstyle","\\scriptstyle","\\scriptscriptstyle"],data:{numArgs:0}},{funcs:["\\mathrm","\\mathit","\\mathbf","\\mathbb","\\mathcal","\\mathfrak","\\mathscr","\\mathsf","\\mathtt","\\Bbb","\\bold","\\frak"],data:{numArgs:1,handler:function(e,t){if(e in p){e=p[e]}return{type:"font",font:e.slice(1),body:t}}}},{funcs:["\\acute","\\grave","\\ddot","\\tilde","\\bar","\\breve","\\check","\\hat","\\vec","\\dot"],data:{numArgs:1,handler:function(e,t){return{type:"accent",accent:e,base:t}}}},{funcs:["\\over","\\choose"],data:{numArgs:0,handler:function(e){var t;switch(e){case"\\over":t="\\frac";break;case"\\choose":t="\\binom";break;default:throw new Error("Unrecognized infix genfrac command")}return{type:"infix",replaceWith:t}}}},{funcs:["\\\\","\\cr"],data:{numArgs:0,numOptionalArgs:1,argTypes:["size"],handler:function(e,t){return{type:"cr",size:t}}}},{funcs:["\\begin","\\end"],data:{numArgs:1,argTypes:["text"],handler:function(e,t,i){if(t.type!=="ordgroup"){throw new a("Invalid environment name",this.lexer,i[1])}var h="";for(var r=0;r";return e};function r(e){this.text=e}r.prototype.toNode=function(){return document.createTextNode(this.text)};r.prototype.toMarkup=function(){return h.escape(this.text)};t.exports={MathNode:a,TextNode:r}},{"./utils":23}],20:[function(e,t,i){function h(e,t,i){this.type=e;this.value=t;this.mode=i}function a(e,t,i){this.result=e;this.position=t}t.exports={ParseNode:h,ParseResult:a}},{}],21:[function(e,t,i){var h=e("./Parser");var a=function(e,t){var i=new h(e,t);return i.parse()};t.exports=a},{"./Parser":6}],22:[function(e,t,i){var h={math:{"\\equiv":{font:"main",group:"rel",replace:"\u2261"},"\\prec":{font:"main",group:"rel",replace:"\u227a"},"\\succ":{font:"main",group:"rel",replace:"\u227b"},"\\sim":{font:"main",group:"rel",replace:"\u223c"},"\\perp":{font:"main",group:"rel",replace:"\u22a5"},"\\preceq":{font:"main",group:"rel",replace:"\u2aaf"},"\\succeq":{font:"main",group:"rel",replace:"\u2ab0"},"\\simeq":{font:"main",group:"rel",replace:"\u2243"},"\\mid":{font:"main",group:"rel",replace:"\u2223"},"\\ll":{font:"main",group:"rel",replace:"\u226a"},"\\gg":{font:"main",group:"rel",replace:"\u226b"},"\\asymp":{font:"main",group:"rel",replace:"\u224d"},"\\parallel":{font:"main",group:"rel",replace:"\u2225"},"\\bowtie":{font:"main",group:"rel",replace:"\u22c8"},"\\smile":{font:"main",group:"rel",replace:"\u2323"},"\\sqsubseteq":{font:"main",group:"rel",replace:"\u2291"},"\\sqsupseteq":{font:"main",group:"rel",replace:"\u2292"},"\\doteq":{font:"main",group:"rel",replace:"\u2250"},"\\frown":{font:"main",group:"rel",replace:"\u2322"},"\\ni":{font:"main",group:"rel",replace:"\u220b"},"\\propto":{font:"main",group:"rel",replace:"\u221d"},"\\vdash":{font:"main",group:"rel",replace:"\u22a2"},"\\dashv":{font:"main",group:"rel",replace:"\u22a3"},"\\owns":{font:"main",group:"rel",replace:"\u220b"},"\\ldotp":{font:"main",group:"punct",replace:"."},"\\cdotp":{font:"main",group:"punct",replace:"\u22c5"},"\\#":{font:"main",group:"textord",replace:"#"},"\\&":{font:"main",group:"textord",replace:"&"},"\\aleph":{font:"main",group:"textord",replace:"\u2135"},"\\forall":{font:"main",group:"textord",replace:"\u2200"},"\\hbar":{font:"main",group:"textord",replace:"\u210f"},"\\exists":{font:"main",group:"textord",replace:"\u2203"},"\\nabla":{font:"main",group:"textord",replace:"\u2207"},"\\flat":{font:"main",group:"textord",replace:"\u266d"},"\\ell":{font:"main",group:"textord",replace:"\u2113"},"\\natural":{font:"main",group:"textord",replace:"\u266e"},"\\clubsuit":{font:"main",group:"textord",replace:"\u2663"},"\\wp":{font:"main",group:"textord",replace:"\u2118"},"\\sharp":{font:"main",group:"textord",replace:"\u266f"},"\\diamondsuit":{font:"main",group:"textord",replace:"\u2662"},"\\Re":{font:"main",group:"textord",replace:"\u211c"},"\\heartsuit":{font:"main",group:"textord",replace:"\u2661"},"\\Im":{font:"main",group:"textord",replace:"\u2111"},"\\spadesuit":{font:"main",group:"textord",replace:"\u2660"},"\\dag":{font:"main",group:"textord",replace:"\u2020"},"\\ddag":{font:"main",group:"textord",replace:"\u2021"},"\\rmoustache":{font:"main",group:"close",replace:"\u23b1"},"\\lmoustache":{font:"main",group:"open",replace:"\u23b0"},"\\rgroup":{font:"main",group:"close",replace:"\u27ef"},"\\lgroup":{font:"main",group:"open",replace:"\u27ee"},"\\mp":{font:"main",group:"bin",replace:"\u2213"},"\\ominus":{font:"main",group:"bin",replace:"\u2296"},"\\uplus":{font:"main",group:"bin",replace:"\u228e"},"\\sqcap":{font:"main",group:"bin",replace:"\u2293"},"\\ast":{font:"main",group:"bin",replace:"\u2217"},"\\sqcup":{font:"main",group:"bin",replace:"\u2294"},"\\bigcirc":{font:"main",group:"bin",replace:"\u25ef"},"\\bullet":{font:"main",group:"bin",replace:"\u2219"},"\\ddagger":{font:"main",group:"bin",replace:"\u2021"},"\\wr":{font:"main",group:"bin",replace:"\u2240"},"\\amalg":{font:"main",group:"bin",replace:"\u2a3f"},"\\longleftarrow":{font:"main",group:"rel",replace:"\u27f5"},"\\Leftarrow":{font:"main",group:"rel",replace:"\u21d0"},"\\Longleftarrow":{font:"main",group:"rel",replace:"\u27f8"},"\\longrightarrow":{font:"main",group:"rel",replace:"\u27f6"},"\\Rightarrow":{font:"main",group:"rel",replace:"\u21d2"},"\\Longrightarrow":{font:"main",group:"rel",replace:"\u27f9"},"\\leftrightarrow":{font:"main",group:"rel",replace:"\u2194"},"\\longleftrightarrow":{font:"main",group:"rel",replace:"\u27f7"},"\\Leftrightarrow":{font:"main",group:"rel",replace:"\u21d4"},"\\Longleftrightarrow":{font:"main",group:"rel",replace:"\u27fa"},"\\mapsto":{font:"main",group:"rel",replace:"\u21a6"},"\\longmapsto":{font:"main",group:"rel",replace:"\u27fc"},"\\nearrow":{font:"main",group:"rel",replace:"\u2197"},"\\hookleftarrow":{font:"main",group:"rel",replace:"\u21a9"},"\\hookrightarrow":{font:"main",group:"rel",replace:"\u21aa"},"\\searrow":{font:"main",group:"rel",replace:"\u2198"},"\\leftharpoonup":{font:"main",group:"rel",replace:"\u21bc"},"\\rightharpoonup":{font:"main",group:"rel",replace:"\u21c0"},"\\swarrow":{font:"main",group:"rel",replace:"\u2199"},"\\leftharpoondown":{font:"main",group:"rel",replace:"\u21bd"},"\\rightharpoondown":{font:"main",group:"rel",replace:"\u21c1"},"\\nwarrow":{font:"main",group:"rel",replace:"\u2196"},"\\rightleftharpoons":{font:"main",group:"rel",replace:"\u21cc"},"\\nless":{font:"ams",group:"rel",replace:"\u226e"},"\\nleqslant":{font:"ams",group:"rel",replace:"\ue010"},"\\nleqq":{font:"ams",group:"rel",replace:"\ue011"},"\\lneq":{font:"ams",group:"rel",replace:"\u2a87"},"\\lneqq":{font:"ams",group:"rel",replace:"\u2268"},"\\lvertneqq":{font:"ams",group:"rel",replace:"\ue00c"},"\\lnsim":{font:"ams",group:"rel",replace:"\u22e6"},"\\lnapprox":{font:"ams",group:"rel",replace:"\u2a89"},"\\nprec":{font:"ams",group:"rel",replace:"\u2280"},"\\npreceq":{font:"ams",group:"rel",replace:"\u22e0"},"\\precnsim":{font:"ams",group:"rel",replace:"\u22e8"},"\\precnapprox":{font:"ams",group:"rel",replace:"\u2ab9"},"\\nsim":{font:"ams",group:"rel",replace:"\u2241"},"\\nshortmid":{font:"ams",group:"rel",replace:"\ue006"},"\\nmid":{font:"ams",group:"rel",replace:"\u2224"},"\\nvdash":{font:"ams",group:"rel",replace:"\u22ac"},"\\nvDash":{font:"ams",group:"rel",replace:"\u22ad"},"\\ntriangleleft":{font:"ams",group:"rel",replace:"\u22ea"},"\\ntrianglelefteq":{font:"ams",group:"rel",replace:"\u22ec"},"\\subsetneq":{font:"ams",group:"rel",replace:"\u228a"},"\\varsubsetneq":{font:"ams",group:"rel",replace:"\ue01a"},"\\subsetneqq":{font:"ams",group:"rel",replace:"\u2acb"},"\\varsubsetneqq":{font:"ams",group:"rel",replace:"\ue017"},"\\ngtr":{font:"ams",group:"rel",replace:"\u226f"},"\\ngeqslant":{font:"ams",group:"rel",replace:"\ue00f"},"\\ngeqq":{font:"ams",group:"rel",replace:"\ue00e"},"\\gneq":{font:"ams",group:"rel",replace:"\u2a88"},"\\gneqq":{font:"ams",group:"rel",replace:"\u2269"},"\\gvertneqq":{font:"ams",group:"rel",replace:"\ue00d"},"\\gnsim":{font:"ams",group:"rel",replace:"\u22e7"},"\\gnapprox":{font:"ams",group:"rel",replace:"\u2a8a"},"\\nsucc":{font:"ams",group:"rel",replace:"\u2281"},"\\nsucceq":{font:"ams",group:"rel",replace:"\u22e1"},"\\succnsim":{font:"ams",group:"rel",replace:"\u22e9"},"\\succnapprox":{font:"ams",group:"rel",replace:"\u2aba"},"\\ncong":{font:"ams",group:"rel",replace:"\u2246"},"\\nshortparallel":{font:"ams",group:"rel",replace:"\ue007"},"\\nparallel":{font:"ams",group:"rel",replace:"\u2226"},"\\nVDash":{font:"ams",group:"rel",replace:"\u22af"},"\\ntriangleright":{font:"ams",group:"rel",replace:"\u22eb"},"\\ntrianglerighteq":{font:"ams",group:"rel",replace:"\u22ed"},"\\nsupseteqq":{font:"ams",group:"rel",replace:"\ue018"},"\\supsetneq":{font:"ams",group:"rel",replace:"\u228b"},"\\varsupsetneq":{font:"ams",group:"rel",replace:"\ue01b"},"\\supsetneqq":{font:"ams",group:"rel",replace:"\u2acc"},"\\varsupsetneqq":{font:"ams",group:"rel",replace:"\ue019"},"\\nVdash":{font:"ams",group:"rel",replace:"\u22ae"},"\\precneqq":{font:"ams",group:"rel",replace:"\u2ab5"},"\\succneqq":{font:"ams",group:"rel",replace:"\u2ab6"},"\\nsubseteqq":{font:"ams",group:"rel",replace:"\ue016"},"\\unlhd":{font:"ams",group:"bin",replace:"\u22b4"},"\\unrhd":{font:"ams",group:"bin",replace:"\u22b5"},"\\nleftarrow":{font:"ams",group:"rel",replace:"\u219a"},"\\nrightarrow":{font:"ams",group:"rel",replace:"\u219b"},"\\nLeftarrow":{font:"ams",group:"rel",replace:"\u21cd"},"\\nRightarrow":{font:"ams",group:"rel",replace:"\u21cf"},"\\nleftrightarrow":{font:"ams",group:"rel",replace:"\u21ae"},"\\nLeftrightarrow":{font:"ams",group:"rel",replace:"\u21ce"},"\\vartriangle":{font:"ams",group:"rel",replace:"\u25b3"},"\\hslash":{font:"ams",group:"textord",replace:"\u210f"},"\\triangledown":{font:"ams",group:"textord",replace:"\u25bd"},"\\lozenge":{font:"ams",group:"textord",replace:"\u25ca"},"\\circledS":{font:"ams",group:"textord",replace:"\u24c8"},"\\circledR":{font:"ams",group:"textord",replace:"\xae"},"\\measuredangle":{font:"ams",group:"textord",replace:"\u2221"},"\\nexists":{font:"ams",group:"textord",replace:"\u2204"},"\\mho":{font:"ams",group:"textord",replace:"\u2127"},"\\Finv":{font:"ams",group:"textord",replace:"\u2132"},"\\Game":{font:"ams",group:"textord",replace:"\u2141"},"\\Bbbk":{font:"ams",group:"textord",replace:"k"},"\\backprime":{font:"ams",group:"textord",replace:"\u2035"},"\\blacktriangle":{font:"ams",group:"textord",replace:"\u25b2"},"\\blacktriangledown":{font:"ams",group:"textord",replace:"\u25bc"},"\\blacksquare":{font:"ams",group:"textord",replace:"\u25a0"},"\\blacklozenge":{font:"ams",group:"textord",replace:"\u29eb"},"\\bigstar":{font:"ams",group:"textord",replace:"\u2605"},"\\sphericalangle":{font:"ams",group:"textord",replace:"\u2222"},"\\complement":{font:"ams",group:"textord",replace:"\u2201"},"\\eth":{font:"ams",group:"textord",replace:"\xf0"},"\\diagup":{font:"ams",group:"textord",replace:"\u2571"},"\\diagdown":{font:"ams",group:"textord",replace:"\u2572"},"\\square":{font:"ams",group:"textord",replace:"\u25a1"},"\\Box":{font:"ams",group:"textord",replace:"\u25a1"},"\\Diamond":{font:"ams",group:"textord",replace:"\u25ca"},"\\yen":{font:"ams",group:"textord",replace:"\xa5"},"\\checkmark":{font:"ams",group:"textord",replace:"\u2713"},"\\beth":{font:"ams",group:"textord",replace:"\u2136"},"\\daleth":{font:"ams",group:"textord",replace:"\u2138"},"\\gimel":{font:"ams",group:"textord",replace:"\u2137"},"\\digamma":{font:"ams",group:"textord",replace:"\u03dd"},"\\varkappa":{font:"ams",group:"textord",replace:"\u03f0"},"\\ulcorner":{font:"ams",group:"open",replace:"\u250c"},"\\urcorner":{font:"ams",group:"close",replace:"\u2510"},"\\llcorner":{font:"ams",group:"open",replace:"\u2514"},"\\lrcorner":{font:"ams",group:"close",replace:"\u2518"},"\\leqq":{font:"ams",group:"rel",replace:"\u2266"},"\\leqslant":{font:"ams",group:"rel",replace:"\u2a7d"},"\\eqslantless":{font:"ams",group:"rel",replace:"\u2a95"},"\\lesssim":{font:"ams",group:"rel",replace:"\u2272"},"\\lessapprox":{font:"ams",group:"rel",replace:"\u2a85"},"\\approxeq":{font:"ams",group:"rel",replace:"\u224a"},"\\lessdot":{font:"ams",group:"bin",replace:"\u22d6"},"\\lll":{font:"ams",group:"rel",replace:"\u22d8"},"\\lessgtr":{font:"ams",group:"rel",replace:"\u2276"},"\\lesseqgtr":{font:"ams",group:"rel",replace:"\u22da"},"\\lesseqqgtr":{font:"ams",group:"rel",replace:"\u2a8b"},"\\doteqdot":{font:"ams",group:"rel",replace:"\u2251"},"\\risingdotseq":{font:"ams",group:"rel",replace:"\u2253"},"\\fallingdotseq":{font:"ams",group:"rel",replace:"\u2252"},"\\backsim":{font:"ams",group:"rel",replace:"\u223d"},"\\backsimeq":{font:"ams",group:"rel",replace:"\u22cd"},"\\subseteqq":{font:"ams",group:"rel",replace:"\u2ac5"},"\\Subset":{font:"ams",group:"rel",replace:"\u22d0"},"\\sqsubset":{font:"ams",group:"rel",replace:"\u228f"},"\\preccurlyeq":{font:"ams",group:"rel",replace:"\u227c"},"\\curlyeqprec":{font:"ams",group:"rel",replace:"\u22de"},"\\precsim":{font:"ams",group:"rel",replace:"\u227e"},"\\precapprox":{font:"ams",group:"rel",replace:"\u2ab7"},"\\vartriangleleft":{font:"ams",group:"rel",replace:"\u22b2"},"\\trianglelefteq":{font:"ams",group:"rel",replace:"\u22b4"},"\\vDash":{font:"ams",group:"rel",replace:"\u22a8"},"\\Vvdash":{font:"ams",group:"rel",replace:"\u22aa"},"\\smallsmile":{font:"ams",group:"rel",replace:"\u2323"},"\\smallfrown":{font:"ams",group:"rel",replace:"\u2322"},"\\bumpeq":{font:"ams",group:"rel",replace:"\u224f"},"\\Bumpeq":{font:"ams",group:"rel",replace:"\u224e"},"\\geqq":{font:"ams",group:"rel",replace:"\u2267"},"\\geqslant":{font:"ams",group:"rel",replace:"\u2a7e"},"\\eqslantgtr":{font:"ams",group:"rel",replace:"\u2a96"},"\\gtrsim":{font:"ams",group:"rel",replace:"\u2273"},"\\gtrapprox":{font:"ams",group:"rel",replace:"\u2a86"},"\\gtrdot":{font:"ams",group:"bin",replace:"\u22d7"},"\\ggg":{font:"ams",group:"rel",replace:"\u22d9"},"\\gtrless":{font:"ams",group:"rel",replace:"\u2277"},"\\gtreqless":{font:"ams",group:"rel",replace:"\u22db"},"\\gtreqqless":{font:"ams",group:"rel",replace:"\u2a8c"},"\\eqcirc":{font:"ams",group:"rel",replace:"\u2256"},"\\circeq":{font:"ams",group:"rel",replace:"\u2257"},"\\triangleq":{font:"ams",group:"rel",replace:"\u225c"},"\\thicksim":{font:"ams",group:"rel",replace:"\u223c"},"\\thickapprox":{font:"ams",group:"rel",replace:"\u2248"},"\\supseteqq":{font:"ams",group:"rel",replace:"\u2ac6"},"\\Supset":{font:"ams",group:"rel",replace:"\u22d1"},"\\sqsupset":{font:"ams",group:"rel",replace:"\u2290"},"\\succcurlyeq":{font:"ams",group:"rel",replace:"\u227d"},"\\curlyeqsucc":{font:"ams",group:"rel",replace:"\u22df"},"\\succsim":{font:"ams",group:"rel",replace:"\u227f"},"\\succapprox":{font:"ams",group:"rel",replace:"\u2ab8"},"\\vartriangleright":{font:"ams",group:"rel",replace:"\u22b3"},"\\trianglerighteq":{font:"ams",group:"rel",replace:"\u22b5"},"\\Vdash":{font:"ams",group:"rel",replace:"\u22a9"},"\\shortmid":{font:"ams",group:"rel",replace:"\u2223"},"\\shortparallel":{font:"ams",group:"rel",replace:"\u2225"},"\\between":{font:"ams",group:"rel",replace:"\u226c"},"\\pitchfork":{font:"ams",group:"rel",replace:"\u22d4"},"\\varpropto":{font:"ams",group:"rel",replace:"\u221d"},"\\blacktriangleleft":{font:"ams",group:"rel",replace:"\u25c0"},"\\therefore":{font:"ams",group:"rel",replace:"\u2234"},"\\backepsilon":{font:"ams",group:"rel",replace:"\u220d"},"\\blacktriangleright":{font:"ams",group:"rel",replace:"\u25b6"},"\\because":{font:"ams",group:"rel",replace:"\u2235"},"\\llless":{font:"ams",group:"rel",replace:"\u22d8"},"\\gggtr":{font:"ams",group:"rel",replace:"\u22d9"},"\\lhd":{font:"ams",group:"bin",replace:"\u22b2"},"\\rhd":{font:"ams",group:"bin",replace:"\u22b3"},"\\eqsim":{font:"ams",group:"rel",replace:"\u2242"},"\\Join":{font:"main",group:"rel",replace:"\u22c8"},"\\Doteq":{font:"ams",group:"rel",replace:"\u2251"},"\\dotplus":{font:"ams",group:"bin",replace:"\u2214"},"\\smallsetminus":{font:"ams",group:"bin",replace:"\u2216"},"\\Cap":{font:"ams",group:"bin",replace:"\u22d2"},"\\Cup":{font:"ams",group:"bin",replace:"\u22d3"},"\\doublebarwedge":{font:"ams",group:"bin",replace:"\u2a5e"},"\\boxminus":{font:"ams",group:"bin",replace:"\u229f"},"\\boxplus":{font:"ams",group:"bin",replace:"\u229e"},"\\divideontimes":{font:"ams",group:"bin",replace:"\u22c7"},"\\ltimes":{font:"ams",group:"bin",replace:"\u22c9"},"\\rtimes":{font:"ams",group:"bin",replace:"\u22ca"},"\\leftthreetimes":{font:"ams",group:"bin",replace:"\u22cb"},"\\rightthreetimes":{font:"ams",group:"bin",replace:"\u22cc"},"\\curlywedge":{font:"ams",group:"bin",replace:"\u22cf"},"\\curlyvee":{font:"ams",group:"bin",replace:"\u22ce"},"\\circleddash":{font:"ams",group:"bin",replace:"\u229d"},"\\circledast":{font:"ams",group:"bin",replace:"\u229b"},"\\centerdot":{font:"ams",group:"bin",replace:"\u22c5"},"\\intercal":{font:"ams",group:"bin",replace:"\u22ba"},"\\doublecap":{font:"ams",group:"bin",replace:"\u22d2"},"\\doublecup":{font:"ams",group:"bin",replace:"\u22d3"},"\\boxtimes":{font:"ams",group:"bin",replace:"\u22a0"},"\\dashrightarrow":{font:"ams",group:"rel",replace:"\u21e2"},"\\dashleftarrow":{font:"ams",group:"rel",replace:"\u21e0"},"\\leftleftarrows":{font:"ams",group:"rel",replace:"\u21c7"},"\\leftrightarrows":{font:"ams",group:"rel",replace:"\u21c6"},"\\Lleftarrow":{font:"ams",group:"rel",replace:"\u21da"},"\\twoheadleftarrow":{font:"ams",group:"rel",replace:"\u219e"},"\\leftarrowtail":{font:"ams",group:"rel",replace:"\u21a2"},"\\looparrowleft":{font:"ams",group:"rel",replace:"\u21ab"},"\\leftrightharpoons":{font:"ams",group:"rel",replace:"\u21cb"},"\\curvearrowleft":{font:"ams",group:"rel",replace:"\u21b6"},"\\circlearrowleft":{font:"ams",group:"rel",replace:"\u21ba"},"\\Lsh":{font:"ams",group:"rel",replace:"\u21b0"},"\\upuparrows":{font:"ams",group:"rel",replace:"\u21c8"},"\\upharpoonleft":{font:"ams",group:"rel",replace:"\u21bf"},"\\downharpoonleft":{font:"ams",group:"rel",replace:"\u21c3"},"\\multimap":{font:"ams",group:"rel",replace:"\u22b8"},"\\leftrightsquigarrow":{font:"ams",group:"rel",replace:"\u21ad"},"\\rightrightarrows":{font:"ams",group:"rel",replace:"\u21c9"},"\\rightleftarrows":{font:"ams",group:"rel",replace:"\u21c4"},"\\twoheadrightarrow":{font:"ams",group:"rel",replace:"\u21a0"},"\\rightarrowtail":{font:"ams",group:"rel",replace:"\u21a3"},"\\looparrowright":{font:"ams",group:"rel",replace:"\u21ac"},"\\curvearrowright":{font:"ams",group:"rel",replace:"\u21b7"},"\\circlearrowright":{font:"ams",group:"rel",replace:"\u21bb"},"\\Rsh":{font:"ams",group:"rel",replace:"\u21b1"},"\\downdownarrows":{font:"ams",group:"rel",replace:"\u21ca"},"\\upharpoonright":{font:"ams",group:"rel",replace:"\u21be"},"\\downharpoonright":{font:"ams",group:"rel",replace:"\u21c2"},"\\rightsquigarrow":{font:"ams",group:"rel",replace:"\u21dd"},"\\leadsto":{font:"ams",group:"rel",replace:"\u21dd"},"\\Rrightarrow":{font:"ams",group:"rel",replace:"\u21db"},"\\restriction":{font:"ams",group:"rel",replace:"\u21be"},"`":{font:"main",group:"textord",replace:"\u2018"},"\\$":{font:"main",group:"textord",replace:"$"},"\\%":{font:"main",group:"textord",replace:"%"},"\\_":{font:"main",group:"textord",replace:"_"},"\\angle":{font:"main",group:"textord",replace:"\u2220"},"\\infty":{font:"main",group:"textord",replace:"\u221e"},"\\prime":{font:"main",group:"textord",replace:"\u2032"},"\\triangle":{font:"main",group:"textord",replace:"\u25b3"},"\\Gamma":{font:"main",group:"textord",replace:"\u0393"},"\\Delta":{font:"main",group:"textord",replace:"\u0394"},"\\Theta":{font:"main",group:"textord",replace:"\u0398"},"\\Lambda":{font:"main",group:"textord",replace:"\u039b"},"\\Xi":{font:"main",group:"textord",replace:"\u039e"},"\\Pi":{font:"main",group:"textord",replace:"\u03a0"},"\\Sigma":{font:"main",group:"textord",replace:"\u03a3"},"\\Upsilon":{font:"main", -group:"textord",replace:"\u03a5"},"\\Phi":{font:"main",group:"textord",replace:"\u03a6"},"\\Psi":{font:"main",group:"textord",replace:"\u03a8"},"\\Omega":{font:"main",group:"textord",replace:"\u03a9"},"\\neg":{font:"main",group:"textord",replace:"\xac"},"\\lnot":{font:"main",group:"textord",replace:"\xac"},"\\top":{font:"main",group:"textord",replace:"\u22a4"},"\\bot":{font:"main",group:"textord",replace:"\u22a5"},"\\emptyset":{font:"main",group:"textord",replace:"\u2205"},"\\varnothing":{font:"ams",group:"textord",replace:"\u2205"},"\\alpha":{font:"main",group:"mathord",replace:"\u03b1"},"\\beta":{font:"main",group:"mathord",replace:"\u03b2"},"\\gamma":{font:"main",group:"mathord",replace:"\u03b3"},"\\delta":{font:"main",group:"mathord",replace:"\u03b4"},"\\epsilon":{font:"main",group:"mathord",replace:"\u03f5"},"\\zeta":{font:"main",group:"mathord",replace:"\u03b6"},"\\eta":{font:"main",group:"mathord",replace:"\u03b7"},"\\theta":{font:"main",group:"mathord",replace:"\u03b8"},"\\iota":{font:"main",group:"mathord",replace:"\u03b9"},"\\kappa":{font:"main",group:"mathord",replace:"\u03ba"},"\\lambda":{font:"main",group:"mathord",replace:"\u03bb"},"\\mu":{font:"main",group:"mathord",replace:"\u03bc"},"\\nu":{font:"main",group:"mathord",replace:"\u03bd"},"\\xi":{font:"main",group:"mathord",replace:"\u03be"},"\\omicron":{font:"main",group:"mathord",replace:"o"},"\\pi":{font:"main",group:"mathord",replace:"\u03c0"},"\\rho":{font:"main",group:"mathord",replace:"\u03c1"},"\\sigma":{font:"main",group:"mathord",replace:"\u03c3"},"\\tau":{font:"main",group:"mathord",replace:"\u03c4"},"\\upsilon":{font:"main",group:"mathord",replace:"\u03c5"},"\\phi":{font:"main",group:"mathord",replace:"\u03d5"},"\\chi":{font:"main",group:"mathord",replace:"\u03c7"},"\\psi":{font:"main",group:"mathord",replace:"\u03c8"},"\\omega":{font:"main",group:"mathord",replace:"\u03c9"},"\\varepsilon":{font:"main",group:"mathord",replace:"\u03b5"},"\\vartheta":{font:"main",group:"mathord",replace:"\u03d1"},"\\varpi":{font:"main",group:"mathord",replace:"\u03d6"},"\\varrho":{font:"main",group:"mathord",replace:"\u03f1"},"\\varsigma":{font:"main",group:"mathord",replace:"\u03c2"},"\\varphi":{font:"main",group:"mathord",replace:"\u03c6"},"*":{font:"main",group:"bin",replace:"\u2217"},"+":{font:"main",group:"bin"},"-":{font:"main",group:"bin",replace:"\u2212"},"\\cdot":{font:"main",group:"bin",replace:"\u22c5"},"\\circ":{font:"main",group:"bin",replace:"\u2218"},"\\div":{font:"main",group:"bin",replace:"\xf7"},"\\pm":{font:"main",group:"bin",replace:"\xb1"},"\\times":{font:"main",group:"bin",replace:"\xd7"},"\\cap":{font:"main",group:"bin",replace:"\u2229"},"\\cup":{font:"main",group:"bin",replace:"\u222a"},"\\setminus":{font:"main",group:"bin",replace:"\u2216"},"\\land":{font:"main",group:"bin",replace:"\u2227"},"\\lor":{font:"main",group:"bin",replace:"\u2228"},"\\wedge":{font:"main",group:"bin",replace:"\u2227"},"\\vee":{font:"main",group:"bin",replace:"\u2228"},"\\surd":{font:"main",group:"textord",replace:"\u221a"},"(":{font:"main",group:"open"},"[":{font:"main",group:"open"},"\\langle":{font:"main",group:"open",replace:"\u27e8"},"\\lvert":{font:"main",group:"open",replace:"\u2223"},"\\lVert":{font:"main",group:"open",replace:"\u2225"},")":{font:"main",group:"close"},"]":{font:"main",group:"close"},"?":{font:"main",group:"close"},"!":{font:"main",group:"close"},"\\rangle":{font:"main",group:"close",replace:"\u27e9"},"\\rvert":{font:"main",group:"close",replace:"\u2223"},"\\rVert":{font:"main",group:"close",replace:"\u2225"},"=":{font:"main",group:"rel"},"<":{font:"main",group:"rel"},">":{font:"main",group:"rel"},":":{font:"main",group:"rel"},"\\approx":{font:"main",group:"rel",replace:"\u2248"},"\\cong":{font:"main",group:"rel",replace:"\u2245"},"\\ge":{font:"main",group:"rel",replace:"\u2265"},"\\geq":{font:"main",group:"rel",replace:"\u2265"},"\\gets":{font:"main",group:"rel",replace:"\u2190"},"\\in":{font:"main",group:"rel",replace:"\u2208"},"\\notin":{font:"main",group:"rel",replace:"\u2209"},"\\subset":{font:"main",group:"rel",replace:"\u2282"},"\\supset":{font:"main",group:"rel",replace:"\u2283"},"\\subseteq":{font:"main",group:"rel",replace:"\u2286"},"\\supseteq":{font:"main",group:"rel",replace:"\u2287"},"\\nsubseteq":{font:"ams",group:"rel",replace:"\u2288"},"\\nsupseteq":{font:"ams",group:"rel",replace:"\u2289"},"\\models":{font:"main",group:"rel",replace:"\u22a8"},"\\leftarrow":{font:"main",group:"rel",replace:"\u2190"},"\\le":{font:"main",group:"rel",replace:"\u2264"},"\\leq":{font:"main",group:"rel",replace:"\u2264"},"\\ne":{font:"main",group:"rel",replace:"\u2260"},"\\neq":{font:"main",group:"rel",replace:"\u2260"},"\\rightarrow":{font:"main",group:"rel",replace:"\u2192"},"\\to":{font:"main",group:"rel",replace:"\u2192"},"\\ngeq":{font:"ams",group:"rel",replace:"\u2271"},"\\nleq":{font:"ams",group:"rel",replace:"\u2270"},"\\!":{font:"main",group:"spacing"},"\\ ":{font:"main",group:"spacing",replace:"\xa0"},"~":{font:"main",group:"spacing",replace:"\xa0"},"\\,":{font:"main",group:"spacing"},"\\:":{font:"main",group:"spacing"},"\\;":{font:"main",group:"spacing"},"\\enspace":{font:"main",group:"spacing"},"\\qquad":{font:"main",group:"spacing"},"\\quad":{font:"main",group:"spacing"},"\\space":{font:"main",group:"spacing",replace:"\xa0"},",":{font:"main",group:"punct"},";":{font:"main",group:"punct"},"\\colon":{font:"main",group:"punct",replace:":"},"\\barwedge":{font:"ams",group:"bin",replace:"\u22bc"},"\\veebar":{font:"ams",group:"bin",replace:"\u22bb"},"\\odot":{font:"main",group:"bin",replace:"\u2299"},"\\oplus":{font:"main",group:"bin",replace:"\u2295"},"\\otimes":{font:"main",group:"bin",replace:"\u2297"},"\\partial":{font:"main",group:"textord",replace:"\u2202"},"\\oslash":{font:"main",group:"bin",replace:"\u2298"},"\\circledcirc":{font:"ams",group:"bin",replace:"\u229a"},"\\boxdot":{font:"ams",group:"bin",replace:"\u22a1"},"\\bigtriangleup":{font:"main",group:"bin",replace:"\u25b3"},"\\bigtriangledown":{font:"main",group:"bin",replace:"\u25bd"},"\\dagger":{font:"main",group:"bin",replace:"\u2020"},"\\diamond":{font:"main",group:"bin",replace:"\u22c4"},"\\star":{font:"main",group:"bin",replace:"\u22c6"},"\\triangleleft":{font:"main",group:"bin",replace:"\u25c3"},"\\triangleright":{font:"main",group:"bin",replace:"\u25b9"},"\\{":{font:"main",group:"open",replace:"{"},"\\}":{font:"main",group:"close",replace:"}"},"\\lbrace":{font:"main",group:"open",replace:"{"},"\\rbrace":{font:"main",group:"close",replace:"}"},"\\lbrack":{font:"main",group:"open",replace:"["},"\\rbrack":{font:"main",group:"close",replace:"]"},"\\lfloor":{font:"main",group:"open",replace:"\u230a"},"\\rfloor":{font:"main",group:"close",replace:"\u230b"},"\\lceil":{font:"main",group:"open",replace:"\u2308"},"\\rceil":{font:"main",group:"close",replace:"\u2309"},"\\backslash":{font:"main",group:"textord",replace:"\\"},"|":{font:"main",group:"textord",replace:"\u2223"},"\\vert":{font:"main",group:"textord",replace:"\u2223"},"\\|":{font:"main",group:"textord",replace:"\u2225"},"\\Vert":{font:"main",group:"textord",replace:"\u2225"},"\\uparrow":{font:"main",group:"rel",replace:"\u2191"},"\\Uparrow":{font:"main",group:"rel",replace:"\u21d1"},"\\downarrow":{font:"main",group:"rel",replace:"\u2193"},"\\Downarrow":{font:"main",group:"rel",replace:"\u21d3"},"\\updownarrow":{font:"main",group:"rel",replace:"\u2195"},"\\Updownarrow":{font:"main",group:"rel",replace:"\u21d5"},"\\coprod":{font:"math",group:"op",replace:"\u2210"},"\\bigvee":{font:"math",group:"op",replace:"\u22c1"},"\\bigwedge":{font:"math",group:"op",replace:"\u22c0"},"\\biguplus":{font:"math",group:"op",replace:"\u2a04"},"\\bigcap":{font:"math",group:"op",replace:"\u22c2"},"\\bigcup":{font:"math",group:"op",replace:"\u22c3"},"\\int":{font:"math",group:"op",replace:"\u222b"},"\\intop":{font:"math",group:"op",replace:"\u222b"},"\\iint":{font:"math",group:"op",replace:"\u222c"},"\\iiint":{font:"math",group:"op",replace:"\u222d"},"\\prod":{font:"math",group:"op",replace:"\u220f"},"\\sum":{font:"math",group:"op",replace:"\u2211"},"\\bigotimes":{font:"math",group:"op",replace:"\u2a02"},"\\bigoplus":{font:"math",group:"op",replace:"\u2a01"},"\\bigodot":{font:"math",group:"op",replace:"\u2a00"},"\\oint":{font:"math",group:"op",replace:"\u222e"},"\\bigsqcup":{font:"math",group:"op",replace:"\u2a06"},"\\smallint":{font:"math",group:"op",replace:"\u222b"},"\\ldots":{font:"main",group:"inner",replace:"\u2026"},"\\cdots":{font:"main",group:"inner",replace:"\u22ef"},"\\ddots":{font:"main",group:"inner",replace:"\u22f1"},"\\vdots":{font:"main",group:"textord",replace:"\u22ee"},"\\acute":{font:"main",group:"accent",replace:"\xb4"},"\\grave":{font:"main",group:"accent",replace:"`"},"\\ddot":{font:"main",group:"accent",replace:"\xa8"},"\\tilde":{font:"main",group:"accent",replace:"~"},"\\bar":{font:"main",group:"accent",replace:"\xaf"},"\\breve":{font:"main",group:"accent",replace:"\u02d8"},"\\check":{font:"main",group:"accent",replace:"\u02c7"},"\\hat":{font:"main",group:"accent",replace:"^"},"\\vec":{font:"main",group:"accent",replace:"\u20d7"},"\\dot":{font:"main",group:"accent",replace:"\u02d9"},"\\imath":{font:"main",group:"mathord",replace:"\u0131"},"\\jmath":{font:"main",group:"mathord",replace:"\u0237"}},text:{"\\ ":{font:"main",group:"spacing",replace:"\xa0"}," ":{font:"main",group:"spacing",replace:"\xa0"},"~":{font:"main",group:"spacing",replace:"\xa0"}}};var a='0123456789/@."';for(var r=0;r":">","<":"<",'"':""","'":"'"};var n=/[&><"']/g;function o(e){return c[e]}function g(e){return(""+e).replace(n,o)}var d;if(typeof document!=="undefined"){var w=document.createElement("span");if("textContent"in w){d=function(e,t){e.textContent=t}}else{d=function(e,t){e.innerText=t}}}function u(e){d(e,"")}t.exports={contains:r,deflt:l,escape:g,hyphenate:p,indexOf:a,setTextContent:d,clearNode:u}},{}]},{},[1])(1)}); +(function(e){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=e()}else if(typeof define==="function"&&define.amd){define([],e)}else{var t;if(typeof window!=="undefined"){t=window}else if(typeof global!=="undefined"){t=global}else if(typeof self!=="undefined"){t=self}else{t=this}t.katex=e()}})(function(){var e,t,r;return function a(e,t,r){function i(s,l){if(!t[s]){if(!e[s]){var o=typeof require=="function"&&require;if(!l&&o)return o(s,!0);if(n)return n(s,!0);var u=new Error("Cannot find module '"+s+"'");throw u.code="MODULE_NOT_FOUND",u}var p=t[s]={exports:{}};e[s][0].call(p.exports,function(t){var r=e[s][1][t];return i(r?r:t)},p,p.exports,a,e,t,r)}return t[s].exports}var n=typeof require=="function"&&require;for(var s=0;sm){return this.parseFunction(i)}else{throw new u("Got function '"+i.result+"' with no arguments "+"as "+e,this.lexer,r+1)}}else{return i.result}};p.prototype.handleUnsupportedCmd=function(){var e=this.nextToken.text;var t=[];for(var r=0;ri){h=this.parseFunction(p)}else{throw new u("Got function '"+p.result+"' as "+"argument to '"+e+"'",this.lexer,this.pos-1)}}else{h=p.result}s.push(h);n.push(this.pos)}s.push(n);return s};p.prototype.parseSpecialGroup=function(e,t){var r=this.mode;if(e==="original"){e=r}if(e==="color"||e==="size"){var a=this.nextToken;if(t&&a.text!=="["){return null}this.mode=e;this.expect(t?"[":"{");var i=this.nextToken;this.mode=r;var n;if(e==="color"){n=i.text}else{n=i.data}this.consume();this.expect(t?"]":"}");return new c(new h(e,n,r),false)}else if(e==="text"){var s=this.lexer.lex(this.pos,"whitespace");this.pos=s.position}this.mode=e;this.nextToken=this.lexer.lex(this.pos,e);var l;if(t){l=this.parseOptionalGroup()}else{l=this.parseGroup()}this.mode=r;this.nextToken=this.lexer.lex(this.pos,r);return l};p.prototype.parseGroup=function(){if(this.nextToken.text==="{"){this.consume();var e=this.parseExpression(false);this.expect("}");return new c(new h("ordgroup",e,this.mode),false)}else{return this.parseSymbol()}};p.prototype.parseOptionalGroup=function(){if(this.nextToken.text==="["){this.consume();var e=this.parseExpression(false,"]");this.expect("]");return new c(new h("ordgroup",e,this.mode),false)}else{return null}};p.prototype.parseSymbol=function(){var e=this.nextToken;if(a[e.text]){this.consume();return new c(e.text,true)}else if(s[this.mode][e.text]){this.consume();return new c(new h(s[this.mode][e.text].group,e.text,this.mode),false)}else{return null}};p.prototype.ParseNode=h;t.exports=p},{"./Lexer":3,"./ParseError":5,"./environments":15,"./functions":18,"./parseData":20,"./symbols":22,"./utils":23}],7:[function(e,t,r){function a(e,t){return e===undefined?t:e}function i(e){e=e||{};this.displayMode=a(e.displayMode,false);this.throwOnError=a(e.throwOnError,true);this.errorColor=a(e.errorColor,"#cc0000")}t.exports=i},{}],8:[function(e,t,r){function a(e,t,r,a){this.id=e;this.size=t;this.cramped=a;this.sizeMultiplier=r}a.prototype.sup=function(){return m[f[this.id]]};a.prototype.sub=function(){return m[d[this.id]]};a.prototype.fracNum=function(){return m[g[this.id]]};a.prototype.fracDen=function(){return m[y[this.id]]};a.prototype.cramp=function(){return m[b[this.id]]};a.prototype.cls=function(){return c[this.size]+(this.cramped?" cramped":" uncramped")};a.prototype.reset=function(){return v[this.size]};var i=0;var n=1;var s=2;var l=3;var o=4;var u=5;var p=6;var h=7;var c=["displaystyle textstyle","textstyle","scriptstyle","scriptscriptstyle"];var v=["reset-textstyle","reset-textstyle","reset-scriptstyle","reset-scriptscriptstyle"];var m=[new a(i,0,1,false),new a(n,0,1,true),new a(s,1,1,false),new a(l,1,1,true),new a(o,2,.7,false),new a(u,2,.7,true),new a(p,3,.5,false),new a(h,3,.5,true)];var f=[o,u,o,u,p,h,p,h];var d=[u,u,u,u,h,h,h,h];var g=[s,l,o,u,p,h,p,h];var y=[l,l,u,u,h,h,h,h];var b=[n,n,l,l,u,u,h,h];t.exports={DISPLAY:m[i],TEXT:m[s],SCRIPT:m[o],SCRIPTSCRIPT:m[p]}},{}],9:[function(e,t,r){var a=e("./domTree");var i=e("./fontMetrics");var n=e("./symbols");var s=e("./utils");var l=["\\Gamma","\\Delta","\\Theta","\\Lambda","\\Xi","\\Pi","\\Sigma","\\Upsilon","\\Phi","\\Psi","\\Omega"];var o=["\u0131","\u0237"];var u=function(e,t,r,s,l){if(n[r][e]&&n[r][e].replace){e=n[r][e].replace}var o=i.getCharacterMetrics(e,t);var u;if(o){u=new a.symbolNode(e,o.height,o.depth,o.italic,o.skew,l)}else{typeof console!=="undefined"&&console.warn("No character metrics for '"+e+"' in style '"+t+"'");u=new a.symbolNode(e,0,0,0,0,l)}if(s){u.style.color=s}return u};var p=function(e,t,r,a){if(e==="\\"||n[t][e].font==="main"){return u(e,"Main-Regular",t,r,a)}else{return u(e,"AMS-Regular",t,r,a.concat(["amsrm"]))}};var h=function(e,t,r,a,i){if(i==="mathord"){return c(e,t,r,a)}else if(i==="textord"){return u(e,"Main-Regular",t,r,a.concat(["mathrm"]))}else{throw new Error("unexpected type: "+i+" in mathDefault")}};var c=function(e,t,r,a){if(/[0-9]/.test(e.charAt(0))||s.contains(o,e)||s.contains(l,e)){return u(e,"Main-Italic",t,r,a.concat(["mainit"]))}else{return u(e,"Math-Italic",t,r,a.concat(["mathit"]))}};var v=function(e,t,r){var a=e.mode;var l=e.value;if(n[a][l]&&n[a][l].replace){l=n[a][l].replace}var p=["mord"];var v=t.getColor();var m=t.font;if(m){if(m==="mathit"||s.contains(o,l)){return c(l,a,v,p)}else{var f=w[m].fontName;if(i.getCharacterMetrics(l,f)){return u(l,f,a,v,p.concat([m]))}else{return h(l,a,v,p,r)}}}else{return h(l,a,v,p,r)}};var m=function(e){var t=0;var r=0;var a=0;if(e.children){for(var i=0;it){t=e.children[i].height}if(e.children[i].depth>r){r=e.children[i].depth}if(e.children[i].maxFontSize>a){a=e.children[i].maxFontSize}}}e.height=t;e.depth=r;e.maxFontSize=a};var f=function(e,t,r){var i=new a.span(e,t);m(i);if(r){i.style.color=r}return i};var d=function(e){var t=new a.documentFragment(e);m(t);return t};var g=function(e,t){var r=f([],[new a.symbolNode("\u200b")]);r.style.fontSize=t/e.style.sizeMultiplier+"em";var i=f(["fontsize-ensurer","reset-"+e.size,"size5"],[r]);return i};var y=function(e,t,r,i){var n;var s;var l;if(t==="individualShift"){var o=e;e=[o[0]];n=-o[0].shift-o[0].elem.depth;s=n;for(l=1;l0){f+=M;g-=M}}z=n.makeVList([{type:"elem",elem:u,shift:g},{type:"elem",elem:s,shift:-f}],"individualShift",null,t);if(a instanceof l.symbolNode){z.children[0].style.marginLeft=-a.italic+"em"}z.children[0].style.marginRight=k;z.children[1].style.marginRight=k}return p([v(e.value.base)],[a,z])};y.genfrac=function(e,t,r){var a=t.style;if(e.value.size==="display"){a=i.DISPLAY}else if(e.value.size==="text"){a=i.TEXT}var l=a.fracNum();var u=a.fracDen();var h=b(e.value.numer,t.withStyle(l));var c=p([a.reset(),l.cls()],[h]);var v=b(e.value.denom,t.withStyle(u));var m=p([a.reset(),u.cls()],[v]);var f;if(e.value.hasBarLine){f=o.metrics.defaultRuleThickness/t.style.sizeMultiplier}else{f=0}var d;var y;var x;if(a.size===i.DISPLAY.size){d=o.metrics.num1;if(f>0){y=3*f}else{y=7*o.metrics.defaultRuleThickness}x=o.metrics.denom1}else{if(f>0){d=o.metrics.num2;y=f}else{d=o.metrics.num3;y=3*o.metrics.defaultRuleThickness}x=o.metrics.denom2}var w;if(f===0){var k=d-h.depth-(v.height-x);if(k0){N+=x;if(S=h){continue}var O;if(s>0||e.value.hskipBeforeAndAfter){O=u.deflt(P.pregap,m);if(O!==0){R=p(["arraycolsep"],[]);R.style.width=O+"em";C.push(R)}}var I=[];for(i=0;ia.height+a.depth+c){c=(c+d-a.height-a.depth)/2}var g=-(a.height+c+l)+f.height;f.style.top=g+"em";f.height-=g;f.depth+=g;var y;if(a.height===0&&a.depth===0){y=p()}else{y=n.makeVList([{type:"elem",elem:a},{type:"kern",size:c},{type:"elem",elem:u},{type:"kern",size:l}],"firstBaseline",null,t)}if(!e.value.index){return p(["sqrt","mord"],[f,y])}else{var x=b(e.value.index,t.withStyle(i.SCRIPTSCRIPT));var w=p([t.style.reset(),i.SCRIPTSCRIPT.cls()],[x]);var k=Math.max(f.height,y.height);var z=Math.max(f.depth,y.depth);var S=.6*(k-z);var M=n.makeVList([{type:"elem",elem:w}],"shift",-S,t);var T=p(["root"],[M]);return p(["sqrt","mord"],[T,f,y]); + +}};y.sizing=function(e,t,r){var a=h(e.value.value,t.withSize(e.value.size),r);var i=p(["mord"],[p(["sizing","reset-"+t.size,e.value.size,t.style.cls()],a)]);var s=n.sizingMultiplier[e.value.size];i.maxFontSize=s*t.style.sizeMultiplier;return i};y.styling=function(e,t,r){var a={display:i.DISPLAY,text:i.TEXT,script:i.SCRIPT,scriptscript:i.SCRIPTSCRIPT};var n=a[e.value.style];var s=h(e.value.value,t.withStyle(n),r);return p([t.style.reset(),n.cls()],s)};y.font=function(e,t,r){var a=e.value.font;return b(e.value.body,t.withFont(a),r)};y.delimsizing=function(e,t,r){var a=e.value.value;if(a==="."){return p([c[e.value.delimType]])}return p([c[e.value.delimType]],[s.sizedDelim(a,e.value.size,t,e.mode)])};y.leftright=function(e,t,r){var a=h(e.value.body,t.reset());var i=0;var n=0;for(var l=0;l","\\langle","\\rangle","/","\\backslash","\\lt","\\gt"];var x=[0,1.2,1.8,2.4,3];var w=function(e,t,r,i){if(e==="<"||e==="\\lt"){e="\\langle"}else if(e===">"||e==="\\gt"){e="\\rangle"}if(o.contains(g,e)||o.contains(b,e)){return m(e,t,false,r,i)}else if(o.contains(y,e)){return d(e,x[t],false,r,i)}else{throw new a("Illegal delimiter: '"+e+"'")}};var k=[{type:"small",style:i.SCRIPTSCRIPT},{type:"small",style:i.SCRIPT},{type:"small",style:i.TEXT},{type:"large",size:1},{type:"large",size:2},{type:"large",size:3},{type:"large",size:4}];var z=[{type:"small",style:i.SCRIPTSCRIPT},{type:"small",style:i.SCRIPT},{type:"small",style:i.TEXT},{type:"stack"}];var S=[{type:"small",style:i.SCRIPTSCRIPT},{type:"small",style:i.SCRIPT},{type:"small",style:i.TEXT},{type:"large",size:1},{type:"large",size:2},{type:"large",size:3},{type:"large",size:4},{type:"stack"}];var M=function(e){if(e.type==="small"){return"Main-Regular"}else if(e.type==="large"){return"Size"+e.size+"-Regular"}else if(e.type==="stack"){return"Size4-Regular"}};var T=function(e,t,r,a){var i=Math.min(2,3-a.style.size);for(var n=i;nt){return r[n]}}return r[r.length-1]};var N=function(e,t,r,a,i){if(e==="<"||e==="\\lt"){e="\\langle"}else if(e===">"||e==="\\gt"){e="\\rangle"}var n;if(o.contains(b,e)){n=k}else if(o.contains(g,e)){n=S}else{n=z}var s=T(e,t,n,a);if(s.type==="small"){return v(e,s.style,r,a,i)}else if(s.type==="large"){return m(e,s.size,r,a,i)}else if(s.type==="stack"){return d(e,t,r,a,i)}};var q=function(e,t,r,a,i){var n=s.metrics.axisHeight*a.style.sizeMultiplier;var l=901;var o=5/s.metrics.ptPerEm;var u=Math.max(t-n,r+n);var p=Math.max(u/500*l,2*u-o);return N(e,p,true,a,i)};t.exports={sizedDelim:w,customSizedDelim:N,leftRightDelim:q}},{"./ParseError":5,"./Style":8,"./buildCommon":9,"./fontMetrics":16,"./symbols":22,"./utils":23}],14:[function(e,t,r){var a=e("./utils");var i=function(e){e=e.slice();for(var t=e.length-1;t>=0;t--){if(!e[t]){e.splice(t,1)}}return e.join(" ")};function n(e,t,r,a,i,n){this.classes=e||[];this.children=t||[];this.height=r||0;this.depth=a||0;this.maxFontSize=i||0;this.style=n||{};this.attributes={}}n.prototype.setAttribute=function(e,t){this.attributes[e]=t};n.prototype.toNode=function(){var e=document.createElement("span");e.className=i(this.classes);for(var t in this.style){if(Object.prototype.hasOwnProperty.call(this.style,t)){e.style[t]=this.style[t]}}for(var r in this.attributes){if(Object.prototype.hasOwnProperty.call(this.attributes,r)){e.setAttribute(r,this.attributes[r])}}for(var a=0;a";return e};function s(e,t,r,a){this.children=e||[];this.height=t||0;this.depth=r||0;this.maxFontSize=a||0}s.prototype.toNode=function(){var e=document.createDocumentFragment();for(var t=0;t0){t=document.createElement("span");t.style.marginRight=this.italic+"em"}if(this.classes.length>0){t=t||document.createElement("span");t.className=i(this.classes)}for(var r in this.style){if(this.style.hasOwnProperty(r)){t=t||document.createElement("span");t.style[r]=this.style[r]}}if(t){t.appendChild(e);return t}else{return e}};l.prototype.toMarkup=function(){var e=false;var t="0){r+="margin-right:"+this.italic+"em;"}for(var n in this.style){if(this.style.hasOwnProperty(n)){r+=a.hyphenate(n)+":"+this.style[n]+";"}}if(r){e=true;t+=' style="'+a.escape(r)+'"'}var s=a.escape(this.value);if(e){t+=">";t+=s;t+="";return t}else{return s}};t.exports={span:n,documentFragment:s,symbolNode:l}},{"./utils":23}],15:[function(e,t,r){var a=e("./fontMetrics");var i=e("./parseData");var n=e("./ParseError");var s=i.ParseNode;function l(e,t){var r=[];var a=[r];var i=[];while(true){var l=e.parseExpression(false,null);r.push(new s("ordgroup",l,e.mode));var o=e.nextToken.text;if(o==="&"){e.consume()}else if(o==="\\end"){break}else if(o==="\\\\"||o==="\\cr"){var u=e.parseFunction();i.push(u.value.size);r=[];a.push(r)}else{var p=Math.min(e.pos+1,e.lexer._input.length);throw new n("Expected & or \\\\ or \\end",e.lexer,p)}}t.body=a;t.rowGaps=i;return new s(t.type,t,e.mode)}function o(e,r,a){if(typeof e==="string"){e=[e]}if(typeof r==="number"){r={numArgs:r}}var i={numArgs:r.numArgs||0,argTypes:r.argTypes,greediness:1,allowedInText:!!r.allowedInText,numOptionalArgs:r.numOptionalArgs||0,handler:a};for(var n=0;n0){o=2}t.value.cols[i]={type:"align",align:n,pregap:o,postgap:0}}return t})},{"./ParseError":5,"./fontMetrics":16,"./parseData":20}],16:[function(e,t,r){var a=e("./Style");var i=.025;var n=0;var s=0;var l=0;var o=.431;var u=1;var p=0;var h=.677;var c=.394;var v=.444;var m=.686;var f=.345;var d=.413;var g=.363;var y=.289;var b=.15;var x=.247;var w=.386;var k=.05;var z=2.39;var S=1.01;var M=.81;var T=.71;var N=.25;var q=0;var A=0;var C=0;var R=0;var E=.431;var P=1;var D=0;var L=.04;var O=.111;var I=.166;var B=.2;var F=.6;var _=.1;var V=10;var G=2/V;var H={xHeight:o,quad:u,num1:h,num2:c,num3:v,denom1:m,denom2:f,sup1:d,sup2:g,sup3:y,sub1:b,sub2:x,supDrop:w,subDrop:k,axisHeight:N,defaultRuleThickness:L,bigOpSpacing1:O,bigOpSpacing2:I,bigOpSpacing3:B,bigOpSpacing4:F,bigOpSpacing5:_,ptPerEm:V,emPerEx:o/u,doubleRuleSep:G,delim1:z,getDelim2:function(e){if(e.size===a.TEXT.size){return S}else if(e.size===a.SCRIPT.size){return M}else if(e.size===a.SCRIPTSCRIPT.size){return T}throw new Error("Unexpected style size: "+e.size)}};var X=e("./fontMetricsData");var U=function(e,t){var r=X[t][e.charCodeAt(0)];if(r){return{depth:r[0],height:r[1],italic:r[2],skew:r[3],width:r[4]}}};t.exports={metrics:H,getCharacterMetrics:U}},{"./Style":8,"./fontMetricsData":17}],17:[function(e,t,r){t.exports={"AMS-Regular":{65:[0,.68889,0,0],66:[0,.68889,0,0],67:[0,.68889,0,0],68:[0,.68889,0,0],69:[0,.68889,0,0],70:[0,.68889,0,0],71:[0,.68889,0,0],72:[0,.68889,0,0],73:[0,.68889,0,0],74:[.16667,.68889,0,0],75:[0,.68889,0,0],76:[0,.68889,0,0],77:[0,.68889,0,0],78:[0,.68889,0,0],79:[.16667,.68889,0,0],80:[0,.68889,0,0],81:[.16667,.68889,0,0],82:[0,.68889,0,0],83:[0,.68889,0,0],84:[0,.68889,0,0],85:[0,.68889,0,0],86:[0,.68889,0,0],87:[0,.68889,0,0],88:[0,.68889,0,0],89:[0,.68889,0,0],90:[0,.68889,0,0],107:[0,.68889,0,0],165:[0,.675,.025,0],174:[.15559,.69224,0,0],240:[0,.68889,0,0],295:[0,.68889,0,0],710:[0,.825,0,0],732:[0,.9,0,0],770:[0,.825,0,0],771:[0,.9,0,0],989:[.08167,.58167,0,0],1008:[0,.43056,.04028,0],8245:[0,.54986,0,0],8463:[0,.68889,0,0],8487:[0,.68889,0,0],8498:[0,.68889,0,0],8502:[0,.68889,0,0],8503:[0,.68889,0,0],8504:[0,.68889,0,0],8513:[0,.68889,0,0],8592:[-.03598,.46402,0,0],8594:[-.03598,.46402,0,0],8602:[-.13313,.36687,0,0],8603:[-.13313,.36687,0,0],8606:[.01354,.52239,0,0],8608:[.01354,.52239,0,0],8610:[.01354,.52239,0,0],8611:[.01354,.52239,0,0],8619:[0,.54986,0,0],8620:[0,.54986,0,0],8621:[-.13313,.37788,0,0],8622:[-.13313,.36687,0,0],8624:[0,.69224,0,0],8625:[0,.69224,0,0],8630:[0,.43056,0,0],8631:[0,.43056,0,0],8634:[.08198,.58198,0,0],8635:[.08198,.58198,0,0],8638:[.19444,.69224,0,0],8639:[.19444,.69224,0,0],8642:[.19444,.69224,0,0],8643:[.19444,.69224,0,0],8644:[.1808,.675,0,0],8646:[.1808,.675,0,0],8647:[.1808,.675,0,0],8648:[.19444,.69224,0,0],8649:[.1808,.675,0,0],8650:[.19444,.69224,0,0],8651:[.01354,.52239,0,0],8652:[.01354,.52239,0,0],8653:[-.13313,.36687,0,0],8654:[-.13313,.36687,0,0],8655:[-.13313,.36687,0,0],8666:[.13667,.63667,0,0],8667:[.13667,.63667,0,0],8669:[-.13313,.37788,0,0],8672:[-.064,.437,0,0],8674:[-.064,.437,0,0],8705:[0,.825,0,0],8708:[0,.68889,0,0],8709:[.08167,.58167,0,0],8717:[0,.43056,0,0],8722:[-.03598,.46402,0,0],8724:[.08198,.69224,0,0],8726:[.08167,.58167,0,0],8733:[0,.69224,0,0],8736:[0,.69224,0,0],8737:[0,.69224,0,0],8738:[.03517,.52239,0,0],8739:[.08167,.58167,0,0],8740:[.25142,.74111,0,0],8741:[.08167,.58167,0,0],8742:[.25142,.74111,0,0],8756:[0,.69224,0,0],8757:[0,.69224,0,0],8764:[-.13313,.36687,0,0],8765:[-.13313,.37788,0,0],8769:[-.13313,.36687,0,0],8770:[-.03625,.46375,0,0],8774:[.30274,.79383,0,0],8776:[-.01688,.48312,0,0],8778:[.08167,.58167,0,0],8782:[.06062,.54986,0,0],8783:[.06062,.54986,0,0],8785:[.08198,.58198,0,0],8786:[.08198,.58198,0,0],8787:[.08198,.58198,0,0],8790:[0,.69224,0,0],8791:[.22958,.72958,0,0],8796:[.08198,.91667,0,0],8806:[.25583,.75583,0,0],8807:[.25583,.75583,0,0],8808:[.25142,.75726,0,0],8809:[.25142,.75726,0,0],8812:[.25583,.75583,0,0],8814:[.20576,.70576,0,0],8815:[.20576,.70576,0,0],8816:[.30274,.79383,0,0],8817:[.30274,.79383,0,0],8818:[.22958,.72958,0,0],8819:[.22958,.72958,0,0],8822:[.1808,.675,0,0],8823:[.1808,.675,0,0],8828:[.13667,.63667,0,0],8829:[.13667,.63667,0,0],8830:[.22958,.72958,0,0],8831:[.22958,.72958,0,0],8832:[.20576,.70576,0,0],8833:[.20576,.70576,0,0],8840:[.30274,.79383,0,0],8841:[.30274,.79383,0,0],8842:[.13597,.63597,0,0],8843:[.13597,.63597,0,0],8847:[.03517,.54986,0,0],8848:[.03517,.54986,0,0],8858:[.08198,.58198,0,0],8859:[.08198,.58198,0,0],8861:[.08198,.58198,0,0],8862:[0,.675,0,0],8863:[0,.675,0,0],8864:[0,.675,0,0],8865:[0,.675,0,0],8872:[0,.69224,0,0],8873:[0,.69224,0,0],8874:[0,.69224,0,0],8876:[0,.68889,0,0],8877:[0,.68889,0,0],8878:[0,.68889,0,0],8879:[0,.68889,0,0],8882:[.03517,.54986,0,0],8883:[.03517,.54986,0,0],8884:[.13667,.63667,0,0],8885:[.13667,.63667,0,0],8888:[0,.54986,0,0],8890:[.19444,.43056,0,0],8891:[.19444,.69224,0,0],8892:[.19444,.69224,0,0],8901:[0,.54986,0,0],8903:[.08167,.58167,0,0],8905:[.08167,.58167,0,0],8906:[.08167,.58167,0,0],8907:[0,.69224,0,0],8908:[0,.69224,0,0],8909:[-.03598,.46402,0,0],8910:[0,.54986,0,0],8911:[0,.54986,0,0],8912:[.03517,.54986,0,0],8913:[.03517,.54986,0,0],8914:[0,.54986,0,0],8915:[0,.54986,0,0],8916:[0,.69224,0,0],8918:[.0391,.5391,0,0],8919:[.0391,.5391,0,0],8920:[.03517,.54986,0,0],8921:[.03517,.54986,0,0],8922:[.38569,.88569,0,0],8923:[.38569,.88569,0,0],8926:[.13667,.63667,0,0],8927:[.13667,.63667,0,0],8928:[.30274,.79383,0,0],8929:[.30274,.79383,0,0],8934:[.23222,.74111,0,0],8935:[.23222,.74111,0,0],8936:[.23222,.74111,0,0],8937:[.23222,.74111,0,0],8938:[.20576,.70576,0,0],8939:[.20576,.70576,0,0],8940:[.30274,.79383,0,0],8941:[.30274,.79383,0,0],8994:[.19444,.69224,0,0],8995:[.19444,.69224,0,0],9416:[.15559,.69224,0,0],9484:[0,.69224,0,0],9488:[0,.69224,0,0],9492:[0,.37788,0,0],9496:[0,.37788,0,0],9585:[.19444,.68889,0,0],9586:[.19444,.74111,0,0],9632:[0,.675,0,0],9633:[0,.675,0,0],9650:[0,.54986,0,0],9651:[0,.54986,0,0],9654:[.03517,.54986,0,0],9660:[0,.54986,0,0],9661:[0,.54986,0,0],9664:[.03517,.54986,0,0],9674:[.11111,.69224,0,0],9733:[.19444,.69224,0,0],10003:[0,.69224,0,0],10016:[0,.69224,0,0],10731:[.11111,.69224,0,0],10846:[.19444,.75583,0,0],10877:[.13667,.63667,0,0],10878:[.13667,.63667,0,0],10885:[.25583,.75583,0,0],10886:[.25583,.75583,0,0],10887:[.13597,.63597,0,0],10888:[.13597,.63597,0,0],10889:[.26167,.75726,0,0],10890:[.26167,.75726,0,0],10891:[.48256,.98256,0,0],10892:[.48256,.98256,0,0],10901:[.13667,.63667,0,0],10902:[.13667,.63667,0,0],10933:[.25142,.75726,0,0],10934:[.25142,.75726,0,0],10935:[.26167,.75726,0,0],10936:[.26167,.75726,0,0],10937:[.26167,.75726,0,0],10938:[.26167,.75726,0,0],10949:[.25583,.75583,0,0],10950:[.25583,.75583,0,0],10955:[.28481,.79383,0,0],10956:[.28481,.79383,0,0],57350:[.08167,.58167,0,0],57351:[.08167,.58167,0,0],57352:[.08167,.58167,0,0],57353:[0,.43056,.04028,0],57356:[.25142,.75726,0,0],57357:[.25142,.75726,0,0],57358:[.41951,.91951,0,0],57359:[.30274,.79383,0,0],57360:[.30274,.79383,0,0],57361:[.41951,.91951,0,0],57366:[.25142,.75726,0,0],57367:[.25142,.75726,0,0],57368:[.25142,.75726,0,0],57369:[.25142,.75726,0,0],57370:[.13597,.63597,0,0],57371:[.13597,.63597,0,0]},"Caligraphic-Regular":{48:[0,.43056,0,0],49:[0,.43056,0,0],50:[0,.43056,0,0],51:[.19444,.43056,0,0],52:[.19444,.43056,0,0],53:[.19444,.43056,0,0],54:[0,.64444,0,0],55:[.19444,.43056,0,0],56:[0,.64444,0,0],57:[.19444,.43056,0,0],65:[0,.68333,0,.19445],66:[0,.68333,.03041,.13889],67:[0,.68333,.05834,.13889],68:[0,.68333,.02778,.08334],69:[0,.68333,.08944,.11111],70:[0,.68333,.09931,.11111],71:[.09722,.68333,.0593,.11111],72:[0,.68333,.00965,.11111],73:[0,.68333,.07382,0],74:[.09722,.68333,.18472,.16667],75:[0,.68333,.01445,.05556],76:[0,.68333,0,.13889],77:[0,.68333,0,.13889],78:[0,.68333,.14736,.08334],79:[0,.68333,.02778,.11111],80:[0,.68333,.08222,.08334],81:[.09722,.68333,0,.11111],82:[0,.68333,0,.08334],83:[0,.68333,.075,.13889],84:[0,.68333,.25417,0],85:[0,.68333,.09931,.08334],86:[0,.68333,.08222,0],87:[0,.68333,.08222,.08334],88:[0,.68333,.14643,.13889],89:[.09722,.68333,.08222,.08334],90:[0,.68333,.07944,.13889]},"Fraktur-Regular":{33:[0,.69141,0,0],34:[0,.69141,0,0],38:[0,.69141,0,0],39:[0,.69141,0,0],40:[.24982,.74947,0,0],41:[.24982,.74947,0,0],42:[0,.62119,0,0],43:[.08319,.58283,0,0],44:[0,.10803,0,0],45:[.08319,.58283,0,0],46:[0,.10803,0,0],47:[.24982,.74947,0,0],48:[0,.47534,0,0],49:[0,.47534,0,0],50:[0,.47534,0,0],51:[.18906,.47534,0,0],52:[.18906,.47534,0,0],53:[.18906,.47534,0,0],54:[0,.69141,0,0],55:[.18906,.47534,0,0],56:[0,.69141,0,0],57:[.18906,.47534,0,0],58:[0,.47534,0,0],59:[.12604,.47534,0,0],61:[-.13099,.36866,0,0],63:[0,.69141,0,0],65:[0,.69141,0,0],66:[0,.69141,0,0],67:[0,.69141,0,0],68:[0,.69141,0,0],69:[0,.69141,0,0],70:[.12604,.69141,0,0],71:[0,.69141,0,0],72:[.06302,.69141,0,0],73:[0,.69141,0,0],74:[.12604,.69141,0,0],75:[0,.69141,0,0],76:[0,.69141,0,0],77:[0,.69141,0,0],78:[0,.69141,0,0],79:[0,.69141,0,0],80:[.18906,.69141,0,0],81:[.03781,.69141,0,0],82:[0,.69141,0,0],83:[0,.69141,0,0],84:[0,.69141,0,0],85:[0,.69141,0,0],86:[0,.69141,0,0],87:[0,.69141,0,0],88:[0,.69141,0,0],89:[.18906,.69141,0,0],90:[.12604,.69141,0,0],91:[.24982,.74947,0,0],93:[.24982,.74947,0,0],94:[0,.69141,0,0],97:[0,.47534,0,0],98:[0,.69141,0,0],99:[0,.47534,0,0],100:[0,.62119,0,0],101:[0,.47534,0,0],102:[.18906,.69141,0,0],103:[.18906,.47534,0,0],104:[.18906,.69141,0,0],105:[0,.69141,0,0],106:[0,.69141,0,0],107:[0,.69141,0,0],108:[0,.69141,0,0],109:[0,.47534,0,0],110:[0,.47534,0,0],111:[0,.47534,0,0],112:[.18906,.52396,0,0],113:[.18906,.47534,0,0],114:[0,.47534,0,0],115:[0,.47534,0,0],116:[0,.62119,0,0],117:[0,.47534,0,0],118:[0,.52396,0,0],119:[0,.52396,0,0],120:[.18906,.47534,0,0],121:[.18906,.47534,0,0],122:[.18906,.47534,0,0],8216:[0,.69141,0,0],8217:[0,.69141,0,0],58112:[0,.62119,0,0],58113:[0,.62119,0,0],58114:[.18906,.69141,0,0],58115:[.18906,.69141,0,0],58116:[.18906,.47534,0,0],58117:[0,.69141,0,0],58118:[0,.62119,0,0],58119:[0,.47534,0,0]},"Main-Bold":{33:[0,.69444,0,0],34:[0,.69444,0,0],35:[.19444,.69444,0,0],36:[.05556,.75,0,0],37:[.05556,.75,0,0],38:[0,.69444,0,0],39:[0,.69444,0,0],40:[.25,.75,0,0],41:[.25,.75,0,0],42:[0,.75,0,0],43:[.13333,.63333,0,0],44:[.19444,.15556,0,0],45:[0,.44444,0,0],46:[0,.15556,0,0],47:[.25,.75,0,0],48:[0,.64444,0,0],49:[0,.64444,0,0],50:[0,.64444,0,0],51:[0,.64444,0,0],52:[0,.64444,0,0],53:[0,.64444,0,0],54:[0,.64444,0,0],55:[0,.64444,0,0],56:[0,.64444,0,0],57:[0,.64444,0,0],58:[0,.44444,0,0],59:[.19444,.44444,0,0],60:[.08556,.58556,0,0],61:[-.10889,.39111,0,0],62:[.08556,.58556,0,0],63:[0,.69444,0,0],64:[0,.69444,0,0],65:[0,.68611,0,0],66:[0,.68611,0,0],67:[0,.68611,0,0],68:[0,.68611,0,0],69:[0,.68611,0,0],70:[0,.68611,0,0],71:[0,.68611,0,0],72:[0,.68611,0,0],73:[0,.68611,0,0],74:[0,.68611,0,0],75:[0,.68611,0,0],76:[0,.68611,0,0],77:[0,.68611,0,0],78:[0,.68611,0,0],79:[0,.68611,0,0],80:[0,.68611,0,0],81:[.19444,.68611,0,0],82:[0,.68611,0,0],83:[0,.68611,0,0],84:[0,.68611,0,0],85:[0,.68611,0,0],86:[0,.68611,.01597,0],87:[0,.68611,.01597,0],88:[0,.68611,0,0],89:[0,.68611,.02875,0],90:[0,.68611,0,0],91:[.25,.75,0,0],92:[.25,.75,0,0],93:[.25,.75,0,0],94:[0,.69444,0,0],95:[.31,.13444,.03194,0],96:[0,.69444,0,0],97:[0,.44444,0,0],98:[0,.69444,0,0],99:[0,.44444,0,0],100:[0,.69444,0,0],101:[0,.44444,0,0],102:[0,.69444,.10903,0],103:[.19444,.44444,.01597,0],104:[0,.69444,0,0],105:[0,.69444,0,0],106:[.19444,.69444,0,0],107:[0,.69444,0,0],108:[0,.69444,0,0],109:[0,.44444,0,0], +110:[0,.44444,0,0],111:[0,.44444,0,0],112:[.19444,.44444,0,0],113:[.19444,.44444,0,0],114:[0,.44444,0,0],115:[0,.44444,0,0],116:[0,.63492,0,0],117:[0,.44444,0,0],118:[0,.44444,.01597,0],119:[0,.44444,.01597,0],120:[0,.44444,0,0],121:[.19444,.44444,.01597,0],122:[0,.44444,0,0],123:[.25,.75,0,0],124:[.25,.75,0,0],125:[.25,.75,0,0],126:[.35,.34444,0,0],168:[0,.69444,0,0],172:[0,.44444,0,0],175:[0,.59611,0,0],176:[0,.69444,0,0],177:[.13333,.63333,0,0],180:[0,.69444,0,0],215:[.13333,.63333,0,0],247:[.13333,.63333,0,0],305:[0,.44444,0,0],567:[.19444,.44444,0,0],710:[0,.69444,0,0],711:[0,.63194,0,0],713:[0,.59611,0,0],714:[0,.69444,0,0],715:[0,.69444,0,0],728:[0,.69444,0,0],729:[0,.69444,0,0],730:[0,.69444,0,0],732:[0,.69444,0,0],768:[0,.69444,0,0],769:[0,.69444,0,0],770:[0,.69444,0,0],771:[0,.69444,0,0],772:[0,.59611,0,0],774:[0,.69444,0,0],775:[0,.69444,0,0],776:[0,.69444,0,0],778:[0,.69444,0,0],779:[0,.69444,0,0],780:[0,.63194,0,0],824:[.19444,.69444,0,0],915:[0,.68611,0,0],916:[0,.68611,0,0],920:[0,.68611,0,0],923:[0,.68611,0,0],926:[0,.68611,0,0],928:[0,.68611,0,0],931:[0,.68611,0,0],933:[0,.68611,0,0],934:[0,.68611,0,0],936:[0,.68611,0,0],937:[0,.68611,0,0],8211:[0,.44444,.03194,0],8212:[0,.44444,.03194,0],8216:[0,.69444,0,0],8217:[0,.69444,0,0],8220:[0,.69444,0,0],8221:[0,.69444,0,0],8224:[.19444,.69444,0,0],8225:[.19444,.69444,0,0],8242:[0,.55556,0,0],8407:[0,.72444,.15486,0],8463:[0,.69444,0,0],8465:[0,.69444,0,0],8467:[0,.69444,0,0],8472:[.19444,.44444,0,0],8476:[0,.69444,0,0],8501:[0,.69444,0,0],8592:[-.10889,.39111,0,0],8593:[.19444,.69444,0,0],8594:[-.10889,.39111,0,0],8595:[.19444,.69444,0,0],8596:[-.10889,.39111,0,0],8597:[.25,.75,0,0],8598:[.19444,.69444,0,0],8599:[.19444,.69444,0,0],8600:[.19444,.69444,0,0],8601:[.19444,.69444,0,0],8636:[-.10889,.39111,0,0],8637:[-.10889,.39111,0,0],8640:[-.10889,.39111,0,0],8641:[-.10889,.39111,0,0],8656:[-.10889,.39111,0,0],8657:[.19444,.69444,0,0],8658:[-.10889,.39111,0,0],8659:[.19444,.69444,0,0],8660:[-.10889,.39111,0,0],8661:[.25,.75,0,0],8704:[0,.69444,0,0],8706:[0,.69444,.06389,0],8707:[0,.69444,0,0],8709:[.05556,.75,0,0],8711:[0,.68611,0,0],8712:[.08556,.58556,0,0],8715:[.08556,.58556,0,0],8722:[.13333,.63333,0,0],8723:[.13333,.63333,0,0],8725:[.25,.75,0,0],8726:[.25,.75,0,0],8727:[-.02778,.47222,0,0],8728:[-.02639,.47361,0,0],8729:[-.02639,.47361,0,0],8730:[.18,.82,0,0],8733:[0,.44444,0,0],8734:[0,.44444,0,0],8736:[0,.69224,0,0],8739:[.25,.75,0,0],8741:[.25,.75,0,0],8743:[0,.55556,0,0],8744:[0,.55556,0,0],8745:[0,.55556,0,0],8746:[0,.55556,0,0],8747:[.19444,.69444,.12778,0],8764:[-.10889,.39111,0,0],8768:[.19444,.69444,0,0],8771:[.00222,.50222,0,0],8776:[.02444,.52444,0,0],8781:[.00222,.50222,0,0],8801:[.00222,.50222,0,0],8804:[.19667,.69667,0,0],8805:[.19667,.69667,0,0],8810:[.08556,.58556,0,0],8811:[.08556,.58556,0,0],8826:[.08556,.58556,0,0],8827:[.08556,.58556,0,0],8834:[.08556,.58556,0,0],8835:[.08556,.58556,0,0],8838:[.19667,.69667,0,0],8839:[.19667,.69667,0,0],8846:[0,.55556,0,0],8849:[.19667,.69667,0,0],8850:[.19667,.69667,0,0],8851:[0,.55556,0,0],8852:[0,.55556,0,0],8853:[.13333,.63333,0,0],8854:[.13333,.63333,0,0],8855:[.13333,.63333,0,0],8856:[.13333,.63333,0,0],8857:[.13333,.63333,0,0],8866:[0,.69444,0,0],8867:[0,.69444,0,0],8868:[0,.69444,0,0],8869:[0,.69444,0,0],8900:[-.02639,.47361,0,0],8901:[-.02639,.47361,0,0],8902:[-.02778,.47222,0,0],8968:[.25,.75,0,0],8969:[.25,.75,0,0],8970:[.25,.75,0,0],8971:[.25,.75,0,0],8994:[-.13889,.36111,0,0],8995:[-.13889,.36111,0,0],9651:[.19444,.69444,0,0],9657:[-.02778,.47222,0,0],9661:[.19444,.69444,0,0],9667:[-.02778,.47222,0,0],9711:[.19444,.69444,0,0],9824:[.12963,.69444,0,0],9825:[.12963,.69444,0,0],9826:[.12963,.69444,0,0],9827:[.12963,.69444,0,0],9837:[0,.75,0,0],9838:[.19444,.69444,0,0],9839:[.19444,.69444,0,0],10216:[.25,.75,0,0],10217:[.25,.75,0,0],10815:[0,.68611,0,0],10927:[.19667,.69667,0,0],10928:[.19667,.69667,0,0]},"Main-Italic":{33:[0,.69444,.12417,0],34:[0,.69444,.06961,0],35:[.19444,.69444,.06616,0],37:[.05556,.75,.13639,0],38:[0,.69444,.09694,0],39:[0,.69444,.12417,0],40:[.25,.75,.16194,0],41:[.25,.75,.03694,0],42:[0,.75,.14917,0],43:[.05667,.56167,.03694,0],44:[.19444,.10556,0,0],45:[0,.43056,.02826,0],46:[0,.10556,0,0],47:[.25,.75,.16194,0],48:[0,.64444,.13556,0],49:[0,.64444,.13556,0],50:[0,.64444,.13556,0],51:[0,.64444,.13556,0],52:[.19444,.64444,.13556,0],53:[0,.64444,.13556,0],54:[0,.64444,.13556,0],55:[.19444,.64444,.13556,0],56:[0,.64444,.13556,0],57:[0,.64444,.13556,0],58:[0,.43056,.0582,0],59:[.19444,.43056,.0582,0],61:[-.13313,.36687,.06616,0],63:[0,.69444,.1225,0],64:[0,.69444,.09597,0],65:[0,.68333,0,0],66:[0,.68333,.10257,0],67:[0,.68333,.14528,0],68:[0,.68333,.09403,0],69:[0,.68333,.12028,0],70:[0,.68333,.13305,0],71:[0,.68333,.08722,0],72:[0,.68333,.16389,0],73:[0,.68333,.15806,0],74:[0,.68333,.14028,0],75:[0,.68333,.14528,0],76:[0,.68333,0,0],77:[0,.68333,.16389,0],78:[0,.68333,.16389,0],79:[0,.68333,.09403,0],80:[0,.68333,.10257,0],81:[.19444,.68333,.09403,0],82:[0,.68333,.03868,0],83:[0,.68333,.11972,0],84:[0,.68333,.13305,0],85:[0,.68333,.16389,0],86:[0,.68333,.18361,0],87:[0,.68333,.18361,0],88:[0,.68333,.15806,0],89:[0,.68333,.19383,0],90:[0,.68333,.14528,0],91:[.25,.75,.1875,0],93:[.25,.75,.10528,0],94:[0,.69444,.06646,0],95:[.31,.12056,.09208,0],97:[0,.43056,.07671,0],98:[0,.69444,.06312,0],99:[0,.43056,.05653,0],100:[0,.69444,.10333,0],101:[0,.43056,.07514,0],102:[.19444,.69444,.21194,0],103:[.19444,.43056,.08847,0],104:[0,.69444,.07671,0],105:[0,.65536,.1019,0],106:[.19444,.65536,.14467,0],107:[0,.69444,.10764,0],108:[0,.69444,.10333,0],109:[0,.43056,.07671,0],110:[0,.43056,.07671,0],111:[0,.43056,.06312,0],112:[.19444,.43056,.06312,0],113:[.19444,.43056,.08847,0],114:[0,.43056,.10764,0],115:[0,.43056,.08208,0],116:[0,.61508,.09486,0],117:[0,.43056,.07671,0],118:[0,.43056,.10764,0],119:[0,.43056,.10764,0],120:[0,.43056,.12042,0],121:[.19444,.43056,.08847,0],122:[0,.43056,.12292,0],126:[.35,.31786,.11585,0],163:[0,.69444,0,0],305:[0,.43056,0,.02778],567:[.19444,.43056,0,.08334],768:[0,.69444,0,0],769:[0,.69444,.09694,0],770:[0,.69444,.06646,0],771:[0,.66786,.11585,0],772:[0,.56167,.10333,0],774:[0,.69444,.10806,0],775:[0,.66786,.11752,0],776:[0,.66786,.10474,0],778:[0,.69444,0,0],779:[0,.69444,.1225,0],780:[0,.62847,.08295,0],915:[0,.68333,.13305,0],916:[0,.68333,0,0],920:[0,.68333,.09403,0],923:[0,.68333,0,0],926:[0,.68333,.15294,0],928:[0,.68333,.16389,0],931:[0,.68333,.12028,0],933:[0,.68333,.11111,0],934:[0,.68333,.05986,0],936:[0,.68333,.11111,0],937:[0,.68333,.10257,0],8211:[0,.43056,.09208,0],8212:[0,.43056,.09208,0],8216:[0,.69444,.12417,0],8217:[0,.69444,.12417,0],8220:[0,.69444,.1685,0],8221:[0,.69444,.06961,0],8463:[0,.68889,0,0]},"Main-Regular":{32:[0,0,0,0],33:[0,.69444,0,0],34:[0,.69444,0,0],35:[.19444,.69444,0,0],36:[.05556,.75,0,0],37:[.05556,.75,0,0],38:[0,.69444,0,0],39:[0,.69444,0,0],40:[.25,.75,0,0],41:[.25,.75,0,0],42:[0,.75,0,0],43:[.08333,.58333,0,0],44:[.19444,.10556,0,0],45:[0,.43056,0,0],46:[0,.10556,0,0],47:[.25,.75,0,0],48:[0,.64444,0,0],49:[0,.64444,0,0],50:[0,.64444,0,0],51:[0,.64444,0,0],52:[0,.64444,0,0],53:[0,.64444,0,0],54:[0,.64444,0,0],55:[0,.64444,0,0],56:[0,.64444,0,0],57:[0,.64444,0,0],58:[0,.43056,0,0],59:[.19444,.43056,0,0],60:[.0391,.5391,0,0],61:[-.13313,.36687,0,0],62:[.0391,.5391,0,0],63:[0,.69444,0,0],64:[0,.69444,0,0],65:[0,.68333,0,0],66:[0,.68333,0,0],67:[0,.68333,0,0],68:[0,.68333,0,0],69:[0,.68333,0,0],70:[0,.68333,0,0],71:[0,.68333,0,0],72:[0,.68333,0,0],73:[0,.68333,0,0],74:[0,.68333,0,0],75:[0,.68333,0,0],76:[0,.68333,0,0],77:[0,.68333,0,0],78:[0,.68333,0,0],79:[0,.68333,0,0],80:[0,.68333,0,0],81:[.19444,.68333,0,0],82:[0,.68333,0,0],83:[0,.68333,0,0],84:[0,.68333,0,0],85:[0,.68333,0,0],86:[0,.68333,.01389,0],87:[0,.68333,.01389,0],88:[0,.68333,0,0],89:[0,.68333,.025,0],90:[0,.68333,0,0],91:[.25,.75,0,0],92:[.25,.75,0,0],93:[.25,.75,0,0],94:[0,.69444,0,0],95:[.31,.12056,.02778,0],96:[0,.69444,0,0],97:[0,.43056,0,0],98:[0,.69444,0,0],99:[0,.43056,0,0],100:[0,.69444,0,0],101:[0,.43056,0,0],102:[0,.69444,.07778,0],103:[.19444,.43056,.01389,0],104:[0,.69444,0,0],105:[0,.66786,0,0],106:[.19444,.66786,0,0],107:[0,.69444,0,0],108:[0,.69444,0,0],109:[0,.43056,0,0],110:[0,.43056,0,0],111:[0,.43056,0,0],112:[.19444,.43056,0,0],113:[.19444,.43056,0,0],114:[0,.43056,0,0],115:[0,.43056,0,0],116:[0,.61508,0,0],117:[0,.43056,0,0],118:[0,.43056,.01389,0],119:[0,.43056,.01389,0],120:[0,.43056,0,0],121:[.19444,.43056,.01389,0],122:[0,.43056,0,0],123:[.25,.75,0,0],124:[.25,.75,0,0],125:[.25,.75,0,0],126:[.35,.31786,0,0],160:[0,0,0,0],168:[0,.66786,0,0],172:[0,.43056,0,0],175:[0,.56778,0,0],176:[0,.69444,0,0],177:[.08333,.58333,0,0],180:[0,.69444,0,0],215:[.08333,.58333,0,0],247:[.08333,.58333,0,0],305:[0,.43056,0,0],567:[.19444,.43056,0,0],710:[0,.69444,0,0],711:[0,.62847,0,0],713:[0,.56778,0,0],714:[0,.69444,0,0],715:[0,.69444,0,0],728:[0,.69444,0,0],729:[0,.66786,0,0],730:[0,.69444,0,0],732:[0,.66786,0,0],768:[0,.69444,0,0],769:[0,.69444,0,0],770:[0,.69444,0,0],771:[0,.66786,0,0],772:[0,.56778,0,0],774:[0,.69444,0,0],775:[0,.66786,0,0],776:[0,.66786,0,0],778:[0,.69444,0,0],779:[0,.69444,0,0],780:[0,.62847,0,0],824:[.19444,.69444,0,0],915:[0,.68333,0,0],916:[0,.68333,0,0],920:[0,.68333,0,0],923:[0,.68333,0,0],926:[0,.68333,0,0],928:[0,.68333,0,0],931:[0,.68333,0,0],933:[0,.68333,0,0],934:[0,.68333,0,0],936:[0,.68333,0,0],937:[0,.68333,0,0],8211:[0,.43056,.02778,0],8212:[0,.43056,.02778,0],8216:[0,.69444,0,0],8217:[0,.69444,0,0],8220:[0,.69444,0,0],8221:[0,.69444,0,0],8224:[.19444,.69444,0,0],8225:[.19444,.69444,0,0],8230:[0,.12,0,0],8242:[0,.55556,0,0],8407:[0,.71444,.15382,0],8463:[0,.68889,0,0],8465:[0,.69444,0,0],8467:[0,.69444,0,.11111],8472:[.19444,.43056,0,.11111],8476:[0,.69444,0,0],8501:[0,.69444,0,0],8592:[-.13313,.36687,0,0],8593:[.19444,.69444,0,0],8594:[-.13313,.36687,0,0],8595:[.19444,.69444,0,0],8596:[-.13313,.36687,0,0],8597:[.25,.75,0,0],8598:[.19444,.69444,0,0],8599:[.19444,.69444,0,0],8600:[.19444,.69444,0,0],8601:[.19444,.69444,0,0],8614:[.011,.511,0,0],8617:[.011,.511,0,0],8618:[.011,.511,0,0],8636:[-.13313,.36687,0,0],8637:[-.13313,.36687,0,0],8640:[-.13313,.36687,0,0],8641:[-.13313,.36687,0,0],8652:[.011,.671,0,0],8656:[-.13313,.36687,0,0],8657:[.19444,.69444,0,0],8658:[-.13313,.36687,0,0],8659:[.19444,.69444,0,0],8660:[-.13313,.36687,0,0],8661:[.25,.75,0,0],8704:[0,.69444,0,0],8706:[0,.69444,.05556,.08334],8707:[0,.69444,0,0],8709:[.05556,.75,0,0],8711:[0,.68333,0,0],8712:[.0391,.5391,0,0],8715:[.0391,.5391,0,0],8722:[.08333,.58333,0,0],8723:[.08333,.58333,0,0],8725:[.25,.75,0,0],8726:[.25,.75,0,0],8727:[-.03472,.46528,0,0],8728:[-.05555,.44445,0,0],8729:[-.05555,.44445,0,0],8730:[.2,.8,0,0],8733:[0,.43056,0,0],8734:[0,.43056,0,0],8736:[0,.69224,0,0],8739:[.25,.75,0,0],8741:[.25,.75,0,0],8743:[0,.55556,0,0],8744:[0,.55556,0,0],8745:[0,.55556,0,0],8746:[0,.55556,0,0],8747:[.19444,.69444,.11111,0],8764:[-.13313,.36687,0,0],8768:[.19444,.69444,0,0],8771:[-.03625,.46375,0,0],8773:[-.022,.589,0,0],8776:[-.01688,.48312,0,0],8781:[-.03625,.46375,0,0],8784:[-.133,.67,0,0],8800:[.215,.716,0,0],8801:[-.03625,.46375,0,0],8804:[.13597,.63597,0,0],8805:[.13597,.63597,0,0],8810:[.0391,.5391,0,0],8811:[.0391,.5391,0,0],8826:[.0391,.5391,0,0],8827:[.0391,.5391,0,0],8834:[.0391,.5391,0,0],8835:[.0391,.5391,0,0],8838:[.13597,.63597,0,0],8839:[.13597,.63597,0,0],8846:[0,.55556,0,0],8849:[.13597,.63597,0,0],8850:[.13597,.63597,0,0],8851:[0,.55556,0,0],8852:[0,.55556,0,0],8853:[.08333,.58333,0,0],8854:[.08333,.58333,0,0],8855:[.08333,.58333,0,0],8856:[.08333,.58333,0,0],8857:[.08333,.58333,0,0],8866:[0,.69444,0,0],8867:[0,.69444,0,0],8868:[0,.69444,0,0],8869:[0,.69444,0,0],8872:[.249,.75,0,0],8900:[-.05555,.44445,0,0],8901:[-.05555,.44445,0,0],8902:[-.03472,.46528,0,0],8904:[.005,.505,0,0],8942:[.03,.9,0,0],8943:[-.19,.31,0,0],8945:[-.1,.82,0,0],8968:[.25,.75,0,0],8969:[.25,.75,0,0],8970:[.25,.75,0,0],8971:[.25,.75,0,0],8994:[-.14236,.35764,0,0],8995:[-.14236,.35764,0,0],9136:[.244,.744,0,0],9137:[.244,.744,0,0],9651:[.19444,.69444,0,0],9657:[-.03472,.46528,0,0],9661:[.19444,.69444,0,0],9667:[-.03472,.46528,0,0],9711:[.19444,.69444,0,0],9824:[.12963,.69444,0,0],9825:[.12963,.69444,0,0],9826:[.12963,.69444,0,0],9827:[.12963,.69444,0,0],9837:[0,.75,0,0],9838:[.19444,.69444,0,0],9839:[.19444,.69444,0,0],10216:[.25,.75,0,0],10217:[.25,.75,0,0],10222:[.244,.744,0,0],10223:[.244,.744,0,0],10229:[.011,.511,0,0],10230:[.011,.511,0,0],10231:[.011,.511,0,0],10232:[.024,.525,0,0],10233:[.024,.525,0,0],10234:[.024,.525,0,0],10236:[.011,.511,0,0],10815:[0,.68333,0,0],10927:[.13597,.63597,0,0],10928:[.13597,.63597,0,0]},"Math-BoldItalic":{47:[.19444,.69444,0,0],65:[0,.68611,0,0],66:[0,.68611,.04835,0],67:[0,.68611,.06979,0],68:[0,.68611,.03194,0],69:[0,.68611,.05451,0],70:[0,.68611,.15972,0],71:[0,.68611,0,0],72:[0,.68611,.08229,0],73:[0,.68611,.07778,0],74:[0,.68611,.10069,0],75:[0,.68611,.06979,0],76:[0,.68611,0,0],77:[0,.68611,.11424,0],78:[0,.68611,.11424,0],79:[0,.68611,.03194,0],80:[0,.68611,.15972,0],81:[.19444,.68611,0,0],82:[0,.68611,.00421,0],83:[0,.68611,.05382,0],84:[0,.68611,.15972,0],85:[0,.68611,.11424,0],86:[0,.68611,.25555,0],87:[0,.68611,.15972,0],88:[0,.68611,.07778,0],89:[0,.68611,.25555,0],90:[0,.68611,.06979,0],97:[0,.44444,0,0],98:[0,.69444,0,0],99:[0,.44444,0,0],100:[0,.69444,0,0],101:[0,.44444,0,0],102:[.19444,.69444,.11042,0],103:[.19444,.44444,.03704,0],104:[0,.69444,0,0],105:[0,.69326,0,0],106:[.19444,.69326,.0622,0],107:[0,.69444,.01852,0],108:[0,.69444,.0088,0],109:[0,.44444,0,0],110:[0,.44444,0,0],111:[0,.44444,0,0],112:[.19444,.44444,0,0],113:[.19444,.44444,.03704,0],114:[0,.44444,.03194,0],115:[0,.44444,0,0],116:[0,.63492,0,0],117:[0,.44444,0,0],118:[0,.44444,.03704,0],119:[0,.44444,.02778,0],120:[0,.44444,0,0],121:[.19444,.44444,.03704,0],122:[0,.44444,.04213,0],915:[0,.68611,.15972,0],916:[0,.68611,0,0],920:[0,.68611,.03194,0],923:[0,.68611,0,0],926:[0,.68611,.07458,0],928:[0,.68611,.08229,0],931:[0,.68611,.05451,0],933:[0,.68611,.15972,0],934:[0,.68611,0,0],936:[0,.68611,.11653,0],937:[0,.68611,.04835,0],945:[0,.44444,0,0],946:[.19444,.69444,.03403,0],947:[.19444,.44444,.06389,0],948:[0,.69444,.03819,0],949:[0,.44444,0,0],950:[.19444,.69444,.06215,0],951:[.19444,.44444,.03704,0],952:[0,.69444,.03194,0],953:[0,.44444,0,0],954:[0,.44444,0,0],955:[0,.69444,0,0],956:[.19444,.44444,0,0],957:[0,.44444,.06898,0],958:[.19444,.69444,.03021,0],959:[0,.44444,0,0],960:[0,.44444,.03704,0],961:[.19444,.44444,0,0],962:[.09722,.44444,.07917,0],963:[0,.44444,.03704,0],964:[0,.44444,.13472,0],965:[0,.44444,.03704,0],966:[.19444,.44444,0,0],967:[.19444,.44444,0,0],968:[.19444,.69444,.03704,0],969:[0,.44444,.03704,0],977:[0,.69444,0,0],981:[.19444,.69444,0,0],982:[0,.44444,.03194,0],1009:[.19444,.44444,0,0],1013:[0,.44444,0,0]},"Math-Italic":{47:[.19444,.69444,0,0],65:[0,.68333,0,.13889],66:[0,.68333,.05017,.08334],67:[0,.68333,.07153,.08334],68:[0,.68333,.02778,.05556],69:[0,.68333,.05764,.08334],70:[0,.68333,.13889,.08334],71:[0,.68333,0,.08334],72:[0,.68333,.08125,.05556],73:[0,.68333,.07847,.11111],74:[0,.68333,.09618,.16667],75:[0,.68333,.07153,.05556],76:[0,.68333,0,.02778],77:[0,.68333,.10903,.08334],78:[0,.68333,.10903,.08334],79:[0,.68333,.02778,.08334],80:[0,.68333,.13889,.08334],81:[.19444,.68333,0,.08334],82:[0,.68333,.00773,.08334],83:[0,.68333,.05764,.08334],84:[0,.68333,.13889,.08334],85:[0,.68333,.10903,.02778],86:[0,.68333,.22222,0],87:[0,.68333,.13889,0],88:[0,.68333,.07847,.08334],89:[0,.68333,.22222,0],90:[0,.68333,.07153,.08334],97:[0,.43056,0,0],98:[0,.69444,0,0],99:[0,.43056,0,.05556],100:[0,.69444,0,.16667],101:[0,.43056,0,.05556],102:[.19444,.69444,.10764,.16667],103:[.19444,.43056,.03588,.02778],104:[0,.69444,0,0],105:[0,.65952,0,0],106:[.19444,.65952,.05724,0],107:[0,.69444,.03148,0],108:[0,.69444,.01968,.08334],109:[0,.43056,0,0],110:[0,.43056,0,0],111:[0,.43056,0,.05556],112:[.19444,.43056,0,.08334],113:[.19444,.43056,.03588,.08334],114:[0,.43056,.02778,.05556],115:[0,.43056,0,.05556],116:[0,.61508,0,.08334],117:[0,.43056,0,.02778],118:[0,.43056,.03588,.02778],119:[0,.43056,.02691,.08334],120:[0,.43056,0,.02778],121:[.19444,.43056,.03588,.05556],122:[0,.43056,.04398,.05556],915:[0,.68333,.13889,.08334],916:[0,.68333,0,.16667],920:[0,.68333,.02778,.08334],923:[0,.68333,0,.16667],926:[0,.68333,.07569,.08334],928:[0,.68333,.08125,.05556],931:[0,.68333,.05764,.08334],933:[0,.68333,.13889,.05556],934:[0,.68333,0,.08334],936:[0,.68333,.11,.05556],937:[0,.68333,.05017,.08334],945:[0,.43056,.0037,.02778],946:[.19444,.69444,.05278,.08334],947:[.19444,.43056,.05556,0],948:[0,.69444,.03785,.05556],949:[0,.43056,0,.08334],950:[.19444,.69444,.07378,.08334],951:[.19444,.43056,.03588,.05556],952:[0,.69444,.02778,.08334],953:[0,.43056,0,.05556],954:[0,.43056,0,0],955:[0,.69444,0,0],956:[.19444,.43056,0,.02778],957:[0,.43056,.06366,.02778],958:[.19444,.69444,.04601,.11111],959:[0,.43056,0,.05556],960:[0,.43056,.03588,0],961:[.19444,.43056,0,.08334],962:[.09722,.43056,.07986,.08334],963:[0,.43056,.03588,0],964:[0,.43056,.1132,.02778],965:[0,.43056,.03588,.02778],966:[.19444,.43056,0,.08334],967:[.19444,.43056,0,.05556],968:[.19444,.69444,.03588,.11111],969:[0,.43056,.03588,0],977:[0,.69444,0,.08334],981:[.19444,.69444,0,.08334],982:[0,.43056,.02778,0],1009:[.19444,.43056,0,.08334],1013:[0,.43056,0,.05556]},"Math-Regular":{65:[0,.68333,0,.13889],66:[0,.68333,.05017,.08334],67:[0,.68333,.07153,.08334],68:[0,.68333,.02778,.05556],69:[0,.68333,.05764,.08334],70:[0,.68333,.13889,.08334],71:[0,.68333,0,.08334],72:[0,.68333,.08125,.05556],73:[0,.68333,.07847,.11111],74:[0,.68333,.09618,.16667],75:[0,.68333,.07153,.05556],76:[0,.68333,0,.02778],77:[0,.68333,.10903,.08334],78:[0,.68333,.10903,.08334],79:[0,.68333,.02778,.08334],80:[0,.68333,.13889,.08334],81:[.19444,.68333,0,.08334],82:[0,.68333,.00773,.08334],83:[0,.68333,.05764,.08334],84:[0,.68333,.13889,.08334],85:[0,.68333,.10903,.02778],86:[0,.68333,.22222,0],87:[0,.68333,.13889,0],88:[0,.68333,.07847,.08334],89:[0,.68333,.22222,0],90:[0,.68333,.07153,.08334],97:[0,.43056,0,0],98:[0,.69444,0,0],99:[0,.43056,0,.05556],100:[0,.69444,0,.16667],101:[0,.43056,0,.05556],102:[.19444,.69444,.10764,.16667],103:[.19444,.43056,.03588,.02778],104:[0,.69444,0,0],105:[0,.65952,0,0],106:[.19444,.65952,.05724,0],107:[0,.69444,.03148,0],108:[0,.69444,.01968,.08334],109:[0,.43056,0,0],110:[0,.43056,0,0],111:[0,.43056,0,.05556],112:[.19444,.43056,0,.08334],113:[.19444,.43056,.03588,.08334],114:[0,.43056,.02778,.05556],115:[0,.43056,0,.05556],116:[0,.61508,0,.08334],117:[0,.43056,0,.02778],118:[0,.43056,.03588,.02778],119:[0,.43056,.02691,.08334],120:[0,.43056,0,.02778],121:[.19444,.43056,.03588,.05556],122:[0,.43056,.04398,.05556],915:[0,.68333,.13889,.08334],916:[0,.68333,0,.16667],920:[0,.68333,.02778,.08334],923:[0,.68333,0,.16667],926:[0,.68333,.07569,.08334],928:[0,.68333,.08125,.05556],931:[0,.68333,.05764,.08334],933:[0,.68333,.13889,.05556],934:[0,.68333,0,.08334],936:[0,.68333,.11,.05556],937:[0,.68333,.05017,.08334],945:[0,.43056,.0037,.02778],946:[.19444,.69444,.05278,.08334],947:[.19444,.43056,.05556,0],948:[0,.69444,.03785,.05556],949:[0,.43056,0,.08334],950:[.19444,.69444,.07378,.08334],951:[.19444,.43056,.03588,.05556],952:[0,.69444,.02778,.08334],953:[0,.43056,0,.05556],954:[0,.43056,0,0],955:[0,.69444,0,0],956:[.19444,.43056,0,.02778],957:[0,.43056,.06366,.02778],958:[.19444,.69444,.04601,.11111],959:[0,.43056,0,.05556],960:[0,.43056,.03588,0],961:[.19444,.43056,0,.08334],962:[.09722,.43056,.07986,.08334],963:[0,.43056,.03588,0],964:[0,.43056,.1132,.02778],965:[0,.43056,.03588,.02778],966:[.19444,.43056,0,.08334],967:[.19444,.43056,0,.05556],968:[.19444,.69444,.03588,.11111],969:[0,.43056,.03588,0],977:[0,.69444,0,.08334],981:[.19444,.69444,0,.08334],982:[0,.43056,.02778,0],1009:[.19444,.43056,0,.08334],1013:[0,.43056,0,.05556]},"SansSerif-Regular":{33:[0,.69444,0,0],34:[0,.69444,0,0],35:[.19444,.69444,0,0],36:[.05556,.75,0,0],37:[.05556,.75,0,0],38:[0,.69444,0,0],39:[0,.69444,0,0],40:[.25,.75,0,0],41:[.25,.75,0,0],42:[0,.75,0,0],43:[.08333,.58333,0,0],44:[.125,.08333,0,0],45:[0,.44444,0,0],46:[0,.08333,0,0],47:[.25,.75,0,0],48:[0,.65556,0,0],49:[0,.65556,0,0],50:[0,.65556,0,0],51:[0,.65556,0,0],52:[0,.65556,0,0],53:[0,.65556,0,0],54:[0,.65556,0,0],55:[0,.65556,0,0],56:[0,.65556,0,0],57:[0,.65556,0,0],58:[0,.44444,0,0],59:[.125,.44444,0,0],61:[-.13,.37,0,0],63:[0,.69444,0,0],64:[0,.69444,0,0],65:[0,.69444,0,0],66:[0,.69444,0,0],67:[0,.69444,0,0],68:[0,.69444,0,0],69:[0,.69444,0,0],70:[0,.69444,0,0],71:[0,.69444,0,0],72:[0,.69444,0,0],73:[0,.69444,0,0],74:[0,.69444,0,0],75:[0,.69444,0,0],76:[0,.69444,0,0],77:[0,.69444,0,0],78:[0,.69444,0,0],79:[0,.69444,0,0],80:[0,.69444,0,0],81:[.125,.69444,0,0],82:[0,.69444,0,0],83:[0,.69444,0,0],84:[0,.69444,0,0],85:[0,.69444,0,0],86:[0,.69444,.01389,0],87:[0,.69444,.01389,0],88:[0,.69444,0,0],89:[0,.69444,.025,0],90:[0,.69444,0,0],91:[.25,.75,0,0],93:[.25,.75,0,0],94:[0,.69444,0,0],95:[.35,.09444,.02778,0],97:[0,.44444,0,0],98:[0,.69444,0,0],99:[0,.44444,0,0],100:[0,.69444,0,0],101:[0,.44444,0,0],102:[0,.69444,.06944,0],103:[.19444,.44444,.01389,0],104:[0,.69444,0,0],105:[0,.67937,0,0],106:[.19444,.67937,0,0],107:[0,.69444,0,0],108:[0,.69444,0,0],109:[0,.44444,0,0],110:[0,.44444,0,0],111:[0,.44444,0,0],112:[.19444,.44444,0,0],113:[.19444,.44444,0,0],114:[0,.44444,.01389,0],115:[0,.44444,0,0],116:[0,.57143,0,0],117:[0,.44444,0,0],118:[0,.44444,.01389,0],119:[0,.44444,.01389,0],120:[0,.44444,0,0],121:[.19444,.44444,.01389,0],122:[0,.44444,0,0],126:[.35,.32659,0,0],305:[0,.44444,0,0],567:[.19444,.44444,0,0],768:[0,.69444,0,0],769:[0,.69444,0,0],770:[0,.69444,0,0],771:[0,.67659,0,0],772:[0,.60889,0,0],774:[0,.69444,0,0],775:[0,.67937,0,0],776:[0,.67937,0,0],778:[0,.69444,0,0],779:[0,.69444,0,0],780:[0,.63194,0,0],915:[0,.69444,0,0],916:[0,.69444,0,0],920:[0,.69444,0,0],923:[0,.69444,0,0],926:[0,.69444,0,0],928:[0,.69444,0,0],931:[0,.69444,0,0],933:[0,.69444,0,0],934:[0,.69444,0,0],936:[0,.69444,0,0],937:[0,.69444,0,0],8211:[0,.44444,.02778,0],8212:[0,.44444,.02778,0],8216:[0,.69444,0,0],8217:[0,.69444,0,0],8220:[0,.69444,0,0],8221:[0,.69444,0,0]},"Script-Regular":{65:[0,.7,.22925,0],66:[0,.7,.04087,0],67:[0,.7,.1689,0],68:[0,.7,.09371,0],69:[0,.7,.18583,0],70:[0,.7,.13634,0],71:[0,.7,.17322,0],72:[0,.7,.29694,0],73:[0,.7,.19189,0],74:[.27778,.7,.19189,0],75:[0,.7,.31259,0],76:[0,.7,.19189,0],77:[0,.7,.15981,0],78:[0,.7,.3525,0],79:[0,.7,.08078,0],80:[0,.7,.08078,0],81:[0,.7,.03305,0],82:[0,.7,.06259,0],83:[0,.7,.19189,0],84:[0,.7,.29087,0],85:[0,.7,.25815,0],86:[0,.7,.27523,0],87:[0,.7,.27523,0],88:[0,.7,.26006,0],89:[0,.7,.2939,0],90:[0,.7,.24037,0]},"Size1-Regular":{40:[.35001,.85,0,0],41:[.35001,.85,0,0],47:[.35001,.85,0,0],91:[.35001,.85,0,0],92:[.35001,.85,0,0],93:[.35001,.85,0,0],123:[.35001,.85,0,0],125:[.35001,.85,0,0],710:[0,.72222,0,0],732:[0,.72222,0,0],770:[0,.72222,0,0],771:[0,.72222,0,0],8214:[-99e-5,.601,0,0],8593:[1e-5,.6,0,0],8595:[1e-5,.6,0,0],8657:[1e-5,.6,0,0],8659:[1e-5,.6,0,0],8719:[.25001,.75,0,0],8720:[.25001,.75,0,0],8721:[.25001,.75,0,0],8730:[.35001,.85,0,0],8739:[-.00599,.606,0,0],8741:[-.00599,.606,0,0],8747:[.30612,.805,.19445,0],8748:[.306,.805,.19445,0],8749:[.306,.805,.19445,0],8750:[.30612,.805,.19445,0],8896:[.25001,.75,0,0],8897:[.25001,.75,0,0],8898:[.25001,.75,0,0],8899:[.25001,.75,0,0],8968:[.35001,.85,0,0],8969:[.35001,.85,0,0],8970:[.35001,.85,0,0],8971:[.35001,.85,0,0],9168:[-99e-5,.601,0,0],10216:[.35001,.85,0,0],10217:[.35001,.85,0,0],10752:[.25001,.75,0,0],10753:[.25001,.75,0,0],10754:[.25001,.75,0,0],10756:[.25001,.75,0,0],10758:[.25001,.75,0,0]},"Size2-Regular":{40:[.65002,1.15,0,0],41:[.65002,1.15,0,0],47:[.65002,1.15,0,0],91:[.65002,1.15,0,0],92:[.65002,1.15,0,0],93:[.65002,1.15,0,0],123:[.65002,1.15,0,0],125:[.65002,1.15,0,0],710:[0,.75,0,0],732:[0,.75,0,0],770:[0,.75,0,0],771:[0,.75,0,0],8719:[.55001,1.05,0,0],8720:[.55001,1.05,0,0],8721:[.55001,1.05,0,0],8730:[.65002,1.15,0,0],8747:[.86225,1.36,.44445,0],8748:[.862,1.36,.44445,0],8749:[.862,1.36,.44445,0],8750:[.86225,1.36,.44445,0],8896:[.55001,1.05,0,0],8897:[.55001,1.05,0,0],8898:[.55001,1.05,0,0],8899:[.55001,1.05,0,0],8968:[.65002,1.15,0,0],8969:[.65002,1.15,0,0],8970:[.65002,1.15,0,0],8971:[.65002,1.15,0,0],10216:[.65002,1.15,0,0],10217:[.65002,1.15,0,0],10752:[.55001,1.05,0,0],10753:[.55001,1.05,0,0],10754:[.55001,1.05,0,0],10756:[.55001,1.05,0,0],10758:[.55001,1.05,0,0]},"Size3-Regular":{40:[.95003,1.45,0,0],41:[.95003,1.45,0,0],47:[.95003,1.45,0,0],91:[.95003,1.45,0,0],92:[.95003,1.45,0,0],93:[.95003,1.45,0,0],123:[.95003,1.45,0,0],125:[.95003,1.45,0,0],710:[0,.75,0,0],732:[0,.75,0,0],770:[0,.75,0,0],771:[0,.75,0,0],8730:[.95003,1.45,0,0],8968:[.95003,1.45,0,0],8969:[.95003,1.45,0,0],8970:[.95003,1.45,0,0],8971:[.95003,1.45,0,0],10216:[.95003,1.45,0,0],10217:[.95003,1.45,0,0]},"Size4-Regular":{40:[1.25003,1.75,0,0],41:[1.25003,1.75,0,0],47:[1.25003,1.75,0,0],91:[1.25003,1.75,0,0],92:[1.25003,1.75,0,0],93:[1.25003,1.75,0,0],123:[1.25003,1.75,0,0],125:[1.25003,1.75,0,0],710:[0,.825,0,0],732:[0,.825,0,0],770:[0,.825,0,0],771:[0,.825,0,0],8730:[1.25003,1.75,0,0],8968:[1.25003,1.75,0,0],8969:[1.25003,1.75,0,0],8970:[1.25003,1.75,0,0],8971:[1.25003,1.75,0,0],9115:[.64502,1.155,0,0],9116:[1e-5,.6,0,0],9117:[.64502,1.155,0,0],9118:[.64502,1.155,0,0],9119:[1e-5,.6,0,0],9120:[.64502,1.155,0,0],9121:[.64502,1.155,0,0],9122:[-99e-5,.601,0,0],9123:[.64502,1.155,0,0],9124:[.64502,1.155,0,0],9125:[-99e-5,.601,0,0],9126:[.64502,1.155,0,0],9127:[1e-5,.9,0,0],9128:[.65002,1.15,0,0],9129:[.90001,0,0,0],9130:[0,.3,0,0],9131:[1e-5,.9,0,0],9132:[.65002,1.15,0,0],9133:[.90001,0,0,0],9143:[.88502,.915,0,0],10216:[1.25003,1.75,0,0],10217:[1.25003,1.75,0,0],57344:[-.00499,.605,0,0],57345:[-.00499,.605,0,0],57680:[0,.12,0,0],57681:[0,.12,0,0],57682:[0,.12,0,0],57683:[0,.12,0,0]},"Typewriter-Regular":{33:[0,.61111,0,0],34:[0,.61111,0,0],35:[0,.61111,0,0],36:[.08333,.69444,0,0],37:[.08333,.69444,0,0],38:[0,.61111,0,0],39:[0,.61111,0,0],40:[.08333,.69444,0,0],41:[.08333,.69444,0,0],42:[0,.52083,0,0],43:[-.08056,.53055,0,0],44:[.13889,.125,0,0],45:[-.08056,.53055,0,0],46:[0,.125,0,0],47:[.08333,.69444,0,0],48:[0,.61111,0,0],49:[0,.61111,0,0],50:[0,.61111,0,0],51:[0,.61111,0,0],52:[0,.61111,0,0],53:[0,.61111,0,0],54:[0,.61111,0,0],55:[0,.61111,0,0],56:[0,.61111,0,0],57:[0,.61111,0,0],58:[0,.43056,0,0],59:[.13889,.43056,0,0],60:[-.05556,.55556,0,0],61:[-.19549,.41562,0,0],62:[-.05556,.55556,0,0],63:[0,.61111,0,0],64:[0,.61111,0,0],65:[0,.61111,0,0],66:[0,.61111,0,0],67:[0,.61111,0,0],68:[0,.61111,0,0],69:[0,.61111,0,0],70:[0,.61111,0,0],71:[0,.61111,0,0],72:[0,.61111,0,0],73:[0,.61111,0,0],74:[0,.61111,0,0],75:[0,.61111,0,0],76:[0,.61111,0,0],77:[0,.61111,0,0],78:[0,.61111,0,0],79:[0,.61111,0,0],80:[0,.61111,0,0],81:[.13889,.61111,0,0],82:[0,.61111,0,0],83:[0,.61111,0,0],84:[0,.61111,0,0],85:[0,.61111,0,0],86:[0,.61111,0,0],87:[0,.61111,0,0],88:[0,.61111,0,0],89:[0,.61111,0,0],90:[0,.61111,0,0],91:[.08333,.69444,0,0],92:[.08333,.69444,0,0],93:[.08333,.69444,0,0],94:[0,.61111,0,0],95:[.09514,0,0,0],96:[0,.61111,0,0],97:[0,.43056,0,0],98:[0,.61111,0,0],99:[0,.43056,0,0],100:[0,.61111,0,0],101:[0,.43056,0,0],102:[0,.61111,0,0],103:[.22222,.43056,0,0],104:[0,.61111,0,0],105:[0,.61111,0,0],106:[.22222,.61111,0,0],107:[0,.61111,0,0],108:[0,.61111,0,0],109:[0,.43056,0,0],110:[0,.43056,0,0],111:[0,.43056,0,0],112:[.22222,.43056,0,0],113:[.22222,.43056,0,0],114:[0,.43056,0,0],115:[0,.43056,0,0],116:[0,.55358,0,0],117:[0,.43056,0,0],118:[0,.43056,0,0],119:[0,.43056,0,0],120:[0,.43056,0,0],121:[.22222,.43056,0,0],122:[0,.43056,0,0],123:[.08333,.69444,0,0],124:[.08333,.69444,0,0],125:[.08333,.69444,0,0],126:[0,.61111,0,0],127:[0,.61111,0,0],305:[0,.43056,0,0],567:[.22222,.43056,0,0],768:[0,.61111,0,0],769:[0,.61111,0,0],770:[0,.61111,0,0],771:[0,.61111,0,0],772:[0,.56555,0,0],774:[0,.61111,0,0],776:[0,.61111,0,0],778:[0,.61111,0,0],780:[0,.56597,0,0],915:[0,.61111,0,0],916:[0,.61111,0,0],920:[0,.61111,0,0],923:[0,.61111,0,0],926:[0,.61111,0,0],928:[0,.61111,0,0],931:[0,.61111,0,0],933:[0,.61111,0,0],934:[0,.61111,0,0],936:[0,.61111,0,0],937:[0,.61111,0,0],2018:[0,.61111,0,0],2019:[0,.61111,0,0],8242:[0,.61111,0,0]}}},{}],18:[function(e,t,r){var a=e("./utils");var i=e("./ParseError");function n(e,r,a){if(typeof e==="string"){e=[e]}if(typeof r==="number"){r={numArgs:r}}var i={numArgs:r.numArgs,argTypes:r.argTypes,greediness:r.greediness===undefined?1:r.greediness,allowedInText:!!r.allowedInText,numOptionalArgs:r.numOptionalArgs||0,handler:a};for(var n=0;n","\\langle","\\rangle","\\lt","\\gt","\\lvert","\\rvert","\\lVert","\\rVert","\\lgroup","\\rgroup","\\lmoustache","\\rmoustache","/","\\backslash","|","\\vert","\\|","\\Vert","\\uparrow","\\Uparrow","\\downarrow","\\Downarrow","\\updownarrow","\\Updownarrow","."];var o={"\\Bbb":"\\mathbb","\\bold":"\\mathbf","\\frak":"\\mathfrak"};n(["\\blue","\\orange","\\pink","\\red","\\green","\\gray","\\purple","\\blueA","\\blueB","\\blueC","\\blueD","\\blueE","\\tealA","\\tealB","\\tealC","\\tealD","\\tealE","\\greenA","\\greenB","\\greenC","\\greenD","\\greenE","\\goldA","\\goldB","\\goldC","\\goldD","\\goldE","\\redA","\\redB","\\redC","\\redD","\\redE","\\maroonA","\\maroonB","\\maroonC","\\maroonD","\\maroonE","\\purpleA","\\purpleB","\\purpleC","\\purpleD","\\purpleE","\\mintA","\\mintB","\\mintC","\\grayA","\\grayB","\\grayC","\\grayD","\\grayE","\\grayF","\\grayG","\\grayH","\\grayI","\\kaBlue","\\kaGreen"],{numArgs:1,allowedInText:true,greediness:3},function(e,t){var r=t[0];var a;if(r.type==="ordgroup"){a=r.value}else{a=[r]}return{type:"color",color:"katex-"+e.funcName.slice(1),value:a}});n(["\\arcsin","\\arccos","\\arctan","\\arg","\\cos","\\cosh","\\cot","\\coth","\\csc","\\deg","\\dim","\\exp","\\hom","\\ker","\\lg","\\ln","\\log","\\sec","\\sin","\\sinh","\\tan","\\tanh"],{numArgs:0},function(e){return{type:"op",limits:false,symbol:false,body:e.funcName}});n(["\\det","\\gcd","\\inf","\\lim","\\liminf","\\limsup","\\max","\\min","\\Pr","\\sup"],{numArgs:0},function(e){return{type:"op",limits:true,symbol:false,body:e.funcName}});n(["\\int","\\iint","\\iiint","\\oint"],{numArgs:0},function(e){return{type:"op",limits:false,symbol:true,body:e.funcName}});n(["\\coprod","\\bigvee","\\bigwedge","\\biguplus","\\bigcap","\\bigcup","\\intop","\\prod","\\sum","\\bigotimes","\\bigoplus","\\bigodot","\\bigsqcup","\\smallint"],{ +numArgs:0},function(e){return{type:"op",limits:true,symbol:true,body:e.funcName}});n(["\\dfrac","\\frac","\\tfrac","\\dbinom","\\binom","\\tbinom"],{numArgs:2,greediness:2},function(e,t){var r=t[0];var a=t[1];var i;var n=null;var s=null;var l="auto";switch(e.funcName){case"\\dfrac":case"\\frac":case"\\tfrac":i=true;break;case"\\dbinom":case"\\binom":case"\\tbinom":i=false;n="(";s=")";break;default:throw new Error("Unrecognized genfrac command")}switch(e.funcName){case"\\dfrac":case"\\dbinom":l="display";break;case"\\tfrac":case"\\tbinom":l="text";break}return{type:"genfrac",numer:r,denom:a,hasBarLine:i,leftDelim:n,rightDelim:s,size:l}});n(["\\llap","\\rlap"],{numArgs:1,allowedInText:true},function(e,t){var r=t[0];return{type:e.funcName.slice(1),body:r}});n(["\\bigl","\\Bigl","\\biggl","\\Biggl","\\bigr","\\Bigr","\\biggr","\\Biggr","\\bigm","\\Bigm","\\biggm","\\Biggm","\\big","\\Big","\\bigg","\\Bigg","\\left","\\right"],{numArgs:1},function(e,t){var r=t[0];if(!a.contains(l,r.value)){throw new i("Invalid delimiter: '"+r.value+"' after '"+e.funcName+"'",e.lexer,e.positions[1])}if(e.funcName==="\\left"||e.funcName==="\\right"){return{type:"leftright",value:r.value}}else{return{type:"delimsizing",size:s[e.funcName].size,delimType:s[e.funcName].type,value:r.value}}});n(["\\tiny","\\scriptsize","\\footnotesize","\\small","\\normalsize","\\large","\\Large","\\LARGE","\\huge","\\Huge"],0,null);n(["\\displaystyle","\\textstyle","\\scriptstyle","\\scriptscriptstyle"],0,null);n(["\\mathrm","\\mathit","\\mathbf","\\mathbb","\\mathcal","\\mathfrak","\\mathscr","\\mathsf","\\mathtt","\\Bbb","\\bold","\\frak"],{numArgs:1,greediness:2},function(e,t){var r=t[0];var a=e.funcName;if(a in o){a=o[a]}return{type:"font",font:a.slice(1),body:r}});n(["\\acute","\\grave","\\ddot","\\tilde","\\bar","\\breve","\\check","\\hat","\\vec","\\dot"],{numArgs:1},function(e,t){var r=t[0];return{type:"accent",accent:e.funcName,base:r}});n(["\\over","\\choose"],{numArgs:0},function(e){var t;switch(e.funcName){case"\\over":t="\\frac";break;case"\\choose":t="\\binom";break;default:throw new Error("Unrecognized infix genfrac command")}return{type:"infix",replaceWith:t}});n(["\\\\","\\cr"],{numArgs:0,numOptionalArgs:1,argTypes:["size"]},function(e,t){var r=t[0];return{type:"cr",size:r}});n(["\\begin","\\end"],{numArgs:1,argTypes:["text"]},function(e,t){var r=t[0];if(r.type!=="ordgroup"){throw new i("Invalid environment name",e.lexer,e.positions[1])}var a="";for(var n=0;n";return e};function n(e){this.text=e}n.prototype.toNode=function(){return document.createTextNode(this.text)};n.prototype.toMarkup=function(){return a.escape(this.text)};t.exports={MathNode:i,TextNode:n}},{"./utils":23}],20:[function(e,t,r){function a(e,t,r){this.type=e;this.value=t;this.mode=r}t.exports={ParseNode:a}},{}],21:[function(e,t,r){var a=e("./Parser");var i=function(e,t){var r=new a(e,t);return r.parse()};t.exports=i},{"./Parser":6}],22:[function(e,t,r){t.exports={math:{},text:{}};function a(e,r,a,i,n){t.exports[e][n]={font:r,group:a,replace:i}}var i="math";var n="text";var s="main";var l="ams";var o="accent";var u="bin";var p="close";var h="inner";var c="mathord";var v="op";var m="open";var f="punct";var d="rel";var g="spacing";var y="textord";a(i,s,d,"\u2261","\\equiv");a(i,s,d,"\u227a","\\prec");a(i,s,d,"\u227b","\\succ");a(i,s,d,"\u223c","\\sim");a(i,s,d,"\u22a5","\\perp");a(i,s,d,"\u2aaf","\\preceq");a(i,s,d,"\u2ab0","\\succeq");a(i,s,d,"\u2243","\\simeq");a(i,s,d,"\u2223","\\mid");a(i,s,d,"\u226a","\\ll");a(i,s,d,"\u226b","\\gg");a(i,s,d,"\u224d","\\asymp");a(i,s,d,"\u2225","\\parallel");a(i,s,d,"\u22c8","\\bowtie");a(i,s,d,"\u2323","\\smile");a(i,s,d,"\u2291","\\sqsubseteq");a(i,s,d,"\u2292","\\sqsupseteq");a(i,s,d,"\u2250","\\doteq");a(i,s,d,"\u2322","\\frown");a(i,s,d,"\u220b","\\ni");a(i,s,d,"\u221d","\\propto");a(i,s,d,"\u22a2","\\vdash");a(i,s,d,"\u22a3","\\dashv");a(i,s,d,"\u220b","\\owns");a(i,s,f,".","\\ldotp");a(i,s,f,"\u22c5","\\cdotp");a(i,s,y,"#","\\#");a(i,s,y,"&","\\&");a(i,s,y,"\u2135","\\aleph");a(i,s,y,"\u2200","\\forall");a(i,s,y,"\u210f","\\hbar");a(i,s,y,"\u2203","\\exists");a(i,s,y,"\u2207","\\nabla");a(i,s,y,"\u266d","\\flat");a(i,s,y,"\u2113","\\ell");a(i,s,y,"\u266e","\\natural");a(i,s,y,"\u2663","\\clubsuit");a(i,s,y,"\u2118","\\wp");a(i,s,y,"\u266f","\\sharp");a(i,s,y,"\u2662","\\diamondsuit");a(i,s,y,"\u211c","\\Re");a(i,s,y,"\u2661","\\heartsuit");a(i,s,y,"\u2111","\\Im");a(i,s,y,"\u2660","\\spadesuit");a(i,s,y,"\u2020","\\dag");a(i,s,y,"\u2021","\\ddag");a(i,s,p,"\u23b1","\\rmoustache");a(i,s,m,"\u23b0","\\lmoustache");a(i,s,p,"\u27ef","\\rgroup");a(i,s,m,"\u27ee","\\lgroup");a(i,s,u,"\u2213","\\mp");a(i,s,u,"\u2296","\\ominus");a(i,s,u,"\u228e","\\uplus");a(i,s,u,"\u2293","\\sqcap");a(i,s,u,"\u2217","\\ast");a(i,s,u,"\u2294","\\sqcup");a(i,s,u,"\u25ef","\\bigcirc");a(i,s,u,"\u2219","\\bullet");a(i,s,u,"\u2021","\\ddagger");a(i,s,u,"\u2240","\\wr");a(i,s,u,"\u2a3f","\\amalg");a(i,s,d,"\u27f5","\\longleftarrow");a(i,s,d,"\u21d0","\\Leftarrow");a(i,s,d,"\u27f8","\\Longleftarrow");a(i,s,d,"\u27f6","\\longrightarrow");a(i,s,d,"\u21d2","\\Rightarrow");a(i,s,d,"\u27f9","\\Longrightarrow");a(i,s,d,"\u2194","\\leftrightarrow");a(i,s,d,"\u27f7","\\longleftrightarrow");a(i,s,d,"\u21d4","\\Leftrightarrow");a(i,s,d,"\u27fa","\\Longleftrightarrow");a(i,s,d,"\u21a6","\\mapsto");a(i,s,d,"\u27fc","\\longmapsto");a(i,s,d,"\u2197","\\nearrow");a(i,s,d,"\u21a9","\\hookleftarrow");a(i,s,d,"\u21aa","\\hookrightarrow");a(i,s,d,"\u2198","\\searrow");a(i,s,d,"\u21bc","\\leftharpoonup");a(i,s,d,"\u21c0","\\rightharpoonup");a(i,s,d,"\u2199","\\swarrow");a(i,s,d,"\u21bd","\\leftharpoondown");a(i,s,d,"\u21c1","\\rightharpoondown");a(i,s,d,"\u2196","\\nwarrow");a(i,s,d,"\u21cc","\\rightleftharpoons");a(i,l,d,"\u226e","\\nless");a(i,l,d,"\ue010","\\nleqslant");a(i,l,d,"\ue011","\\nleqq");a(i,l,d,"\u2a87","\\lneq");a(i,l,d,"\u2268","\\lneqq");a(i,l,d,"\ue00c","\\lvertneqq");a(i,l,d,"\u22e6","\\lnsim");a(i,l,d,"\u2a89","\\lnapprox");a(i,l,d,"\u2280","\\nprec");a(i,l,d,"\u22e0","\\npreceq");a(i,l,d,"\u22e8","\\precnsim");a(i,l,d,"\u2ab9","\\precnapprox");a(i,l,d,"\u2241","\\nsim");a(i,l,d,"\ue006","\\nshortmid");a(i,l,d,"\u2224","\\nmid");a(i,l,d,"\u22ac","\\nvdash");a(i,l,d,"\u22ad","\\nvDash");a(i,l,d,"\u22ea","\\ntriangleleft");a(i,l,d,"\u22ec","\\ntrianglelefteq");a(i,l,d,"\u228a","\\subsetneq");a(i,l,d,"\ue01a","\\varsubsetneq");a(i,l,d,"\u2acb","\\subsetneqq");a(i,l,d,"\ue017","\\varsubsetneqq");a(i,l,d,"\u226f","\\ngtr");a(i,l,d,"\ue00f","\\ngeqslant");a(i,l,d,"\ue00e","\\ngeqq");a(i,l,d,"\u2a88","\\gneq");a(i,l,d,"\u2269","\\gneqq");a(i,l,d,"\ue00d","\\gvertneqq");a(i,l,d,"\u22e7","\\gnsim");a(i,l,d,"\u2a8a","\\gnapprox");a(i,l,d,"\u2281","\\nsucc");a(i,l,d,"\u22e1","\\nsucceq");a(i,l,d,"\u22e9","\\succnsim");a(i,l,d,"\u2aba","\\succnapprox");a(i,l,d,"\u2246","\\ncong");a(i,l,d,"\ue007","\\nshortparallel");a(i,l,d,"\u2226","\\nparallel");a(i,l,d,"\u22af","\\nVDash");a(i,l,d,"\u22eb","\\ntriangleright");a(i,l,d,"\u22ed","\\ntrianglerighteq");a(i,l,d,"\ue018","\\nsupseteqq");a(i,l,d,"\u228b","\\supsetneq");a(i,l,d,"\ue01b","\\varsupsetneq");a(i,l,d,"\u2acc","\\supsetneqq");a(i,l,d,"\ue019","\\varsupsetneqq");a(i,l,d,"\u22ae","\\nVdash");a(i,l,d,"\u2ab5","\\precneqq");a(i,l,d,"\u2ab6","\\succneqq");a(i,l,d,"\ue016","\\nsubseteqq");a(i,l,u,"\u22b4","\\unlhd");a(i,l,u,"\u22b5","\\unrhd");a(i,l,d,"\u219a","\\nleftarrow");a(i,l,d,"\u219b","\\nrightarrow");a(i,l,d,"\u21cd","\\nLeftarrow");a(i,l,d,"\u21cf","\\nRightarrow");a(i,l,d,"\u21ae","\\nleftrightarrow");a(i,l,d,"\u21ce","\\nLeftrightarrow");a(i,l,d,"\u25b3","\\vartriangle");a(i,l,y,"\u210f","\\hslash");a(i,l,y,"\u25bd","\\triangledown");a(i,l,y,"\u25ca","\\lozenge");a(i,l,y,"\u24c8","\\circledS");a(i,l,y,"\xae","\\circledR");a(i,l,y,"\u2221","\\measuredangle");a(i,l,y,"\u2204","\\nexists");a(i,l,y,"\u2127","\\mho");a(i,l,y,"\u2132","\\Finv");a(i,l,y,"\u2141","\\Game");a(i,l,y,"k","\\Bbbk");a(i,l,y,"\u2035","\\backprime");a(i,l,y,"\u25b2","\\blacktriangle");a(i,l,y,"\u25bc","\\blacktriangledown");a(i,l,y,"\u25a0","\\blacksquare");a(i,l,y,"\u29eb","\\blacklozenge");a(i,l,y,"\u2605","\\bigstar");a(i,l,y,"\u2222","\\sphericalangle");a(i,l,y,"\u2201","\\complement");a(i,l,y,"\xf0","\\eth");a(i,l,y,"\u2571","\\diagup");a(i,l,y,"\u2572","\\diagdown");a(i,l,y,"\u25a1","\\square");a(i,l,y,"\u25a1","\\Box");a(i,l,y,"\u25ca","\\Diamond");a(i,l,y,"\xa5","\\yen");a(i,l,y,"\u2713","\\checkmark");a(i,l,y,"\u2136","\\beth");a(i,l,y,"\u2138","\\daleth");a(i,l,y,"\u2137","\\gimel");a(i,l,y,"\u03dd","\\digamma");a(i,l,y,"\u03f0","\\varkappa");a(i,l,m,"\u250c","\\ulcorner");a(i,l,p,"\u2510","\\urcorner");a(i,l,m,"\u2514","\\llcorner");a(i,l,p,"\u2518","\\lrcorner");a(i,l,d,"\u2266","\\leqq");a(i,l,d,"\u2a7d","\\leqslant");a(i,l,d,"\u2a95","\\eqslantless");a(i,l,d,"\u2272","\\lesssim");a(i,l,d,"\u2a85","\\lessapprox");a(i,l,d,"\u224a","\\approxeq");a(i,l,u,"\u22d6","\\lessdot");a(i,l,d,"\u22d8","\\lll");a(i,l,d,"\u2276","\\lessgtr");a(i,l,d,"\u22da","\\lesseqgtr");a(i,l,d,"\u2a8b","\\lesseqqgtr");a(i,l,d,"\u2251","\\doteqdot");a(i,l,d,"\u2253","\\risingdotseq");a(i,l,d,"\u2252","\\fallingdotseq");a(i,l,d,"\u223d","\\backsim");a(i,l,d,"\u22cd","\\backsimeq");a(i,l,d,"\u2ac5","\\subseteqq");a(i,l,d,"\u22d0","\\Subset");a(i,l,d,"\u228f","\\sqsubset");a(i,l,d,"\u227c","\\preccurlyeq");a(i,l,d,"\u22de","\\curlyeqprec");a(i,l,d,"\u227e","\\precsim");a(i,l,d,"\u2ab7","\\precapprox");a(i,l,d,"\u22b2","\\vartriangleleft");a(i,l,d,"\u22b4","\\trianglelefteq");a(i,l,d,"\u22a8","\\vDash");a(i,l,d,"\u22aa","\\Vvdash");a(i,l,d,"\u2323","\\smallsmile");a(i,l,d,"\u2322","\\smallfrown");a(i,l,d,"\u224f","\\bumpeq");a(i,l,d,"\u224e","\\Bumpeq");a(i,l,d,"\u2267","\\geqq");a(i,l,d,"\u2a7e","\\geqslant");a(i,l,d,"\u2a96","\\eqslantgtr");a(i,l,d,"\u2273","\\gtrsim");a(i,l,d,"\u2a86","\\gtrapprox");a(i,l,u,"\u22d7","\\gtrdot");a(i,l,d,"\u22d9","\\ggg");a(i,l,d,"\u2277","\\gtrless");a(i,l,d,"\u22db","\\gtreqless");a(i,l,d,"\u2a8c","\\gtreqqless");a(i,l,d,"\u2256","\\eqcirc");a(i,l,d,"\u2257","\\circeq");a(i,l,d,"\u225c","\\triangleq");a(i,l,d,"\u223c","\\thicksim");a(i,l,d,"\u2248","\\thickapprox");a(i,l,d,"\u2ac6","\\supseteqq");a(i,l,d,"\u22d1","\\Supset");a(i,l,d,"\u2290","\\sqsupset");a(i,l,d,"\u227d","\\succcurlyeq");a(i,l,d,"\u22df","\\curlyeqsucc");a(i,l,d,"\u227f","\\succsim");a(i,l,d,"\u2ab8","\\succapprox");a(i,l,d,"\u22b3","\\vartriangleright");a(i,l,d,"\u22b5","\\trianglerighteq");a(i,l,d,"\u22a9","\\Vdash");a(i,l,d,"\u2223","\\shortmid");a(i,l,d,"\u2225","\\shortparallel");a(i,l,d,"\u226c","\\between");a(i,l,d,"\u22d4","\\pitchfork");a(i,l,d,"\u221d","\\varpropto");a(i,l,d,"\u25c0","\\blacktriangleleft");a(i,l,d,"\u2234","\\therefore");a(i,l,d,"\u220d","\\backepsilon");a(i,l,d,"\u25b6","\\blacktriangleright");a(i,l,d,"\u2235","\\because");a(i,l,d,"\u22d8","\\llless");a(i,l,d,"\u22d9","\\gggtr");a(i,l,u,"\u22b2","\\lhd");a(i,l,u,"\u22b3","\\rhd");a(i,l,d,"\u2242","\\eqsim");a(i,s,d,"\u22c8","\\Join");a(i,l,d,"\u2251","\\Doteq");a(i,l,u,"\u2214","\\dotplus");a(i,l,u,"\u2216","\\smallsetminus");a(i,l,u,"\u22d2","\\Cap");a(i,l,u,"\u22d3","\\Cup");a(i,l,u,"\u2a5e","\\doublebarwedge");a(i,l,u,"\u229f","\\boxminus");a(i,l,u,"\u229e","\\boxplus");a(i,l,u,"\u22c7","\\divideontimes");a(i,l,u,"\u22c9","\\ltimes");a(i,l,u,"\u22ca","\\rtimes");a(i,l,u,"\u22cb","\\leftthreetimes");a(i,l,u,"\u22cc","\\rightthreetimes");a(i,l,u,"\u22cf","\\curlywedge");a(i,l,u,"\u22ce","\\curlyvee");a(i,l,u,"\u229d","\\circleddash");a(i,l,u,"\u229b","\\circledast");a(i,l,u,"\u22c5","\\centerdot");a(i,l,u,"\u22ba","\\intercal");a(i,l,u,"\u22d2","\\doublecap");a(i,l,u,"\u22d3","\\doublecup");a(i,l,u,"\u22a0","\\boxtimes");a(i,l,d,"\u21e2","\\dashrightarrow");a(i,l,d,"\u21e0","\\dashleftarrow");a(i,l,d,"\u21c7","\\leftleftarrows");a(i,l,d,"\u21c6","\\leftrightarrows");a(i,l,d,"\u21da","\\Lleftarrow");a(i,l,d,"\u219e","\\twoheadleftarrow");a(i,l,d,"\u21a2","\\leftarrowtail");a(i,l,d,"\u21ab","\\looparrowleft");a(i,l,d,"\u21cb","\\leftrightharpoons");a(i,l,d,"\u21b6","\\curvearrowleft");a(i,l,d,"\u21ba","\\circlearrowleft");a(i,l,d,"\u21b0","\\Lsh");a(i,l,d,"\u21c8","\\upuparrows");a(i,l,d,"\u21bf","\\upharpoonleft");a(i,l,d,"\u21c3","\\downharpoonleft");a(i,l,d,"\u22b8","\\multimap");a(i,l,d,"\u21ad","\\leftrightsquigarrow");a(i,l,d,"\u21c9","\\rightrightarrows");a(i,l,d,"\u21c4","\\rightleftarrows");a(i,l,d,"\u21a0","\\twoheadrightarrow");a(i,l,d,"\u21a3","\\rightarrowtail");a(i,l,d,"\u21ac","\\looparrowright");a(i,l,d,"\u21b7","\\curvearrowright");a(i,l,d,"\u21bb","\\circlearrowright");a(i,l,d,"\u21b1","\\Rsh");a(i,l,d,"\u21ca","\\downdownarrows");a(i,l,d,"\u21be","\\upharpoonright");a(i,l,d,"\u21c2","\\downharpoonright");a(i,l,d,"\u21dd","\\rightsquigarrow");a(i,l,d,"\u21dd","\\leadsto");a(i,l,d,"\u21db","\\Rrightarrow");a(i,l,d,"\u21be","\\restriction");a(i,s,y,"\u2018","`");a(i,s,y,"$","\\$");a(i,s,y,"%","\\%");a(i,s,y,"_","\\_");a(i,s,y,"\u2220","\\angle");a(i,s,y,"\u221e","\\infty");a(i,s,y,"\u2032","\\prime");a(i,s,y,"\u25b3","\\triangle");a(i,s,y,"\u0393","\\Gamma");a(i,s,y,"\u0394","\\Delta");a(i,s,y,"\u0398","\\Theta");a(i,s,y,"\u039b","\\Lambda");a(i,s,y,"\u039e","\\Xi");a(i,s,y,"\u03a0","\\Pi");a(i,s,y,"\u03a3","\\Sigma");a(i,s,y,"\u03a5","\\Upsilon");a(i,s,y,"\u03a6","\\Phi");a(i,s,y,"\u03a8","\\Psi");a(i,s,y,"\u03a9","\\Omega");a(i,s,y,"\xac","\\neg");a(i,s,y,"\xac","\\lnot");a(i,s,y,"\u22a4","\\top");a(i,s,y,"\u22a5","\\bot");a(i,s,y,"\u2205","\\emptyset");a(i,l,y,"\u2205","\\varnothing");a(i,s,c,"\u03b1","\\alpha");a(i,s,c,"\u03b2","\\beta");a(i,s,c,"\u03b3","\\gamma");a(i,s,c,"\u03b4","\\delta");a(i,s,c,"\u03f5","\\epsilon");a(i,s,c,"\u03b6","\\zeta");a(i,s,c,"\u03b7","\\eta");a(i,s,c,"\u03b8","\\theta");a(i,s,c,"\u03b9","\\iota");a(i,s,c,"\u03ba","\\kappa");a(i,s,c,"\u03bb","\\lambda");a(i,s,c,"\u03bc","\\mu");a(i,s,c,"\u03bd","\\nu");a(i,s,c,"\u03be","\\xi");a(i,s,c,"o","\\omicron");a(i,s,c,"\u03c0","\\pi");a(i,s,c,"\u03c1","\\rho");a(i,s,c,"\u03c3","\\sigma");a(i,s,c,"\u03c4","\\tau");a(i,s,c,"\u03c5","\\upsilon");a(i,s,c,"\u03d5","\\phi");a(i,s,c,"\u03c7","\\chi");a(i,s,c,"\u03c8","\\psi");a(i,s,c,"\u03c9","\\omega");a(i,s,c,"\u03b5","\\varepsilon");a(i,s,c,"\u03d1","\\vartheta");a(i,s,c,"\u03d6","\\varpi");a(i,s,c,"\u03f1","\\varrho");a(i,s,c,"\u03c2","\\varsigma");a(i,s,c,"\u03c6","\\varphi");a(i,s,u,"\u2217","*");a(i,s,u,"+","+");a(i,s,u,"\u2212","-");a(i,s,u,"\u22c5","\\cdot");a(i,s,u,"\u2218","\\circ");a(i,s,u,"\xf7","\\div");a(i,s,u,"\xb1","\\pm");a(i,s,u,"\xd7","\\times");a(i,s,u,"\u2229","\\cap");a(i,s,u,"\u222a","\\cup");a(i,s,u,"\u2216","\\setminus");a(i,s,u,"\u2227","\\land");a(i,s,u,"\u2228","\\lor");a(i,s,u,"\u2227","\\wedge");a(i,s,u,"\u2228","\\vee");a(i,s,y,"\u221a","\\surd");a(i,s,m,"(","(");a(i,s,m,"[","[");a(i,s,m,"\u27e8","\\langle");a(i,s,m,"\u2223","\\lvert");a(i,s,m,"\u2225","\\lVert");a(i,s,p,")",")");a(i,s,p,"]","]");a(i,s,p,"?","?");a(i,s,p,"!","!");a(i,s,p,"\u27e9","\\rangle");a(i,s,p,"\u2223","\\rvert");a(i,s,p,"\u2225","\\rVert");a(i,s,d,"=","=");a(i,s,d,"<","<");a(i,s,d,">",">");a(i,s,d,":",":");a(i,s,d,"\u2248","\\approx");a(i,s,d,"\u2245","\\cong");a(i,s,d,"\u2265","\\ge");a(i,s,d,"\u2265","\\geq");a(i,s,d,"\u2190","\\gets");a(i,s,d,">","\\gt");a(i,s,d,"\u2208","\\in");a(i,s,d,"\u2209","\\notin");a(i,s,d,"\u2282","\\subset");a(i,s,d,"\u2283","\\supset");a(i,s,d,"\u2286","\\subseteq");a(i,s,d,"\u2287","\\supseteq");a(i,l,d,"\u2288","\\nsubseteq");a(i,l,d,"\u2289","\\nsupseteq");a(i,s,d,"\u22a8","\\models");a(i,s,d,"\u2190","\\leftarrow");a(i,s,d,"\u2264","\\le");a(i,s,d,"\u2264","\\leq");a(i,s,d,"<","\\lt");a(i,s,d,"\u2260","\\ne");a(i,s,d,"\u2260","\\neq");a(i,s,d,"\u2192","\\rightarrow");a(i,s,d,"\u2192","\\to");a(i,l,d,"\u2271","\\ngeq");a(i,l,d,"\u2270","\\nleq");a(i,s,g,null,"\\!");a(i,s,g,"\xa0","\\ ");a(i,s,g,"\xa0","~");a(i,s,g,null,"\\,");a(i,s,g,null,"\\:");a(i,s,g,null,"\\;");a(i,s,g,null,"\\enspace");a(i,s,g,null,"\\qquad");a(i,s,g,null,"\\quad");a(i,s,g,"\xa0","\\space");a(i,s,f,",",",");a(i,s,f,";",";");a(i,s,f,":","\\colon");a(i,l,u,"\u22bc","\\barwedge");a(i,l,u,"\u22bb","\\veebar");a(i,s,u,"\u2299","\\odot");a(i,s,u,"\u2295","\\oplus");a(i,s,u,"\u2297","\\otimes");a(i,s,y,"\u2202","\\partial");a(i,s,u,"\u2298","\\oslash");a(i,l,u,"\u229a","\\circledcirc");a(i,l,u,"\u22a1","\\boxdot");a(i,s,u,"\u25b3","\\bigtriangleup");a(i,s,u,"\u25bd","\\bigtriangledown");a(i,s,u,"\u2020","\\dagger");a(i,s,u,"\u22c4","\\diamond");a(i,s,u,"\u22c6","\\star");a(i,s,u,"\u25c3","\\triangleleft");a(i,s,u,"\u25b9","\\triangleright");a(i,s,m,"{","\\{");a(i,s,p,"}","\\}");a(i,s,m,"{","\\lbrace");a(i,s,p,"}","\\rbrace");a(i,s,m,"[","\\lbrack");a(i,s,p,"]","\\rbrack");a(i,s,m,"\u230a","\\lfloor");a(i,s,p,"\u230b","\\rfloor");a(i,s,m,"\u2308","\\lceil");a(i,s,p,"\u2309","\\rceil");a(i,s,y,"\\","\\backslash");a(i,s,y,"\u2223","|");a(i,s,y,"\u2223","\\vert");a(i,s,y,"\u2225","\\|");a(i,s,y,"\u2225","\\Vert");a(i,s,d,"\u2191","\\uparrow");a(i,s,d,"\u21d1","\\Uparrow");a(i,s,d,"\u2193","\\downarrow");a(i,s,d,"\u21d3","\\Downarrow");a(i,s,d,"\u2195","\\updownarrow");a(i,s,d,"\u21d5","\\Updownarrow");a(i,i,v,"\u2210","\\coprod");a(i,i,v,"\u22c1","\\bigvee");a(i,i,v,"\u22c0","\\bigwedge");a(i,i,v,"\u2a04","\\biguplus");a(i,i,v,"\u22c2","\\bigcap");a(i,i,v,"\u22c3","\\bigcup");a(i,i,v,"\u222b","\\int");a(i,i,v,"\u222b","\\intop");a(i,i,v,"\u222c","\\iint");a(i,i,v,"\u222d","\\iiint");a(i,i,v,"\u220f","\\prod");a(i,i,v,"\u2211","\\sum");a(i,i,v,"\u2a02","\\bigotimes");a(i,i,v,"\u2a01","\\bigoplus");a(i,i,v,"\u2a00","\\bigodot");a(i,i,v,"\u222e","\\oint");a(i,i,v,"\u2a06","\\bigsqcup");a(i,i,v,"\u222b","\\smallint");a(i,s,h,"\u2026","\\ldots");a(i,s,h,"\u22ef","\\cdots");a(i,s,h,"\u22f1","\\ddots");a(i,s,y,"\u22ee","\\vdots");a(i,s,o,"\xb4","\\acute");a(i,s,o,"`","\\grave");a(i,s,o,"\xa8","\\ddot");a(i,s,o,"~","\\tilde");a(i,s,o,"\xaf","\\bar");a(i,s,o,"\u02d8","\\breve");a(i,s,o,"\u02c7","\\check");a(i,s,o,"^","\\hat");a(i,s,o,"\u20d7","\\vec");a(i,s,o,"\u02d9","\\dot");a(i,s,c,"\u0131","\\imath");a(i,s,c,"\u0237","\\jmath");a(n,s,g,"\xa0","\\ ");a(n,s,g,"\xa0"," ");a(n,s,g,"\xa0","~");var b;var x;var w='0123456789/@."';for(b=0;b":">","<":"<",'"':""","'":"'"};var p=/[&><"']/g;function h(e){return u[e]}function c(e){return(""+e).replace(p,h)}var v;if(typeof document!=="undefined"){var m=document.createElement("span");if("textContent"in m){v=function(e,t){e.textContent=t}}else{v=function(e,t){e.innerText=t}}}function f(e){v(e,"")}t.exports={contains:n,deflt:s,escape:c,hyphenate:o,indexOf:i,setTextContent:v,clearNode:f}},{}]},{},[1])(1)}); \ No newline at end of file diff --git a/plugins/tiddlywiki/katex/files/katex.without-font-face.min.css b/plugins/tiddlywiki/katex/files/katex.without-font-face.min.css index 451974934..9c22acb6d 100644 --- a/plugins/tiddlywiki/katex/files/katex.without-font-face.min.css +++ b/plugins/tiddlywiki/katex/files/katex.without-font-face.min.css @@ -1 +1 @@ -.katex-display{display:block;margin:1em 0;text-align:center}.katex-display>.katex{display:inline-block}.katex{font:400 1.21em KaTeX_Main;line-height:1.2;white-space:nowrap;text-indent:0}.katex .katex-html{display:inline-block}.katex .katex-mathml{position:absolute;clip:rect(1px,1px,1px,1px);padding:0;border:0;height:1px;width:1px;overflow:hidden}.katex .base,.katex .strut{display:inline-block}.katex .mathit{font-family:KaTeX_Math;font-style:italic}.katex .mathbf{font-family:KaTeX_Main;font-weight:700}.katex .amsrm,.katex .mathbb{font-family:KaTeX_AMS}.katex .mathcal{font-family:KaTeX_Caligraphic}.katex .mathfrak{font-family:KaTeX_Fraktur}.katex .mathtt{font-family:KaTeX_Typewriter}.katex .mathscr{font-family:KaTeX_Script}.katex .mathsf{font-family:KaTeX_SansSerif}.katex .mainit{font-family:KaTeX_Main;font-style:italic}.katex .textstyle>.mord+.mop{margin-left:.16667em}.katex .textstyle>.mord+.mbin{margin-left:.22222em}.katex .textstyle>.mord+.mrel{margin-left:.27778em}.katex .textstyle>.mop+.mop,.katex .textstyle>.mop+.mord,.katex .textstyle>.mord+.minner{margin-left:.16667em}.katex .textstyle>.mop+.mrel{margin-left:.27778em}.katex .textstyle>.mop+.minner{margin-left:.16667em}.katex .textstyle>.mbin+.minner,.katex .textstyle>.mbin+.mop,.katex .textstyle>.mbin+.mopen,.katex .textstyle>.mbin+.mord{margin-left:.22222em}.katex .textstyle>.mrel+.minner,.katex .textstyle>.mrel+.mop,.katex .textstyle>.mrel+.mopen,.katex .textstyle>.mrel+.mord{margin-left:.27778em}.katex .textstyle>.mclose+.mop{margin-left:.16667em}.katex .textstyle>.mclose+.mbin{margin-left:.22222em}.katex .textstyle>.mclose+.mrel{margin-left:.27778em}.katex .textstyle>.mclose+.minner,.katex .textstyle>.minner+.mop,.katex .textstyle>.minner+.mord,.katex .textstyle>.mpunct+.mclose,.katex .textstyle>.mpunct+.minner,.katex .textstyle>.mpunct+.mop,.katex .textstyle>.mpunct+.mopen,.katex .textstyle>.mpunct+.mord,.katex .textstyle>.mpunct+.mpunct,.katex .textstyle>.mpunct+.mrel{margin-left:.16667em}.katex .textstyle>.minner+.mbin{margin-left:.22222em}.katex .textstyle>.minner+.mrel{margin-left:.27778em}.katex .mclose+.mop,.katex .minner+.mop,.katex .mop+.mop,.katex .mop+.mord,.katex .mord+.mop,.katex .textstyle>.minner+.minner,.katex .textstyle>.minner+.mopen,.katex .textstyle>.minner+.mpunct{margin-left:.16667em}.katex .reset-textstyle.textstyle{font-size:1em}.katex .reset-textstyle.scriptstyle{font-size:.7em}.katex .reset-textstyle.scriptscriptstyle{font-size:.5em}.katex .reset-scriptstyle.textstyle{font-size:1.42857em}.katex .reset-scriptstyle.scriptstyle{font-size:1em}.katex .reset-scriptstyle.scriptscriptstyle{font-size:.71429em}.katex .reset-scriptscriptstyle.textstyle{font-size:2em}.katex .reset-scriptscriptstyle.scriptstyle{font-size:1.4em}.katex .reset-scriptscriptstyle.scriptscriptstyle{font-size:1em}.katex .style-wrap{position:relative}.katex .vlist{display:inline-block}.katex .vlist>span{display:block;height:0;position:relative}.katex .vlist>span>span{display:inline-block}.katex .vlist .baseline-fix{display:inline-table;table-layout:fixed}.katex .msupsub{text-align:left}.katex .mfrac>span>span{text-align:center}.katex .mfrac .frac-line{width:100%}.katex .mfrac .frac-line:before{border-bottom-style:solid;border-bottom-width:1px;content:"";display:block}.katex .mfrac .frac-line:after{border-bottom-style:solid;border-bottom-width:.04em;content:"";display:block;margin-top:-1px}.katex .mspace{display:inline-block}.katex .mspace.negativethinspace{margin-left:-.16667em}.katex .mspace.thinspace{width:.16667em}.katex .mspace.mediumspace{width:.22222em}.katex .mspace.thickspace{width:.27778em}.katex .mspace.enspace{width:.5em}.katex .mspace.quad{width:1em}.katex .mspace.qquad{width:2em}.katex .llap,.katex .rlap{width:0;position:relative}.katex .llap>.inner,.katex .rlap>.inner{position:absolute}.katex .llap>.fix,.katex .rlap>.fix{display:inline-block}.katex .llap>.inner{right:0}.katex .rlap>.inner{left:0}.katex .katex-logo .a{font-size:.75em;margin-left:-.32em;position:relative;top:-.2em}.katex .katex-logo .t{margin-left:-.23em}.katex .katex-logo .e{margin-left:-.1667em;position:relative;top:.2155em}.katex .katex-logo .x{margin-left:-.125em}.katex .rule{display:inline-block;border-style:solid;position:relative}.katex .overline .overline-line{width:100%}.katex .overline .overline-line:before{border-bottom-style:solid;border-bottom-width:1px;content:"";display:block}.katex .overline .overline-line:after{border-bottom-style:solid;border-bottom-width:.04em;content:"";display:block;margin-top:-1px}.katex .sqrt>.sqrt-sign{position:relative}.katex .sqrt .sqrt-line{width:100%}.katex .sqrt .sqrt-line:before{border-bottom-style:solid;border-bottom-width:1px;content:"";display:block}.katex .sqrt .sqrt-line:after{border-bottom-style:solid;border-bottom-width:.04em;content:"";display:block;margin-top:-1px}.katex .sqrt>.root{margin-left:.27777778em;margin-right:-.55555556em}.katex .fontsize-ensurer,.katex .sizing{display:inline-block}.katex .fontsize-ensurer.reset-size1.size1,.katex .sizing.reset-size1.size1{font-size:1em}.katex .fontsize-ensurer.reset-size1.size2,.katex .sizing.reset-size1.size2{font-size:1.4em}.katex .fontsize-ensurer.reset-size1.size3,.katex .sizing.reset-size1.size3{font-size:1.6em}.katex .fontsize-ensurer.reset-size1.size4,.katex .sizing.reset-size1.size4{font-size:1.8em}.katex .fontsize-ensurer.reset-size1.size5,.katex .sizing.reset-size1.size5{font-size:2em}.katex .fontsize-ensurer.reset-size1.size6,.katex .sizing.reset-size1.size6{font-size:2.4em}.katex .fontsize-ensurer.reset-size1.size7,.katex .sizing.reset-size1.size7{font-size:2.88em}.katex .fontsize-ensurer.reset-size1.size8,.katex .sizing.reset-size1.size8{font-size:3.46em}.katex .fontsize-ensurer.reset-size1.size9,.katex .sizing.reset-size1.size9{font-size:4.14em}.katex .fontsize-ensurer.reset-size1.size10,.katex .sizing.reset-size1.size10{font-size:4.98em}.katex .fontsize-ensurer.reset-size2.size1,.katex .sizing.reset-size2.size1{font-size:.71428571em}.katex .fontsize-ensurer.reset-size2.size2,.katex .sizing.reset-size2.size2{font-size:1em}.katex .fontsize-ensurer.reset-size2.size3,.katex .sizing.reset-size2.size3{font-size:1.14285714em}.katex .fontsize-ensurer.reset-size2.size4,.katex .sizing.reset-size2.size4{font-size:1.28571429em}.katex .fontsize-ensurer.reset-size2.size5,.katex .sizing.reset-size2.size5{font-size:1.42857143em}.katex .fontsize-ensurer.reset-size2.size6,.katex .sizing.reset-size2.size6{font-size:1.71428571em}.katex .fontsize-ensurer.reset-size2.size7,.katex .sizing.reset-size2.size7{font-size:2.05714286em}.katex .fontsize-ensurer.reset-size2.size8,.katex .sizing.reset-size2.size8{font-size:2.47142857em}.katex .fontsize-ensurer.reset-size2.size9,.katex .sizing.reset-size2.size9{font-size:2.95714286em}.katex .fontsize-ensurer.reset-size2.size10,.katex .sizing.reset-size2.size10{font-size:3.55714286em}.katex .fontsize-ensurer.reset-size3.size1,.katex .sizing.reset-size3.size1{font-size:.625em}.katex .fontsize-ensurer.reset-size3.size2,.katex .sizing.reset-size3.size2{font-size:.875em}.katex .fontsize-ensurer.reset-size3.size3,.katex .sizing.reset-size3.size3{font-size:1em}.katex .fontsize-ensurer.reset-size3.size4,.katex .sizing.reset-size3.size4{font-size:1.125em}.katex .fontsize-ensurer.reset-size3.size5,.katex .sizing.reset-size3.size5{font-size:1.25em}.katex .fontsize-ensurer.reset-size3.size6,.katex .sizing.reset-size3.size6{font-size:1.5em}.katex .fontsize-ensurer.reset-size3.size7,.katex .sizing.reset-size3.size7{font-size:1.8em}.katex .fontsize-ensurer.reset-size3.size8,.katex .sizing.reset-size3.size8{font-size:2.1625em}.katex .fontsize-ensurer.reset-size3.size9,.katex .sizing.reset-size3.size9{font-size:2.5875em}.katex .fontsize-ensurer.reset-size3.size10,.katex .sizing.reset-size3.size10{font-size:3.1125em}.katex .fontsize-ensurer.reset-size4.size1,.katex .sizing.reset-size4.size1{font-size:.55555556em}.katex .fontsize-ensurer.reset-size4.size2,.katex .sizing.reset-size4.size2{font-size:.77777778em}.katex .fontsize-ensurer.reset-size4.size3,.katex .sizing.reset-size4.size3{font-size:.88888889em}.katex .fontsize-ensurer.reset-size4.size4,.katex .sizing.reset-size4.size4{font-size:1em}.katex .fontsize-ensurer.reset-size4.size5,.katex .sizing.reset-size4.size5{font-size:1.11111111em}.katex .fontsize-ensurer.reset-size4.size6,.katex .sizing.reset-size4.size6{font-size:1.33333333em}.katex .fontsize-ensurer.reset-size4.size7,.katex .sizing.reset-size4.size7{font-size:1.6em}.katex .fontsize-ensurer.reset-size4.size8,.katex .sizing.reset-size4.size8{font-size:1.92222222em}.katex .fontsize-ensurer.reset-size4.size9,.katex .sizing.reset-size4.size9{font-size:2.3em}.katex .fontsize-ensurer.reset-size4.size10,.katex .sizing.reset-size4.size10{font-size:2.76666667em}.katex .fontsize-ensurer.reset-size5.size1,.katex .sizing.reset-size5.size1{font-size:.5em}.katex .fontsize-ensurer.reset-size5.size2,.katex .sizing.reset-size5.size2{font-size:.7em}.katex .fontsize-ensurer.reset-size5.size3,.katex .sizing.reset-size5.size3{font-size:.8em}.katex .fontsize-ensurer.reset-size5.size4,.katex .sizing.reset-size5.size4{font-size:.9em}.katex .fontsize-ensurer.reset-size5.size5,.katex .sizing.reset-size5.size5{font-size:1em}.katex .fontsize-ensurer.reset-size5.size6,.katex .sizing.reset-size5.size6{font-size:1.2em}.katex .fontsize-ensurer.reset-size5.size7,.katex .sizing.reset-size5.size7{font-size:1.44em}.katex .fontsize-ensurer.reset-size5.size8,.katex .sizing.reset-size5.size8{font-size:1.73em}.katex .fontsize-ensurer.reset-size5.size9,.katex .sizing.reset-size5.size9{font-size:2.07em}.katex .fontsize-ensurer.reset-size5.size10,.katex .sizing.reset-size5.size10{font-size:2.49em}.katex .fontsize-ensurer.reset-size6.size1,.katex .sizing.reset-size6.size1{font-size:.41666667em}.katex .fontsize-ensurer.reset-size6.size2,.katex .sizing.reset-size6.size2{font-size:.58333333em}.katex .fontsize-ensurer.reset-size6.size3,.katex .sizing.reset-size6.size3{font-size:.66666667em}.katex .fontsize-ensurer.reset-size6.size4,.katex .sizing.reset-size6.size4{font-size:.75em}.katex .fontsize-ensurer.reset-size6.size5,.katex .sizing.reset-size6.size5{font-size:.83333333em}.katex .fontsize-ensurer.reset-size6.size6,.katex .sizing.reset-size6.size6{font-size:1em}.katex .fontsize-ensurer.reset-size6.size7,.katex .sizing.reset-size6.size7{font-size:1.2em}.katex .fontsize-ensurer.reset-size6.size8,.katex .sizing.reset-size6.size8{font-size:1.44166667em}.katex .fontsize-ensurer.reset-size6.size9,.katex .sizing.reset-size6.size9{font-size:1.725em}.katex .fontsize-ensurer.reset-size6.size10,.katex .sizing.reset-size6.size10{font-size:2.075em}.katex .fontsize-ensurer.reset-size7.size1,.katex .sizing.reset-size7.size1{font-size:.34722222em}.katex .fontsize-ensurer.reset-size7.size2,.katex .sizing.reset-size7.size2{font-size:.48611111em}.katex .fontsize-ensurer.reset-size7.size3,.katex .sizing.reset-size7.size3{font-size:.55555556em}.katex .fontsize-ensurer.reset-size7.size4,.katex .sizing.reset-size7.size4{font-size:.625em}.katex .fontsize-ensurer.reset-size7.size5,.katex .sizing.reset-size7.size5{font-size:.69444444em}.katex .fontsize-ensurer.reset-size7.size6,.katex .sizing.reset-size7.size6{font-size:.83333333em}.katex .fontsize-ensurer.reset-size7.size7,.katex .sizing.reset-size7.size7{font-size:1em}.katex .fontsize-ensurer.reset-size7.size8,.katex .sizing.reset-size7.size8{font-size:1.20138889em}.katex .fontsize-ensurer.reset-size7.size9,.katex .sizing.reset-size7.size9{font-size:1.4375em}.katex .fontsize-ensurer.reset-size7.size10,.katex .sizing.reset-size7.size10{font-size:1.72916667em}.katex .fontsize-ensurer.reset-size8.size1,.katex .sizing.reset-size8.size1{font-size:.28901734em}.katex .fontsize-ensurer.reset-size8.size2,.katex .sizing.reset-size8.size2{font-size:.40462428em}.katex .fontsize-ensurer.reset-size8.size3,.katex .sizing.reset-size8.size3{font-size:.46242775em}.katex .fontsize-ensurer.reset-size8.size4,.katex .sizing.reset-size8.size4{font-size:.52023121em}.katex .fontsize-ensurer.reset-size8.size5,.katex .sizing.reset-size8.size5{font-size:.57803468em}.katex .fontsize-ensurer.reset-size8.size6,.katex .sizing.reset-size8.size6{font-size:.69364162em}.katex .fontsize-ensurer.reset-size8.size7,.katex .sizing.reset-size8.size7{font-size:.83236994em}.katex .fontsize-ensurer.reset-size8.size8,.katex .sizing.reset-size8.size8{font-size:1em}.katex .fontsize-ensurer.reset-size8.size9,.katex .sizing.reset-size8.size9{font-size:1.19653179em}.katex .fontsize-ensurer.reset-size8.size10,.katex .sizing.reset-size8.size10{font-size:1.43930636em}.katex .fontsize-ensurer.reset-size9.size1,.katex .sizing.reset-size9.size1{font-size:.24154589em}.katex .fontsize-ensurer.reset-size9.size2,.katex .sizing.reset-size9.size2{font-size:.33816425em}.katex .fontsize-ensurer.reset-size9.size3,.katex .sizing.reset-size9.size3{font-size:.38647343em}.katex .fontsize-ensurer.reset-size9.size4,.katex .sizing.reset-size9.size4{font-size:.43478261em}.katex .fontsize-ensurer.reset-size9.size5,.katex .sizing.reset-size9.size5{font-size:.48309179em}.katex .fontsize-ensurer.reset-size9.size6,.katex .sizing.reset-size9.size6{font-size:.57971014em}.katex .fontsize-ensurer.reset-size9.size7,.katex .sizing.reset-size9.size7{font-size:.69565217em}.katex .fontsize-ensurer.reset-size9.size8,.katex .sizing.reset-size9.size8{font-size:.83574879em}.katex .fontsize-ensurer.reset-size9.size9,.katex .sizing.reset-size9.size9{font-size:1em}.katex .fontsize-ensurer.reset-size9.size10,.katex .sizing.reset-size9.size10{font-size:1.20289855em}.katex .fontsize-ensurer.reset-size10.size1,.katex .sizing.reset-size10.size1{font-size:.20080321em}.katex .fontsize-ensurer.reset-size10.size2,.katex .sizing.reset-size10.size2{font-size:.2811245em}.katex .fontsize-ensurer.reset-size10.size3,.katex .sizing.reset-size10.size3{font-size:.32128514em}.katex .fontsize-ensurer.reset-size10.size4,.katex .sizing.reset-size10.size4{font-size:.36144578em}.katex .fontsize-ensurer.reset-size10.size5,.katex .sizing.reset-size10.size5{font-size:.40160643em}.katex .fontsize-ensurer.reset-size10.size6,.katex .sizing.reset-size10.size6{font-size:.48192771em}.katex .fontsize-ensurer.reset-size10.size7,.katex .sizing.reset-size10.size7{font-size:.57831325em}.katex .fontsize-ensurer.reset-size10.size8,.katex .sizing.reset-size10.size8{font-size:.69477912em}.katex .fontsize-ensurer.reset-size10.size9,.katex .sizing.reset-size10.size9{font-size:.8313253em}.katex .fontsize-ensurer.reset-size10.size10,.katex .sizing.reset-size10.size10{font-size:1em}.katex .delimsizing.size1{font-family:KaTeX_Size1}.katex .delimsizing.size2{font-family:KaTeX_Size2}.katex .delimsizing.size3{font-family:KaTeX_Size3}.katex .delimsizing.size4{font-family:KaTeX_Size4}.katex .delimsizing.mult .delim-size1>span{font-family:KaTeX_Size1}.katex .delimsizing.mult .delim-size4>span{font-family:KaTeX_Size4}.katex .nulldelimiter{display:inline-block;width:.12em}.katex .op-symbol{position:relative}.katex .op-symbol.small-op{font-family:KaTeX_Size1}.katex .op-symbol.large-op{font-family:KaTeX_Size2}.katex .accent>.vlist>span,.katex .op-limits>.vlist>span{text-align:center}.katex .accent .accent-body>span{width:0}.katex .accent .accent-body.accent-vec>span{position:relative;left:.326em}.katex .mtable .vertical-separator{display:inline-block;margin:0 -.025em;border-right:.05em solid #000}.katex .mtable .arraycolsep{display:inline-block}.katex .mtable .col-align-c>.vlist{text-align:center}.katex .mtable .col-align-l>.vlist{text-align:left}.katex .mtable .col-align-r>.vlist{text-align:right} \ No newline at end of file +.katex-display{display:block;margin:1em 0;text-align:center}.katex-display>.katex{display:inline-block;text-align:initial}.katex{font:400 1.21em KaTeX_Main;line-height:1.2;white-space:nowrap;text-indent:0}.katex .katex-html{display:inline-block}.katex .katex-mathml{position:absolute;clip:rect(1px,1px,1px,1px);padding:0;border:0;height:1px;width:1px;overflow:hidden}.katex .base,.katex .strut{display:inline-block}.katex .mathit{font-family:KaTeX_Math;font-style:italic}.katex .mathbf{font-family:KaTeX_Main;font-weight:700}.katex .amsrm,.katex .mathbb{font-family:KaTeX_AMS}.katex .mathcal{font-family:KaTeX_Caligraphic}.katex .mathfrak{font-family:KaTeX_Fraktur}.katex .mathtt{font-family:KaTeX_Typewriter}.katex .mathscr{font-family:KaTeX_Script}.katex .mathsf{font-family:KaTeX_SansSerif}.katex .mainit{font-family:KaTeX_Main;font-style:italic}.katex .textstyle>.mord+.mop{margin-left:.16667em}.katex .textstyle>.mord+.mbin{margin-left:.22222em}.katex .textstyle>.mord+.mrel{margin-left:.27778em}.katex .textstyle>.mop+.mop,.katex .textstyle>.mop+.mord,.katex .textstyle>.mord+.minner{margin-left:.16667em}.katex .textstyle>.mop+.mrel{margin-left:.27778em}.katex .textstyle>.mop+.minner{margin-left:.16667em}.katex .textstyle>.mbin+.minner,.katex .textstyle>.mbin+.mop,.katex .textstyle>.mbin+.mopen,.katex .textstyle>.mbin+.mord{margin-left:.22222em}.katex .textstyle>.mrel+.minner,.katex .textstyle>.mrel+.mop,.katex .textstyle>.mrel+.mopen,.katex .textstyle>.mrel+.mord{margin-left:.27778em}.katex .textstyle>.mclose+.mop{margin-left:.16667em}.katex .textstyle>.mclose+.mbin{margin-left:.22222em}.katex .textstyle>.mclose+.mrel{margin-left:.27778em}.katex .textstyle>.mclose+.minner,.katex .textstyle>.minner+.mop,.katex .textstyle>.minner+.mord,.katex .textstyle>.mpunct+.mclose,.katex .textstyle>.mpunct+.minner,.katex .textstyle>.mpunct+.mop,.katex .textstyle>.mpunct+.mopen,.katex .textstyle>.mpunct+.mord,.katex .textstyle>.mpunct+.mpunct,.katex .textstyle>.mpunct+.mrel{margin-left:.16667em}.katex .textstyle>.minner+.mbin{margin-left:.22222em}.katex .textstyle>.minner+.mrel{margin-left:.27778em}.katex .mclose+.mop,.katex .minner+.mop,.katex .mop+.mop,.katex .mop+.mord,.katex .mord+.mop,.katex .textstyle>.minner+.minner,.katex .textstyle>.minner+.mopen,.katex .textstyle>.minner+.mpunct{margin-left:.16667em}.katex .reset-textstyle.textstyle{font-size:1em}.katex .reset-textstyle.scriptstyle{font-size:.7em}.katex .reset-textstyle.scriptscriptstyle{font-size:.5em}.katex .reset-scriptstyle.textstyle{font-size:1.42857em}.katex .reset-scriptstyle.scriptstyle{font-size:1em}.katex .reset-scriptstyle.scriptscriptstyle{font-size:.71429em}.katex .reset-scriptscriptstyle.textstyle{font-size:2em}.katex .reset-scriptscriptstyle.scriptstyle{font-size:1.4em}.katex .reset-scriptscriptstyle.scriptscriptstyle{font-size:1em}.katex .style-wrap{position:relative}.katex .vlist{display:inline-block}.katex .vlist>span{display:block;height:0;position:relative}.katex .vlist>span>span{display:inline-block}.katex .vlist .baseline-fix{display:inline-table;table-layout:fixed}.katex .msupsub{text-align:left}.katex .mfrac>span>span{text-align:center}.katex .mfrac .frac-line{width:100%}.katex .mfrac .frac-line:before{border-bottom-style:solid;border-bottom-width:1px;content:"";display:block}.katex .mfrac .frac-line:after{border-bottom-style:solid;border-bottom-width:.04em;content:"";display:block;margin-top:-1px}.katex .mspace{display:inline-block}.katex .mspace.negativethinspace{margin-left:-.16667em}.katex .mspace.thinspace{width:.16667em}.katex .mspace.mediumspace{width:.22222em}.katex .mspace.thickspace{width:.27778em}.katex .mspace.enspace{width:.5em}.katex .mspace.quad{width:1em}.katex .mspace.qquad{width:2em}.katex .llap,.katex .rlap{width:0;position:relative}.katex .llap>.inner,.katex .rlap>.inner{position:absolute}.katex .llap>.fix,.katex .rlap>.fix{display:inline-block}.katex .llap>.inner{right:0}.katex .rlap>.inner{left:0}.katex .katex-logo .a{font-size:.75em;margin-left:-.32em;position:relative;top:-.2em}.katex .katex-logo .t{margin-left:-.23em}.katex .katex-logo .e{margin-left:-.1667em;position:relative;top:.2155em}.katex .katex-logo .x{margin-left:-.125em}.katex .rule{display:inline-block;border:0 solid;position:relative}.katex .overline .overline-line,.katex .underline .underline-line{width:100%}.katex .overline .overline-line:before,.katex .underline .underline-line:before{border-bottom-style:solid;border-bottom-width:1px;content:"";display:block}.katex .overline .overline-line:after,.katex .underline .underline-line:after{border-bottom-style:solid;border-bottom-width:.04em;content:"";display:block;margin-top:-1px}.katex .sqrt>.sqrt-sign{position:relative}.katex .sqrt .sqrt-line{width:100%}.katex .sqrt .sqrt-line:before{border-bottom-style:solid;border-bottom-width:1px;content:"";display:block}.katex .sqrt .sqrt-line:after{border-bottom-style:solid;border-bottom-width:.04em;content:"";display:block;margin-top:-1px}.katex .sqrt>.root{margin-left:.27777778em;margin-right:-.55555556em}.katex .fontsize-ensurer,.katex .sizing{display:inline-block}.katex .fontsize-ensurer.reset-size1.size1,.katex .sizing.reset-size1.size1{font-size:1em}.katex .fontsize-ensurer.reset-size1.size2,.katex .sizing.reset-size1.size2{font-size:1.4em}.katex .fontsize-ensurer.reset-size1.size3,.katex .sizing.reset-size1.size3{font-size:1.6em}.katex .fontsize-ensurer.reset-size1.size4,.katex .sizing.reset-size1.size4{font-size:1.8em}.katex .fontsize-ensurer.reset-size1.size5,.katex .sizing.reset-size1.size5{font-size:2em}.katex .fontsize-ensurer.reset-size1.size6,.katex .sizing.reset-size1.size6{font-size:2.4em}.katex .fontsize-ensurer.reset-size1.size7,.katex .sizing.reset-size1.size7{font-size:2.88em}.katex .fontsize-ensurer.reset-size1.size8,.katex .sizing.reset-size1.size8{font-size:3.46em}.katex .fontsize-ensurer.reset-size1.size9,.katex .sizing.reset-size1.size9{font-size:4.14em}.katex .fontsize-ensurer.reset-size1.size10,.katex .sizing.reset-size1.size10{font-size:4.98em}.katex .fontsize-ensurer.reset-size2.size1,.katex .sizing.reset-size2.size1{font-size:.71428571em}.katex .fontsize-ensurer.reset-size2.size2,.katex .sizing.reset-size2.size2{font-size:1em}.katex .fontsize-ensurer.reset-size2.size3,.katex .sizing.reset-size2.size3{font-size:1.14285714em}.katex .fontsize-ensurer.reset-size2.size4,.katex .sizing.reset-size2.size4{font-size:1.28571429em}.katex .fontsize-ensurer.reset-size2.size5,.katex .sizing.reset-size2.size5{font-size:1.42857143em}.katex .fontsize-ensurer.reset-size2.size6,.katex .sizing.reset-size2.size6{font-size:1.71428571em}.katex .fontsize-ensurer.reset-size2.size7,.katex .sizing.reset-size2.size7{font-size:2.05714286em}.katex .fontsize-ensurer.reset-size2.size8,.katex .sizing.reset-size2.size8{font-size:2.47142857em}.katex .fontsize-ensurer.reset-size2.size9,.katex .sizing.reset-size2.size9{font-size:2.95714286em}.katex .fontsize-ensurer.reset-size2.size10,.katex .sizing.reset-size2.size10{font-size:3.55714286em}.katex .fontsize-ensurer.reset-size3.size1,.katex .sizing.reset-size3.size1{font-size:.625em}.katex .fontsize-ensurer.reset-size3.size2,.katex .sizing.reset-size3.size2{font-size:.875em}.katex .fontsize-ensurer.reset-size3.size3,.katex .sizing.reset-size3.size3{font-size:1em}.katex .fontsize-ensurer.reset-size3.size4,.katex .sizing.reset-size3.size4{font-size:1.125em}.katex .fontsize-ensurer.reset-size3.size5,.katex .sizing.reset-size3.size5{font-size:1.25em}.katex .fontsize-ensurer.reset-size3.size6,.katex .sizing.reset-size3.size6{font-size:1.5em}.katex .fontsize-ensurer.reset-size3.size7,.katex .sizing.reset-size3.size7{font-size:1.8em}.katex .fontsize-ensurer.reset-size3.size8,.katex .sizing.reset-size3.size8{font-size:2.1625em}.katex .fontsize-ensurer.reset-size3.size9,.katex .sizing.reset-size3.size9{font-size:2.5875em}.katex .fontsize-ensurer.reset-size3.size10,.katex .sizing.reset-size3.size10{font-size:3.1125em}.katex .fontsize-ensurer.reset-size4.size1,.katex .sizing.reset-size4.size1{font-size:.55555556em}.katex .fontsize-ensurer.reset-size4.size2,.katex .sizing.reset-size4.size2{font-size:.77777778em}.katex .fontsize-ensurer.reset-size4.size3,.katex .sizing.reset-size4.size3{font-size:.88888889em}.katex .fontsize-ensurer.reset-size4.size4,.katex .sizing.reset-size4.size4{font-size:1em}.katex .fontsize-ensurer.reset-size4.size5,.katex .sizing.reset-size4.size5{font-size:1.11111111em}.katex .fontsize-ensurer.reset-size4.size6,.katex .sizing.reset-size4.size6{font-size:1.33333333em}.katex .fontsize-ensurer.reset-size4.size7,.katex .sizing.reset-size4.size7{font-size:1.6em}.katex .fontsize-ensurer.reset-size4.size8,.katex .sizing.reset-size4.size8{font-size:1.92222222em}.katex .fontsize-ensurer.reset-size4.size9,.katex .sizing.reset-size4.size9{font-size:2.3em}.katex .fontsize-ensurer.reset-size4.size10,.katex .sizing.reset-size4.size10{font-size:2.76666667em}.katex .fontsize-ensurer.reset-size5.size1,.katex .sizing.reset-size5.size1{font-size:.5em}.katex .fontsize-ensurer.reset-size5.size2,.katex .sizing.reset-size5.size2{font-size:.7em}.katex .fontsize-ensurer.reset-size5.size3,.katex .sizing.reset-size5.size3{font-size:.8em}.katex .fontsize-ensurer.reset-size5.size4,.katex .sizing.reset-size5.size4{font-size:.9em}.katex .fontsize-ensurer.reset-size5.size5,.katex .sizing.reset-size5.size5{font-size:1em}.katex .fontsize-ensurer.reset-size5.size6,.katex .sizing.reset-size5.size6{font-size:1.2em}.katex .fontsize-ensurer.reset-size5.size7,.katex .sizing.reset-size5.size7{font-size:1.44em}.katex .fontsize-ensurer.reset-size5.size8,.katex .sizing.reset-size5.size8{font-size:1.73em}.katex .fontsize-ensurer.reset-size5.size9,.katex .sizing.reset-size5.size9{font-size:2.07em}.katex .fontsize-ensurer.reset-size5.size10,.katex .sizing.reset-size5.size10{font-size:2.49em}.katex .fontsize-ensurer.reset-size6.size1,.katex .sizing.reset-size6.size1{font-size:.41666667em}.katex .fontsize-ensurer.reset-size6.size2,.katex .sizing.reset-size6.size2{font-size:.58333333em}.katex .fontsize-ensurer.reset-size6.size3,.katex .sizing.reset-size6.size3{font-size:.66666667em}.katex .fontsize-ensurer.reset-size6.size4,.katex .sizing.reset-size6.size4{font-size:.75em}.katex .fontsize-ensurer.reset-size6.size5,.katex .sizing.reset-size6.size5{font-size:.83333333em}.katex .fontsize-ensurer.reset-size6.size6,.katex .sizing.reset-size6.size6{font-size:1em}.katex .fontsize-ensurer.reset-size6.size7,.katex .sizing.reset-size6.size7{font-size:1.2em}.katex .fontsize-ensurer.reset-size6.size8,.katex .sizing.reset-size6.size8{font-size:1.44166667em}.katex .fontsize-ensurer.reset-size6.size9,.katex .sizing.reset-size6.size9{font-size:1.725em}.katex .fontsize-ensurer.reset-size6.size10,.katex .sizing.reset-size6.size10{font-size:2.075em}.katex .fontsize-ensurer.reset-size7.size1,.katex .sizing.reset-size7.size1{font-size:.34722222em}.katex .fontsize-ensurer.reset-size7.size2,.katex .sizing.reset-size7.size2{font-size:.48611111em}.katex .fontsize-ensurer.reset-size7.size3,.katex .sizing.reset-size7.size3{font-size:.55555556em}.katex .fontsize-ensurer.reset-size7.size4,.katex .sizing.reset-size7.size4{font-size:.625em}.katex .fontsize-ensurer.reset-size7.size5,.katex .sizing.reset-size7.size5{font-size:.69444444em}.katex .fontsize-ensurer.reset-size7.size6,.katex .sizing.reset-size7.size6{font-size:.83333333em}.katex .fontsize-ensurer.reset-size7.size7,.katex .sizing.reset-size7.size7{font-size:1em}.katex .fontsize-ensurer.reset-size7.size8,.katex .sizing.reset-size7.size8{font-size:1.20138889em}.katex .fontsize-ensurer.reset-size7.size9,.katex .sizing.reset-size7.size9{font-size:1.4375em}.katex .fontsize-ensurer.reset-size7.size10,.katex .sizing.reset-size7.size10{font-size:1.72916667em}.katex .fontsize-ensurer.reset-size8.size1,.katex .sizing.reset-size8.size1{font-size:.28901734em}.katex .fontsize-ensurer.reset-size8.size2,.katex .sizing.reset-size8.size2{font-size:.40462428em}.katex .fontsize-ensurer.reset-size8.size3,.katex .sizing.reset-size8.size3{font-size:.46242775em}.katex .fontsize-ensurer.reset-size8.size4,.katex .sizing.reset-size8.size4{font-size:.52023121em}.katex .fontsize-ensurer.reset-size8.size5,.katex .sizing.reset-size8.size5{font-size:.57803468em}.katex .fontsize-ensurer.reset-size8.size6,.katex .sizing.reset-size8.size6{font-size:.69364162em}.katex .fontsize-ensurer.reset-size8.size7,.katex .sizing.reset-size8.size7{font-size:.83236994em}.katex .fontsize-ensurer.reset-size8.size8,.katex .sizing.reset-size8.size8{font-size:1em}.katex .fontsize-ensurer.reset-size8.size9,.katex .sizing.reset-size8.size9{font-size:1.19653179em}.katex .fontsize-ensurer.reset-size8.size10,.katex .sizing.reset-size8.size10{font-size:1.43930636em}.katex .fontsize-ensurer.reset-size9.size1,.katex .sizing.reset-size9.size1{font-size:.24154589em}.katex .fontsize-ensurer.reset-size9.size2,.katex .sizing.reset-size9.size2{font-size:.33816425em}.katex .fontsize-ensurer.reset-size9.size3,.katex .sizing.reset-size9.size3{font-size:.38647343em}.katex .fontsize-ensurer.reset-size9.size4,.katex .sizing.reset-size9.size4{font-size:.43478261em}.katex .fontsize-ensurer.reset-size9.size5,.katex .sizing.reset-size9.size5{font-size:.48309179em}.katex .fontsize-ensurer.reset-size9.size6,.katex .sizing.reset-size9.size6{font-size:.57971014em}.katex .fontsize-ensurer.reset-size9.size7,.katex .sizing.reset-size9.size7{font-size:.69565217em}.katex .fontsize-ensurer.reset-size9.size8,.katex .sizing.reset-size9.size8{font-size:.83574879em}.katex .fontsize-ensurer.reset-size9.size9,.katex .sizing.reset-size9.size9{font-size:1em}.katex .fontsize-ensurer.reset-size9.size10,.katex .sizing.reset-size9.size10{font-size:1.20289855em}.katex .fontsize-ensurer.reset-size10.size1,.katex .sizing.reset-size10.size1{font-size:.20080321em}.katex .fontsize-ensurer.reset-size10.size2,.katex .sizing.reset-size10.size2{font-size:.2811245em}.katex .fontsize-ensurer.reset-size10.size3,.katex .sizing.reset-size10.size3{font-size:.32128514em}.katex .fontsize-ensurer.reset-size10.size4,.katex .sizing.reset-size10.size4{font-size:.36144578em}.katex .fontsize-ensurer.reset-size10.size5,.katex .sizing.reset-size10.size5{font-size:.40160643em}.katex .fontsize-ensurer.reset-size10.size6,.katex .sizing.reset-size10.size6{font-size:.48192771em}.katex .fontsize-ensurer.reset-size10.size7,.katex .sizing.reset-size10.size7{font-size:.57831325em}.katex .fontsize-ensurer.reset-size10.size8,.katex .sizing.reset-size10.size8{font-size:.69477912em}.katex .fontsize-ensurer.reset-size10.size9,.katex .sizing.reset-size10.size9{font-size:.8313253em}.katex .fontsize-ensurer.reset-size10.size10,.katex .sizing.reset-size10.size10{font-size:1em}.katex .delimsizing.size1{font-family:KaTeX_Size1}.katex .delimsizing.size2{font-family:KaTeX_Size2}.katex .delimsizing.size3{font-family:KaTeX_Size3}.katex .delimsizing.size4{font-family:KaTeX_Size4}.katex .delimsizing.mult .delim-size1>span{font-family:KaTeX_Size1}.katex .delimsizing.mult .delim-size4>span{font-family:KaTeX_Size4}.katex .nulldelimiter{display:inline-block;width:.12em}.katex .op-symbol{position:relative}.katex .op-symbol.small-op{font-family:KaTeX_Size1}.katex .op-symbol.large-op{font-family:KaTeX_Size2}.katex .accent>.vlist>span,.katex .op-limits>.vlist>span{text-align:center}.katex .accent .accent-body>span{width:0}.katex .accent .accent-body.accent-vec>span{position:relative;left:.326em}.katex .mtable .vertical-separator{display:inline-block;margin:0 -.025em;border-right:.05em solid #000}.katex .mtable .arraycolsep{display:inline-block}.katex .mtable .col-align-c>.vlist{text-align:center}.katex .mtable .col-align-l>.vlist{text-align:left}.katex .mtable .col-align-r>.vlist{text-align:right} \ No newline at end of file diff --git a/plugins/tiddlywiki/katex/files/tiddlywiki.files b/plugins/tiddlywiki/katex/files/tiddlywiki.files index 1924dbd09..6af3ec967 100644 --- a/plugins/tiddlywiki/katex/files/tiddlywiki.files +++ b/plugins/tiddlywiki/katex/files/tiddlywiki.files @@ -1,126 +1,17 @@ { + "directories": [ + { + "path": "./fonts/", + "filesRegExp": "^.*\\.woff$", + "isTiddlerFile": false, + "fields": { + "title": {"source": "filename", "prefix": "$:/plugins/tiddlywiki/katex/fonts/"}, + "type": "application/font-woff" + } + } + ], "tiddlers": [ { - "file": "fonts/KaTeX_AMS-Regular.woff", - "fields": { - "type": "application/font-woff", - "title": "$:/plugins/tiddlywiki/katex/fonts/KaTeX_AMS-Regular.woff" - } - },{ - "file": "fonts/KaTeX_Caligraphic-Bold.woff", - "fields": { - "type": "application/font-woff", - "title": "$:/plugins/tiddlywiki/katex/fonts/KaTeX_Caligraphic-Bold.woff" - } - },{ - "file": "fonts/KaTeX_Caligraphic-Regular.woff", - "fields": { - "type": "application/font-woff", - "title": "$:/plugins/tiddlywiki/katex/fonts/KaTeX_Caligraphic-Regular.woff" - } - },{ - "file": "fonts/KaTeX_Fraktur-Bold.woff", - "fields": { - "type": "application/font-woff", - "title": "$:/plugins/tiddlywiki/katex/fonts/KaTeX_Fraktur-Bold.woff" - } - },{ - "file": "fonts/KaTeX_Fraktur-Regular.woff", - "fields": { - "type": "application/font-woff", - "title": "$:/plugins/tiddlywiki/katex/fonts/KaTeX_Fraktur-Regular.woff" - } - },{ - "file": "fonts/KaTeX_Main-Bold.woff", - "fields": { - "type": "application/font-woff", - "title": "$:/plugins/tiddlywiki/katex/fonts/KaTeX_Main-Bold.woff" - } - },{ - "file": "fonts/KaTeX_Main-Italic.woff", - "fields": { - "type": "application/font-woff", - "title": "$:/plugins/tiddlywiki/katex/fonts/KaTeX_Main-Italic.woff" - } - },{ - "file": "fonts/KaTeX_Main-Regular.woff", - "fields": { - "type": "application/font-woff", - "title": "$:/plugins/tiddlywiki/katex/fonts/KaTeX_Main-Regular.woff" - } - },{ - "file": "fonts/KaTeX_Math-BoldItalic.woff", - "fields": { - "type": "application/font-woff", - "title": "$:/plugins/tiddlywiki/katex/fonts/KaTeX_Math-BoldItalic.woff" - } - },{ - "file": "fonts/KaTeX_Math-Italic.woff", - "fields": { - "type": "application/font-woff", - "title": "$:/plugins/tiddlywiki/katex/fonts/KaTeX_Math-Italic.woff" - } - },{ - "file": "fonts/KaTeX_Math-Regular.woff", - "fields": { - "type": "application/font-woff", - "title": "$:/plugins/tiddlywiki/katex/fonts/KaTeX_Math-Regular.woff" - } - },{ - "file": "fonts/KaTeX_SansSerif-Bold.woff", - "fields": { - "type": "application/font-woff", - "title": "$:/plugins/tiddlywiki/katex/fonts/KaTeX_SansSerif-Bold.woff" - } - },{ - "file": "fonts/KaTeX_SansSerif-Italic.woff", - "fields": { - "type": "application/font-woff", - "title": "$:/plugins/tiddlywiki/katex/fonts/KaTeX_SansSerif-Italic.woff" - } - },{ - "file": "fonts/KaTeX_SansSerif-Regular.woff", - "fields": { - "type": "application/font-woff", - "title": "$:/plugins/tiddlywiki/katex/fonts/KaTeX_SansSerif-Regular.woff" - } - },{ - "file": "fonts/KaTeX_Script-Regular.woff", - "fields": { - "type": "application/font-woff", - "title": "$:/plugins/tiddlywiki/katex/fonts/KaTeX_Script-Regular.woff" - } - },{ - "file": "fonts/KaTeX_Size1-Regular.woff", - "fields": { - "type": "application/font-woff", - "title": "$:/plugins/tiddlywiki/katex/fonts/KaTeX_Size1-Regular.woff" - } - },{ - "file": "fonts/KaTeX_Size2-Regular.woff", - "fields": { - "type": "application/font-woff", - "title": "$:/plugins/tiddlywiki/katex/fonts/KaTeX_Size2-Regular.woff" - } - },{ - "file": "fonts/KaTeX_Size3-Regular.woff", - "fields": { - "type": "application/font-woff", - "title": "$:/plugins/tiddlywiki/katex/fonts/KaTeX_Size3-Regular.woff" - } - },{ - "file": "fonts/KaTeX_Size4-Regular.woff", - "fields": { - "type": "application/font-woff", - "title": "$:/plugins/tiddlywiki/katex/fonts/KaTeX_Size4-Regular.woff" - } - },{ - "file": "fonts/KaTeX_Typewriter-Regular.woff", - "fields": { - "type": "application/font-woff", - "title": "$:/plugins/tiddlywiki/katex/fonts/KaTeX_Typewriter-Regular.woff" - } - },{ "file": "katex.without-font-face.min.css", "fields": { "type": "text/plain", diff --git a/plugins/tiddlywiki/katex/readme.tid b/plugins/tiddlywiki/katex/readme.tid index 23091ba78..18a9e6714 100644 --- a/plugins/tiddlywiki/katex/readme.tid +++ b/plugins/tiddlywiki/katex/readme.tid @@ -4,6 +4,6 @@ This is a TiddlyWiki plugin for mathematical typesetting based on [[KaTeX from K It is completely self-contained, and doesn't need an Internet connection in order to work. It works both in the browser and under Node.js. -It is currently based on KaTeX version 0.4.3. See https://github.com/Khan/KaTeX/releases for details of releases. +It is currently based on KaTeX version 0.6.0. See https://github.com/Khan/KaTeX/releases for details of releases. [[Source code|https://github.com/Jermolene/TiddlyWiki5/blob/master/plugins/tiddlywiki/katex]] diff --git a/plugins/tiddlywiki/katex/styles.tid b/plugins/tiddlywiki/katex/styles.tid index b1a2180a2..2550aa1de 100644 --- a/plugins/tiddlywiki/katex/styles.tid +++ b/plugins/tiddlywiki/katex/styles.tid @@ -7,6 +7,12 @@ tags: [[$:/tags/Stylesheet]] {{$:/plugins/tiddlywiki/katex/katex.min.css}} +/* Force text-rendering (see https://github.com/Jermolene/TiddlyWiki5/issues/2500) */ + +.katex { + text-rendering: auto; +} + /* Override font URLs */ @font-face { diff --git a/plugins/tiddlywiki/markdown/EditorToolbar/bold.tid b/plugins/tiddlywiki/markdown/EditorToolbar/bold.tid new file mode 100755 index 000000000..74cb4c596 --- /dev/null +++ b/plugins/tiddlywiki/markdown/EditorToolbar/bold.tid @@ -0,0 +1,15 @@ +title: $:/plugins/tiddlywiki/markdown/EditorToolbar/bold +list-after: $:/core/ui/EditorToolbar/bold +tags: $:/tags/EditorToolbar +icon: $:/core/images/bold +caption: {{$:/language/Buttons/Bold/Caption}} (Markdown) +description: {{$:/language/Buttons/Bold/Hint}} +condition: [type[text/x-markdown]] +shortcuts: ((bold)) + +<$action-sendmessage + $message="tm-edit-text-operation" + $param="wrap-selection" + prefix="**" + suffix="**" +/> diff --git a/plugins/tiddlywiki/markdown/EditorToolbar/heading-1.tid b/plugins/tiddlywiki/markdown/EditorToolbar/heading-1.tid new file mode 100755 index 000000000..c51bfaccc --- /dev/null +++ b/plugins/tiddlywiki/markdown/EditorToolbar/heading-1.tid @@ -0,0 +1,15 @@ +title: $:/plugins/tiddlywiki/markdown/EditorToolbar/heading-1 +list-after: $:/core/ui/EditorToolbar/heading-1 +tags: $:/tags/EditorToolbar +icon: $:/core/images/heading-1 +caption: {{$:/language/Buttons/Heading1/Caption}} (Markdown) +description: {{$:/language/Buttons/Heading1/Hint}} +condition: [type[text/x-markdown]] +shortcuts: ((heading-1)) + +<$action-sendmessage + $message="tm-edit-text-operation" + $param="prefix-lines" + character="#" + count="1" +/> diff --git a/plugins/tiddlywiki/markdown/EditorToolbar/heading-2.tid b/plugins/tiddlywiki/markdown/EditorToolbar/heading-2.tid new file mode 100755 index 000000000..8a5a86a1c --- /dev/null +++ b/plugins/tiddlywiki/markdown/EditorToolbar/heading-2.tid @@ -0,0 +1,15 @@ +title: $:/plugins/tiddlywiki/markdown/EditorToolbar/heading-2 +list-after: $:/core/ui/EditorToolbar/heading-2 +tags: $:/tags/EditorToolbar +icon: $:/core/images/heading-2 +caption: {{$:/language/Buttons/Heading2/Caption}} (Markdown) +description: {{$:/language/Buttons/Heading2/Hint}} +condition: [type[text/x-markdown]] +shortcuts: ((heading-2)) + +<$action-sendmessage + $message="tm-edit-text-operation" + $param="prefix-lines" + character="#" + count="2" +/> diff --git a/plugins/tiddlywiki/markdown/EditorToolbar/heading-3.tid b/plugins/tiddlywiki/markdown/EditorToolbar/heading-3.tid new file mode 100755 index 000000000..2c1c24034 --- /dev/null +++ b/plugins/tiddlywiki/markdown/EditorToolbar/heading-3.tid @@ -0,0 +1,15 @@ +title: $:/plugins/tiddlywiki/markdown/EditorToolbar/heading-3 +list-after: $:/core/ui/EditorToolbar/heading-3 +tags: $:/tags/EditorToolbar +icon: $:/core/images/heading-3 +caption: {{$:/language/Buttons/Heading3/Caption}} (Markdown) +description: {{$:/language/Buttons/Heading3/Hint}} +condition: [type[text/x-markdown]] +shortcuts: ((heading-3)) + +<$action-sendmessage + $message="tm-edit-text-operation" + $param="prefix-lines" + character="#" + count="3" +/> diff --git a/plugins/tiddlywiki/markdown/EditorToolbar/heading-4.tid b/plugins/tiddlywiki/markdown/EditorToolbar/heading-4.tid new file mode 100755 index 000000000..2df2d78f5 --- /dev/null +++ b/plugins/tiddlywiki/markdown/EditorToolbar/heading-4.tid @@ -0,0 +1,15 @@ +title: $:/plugins/tiddlywiki/markdown/EditorToolbar/heading-4 +list-after: $:/core/ui/EditorToolbar/heading-4 +tags: $:/tags/EditorToolbar +icon: $:/core/images/heading-4 +caption: {{$:/language/Buttons/Heading4/Caption}} (Markdown) +description: {{$:/language/Buttons/Heading4/Hint}} +condition: [type[text/x-markdown]] +shortcuts: ((heading-4)) + +<$action-sendmessage + $message="tm-edit-text-operation" + $param="prefix-lines" + character="#" + count="4" +/> diff --git a/plugins/tiddlywiki/markdown/EditorToolbar/heading-5.tid b/plugins/tiddlywiki/markdown/EditorToolbar/heading-5.tid new file mode 100755 index 000000000..e1f9447fe --- /dev/null +++ b/plugins/tiddlywiki/markdown/EditorToolbar/heading-5.tid @@ -0,0 +1,15 @@ +title: $:/plugins/tiddlywiki/markdown/EditorToolbar/heading-5 +list-after: $:/core/ui/EditorToolbar/heading-5 +tags: $:/tags/EditorToolbar +icon: $:/core/images/heading-5 +caption: {{$:/language/Buttons/Heading5/Caption}} (Markdown) +description: {{$:/language/Buttons/Heading5/Hint}} +condition: [type[text/x-markdown]] +shortcuts: ((heading-5)) + +<$action-sendmessage + $message="tm-edit-text-operation" + $param="prefix-lines" + character="#" + count="5" +/> diff --git a/plugins/tiddlywiki/markdown/EditorToolbar/heading-6.tid b/plugins/tiddlywiki/markdown/EditorToolbar/heading-6.tid new file mode 100755 index 000000000..34e598066 --- /dev/null +++ b/plugins/tiddlywiki/markdown/EditorToolbar/heading-6.tid @@ -0,0 +1,15 @@ +title: $:/plugins/tiddlywiki/markdown/EditorToolbar/heading-6 +list-after: $:/core/ui/EditorToolbar/heading-6 +tags: $:/tags/EditorToolbar +icon: $:/core/images/heading-6 +caption: {{$:/language/Buttons/Heading6/Caption}} (Markdown) +description: {{$:/language/Buttons/Heading6/Hint}} +condition: [type[text/x-markdown]] +shortcuts: ((heading-6)) + +<$action-sendmessage + $message="tm-edit-text-operation" + $param="prefix-lines" + character="#" + count="6" +/> diff --git a/plugins/tiddlywiki/markdown/EditorToolbar/italic.tid b/plugins/tiddlywiki/markdown/EditorToolbar/italic.tid new file mode 100755 index 000000000..921898770 --- /dev/null +++ b/plugins/tiddlywiki/markdown/EditorToolbar/italic.tid @@ -0,0 +1,15 @@ +title: $:/plugins/tiddlywiki/markdown/EditorToolbar/italic +list-after: $:/core/ui/EditorToolbar/italic +tags: $:/tags/EditorToolbar +icon: $:/core/images/italic +caption: {{$:/language/Buttons/Italic/Caption}} (Markdown) +description: {{$:/language/Buttons/Italic/Hint}} +condition: [type[text/x-markdown]] +shortcuts: ((italic)) + +<$action-sendmessage + $message="tm-edit-text-operation" + $param="wrap-selection" + prefix="*" + suffix="*" +/> diff --git a/plugins/tiddlywiki/markdown/EditorToolbar/list-bullet.tid b/plugins/tiddlywiki/markdown/EditorToolbar/list-bullet.tid new file mode 100755 index 000000000..166637d03 --- /dev/null +++ b/plugins/tiddlywiki/markdown/EditorToolbar/list-bullet.tid @@ -0,0 +1,15 @@ +title: $:/plugins/tiddlywiki/markdown/EditorToolbar/list-bullet +list-after: $:/core/ui/EditorToolbar/list-bullet +tags: $:/tags/EditorToolbar +icon: $:/core/images/list-bullet +caption: {{$:/language/Buttons/ListBullet/Caption}} (Markdown) +description: {{$:/language/Buttons/ListBullet/Hint}} +condition: [type[text/x-markdown]] +shortcuts: ((list-bullet)) + +<$action-sendmessage + $message="tm-edit-text-operation" + $param="prefix-lines" + character="*" + count="1" +/> diff --git a/plugins/tiddlywiki/markdown/EditorToolbar/list-number.tid b/plugins/tiddlywiki/markdown/EditorToolbar/list-number.tid new file mode 100755 index 000000000..ce185b42f --- /dev/null +++ b/plugins/tiddlywiki/markdown/EditorToolbar/list-number.tid @@ -0,0 +1,15 @@ +title: $:/plugins/tiddlywiki/markdown/EditorToolbar/list-number +list-after: $:/core/ui/EditorToolbar/list-number +tags: $:/tags/EditorToolbar +icon: $:/core/images/list-number +caption: {{$:/language/Buttons/ListNumber/Caption}} (Markdown) +description: {{$:/language/Buttons/ListNumber/Hint}} +condition: [type[text/x-markdown]] +shortcuts: ((list-number)) + +<$action-sendmessage + $message="tm-edit-text-operation" + $param="prefix-lines" + character="1." + count="1" +/> diff --git a/plugins/tiddlywiki/markdown/EditorToolbar/mono-line.tid b/plugins/tiddlywiki/markdown/EditorToolbar/mono-line.tid new file mode 100755 index 000000000..c69145e1e --- /dev/null +++ b/plugins/tiddlywiki/markdown/EditorToolbar/mono-line.tid @@ -0,0 +1,15 @@ +title: $:/plugins/tiddlywiki/markdown/EditorToolbar/mono-line +list-after: $:/core/ui/EditorToolbar/mono-line +tags: $:/tags/EditorToolbar +icon: $:/core/images/mono-line +caption: {{$:/language/Buttons/MonoLine/Caption}} (Markdown) +description: {{$:/language/Buttons/MonoLine/Hint}} +condition: [type[text/x-markdown]] +shortcuts: ((mono-line)) + +<$action-sendmessage + $message="tm-edit-text-operation" + $param="wrap-selection" + prefix="`" + suffix="`" +/> diff --git a/plugins/tiddlywiki/markdown/EditorToolbar/quote.tid b/plugins/tiddlywiki/markdown/EditorToolbar/quote.tid new file mode 100755 index 000000000..1471a77ba --- /dev/null +++ b/plugins/tiddlywiki/markdown/EditorToolbar/quote.tid @@ -0,0 +1,15 @@ +title: $:/plugins/tiddlywiki/markdown/EditorToolbar/quote +list-after: $:/core/ui/EditorToolbar/quote +tags: $:/tags/EditorToolbar +icon: $:/core/images/quote +caption: {{$:/language/Buttons/Quote/Caption}} (Markdown) +description: {{$:/language/Buttons/Quote/Hint}} +condition: [type[text/x-markdown]] +shortcuts: ((quote)) + +<$action-sendmessage + $message="tm-edit-text-operation" + $param="prefix-lines" + character=">" + count="1" +/> diff --git a/plugins/tiddlywiki/markdown/dialect.tid b/plugins/tiddlywiki/markdown/dialect.tid old mode 100644 new mode 100755 diff --git a/plugins/tiddlywiki/markdown/docs_type_markdown.tid b/plugins/tiddlywiki/markdown/docs_type_markdown.tid old mode 100644 new mode 100755 index 0c383e05b..229397ed7 --- a/plugins/tiddlywiki/markdown/docs_type_markdown.tid +++ b/plugins/tiddlywiki/markdown/docs_type_markdown.tid @@ -1,3 +1,4 @@ title: $:/language/Docs/Types/text/x-markdown description: Markdown name: text/x-markdown +group: Text diff --git a/plugins/tiddlywiki/markdown/files/markdown.js b/plugins/tiddlywiki/markdown/files/markdown.js old mode 100644 new mode 100755 diff --git a/plugins/tiddlywiki/markdown/files/tiddlywiki.files b/plugins/tiddlywiki/markdown/files/tiddlywiki.files old mode 100644 new mode 100755 diff --git a/plugins/tiddlywiki/markdown/images/new-markdown-button.tid b/plugins/tiddlywiki/markdown/images/new-markdown-button.tid new file mode 100755 index 000000000..e2d823349 --- /dev/null +++ b/plugins/tiddlywiki/markdown/images/new-markdown-button.tid @@ -0,0 +1,10 @@ +title: $:/plugins/tiddlywiki/markdown/images/new-markdown-button +tags: $:/tags/Image + + + + + + + + \ No newline at end of file diff --git a/plugins/tiddlywiki/markdown/new-markdown.tid b/plugins/tiddlywiki/markdown/new-markdown.tid new file mode 100755 index 000000000..688ea9709 --- /dev/null +++ b/plugins/tiddlywiki/markdown/new-markdown.tid @@ -0,0 +1,15 @@ +title: $:/plugins/tiddlywiki/markdown/new-markdown-button +tags: $:/tags/PageControls +caption: {{$:/plugins/tiddlywiki/markdown/images/new-markdown-button}} {{$:/language/Buttons/NewMarkdown/Caption}} +description: {{$:/language/Buttons/NewMarkdown/Hint}} +list-after: $:/core/ui/Buttons/new-tiddler + +<$button tooltip={{$:/language/Buttons/NewMarkdown/Hint}} aria-label={{$:/language/Buttons/NewMarkdown/Caption}} class=<>> +<$action-sendmessage $message="tm-new-tiddler" type="text/x-markdown"/> +<$list filter="[prefix[yes]]"> +{{$:/plugins/tiddlywiki/markdown/images/new-markdown-button}} + +<$list filter="[prefix[yes]]"> +<$text text={{$:/language/Buttons/NewMarkdown/Caption}}/> + + diff --git a/plugins/tiddlywiki/markdown/plugin.info b/plugins/tiddlywiki/markdown/plugin.info old mode 100644 new mode 100755 diff --git a/plugins/tiddlywiki/markdown/readme.tid b/plugins/tiddlywiki/markdown/readme.tid old mode 100644 new mode 100755 diff --git a/plugins/tiddlywiki/markdown/usage.tid b/plugins/tiddlywiki/markdown/usage.tid old mode 100644 new mode 100755 diff --git a/plugins/tiddlywiki/markdown/wrapper.js b/plugins/tiddlywiki/markdown/wrapper.js old mode 100644 new mode 100755 diff --git a/plugins/tiddlywiki/powered-by-tiddlywiki/banner.tid b/plugins/tiddlywiki/powered-by-tiddlywiki/banner.tid index 52c877caf..f79e265ff 100644 --- a/plugins/tiddlywiki/powered-by-tiddlywiki/banner.tid +++ b/plugins/tiddlywiki/powered-by-tiddlywiki/banner.tid @@ -1,6 +1,6 @@ title: $:/plugins/tiddlywiki/powered-by-tiddlywiki/banner tags: $:/tags/PageTemplate - + [img width="160px" class="tc-powered-by-tiddlywiki-banner" [$:/plugins/tiddlywiki/powered-by-tiddlywiki/powered-by-tiddlywiki.svg]] diff --git a/plugins/tiddlywiki/qrcode/MakeContactQR.tid b/plugins/tiddlywiki/qrcode/MakeContactQR.tid new file mode 100644 index 000000000..5eeb2d231 --- /dev/null +++ b/plugins/tiddlywiki/qrcode/MakeContactQR.tid @@ -0,0 +1,27 @@ +title: $:/plugins/tiddlywiki/qrcode/MakeContactQR +tags: $:/tags/MakeQR +caption: Contact + +\define wifi-url() +WIFI:wifi name;T:WPA;S:SSID;P:password; +\end + +\define image(firstname,lastname,address,tel,email) +>/> +\end + +! Enter the contact details + +First name: <$edit-text tiddler="$:/config/plugins/tiddlywiki/qrcode/contact/firstname" tag="input" default=""/> + +Last name: <$edit-text tiddler="$:/config/plugins/tiddlywiki/qrcode/contact/lastname" tag="input" default=""/> + +Address: <$edit-text tiddler="$:/config/plugins/tiddlywiki/qrcode/contact/address" tag="input" default=""/> + +Telephone: <$edit-text tiddler="$:/config/plugins/tiddlywiki/qrcode/contact/tel" tag="input" default=""/> + +Email: <$edit-text tiddler="$:/config/plugins/tiddlywiki/qrcode/contact/email" tag="input" default=""/> + +! Here is your QR code + +<$macrocall $name="image" firstname={{$:/config/plugins/tiddlywiki/qrcode/contact/firstname}} lastname={{$:/config/plugins/tiddlywiki/qrcode/contact/lastname}} address={{$:/config/plugins/tiddlywiki/qrcode/contact/address}} tel={{$:/config/plugins/tiddlywiki/qrcode/contact/tel}} email={{$:/config/plugins/tiddlywiki/qrcode/contact/email}}/> diff --git a/plugins/tiddlywiki/qrcode/MakeGenericQR.tid b/plugins/tiddlywiki/qrcode/MakeGenericQR.tid new file mode 100644 index 000000000..9f0bcc286 --- /dev/null +++ b/plugins/tiddlywiki/qrcode/MakeGenericQR.tid @@ -0,0 +1,17 @@ +title: $:/plugins/tiddlywiki/qrcode/MakeGenericQR +tags: $:/tags/MakeQR +caption: Generic + +\define image(content) +>/> +\end + +! Enter the details + +You can also use this form to encode URLs. + +<$edit-text tiddler="$:/config/plugins/tiddlywiki/qrcode/generic" default="" class="tc-edit-texteditor"/> + +! Here is your QR code + +<$macrocall $name="image" content={{$:/config/plugins/tiddlywiki/qrcode/generic}}/> diff --git a/plugins/tiddlywiki/qrcode/MakeWifiQR.tid b/plugins/tiddlywiki/qrcode/MakeWifiQR.tid new file mode 100644 index 000000000..1cc7d1bb6 --- /dev/null +++ b/plugins/tiddlywiki/qrcode/MakeWifiQR.tid @@ -0,0 +1,30 @@ +title: $:/plugins/tiddlywiki/qrcode/MakeWifiQR +tags: $:/tags/MakeQR +caption: Wifi + +\define wifi-url() +WIFI:wifi name;T:WPA;S:SSID;P:password; +\end + +\define image(network,encryption,ssid,password) +>/> +\end + +! Enter the details of your wifi network + +Name of wifi network: <$edit-text tiddler="$:/config/plugins/tiddlywiki/qrcode/wifi/network" tag="input" default=""/> + +Encryption: <$select tiddler="$:/config/plugins/tiddlywiki/qrcode/wifi/encryption" default="none"> + + + + + + +SSID: <$edit-text tiddler="$:/config/plugins/tiddlywiki/qrcode/wifi/ssid" tag="input" default=""/> + +Password: <$edit-text tiddler="$:/config/plugins/tiddlywiki/qrcode/wifi/password" tag="input" default=""/> + +! Here is your QR code + +<$macrocall $name="image" network={{$:/config/plugins/tiddlywiki/qrcode/wifi/network}} encryption={{$:/config/plugins/tiddlywiki/qrcode/wifi/encryption}} ssid={{$:/config/plugins/tiddlywiki/qrcode/wifi/ssid}} password={{$:/config/plugins/tiddlywiki/qrcode/wifi/password}}/> diff --git a/plugins/tiddlywiki/qrcode/ViewToolbarButton/Button.tid b/plugins/tiddlywiki/qrcode/ViewToolbarButton/Button.tid new file mode 100644 index 000000000..e83391654 --- /dev/null +++ b/plugins/tiddlywiki/qrcode/ViewToolbarButton/Button.tid @@ -0,0 +1,53 @@ +title: $:/plugins/tiddlywiki/qrcode/ViewToolbarButton +tags: $:/tags/ViewToolbar +caption: {{$:/plugins/tiddlywiki/qrcode/icon}} +short-caption: QR code +description: Generate QR code for this tiddler + + +<$button popup=<> tooltip={{$:/plugins/tiddlywiki/qrcode/ViewToolbarButton!!description}} aria-label={{$:/plugins/tiddlywiki/qrcode/ViewToolbarButton!!short-caption}} class=<> class=<> selectedClass="tc-selected"> +<$list filter="[prefix[yes]]"> +{{$:/plugins/tiddlywiki/qrcode/icon}} + +<$list filter="[prefix[yes]]"> +<$text text={{$:/plugins/tiddlywiki/qrcode/ViewToolbarButton!!short-caption}}/> + + + +<$reveal state=<> type="popup" position="below" animate="yes"> + +
    + +{{$:/plugins/tiddlywiki/qrcode/ViewToolbarButton||description}} + +<$set name="tv-config-toolbar-icons" value="yes"> + +<$set name="tv-config-toolbar-text" value="yes"> + +<$set name="tv-config-toolbar-class" value="tc-btn-invisible"> + +<$set name="targetTiddler" value=<>> + +<$list filter="[all[shadows+tiddlers]tag[$:/tags/ViewToolbarButton/QRcode]!has[draft.of]]"> + +<$button popup=<> class="tc-btn-invisible" selectedClass="tc-selected"> + +<$action-sendmessage $message="tm-modal" $param=<> currentTiddler=<>/> + +<$transclude field="caption" mode="inline"/> + + + + + + + + + + + + + +
    + + diff --git a/plugins/tiddlywiki/qrcode/ViewToolbarButton/Raw.tid b/plugins/tiddlywiki/qrcode/ViewToolbarButton/Raw.tid new file mode 100644 index 000000000..160089407 --- /dev/null +++ b/plugins/tiddlywiki/qrcode/ViewToolbarButton/Raw.tid @@ -0,0 +1,12 @@ +title: $:/plugins/tiddlywiki/qrcode/ViewToolbarButton/Raw +tags: $:/tags/ViewToolbarButton/QRcode +caption: Raw content of this tiddler +subtitle: QR code of raw tiddler content + +\define image() +>/> +\end + +<$set name="content" value={{!!text}}> +<> + diff --git a/plugins/tiddlywiki/qrcode/ViewToolbarButton/Rendered.tid b/plugins/tiddlywiki/qrcode/ViewToolbarButton/Rendered.tid new file mode 100644 index 000000000..c29f45765 --- /dev/null +++ b/plugins/tiddlywiki/qrcode/ViewToolbarButton/Rendered.tid @@ -0,0 +1,12 @@ +title: $:/plugins/tiddlywiki/qrcode/ViewToolbarButton/Rendered +tags: $:/tags/ViewToolbarButton/QRcode +caption: Rendered content of this tiddler +subtitle: QR code of rendered tiddler content + +\define image() +>/> +\end + +<$wikify name="content" text={{!!text}} type="text" mode="block" output="formattedtext"> +<> + diff --git a/plugins/tiddlywiki/qrcode/ViewToolbarButton/URL.tid b/plugins/tiddlywiki/qrcode/ViewToolbarButton/URL.tid new file mode 100644 index 000000000..e05a80e84 --- /dev/null +++ b/plugins/tiddlywiki/qrcode/ViewToolbarButton/URL.tid @@ -0,0 +1,14 @@ +title: $:/plugins/tiddlywiki/qrcode/ViewToolbarButton/URL +tags: $:/tags/ViewToolbarButton/QRcode +caption: URL of this tiddler +subtitle: QR code of URL of this tiddler + +\define image() +>/> +\end + +<$set name="url" value={{$:/info/url/full}}> +<$set name="hash" filter="[encodeuricomponent[]]" select="0"> +<> + + diff --git a/plugins/tiddlywiki/qrcode/ViewToolbarButton/styles.tid b/plugins/tiddlywiki/qrcode/ViewToolbarButton/styles.tid new file mode 100644 index 000000000..6889bff06 --- /dev/null +++ b/plugins/tiddlywiki/qrcode/ViewToolbarButton/styles.tid @@ -0,0 +1,9 @@ +title: $:/plugins/tiddlywiki/qrcode/styles +tags: [[$:/tags/Stylesheet]] + +\rules only filteredtranscludeinline transcludeinline macrodef macrocallinline + +.tc-drop-down .tc-qrcode-drop-down img { + width: 100%; + height: 100%; +} diff --git a/plugins/tiddlywiki/qrcode/doc/examples.tid b/plugins/tiddlywiki/qrcode/doc/examples.tid new file mode 100644 index 000000000..5bd19afa8 --- /dev/null +++ b/plugins/tiddlywiki/qrcode/doc/examples.tid @@ -0,0 +1,3 @@ +title: $:/plugins/tiddlywiki/qrcode/examples + +<> \ No newline at end of file diff --git a/plugins/tiddlywiki/qrcode/doc/readme.tid b/plugins/tiddlywiki/qrcode/doc/readme.tid new file mode 100644 index 000000000..89e2427e6 --- /dev/null +++ b/plugins/tiddlywiki/qrcode/doc/readme.tid @@ -0,0 +1,13 @@ +title: $:/plugins/tiddlywiki/qrcode/readme + +The QR code plugin provides a macro that enables any text to be rendered as a [[QR code|https://en.wikipedia.org/wiki/QR_code]]. QR codes are a type of 2-dimensional bar code that encodes arbitrary data: text, numbers, links. QR code readers are available or built-in for smartphones, making them a convenient means to transfer information between devices + +The QR code plugin adds the following features to TiddlyWiki: + +* A new [[makeqr Macro]] that renders specified text as a QR code image that can be displayed or printed +* A new toolbar button that can display several QR code renderings of the content of a tiddler: +** Raw content +** Rendered, formatted content +** URL of tiddler + +The QR code plugin is based on the library [[qrcode.js by Zeno Zeng|https://github.com/zenozeng/node-yaqrcode]]. \ No newline at end of file diff --git a/plugins/tiddlywiki/qrcode/doc/usage.tid b/plugins/tiddlywiki/qrcode/doc/usage.tid new file mode 100644 index 000000000..fb186c901 --- /dev/null +++ b/plugins/tiddlywiki/qrcode/doc/usage.tid @@ -0,0 +1,44 @@ +title: $:/plugins/tiddlywiki/qrcode/usage + +! `makeqr` Macro + +The <<.def makeqr>> [[macro|Macros]] converts text data into an image of the corresponding QR code. The image is returned as [[base64-encoded data URI|https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs]]. + +!! Parameters + +;text +: The text to encode +;size +: The size of the image in pixels (defaults to 500) +;errorCorrectLevel +: Determines the amount of error correction applied to the image; see below (defaults to "M"). +;fallback +: The fallback image to be returned in case of an error (see below) + +The conversion will fail if the text is too long and/or complex and the macro will return the provided fallback image. If no fallback image is provided then an error image is generated. + +The error correction level is a [[QR code feature|http://www.qrcode.com/en/about/error_correction.html]]: + +<<< +QR Code has error correction capability to restore data if the code is dirty or damaged. ... Level Q or H may be selected for factory environment where QR Code get dirty, whereas Level L may be selected for clean environment with the large amount of data. Typically, Level M (15%) is most frequently selected. +<<< + +!! Examples + +Making a QR code for a simple string of text: + +``` +<> +``` + +Making a QR code for the URL field of the current tiddler: + +``` +<$macrocall $name="makeqr" text={{!!url}}/> +``` + +Making a QR code for the URL of the current wiki: + +``` +<$macrocall $name="makeqr" text={{$:/info/url/full}}/> +``` diff --git a/plugins/tiddlywiki/qrcode/files/LICENSE b/plugins/tiddlywiki/qrcode/files/LICENSE new file mode 100755 index 000000000..3fec150fa --- /dev/null +++ b/plugins/tiddlywiki/qrcode/files/LICENSE @@ -0,0 +1,20 @@ +The MIT License (MIT) + +Copyright (c) 2013 Zeno Zeng + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/plugins/tiddlywiki/qrcode/files/README.md b/plugins/tiddlywiki/qrcode/files/README.md new file mode 100755 index 000000000..8bd65a26b --- /dev/null +++ b/plugins/tiddlywiki/qrcode/files/README.md @@ -0,0 +1,72 @@ +# node-yaqrcode + +Yet another node-qrcode Generator! + +This is a simple and pure javascript wrapper for the QR Code Generator from the d-project. + +No Canvas or Binary needed! + +Note: + +``` +The word 'QR Code' is registered trademark of +DENSO WAVE INCORPORATED +http://www.denso-wave.com/qrcode/faqpatent-e.html +``` + +## Overview + +- Pure Javascript and could work without any requiments + +- Use `RS_BLOCK_TABLE` from http://davidshimjs.github.io/qrcodejs/ to support typeNumber 40 + +- Use the code from http://davidshimjs.github.io/qrcodejs/ to support UTF-8 + +- Return a Base64 Data URI like this + +``` +data:image/gif;base64,R0lGODdhggCCAIAAAAAAAP///ywAAAAAggCCAAAC/4yPqcvtD6OctNqLs968+w+G4kiW5omm6sq27gvHEUDXto3gCc3wgQ+8+QxCYq13/AGMQ6WwOHk+c0kq0oh13qg6naK71HKl1Vn4ukuSy01ksC1WOoLWBnx+XsDB6zr+nccUdndAVxiYRgFouAYl2ETolcY3WAlYB0WIlmnZCLl16Ib42JlFiQmqqdfJmJpnKEgaq+UYt/eKKysXxVqp+5k1y7kIKowIHErry/tbunvrl9z3vCzVjAqm2GuqthwNrZxNTUocTC0uoXp5yGnePlnMXr2daDdqjzdLPj8GKy9pjBvAXWjSeeI3LmErbgwVIlwYbgovTw0hWnyIsWLGiP+1QKzTxxHhmIZ/cKli8THOPogjE5ZsSYLYQGyu1lFkpvJfr5lmVt4TWNPZTYMgm1nb4M9fQIJMl2osmlOptDLa3HmTR7KprVwObyGL5KzqVFFfuqFTZu6bWZMSwVr4em8gpaSuCm79dNTtxKu60rqsVwvvzng0xfEkqzXwMb5TJQn2qTdvWDNgIwc9BW8YW8FwgZ6Eh7is0aBlJXPezLXV4QqqF9tc3LIc1mRW92XV0Lq0UNizZYNE5rmbX4OY7Z496hNq8NXT3pLG1xv16eKAyZTsSFm4TtFou1t+DNohqr576cql9467Y6pbs7b+DAG7e+1Ah3tfCz+kVOc8zV//fS3Ka6v109ZPqww4VnW2RbXbeRflplV8hEEHjkyTCcieYbs5xVo8/pEnlWKmcSUhckh5+B9+qbnGhnUMEicRB2fV92Jj9DwV0YKYzbiXXxiqZcx6Gmm241r2SbgUeOAQuJyLQ6JXIG4bMsWjV9od1CKNRNJ3gW/3EWiiknXpJBtwOWHgZXr6ZRndcQW6CVOXb0o34XoiuqjXNQdOVuJzkLEIJp08WjXoXQZyF42WUYr3wIMsImgXkvXQpONG+XT1KHtEdfhOiFCKeWRmU+qZEowa+vgpW7fZUySTmIoFIG2yxmbkKoRmGGOEk+IUK6qIUTfedqKaGWlPZDpJJW+6/5lIq4WByofTn0LOqutQ4c3VorXOrfqhsIohKitLCu6aX7AVquotiuDW9lewQHK6qJ3oevreorfiCCmr8WY7L2MaTmPmqecc2iiy97ab45mvHuvquaEuW2e/qGqm3oW5qonjphbKG+h8WLJb5mDNGbsxvx3/hSVdwTU5MowHq9nquKdVHHCK+dLaLJcxm4sazSSiPGGfC667J9GeBhkxwLm6nDDRuhntb4NJ47l0weCW7POdYaobHciaRhuuyLyNbO23XSerXIdDh0Spru4a+nS6Zm/bNNs2Pgx0qQxiS2x2OMPdXcNXRt1ygnHyJzHg2FHM6LNf00sw4p952WTb0//yHbnbciJI+cCX16ootE6rndjgDpqsOcelK5qonBPPczqo+v7Ns8onniyutCn+FpeKra8tVqXcHuR130gbXzfTnx9eo5uMbzK414jzfnCcvSbM3JS2l+v5YGhexqaVK89ut8bgcy+42eJ3/1L5YDtvsfoqPr9n7GzSzSF1Wx8/53W4zl0eqr3rSZYjXNTad7P6CTBstVtR7tqzq7glsE+O6tSYsHW1MY3PdlISmNJI5TtyaZB9QKPbtFp3LmfZiHHT4dcEq9O3Jd2tbliDYHIY1oHvoIhZZ8ua9wAXNxn1bm2F41Bhfgis2XzvZajLmA1JGKsRiYl73VKdE+H0JQj/SrFfVDSY3SojkmRd5Fe4ol4A7VcogTFxVUjz2e8ykEJlheeGl9Lbx5SYw7GVsWjHmhzsMrU19PEqhKGhlhpLd702jgBD6tjj32JYq/Ul8I5q+dEM9yMqqFhwdAHy4hQtliSC0Q+EnLQVheLnJ1OiUGxxlODXitVA3L1ydTD0JJ+ASLILXsyR97nJ8uS2wC6C8E4ZxBz9/FOyB9ZRl3q7YvSEpadbARBWzLylM8Wltd318WfUPKR9UjIiRVZyj50znzerhcoi2bFnMguasYwzJ9F1r5EyrBfGwFbM881ShYWU3prw1skt5tOHvrqWO1cpz4DGU47niaYhCQmdk8lgHKIUrahFL4rRjGp0oxztqEc/CtKQinSkJD1AAQAAOw== +``` + +## Usage + +``` +npm install yaqrcode +``` + +```javascript +qrcode = require('yaqrcode'); +base64 = qrcode('hello world'); +``` + +### custom size + +```javascript +qrcode = require('yaqrcode'); +base64 = qrcode('hello world', { + size: 500 +}); +``` + +## License + +The MIT License (MIT) + +Copyright (c) 2013,2015 Zeno Zeng + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/plugins/tiddlywiki/qrcode/files/qrcode.js b/plugins/tiddlywiki/qrcode/files/qrcode.js new file mode 100755 index 000000000..60c978ee6 --- /dev/null +++ b/plugins/tiddlywiki/qrcode/files/qrcode.js @@ -0,0 +1,1587 @@ +//--------------------------------------------------------------------- +// +// QR Code Generator for JavaScript +// +// Copyright (c) 2009 Kazuhiko Arase +// +// URL: http://www.d-project.com/ +// +// Licensed under the MIT license: +// http://www.opensource.org/licenses/mit-license.php +// +// The word 'QR Code' is registered trademark of +// DENSO WAVE INCORPORATED +// http://www.denso-wave.com/qrcode/faqpatent-e.html +// +//--------------------------------------------------------------------- + +//--------------------------------------------------------------------- +// qrcode +//--------------------------------------------------------------------- + +/** + * qrcode + * @param typeNumber 1 to 40 + * @param errorCorrectLevel 'L','M','Q','H' + */ +var qrcode = function(typeNumber, errorCorrectLevel) { + + var PAD0 = 0xEC; + var PAD1 = 0x11; + + var _typeNumber = typeNumber; + var _errorCorrectLevel = QRErrorCorrectLevel[errorCorrectLevel]; + var _modules = null; + var _moduleCount = 0; + var _dataCache = null; + var _dataList = new Array(); + + var _this = {}; + + var makeImpl = function(test, maskPattern) { + + _moduleCount = _typeNumber * 4 + 17; + _modules = function(moduleCount) { + var modules = new Array(moduleCount); + for (var row = 0; row < moduleCount; row += 1) { + modules[row] = new Array(moduleCount); + for (var col = 0; col < moduleCount; col += 1) { + modules[row][col] = null; + } + } + return modules; + }(_moduleCount); + + setupPositionProbePattern(0, 0); + setupPositionProbePattern(_moduleCount - 7, 0); + setupPositionProbePattern(0, _moduleCount - 7); + setupPositionAdjustPattern(); + setupTimingPattern(); + setupTypeInfo(test, maskPattern); + + if (_typeNumber >= 7) { + setupTypeNumber(test); + } + + if (_dataCache == null) { + _dataCache = createData(_typeNumber, _errorCorrectLevel, _dataList); + } + + mapData(_dataCache, maskPattern); + }; + + var setupPositionProbePattern = function(row, col) { + + for (var r = -1; r <= 7; r += 1) { + + if (row + r <= -1 || _moduleCount <= row + r) continue; + + for (var c = -1; c <= 7; c += 1) { + + if (col + c <= -1 || _moduleCount <= col + c) continue; + + if ( (0 <= r && r <= 6 && (c == 0 || c == 6) ) + || (0 <= c && c <= 6 && (r == 0 || r == 6) ) + || (2 <= r && r <= 4 && 2 <= c && c <= 4) ) { + _modules[row + r][col + c] = true; + } else { + _modules[row + r][col + c] = false; + } + } + } + }; + + var getBestMaskPattern = function() { + + var minLostPoint = 0; + var pattern = 0; + + for (var i = 0; i < 8; i += 1) { + + makeImpl(true, i); + + var lostPoint = QRUtil.getLostPoint(_this); + + if (i == 0 || minLostPoint > lostPoint) { + minLostPoint = lostPoint; + pattern = i; + } + } + + return pattern; + }; + + var setupTimingPattern = function() { + + for (var r = 8; r < _moduleCount - 8; r += 1) { + if (_modules[r][6] != null) { + continue; + } + _modules[r][6] = (r % 2 == 0); + } + + for (var c = 8; c < _moduleCount - 8; c += 1) { + if (_modules[6][c] != null) { + continue; + } + _modules[6][c] = (c % 2 == 0); + } + }; + + var setupPositionAdjustPattern = function() { + + var pos = QRUtil.getPatternPosition(_typeNumber); + + for (var i = 0; i < pos.length; i += 1) { + + for (var j = 0; j < pos.length; j += 1) { + + var row = pos[i]; + var col = pos[j]; + + if (_modules[row][col] != null) { + continue; + } + + for (var r = -2; r <= 2; r += 1) { + + for (var c = -2; c <= 2; c += 1) { + + if (r == -2 || r == 2 || c == -2 || c == 2 + || (r == 0 && c == 0) ) { + _modules[row + r][col + c] = true; + } else { + _modules[row + r][col + c] = false; + } + } + } + } + } + }; + + var setupTypeNumber = function(test) { + + var bits = QRUtil.getBCHTypeNumber(_typeNumber); + + for (var i = 0; i < 18; i += 1) { + var mod = (!test && ( (bits >> i) & 1) == 1); + _modules[Math.floor(i / 3)][i % 3 + _moduleCount - 8 - 3] = mod; + } + + for (var i = 0; i < 18; i += 1) { + var mod = (!test && ( (bits >> i) & 1) == 1); + _modules[i % 3 + _moduleCount - 8 - 3][Math.floor(i / 3)] = mod; + } + }; + + var setupTypeInfo = function(test, maskPattern) { + + var data = (_errorCorrectLevel << 3) | maskPattern; + var bits = QRUtil.getBCHTypeInfo(data); + + // vertical + for (var i = 0; i < 15; i += 1) { + + var mod = (!test && ( (bits >> i) & 1) == 1); + + if (i < 6) { + _modules[i][8] = mod; + } else if (i < 8) { + _modules[i + 1][8] = mod; + } else { + _modules[_moduleCount - 15 + i][8] = mod; + } + } + + // horizontal + for (var i = 0; i < 15; i += 1) { + + var mod = (!test && ( (bits >> i) & 1) == 1); + + if (i < 8) { + _modules[8][_moduleCount - i - 1] = mod; + } else if (i < 9) { + _modules[8][15 - i - 1 + 1] = mod; + } else { + _modules[8][15 - i - 1] = mod; + } + } + + // fixed module + _modules[_moduleCount - 8][8] = (!test); + }; + + var mapData = function(data, maskPattern) { + + var inc = -1; + var row = _moduleCount - 1; + var bitIndex = 7; + var byteIndex = 0; + var maskFunc = QRUtil.getMaskFunction(maskPattern); + + for (var col = _moduleCount - 1; col > 0; col -= 2) { + + if (col == 6) col -= 1; + + while (true) { + + for (var c = 0; c < 2; c += 1) { + + if (_modules[row][col - c] == null) { + + var dark = false; + + if (byteIndex < data.length) { + dark = ( ( (data[byteIndex] >>> bitIndex) & 1) == 1); + } + + var mask = maskFunc(row, col - c); + + if (mask) { + dark = !dark; + } + + _modules[row][col - c] = dark; + bitIndex -= 1; + + if (bitIndex == -1) { + byteIndex += 1; + bitIndex = 7; + } + } + } + + row += inc; + + if (row < 0 || _moduleCount <= row) { + row -= inc; + inc = -inc; + break; + } + } + } + }; + + var createBytes = function(buffer, rsBlocks) { + + var offset = 0; + + var maxDcCount = 0; + var maxEcCount = 0; + + var dcdata = new Array(rsBlocks.length); + var ecdata = new Array(rsBlocks.length); + + for (var r = 0; r < rsBlocks.length; r += 1) { + + var dcCount = rsBlocks[r].dataCount; + var ecCount = rsBlocks[r].totalCount - dcCount; + + maxDcCount = Math.max(maxDcCount, dcCount); + maxEcCount = Math.max(maxEcCount, ecCount); + + dcdata[r] = new Array(dcCount); + + for (var i = 0; i < dcdata[r].length; i += 1) { + dcdata[r][i] = 0xff & buffer.getBuffer()[i + offset]; + } + offset += dcCount; + + var rsPoly = QRUtil.getErrorCorrectPolynomial(ecCount); + var rawPoly = qrPolynomial(dcdata[r], rsPoly.getLength() - 1); + + var modPoly = rawPoly.mod(rsPoly); + ecdata[r] = new Array(rsPoly.getLength() - 1); + for (var i = 0; i < ecdata[r].length; i += 1) { + var modIndex = i + modPoly.getLength() - ecdata[r].length; + ecdata[r][i] = (modIndex >= 0)? modPoly.getAt(modIndex) : 0; + } + } + + var totalCodeCount = 0; + for (var i = 0; i < rsBlocks.length; i += 1) { + totalCodeCount += rsBlocks[i].totalCount; + } + + var data = new Array(totalCodeCount); + var index = 0; + + for (var i = 0; i < maxDcCount; i += 1) { + for (var r = 0; r < rsBlocks.length; r += 1) { + if (i < dcdata[r].length) { + data[index] = dcdata[r][i]; + index += 1; + } + } + } + + for (var i = 0; i < maxEcCount; i += 1) { + for (var r = 0; r < rsBlocks.length; r += 1) { + if (i < ecdata[r].length) { + data[index] = ecdata[r][i]; + index += 1; + } + } + } + + return data; + }; + + var createData = function(typeNumber, errorCorrectLevel, dataList) { + + var rsBlocks = QRRSBlock.getRSBlocks(typeNumber, errorCorrectLevel); + + var buffer = qrBitBuffer(); + + for (var i = 0; i < dataList.length; i += 1) { + var data = dataList[i]; + buffer.put(data.getMode(), 4); + buffer.put(data.getLength(), QRUtil.getLengthInBits(data.getMode(), typeNumber) ); + data.write(buffer); + } + + // calc num max data. + var totalDataCount = 0; + for (var i = 0; i < rsBlocks.length; i += 1) { + totalDataCount += rsBlocks[i].dataCount; + } + + if (buffer.getLengthInBits() > totalDataCount * 8) { + throw new Error('code length overflow. (' + + buffer.getLengthInBits() + + '>' + + totalDataCount * 8 + + ')'); + } + + // end code + if (buffer.getLengthInBits() + 4 <= totalDataCount * 8) { + buffer.put(0, 4); + } + + // padding + while (buffer.getLengthInBits() % 8 != 0) { + buffer.putBit(false); + } + + // padding + while (true) { + + if (buffer.getLengthInBits() >= totalDataCount * 8) { + break; + } + buffer.put(PAD0, 8); + + if (buffer.getLengthInBits() >= totalDataCount * 8) { + break; + } + buffer.put(PAD1, 8); + } + + return createBytes(buffer, rsBlocks); + }; + + _this.addData = function(data) { + var newData = qr8BitByte(data); + _dataList.push(newData); + _dataCache = null; + }; + + _this.isDark = function(row, col) { + if (row < 0 || _moduleCount <= row || col < 0 || _moduleCount <= col) { + throw new Error(row + ',' + col); + } + return _modules[row][col]; + }; + + _this.getModuleCount = function() { + return _moduleCount; + }; + + _this.make = function() { + makeImpl(false, getBestMaskPattern() ); + }; + + _this.createTableTag = function(cellSize, margin) { + + cellSize = cellSize || 2; + margin = (typeof margin == 'undefined')? cellSize * 4 : margin; + + var qrHtml = ''; + + qrHtml += ''; + qrHtml += ''; + + for (var r = 0; r < _this.getModuleCount(); r += 1) { + + qrHtml += ''; + + for (var c = 0; c < _this.getModuleCount(); c += 1) { + qrHtml += ''; + } + + qrHtml += ''; + qrHtml += '
    '; + } + + qrHtml += '
    '; + + return qrHtml; + }; + + _this.createImgTag = function(cellSize, margin, size) { + + cellSize = cellSize || 2; + margin = (typeof margin == 'undefined')? cellSize * 4 : margin; + + var min = margin; + var max = _this.getModuleCount() * cellSize + margin; + + return createImgTag(size, size, function(x, y) { + if (min <= x && x < max && min <= y && y < max) { + var c = Math.floor( (x - min) / cellSize); + var r = Math.floor( (y - min) / cellSize); + return _this.isDark(r, c)? 0 : 1; + } else { + return 1; + } + } ); + }; + + return _this; +}; + +//--------------------------------------------------------------------- +// qrcode.stringToBytes +//--------------------------------------------------------------------- + +qrcode.stringToBytes = function(s) { + var bytes = new Array(); + for (var i = 0; i < s.length; i += 1) { + var c = s.charCodeAt(i); + bytes.push(c & 0xff); + } + return bytes; +}; + +//--------------------------------------------------------------------- +// qrcode.createStringToBytes +//--------------------------------------------------------------------- + +/** + * @param unicodeData base64 string of byte array. + * [16bit Unicode],[16bit Bytes], ... + * @param numChars + */ +qrcode.createStringToBytes = function(unicodeData, numChars) { + + // create conversion map. + + var unicodeMap = function() { + + var bin = base64DecodeInputStream(unicodeData); + var read = function() { + var b = bin.read(); + if (b == -1) throw new Error(); + return b; + }; + + var count = 0; + var unicodeMap = {}; + while (true) { + var b0 = bin.read(); + if (b0 == -1) break; + var b1 = read(); + var b2 = read(); + var b3 = read(); + var k = String.fromCharCode( (b0 << 8) | b1); + var v = (b2 << 8) | b3; + unicodeMap[k] = v; + count += 1; + } + if (count != numChars) { + throw new Error(count + ' != ' + numChars); + } + + return unicodeMap; + }(); + + var unknownChar = '?'.charCodeAt(0); + + return function(s) { + var bytes = new Array(); + for (var i = 0; i < s.length; i += 1) { + var c = s.charCodeAt(i); + if (c < 128) { + bytes.push(c); + } else { + var b = unicodeMap[s.charAt(i)]; + if (typeof b == 'number') { + if ( (b & 0xff) == b) { + // 1byte + bytes.push(b); + } else { + // 2bytes + bytes.push(b >>> 8); + bytes.push(b & 0xff); + } + } else { + bytes.push(unknownChar); + } + } + } + return bytes; + }; +}; + +//--------------------------------------------------------------------- +// QRMode +//--------------------------------------------------------------------- + +var QRMode = { + MODE_NUMBER : 1 << 0, + MODE_ALPHA_NUM : 1 << 1, + MODE_8BIT_BYTE : 1 << 2, + MODE_KANJI : 1 << 3 +}; + +//--------------------------------------------------------------------- +// QRErrorCorrectLevel +//--------------------------------------------------------------------- + +var QRErrorCorrectLevel = { + L : 1, + M : 0, + Q : 3, + H : 2 +}; + +//--------------------------------------------------------------------- +// QRMaskPattern +//--------------------------------------------------------------------- + +var QRMaskPattern = { + PATTERN000 : 0, + PATTERN001 : 1, + PATTERN010 : 2, + PATTERN011 : 3, + PATTERN100 : 4, + PATTERN101 : 5, + PATTERN110 : 6, + PATTERN111 : 7 +}; + +//--------------------------------------------------------------------- +// QRUtil +//--------------------------------------------------------------------- + +var QRUtil = function() { + + var PATTERN_POSITION_TABLE = [ + [], + [6, 18], + [6, 22], + [6, 26], + [6, 30], + [6, 34], + [6, 22, 38], + [6, 24, 42], + [6, 26, 46], + [6, 28, 50], + [6, 30, 54], + [6, 32, 58], + [6, 34, 62], + [6, 26, 46, 66], + [6, 26, 48, 70], + [6, 26, 50, 74], + [6, 30, 54, 78], + [6, 30, 56, 82], + [6, 30, 58, 86], + [6, 34, 62, 90], + [6, 28, 50, 72, 94], + [6, 26, 50, 74, 98], + [6, 30, 54, 78, 102], + [6, 28, 54, 80, 106], + [6, 32, 58, 84, 110], + [6, 30, 58, 86, 114], + [6, 34, 62, 90, 118], + [6, 26, 50, 74, 98, 122], + [6, 30, 54, 78, 102, 126], + [6, 26, 52, 78, 104, 130], + [6, 30, 56, 82, 108, 134], + [6, 34, 60, 86, 112, 138], + [6, 30, 58, 86, 114, 142], + [6, 34, 62, 90, 118, 146], + [6, 30, 54, 78, 102, 126, 150], + [6, 24, 50, 76, 102, 128, 154], + [6, 28, 54, 80, 106, 132, 158], + [6, 32, 58, 84, 110, 136, 162], + [6, 26, 54, 82, 110, 138, 166], + [6, 30, 58, 86, 114, 142, 170] + ]; + var G15 = (1 << 10) | (1 << 8) | (1 << 5) | (1 << 4) | (1 << 2) | (1 << 1) | (1 << 0); + var G18 = (1 << 12) | (1 << 11) | (1 << 10) | (1 << 9) | (1 << 8) | (1 << 5) | (1 << 2) | (1 << 0); + var G15_MASK = (1 << 14) | (1 << 12) | (1 << 10) | (1 << 4) | (1 << 1); + + var _this = {}; + + var getBCHDigit = function(data) { + var digit = 0; + while (data != 0) { + digit += 1; + data >>>= 1; + } + return digit; + }; + + _this.getBCHTypeInfo = function(data) { + var d = data << 10; + while (getBCHDigit(d) - getBCHDigit(G15) >= 0) { + d ^= (G15 << (getBCHDigit(d) - getBCHDigit(G15) ) ); + } + return ( (data << 10) | d) ^ G15_MASK; + }; + + _this.getBCHTypeNumber = function(data) { + var d = data << 12; + while (getBCHDigit(d) - getBCHDigit(G18) >= 0) { + d ^= (G18 << (getBCHDigit(d) - getBCHDigit(G18) ) ); + } + return (data << 12) | d; + }; + + _this.getPatternPosition = function(typeNumber) { + return PATTERN_POSITION_TABLE[typeNumber - 1]; + }; + + _this.getMaskFunction = function(maskPattern) { + + switch (maskPattern) { + + case QRMaskPattern.PATTERN000 : + return function(i, j) { return (i + j) % 2 == 0; }; + case QRMaskPattern.PATTERN001 : + return function(i, j) { return i % 2 == 0; }; + case QRMaskPattern.PATTERN010 : + return function(i, j) { return j % 3 == 0; }; + case QRMaskPattern.PATTERN011 : + return function(i, j) { return (i + j) % 3 == 0; }; + case QRMaskPattern.PATTERN100 : + return function(i, j) { return (Math.floor(i / 2) + Math.floor(j / 3) ) % 2 == 0; }; + case QRMaskPattern.PATTERN101 : + return function(i, j) { return (i * j) % 2 + (i * j) % 3 == 0; }; + case QRMaskPattern.PATTERN110 : + return function(i, j) { return ( (i * j) % 2 + (i * j) % 3) % 2 == 0; }; + case QRMaskPattern.PATTERN111 : + return function(i, j) { return ( (i * j) % 3 + (i + j) % 2) % 2 == 0; }; + + default : + throw new Error('bad maskPattern:' + maskPattern); + } + }; + + _this.getErrorCorrectPolynomial = function(errorCorrectLength) { + var a = qrPolynomial([1], 0); + for (var i = 0; i < errorCorrectLength; i += 1) { + a = a.multiply(qrPolynomial([1, QRMath.gexp(i)], 0) ); + } + return a; + }; + + _this.getLengthInBits = function(mode, type) { + + if (1 <= type && type < 10) { + + // 1 - 9 + + switch(mode) { + case QRMode.MODE_NUMBER : return 10; + case QRMode.MODE_ALPHA_NUM : return 9; + case QRMode.MODE_8BIT_BYTE : return 8; + case QRMode.MODE_KANJI : return 8; + default : + throw new Error('mode:' + mode); + } + + } else if (type < 27) { + + // 10 - 26 + + switch(mode) { + case QRMode.MODE_NUMBER : return 12; + case QRMode.MODE_ALPHA_NUM : return 11; + case QRMode.MODE_8BIT_BYTE : return 16; + case QRMode.MODE_KANJI : return 10; + default : + throw new Error('mode:' + mode); + } + + } else if (type < 41) { + + // 27 - 40 + + switch(mode) { + case QRMode.MODE_NUMBER : return 14; + case QRMode.MODE_ALPHA_NUM : return 13; + case QRMode.MODE_8BIT_BYTE : return 16; + case QRMode.MODE_KANJI : return 12; + default : + throw new Error('mode:' + mode); + } + + } else { + throw new Error('type:' + type); + } + }; + + _this.getLostPoint = function(qrcode) { + + var moduleCount = qrcode.getModuleCount(); + + var lostPoint = 0; + + // LEVEL1 + + for (var row = 0; row < moduleCount; row += 1) { + for (var col = 0; col < moduleCount; col += 1) { + + var sameCount = 0; + var dark = qrcode.isDark(row, col); + + for (var r = -1; r <= 1; r += 1) { + + if (row + r < 0 || moduleCount <= row + r) { + continue; + } + + for (var c = -1; c <= 1; c += 1) { + + if (col + c < 0 || moduleCount <= col + c) { + continue; + } + + if (r == 0 && c == 0) { + continue; + } + + if (dark == qrcode.isDark(row + r, col + c) ) { + sameCount += 1; + } + } + } + + if (sameCount > 5) { + lostPoint += (3 + sameCount - 5); + } + } + }; + + // LEVEL2 + + for (var row = 0; row < moduleCount - 1; row += 1) { + for (var col = 0; col < moduleCount - 1; col += 1) { + var count = 0; + if (qrcode.isDark(row, col) ) count += 1; + if (qrcode.isDark(row + 1, col) ) count += 1; + if (qrcode.isDark(row, col + 1) ) count += 1; + if (qrcode.isDark(row + 1, col + 1) ) count += 1; + if (count == 0 || count == 4) { + lostPoint += 3; + } + } + } + + // LEVEL3 + + for (var row = 0; row < moduleCount; row += 1) { + for (var col = 0; col < moduleCount - 6; col += 1) { + if (qrcode.isDark(row, col) + && !qrcode.isDark(row, col + 1) + && qrcode.isDark(row, col + 2) + && qrcode.isDark(row, col + 3) + && qrcode.isDark(row, col + 4) + && !qrcode.isDark(row, col + 5) + && qrcode.isDark(row, col + 6) ) { + lostPoint += 40; + } + } + } + + for (var col = 0; col < moduleCount; col += 1) { + for (var row = 0; row < moduleCount - 6; row += 1) { + if (qrcode.isDark(row, col) + && !qrcode.isDark(row + 1, col) + && qrcode.isDark(row + 2, col) + && qrcode.isDark(row + 3, col) + && qrcode.isDark(row + 4, col) + && !qrcode.isDark(row + 5, col) + && qrcode.isDark(row + 6, col) ) { + lostPoint += 40; + } + } + } + + // LEVEL4 + + var darkCount = 0; + + for (var col = 0; col < moduleCount; col += 1) { + for (var row = 0; row < moduleCount; row += 1) { + if (qrcode.isDark(row, col) ) { + darkCount += 1; + } + } + } + + var ratio = Math.abs(100 * darkCount / moduleCount / moduleCount - 50) / 5; + lostPoint += ratio * 10; + + return lostPoint; + }; + + return _this; +}(); + +//--------------------------------------------------------------------- +// QRMath +//--------------------------------------------------------------------- + +var QRMath = function() { + + var EXP_TABLE = new Array(256); + var LOG_TABLE = new Array(256); + + // initialize tables + for (var i = 0; i < 8; i += 1) { + EXP_TABLE[i] = 1 << i; + } + for (var i = 8; i < 256; i += 1) { + EXP_TABLE[i] = EXP_TABLE[i - 4] + ^ EXP_TABLE[i - 5] + ^ EXP_TABLE[i - 6] + ^ EXP_TABLE[i - 8]; + } + for (var i = 0; i < 255; i += 1) { + LOG_TABLE[EXP_TABLE[i] ] = i; + } + + var _this = {}; + + _this.glog = function(n) { + + if (n < 1) { + throw new Error('glog(' + n + ')'); + } + + return LOG_TABLE[n]; + }; + + _this.gexp = function(n) { + + while (n < 0) { + n += 255; + } + + while (n >= 256) { + n -= 255; + } + + return EXP_TABLE[n]; + }; + + return _this; +}(); + +//--------------------------------------------------------------------- +// qrPolynomial +//--------------------------------------------------------------------- + +function qrPolynomial(num, shift) { + + if (typeof num.length == 'undefined') { + throw new Error(num.length + '/' + shift); + } + + var _num = function() { + var offset = 0; + while (offset < num.length && num[offset] == 0) { + offset += 1; + } + var _num = new Array(num.length - offset + shift); + for (var i = 0; i < num.length - offset; i += 1) { + _num[i] = num[i + offset]; + } + return _num; + }(); + + var _this = {}; + + _this.getAt = function(index) { + return _num[index]; + }; + + _this.getLength = function() { + return _num.length; + }; + + _this.multiply = function(e) { + + var num = new Array(_this.getLength() + e.getLength() - 1); + + for (var i = 0; i < _this.getLength(); i += 1) { + for (var j = 0; j < e.getLength(); j += 1) { + num[i + j] ^= QRMath.gexp(QRMath.glog(_this.getAt(i) ) + QRMath.glog(e.getAt(j) ) ); + } + } + + return qrPolynomial(num, 0); + }; + + _this.mod = function(e) { + + if (_this.getLength() - e.getLength() < 0) { + return _this; + } + + var ratio = QRMath.glog(_this.getAt(0) ) - QRMath.glog(e.getAt(0) ); + + var num = new Array(_this.getLength() ); + for (var i = 0; i < _this.getLength(); i += 1) { + num[i] = _this.getAt(i); + } + + for (var i = 0; i < e.getLength(); i += 1) { + num[i] ^= QRMath.gexp(QRMath.glog(e.getAt(i) ) + ratio); + } + + // recursive call + return qrPolynomial(num, 0).mod(e); + }; + + return _this; +}; + +//--------------------------------------------------------------------- +// QRRSBlock +//--------------------------------------------------------------------- + +var QRRSBlock = function() { + + + // [1: [L, M, Q, H], ..] + var RS_BLOCK_TABLE=[[1,26,19],[1,26,16],[1,26,13],[1,26,9],[1,44,34],[1,44,28],[1,44,22],[1,44,16],[1,70,55],[1,70,44],[2,35,17],[2,35,13],[1,100,80],[2,50,32],[2,50,24],[4,25,9],[1,134,108],[2,67,43],[2,33,15,2,34,16],[2,33,11,2,34,12],[2,86,68],[4,43,27],[4,43,19],[4,43,15],[2,98,78],[4,49,31],[2,32,14,4,33,15],[4,39,13,1,40,14],[2,121,97],[2,60,38,2,61,39],[4,40,18,2,41,19],[4,40,14,2,41,15],[2,146,116],[3,58,36,2,59,37],[4,36,16,4,37,17],[4,36,12,4,37,13],[2,86,68,2,87,69],[4,69,43,1,70,44],[6,43,19,2,44,20],[6,43,15,2,44,16],[4,101,81],[1,80,50,4,81,51],[4,50,22,4,51,23],[3,36,12,8,37,13],[2,116,92,2,117,93],[6,58,36,2,59,37],[4,46,20,6,47,21],[7,42,14,4,43,15],[4,133,107],[8,59,37,1,60,38],[8,44,20,4,45,21],[12,33,11,4,34,12],[3,145,115,1,146,116],[4,64,40,5,65,41],[11,36,16,5,37,17],[11,36,12,5,37,13],[5,109,87,1,110,88],[5,65,41,5,66,42],[5,54,24,7,55,25],[11,36,12],[5,122,98,1,123,99],[7,73,45,3,74,46],[15,43,19,2,44,20],[3,45,15,13,46,16],[1,135,107,5,136,108],[10,74,46,1,75,47],[1,50,22,15,51,23],[2,42,14,17,43,15],[5,150,120,1,151,121],[9,69,43,4,70,44],[17,50,22,1,51,23],[2,42,14,19,43,15],[3,141,113,4,142,114],[3,70,44,11,71,45],[17,47,21,4,48,22],[9,39,13,16,40,14],[3,135,107,5,136,108],[3,67,41,13,68,42],[15,54,24,5,55,25],[15,43,15,10,44,16],[4,144,116,4,145,117],[17,68,42],[17,50,22,6,51,23],[19,46,16,6,47,17],[2,139,111,7,140,112],[17,74,46],[7,54,24,16,55,25],[34,37,13],[4,151,121,5,152,122],[4,75,47,14,76,48],[11,54,24,14,55,25],[16,45,15,14,46,16],[6,147,117,4,148,118],[6,73,45,14,74,46],[11,54,24,16,55,25],[30,46,16,2,47,17],[8,132,106,4,133,107],[8,75,47,13,76,48],[7,54,24,22,55,25],[22,45,15,13,46,16],[10,142,114,2,143,115],[19,74,46,4,75,47],[28,50,22,6,51,23],[33,46,16,4,47,17],[8,152,122,4,153,123],[22,73,45,3,74,46],[8,53,23,26,54,24],[12,45,15,28,46,16],[3,147,117,10,148,118],[3,73,45,23,74,46],[4,54,24,31,55,25],[11,45,15,31,46,16],[7,146,116,7,147,117],[21,73,45,7,74,46],[1,53,23,37,54,24],[19,45,15,26,46,16],[5,145,115,10,146,116],[19,75,47,10,76,48],[15,54,24,25,55,25],[23,45,15,25,46,16],[13,145,115,3,146,116],[2,74,46,29,75,47],[42,54,24,1,55,25],[23,45,15,28,46,16],[17,145,115],[10,74,46,23,75,47],[10,54,24,35,55,25],[19,45,15,35,46,16],[17,145,115,1,146,116],[14,74,46,21,75,47],[29,54,24,19,55,25],[11,45,15,46,46,16],[13,145,115,6,146,116],[14,74,46,23,75,47],[44,54,24,7,55,25],[59,46,16,1,47,17],[12,151,121,7,152,122],[12,75,47,26,76,48],[39,54,24,14,55,25],[22,45,15,41,46,16],[6,151,121,14,152,122],[6,75,47,34,76,48],[46,54,24,10,55,25],[2,45,15,64,46,16],[17,152,122,4,153,123],[29,74,46,14,75,47],[49,54,24,10,55,25],[24,45,15,46,46,16],[4,152,122,18,153,123],[13,74,46,32,75,47],[48,54,24,14,55,25],[42,45,15,32,46,16],[20,147,117,4,148,118],[40,75,47,7,76,48],[43,54,24,22,55,25],[10,45,15,67,46,16],[19,148,118,6,149,119],[18,75,47,31,76,48],[34,54,24,34,55,25],[20,45,15,61,46,16]]; + + var qrRSBlock = function(totalCount, dataCount) { + var _this = {}; + _this.totalCount = totalCount; + _this.dataCount = dataCount; + return _this; + }; + + var _this = {}; + + var getRsBlockTable = function(typeNumber, errorCorrectLevel) { + + switch(errorCorrectLevel) { + case QRErrorCorrectLevel.L : + return RS_BLOCK_TABLE[(typeNumber - 1) * 4 + 0]; + case QRErrorCorrectLevel.M : + return RS_BLOCK_TABLE[(typeNumber - 1) * 4 + 1]; + case QRErrorCorrectLevel.Q : + return RS_BLOCK_TABLE[(typeNumber - 1) * 4 + 2]; + case QRErrorCorrectLevel.H : + return RS_BLOCK_TABLE[(typeNumber - 1) * 4 + 3]; + default : + return undefined; + } + }; + + _this.getRSBlocks = function(typeNumber, errorCorrectLevel) { + + var rsBlock = getRsBlockTable(typeNumber, errorCorrectLevel); + + if (typeof rsBlock == 'undefined') { + throw new Error('bad rs block @ typeNumber:' + typeNumber + + '/errorCorrectLevel:' + errorCorrectLevel); + } + + var length = rsBlock.length / 3; + + var list = new Array(); + + for (var i = 0; i < length; i += 1) { + + var count = rsBlock[i * 3 + 0]; + var totalCount = rsBlock[i * 3 + 1]; + var dataCount = rsBlock[i * 3 + 2]; + + for (var j = 0; j < count; j += 1) { + list.push(qrRSBlock(totalCount, dataCount) ); + } + } + + return list; + }; + + return _this; +}(); + +//--------------------------------------------------------------------- +// qrBitBuffer +//--------------------------------------------------------------------- + +var qrBitBuffer = function() { + + var _buffer = new Array(); + var _length = 0; + + var _this = {}; + + _this.getBuffer = function() { + return _buffer; + }; + + _this.getAt = function(index) { + var bufIndex = Math.floor(index / 8); + return ( (_buffer[bufIndex] >>> (7 - index % 8) ) & 1) == 1; + }; + + _this.put = function(num, length) { + for (var i = 0; i < length; i += 1) { + _this.putBit( ( (num >>> (length - i - 1) ) & 1) == 1); + } + }; + + _this.getLengthInBits = function() { + return _length; + }; + + _this.putBit = function(bit) { + + var bufIndex = Math.floor(_length / 8); + if (_buffer.length <= bufIndex) { + _buffer.push(0); + } + + if (bit) { + _buffer[bufIndex] |= (0x80 >>> (_length % 8) ); + } + + _length += 1; + }; + + return _this; +}; + +//--------------------------------------------------------------------- +// qr8BitByte +//--------------------------------------------------------------------- + +var qr8BitByte = function(data) { + + var _mode = QRMode.MODE_8BIT_BYTE; + var _data = data; + var _parsedData = []; + + var _this = {}; + + + // Added to support UTF-8 Characters + for (var i = 0, l = _data.length; i < l; i++) { + var byteArray = []; + var code = _data.charCodeAt(i); + + if (code > 0x10000) { + byteArray[0] = 0xF0 | ((code & 0x1C0000) >>> 18); + byteArray[1] = 0x80 | ((code & 0x3F000) >>> 12); + byteArray[2] = 0x80 | ((code & 0xFC0) >>> 6); + byteArray[3] = 0x80 | (code & 0x3F); + } else if (code > 0x800) { + byteArray[0] = 0xE0 | ((code & 0xF000) >>> 12); + byteArray[1] = 0x80 | ((code & 0xFC0) >>> 6); + byteArray[2] = 0x80 | (code & 0x3F); + } else if (code > 0x80) { + byteArray[0] = 0xC0 | ((code & 0x7C0) >>> 6); + byteArray[1] = 0x80 | (code & 0x3F); + } else { + byteArray[0] = code; + } + + // Fix Unicode corruption bug + _parsedData.push(byteArray); + } + + _parsedData = Array.prototype.concat.apply([], _parsedData); + + if (_parsedData.length != _data.length) { + _parsedData.unshift(191); + _parsedData.unshift(187); + _parsedData.unshift(239); + } + + var _bytes = _parsedData; + + _this.getMode = function() { + return _mode; + }; + + _this.getLength = function(buffer) { + return _bytes.length; + }; + + _this.write = function(buffer) { + for (var i = 0; i < _bytes.length; i += 1) { + buffer.put(_bytes[i], 8); + } + }; + + return _this; +}; + +//===================================================================== +// GIF Support etc. +// + +//--------------------------------------------------------------------- +// byteArrayOutputStream +//--------------------------------------------------------------------- + +var byteArrayOutputStream = function() { + + var _bytes = new Array(); + + var _this = {}; + + _this.writeByte = function(b) { + _bytes.push(b & 0xff); + }; + + _this.writeShort = function(i) { + _this.writeByte(i); + _this.writeByte(i >>> 8); + }; + + _this.writeBytes = function(b, off, len) { + off = off || 0; + len = len || b.length; + for (var i = 0; i < len; i += 1) { + _this.writeByte(b[i + off]); + } + }; + + _this.writeString = function(s) { + for (var i = 0; i < s.length; i += 1) { + _this.writeByte(s.charCodeAt(i) ); + } + }; + + _this.toByteArray = function() { + return _bytes; + }; + + _this.toString = function() { + var s = ''; + s += '['; + for (var i = 0; i < _bytes.length; i += 1) { + if (i > 0) { + s += ','; + } + s += _bytes[i]; + } + s += ']'; + return s; + }; + + return _this; +}; + +//--------------------------------------------------------------------- +// base64EncodeOutputStream +//--------------------------------------------------------------------- + +var base64EncodeOutputStream = function() { + + var _buffer = 0; + var _buflen = 0; + var _length = 0; + var _base64 = ''; + + var _this = {}; + + var writeEncoded = function(b) { + _base64 += String.fromCharCode(encode(b & 0x3f) ); + }; + + var encode = function(n) { + if (n < 0) { + // error. + } else if (n < 26) { + return 0x41 + n; + } else if (n < 52) { + return 0x61 + (n - 26); + } else if (n < 62) { + return 0x30 + (n - 52); + } else if (n == 62) { + return 0x2b; + } else if (n == 63) { + return 0x2f; + } + throw new Error('n:' + n); + }; + + _this.writeByte = function(n) { + + _buffer = (_buffer << 8) | (n & 0xff); + _buflen += 8; + _length += 1; + + while (_buflen >= 6) { + writeEncoded(_buffer >>> (_buflen - 6) ); + _buflen -= 6; + } + }; + + _this.flush = function() { + + if (_buflen > 0) { + writeEncoded(_buffer << (6 - _buflen) ); + _buffer = 0; + _buflen = 0; + } + + if (_length % 3 != 0) { + // padding + var padlen = 3 - _length % 3; + for (var i = 0; i < padlen; i += 1) { + _base64 += '='; + } + } + }; + + _this.toString = function() { + return _base64; + }; + + return _this; +}; + +//--------------------------------------------------------------------- +// base64DecodeInputStream +//--------------------------------------------------------------------- + +var base64DecodeInputStream = function(str) { + + var _str = str; + var _pos = 0; + var _buffer = 0; + var _buflen = 0; + + var _this = {}; + + _this.read = function() { + + while (_buflen < 8) { + + if (_pos >= _str.length) { + if (_buflen == 0) { + return -1; + } + throw new Error('unexpected end of file./' + _buflen); + } + + var c = _str.charAt(_pos); + _pos += 1; + + if (c == '=') { + _buflen = 0; + return -1; + } else if (c.match(/^\s$/) ) { + // ignore if whitespace. + continue; + } + + _buffer = (_buffer << 6) | decode(c.charCodeAt(0) ); + _buflen += 6; + } + + var n = (_buffer >>> (_buflen - 8) ) & 0xff; + _buflen -= 8; + return n; + }; + + var decode = function(c) { + if (0x41 <= c && c <= 0x5a) { + return c - 0x41; + } else if (0x61 <= c && c <= 0x7a) { + return c - 0x61 + 26; + } else if (0x30 <= c && c <= 0x39) { + return c - 0x30 + 52; + } else if (c == 0x2b) { + return 62; + } else if (c == 0x2f) { + return 63; + } else { + throw new Error('c:' + c); + } + }; + + return _this; +}; + +//--------------------------------------------------------------------- +// gifImage (B/W) +//--------------------------------------------------------------------- + +var gifImage = function(width, height) { + + var _width = width; + var _height = height; + var _data = new Array(width * height); + + var _this = {}; + + _this.setPixel = function(x, y, pixel) { + _data[y * _width + x] = pixel; + }; + + _this.write = function(out) { + + //--------------------------------- + // GIF Signature + + out.writeString('GIF87a'); + + //--------------------------------- + // Screen Descriptor + + out.writeShort(_width); + out.writeShort(_height); + + out.writeByte(0x80); // 2bit + out.writeByte(0); + out.writeByte(0); + + //--------------------------------- + // Global Color Map + + // black + out.writeByte(0x00); + out.writeByte(0x00); + out.writeByte(0x00); + + // white + out.writeByte(0xff); + out.writeByte(0xff); + out.writeByte(0xff); + + //--------------------------------- + // Image Descriptor + + out.writeString(','); + out.writeShort(0); + out.writeShort(0); + out.writeShort(_width); + out.writeShort(_height); + out.writeByte(0); + + //--------------------------------- + // Local Color Map + + //--------------------------------- + // Raster Data + + var lzwMinCodeSize = 2; + var raster = getLZWRaster(lzwMinCodeSize); + + out.writeByte(lzwMinCodeSize); + + var offset = 0; + + while (raster.length - offset > 255) { + out.writeByte(255); + out.writeBytes(raster, offset, 255); + offset += 255; + } + + out.writeByte(raster.length - offset); + out.writeBytes(raster, offset, raster.length - offset); + out.writeByte(0x00); + + //--------------------------------- + // GIF Terminator + out.writeString(';'); + }; + + var bitOutputStream = function(out) { + + var _out = out; + var _bitLength = 0; + var _bitBuffer = 0; + + var _this = {}; + + _this.write = function(data, length) { + + if ( (data >>> length) != 0) { + throw new Error('length over'); + } + + while (_bitLength + length >= 8) { + _out.writeByte(0xff & ( (data << _bitLength) | _bitBuffer) ); + length -= (8 - _bitLength); + data >>>= (8 - _bitLength); + _bitBuffer = 0; + _bitLength = 0; + } + + _bitBuffer = (data << _bitLength) | _bitBuffer; + _bitLength = _bitLength + length; + }; + + _this.flush = function() { + if (_bitLength > 0) { + _out.writeByte(_bitBuffer); + } + }; + + return _this; + }; + + var getLZWRaster = function(lzwMinCodeSize) { + + var clearCode = 1 << lzwMinCodeSize; + var endCode = (1 << lzwMinCodeSize) + 1; + var bitLength = lzwMinCodeSize + 1; + + // Setup LZWTable + var table = lzwTable(); + + for (var i = 0; i < clearCode; i += 1) { + table.add(String.fromCharCode(i) ); + } + table.add(String.fromCharCode(clearCode) ); + table.add(String.fromCharCode(endCode) ); + + var byteOut = byteArrayOutputStream(); + var bitOut = bitOutputStream(byteOut); + + // clear code + bitOut.write(clearCode, bitLength); + + var dataIndex = 0; + + var s = String.fromCharCode(_data[dataIndex]); + dataIndex += 1; + + while (dataIndex < _data.length) { + + var c = String.fromCharCode(_data[dataIndex]); + dataIndex += 1; + + if (table.contains(s + c) ) { + + s = s + c; + + } else { + + bitOut.write(table.indexOf(s), bitLength); + + if (table.size() < 0xfff) { + + if (table.size() == (1 << bitLength) ) { + bitLength += 1; + } + + table.add(s + c); + } + + s = c; + } + } + + bitOut.write(table.indexOf(s), bitLength); + + // end code + bitOut.write(endCode, bitLength); + + bitOut.flush(); + + return byteOut.toByteArray(); + }; + + var lzwTable = function() { + + var _map = {}; + var _size = 0; + + var _this = {}; + + _this.add = function(key) { + if (_this.contains(key) ) { + throw new Error('dup key:' + key); + } + _map[key] = _size; + _size += 1; + }; + + _this.size = function() { + return _size; + }; + + _this.indexOf = function(key) { + return _map[key]; + }; + + _this.contains = function(key) { + return typeof _map[key] != 'undefined'; + }; + + return _this; + }; + + return _this; +}; + +var createImgTag = function(width, height, getPixel, alt) { + + var gif = gifImage(width, height); + for (var y = 0; y < height; y += 1) { + for (var x = 0; x < width; x += 1) { + gif.setPixel(x, y, getPixel(x, y) ); + } + } + + var b = byteArrayOutputStream(); + gif.write(b); + + var base64 = base64EncodeOutputStream(); + var bytes = b.toByteArray(); + for (var i = 0; i < bytes.length; i += 1) { + base64.writeByte(bytes[i]); + } + base64.flush(); + + var img = ''; + img += 'data:image/gif;base64,'; + img += base64; + + return img; +}; + +//--------------------------------------------------------------------- +// returns qrcode function. + +module.exports = qrcode; diff --git a/plugins/tiddlywiki/qrcode/files/tiddlywiki.files b/plugins/tiddlywiki/qrcode/files/tiddlywiki.files new file mode 100644 index 000000000..91384cd47 --- /dev/null +++ b/plugins/tiddlywiki/qrcode/files/tiddlywiki.files @@ -0,0 +1,18 @@ +{ + "tiddlers": [ + { + "file": "qrcode.js", + "fields": { + "type": "application/javascript", + "title": "$:/plugins/tiddlywiki/qrcode/qrcode.js", + "module-type": "library" + } + },{ + "file": "LICENSE", + "fields": { + "type": "text/plain", + "title": "$:/plugins/tiddlywiki/qrcode/license" + } + } + ] +} diff --git a/plugins/tiddlywiki/qrcode/icon.tid b/plugins/tiddlywiki/qrcode/icon.tid new file mode 100644 index 000000000..2ce14d4f5 --- /dev/null +++ b/plugins/tiddlywiki/qrcode/icon.tid @@ -0,0 +1,15 @@ +title: $:/plugins/tiddlywiki/qrcode/icon +tags: $:/tags/Image + + + + + + + + + + + + + \ No newline at end of file diff --git a/plugins/tiddlywiki/qrcode/makeqr.js b/plugins/tiddlywiki/qrcode/makeqr.js new file mode 100644 index 000000000..561dfb4a5 --- /dev/null +++ b/plugins/tiddlywiki/qrcode/makeqr.js @@ -0,0 +1,74 @@ +/*\ +title: $:/plugins/tiddlywiki/qrcode/makeqr.js +type: application/javascript +module-type: macro + +Macro to convert a string into a QR Code + +\*/ +(function(){ + +/*jslint node: true, browser: true */ +/*global $tw: false */ +"use strict"; + +/* +Information about this macro +*/ + +var qrcode = require("$:/plugins/tiddlywiki/qrcode/qrcode.js"); + +var QRCODE_GENERATION_ERROR_PREFIX = '', + QRCODE_GENERATION_ERROR_SUFFIX = ''; + +exports.name = "makeqr"; + +exports.params = [ + {name: "text"}, + {name: "size"}, + {name: "errorCorrectLevel"}, + {name: "fallback"} +]; + +/* +Run the macro +*/ +exports.run = function(text,size,errorCorrectLevel,fallback) { + var result; + try { + result = generateQrCode(text,{size: size, errorCorrectLevel: errorCorrectLevel}); + } catch (ex) { + console.log("makeqr error: " + ex); + result = fallback || ("data:image/svg+xml," + encodeURI(QRCODE_GENERATION_ERROR_PREFIX + ex + QRCODE_GENERATION_ERROR_SUFFIX)); + } + return result || ""; +}; + +function generateQrCode(text,options) { + options = options || {}; + var typeNumber = options.typeNumber || 4, + errorCorrectLevel = options.errorCorrectLevel || "M", + size = options.size || 500, + qr; + try { + qr = qrcode(typeNumber,errorCorrectLevel); + qr.addData(text); + qr.make(); + } catch (e) { + if(typeNumber >= 40) { + throw new Error("Text too long to encode"); + } else { + return generateQrCode(text, { + size: size, + errorCorrectLevel: errorCorrectLevel, + typeNumber: typeNumber + 1 + }); + } + } + var cellsize = parseInt(size / qr.getModuleCount()), + margin = parseInt((size - qr.getModuleCount() * cellsize) / 2); + return qr.createImgTag(cellsize, margin, size); +} + + +})(); diff --git a/plugins/tiddlywiki/qrcode/plugin.info b/plugins/tiddlywiki/qrcode/plugin.info new file mode 100644 index 000000000..1be38b1a3 --- /dev/null +++ b/plugins/tiddlywiki/qrcode/plugin.info @@ -0,0 +1,7 @@ +{ + "title": "$:/plugins/tiddlywiki/qrcode", + "description": "QR Code generator", + "author": "Zeno Zeng, adapted by Jeremy Ruston", + "plugin-type": "plugin", + "list": "readme usage examples license" +} diff --git a/plugins/tiddlywiki/railroad/wrapper.js b/plugins/tiddlywiki/railroad/wrapper.js index ca1c18e6b..aeaab3543 100644 --- a/plugins/tiddlywiki/railroad/wrapper.js +++ b/plugins/tiddlywiki/railroad/wrapper.js @@ -97,6 +97,7 @@ RailroadWidget.prototype.patchLinks = function(node) { if(child.attributes["data-tw-external"]) { // External links are straightforward child.setAttribute("target","_blank"); + child.setAttribute("rel","noopener noreferrer"); } else { // Each internal link gets its own onclick handler, capturing its own copy of target (function(myTarget) { diff --git a/plugins/tiddlywiki/stacked-view/StackedControls.tid b/plugins/tiddlywiki/stacked-view/StackedControls.tid index 6fc706fea..56c93d657 100644 --- a/plugins/tiddlywiki/stacked-view/StackedControls.tid +++ b/plugins/tiddlywiki/stacked-view/StackedControls.tid @@ -1,16 +1,19 @@ title: $:/plugins/tiddlywiki/stacked-view/StackedControls -tags: $:/tags/TopLeftBar +caption: Stacked View +tags: $:/tags/SideBar -<$reveal type="match" state="$:/view" text="stacked"> -Stacked view fan height: -<$button set="$:/config/StackedStoryViewFanHeight" setTo="-10">-10 -<$button set="$:/config/StackedStoryViewFanHeight" setTo="0">0 -<$button set="$:/config/StackedStoryViewFanHeight" setTo="10">10 -<$button set="$:/config/StackedStoryViewFanHeight" setTo="30">30 -<$button set="$:/config/StackedStoryViewFanHeight" setTo="50">50 -<$button set="$:/config/StackedStoryViewFanHeight" setTo="100">100 -<$button set="$:/config/StackedStoryViewFanHeight" setTo="300">300 -<$button set="$:/config/StackedStoryViewFanHeight" setTo="500">500 -<$button set="$:/config/StackedStoryViewFanHeight" setTo="700">700 -<$button set="$:/config/StackedStoryViewFanHeight" setTo="1500">1500 - +Set the [[fan separation|$:/config/StackedStoryViewFanHeight]]: + +* <$button set="$:/config/StackedStoryViewFanHeight" setTo="-10">-10 +* <$button set="$:/config/StackedStoryViewFanHeight" setTo="0">0 +* <$button set="$:/config/StackedStoryViewFanHeight" setTo="10">10 +* <$button set="$:/config/StackedStoryViewFanHeight" setTo="30">30 +* <$button set="$:/config/StackedStoryViewFanHeight" setTo="50">50 +* <$button set="$:/config/StackedStoryViewFanHeight" setTo="100">100 +* <$button set="$:/config/StackedStoryViewFanHeight" setTo="150">150 +* <$button set="$:/config/StackedStoryViewFanHeight" setTo="200">200 +* <$button set="$:/config/StackedStoryViewFanHeight" setTo="250">250 +* <$button set="$:/config/StackedStoryViewFanHeight" setTo="300">300 +* <$button set="$:/config/StackedStoryViewFanHeight" setTo="500">500 +* <$button set="$:/config/StackedStoryViewFanHeight" setTo="700">700 +* <$button set="$:/config/StackedStoryViewFanHeight" setTo="1500">1500 diff --git a/plugins/tiddlywiki/text-slicer/docs.tid b/plugins/tiddlywiki/text-slicer/docs.tid index f08e5c9d7..219443107 100644 --- a/plugins/tiddlywiki/text-slicer/docs.tid +++ b/plugins/tiddlywiki/text-slicer/docs.tid @@ -178,6 +178,15 @@ Tiddlers representing images have the following fields: * ''title'': an automatically generated unique title * ''type'': appropriate content type for the image (eg "image/jpeg") +!!! Notes + +Notes are available during editing but hidden for static renderings. The slicing mechanism does not generate notes; they can only be subsequently added manually. Tiddlers representing notes have the following fields: + +* ''toc-type'': the text "note" +* ''title'': an automatically generated unique title +* ''text'': the text of the note +* ''tags'': any CSS classes found in the HTML are converted into tags + ! Document Metadata, Tags and Classes [TBD] diff --git a/plugins/tiddlywiki/text-slicer/modules/commands/slice.js b/plugins/tiddlywiki/text-slicer/modules/commands/slice.js index 29db5892a..81346fbbb 100644 --- a/plugins/tiddlywiki/text-slicer/modules/commands/slice.js +++ b/plugins/tiddlywiki/text-slicer/modules/commands/slice.js @@ -16,7 +16,7 @@ var widget = require("$:/core/modules/widgets/widget.js"); exports.info = { name: "slice", - synchronous: true + synchronous: false }; var Command = function(params,commander,callback) { @@ -31,11 +31,15 @@ Command.prototype.execute = function() { } var self = this, wiki = this.commander.wiki, - tiddlerTitle = this.params[0], - slicer = new $tw.Slicer(wiki,tiddlerTitle); - slicer.sliceTiddler(tiddlerTitle) + sourceTitle = this.params[0], + destTitle = this.params[1], + slicer = new $tw.Slicer(wiki,sourceTitle,{ + destTitle: destTitle + }); + slicer.sliceTiddler() slicer.outputTiddlers(); slicer.destroy(); + $tw.utils.nextTick(this.callback); return null; }; diff --git a/plugins/tiddlywiki/text-slicer/modules/filters/list-children.js b/plugins/tiddlywiki/text-slicer/modules/filters/list-children.js new file mode 100644 index 000000000..443f80a0b --- /dev/null +++ b/plugins/tiddlywiki/text-slicer/modules/filters/list-children.js @@ -0,0 +1,38 @@ +/*\ +title: $:/core/modules/filters/list-children.js +type: application/javascript +module-type: filteroperator + +Filter operator returning all the descendents of a tiddler listed in the "list" field + +\*/ +(function(){ + +/*jslint node: true, browser: true */ +/*global $tw: false */ +"use strict"; + +/* +Export our filter function +*/ +exports["list-children"] = function(source,operator,options) { + var children = {}, + processTiddler = function(title) { + var tiddler = options.wiki.getTiddler(title); + if(tiddler && !$tw.utils.hop(children,title)) { + children[title] = true; + var list = options.wiki.getTiddlerList(title,operator.operand); + list.forEach(function(listItem) { + if(!$tw.utils.hop(children,listItem)) { + processTiddler(listItem); + } + }); + } + }; + source(function(tiddler,title) { + processTiddler(title); + }); + return Object.keys(children); +}; + +})(); diff --git a/plugins/tiddlywiki/text-slicer/modules/slicer.js b/plugins/tiddlywiki/text-slicer/modules/slicer.js index cc86089b0..2514b3d64 100644 --- a/plugins/tiddlywiki/text-slicer/modules/slicer.js +++ b/plugins/tiddlywiki/text-slicer/modules/slicer.js @@ -12,11 +12,16 @@ Main text-slicing logic /*global $tw: false */ "use strict"; +var DOMParser = require("$:/plugins/tiddlywiki/xmldom/dom-parser").DOMParser; + var SLICER_OUTPUT_TITLE = "$:/TextSlicer"; -function Slicer(wiki,sourceTitle) { +function Slicer(wiki,sourceTitle,options) { + options = options || {}; this.wiki = wiki; this.sourceTitle = sourceTitle; + this.sourceTiddler = wiki.getTiddler(this.sourceTitle); + this.destTitle = options.destTitle || this.sourceTiddler.fields["doc-split-to"] || ("Sliced up " + this.sourceTitle); this.iframe = null; // Reference to iframe used for HTML parsing this.stopWordList = "the and a of on i".split(" "); this.tiddlers = {}; @@ -104,27 +109,33 @@ Slicer.prototype.isBlank = function(s) { }; Slicer.prototype.getSourceHtmlDocument = function(tiddler) { - this.iframe = document.createElement("iframe"); - document.body.appendChild(this.iframe); - this.iframe.contentWindow.document.open(); - this.iframe.contentWindow.document.write(tiddler.fields.text); - this.iframe.contentWindow.document.close(); - return this.iframe.contentWindow.document; + if($tw.browser) { + this.iframe = document.createElement("iframe"); + document.body.appendChild(this.iframe); + this.iframe.contentWindow.document.open(); + this.iframe.contentWindow.document.write(tiddler.fields.text); + this.iframe.contentWindow.document.close(); + return this.iframe.contentWindow.document; + } else { + return new DOMParser().parseFromString(tiddler.fields.text); + } }; Slicer.prototype.getSourceWikiDocument = function(tiddler) { - var widgetNode = this.wiki.makeTranscludeWidget(this.sourceTitle,{document: $tw.fakeDocument, parseAsInline: false}), + var widgetNode = this.wiki.makeTranscludeWidget(this.sourceTitle,{ + document: $tw.fakeDocument, + parseAsInline: false, + importPageMacros: true}), container = $tw.fakeDocument.createElement("div"); widgetNode.render(container,null); return container; }; Slicer.prototype.getSourceDocument = function() { - var tiddler = $tw.wiki.getTiddler(this.sourceTitle); - if(tiddler.fields.type === "text/html") { - return this.getSourceHtmlDocument(tiddler); + if(this.sourceTiddler.fields.type === "text/html") { + return this.getSourceHtmlDocument(this.sourceTiddler); } else { - return this.getSourceWikiDocument(tiddler); + return this.getSourceWikiDocument(this.sourceTiddler); } }; @@ -192,17 +203,21 @@ Slicer.prototype.processNode = function(domNode) { }; // Slice a tiddler into individual tiddlers -Slicer.prototype.sliceTiddler = function(title) { - this.sliceTitle = "Sliced up " + title; +Slicer.prototype.sliceTiddler = function() { + var sliceTitle,sliceTiddler = {}; + if(this.sourceTiddler) { + sliceTiddler = $tw.utils.extend({},this.sourceTiddler.fields); + } + sliceTiddler.title = this.destTitle; + sliceTiddler.text = "Document sliced at " + (new Date()); + sliceTiddler.type = "text/vnd.tiddlywiki"; + sliceTiddler.tags = []; + sliceTiddler.list = []; + sliceTiddler["toc-type"] = "document"; var domNode = this.getSourceDocument(); - this.parentStack.push({type: "h0", title: this.addTiddler({ - title: this.sliceTitle, - text: "Document sliced at " + (new Date()), - list: [], - "toc-type": "document" - })}); - this.currentTiddler = title; - this.containerStack.push(this.sliceTitle); + this.parentStack.push({type: "h0", title: this.addTiddler(sliceTiddler)}); + this.currentTiddler = sliceTiddler.title; + this.containerStack.push(sliceTiddler.title); this.processNodeList(domNode.childNodes); this.containerStack.pop(); }; diff --git a/plugins/tiddlywiki/text-slicer/modules/slicers/def-list.js b/plugins/tiddlywiki/text-slicer/modules/slicers/def-list.js index bfcdce28e..2f471b78e 100644 --- a/plugins/tiddlywiki/text-slicer/modules/slicers/def-list.js +++ b/plugins/tiddlywiki/text-slicer/modules/slicers/def-list.js @@ -17,7 +17,7 @@ exports.processDefListNode = function(domNode,tagName) { var title = this.makeUniqueTitle("def-list-" + tagName), parentTitle = this.parentStack[this.parentStack.length - 1].title, tags = []; - if(domNode.className.trim() !== "") { + if(domNode.className && domNode.className.trim() !== "") { tags = tags.concat(domNode.className.split(" ")); } this.addToList(parentTitle,title); diff --git a/plugins/tiddlywiki/text-slicer/modules/slicers/definition.js b/plugins/tiddlywiki/text-slicer/modules/slicers/definition.js index dc4d064c6..a5bcc695f 100644 --- a/plugins/tiddlywiki/text-slicer/modules/slicers/definition.js +++ b/plugins/tiddlywiki/text-slicer/modules/slicers/definition.js @@ -19,7 +19,7 @@ exports.processDefinitionNode = function(domNode,tagName) { var title = this.makeUniqueTitle("definition",text), parentTitle = this.parentStack[this.parentStack.length - 1].title, tags = []; - if(domNode.className.trim() !== "") { + if(domNode.className && domNode.className.trim() !== "") { tags = tags.concat(domNode.className.split(" ")); } this.addToList(parentTitle,title); diff --git a/plugins/tiddlywiki/text-slicer/modules/slicers/heading.js b/plugins/tiddlywiki/text-slicer/modules/slicers/heading.js index cdc9ff1c5..c263c1074 100644 --- a/plugins/tiddlywiki/text-slicer/modules/slicers/heading.js +++ b/plugins/tiddlywiki/text-slicer/modules/slicers/heading.js @@ -18,7 +18,7 @@ exports.processHeadingNode = function(domNode,tagName) { var title = this.makeUniqueTitle("heading",text), parentTitle = this.popParentStackUntil(tagName), tags = []; - if(domNode.className.trim() !== "") { + if(domNode.className && domNode.className.trim() !== "") { tags = tags.concat(domNode.className.split(" ")); } this.addToList(parentTitle,title); diff --git a/plugins/tiddlywiki/text-slicer/modules/slicers/item.js b/plugins/tiddlywiki/text-slicer/modules/slicers/item.js index e8c772310..b4a3dd201 100644 --- a/plugins/tiddlywiki/text-slicer/modules/slicers/item.js +++ b/plugins/tiddlywiki/text-slicer/modules/slicers/item.js @@ -19,7 +19,7 @@ exports.processListItemNode = function(domNode,tagName) { var title = this.makeUniqueTitle("list-item",text), parentTitle = this.parentStack[this.parentStack.length - 1].title, tags = []; - if(domNode.className.trim() !== "") { + if(domNode.className && domNode.className.trim() !== "") { tags = tags.concat(domNode.className.split(" ")); } this.addToList(parentTitle,title); diff --git a/plugins/tiddlywiki/text-slicer/modules/slicers/list.js b/plugins/tiddlywiki/text-slicer/modules/slicers/list.js index 1e203b772..53b1c62f9 100644 --- a/plugins/tiddlywiki/text-slicer/modules/slicers/list.js +++ b/plugins/tiddlywiki/text-slicer/modules/slicers/list.js @@ -17,7 +17,7 @@ exports.processListNode = function(domNode,tagName) { var title = this.makeUniqueTitle("list-" + tagName), parentTitle = this.parentStack[this.parentStack.length - 1].title, tags = []; - if(domNode.className.trim() !== "") { + if(domNode.className && domNode.className.trim() !== "") { tags = tags.concat(domNode.className.split(" ")); } this.addToList(parentTitle,title); diff --git a/plugins/tiddlywiki/text-slicer/modules/slicers/paragraph.js b/plugins/tiddlywiki/text-slicer/modules/slicers/paragraph.js index db28ad902..e5a2b088e 100644 --- a/plugins/tiddlywiki/text-slicer/modules/slicers/paragraph.js +++ b/plugins/tiddlywiki/text-slicer/modules/slicers/paragraph.js @@ -19,7 +19,7 @@ exports.processParagraphNode = function(domNode,tagName) { var parentTitle = this.parentStack[this.parentStack.length - 1].title, tags = [], title = this.makeUniqueTitle("paragraph",text); - if(domNode.className.trim() !== "") { + if(domNode.className && domNode.className && domNode.className.trim() !== "") { tags = tags.concat(domNode.className.split(" ")); } this.addToList(parentTitle,this.addTiddler({ diff --git a/plugins/tiddlywiki/text-slicer/modules/slicers/term.js b/plugins/tiddlywiki/text-slicer/modules/slicers/term.js index d72875e18..6ee16dde3 100644 --- a/plugins/tiddlywiki/text-slicer/modules/slicers/term.js +++ b/plugins/tiddlywiki/text-slicer/modules/slicers/term.js @@ -19,7 +19,7 @@ exports.processTermNode = function(domNode,tagName) { var title = this.makeUniqueTitle("term",text), parentTitle = this.parentStack[this.parentStack.length - 1].title, tags = []; - if(domNode.className.trim() !== "") { + if(domNode.className && domNode.className.trim() !== "") { tags = tags.concat(domNode.className.split(" ")); } this.addToList(parentTitle,title); diff --git a/plugins/tiddlywiki/text-slicer/modules/startup/slicer-message.js b/plugins/tiddlywiki/text-slicer/modules/startup/slicer-message.js index 2a38d6a05..7cb457549 100644 --- a/plugins/tiddlywiki/text-slicer/modules/startup/slicer-message.js +++ b/plugins/tiddlywiki/text-slicer/modules/startup/slicer-message.js @@ -1,5 +1,5 @@ /*\ -title: $:/plugins/tiddlywiki/text-slicer/modules/startup/slicer.js +title: $:/plugins/tiddlywiki/text-slicer/modules/startup/slicer-message.js type: application/javascript module-type: startup @@ -21,7 +21,9 @@ exports.synchronous = true; // Install the root widget event handlers exports.startup = function() { $tw.rootWidget.addEventListener("tm-slice-tiddler",function(event) { - var slicer = new $tw.Slicer($tw.wiki,event.param); + var slicer = new $tw.Slicer($tw.wiki,event.param,{ + destTitle: event.paramObject && event.paramObject.destTitle + }); slicer.sliceTiddler(event.param) slicer.outputTiddlers(); slicer.destroy(); diff --git a/plugins/tiddlywiki/text-slicer/styles.tid b/plugins/tiddlywiki/text-slicer/styles.tid index cf74a4653..370b4d684 100644 --- a/plugins/tiddlywiki/text-slicer/styles.tid +++ b/plugins/tiddlywiki/text-slicer/styles.tid @@ -21,17 +21,82 @@ tags: $:/tags/Stylesheet font-size: 1.7em; } +.tc-slice-note { + color: #800; + padding: 4px 4px 4px 4px; + border: 1px solid #feed77; + background: #feed77; + background: -webkit-gradient(linear,left top,left bottom,color-stop(0%,#dede80),color-stop(7%,#feed77),color-stop(92%,#feed77),color-stop(100%,#dede80)); + background: -webkit-linear-gradient(72deg,rgba(255, 255, 255, 0.5) 8%,rgba(255, 255, 255, 0.1) 80%), -webkit-linear-gradient(top,#dede80 0,#feed77 7%,#feed77 92%,#dede80 100%); + background: -moz-linear-gradient(72deg,rgba(255, 255, 255, 0.5) 8%,rgba(255, 255, 255, 0.1) 80%), -moz-linear-gradient(top,#dede80 0,#feed77 7%,#feed77 92%,#dede80 100%); + background: -o-linear-gradient(72deg,rgba(255, 255, 255, 0.5) 8%,rgba(255, 255, 255, 0.1) 80%), -o-linear-gradient(top,#dede80 0,#feed77 7%,#feed77 92%,#dede80 100%); + background: -ms-linear-gradient(72deg,rgba(255, 255, 255, 0.5) 8%,rgba(255, 255, 255, 0.1) 80%), -ms-linear-gradient(top,#dede80 0,#feed77 7%,#feed77 92%,#dede80 100%); + background: linear-gradient(72deg,rgba(255, 255, 255, 0.5) 8%,rgba(255, 255, 255, 0.1) 80%), linear-gradient(top,#dede80 0,#feed77 7%,#feed77 92%,#dede80 100%); + <> +} + .tc-document-preview-column .tc-sliced-document-header { margin-left: 24px; } .tc-document-preview-column .tc-sliced-document { margin-bottom: 3px; - border-bottom: 2px solid <>; } -.tc-view-template-document-tiddler-heading { - border-top: 2px solid <>; +.tc-view-template-document-tiddler-wrapper, +.tc-edit-template-document-tiddler-wrapper { + border-top: 2px solid #D6A2A2; + margin-left: -42px; + margin-right: -42px; + margin-bottom: -42px; + padding-left: 42px; + padding-right: 42px; + background: #FFE3E3; + padding-bottom: 10px; +} + +.tc-edit-template-document-tiddler-wrapper { + background: #A3A3D7; +} + +div.tc-view-template-document-tiddler-heading a, +div.tc-edit-template-document-tiddler-heading a { + border: 1px solid #D6A2A2; + background: #fff; + border-radius: 16px; + padding: 0px 4px 0px 4px; + margin: 2px 4px 2px 4px; + white-space: nowrap; + display: inline-block; +} + +div.tc-view-template-document-tiddler-heading a:hover, +div.tc-edit-template-document-tiddler-heading a:hover { + border: 1px solid <>; + text-decoration: none; + color: <>; + background: <>; +} + +.tc-view-template-document-tiddler-heading-icon, +.tc-edit-template-document-tiddler-heading-icon { + width: 42px; + text-align: center; + margin-left: -42px; + margin-right: -42px; + position: absolute; +} + +.tc-view-template-document-tiddler-subheading, +.tc-edit-template-document-tiddler-subheading { + font-size: 0.7em; + font-weight: bold; + color: <>; +} + +.tc-view-template-document-tiddler-heading-icon svg, +.tc-edit-template-document-tiddler-heading-icon svg { + fill: <>; } .tc-view-template-document-tiddler { diff --git a/plugins/tiddlywiki/text-slicer/templates/interactive/document.tid b/plugins/tiddlywiki/text-slicer/templates/interactive/document.tid index 171c73c26..1a5366ce6 100644 --- a/plugins/tiddlywiki/text-slicer/templates/interactive/document.tid +++ b/plugins/tiddlywiki/text-slicer/templates/interactive/document.tid @@ -1,15 +1,19 @@ title: $:/plugins/tiddlywiki/text-slicer/templates/interactive/document \define config-document-status() -$:/config/plugins/tiddlywiki/text-slicer/show-preview-document/$(tv-heading-status-config-prefix)$/$(currentTiddler)$ +$:/state/plugins/tiddlywiki/text-slicer/show-preview-document/$(tv-heading-status-config-prefix)$/$(currentTiddler)$ \end \define config-show-toolbar() -$:/config/plugins/tiddlywiki/text-slicer/show-toolbar/$(currentTiddler)$ +$:/state/plugins/tiddlywiki/text-slicer/show-toolbar/$(currentTiddler)$ +\end + +\define config-show-metadata() +$:/state/plugins/tiddlywiki/text-slicer/show-metadata/$(currentTiddler)$ \end \define config-heading-status() -$:/config/plugins/tiddlywiki/text-slicer/heading-status/$(currentTiddler)$ +$:/state/plugins/tiddlywiki/text-slicer/heading-status/$(currentTiddler)$ \end \define body() @@ -18,20 +22,20 @@ $:/config/plugins/tiddlywiki/text-slicer/heading-status/$(currentTiddler)$
    -<$reveal type="nomatch" state=<> text="open" default="closed"> -<$button set=<> setTo="open" class="tc-btn-invisible"> +<$reveal type="nomatch" state=<> text="close" default="open"> +<$button set=<> setTo="close" class="tc-btn-invisible"> {{$:/core/images/down-arrow}} -<$reveal type="match" state=<> text="open" default="closed"> -<$button set=<> setTo="close" class="tc-btn-invisible"> +<$reveal type="match" state=<> text="close" default="open"> +<$button set=<> setTo="open" class="tc-btn-invisible"> {{$:/core/images/right-arrow}}

    ''Document'': <$link><$view field="title"/>

    -<$reveal type="nomatch" state=<> text="open" default="closed"> +<$reveal type="nomatch" state=<> text="close" default="open"> {{||$:/plugins/tiddlywiki/text-slicer/ui/document/header}}
    <$set name="tv-show-toolbar" value={{$(config-show-toolbar)$}}> diff --git a/plugins/tiddlywiki/text-slicer/templates/interactive/heading.tid b/plugins/tiddlywiki/text-slicer/templates/interactive/heading.tid index e9d47270c..9498c1a5c 100644 --- a/plugins/tiddlywiki/text-slicer/templates/interactive/heading.tid +++ b/plugins/tiddlywiki/text-slicer/templates/interactive/heading.tid @@ -8,13 +8,13 @@ $(tv-heading-status-config-title)$/$(tv-heading-status-config-prefix)$/$(current <$set name="tv-heading-status-config-title" value=<>>
    -<$reveal type="nomatch" state=<> text="open" default=<>> -<$button set=<> setTo="open" class="tc-btn-invisible"> +<$reveal type="nomatch" state=<> text="close" default=<>> +<$button set=<> setTo="close" class="tc-btn-invisible"> {{$:/core/images/down-arrow}} -<$reveal type="match" state=<> text="open" default=<>> -<$button set=<> setTo="close" class="tc-btn-invisible"> +<$reveal type="match" state=<> text="close" default=<>> +<$button set=<> setTo="open" class="tc-btn-invisible"> {{$:/core/images/right-arrow}} @@ -22,7 +22,7 @@ $(tv-heading-status-config-title)$/$(tv-heading-status-config-prefix)$/$(current <$link tag="$level$" class="tc-document-tiddler-link"> <$transclude/> -<$reveal type="nomatch" state=<> text="open" default=<>> +<$reveal type="nomatch" state=<> text="close" default=<>> <$list filter="[list!has[draft.of]]" template="$:/plugins/tiddlywiki/text-slicer/templates/interactive/tiddler"/>
    diff --git a/plugins/tiddlywiki/text-slicer/templates/interactive/note.tid b/plugins/tiddlywiki/text-slicer/templates/interactive/note.tid new file mode 100644 index 000000000..e2f3c4f3e --- /dev/null +++ b/plugins/tiddlywiki/text-slicer/templates/interactive/note.tid @@ -0,0 +1,19 @@ +title: $:/plugins/tiddlywiki/text-slicer/templates/interactive/note + +\define body() +
    + +<$link tag="div" class="tc-document-tiddler-link tc-document-tiddler"> + +<$list filter="""[all[current]] $(tv-exclude-filter)$ +[limit[1]]""" variable="item"> + +<$transclude/> + + + + + +
    +\end + +<> diff --git a/plugins/tiddlywiki/text-slicer/templates/interactive/tiddler.tid b/plugins/tiddlywiki/text-slicer/templates/interactive/tiddler.tid index fd98e761a..2d53001b8 100644 --- a/plugins/tiddlywiki/text-slicer/templates/interactive/tiddler.tid +++ b/plugins/tiddlywiki/text-slicer/templates/interactive/tiddler.tid @@ -16,6 +16,10 @@ title: $:/plugins/tiddlywiki/text-slicer/templates/interactive/tiddler <$transclude tiddler="$:/plugins/tiddlywiki/text-slicer/templates/interactive/paragraph" mode="block"/> +<$reveal type="match" state="!!toc-type" text="note"> +<$transclude tiddler="$:/plugins/tiddlywiki/text-slicer/templates/interactive/note" mode="block"/> + + <$reveal type="match" state="!!toc-type" text="list"> <$transclude tiddler="$:/plugins/tiddlywiki/text-slicer/templates/interactive/list" mode="block"/> diff --git a/plugins/tiddlywiki/text-slicer/templates/plain/note.tid b/plugins/tiddlywiki/text-slicer/templates/plain/note.tid new file mode 100644 index 000000000..cddda37d6 --- /dev/null +++ b/plugins/tiddlywiki/text-slicer/templates/plain/note.tid @@ -0,0 +1,3 @@ +title: $:/plugins/tiddlywiki/text-slicer/templates/plain/note + + diff --git a/plugins/tiddlywiki/text-slicer/templates/plain/tiddler.tid b/plugins/tiddlywiki/text-slicer/templates/plain/tiddler.tid index 390c2e308..f2b67200a 100644 --- a/plugins/tiddlywiki/text-slicer/templates/plain/tiddler.tid +++ b/plugins/tiddlywiki/text-slicer/templates/plain/tiddler.tid @@ -14,6 +14,10 @@ title: $:/plugins/tiddlywiki/text-slicer/templates/plain/tiddler <$transclude tiddler="$:/plugins/tiddlywiki/text-slicer/templates/plain/paragraph" mode="block"/> +<$list filter="[prefix[note]]" variable="item"> +<$transclude tiddler="$:/plugins/tiddlywiki/text-slicer/templates/plain/note" mode="block"/> + + <$list filter="[prefix[list]]" variable="item"> <$transclude tiddler="$:/plugins/tiddlywiki/text-slicer/templates/plain/list" mode="block"/> diff --git a/plugins/tiddlywiki/text-slicer/templates/static/item.tid b/plugins/tiddlywiki/text-slicer/templates/static/item.tid index 268320c13..1c7f5a703 100644 --- a/plugins/tiddlywiki/text-slicer/templates/static/item.tid +++ b/plugins/tiddlywiki/text-slicer/templates/static/item.tid @@ -4,6 +4,7 @@ title: $:/plugins/tiddlywiki/text-slicer/templates/static/item <$transclude/> +<$list filter="[list!has[draft.of]]" template="$:/plugins/tiddlywiki/text-slicer/templates/static/tiddler"/> + `
  • ` -<$list filter="[list!has[draft.of]]" template="$:/plugins/tiddlywiki/text-slicer/templates/static/tiddler"/> diff --git a/plugins/tiddlywiki/text-slicer/templates/static/note.tid b/plugins/tiddlywiki/text-slicer/templates/static/note.tid new file mode 100644 index 000000000..1530d9538 --- /dev/null +++ b/plugins/tiddlywiki/text-slicer/templates/static/note.tid @@ -0,0 +1,3 @@ +title: $:/plugins/tiddlywiki/text-slicer/templates/static/note + + diff --git a/plugins/tiddlywiki/text-slicer/templates/static/tiddler.tid b/plugins/tiddlywiki/text-slicer/templates/static/tiddler.tid index bd8e1e822..8f4c6fe59 100644 --- a/plugins/tiddlywiki/text-slicer/templates/static/tiddler.tid +++ b/plugins/tiddlywiki/text-slicer/templates/static/tiddler.tid @@ -20,6 +20,12 @@ title: $:/plugins/tiddlywiki/text-slicer/templates/static/tiddler +<$list filter="[prefix[note]]" variable="item"> + +<$transclude tiddler="$:/plugins/tiddlywiki/text-slicer/templates/static/note" mode="block"/> + + + <$list filter="[prefix[list]]" variable="item"> <$transclude tiddler="$:/plugins/tiddlywiki/text-slicer/templates/static/list" mode="block"/> diff --git a/plugins/tiddlywiki/text-slicer/ui/document/header.tid b/plugins/tiddlywiki/text-slicer/ui/document/header.tid index 3cd254183..1908dff41 100644 --- a/plugins/tiddlywiki/text-slicer/ui/document/header.tid +++ b/plugins/tiddlywiki/text-slicer/ui/document/header.tid @@ -20,13 +20,12 @@ title: $:/plugins/tiddlywiki/text-slicer/ui/document/header ''Exclude filter'': <$edit-text field="toc-exclude-filter"/> -<$checkbox tiddler=<> field="text" checked="yes" unchecked="no" default="no"> Show toolbar - -<$button> +<$checkbox tiddler=<> field="text" checked="yes" unchecked="no" default="no"> Show toolbar <$checkbox tiddler=<> field="text" checked="yes" unchecked="no" default="no"> Show metadata <$button> <$action-sendmessage $message="tm-open-window" $param=<> template="$:/plugins/tiddlywiki/text-slicer/templates/plain/document"/> View document +<$reveal state=<> default="no" type="match" text="yes"> <$list filter="[all[system+tiddlers]tag[$:/tags/DocumentMetaData]]" variable="listItem"> @@ -34,5 +33,7 @@ View document
    + +
    diff --git a/plugins/tiddlywiki/text-slicer/ui/edit-template-segment.tid b/plugins/tiddlywiki/text-slicer/ui/edit-template-segment.tid new file mode 100644 index 000000000..bd836a425 --- /dev/null +++ b/plugins/tiddlywiki/text-slicer/ui/edit-template-segment.tid @@ -0,0 +1,35 @@ +title: $:/plugins/tiddlywiki/text-slicer/ui/edit-template-segment +tags: $:/tags/EditTemplate + +\define edit-field(name,tag:"input") +$name$: + +<$edit-text field="""$name$""" tag="$tag$" class="tc-edit-texteditor"/> +\end + +<$reveal type="nomatch" state="!!toc-type" text=""> + +
    + +
    + +
    + +{{$:/core/images/file}} + +
    + +
    + +<$view field="toc-type"/> + +
    + +<> + +
    + +
    + + + diff --git a/plugins/tiddlywiki/text-slicer/ui/filters/Orphans.tid b/plugins/tiddlywiki/text-slicer/ui/filters/Orphans.tid new file mode 100644 index 000000000..d4ab0b8d7 --- /dev/null +++ b/plugins/tiddlywiki/text-slicer/ui/filters/Orphans.tid @@ -0,0 +1,5 @@ +title: $:/plugins/tiddlywiki/text-slicer/filters/Orphans +tags: $:/tags/Filter +filter: [has[toc-type]] -[toc-type[document]list-children[]] +description: [Text-slicer] Tiddlers that are not part of any document + diff --git a/plugins/tiddlywiki/text-slicer/ui/preview-column.tid b/plugins/tiddlywiki/text-slicer/ui/preview-column.tid index 41eeac5fa..44532f6d3 100644 --- a/plugins/tiddlywiki/text-slicer/ui/preview-column.tid +++ b/plugins/tiddlywiki/text-slicer/ui/preview-column.tid @@ -3,10 +3,16 @@ tags: $:/tags/AboveStory <$scrollable fallthrough="no" class="tc-document-preview-column"> +<$vars + tv-default-heading-state="open" +> + <$list filter="[toc-type[document]!has[draft.of]sort[title]limit[1]]" emptyMessage={{$:/plugins/tiddlywiki/text-slicer/ui/preview-column/empty}}> <$list filter="[toc-type[document]!has[draft.of]sort[title]butfirst[1]limit[1]]" emptyMessage={{$:/plugins/tiddlywiki/text-slicer/ui/preview-column/single}} template="$:/plugins/tiddlywiki/text-slicer/ui/preview-column/multiple"/> + + diff --git a/plugins/tiddlywiki/text-slicer/ui/tiddler/toolbar/title.tid b/plugins/tiddlywiki/text-slicer/ui/tiddler/toolbar/title.tid index 52af7ef73..d1ed0b583 100644 --- a/plugins/tiddlywiki/text-slicer/ui/tiddler/toolbar/title.tid +++ b/plugins/tiddlywiki/text-slicer/ui/tiddler/toolbar/title.tid @@ -2,7 +2,7 @@ title: $:/plugins/tiddlywiki/text-slicer/ui/tiddler/toolbar/title tags: $:/tags/TextSlicerToolbar \define renameProxyTitle() -$:/config/plugins/tiddlywiki/text-slicer/rename-$(currentTiddler)$ +$:/state/plugins/tiddlywiki/text-slicer/rename-$(currentTiddler)$ \end \define body() diff --git a/plugins/tiddlywiki/text-slicer/ui/view-template-segment.tid b/plugins/tiddlywiki/text-slicer/ui/view-template-segment.tid index 8f14e4454..ebc346e8e 100644 --- a/plugins/tiddlywiki/text-slicer/ui/view-template-segment.tid +++ b/plugins/tiddlywiki/text-slicer/ui/view-template-segment.tid @@ -1,19 +1,43 @@ title: $:/plugins/tiddlywiki/text-slicer/ui/view-template-segment tags: $:/tags/ViewTemplate +\define config-heading-status() +$:/state/plugins/tiddlywiki/text-slicer/heading-status/$(currentTiddler)$ +\end + <$reveal type="nomatch" state=<> text="hide" retain="yes" animate="yes"> <$reveal type="nomatch" state="!!toc-type" text=""> +
    +
    -//This tiddler is part of a document. The content as it appears in the document appears below.// +
    + +{{$:/core/images/file}} + +
    + +
    + +<$view field="toc-type"/> + +
    + +Parents: <$list filter="[all[current]listed[]!is[system]]" emptyMessage="None"> +<$link><$view field="title"/> +
    -<$vars tv-default-heading-state="closed" tv-heading-status-config-prefix="view-template"> +<$vars + tv-default-heading-state="close" + tv-heading-status-config-prefix="view-template" + tv-heading-status-config-title=<> +> <$transclude tiddler="$:/plugins/tiddlywiki/text-slicer/templates/interactive/tiddler"/> @@ -21,6 +45,8 @@ tags: $:/tags/ViewTemplate
    +
    + diff --git a/plugins/tiddlywiki/tiddlyweb/tiddlywebadaptor.js b/plugins/tiddlywiki/tiddlyweb/tiddlywebadaptor.js index 3ff03f7a5..9666ed0f8 100644 --- a/plugins/tiddlywiki/tiddlyweb/tiddlywebadaptor.js +++ b/plugins/tiddlywiki/tiddlyweb/tiddlywebadaptor.js @@ -19,9 +19,14 @@ function TiddlyWebAdaptor(options) { this.wiki = options.wiki; this.host = this.getHost(); this.recipe = undefined; + this.hasStatus = false; this.logger = new $tw.utils.Logger("TiddlyWebAdaptor"); } +TiddlyWebAdaptor.prototype.isReady = function() { + return this.hasStatus; +}; + TiddlyWebAdaptor.prototype.getHost = function() { var text = this.wiki.getTiddlerText(CONFIG_HOST_TIDDLER,DEFAULT_HOST_TIDDLER), substitutions = [ @@ -30,7 +35,7 @@ TiddlyWebAdaptor.prototype.getHost = function() { ]; for(var t=0; t + +<$text text={{$:/language/Snippets/$title$}}/> +\end +<$macrocall $name="generateTid" title=<>/> \ No newline at end of file diff --git a/plugins/tiddlywiki/translators/templates/tid.tid b/plugins/tiddlywiki/translators/templates/tid.tid index 7fde58ac4..55aee6602 100644 --- a/plugins/tiddlywiki/translators/templates/tid.tid +++ b/plugins/tiddlywiki/translators/templates/tid.tid @@ -3,6 +3,6 @@ title: $:/plugins/tiddlywiki/translators/templates/tid \define generateTid(title) title: $title$ -<$list filter="""[[$title$]is[tiddler]]"""><$transclude tiddler="""$title$"""/> +<$list filter="""[[$title$]is[tiddler]]"""><$text text={{$title$}}/> \end <$macrocall $name="generateTid" title=<>/> \ No newline at end of file diff --git a/plugins/tiddlywiki/translators/ui/editorTag.tid b/plugins/tiddlywiki/translators/ui/editorTag.tid index 81f163abc..02b3c8ce3 100644 --- a/plugins/tiddlywiki/translators/ui/editorTag.tid +++ b/plugins/tiddlywiki/translators/ui/editorTag.tid @@ -1,3 +1,3 @@ title: $:/plugins/tiddlywiki/translators/editorTag -input \ No newline at end of file +textarea \ No newline at end of file diff --git a/plugins/tiddlywiki/translators/ui/group/Miscellaneous.tid b/plugins/tiddlywiki/translators/ui/group/Miscellaneous.tid index a43153193..19b640032 100644 --- a/plugins/tiddlywiki/translators/ui/group/Miscellaneous.tid +++ b/plugins/tiddlywiki/translators/ui/group/Miscellaneous.tid @@ -15,6 +15,8 @@ tags: $:/tags/TranslationGroup -[all[tiddlers+shadows]prefix[$:/language/RelativeDate/]] -[all[tiddlers+shadows]prefix[$:/language/Search/]] -[all[tiddlers+shadows]prefix[$:/language/SideBar/]] +-[all[tiddlers+shadows]prefix[$:/language/Snippets/]] +-[all[tiddlers+shadows]prefix[$:/language/ThemeTweaks/]] -[all[tiddlers+shadows]prefix[$:/language/TiddlerInfo/]] [all[tiddlers+shadows]prefix[$:/config/NewJournal/]] [[$:/SiteTitle]] diff --git a/plugins/tiddlywiki/translators/ui/group/Snippets.tid b/plugins/tiddlywiki/translators/ui/group/Snippets.tid new file mode 100644 index 000000000..6880c58a1 --- /dev/null +++ b/plugins/tiddlywiki/translators/ui/group/Snippets.tid @@ -0,0 +1,16 @@ +title: $:/plugins/tiddlywiki/translators/ui/group/Snippets +caption: Snippets +tags: $:/tags/TranslationGroup + +\define translatableTiddlerTitles() +[all[tiddlers+shadows]prefix[$:/language/Snippets/]sort[title]] +\end +\define shortenTitle() +[all[current]removeprefix[$:/language/Snippets/]] +\end + +! Snippets + +Text snippets for use by the stamp text editor toolbar button. + +<> diff --git a/plugins/tiddlywiki/translators/ui/group/ThemeTweaks.tid b/plugins/tiddlywiki/translators/ui/group/ThemeTweaks.tid new file mode 100644 index 000000000..0be2e3df0 --- /dev/null +++ b/plugins/tiddlywiki/translators/ui/group/ThemeTweaks.tid @@ -0,0 +1,16 @@ +title: $:/plugins/tiddlywiki/translators/ui/group/ThemeTweaks +caption: Theme Tweaks +tags: $:/tags/TranslationGroup + +\define translatableTiddlerTitles() +[all[tiddlers+shadows]prefix[$:/language/ThemeTweaks/]sort[title]] +\end +\define shortenTitle() +[all[current]removeprefix[$:/language/ThemeTweaks/]] +\end + +! Theme Tweaks + +Strings used in the theme tweaks for Vanilla. + +<> diff --git a/plugins/tiddlywiki/tw2parser/classictransclude.js b/plugins/tiddlywiki/tw2parser/classictransclude.js index 104aef0eb..8afbed60c 100644 --- a/plugins/tiddlywiki/tw2parser/classictransclude.js +++ b/plugins/tiddlywiki/tw2parser/classictransclude.js @@ -79,7 +79,7 @@ TranscludeWidget.prototype.execute = function() { // Check for recursion var recursionMarker = this.makeRecursionMarker(); if(this.parentWidget && this.parentWidget.hasVariable("transclusion",recursionMarker)) { - this.makeChildWidgets([{type: "text", text: "Recursive transclusion error in transclude widget"}]); + this.makeChildWidgets([{type: "text", text: $tw.language.getString("Error/RecursiveTransclusion")}]); return; } // Check for correct type diff --git a/plugins/tiddlywiki/xmldom/files/LICENSE b/plugins/tiddlywiki/xmldom/files/LICENSE new file mode 100644 index 000000000..68a9b5e1b --- /dev/null +++ b/plugins/tiddlywiki/xmldom/files/LICENSE @@ -0,0 +1,8 @@ +You can choose any one of those: + +The MIT License (MIT): + +link:http://opensource.org/licenses/MIT + +LGPL: +http://www.gnu.org/licenses/lgpl.html diff --git a/plugins/tiddlywiki/xmldom/files/dom-parser.js b/plugins/tiddlywiki/xmldom/files/dom-parser.js new file mode 100644 index 000000000..44657c507 --- /dev/null +++ b/plugins/tiddlywiki/xmldom/files/dom-parser.js @@ -0,0 +1,256 @@ +function DOMParser(options){ + this.options = options ||{locator:{}}; + +} +DOMParser.prototype.parseFromString = function(source,mimeType){ + var options = this.options; + var sax = new XMLReader(); + var domBuilder = options.domBuilder || new DOMHandler();//contentHandler and LexicalHandler + var errorHandler = options.errorHandler; + var locator = options.locator; + var defaultNSMap = options.xmlns||{}; + var entityMap = {'lt':'<','gt':'>','amp':'&','quot':'"','apos':"'"} + if(locator){ + domBuilder.setDocumentLocator(locator) + } + + sax.errorHandler = buildErrorHandler(errorHandler,domBuilder,locator); + sax.domBuilder = options.domBuilder || domBuilder; + if(/\/x?html?$/.test(mimeType)){ + entityMap.nbsp = '\xa0'; + entityMap.copy = '\xa9'; + defaultNSMap['']= 'http://www.w3.org/1999/xhtml'; + } + defaultNSMap.xml = defaultNSMap.xml || 'http://www.w3.org/XML/1998/namespace'; + if(source){ + sax.parse(source,defaultNSMap,entityMap); + }else{ + sax.errorHandler.error("invalid document source"); + } + return domBuilder.document; +} +function buildErrorHandler(errorImpl,domBuilder,locator){ + if(!errorImpl){ + if(domBuilder instanceof DOMHandler){ + return domBuilder; + } + errorImpl = domBuilder ; + } + var errorHandler = {} + var isCallback = errorImpl instanceof Function; + locator = locator||{} + function build(key){ + var fn = errorImpl[key]; + if(!fn){ + if(isCallback){ + fn = errorImpl.length == 2?function(msg){errorImpl(key,msg)}:errorImpl; + }else{ + var i=arguments.length; + while(--i){ + if(fn = errorImpl[arguments[i]]){ + break; + } + } + } + } + errorHandler[key] = fn && function(msg){ + fn(msg+_locator(locator)); + }||function(){}; + } + build('warning','warn'); + build('error','warn','warning'); + build('fatalError','warn','warning','error'); + return errorHandler; +} +/** + * +ContentHandler+ErrorHandler + * +LexicalHandler+EntityResolver2 + * -DeclHandler-DTDHandler + * + * DefaultHandler:EntityResolver, DTDHandler, ContentHandler, ErrorHandler + * DefaultHandler2:DefaultHandler,LexicalHandler, DeclHandler, EntityResolver2 + * @link http://www.saxproject.org/apidoc/org/xml/sax/helpers/DefaultHandler.html + */ +function DOMHandler() { + this.cdata = false; +} +function position(locator,node){ + node.lineNumber = locator.lineNumber; + node.columnNumber = locator.columnNumber; +} +/** + * @see org.xml.sax.ContentHandler#startDocument + * @link http://www.saxproject.org/apidoc/org/xml/sax/ContentHandler.html + */ +DOMHandler.prototype = { + startDocument : function() { + this.document = new DOMImplementation().createDocument(null, null, null); + if (this.locator) { + this.document.documentURI = this.locator.systemId; + } + }, + startElement:function(namespaceURI, localName, qName, attrs) { + var doc = this.document; + var el = doc.createElementNS(namespaceURI, qName||localName); + var len = attrs.length; + appendElement(this, el); + this.currentElement = el; + + this.locator && position(this.locator,el) + for (var i = 0 ; i < len; i++) { + var namespaceURI = attrs.getURI(i); + var value = attrs.getValue(i); + var qName = attrs.getQName(i); + var attr = doc.createAttributeNS(namespaceURI, qName); + if( attr.getOffset){ + position(attr.getOffset(1),attr) + } + attr.value = attr.nodeValue = value; + el.setAttributeNode(attr) + } + }, + endElement:function(namespaceURI, localName, qName) { + var current = this.currentElement + var tagName = current.tagName; + this.currentElement = current.parentNode; + }, + startPrefixMapping:function(prefix, uri) { + }, + endPrefixMapping:function(prefix) { + }, + processingInstruction:function(target, data) { + var ins = this.document.createProcessingInstruction(target, data); + this.locator && position(this.locator,ins) + appendElement(this, ins); + }, + ignorableWhitespace:function(ch, start, length) { + }, + characters:function(chars, start, length) { + chars = _toString.apply(this,arguments) + //console.log(chars) + if(this.currentElement && chars){ + if (this.cdata) { + var charNode = this.document.createCDATASection(chars); + this.currentElement.appendChild(charNode); + } else { + var charNode = this.document.createTextNode(chars); + this.currentElement.appendChild(charNode); + } + this.locator && position(this.locator,charNode) + } + }, + skippedEntity:function(name) { + }, + endDocument:function() { + this.document.normalize(); + }, + setDocumentLocator:function (locator) { + if(this.locator = locator){// && !('lineNumber' in locator)){ + locator.lineNumber = 0; + } + }, + //LexicalHandler + comment:function(chars, start, length) { + chars = _toString.apply(this,arguments) + var comm = this.document.createComment(chars); + this.locator && position(this.locator,comm) + appendElement(this, comm); + }, + + startCDATA:function() { + //used in characters() methods + this.cdata = true; + }, + endCDATA:function() { + this.cdata = false; + }, + + startDTD:function(name, publicId, systemId) { + var impl = this.document.implementation; + if (impl && impl.createDocumentType) { + var dt = impl.createDocumentType(name, publicId, systemId); + this.locator && position(this.locator,dt) + appendElement(this, dt); + } + }, + /** + * @see org.xml.sax.ErrorHandler + * @link http://www.saxproject.org/apidoc/org/xml/sax/ErrorHandler.html + */ + warning:function(error) { + console.warn(error,_locator(this.locator)); + }, + error:function(error) { + console.error(error,_locator(this.locator)); + }, + fatalError:function(error) { + console.error(error,_locator(this.locator)); + throw error; + } +} +function _locator(l){ + if(l){ + return '\n@'+(l.systemId ||'')+'#[line:'+l.lineNumber+',col:'+l.columnNumber+']' + } +} +function _toString(chars,start,length){ + if(typeof chars == 'string'){ + return chars.substr(start,length) + }else{//java sax connect width xmldom on rhino(what about: "? && !(chars instanceof String)") + if(chars.length >= start+length || start){ + return new java.lang.String(chars,start,length)+''; + } + return chars; + } +} + +/* + * @link http://www.saxproject.org/apidoc/org/xml/sax/ext/LexicalHandler.html + * used method of org.xml.sax.ext.LexicalHandler: + * #comment(chars, start, length) + * #startCDATA() + * #endCDATA() + * #startDTD(name, publicId, systemId) + * + * + * IGNORED method of org.xml.sax.ext.LexicalHandler: + * #endDTD() + * #startEntity(name) + * #endEntity(name) + * + * + * @link http://www.saxproject.org/apidoc/org/xml/sax/ext/DeclHandler.html + * IGNORED method of org.xml.sax.ext.DeclHandler + * #attributeDecl(eName, aName, type, mode, value) + * #elementDecl(name, model) + * #externalEntityDecl(name, publicId, systemId) + * #internalEntityDecl(name, value) + * @link http://www.saxproject.org/apidoc/org/xml/sax/ext/EntityResolver2.html + * IGNORED method of org.xml.sax.EntityResolver2 + * #resolveEntity(String name,String publicId,String baseURI,String systemId) + * #resolveEntity(publicId, systemId) + * #getExternalSubset(name, baseURI) + * @link http://www.saxproject.org/apidoc/org/xml/sax/DTDHandler.html + * IGNORED method of org.xml.sax.DTDHandler + * #notationDecl(name, publicId, systemId) {}; + * #unparsedEntityDecl(name, publicId, systemId, notationName) {}; + */ +"endDTD,startEntity,endEntity,attributeDecl,elementDecl,externalEntityDecl,internalEntityDecl,resolveEntity,getExternalSubset,notationDecl,unparsedEntityDecl".replace(/\w+/g,function(key){ + DOMHandler.prototype[key] = function(){return null} +}) + +/* Private static helpers treated below as private instance methods, so don't need to add these to the public API; we might use a Relator to also get rid of non-standard public properties */ +function appendElement (hander,node) { + if (!hander.currentElement) { + hander.document.appendChild(node); + } else { + hander.currentElement.appendChild(node); + } +}//appendChild and setAttributeNS are preformance key + +if(typeof require == 'function'){ + var XMLReader = require('./sax').XMLReader; + var DOMImplementation = exports.DOMImplementation = require('./dom').DOMImplementation; + exports.XMLSerializer = require('./dom').XMLSerializer ; + exports.DOMParser = DOMParser; +} diff --git a/plugins/tiddlywiki/xmldom/files/dom.js b/plugins/tiddlywiki/xmldom/files/dom.js new file mode 100644 index 000000000..0a3b8add4 --- /dev/null +++ b/plugins/tiddlywiki/xmldom/files/dom.js @@ -0,0 +1,1141 @@ +/* + * DOM Level 2 + * Object DOMException + * @see http://www.w3.org/TR/REC-DOM-Level-1/ecma-script-language-binding.html + * @see http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/ecma-script-binding.html + */ + +function copy(src,dest){ + for(var p in src){ + dest[p] = src[p]; + } +} +/** +^\w+\.prototype\.([_\w]+)\s*=\s*((?:.*\{\s*?[\r\n][\s\S]*?^})|\S.*?(?=[;\r\n]));? +^\w+\.prototype\.([_\w]+)\s*=\s*(\S.*?(?=[;\r\n]));? + */ +function _extends(Class,Super){ + var pt = Class.prototype; + if(Object.create){ + var ppt = Object.create(Super.prototype) + pt.__proto__ = ppt; + } + if(!(pt instanceof Super)){ + function t(){}; + t.prototype = Super.prototype; + t = new t(); + copy(pt,t); + Class.prototype = pt = t; + } + if(pt.constructor != Class){ + if(typeof Class != 'function'){ + console.error("unknow Class:"+Class) + } + pt.constructor = Class + } +} +var htmlns = 'http://www.w3.org/1999/xhtml' ; +// Node Types +var NodeType = {} +var ELEMENT_NODE = NodeType.ELEMENT_NODE = 1; +var ATTRIBUTE_NODE = NodeType.ATTRIBUTE_NODE = 2; +var TEXT_NODE = NodeType.TEXT_NODE = 3; +var CDATA_SECTION_NODE = NodeType.CDATA_SECTION_NODE = 4; +var ENTITY_REFERENCE_NODE = NodeType.ENTITY_REFERENCE_NODE = 5; +var ENTITY_NODE = NodeType.ENTITY_NODE = 6; +var PROCESSING_INSTRUCTION_NODE = NodeType.PROCESSING_INSTRUCTION_NODE = 7; +var COMMENT_NODE = NodeType.COMMENT_NODE = 8; +var DOCUMENT_NODE = NodeType.DOCUMENT_NODE = 9; +var DOCUMENT_TYPE_NODE = NodeType.DOCUMENT_TYPE_NODE = 10; +var DOCUMENT_FRAGMENT_NODE = NodeType.DOCUMENT_FRAGMENT_NODE = 11; +var NOTATION_NODE = NodeType.NOTATION_NODE = 12; + +// ExceptionCode +var ExceptionCode = {} +var ExceptionMessage = {}; +var INDEX_SIZE_ERR = ExceptionCode.INDEX_SIZE_ERR = ((ExceptionMessage[1]="Index size error"),1); +var DOMSTRING_SIZE_ERR = ExceptionCode.DOMSTRING_SIZE_ERR = ((ExceptionMessage[2]="DOMString size error"),2); +var HIERARCHY_REQUEST_ERR = ExceptionCode.HIERARCHY_REQUEST_ERR = ((ExceptionMessage[3]="Hierarchy request error"),3); +var WRONG_DOCUMENT_ERR = ExceptionCode.WRONG_DOCUMENT_ERR = ((ExceptionMessage[4]="Wrong document"),4); +var INVALID_CHARACTER_ERR = ExceptionCode.INVALID_CHARACTER_ERR = ((ExceptionMessage[5]="Invalid character"),5); +var NO_DATA_ALLOWED_ERR = ExceptionCode.NO_DATA_ALLOWED_ERR = ((ExceptionMessage[6]="No data allowed"),6); +var NO_MODIFICATION_ALLOWED_ERR = ExceptionCode.NO_MODIFICATION_ALLOWED_ERR = ((ExceptionMessage[7]="No modification allowed"),7); +var NOT_FOUND_ERR = ExceptionCode.NOT_FOUND_ERR = ((ExceptionMessage[8]="Not found"),8); +var NOT_SUPPORTED_ERR = ExceptionCode.NOT_SUPPORTED_ERR = ((ExceptionMessage[9]="Not supported"),9); +var INUSE_ATTRIBUTE_ERR = ExceptionCode.INUSE_ATTRIBUTE_ERR = ((ExceptionMessage[10]="Attribute in use"),10); +//level2 +var INVALID_STATE_ERR = ExceptionCode.INVALID_STATE_ERR = ((ExceptionMessage[11]="Invalid state"),11); +var SYNTAX_ERR = ExceptionCode.SYNTAX_ERR = ((ExceptionMessage[12]="Syntax error"),12); +var INVALID_MODIFICATION_ERR = ExceptionCode.INVALID_MODIFICATION_ERR = ((ExceptionMessage[13]="Invalid modification"),13); +var NAMESPACE_ERR = ExceptionCode.NAMESPACE_ERR = ((ExceptionMessage[14]="Invalid namespace"),14); +var INVALID_ACCESS_ERR = ExceptionCode.INVALID_ACCESS_ERR = ((ExceptionMessage[15]="Invalid access"),15); + + +function DOMException(code, message) { + if(message instanceof Error){ + var error = message; + }else{ + error = this; + Error.call(this, ExceptionMessage[code]); + this.message = ExceptionMessage[code]; + if(Error.captureStackTrace) Error.captureStackTrace(this, DOMException); + } + error.code = code; + if(message) this.message = this.message + ": " + message; + return error; +}; +DOMException.prototype = Error.prototype; +copy(ExceptionCode,DOMException) +/** + * @see http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/core.html#ID-536297177 + * The NodeList interface provides the abstraction of an ordered collection of nodes, without defining or constraining how this collection is implemented. NodeList objects in the DOM are live. + * The items in the NodeList are accessible via an integral index, starting from 0. + */ +function NodeList() { +}; +NodeList.prototype = { + /** + * The number of nodes in the list. The range of valid child node indices is 0 to length-1 inclusive. + * @standard level1 + */ + length:0, + /** + * Returns the indexth item in the collection. If index is greater than or equal to the number of nodes in the list, this returns null. + * @standard level1 + * @param index unsigned long + * Index into the collection. + * @return Node + * The node at the indexth position in the NodeList, or null if that is not a valid index. + */ + item: function(index) { + return this[index] || null; + } +}; +function LiveNodeList(node,refresh){ + this._node = node; + this._refresh = refresh + _updateLiveList(this); +} +function _updateLiveList(list){ + var inc = list._node._inc || list._node.ownerDocument._inc; + if(list._inc != inc){ + var ls = list._refresh(list._node); + //console.log(ls.length) + __set__(list,'length',ls.length); + copy(ls,list); + list._inc = inc; + } +} +LiveNodeList.prototype.item = function(i){ + _updateLiveList(this); + return this[i]; +} + +_extends(LiveNodeList,NodeList); +/** + * + * Objects implementing the NamedNodeMap interface are used to represent collections of nodes that can be accessed by name. Note that NamedNodeMap does not inherit from NodeList; NamedNodeMaps are not maintained in any particular order. Objects contained in an object implementing NamedNodeMap may also be accessed by an ordinal index, but this is simply to allow convenient enumeration of the contents of a NamedNodeMap, and does not imply that the DOM specifies an order to these Nodes. + * NamedNodeMap objects in the DOM are live. + * used for attributes or DocumentType entities + */ +function NamedNodeMap() { +}; + +function _findNodeIndex(list,node){ + var i = list.length; + while(i--){ + if(list[i] === node){return i} + } +} + +function _addNamedNode(el,list,newAttr,oldAttr){ + if(oldAttr){ + list[_findNodeIndex(list,oldAttr)] = newAttr; + }else{ + list[list.length++] = newAttr; + } + if(el){ + newAttr.ownerElement = el; + var doc = el.ownerDocument; + if(doc){ + oldAttr && _onRemoveAttribute(doc,el,oldAttr); + _onAddAttribute(doc,el,newAttr); + } + } +} +function _removeNamedNode(el,list,attr){ + var i = _findNodeIndex(list,attr); + if(i>=0){ + var lastIndex = list.length-1 + while(i0 || key == 'xmlns'){ +// return null; +// } + var i = this.length; + while(i--){ + var attr = this[i]; + if(attr.nodeName == key){ + return attr; + } + } + }, + setNamedItem: function(attr) { + var el = attr.ownerElement; + if(el && el!=this._ownerElement){ + throw new DOMException(INUSE_ATTRIBUTE_ERR); + } + var oldAttr = this.getNamedItem(attr.nodeName); + _addNamedNode(this._ownerElement,this,attr,oldAttr); + return oldAttr; + }, + /* returns Node */ + setNamedItemNS: function(attr) {// raises: WRONG_DOCUMENT_ERR,NO_MODIFICATION_ALLOWED_ERR,INUSE_ATTRIBUTE_ERR + var el = attr.ownerElement, oldAttr; + if(el && el!=this._ownerElement){ + throw new DOMException(INUSE_ATTRIBUTE_ERR); + } + oldAttr = this.getNamedItemNS(attr.namespaceURI,attr.localName); + _addNamedNode(this._ownerElement,this,attr,oldAttr); + return oldAttr; + }, + + /* returns Node */ + removeNamedItem: function(key) { + var attr = this.getNamedItem(key); + _removeNamedNode(this._ownerElement,this,attr); + return attr; + + + },// raises: NOT_FOUND_ERR,NO_MODIFICATION_ALLOWED_ERR + + //for level2 + removeNamedItemNS:function(namespaceURI,localName){ + var attr = this.getNamedItemNS(namespaceURI,localName); + _removeNamedNode(this._ownerElement,this,attr); + return attr; + }, + getNamedItemNS: function(namespaceURI, localName) { + var i = this.length; + while(i--){ + var node = this[i]; + if(node.localName == localName && node.namespaceURI == namespaceURI){ + return node; + } + } + return null; + } +}; +/** + * @see http://www.w3.org/TR/REC-DOM-Level-1/level-one-core.html#ID-102161490 + */ +function DOMImplementation(/* Object */ features) { + this._features = {}; + if (features) { + for (var feature in features) { + this._features = features[feature]; + } + } +}; + +DOMImplementation.prototype = { + hasFeature: function(/* string */ feature, /* string */ version) { + var versions = this._features[feature.toLowerCase()]; + if (versions && (!version || version in versions)) { + return true; + } else { + return false; + } + }, + // Introduced in DOM Level 2: + createDocument:function(namespaceURI, qualifiedName, doctype){// raises:INVALID_CHARACTER_ERR,NAMESPACE_ERR,WRONG_DOCUMENT_ERR + var doc = new Document(); + doc.implementation = this; + doc.childNodes = new NodeList(); + doc.doctype = doctype; + if(doctype){ + doc.appendChild(doctype); + } + if(qualifiedName){ + var root = doc.createElementNS(namespaceURI,qualifiedName); + doc.appendChild(root); + } + return doc; + }, + // Introduced in DOM Level 2: + createDocumentType:function(qualifiedName, publicId, systemId){// raises:INVALID_CHARACTER_ERR,NAMESPACE_ERR + var node = new DocumentType(); + node.name = qualifiedName; + node.nodeName = qualifiedName; + node.publicId = publicId; + node.systemId = systemId; + // Introduced in DOM Level 2: + //readonly attribute DOMString internalSubset; + + //TODO:.. + // readonly attribute NamedNodeMap entities; + // readonly attribute NamedNodeMap notations; + return node; + } +}; + + +/** + * @see http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/core.html#ID-1950641247 + */ + +function Node() { +}; + +Node.prototype = { + firstChild : null, + lastChild : null, + previousSibling : null, + nextSibling : null, + attributes : null, + parentNode : null, + childNodes : null, + ownerDocument : null, + nodeValue : null, + namespaceURI : null, + prefix : null, + localName : null, + // Modified in DOM Level 2: + insertBefore:function(newChild, refChild){//raises + return _insertBefore(this,newChild,refChild); + }, + replaceChild:function(newChild, oldChild){//raises + this.insertBefore(newChild,oldChild); + if(oldChild){ + this.removeChild(oldChild); + } + }, + removeChild:function(oldChild){ + return _removeChild(this,oldChild); + }, + appendChild:function(newChild){ + return this.insertBefore(newChild,null); + }, + hasChildNodes:function(){ + return this.firstChild != null; + }, + cloneNode:function(deep){ + return cloneNode(this.ownerDocument||this,this,deep); + }, + // Modified in DOM Level 2: + normalize:function(){ + var child = this.firstChild; + while(child){ + var next = child.nextSibling; + if(next && next.nodeType == TEXT_NODE && child.nodeType == TEXT_NODE){ + this.removeChild(next); + child.appendData(next.data); + }else{ + child.normalize(); + child = next; + } + } + }, + // Introduced in DOM Level 2: + isSupported:function(feature, version){ + return this.ownerDocument.implementation.hasFeature(feature,version); + }, + // Introduced in DOM Level 2: + hasAttributes:function(){ + return this.attributes.length>0; + }, + lookupPrefix:function(namespaceURI){ + var el = this; + while(el){ + var map = el._nsMap; + //console.dir(map) + if(map){ + for(var n in map){ + if(map[n] == namespaceURI){ + return n; + } + } + } + el = el.nodeType == 2?el.ownerDocument : el.parentNode; + } + return null; + }, + // Introduced in DOM Level 3: + lookupNamespaceURI:function(prefix){ + var el = this; + while(el){ + var map = el._nsMap; + //console.dir(map) + if(map){ + if(prefix in map){ + return map[prefix] ; + } + } + el = el.nodeType == 2?el.ownerDocument : el.parentNode; + } + return null; + }, + // Introduced in DOM Level 3: + isDefaultNamespace:function(namespaceURI){ + var prefix = this.lookupPrefix(namespaceURI); + return prefix == null; + } +}; + + +function _xmlEncoder(c){ + return c == '<' && '<' || + c == '>' && '>' || + c == '&' && '&' || + c == '"' && '"' || + '&#'+c.charCodeAt()+';' +} + + +copy(NodeType,Node); +copy(NodeType,Node.prototype); + +/** + * @param callback return true for continue,false for break + * @return boolean true: break visit; + */ +function _visitNode(node,callback){ + if(callback(node)){ + return true; + } + if(node = node.firstChild){ + do{ + if(_visitNode(node,callback)){return true} + }while(node=node.nextSibling) + } +} + + + +function Document(){ +} +function _onAddAttribute(doc,el,newAttr){ + doc && doc._inc++; + var ns = newAttr.namespaceURI ; + if(ns == 'http://www.w3.org/2000/xmlns/'){ + //update namespace + el._nsMap[newAttr.prefix?newAttr.localName:''] = newAttr.value + } +} +function _onRemoveAttribute(doc,el,newAttr,remove){ + doc && doc._inc++; + var ns = newAttr.namespaceURI ; + if(ns == 'http://www.w3.org/2000/xmlns/'){ + //update namespace + delete el._nsMap[newAttr.prefix?newAttr.localName:''] + } +} +function _onUpdateChild(doc,el,newChild){ + if(doc && doc._inc){ + doc._inc++; + //update childNodes + var cs = el.childNodes; + if(newChild){ + cs[cs.length++] = newChild; + }else{ + //console.log(1) + var child = el.firstChild; + var i = 0; + while(child){ + cs[i++] = child; + child =child.nextSibling; + } + cs.length = i; + } + } +} + +/** + * attributes; + * children; + * + * writeable properties: + * nodeValue,Attr:value,CharacterData:data + * prefix + */ +function _removeChild(parentNode,child){ + var previous = child.previousSibling; + var next = child.nextSibling; + if(previous){ + previous.nextSibling = next; + }else{ + parentNode.firstChild = next + } + if(next){ + next.previousSibling = previous; + }else{ + parentNode.lastChild = previous; + } + _onUpdateChild(parentNode.ownerDocument,parentNode); + return child; +} +/** + * preformance key(refChild == null) + */ +function _insertBefore(parentNode,newChild,nextChild){ + var cp = newChild.parentNode; + if(cp){ + cp.removeChild(newChild);//remove and update + } + if(newChild.nodeType === DOCUMENT_FRAGMENT_NODE){ + var newFirst = newChild.firstChild; + if (newFirst == null) { + return newChild; + } + var newLast = newChild.lastChild; + }else{ + newFirst = newLast = newChild; + } + var pre = nextChild ? nextChild.previousSibling : parentNode.lastChild; + + newFirst.previousSibling = pre; + newLast.nextSibling = nextChild; + + + if(pre){ + pre.nextSibling = newFirst; + }else{ + parentNode.firstChild = newFirst; + } + if(nextChild == null){ + parentNode.lastChild = newLast; + }else{ + nextChild.previousSibling = newLast; + } + do{ + newFirst.parentNode = parentNode; + }while(newFirst !== newLast && (newFirst= newFirst.nextSibling)) + _onUpdateChild(parentNode.ownerDocument||parentNode,parentNode); + //console.log(parentNode.lastChild.nextSibling == null) + if (newChild.nodeType == DOCUMENT_FRAGMENT_NODE) { + newChild.firstChild = newChild.lastChild = null; + } + return newChild; +} +function _appendSingleChild(parentNode,newChild){ + var cp = newChild.parentNode; + if(cp){ + var pre = parentNode.lastChild; + cp.removeChild(newChild);//remove and update + var pre = parentNode.lastChild; + } + var pre = parentNode.lastChild; + newChild.parentNode = parentNode; + newChild.previousSibling = pre; + newChild.nextSibling = null; + if(pre){ + pre.nextSibling = newChild; + }else{ + parentNode.firstChild = newChild; + } + parentNode.lastChild = newChild; + _onUpdateChild(parentNode.ownerDocument,parentNode,newChild); + return newChild; + //console.log("__aa",parentNode.lastChild.nextSibling == null) +} +Document.prototype = { + //implementation : null, + nodeName : '#document', + nodeType : DOCUMENT_NODE, + doctype : null, + documentElement : null, + _inc : 1, + + insertBefore : function(newChild, refChild){//raises + if(newChild.nodeType == DOCUMENT_FRAGMENT_NODE){ + var child = newChild.firstChild; + while(child){ + var next = child.nextSibling; + this.insertBefore(child,refChild); + child = next; + } + return newChild; + } + if(this.documentElement == null && newChild.nodeType == 1){ + this.documentElement = newChild; + } + + return _insertBefore(this,newChild,refChild),(newChild.ownerDocument = this),newChild; + }, + removeChild : function(oldChild){ + if(this.documentElement == oldChild){ + this.documentElement = null; + } + return _removeChild(this,oldChild); + }, + // Introduced in DOM Level 2: + importNode : function(importedNode,deep){ + return importNode(this,importedNode,deep); + }, + // Introduced in DOM Level 2: + getElementById : function(id){ + var rtv = null; + _visitNode(this.documentElement,function(node){ + if(node.nodeType == 1){ + if(node.getAttribute('id') == id){ + rtv = node; + return true; + } + } + }) + return rtv; + }, + + //document factory method: + createElement : function(tagName){ + var node = new Element(); + node.ownerDocument = this; + node.nodeName = tagName; + node.tagName = tagName; + node.childNodes = new NodeList(); + var attrs = node.attributes = new NamedNodeMap(); + attrs._ownerElement = node; + return node; + }, + createDocumentFragment : function(){ + var node = new DocumentFragment(); + node.ownerDocument = this; + node.childNodes = new NodeList(); + return node; + }, + createTextNode : function(data){ + var node = new Text(); + node.ownerDocument = this; + node.appendData(data) + return node; + }, + createComment : function(data){ + var node = new Comment(); + node.ownerDocument = this; + node.appendData(data) + return node; + }, + createCDATASection : function(data){ + var node = new CDATASection(); + node.ownerDocument = this; + node.appendData(data) + return node; + }, + createProcessingInstruction : function(target,data){ + var node = new ProcessingInstruction(); + node.ownerDocument = this; + node.tagName = node.target = target; + node.nodeValue= node.data = data; + return node; + }, + createAttribute : function(name){ + var node = new Attr(); + node.ownerDocument = this; + node.name = name; + node.nodeName = name; + node.localName = name; + node.specified = true; + return node; + }, + createEntityReference : function(name){ + var node = new EntityReference(); + node.ownerDocument = this; + node.nodeName = name; + return node; + }, + // Introduced in DOM Level 2: + createElementNS : function(namespaceURI,qualifiedName){ + var node = new Element(); + var pl = qualifiedName.split(':'); + var attrs = node.attributes = new NamedNodeMap(); + node.childNodes = new NodeList(); + node.ownerDocument = this; + node.nodeName = qualifiedName; + node.tagName = qualifiedName; + node.namespaceURI = namespaceURI; + if(pl.length == 2){ + node.prefix = pl[0]; + node.localName = pl[1]; + }else{ + //el.prefix = null; + node.localName = qualifiedName; + } + attrs._ownerElement = node; + return node; + }, + // Introduced in DOM Level 2: + createAttributeNS : function(namespaceURI,qualifiedName){ + var node = new Attr(); + var pl = qualifiedName.split(':'); + node.ownerDocument = this; + node.nodeName = qualifiedName; + node.name = qualifiedName; + node.namespaceURI = namespaceURI; + node.specified = true; + if(pl.length == 2){ + node.prefix = pl[0]; + node.localName = pl[1]; + }else{ + //el.prefix = null; + node.localName = qualifiedName; + } + return node; + } +}; +_extends(Document,Node); + + +function Element() { + this._nsMap = {}; +}; +Element.prototype = { + nodeType : ELEMENT_NODE, + hasAttribute : function(name){ + return this.getAttributeNode(name)!=null; + }, + getAttribute : function(name){ + var attr = this.getAttributeNode(name); + return attr && attr.value || ''; + }, + getAttributeNode : function(name){ + return this.attributes.getNamedItem(name); + }, + setAttribute : function(name, value){ + var attr = this.ownerDocument.createAttribute(name); + attr.value = attr.nodeValue = "" + value; + this.setAttributeNode(attr) + }, + removeAttribute : function(name){ + var attr = this.getAttributeNode(name) + attr && this.removeAttributeNode(attr); + }, + + //four real opeartion method + appendChild:function(newChild){ + if(newChild.nodeType === DOCUMENT_FRAGMENT_NODE){ + return this.insertBefore(newChild,null); + }else{ + return _appendSingleChild(this,newChild); + } + }, + setAttributeNode : function(newAttr){ + return this.attributes.setNamedItem(newAttr); + }, + setAttributeNodeNS : function(newAttr){ + return this.attributes.setNamedItemNS(newAttr); + }, + removeAttributeNode : function(oldAttr){ + return this.attributes.removeNamedItem(oldAttr.nodeName); + }, + //get real attribute name,and remove it by removeAttributeNode + removeAttributeNS : function(namespaceURI, localName){ + var old = this.getAttributeNodeNS(namespaceURI, localName); + old && this.removeAttributeNode(old); + }, + + hasAttributeNS : function(namespaceURI, localName){ + return this.getAttributeNodeNS(namespaceURI, localName)!=null; + }, + getAttributeNS : function(namespaceURI, localName){ + var attr = this.getAttributeNodeNS(namespaceURI, localName); + return attr && attr.value || ''; + }, + setAttributeNS : function(namespaceURI, qualifiedName, value){ + var attr = this.ownerDocument.createAttributeNS(namespaceURI, qualifiedName); + attr.value = attr.nodeValue = "" + value; + this.setAttributeNode(attr) + }, + getAttributeNodeNS : function(namespaceURI, localName){ + return this.attributes.getNamedItemNS(namespaceURI, localName); + }, + + getElementsByTagName : function(tagName){ + return new LiveNodeList(this,function(base){ + var ls = []; + _visitNode(base,function(node){ + if(node !== base && node.nodeType == ELEMENT_NODE && (tagName === '*' || node.tagName == tagName)){ + ls.push(node); + } + }); + return ls; + }); + }, + getElementsByTagNameNS : function(namespaceURI, localName){ + return new LiveNodeList(this,function(base){ + var ls = []; + _visitNode(base,function(node){ + if(node !== base && node.nodeType === ELEMENT_NODE && (namespaceURI === '*' || node.namespaceURI === namespaceURI) && (localName === '*' || node.localName == localName)){ + ls.push(node); + } + }); + return ls; + }); + } +}; +Document.prototype.getElementsByTagName = Element.prototype.getElementsByTagName; +Document.prototype.getElementsByTagNameNS = Element.prototype.getElementsByTagNameNS; + + +_extends(Element,Node); +function Attr() { +}; +Attr.prototype.nodeType = ATTRIBUTE_NODE; +_extends(Attr,Node); + + +function CharacterData() { +}; +CharacterData.prototype = { + data : '', + substringData : function(offset, count) { + return this.data.substring(offset, offset+count); + }, + appendData: function(text) { + text = this.data+text; + this.nodeValue = this.data = text; + this.length = text.length; + }, + insertData: function(offset,text) { + this.replaceData(offset,0,text); + + }, + appendChild:function(newChild){ + //if(!(newChild instanceof CharacterData)){ + throw new Error(ExceptionMessage[3]) + //} + return Node.prototype.appendChild.apply(this,arguments) + }, + deleteData: function(offset, count) { + this.replaceData(offset,count,""); + }, + replaceData: function(offset, count, text) { + var start = this.data.substring(0,offset); + var end = this.data.substring(offset+count); + text = start + text + end; + this.nodeValue = this.data = text; + this.length = text.length; + } +} +_extends(CharacterData,Node); +function Text() { +}; +Text.prototype = { + nodeName : "#text", + nodeType : TEXT_NODE, + splitText : function(offset) { + var text = this.data; + var newText = text.substring(offset); + text = text.substring(0, offset); + this.data = this.nodeValue = text; + this.length = text.length; + var newNode = this.ownerDocument.createTextNode(newText); + if(this.parentNode){ + this.parentNode.insertBefore(newNode, this.nextSibling); + } + return newNode; + } +} +_extends(Text,CharacterData); +function Comment() { +}; +Comment.prototype = { + nodeName : "#comment", + nodeType : COMMENT_NODE +} +_extends(Comment,CharacterData); + +function CDATASection() { +}; +CDATASection.prototype = { + nodeName : "#cdata-section", + nodeType : CDATA_SECTION_NODE +} +_extends(CDATASection,CharacterData); + + +function DocumentType() { +}; +DocumentType.prototype.nodeType = DOCUMENT_TYPE_NODE; +_extends(DocumentType,Node); + +function Notation() { +}; +Notation.prototype.nodeType = NOTATION_NODE; +_extends(Notation,Node); + +function Entity() { +}; +Entity.prototype.nodeType = ENTITY_NODE; +_extends(Entity,Node); + +function EntityReference() { +}; +EntityReference.prototype.nodeType = ENTITY_REFERENCE_NODE; +_extends(EntityReference,Node); + +function DocumentFragment() { +}; +DocumentFragment.prototype.nodeName = "#document-fragment"; +DocumentFragment.prototype.nodeType = DOCUMENT_FRAGMENT_NODE; +_extends(DocumentFragment,Node); + + +function ProcessingInstruction() { +} +ProcessingInstruction.prototype.nodeType = PROCESSING_INSTRUCTION_NODE; +_extends(ProcessingInstruction,Node); +function XMLSerializer(){} +XMLSerializer.prototype.serializeToString = function(node,attributeSorter){ + return node.toString(attributeSorter); +} +Node.prototype.toString =function(attributeSorter){ + var buf = []; + serializeToString(this,buf,attributeSorter); + return buf.join(''); +} +function serializeToString(node,buf,attributeSorter,isHTML){ + switch(node.nodeType){ + case ELEMENT_NODE: + var attrs = node.attributes; + var len = attrs.length; + var child = node.firstChild; + var nodeName = node.tagName; + isHTML = (htmlns === node.namespaceURI) ||isHTML + buf.push('<',nodeName); + if(attributeSorter){ + buf.sort.apply(attrs, attributeSorter); + } + for(var i=0;i'); + //if is cdata child node + if(isHTML && /^script$/i.test(nodeName)){ + if(child){ + buf.push(child.data); + } + }else{ + while(child){ + serializeToString(child,buf,attributeSorter,isHTML); + child = child.nextSibling; + } + } + buf.push(''); + }else{ + buf.push('/>'); + } + return; + case DOCUMENT_NODE: + case DOCUMENT_FRAGMENT_NODE: + var child = node.firstChild; + while(child){ + serializeToString(child,buf,attributeSorter,isHTML); + child = child.nextSibling; + } + return; + case ATTRIBUTE_NODE: + return buf.push(' ',node.name,'="',node.value.replace(/[<&"]/g,_xmlEncoder),'"'); + case TEXT_NODE: + return buf.push(node.data.replace(/[<&]/g,_xmlEncoder)); + case CDATA_SECTION_NODE: + return buf.push( ''); + case COMMENT_NODE: + return buf.push( ""); + case DOCUMENT_TYPE_NODE: + var pubid = node.publicId; + var sysid = node.systemId; + buf.push(''); + }else if(sysid && sysid!='.'){ + buf.push(' SYSTEM "',sysid,'">'); + }else{ + var sub = node.internalSubset; + if(sub){ + buf.push(" [",sub,"]"); + } + buf.push(">"); + } + return; + case PROCESSING_INSTRUCTION_NODE: + return buf.push( ""); + case ENTITY_REFERENCE_NODE: + return buf.push( '&',node.nodeName,';'); + //case ENTITY_NODE: + //case NOTATION_NODE: + default: + buf.push('??',node.nodeName); + } +} +function importNode(doc,node,deep){ + var node2; + switch (node.nodeType) { + case ELEMENT_NODE: + node2 = node.cloneNode(false); + node2.ownerDocument = doc; + //var attrs = node2.attributes; + //var len = attrs.length; + //for(var i=0;inpm install xmldom + +Example: +==== +```javascript +var DOMParser = require('xmldom').DOMParser; +var doc = new DOMParser().parseFromString( + '\n'+ + '\ttest\n'+ + '\t\n'+ + '\t\n'+ + '' + ,'text/xml'); +doc.documentElement.setAttribute('x','y'); +doc.documentElement.setAttributeNS('./lite','c:x','y2'); +var nsAttr = doc.documentElement.getAttributeNS('./lite','x') +console.info(nsAttr) +console.info(doc) +``` +API Reference +===== + + * [DOMParser](https://developer.mozilla.org/en/DOMParser): + + ```javascript + parseFromString(xmlsource,mimeType) + ``` + * **options extension** _by xmldom_(not BOM standard!!) + + ```javascript + //added the options argument + new DOMParser(options) + + //errorHandler is supported + new DOMParser({ + /** + * locator is always need for error position info + */ + locator:{}, + /** + * you can override the errorHandler for xml parser + * @link http://www.saxproject.org/apidoc/org/xml/sax/ErrorHandler.html + */ + errorHandler:{warning:function(w){console.warn(w)},error:callback,fatalError:callback} + //only callback model + //errorHandler:function(level,msg){console.log(level,msg)} + }) + + ``` + + * [XMLSerializer](https://developer.mozilla.org/en/XMLSerializer) + + ```javascript + serializeToString(node) + ``` +DOM level2 method and attribute: +------ + + * [Node](http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/core.html#ID-1950641247) + + attribute: + nodeValue|prefix + readonly attribute: + nodeName|nodeType|parentNode|childNodes|firstChild|lastChild|previousSibling|nextSibling|attributes|ownerDocument|namespaceURI|localName + method: + insertBefore(newChild, refChild) + replaceChild(newChild, oldChild) + removeChild(oldChild) + appendChild(newChild) + hasChildNodes() + cloneNode(deep) + normalize() + isSupported(feature, version) + hasAttributes() + + * [DOMImplementation](http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/core.html#ID-102161490) + + method: + hasFeature(feature, version) + createDocumentType(qualifiedName, publicId, systemId) + createDocument(namespaceURI, qualifiedName, doctype) + + * [Document](http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/core.html#i-Document) : Node + + readonly attribute: + doctype|implementation|documentElement + method: + createElement(tagName) + createDocumentFragment() + createTextNode(data) + createComment(data) + createCDATASection(data) + createProcessingInstruction(target, data) + createAttribute(name) + createEntityReference(name) + getElementsByTagName(tagname) + importNode(importedNode, deep) + createElementNS(namespaceURI, qualifiedName) + createAttributeNS(namespaceURI, qualifiedName) + getElementsByTagNameNS(namespaceURI, localName) + getElementById(elementId) + + * [DocumentFragment](http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/core.html#ID-B63ED1A3) : Node + * [Element](http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/core.html#ID-745549614) : Node + + readonly attribute: + tagName + method: + getAttribute(name) + setAttribute(name, value) + removeAttribute(name) + getAttributeNode(name) + setAttributeNode(newAttr) + removeAttributeNode(oldAttr) + getElementsByTagName(name) + getAttributeNS(namespaceURI, localName) + setAttributeNS(namespaceURI, qualifiedName, value) + removeAttributeNS(namespaceURI, localName) + getAttributeNodeNS(namespaceURI, localName) + setAttributeNodeNS(newAttr) + getElementsByTagNameNS(namespaceURI, localName) + hasAttribute(name) + hasAttributeNS(namespaceURI, localName) + + * [Attr](http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/core.html#ID-637646024) : Node + + attribute: + value + readonly attribute: + name|specified|ownerElement + + * [NodeList](http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/core.html#ID-536297177) + + readonly attribute: + length + method: + item(index) + + * [NamedNodeMap](http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/core.html#ID-1780488922) + + readonly attribute: + length + method: + getNamedItem(name) + setNamedItem(arg) + removeNamedItem(name) + item(index) + getNamedItemNS(namespaceURI, localName) + setNamedItemNS(arg) + removeNamedItemNS(namespaceURI, localName) + + * [CharacterData](http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/core.html#ID-FF21A306) : Node + + method: + substringData(offset, count) + appendData(arg) + insertData(offset, arg) + deleteData(offset, count) + replaceData(offset, count, arg) + + * [Text](http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/core.html#ID-1312295772) : CharacterData + + method: + splitText(offset) + + * [CDATASection](http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/core.html#ID-667469212) + * [Comment](http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/core.html#ID-1728279322) : CharacterData + + * [DocumentType](http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/core.html#ID-412266927) + + readonly attribute: + name|entities|notations|publicId|systemId|internalSubset + + * Notation : Node + + readonly attribute: + publicId|systemId + + * Entity : Node + + readonly attribute: + publicId|systemId|notationName + + * EntityReference : Node + * ProcessingInstruction : Node + + attribute: + data + readonly attribute: + target + +DOM level 3 support: +----- + + * [Node](http://www.w3.org/TR/DOM-Level-3-Core/core.html#Node3-textContent) + + attribute: + textContent + method: + isDefaultNamespace(namespaceURI){ + lookupNamespaceURI(prefix) + +DOM extension by xmldom +--- + * [Node] Source position extension; + + attribute: + //Numbered starting from '1' + lineNumber + //Numbered starting from '1' + columnNumber diff --git a/plugins/tiddlywiki/xmldom/files/sax.js b/plugins/tiddlywiki/xmldom/files/sax.js new file mode 100644 index 000000000..127963f8a --- /dev/null +++ b/plugins/tiddlywiki/xmldom/files/sax.js @@ -0,0 +1,586 @@ +//[4] NameStartChar ::= ":" | [A-Z] | "_" | [a-z] | [#xC0-#xD6] | [#xD8-#xF6] | [#xF8-#x2FF] | [#x370-#x37D] | [#x37F-#x1FFF] | [#x200C-#x200D] | [#x2070-#x218F] | [#x2C00-#x2FEF] | [#x3001-#xD7FF] | [#xF900-#xFDCF] | [#xFDF0-#xFFFD] | [#x10000-#xEFFFF] +//[4a] NameChar ::= NameStartChar | "-" | "." | [0-9] | #xB7 | [#x0300-#x036F] | [#x203F-#x2040] +//[5] Name ::= NameStartChar (NameChar)* +var nameStartChar = /[A-Z_a-z\xC0-\xD6\xD8-\xF6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]///\u10000-\uEFFFF +var nameChar = new RegExp("[\\-\\.0-9"+nameStartChar.source.slice(1,-1)+"\u00B7\u0300-\u036F\\u203F-\u2040]"); +var tagNamePattern = new RegExp('^'+nameStartChar.source+nameChar.source+'*(?:\:'+nameStartChar.source+nameChar.source+'*)?$'); +//var tagNamePattern = /^[a-zA-Z_][\w\-\.]*(?:\:[a-zA-Z_][\w\-\.]*)?$/ +//var handlers = 'resolveEntity,getExternalSubset,characters,endDocument,endElement,endPrefixMapping,ignorableWhitespace,processingInstruction,setDocumentLocator,skippedEntity,startDocument,startElement,startPrefixMapping,notationDecl,unparsedEntityDecl,error,fatalError,warning,attributeDecl,elementDecl,externalEntityDecl,internalEntityDecl,comment,endCDATA,endDTD,endEntity,startCDATA,startDTD,startEntity'.split(',') + +//S_TAG, S_ATTR, S_EQ, S_V +//S_ATTR_S, S_E, S_S, S_C +var S_TAG = 0;//tag name offerring +var S_ATTR = 1;//attr name offerring +var S_ATTR_S=2;//attr name end and space offer +var S_EQ = 3;//=space? +var S_V = 4;//attr value(no quot value only) +var S_E = 5;//attr value end and no space(quot end) +var S_S = 6;//(attr value end || tag end ) && (space offer) +var S_C = 7;//closed el + +function XMLReader(){ + +} + +XMLReader.prototype = { + parse:function(source,defaultNSMap,entityMap){ + var domBuilder = this.domBuilder; + domBuilder.startDocument(); + _copy(defaultNSMap ,defaultNSMap = {}) + parse(source,defaultNSMap,entityMap, + domBuilder,this.errorHandler); + domBuilder.endDocument(); + } +} +function parse(source,defaultNSMapCopy,entityMap,domBuilder,errorHandler){ + function fixedFromCharCode(code) { + // String.prototype.fromCharCode does not supports + // > 2 bytes unicode chars directly + if (code > 0xffff) { + code -= 0x10000; + var surrogate1 = 0xd800 + (code >> 10) + , surrogate2 = 0xdc00 + (code & 0x3ff); + + return String.fromCharCode(surrogate1, surrogate2); + } else { + return String.fromCharCode(code); + } + } + function entityReplacer(a){ + var k = a.slice(1,-1); + if(k in entityMap){ + return entityMap[k]; + }else if(k.charAt(0) === '#'){ + return fixedFromCharCode(parseInt(k.substr(1).replace('x','0x'))) + }else{ + errorHandler.error('entity not found:'+a); + return a; + } + } + function appendText(end){//has some bugs + if(end>start){ + var xt = source.substring(start,end).replace(/&#?\w+;/g,entityReplacer); + locator&&position(start); + domBuilder.characters(xt,0,end-start); + start = end + } + } + function position(p,m){ + while(p>=lineEnd && (m = linePattern.exec(source))){ + lineStart = m.index; + lineEnd = lineStart + m[0].length; + locator.lineNumber++; + //console.log('line++:',locator,startPos,endPos) + } + locator.columnNumber = p-lineStart+1; + } + var lineStart = 0; + var lineEnd = 0; + var linePattern = /.+(?:\r\n?|\n)|.*$/g + var locator = domBuilder.locator; + + var parseStack = [{currentNSMap:defaultNSMapCopy}] + var closeMap = {}; + var start = 0; + while(true){ + try{ + var tagStart = source.indexOf('<',start); + if(tagStart<0){ + if(!source.substr(start).match(/^\s*$/)){ + var doc = domBuilder.document; + var text = doc.createTextNode(source.substr(start)); + doc.appendChild(text); + domBuilder.currentElement = text; + } + return; + } + if(tagStart>start){ + appendText(tagStart); + } + switch(source.charAt(tagStart+1)){ + case '/': + var end = source.indexOf('>',tagStart+3); + var tagName = source.substring(tagStart+2,end); + var config = parseStack.pop(); + var localNSMap = config.localNSMap; + if(config.tagName != tagName){ + errorHandler.fatalError("end tag name: "+tagName+' is not match the current start tagName:'+config.tagName ); + } + domBuilder.endElement(config.uri,config.localName,tagName); + if(localNSMap){ + for(var prefix in localNSMap){ + domBuilder.endPrefixMapping(prefix) ; + } + } + end++; + break; + // end elment + case '?':// + locator&&position(tagStart); + end = parseInstruction(source,tagStart,domBuilder); + break; + case '!':// start){ + start = end; + }else{ + //TODO: 这里有可能sax回退,有位置错误风险 + appendText(Math.max(tagStart,start)+1); + } + } +} +function copyLocator(f,t){ + t.lineNumber = f.lineNumber; + t.columnNumber = f.columnNumber; + return t; +} + +/** + * @see #appendElement(source,elStartEnd,el,selfClosed,entityReplacer,domBuilder,parseStack); + * @return end of the elementStartPart(end of elementEndPart for selfClosed el) + */ +function parseElementStartPart(source,start,el,entityReplacer,errorHandler){ + var attrName; + var value; + var p = ++start; + var s = S_TAG;//status + while(true){ + var c = source.charAt(p); + switch(c){ + case '=': + if(s === S_ATTR){//attrName + attrName = source.slice(start,p); + s = S_EQ; + }else if(s === S_ATTR_S){ + s = S_EQ; + }else{ + //fatalError: equal must after attrName or space after attrName + throw new Error('attribute equal must after attrName'); + } + break; + case '\'': + case '"': + if(s === S_EQ){//equal + start = p+1; + p = source.indexOf(c,start) + if(p>0){ + value = source.slice(start,p).replace(/&#?\w+;/g,entityReplacer); + el.add(attrName,value,start-1); + s = S_E; + }else{ + //fatalError: no end quot match + throw new Error('attribute value no end \''+c+'\' match'); + } + }else if(s == S_V){ + value = source.slice(start,p).replace(/&#?\w+;/g,entityReplacer); + //console.log(attrName,value,start,p) + el.add(attrName,value,start); + //console.dir(el) + errorHandler.warning('attribute "'+attrName+'" missed start quot('+c+')!!'); + start = p+1; + s = S_E + }else{ + //fatalError: no equal before + throw new Error('attribute value must after "="'); + } + break; + case '/': + switch(s){ + case S_TAG: + el.setTagName(source.slice(start,p)); + case S_E: + case S_S: + case S_C: + s = S_C; + el.closed = true; + case S_V: + case S_ATTR: + case S_ATTR_S: + break; + //case S_EQ: + default: + throw new Error("attribute invalid close char('/')") + } + break; + case ''://end document + //throw new Error('unexpected end of input') + errorHandler.error('unexpected end of input'); + case '>': + switch(s){ + case S_TAG: + el.setTagName(source.slice(start,p)); + case S_E: + case S_S: + case S_C: + break;//normal + case S_V://Compatible state + case S_ATTR: + value = source.slice(start,p); + if(value.slice(-1) === '/'){ + el.closed = true; + value = value.slice(0,-1) + } + case S_ATTR_S: + if(s === S_ATTR_S){ + value = attrName; + } + if(s == S_V){ + errorHandler.warning('attribute "'+value+'" missed quot(")!!'); + el.add(attrName,value.replace(/&#?\w+;/g,entityReplacer),start) + }else{ + errorHandler.warning('attribute "'+value+'" missed value!! "'+value+'" instead!!') + el.add(value,value,start) + } + break; + case S_EQ: + throw new Error('attribute value missed!!'); + } +// console.log(tagName,tagNamePattern,tagNamePattern.test(tagName)) + return p; + /*xml space '\x20' | #x9 | #xD | #xA; */ + case '\u0080': + c = ' '; + default: + if(c<= ' '){//space + switch(s){ + case S_TAG: + el.setTagName(source.slice(start,p));//tagName + s = S_S; + break; + case S_ATTR: + attrName = source.slice(start,p) + s = S_ATTR_S; + break; + case S_V: + var value = source.slice(start,p).replace(/&#?\w+;/g,entityReplacer); + errorHandler.warning('attribute "'+value+'" missed quot(")!!'); + el.add(attrName,value,start) + case S_E: + s = S_S; + break; + //case S_S: + //case S_EQ: + //case S_ATTR_S: + // void();break; + //case S_C: + //ignore warning + } + }else{//not space +//S_TAG, S_ATTR, S_EQ, S_V +//S_ATTR_S, S_E, S_S, S_C + switch(s){ + //case S_TAG:void();break; + //case S_ATTR:void();break; + //case S_V:void();break; + case S_ATTR_S: + errorHandler.warning('attribute "'+attrName+'" missed value!! "'+attrName+'" instead!!') + el.add(attrName,attrName,start); + start = p; + s = S_ATTR; + break; + case S_E: + errorHandler.warning('attribute space is required"'+attrName+'"!!') + case S_S: + s = S_ATTR; + start = p; + break; + case S_EQ: + s = S_V; + start = p; + break; + case S_C: + throw new Error("elements closed character '/' and '>' must be connected to"); + } + } + } + p++; + } +} +/** + * @return end of the elementStartPart(end of elementEndPart for selfClosed el) + */ +function appendElement(el,domBuilder,parseStack){ + var tagName = el.tagName; + var localNSMap = null; + var currentNSMap = parseStack[parseStack.length-1].currentNSMap; + var i = el.length; + while(i--){ + var a = el[i]; + var qName = a.qName; + var value = a.value; + var nsp = qName.indexOf(':'); + if(nsp>0){ + var prefix = a.prefix = qName.slice(0,nsp); + var localName = qName.slice(nsp+1); + var nsPrefix = prefix === 'xmlns' && localName + }else{ + localName = qName; + prefix = null + nsPrefix = qName === 'xmlns' && '' + } + //can not set prefix,because prefix !== '' + a.localName = localName ; + //prefix == null for no ns prefix attribute + if(nsPrefix !== false){//hack!! + if(localNSMap == null){ + localNSMap = {} + //console.log(currentNSMap,0) + _copy(currentNSMap,currentNSMap={}) + //console.log(currentNSMap,1) + } + currentNSMap[nsPrefix] = localNSMap[nsPrefix] = value; + a.uri = 'http://www.w3.org/2000/xmlns/' + domBuilder.startPrefixMapping(nsPrefix, value) + } + } + var i = el.length; + while(i--){ + a = el[i]; + var prefix = a.prefix; + if(prefix){//no prefix attribute has no namespace + if(prefix === 'xml'){ + a.uri = 'http://www.w3.org/XML/1998/namespace'; + }if(prefix !== 'xmlns'){ + a.uri = currentNSMap[prefix] + + //{console.log('###'+a.qName,domBuilder.locator.systemId+'',currentNSMap,a.uri)} + } + } + } + var nsp = tagName.indexOf(':'); + if(nsp>0){ + prefix = el.prefix = tagName.slice(0,nsp); + localName = el.localName = tagName.slice(nsp+1); + }else{ + prefix = null;//important!! + localName = el.localName = tagName; + } + //no prefix element has default namespace + var ns = el.uri = currentNSMap[prefix || '']; + domBuilder.startElement(ns,localName,tagName,el); + //endPrefixMapping and startPrefixMapping have not any help for dom builder + //localNSMap = null + if(el.closed){ + domBuilder.endElement(ns,localName,tagName); + if(localNSMap){ + for(prefix in localNSMap){ + domBuilder.endPrefixMapping(prefix) + } + } + }else{ + el.currentNSMap = currentNSMap; + el.localNSMap = localNSMap; + parseStack.push(el); + } +} +function parseHtmlSpecialContent(source,elStartEnd,tagName,entityReplacer,domBuilder){ + if(/^(?:script|textarea)$/i.test(tagName)){ + var elEndStart = source.indexOf('',elStartEnd); + var text = source.substring(elStartEnd+1,elEndStart); + if(/[&<]/.test(text)){ + if(/^script$/i.test(tagName)){ + //if(!/\]\]>/.test(text)){ + //lexHandler.startCDATA(); + domBuilder.characters(text,0,text.length); + //lexHandler.endCDATA(); + return elEndStart; + //} + }//}else{//text area + text = text.replace(/&#?\w+;/g,entityReplacer); + domBuilder.characters(text,0,text.length); + return elEndStart; + //} + + } + } + return elStartEnd+1; +} +function fixSelfClosed(source,elStartEnd,tagName,closeMap){ + //if(tagName in closeMap){ + var pos = closeMap[tagName]; + if(pos == null){ + //console.log(tagName) + pos = closeMap[tagName] = source.lastIndexOf('') + } + return pos',start+4); + //append comment source.substring(4,end)//