Commit Graph

23 Commits

Author SHA1 Message Date
Jeremy Ruston d455072f13
Add support for JSON-formatted tiddler store, and make it the default (#5708)
* 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>
2021-07-14 09:15:30 +01:00
Joe Bordes 82ec63e711
style(App) eliminate whitespace at the end of code lines (#5735) 2021-05-30 19:20:17 +01:00
Jermolene 779e62a30f Add support for JSON files containing a single tiddler
At the moment, we support JSON files containing an array of tiddlers.
With this change the core will import files containing a single
tiddler. Also adding templates for saving individual tiddlers in JSON
format
2017-03-17 14:19:43 +00:00
Jermolene 892a1f560e Trap JSON syntax errors during import
Fixes #2609
2016-10-13 14:16:55 +01:00
Jermolene 4bf6fe7fe9 Fix JSON deserialiser to allow all fields
Previously we were filtering to a small set of known fields (which was
implemented at the beginning of TW5 as part of the build process for
TW2).
2014-11-13 16:04:30 +00:00
Jermolene 3a67fdb768 Obeisance to JSHint for core modules
There are still some warnings about making functions in a loop, but
I’ll fix those as a separate pull request because the fixes are more
than typographic errors.
2014-08-30 20:44:26 +01:00
Jermolene 86d182fd51 Fix importing blank fields from TiddlyWiki files 2014-05-26 17:47:07 +01:00
Jermolene bced7124e4 Accept single quotes for attributes in TW files 2014-05-01 17:58:49 +01:00
Jermolene ed5cf8b044 Refactor importing of encrypted TiddlyWiki files so that it works on Node.js 2014-01-19 20:13:55 +00:00
Jermolene 10c25c1692 Fix slow regexp in importing TiddlyWiki HTML files 2013-12-23 08:54:33 +00:00
Jermolene 2d1d53893a Adjust regex to work around an issue with importing certain tiddlers on Firefox 2013-12-22 11:28:03 +00:00
Jermolene 7a4abba9fd Ensure system tiddlers are imported
We no longer generate a separate “systemArea” for system tiddlers but
we still need to import it for older wikis
2013-12-02 09:57:54 +00:00
Jeremy Ruston 3d5d5952b7 Fix broken regexps
Using .|\n was a very bad idea, as it doesn't match other newline
characters
2013-09-18 19:09:54 +01:00
Jeremy Ruston dfb49f811e Fixed problem with importing tiddlers with double quotes, gt, lt etc
Reported by @giffmex
2013-08-28 09:25:54 +01:00
Jeremy Ruston 779d8b3aad Update TW2 wikitext content type to `text/x-tiddlywiki`
And also stop assigning the default content type of
`text/vnd.tiddlywiki` to imported tiddlers.
2013-08-25 22:06:28 +01:00
Jeremy Ruston 6864251962 Cleaning up content types
Dealt with some inconsistencies
2013-05-13 17:42:07 +01:00
Jeremy Ruston 6c210df0bd Update HTML deserializer to cope with TiddlyWiki classic and TW5 files 2013-04-03 12:57:17 +01:00
Jeremy Ruston f07bc18204 More MIME type shenanigans 2012-11-18 15:25:40 +00:00
Jeremy Ruston daff9c10f3 Tighten terminology for plugins vs. modules
"Plugins" are bundles of tiddlers managed as one, "modules" are
JavaScript tiddlers with a module type identifying when and how they
should be executed.
2012-08-03 15:09:48 +01:00
Jeremy Ruston ea6d7f5c08 Fixed a long standing issue with javascript module tiddlers being truncated
Ouch!
2012-07-10 23:17:39 +01:00
Jeremy Ruston 2053b7c413 Moved loading of core shadow tiddlers into the boot kernel 2012-06-06 21:42:14 +01:00
Jeremy Ruston 61936d4640 Restore further tiddler deserializers 2012-05-29 21:58:57 +01:00
Jeremy Ruston 9465da4335 Part two of turning the rabbit hole inside out 2012-05-05 22:57:21 +01:00