1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-11-27 12:07:19 +00:00
Commit Graph

276 Commits

Author SHA1 Message Date
Jermolene
a9411262f7 Improve TiddlyWiki as a library
1. Make it possible to disable specific boot tasks
2. Extend the startup mechanism to allow startup tasks to be disabled

Again, see Jermolene/TiddlyWiki5NodeWebkit to see how these features
fit together.
2014-05-07 12:51:16 +01:00
Jermolene
e676156b24 Fixes for running TiddlyWiki on node-webkit
See Jermolene/TiddlyWiki5NodeWebkit
2014-05-07 09:59:21 +01:00
natecain
6b03789e06 Prioritize "module.exports" over "exports" in require sandbox
(Node-ism, inherited (temporarily?) to support codemirror upgrade)
2014-05-06 23:31:57 +02:00
Jermolene
76e8640c31 Fix problem with parsing lists contain non-breaking spaces
Some of the time we need to treat non-breaking spaces as though they
are not spaces (regexps treat them as spaces by default).
2014-05-06 18:10:27 +01:00
Jermolene
cc3d44aec1 Fix problem with list fields containing [[]]
Fixes #603 - thanks @xcazin!

It no longer crashes but unfortunately if you round trip a tiddler out
of edit mode and back you’ll lose any empty double square brackets.
2014-05-06 17:32:12 +01:00
Jermolene
986a20b22b Fixes for permalinks not working on Firefox
Sigh. It’s frustrating that the few browser differences I’m running
into in 2014 are mostly horribly familiar from 2005
2014-05-05 19:21:57 +01:00
Jermolene
a0022a1cd6 Refactoring more of startup.js into modules 2014-05-05 10:17:50 +01:00
Jermolene
519e1b4a44 Pull more of startup.js out into separate modules 2014-05-03 21:23:51 +01:00
Jermolene
09156af475 Add support for "before" field on startup modules 2014-05-03 19:49:50 +01:00
Jermolene
78ba57d55d Remove support for browser-startup modules
Instead support startup modules that stipulate which platform they
require.

Also include docs updates and fixes to fullscreen plugin
2014-05-03 17:49:20 +01:00
Jermolene
749582ede0 Split module loading into a separate startup task
Still a work in progress.
2014-05-03 17:10:55 +01:00
Jermolene
b96aade28a WIP: Add support for dependencies between startup modules
See StartupMechanism for details.
2014-05-03 16:32:18 +01:00
Jermolene
327b53a641 Start adding support for permalinks
At this point we respect any permalink at startup, but we don’t yet
dynamically update the permalink, nor do we respond to ongoing
permalink changes.

The permalink separator being `%00` seems like it might be a bit
controversial. It buys us not having to wrap tiddler titles in double
square brackets if they contain spaces.

Another thing is that this scheme doesn’t support tiddler filters; the
plan is to support them like this:

http://tiddlywiki.com/#!Target%00%00[tag[task]sort[created]]
2014-05-02 19:21:32 +01:00
Jermolene
bd3e955821 Add compound iterators to boot wiki object 2014-04-30 22:49:28 +01:00
Jermolene
84cd296c58 Minor tweaks to shadow warning infrastructure
1. Moved some methods out of boot.js because they are not needed until
after bootup
2. Added alternate message for editing an overridden shadow tiddler
3. Minor style tweaks
2014-04-28 15:16:31 +01:00
Devin Weaver
a505b6ffc0 Move isModified from Tiddler to Wiki
Replace this with a $tw.wiki.isModifiedTiddler(title) as part of the
wiki object. This allows it to be used outside of the current Wiki which
can change.
2014-04-27 17:15:42 -04:00
Devin Weaver
23a71b433e Rename isEqual to isArrayEqual 2014-04-27 17:15:42 -04:00
Devin Weaver
8556e0ea49 Fix coding style 2014-04-27 17:15:42 -04:00
Devin Weaver
3a78465d2d Add isModified to Tiddler object
Adds a check to see if this tiddler differers from the tiddler
referenced in the draft.of field. It iterates of the fields property
skiping those feilds that offer a false positives. Uses the isEqual util
for the tags array.
2014-04-27 17:15:42 -04:00
Devin Weaver
23640d7af4 Add isDraft to Tiddler object
Check to see if this tiddler is a draft (has a draft.of field)
2014-04-27 17:15:42 -04:00
Devin Weaver
540681b2bc Add $tw.util.isEqual
This checks to see if an array is equal. Should handle case where an
array is considered null or undefined. It short circuits when the
lengths are different and will only loop when needed.
2014-04-27 17:15:42 -04:00
Jermolene
f7e50e0950 Add --build command
First pass at the build system described in #356.

