Deno's node emulation can run TiddlyWiki now that it supports the VM isolates API, but the window global exists in that environment, so both browser and node were being detected, causing the autoboot to trip up on nonexistent argv, as the boot was happening in the constructor right before argv was set.
Ref: https://github.com/denoland/deno/issues/19286
Ref: https://github.com/flexdinesh/browser-or-node
* refactor: use files to add prefix
* fix: always use $tw.sjcl
* refactor: move sjcl to lib/sjcl
* fix: require sjcl in lib/
* refactor: move sjcl.js back into /boot
* Run modules in one new context
* Fix polyfill running on require
* Add code to check for global assignments
* Allow globals in separate context
This lets the caller request a separate context which may be polluted.
* Jasmine needs to pollute the global
* Formatting
* Add polyfill and cleanup code
* Convert to ES5
* One bug fix
* Some formatting
* Remove console.log line!
* Cleanup
* revert css-escape-polyfill.js to hopefully remove it from the PR
* Remove JSDOC directives
* Add 'filepath' source attribute to tiddlywiki.files
Adds a new source attribute to facilitate importing subdirectories with
the `searchSubdirectories` attribute.
The `filepath` atttribute is like `filename` except it includes the full
pathname relative to the directory path. Consequently it only works with
`directories` sections (not `tiddlers`).
* Add `subdirectories` source attribute to tiddlywiki.files
Adds another new source attribute to facilitate importing subdirectories
with the `searchSubdirectories` attribute.
The `subdirectories` source attribute is only usable with `directories`
sections (not `tiddlers`). It resolves to an array containing all the
directories in the file's path relative to the directory path. Eg, if
the directory path is `files`, `{ source: 'subdirectories' }` for a file
in `files/images/photos` would resolve to `['images', 'photos'].
This commit also adds an example to the "tiddlywiki.files Files"
documentation tiddler that demonstrates using the `filepath` and
`subdirectories` source attributes to import and auto-tag image files
as external-image tiddlers.
* Failing test
* Fix underlying problem
* Less naive fix
Now we make sure we maintain the sort order of the titles array when adding a new tiddler
* Fix failing tests
* Refactor filter tests to repeat them with different store orderings
* Revert "Fix failing tests"
This reverts commit ee03ee57f5.
* Refine fix to retain stylesheet ordering
The order of tiddlers in the HTML file uses localeCompare(), and that determines the insertion order. So if we want to be compatible with older versions we have to use localeCompare() to order tiddlers, not a plain sort()
* Don't sort shadow tiddlers
Instead rely on the existing ordering
* Fix failing tests, take 2
I think that all of these changes are explained by the store no longer retaining insertion order, but now using localecompare ordering
* Fix tests from #6327
* Add support for JSON-formatted tiddler store, and make it the default
The change to `getTiddlersAsJson()` is to allow experimentation
* Move JSON tiddlers into their own store area, and fix support for encrypted tiddlers
Also add a dummy old-style store area for backwards compatibility
The current arrangement is that JSON tiddlers will always override old-style tiddlers.
* Use the deserialiser mechanism to decode the content
* Refactor $:/core/modules/deserializers.js before we start extending it
Cleaning up the helper function names and ordering
* Drop support for the "systemArea" div
It was only used in really old v5.0.x
* Update deserializer to support JSON store format and add some tests
* Life UI restrictions on characters in fieldnames
* Add another test case
* Correct mis-merge
* Remove toLowerCase() methods applied to fieldnames
* Insert line breaks in output of getTiddlersAsJson (#5786)
Rather than have the entire store on one line, insert a line break
after each tiddler.
* Refactor #5786 for backwards compatibility
* Only read .tiddlywiki-tiddler-store blocks from script tags
Prompted by @simonbaird's comment here: https://github.com/Jermolene/TiddlyWiki5/pull/5708#discussion_r648833367
* Clean up escaping of unsafe script characters
It seems that escaping `<` is sufficient
* Add docs from @saqimtiaz
Thanks @saqimtiaz
* Docs tweaks
* Remove excess whitespace
Thanks @simonbaird
* Fix templates for lazy loading
* Remove obsolete item from release note
* Clean up whitespace
* Docs for the jsontiddler widget
* Fix whitespace
Fixes#5840
* Comments
* Fix newlines in JSON store area
* Remove obsolete docs change
Co-authored-by: Simon Baird <simon.baird@gmail.com>
* Replace css-escape-polyfill.js with escapecss.js utility module
* Add $tw.utils.escapeCSS() method and invoke that function within the
escapecss operator.
* Add test cases for the "escapecss" filter operator
* Fix $tw.boot.doesTaskMatchPlatform() so it works as expected if
a module's export.platforms contains more than one values
* Add missed files to the last commit
We can now pass arrays of rule classes to the parser constructor, overriding the rules that would normally be used by the parser.
This allows us to create custom variants of the wikitext parser with their own content type.
It could also provide a basis for a new Markdown parser based on our existing wikitext parser but with new rules.