To test it, move to a new, empty directory and try `tiddlywiki
editions/tw5.com --verbose --build`
2014-04-25 22:41:59 +01:00
Jermolene
ba576d9f1b Add support for safe mode 2014-04-19 09:36:08 +01:00
Jermolene
f57e047877 Fix issues with tiddlers with null fields
Fixing #567
2014-04-17 14:43:12 +01:00
Jermolene
bd4a031df8 Fix problem with version checking logic
Previously, importing a plugin with a semantically identical version
number was not rejected. This meant that attempts to import
5.0.9-prerelease wikis into 5.0.9-beta led to a corrupted wiki, with a
beta core and prerelease plugins.
2014-04-17 11:59:42 +01:00
Jeremy Ruston
9b52ca7cc0 Merge pull request #543 from welford/load-and-deserialize
Make deserializing a bit more robust
2014-04-09 11:51:16 +01:00
James Welford Anderson
0f07977930 deserializertype -> deserializerType 2014-04-09 06:26:01 +09:00
James Welford Anderson
362df18a19 make deserializing a bit more robust
load.js references the encoding set in boot.js when loading a file.
boot.js can now register file type with different deserialization from
their actual type
2014-04-09 06:20:51 +09:00
Jermolene
ea46f85a8a Fix problem with fields called "__proto__" 2014-04-06 22:49:20 +01:00
Jermolene
1e960ffcac Fix problems with tiddlers called __proto__
Background:

http://www.2ality.com/2012/01/objects-as-maps.html
2014-04-06 22:43:10 +01:00
Jermolene
8a7d0f53d3 Add a sourceURL to the end of eval'd code
This, miraculously, lets Chrome dev tools list tiddler modules in the
script tag by their proper titles. Which lets you set breakpoints
within them!!!!!

https://chromedevtools.googlecode.com/svn-history/r421/trunk/tutorials/b
reapoints/index.html#regular
2014-04-06 22:36:51 +01:00
Jermolene
272a4bbe61 Filtering optimisations 2014-04-05 17:31:36 +01:00
Jermolene
53ca7f6a2f More defensive handling of pluginInfo 2014-03-31 18:30:45 +01:00
Jermolene
6307293469 Fix some Node.js cross-platform compatibility issues
Thanks to http://shapeshed.com/writing-cross-platform-node/

Surprising that file path format is pretty much the only issue.
2014-03-31 17:17:36 +01:00
Jeremy Ruston
03cfa61ae8 Merge pull request #494 from nameanyone/master
Stop using obsoleted "-moz-border-radius" and "-webkit-border-radius" pr...
2014-03-20 22:19:45 +00:00
nameanyone
7616c4ce7d Stop using obsoleted "-moz-border-radius" and "-webkit-border-radius" properties
Fixes #480
2014-03-18 16:38:52 -07:00
Jermolene
b8d0fd059b Fix bug with plugintiddlers filter operator 2014-03-18 21:18:45 +00:00
Jermolene
9de17aa206 Make shadowTiddlers, pluginTiddlers and pluginInfo be private to the Wiki object constructor 2014-03-17 10:50:18 +00:00
Jermolene
279626a3e3 Freeze array or object tiddler fields
Previously object fields like the tags array weren’t frozen.
2014-03-17 08:58:42 +00:00
Jermolene
721e333a20 Starting to make the members of $tw.Wiki be private
We want to avoid plugins from directly accessing the tiddlers hashmap.
Later we’ll do pluginTiddlers, pluginInfo and shadowTiddlers.
2014-03-16 21:23:10 +00:00
Jermolene
b714c67374 Refactor plugin loading to retain plugin info for all plugins
Previously we were not reading the plugin info for plugins that hadn’t
been loaded.
2014-03-14 15:23:12 +00:00
Jermolene
24b6603c42 Fix problem with checking versions of plugins carrying a badly formatted "version" field 2014-03-14 10:43:22 +00:00
Jermolene
a3507bf611 Freeze the fields of a tiddler
Thus enforcing the immutability of tiddler objects
2014-03-12 08:33:13 +00:00
Jermolene
af34fbbca3 Only show command line help if no arguments are provided
Previously we were checking in a way that meant that `tiddlywiki
<wiki>` would trigger the help message.
2014-03-10 18:20:07 +00:00
Jermolene
8bd1fa50dc Fixed typo in dom maker 2014-03-08 10:43:01 +00:00
Jermolene
3994f0dbc6 Add new option to retain tiddler paths 2014-02-27 16:30:05 +00:00
Jermolene
f3930ad69c Add init command to initialise a wiki folder
Fixes #362
2014-02-23 22:58:17 +00:00
Jermolene
ecb845f1cd Require that wiki folders have a tiddlywiki.info file
Previously, we were just using default content if the tiddlywiki.info
file was missing. This allowed us to do things like `tiddlywiki
—server` without actually being in a valid wiki folder.

Fixes #361
2014-02-22 16:38:34 +00:00
Jermolene
dfbb6e1fba Ensure that $:/isEncrypted is reset if modified 2014-02-21 18:21:10 +00:00
Jermolene
9b6c59e9a6 Allow .multids files to contain blank lines and ": " sequences
Also added a warning for multiple definitions of the same tiddler in a
multids file.

Fixes #415
2014-02-21 09:24:36 +00:00
Jermolene
d21fb85d94 Change .tids file extension to .multids
Hopefully less confusing
2014-02-20 10:27:02 +00:00
Jermolene
1f41daf433 Add support for multi-tiddler files with a .tids extension 2014-02-09 20:34:42 +00:00
Jermolene
dea08ed4f8 First pass at language plugins for internationalisation
Still quite a few details to work out, but this shows the basic idea of
re-using the theme mechanism to handle language plugins.

Comments and questions welcome.
2014-02-09 19:18:46 +00:00
Jermolene
02ba92c6b5 Add [is[image]] filter operator 2014-01-29 09:04:41 +00:00
Jermolene
175e86078c Fix crash when wiki/themes folder contains files that are not themes
Fixes #370
2014-01-28 18:58:01 +00:00
Jermolene
5af30086c0 Fix substitution for nbsp
We were substituting the wrong character for non-breaking spaces
2014-01-28 15:23:58 +00:00
Jermolene
3f9561dd95 Better logging 2014-01-26 18:53:31 +00:00
Jermolene
2fc6451bf7 Rejigged encrypted import so that the current password isn't changed
We still try the currently stored password. If that doesn’t work then
we prompt for a password, but we no longer store the password in the
store.
2014-01-20 13:35:55 +00:00
Jermolene
299e9d15fb Add support for importing encrypted TiddlyWiki documents 2014-01-19 18:43:02 +00:00
Jermolene
60926198b1 Improve logic for initialising reading node tiddlers
We want fine control of whether tiddlers are read from the DOM or the
file system, without ganging it to whether we’re on node vs. browser.
2014-01-18 14:53:26 +00:00
Jermolene
839361d54f Futher refactoring for TiddlyDesktop
We need finer control over the boot process so that we can force it to
load tiddlers from the Node.js file APIs rather than from the DOM
2014-01-15 14:51:04 +00:00
Jermolene
c7fb0bd349 Start updating the boot kernel for more node-webkit integration
The goal is to make it possible to use the Node.js boot code under
node-webkit, so that we can directly load wiki folders
2014-01-14 14:09:04 +00:00
Jermolene
84e149e36c Reset the JavaScript error dialogue width
It inadvertantly got affected by the change to the password dialogue.
2014-01-13 16:17:08 +00:00
Jermolene
b04141fefd Don't load tiddlers that don't have a title
We were getting problems (eg, adding a `readme.md` to a plugin without
an accompanying `readme.md.meta` would end up creating a tiddler called
“undefined”)
2014-01-12 21:48:18 +00:00
Jermolene
b5d2b79a37 Add nbsp handling to htmlDecode 2014-01-12 20:11:51 +00:00
Jermolene
b326315b0e Make the password dialogue narrower
To make it work better on mobile devices
2014-01-10 16:51:39 +00:00
Jermolene
1a74e2538c Cleaning up further coding style inconsistencies that have crept in 2014-01-03 10:50:00 +00:00
Jermolene
0ec2224757 Fallback to a default tiddlywiki.info file if it does not exist
We fallback to settings suitable for the server version, to help people
get up and running quickly.
2013-12-18 21:11:00 +00:00
Jermolene
07dd524016 Adjust build scripts to save favicon.ico from wiki
And add file type information for `image/x-icon`
2013-12-18 17:27:10 +00:00
Jeremy Ruston
a389f9bc8c Merge pull request #181 from natecain/excludes_refactor
A small refactor and addition to exclude more files
2013-12-18 08:51:36 -08:00
Jermolene
810167bc7b Improve handling of double square brackets within tags
Now a [[ has to be preceded by the beginning of the string or a
whitespace and a ]] has to be followed by whitespace or the end of the
string to act as quotes.

Thanks to @Skeeve for the regex
2013-12-17 14:53:02 +00:00
Jermolene
3f06384516 Adjusted plugin encoding so that the JSON text no longer duplicates the fields 2013-12-14 09:46:02 +00:00
Jermolene
026a27c1ab Split out the parsing of semantic version strings 2013-12-02 09:57:19 +00:00
Jermolene
7d12d89a0a Added primitive support for basic authentication
Note that the password will be passed over HTTP in plain text.
2013-11-28 14:03:08 +00:00
Jermolene
b63f7a7416 Fix missing seconds in serialised date fields 2013-11-19 12:14:37 +00:00
Jeremy Ruston
35adf4269a Merge backlog of changes from master branch
This is too easy. I'm worried.
2013-11-08 08:33:27 +00:00
Jeremy Ruston
bfe3d3ee5a Extend tiddler modification and creation dates to include milliseconds
Fixes #200
2013-11-07 20:04:54 +00:00
Jeremy Ruston
69888e6701 Allow field modules to specify HTML element tag used for editing 2013-11-07 19:39:50 +00:00
Jeremy Ruston
b474d8c13d Extend domMaker to set event listeners 2013-10-26 13:13:45 +01:00
natecain
5e743262d4 A small refactor and addition to exclude more files
Refactored duplicated `excludeRegExp` into `$tw.boot.excludeRegExp`
  Added NPM's ignore list to ignore more files during node bootstrap
2013-10-13 12:58:10 -04:00
natecain
951019eacc Make require() compliant with CommonJS Modules/1.1 2013-10-12 13:44:09 -04:00
Jeremy Ruston
5ef4123b3d Revert "Merge pull request #160 from natecain/commonjs"
This reverts commit 661621c3f7, reversing
changes made to d3d72eff1b.
2013-10-12 16:29:20 +01:00
Jeremy Ruston
661621c3f7 Merge pull request #160 from natecain/commonjs
CommonJS Modules/1.1 Conformance
2013-10-12 07:42:26 -07:00
natecain
b8c37a26ef Additional improvement to CommonJS Modules support
Now implements (and mostly follows) requirements of Modules/1.1 spec
  implementes only the required "secure sandbox" subset of the spec
  `module` free variable changed from the `moduleInfo` to an id container
  `require` free variable given a "main" property
  boot module scope closed and exported
    this also changes the interface between boot and bootprefix slightly
    (should now be able to create multiple TW instances under node)
 BREAKING CHANGES:
  The tiddlywiki module itself now exports a single constructor function
  Modules which depended on `module` referring to `moduleInfo` will break
  Modules which don't conform to Modules/1.1 will break
    (by attempting to modify require.main or module.id)
2013-10-11 11:32:58 -04:00
Jeremy Ruston
c784217009 Missing semi 2013-10-03 14:43:58 +01:00
natecain
fbc80e379d Some quick style cleanup to commonjs patches 2013-10-01 17:56:05 -04:00
Jeremy Ruston
48402ed329 Improve comments 2013-09-21 10:06:44 +01:00
natecain
5c92ec3617 Cleaned up some dead/commented in patches. 2013-09-17 22:38:14 -04:00
natecain
881325b7ed Make require() compliant with CommonJS 1.0
This includes potentially breaking changes.
  Specifically, before this patch tiddlywiki would default to relative module identifiers
  Now, tiddlywiki will only search relative paths if explicitly specified
  Additionally, some "defaulted export contexts" were removed
    (some modules may make assumptions about context)
Some unit tests were modified slightly from their originals
  Tiddlywiki doesn't have a notion of a "main" program's path
  Some require calls were explicitly made relative
  None of these changes should affect the requirement under test in each case
2013-09-17 21:10:24 -04:00
Jeremy Ruston
20f06e8eec Ensure that the core plugins inherit their version number from the main package.info 2013-08-26 13:28:23 +01:00
Jeremy Ruston
d6ec1ea1e5 Remove plugin field now that we've got the plugin-type field
I've been meaning to remove the `plugin` field for ages.
2013-08-23 18:37:54 +01:00
Jeremy Ruston
9345078926 Refactor boot process to allow for lack of wiki folder
Previously, the command line interface required a wiki folder to be
specified.

This is part of the work to enable TiddlyWiki5 to be used more easily
as a library in other node.js apps
2013-08-21 09:42:51 +01:00
Jeremy Ruston
644d9f9405 Refactor boot sequence
This is the start of making it possible to use TiddlyWiki5 as a library
from a node.js application
2013-08-20 15:17:57 +01:00
Jeremy Ruston
be1b16e260 Add a new standard field called "list" that contains a list of tiddler titles 2013-08-07 16:05:56 +01:00
Jeremy Ruston
4765b4a02d Use a more robust check for whether a variable is a date
The simple "instanceof Date" check fails if the Date was made in a
different node.js VM
2013-08-06 15:26:10 +01:00
Jeremy Ruston
586848f5e2 Fix typo
Fixes #113
2013-07-21 21:11:48 +01:00
Jeremy Ruston
4655a7a4d7 Allow wiki folders to contain a themes folder 2013-07-14 23:08:04 +01:00
Jeremy Ruston
5e93778112 Allow a suffix to be specified for indirected files
As well as the existing ability to add a prefix
2013-07-14 23:06:37 +01:00
Jeremy Ruston
4fe408d9d3 Fixed problem with tags that appear more than once in the tag string 2013-07-04 16:55:47 +01:00
Jeremy Ruston
f28684d249 Fix problem with JavaScript module tiddlers that are named as system tiddlers
Reported by @boycook
2013-07-03 18:36:51 +01:00
Jeremy Ruston
9ca5f673b9 Minor linting 2013-06-27 09:50:46 +01:00
Jeremy Ruston
02bf8fa469 Fixing 05dc8edc5a properly 2013-06-27 09:43:04 +01:00
Jeremy Ruston
05dc8edc5a Fixed problem with recognising module headers on Windows
Pesky line breaks. Thanks to twitter.com/laheadle
2013-06-27 09:04:55 +01:00
Jeremy Ruston
8063770dae Neater HTML generation in the boot kernel 2013-06-26 23:52:21 +01:00
Jeremy Ruston
90d7d0b3a5 A slightly more concise way of reading package.json 2013-06-26 23:51:57 +01:00
Jeremy Ruston
0be6bf84d1 Extend fieldmodules to include an "editType" field
This will allow us to provide the right HTML5 input element for things
like colours and dates
2013-06-13 09:16:07 +01:00
Jeremy Ruston
f285f850d7 Use window.onerror instead of window.addEventListener for error trapping
Now the error trapping works in Firefox
2013-06-13 08:35:05 +01:00
Jeremy Ruston
c631916441 Add a global error trapper for the browser
JavaScript errors are invisible unless you've got developer tools open,
which is making it hard for users to report errors. This change makes
JavaScript errors popup a big red alert
2013-06-12 12:40:48 +01:00
Jeremy Ruston
c566284158 More consistent naming for the boot tiddlers 2013-05-31 16:53:19 +01:00
Jeremy Ruston
8564602256 Refactor rendertree to simplify context handling
Get rid of the separate renderContext stack and instead have a parent
pointer on renderer nodes. This lets us walk back up the render tree to
resolve context references
2013-05-15 17:32:17 +01:00
Jeremy Ruston
6864251962 Cleaning up content types
Dealt with some inconsistencies
2013-05-13 17:42:07 +01:00
Jeremy Ruston
6b6dbb97a8 Fix typo
Fixes #96
2013-05-07 15:52:21 +01:00
Jeremy Ruston
408fcd8aa3 Add a parser for woff fonts
It's a bit of a hack to have a parser dedicated to fonts. We'll replace
it with a mechanism that handles generic binary data
2013-05-01 13:04:27 +01:00
Jeremy Ruston
cb675732b2 More fields hoisted up from plugin.info file into plugin tiddler 2013-05-01 12:01:43 +01:00
Jeremy Ruston
6d455d77cd Update plugin loading mechanism to allow plugins to be unregistered
We still have to explicitly unpack them after registering or
unregistering
2013-04-30 22:56:17 +01:00
Jeremy Ruston
17cfd57390 Start making themes switchable
Separately switch in ordinary plugins and themes. Change the convention
for plugin information to use dashes rather than camel case.
2013-04-28 22:52:26 +01:00
Jeremy Ruston
40ac461ca1 Give plugins a pluginType field
Ordinary plugins have the type "plugin", we'll also have "theme" and
"language"
2013-04-28 18:16:22 +01:00
Jeremy Ruston
31a378b64c Start support for themes
To start with, we move the current stylesheets into a theme plugin
called "Snow White". Wikis have to specify at least one theme in their
`tiddlywiki.info` file. Next we'll add a mechanism for switching
between loaded themes
2013-04-28 09:42:48 +01:00
Jeremy Ruston
7aeeaf81eb Refactor boot.js module execution code
The aim is to expose the underlying cross-platform evalGlobal and
evalSandboxed.

Also adding the capability for a tiddlywiki.files file to specify a
prefix to be added to the text of a file.
2013-04-25 09:05:02 +01:00
Jeremy Ruston
0a37f6bf5b Correct module definition in the browser
The previous logic was preventing modules being executed that weren't
baked into a script tag.
2013-04-10 16:56:17 +01:00
Jeremy Ruston
df59269b0d Fixed problem with plugin precedence
We were unpacking plugin tiddlers in arbitrary order, and ensuring that
later plugins didn't overwrite shadow tiddlers from earlier plugins.

Now we'll allow plugins to specify a "pluginPriority" that determines
the load ordering. We also explicitly allow shadow tiddlers from later
plugins to overwrite shadow tiddlers from earlier plugins.

We're setting a base priority on the core plugin, since many plugins
will want to control their loading relative to it.
2013-04-08 18:37:49 +01:00
Jeremy Ruston
c0b6be9a13 Correct pesky missing brackets 2013-04-03 21:10:57 +01:00
Jeremy Ruston
0d247cb752 Update shadow tiddler handling to record source plugin tiddler 2013-04-03 13:23:26 +01:00
Jeremy Ruston
a75fd3df34 When we deserialize an unknown type as "text/plain" we should mark it with the original type 2013-04-01 18:55:49 +01:00
Jeremy Ruston
63fd149ea9 Relaxed restrictions on the names of constituent tiddlers within plugins
Thus allowing us to give a more sensible title to the core plugin
2013-03-28 17:15:52 +00:00
Jeremy Ruston
cd36f594c5 Make the core into a plugin 2013-03-28 17:07:30 +00:00