1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2026-01-22 19:04:38 +00:00

Compare commits

...

216 Commits

Author SHA1 Message Date
Jermolene
8f6ee1d2a8 Version number update for 5.0.7-beta 2014-01-26 21:04:38 +00:00
Jermolene
183e9544b4 Readme update 2014-01-26 20:59:36 +00:00
Jermolene
dfc57ffa49 More logging 2014-01-26 20:59:30 +00:00
Jermolene
3f9561dd95 Better logging 2014-01-26 18:53:31 +00:00
Jermolene
37ca86ff3d Docs updates 2014-01-26 17:49:43 +00:00
Jermolene
cf26986061 Update upgrading instructions 2014-01-26 13:54:08 +00:00
Jermolene
54822e25d4 Update static link generation 2014-01-26 13:34:53 +00:00
Jermolene
4a9108154d Readme update 2014-01-26 13:26:25 +00:00
Jermolene
8a88253b4e Remove the white background rectangle from Motovun Jack.svg 2014-01-26 13:24:39 +00:00
Jermolene
7891824883 Fix video protocol
YouTube’s default of missing out the protocol for the iframe src
unfortunately makes videos malfunction when viewing TiddlyWiki on a
file: URL
2014-01-26 13:24:27 +00:00
Jermolene
fca5681a1a Docs updates 2014-01-26 13:04:09 +00:00
Jeremy Ruston
5c9a5f5cba Merge pull request #360 from pmario/docs-cm
docs: CodeMirror config tiddler
2014-01-26 02:01:57 -08:00
Jermolene
69d342d46a Stop the reveal widget caching hidden content
Previously, when displayed content is hidden by the reveal widget there
was an optimisation such that the content was retained in the DOM but
hidden using CSS, so that it could be shown again quickly.

It turns out that a sideeffect of that optimisation is that clicking
through all the sidebar tabs leaves them all active, so that they all
need to be refreshed whenever a character is typed in an editor.

This commit suppresses the optimisation, so that hidden content is
removed from the DOM and the render tree.
2014-01-26 09:57:46 +00:00
Mario Pietsch
66254b436c fix #215 cm gutter adjust .CodeMirror-linenumber min-width, font-size. It should work up to 999 lines now. There should be a ControlPanel tab for codemirror 2014-01-25 23:33:24 +01:00
Mario Pietsch
d42981f201 docs: CodeMirror config tiddler needs to be type:application/json 2014-01-25 22:53:52 +01:00
Jeremy Ruston
04dbf99e54 Merge pull request #359 from pmario/fix-docs
some doc updates.
2014-01-25 13:26:42 -08:00
Jermolene
762940adbc No longer save system modules separately in the main HTML template
These tiddlers were being handled as `<script>` tags to make it easier
to debug them. But in fact modern dev tools are quite happy to debug
code that has been eval’d, and this arrangement was causing problems
for importing.

Fixes #335
2014-01-25 21:22:43 +00:00
Mario Pietsch
f58d4fb531 some doc updates. server default IP fix and changed Ton's entry page 2014-01-25 22:02:48 +01:00
Jermolene
45c45e098f Add a cancel button to the 'set password' dialog
Fixes #185
2014-01-25 19:55:56 +00:00
Jermolene
b5629ccc82 Update codemirror plugin docs
@pmario and @jbolila - could you kindly check whether the docs cover
everything?
2014-01-25 19:34:32 +00:00
Jermolene
bd067c6b1e Include the nodewebkitsaver in tw5.com
Just for the moment, to make it easier for people to find it.
2014-01-25 19:33:35 +00:00
Jermolene
1d10ccb368 Update release notes for 5.0.7 2014-01-25 19:33:00 +00:00
Jermolene
9297b27b89 Reference correct wiki object 2014-01-25 18:17:33 +00:00
Jermolene
0b3efe179e Extend list filter operator to take a text reference
Instead of just a title. Means that we can apply the list operator to
fields other than the list field.
2014-01-25 18:14:30 +00:00
Jermolene
e6843aabff Refactoring of new filter list operators 2014-01-25 17:44:36 +00:00
Jermolene
02d3861d7d Tests for the new filter operators 2014-01-25 17:44:14 +00:00
Jeremy Ruston
592ef257a2 Merge pull request #326 from Skeeve/listops
New list operations from @Skeeve
2014-01-25 08:51:26 -08:00
Jermolene
6ba9bf9a95 Boost the priority of the upload saver
If we’ve got an upload wiki name then we should always use the upload
saver.

See https://groups.google.com/d/topic/tiddlywiki/Jqd2jbPmYFA/discussion
2014-01-25 16:38:08 +00:00
Jermolene
18fe0c0f75 Add Jeffrey Kishner link to Community tiddler 2014-01-25 14:51:43 +00:00
Jermolene
c49681ecf3 Docs tweaks 2014-01-25 14:47:25 +00:00
Jermolene
6255b97b14 Resolve merge conflict 2014-01-25 14:41:48 +00:00
Jermolene
6cb44ac0cc Fix typo in field mangler docs
Fixes #358
2014-01-25 14:07:32 +00:00
Jermolene
b1b9c7d6cd Fix typo in codemirror editor 2014-01-25 14:07:10 +00:00
Jermolene
951147d502 Style tweaks 2014-01-24 21:45:37 +00:00
Jermolene
9539664e46 Merge branch 'codemirror_keymap' of https://github.com/jbolila/TiddlyWiki5 into jbolila-codemirror_keymap 2014-01-24 21:39:55 +00:00
Jermolene
f9b5d75446 Clarify that global macros are coming 2014-01-24 20:42:09 +00:00
Jermolene
70a7321edd Take editor configuration from configuration tiddlers
This should enable @buggyj to add an html editor by including a
configuration tiddler in the plugin.
2014-01-24 20:22:23 +00:00
Jermolene
9522050aa7 Merge @buggyj's CLA signature 2014-01-24 19:19:56 +00:00
Jermolene
8d37219545 Add some tests 2014-01-24 19:15:34 +00:00
Jermolene
a76da88380 Rename the operator portion after the colon to "suffix" 2014-01-24 19:15:27 +00:00
Jermolene
42262a637c Docs tweaks 2014-01-24 18:54:55 +00:00
Jermolene
e6a7a0db1e Style tweaks 2014-01-24 18:54:50 +00:00
Jermolene
edc71cb920 Merge branch 'regexp_filter' of https://github.com/Skeeve/TiddlyWiki5 into Skeeve-regexp_filter 2014-01-24 18:40:27 +00:00
Jermolene
bd48ecfcb1 Generate the copyright.md file in the same way we generate readme.md
Fixing #351
2014-01-24 18:35:17 +00:00
Jermolene
f4b27b33de Fixed problem with multiple tiddlers created from dragging a single file 2014-01-24 14:09:06 +00:00
Jermolene
644d88a6c5 Adjust control panel links 2014-01-24 13:43:51 +00:00
Jermolene
43eb81173d Add note about system tiddler naming conventions 2014-01-23 08:23:49 +00:00
Jermolene
a8eff78b62 Fix formatting 2014-01-23 08:22:55 +00:00
Jermolene
f90db97625 Correct year of release for 5.0.6 2014-01-23 08:22:45 +00:00
Jermolene
e339b6dffe Add documentation on sharing via Dropbox 2014-01-22 09:06:07 +00:00
Jermolene
64304f9b7f Ensure that new tiddlers created from a skeleton don't inherit created/creator fields 2014-01-21 21:00:08 +00:00
Jermolene
867dfabff8 Change initial default tiddlers to include most recently created tiddlers 2014-01-20 18:26:32 +00:00
Jermolene
b627bba277 Added link to download instructions 2014-01-20 17:48:03 +00:00
Jermolene
b9b1b001da Update Typed Blocks documentation 2014-01-20 17:14:38 +00:00
Jermolene
e9ae8d2015 Clarify upgrading instructions for encrypted wikis 2014-01-20 13:38:57 +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
f31369035b Update JavaScript Macro docs 2014-01-20 13:02:12 +00:00
Jermolene
1e54b1bcc9 Remove empty tag fields in the field mangler
This means that removing the last tag from a tiddler will remove the
tags field.
2014-01-20 11:53:26 +00:00
Jermolene
d3c421985c Add delete icon for the tiddler type editor 2014-01-20 11:21:12 +00:00
Jermolene
1c283c5586 Tighten "has" filter operator
We now require the field not to be an empty string in order to be
counted.
2014-01-20 08:59:01 +00:00
Jermolene
4f5a923ca0 Update release note 2014-01-19 21:46:01 +00:00
Jermolene
95cb99adb9 Enhance text widget to optionally use "text" attribute
This lets us use the text widget to render text in macros that we don’t
want to be wikified.
2014-01-19 21:45:55 +00:00
Jermolene
d5df78d979 Docs update 2014-01-19 20:16:29 +00: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
98edbec46d Adjust the position of modal dialogues
The top was off the top of the window
2014-01-19 20:12:55 +00:00
Jermolene
299e9d15fb Add support for importing encrypted TiddlyWiki documents 2014-01-19 18:43:02 +00:00
Jermolene
2f4932fefc Expose the option to retain story ordering across restarts 2014-01-19 18:42:32 +00:00
Jermolene
5f1d49f2e0 Clarify the shadow GettingStarted docs 2014-01-19 18:42:20 +00:00
Jermolene
6ea9dc997f Remove extraneous full stop 2014-01-19 18:42:08 +00:00
Jermolene
c9d06ad18a Add link to French thesis notebook 2014-01-18 14:58:24 +00:00
Jermolene
3414f1ca8e Move node-webkit saver into a plugin
We don’t need it for TiddlyDesktop now that it reuses the TiddlyFox
saver. But it is still useful for embedding a TW directly into a
node-webkit app
2014-01-18 14:57:42 +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
2c790d982f Switch to using $tw.fakeDocument for the fakedom document object
So that we can free us `$tw.document` to be the actual DOM document
2014-01-15 14:57:35 +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
Stephan Hradek
14ca91a949 implemented the new regexp syntax 2014-01-14 22:08:05 +01:00
Stephan Hradek
81de74342d implemented the new regexp syntax 2014-01-14 22:07:20 +01:00
Stephan Hradek
0338c36610 implemented the field: syntax 2014-01-14 16:19:34 +01: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
João Bolila
d7d5165847 all configuration and required libs in the config tiddler 2014-01-13 23:34:11 +00:00
Jeremy Ruston
aefc7b7ce2 Merge pull request #343 from csugden/patch-1
Updates "main" in package.json
2014-01-13 13:40:44 -08:00
Jeremy Ruston
1657111cb7 Merge pull request #344 from csugden/patch-2
Update cla-individual.md
2014-01-13 13:39:08 -08:00
csugden
08a8689117 Update cla-individual.md 2014-01-13 21:22:13 +00:00
csugden
b1b38dc143 Updates "main" in package.json
Fixes require "Error: Cannot find module 'tiddlywiki'"
2014-01-13 18:29:22 +00:00
Jermolene
22f48198bd Update release note 2014-01-13 17:59:22 +00:00
Jermolene
4072c4461d Switch to using a real ellipsis for advanced search 2014-01-13 17:59:14 +00:00
Jermolene
43fb16f232 Updates to the batch files
We should build highlightdemo.html on Windows
2014-01-13 17:33:33 +00:00
Jermolene
809c441ab3 Merge branch 'master' of https://github.com/jbolila/TiddlyWiki5 into jbolila-master 2014-01-13 17:28:08 +00:00
Jermolene
9985efa406 Fix link to tutsplus.com node-webkit tutorial 2014-01-13 17:02:21 +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
25423d2d07 Clarified the PHP instructions 2014-01-13 12:32:46 +00:00
Jermolene
12770ca3e6 Use an explicit default host
Thus fixing #339
2014-01-13 09:09:54 +00:00
Stephan Hradek
a5d75db8d2 Thinking about your mail led me to this new push -> Mail follows 2014-01-13 08:44:53 +01:00
Stephan Hradek
9444ef095f I feel ashamed :( Somehow this slipped me :( Sorry! 2014-01-12 23:37:11 +01: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
João Bolila
c74bf6a655 in resp to https://github.com/Jermolene/TiddlyWiki5/pull/328#issuecomment-32131402 2014-01-12 21:48:03 +00:00
Jermolene
19080f9958 Update coding style guidelines 2014-01-12 21:28:58 +00:00
Jermolene
b5d2b79a37 Add nbsp handling to htmlDecode 2014-01-12 20:11:51 +00:00
João Bolila
17b542980f if a function 2014-01-12 20:03:34 +00:00
João Bolila
8f4e1587a2 rename from mode to keymap bindings (Vim and Emacs bindings) 2014-01-12 19:38:27 +00:00
Jermolene
4b000fac72 Added some docs about naming conventions for system tiddlers 2014-01-12 19:02:15 +00:00
João Bolila
426f2978cf fixes of a newbie, me 2014-01-12 17:09:24 +00:00
Jermolene
bad2e36e45 Remove obsolete itemClass attribute on the list widget 2014-01-12 17:01:18 +00:00
Jermolene
a4f895dc4d Introduce coding style guidelines 2014-01-12 16:56:05 +00:00
Jermolene
e254529763 More configuration controls for TiddlySpot saver
And more reliable checking of the result returned from the server
2014-01-12 12:05:15 +00:00
Jermolene
5dff212e5a Clarify comment in main template 2014-01-12 11:58:45 +00:00
Jermolene
b7a1db1e9f Display tiddler data dictionaries as plain text 2014-01-12 11:58:32 +00:00
Jermolene
6964120fce Move PHP docs 2014-01-11 21:46:33 +00:00
João Bolila
a704498155 added suport for vim and emacs keymaps (codemirror updated to 3.20) 2014-01-11 15:23:49 +00:00
Jermolene
83811bc2a9 Updated docs 2014-01-11 10:22:17 +00:00
Jermolene
bd40977c85 Fix docs error 2014-01-11 09:50:34 +00:00
Jermolene
e87097c22e Updated docs for saving to a PHP server 2014-01-11 09:39:50 +00:00
Jermolene
e74cb05540 Adjust CLA docs 2014-01-11 08:58:54 +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
Stephan Hradek
a3384d101e Extended the filter documentation 2014-01-10 13:23:26 +01:00
Stephan Hradek
8ef520ef37 Created regexp search for milestone 5.1 2014-01-10 10:32:49 +01:00
Jermolene
b64b7982af Fix notification removal to not rely on transitionEnd events 2014-01-09 22:26:21 +00:00
João Bolila
c5035fc0b0 highlight.js updated to version 8.0 (http://highlightjs.org/) 2014-01-09 14:32:31 +00:00
Jermolene
2740f8c1f0 A trivial change for testing purposes 2014-01-08 18:04:49 +00:00
Jermolene
209bc78268 Clean up whitespace 2014-01-08 16:51:42 +00:00
Jermolene
ffcc215e8f Add ellipsis for advanced search next to search box 2014-01-08 10:43:50 +00:00
Jermolene
0fb13e649b Exclude non-system tiddlers from system tiddler search 2014-01-08 09:55:06 +00:00
João Bolila
b42eefe1e8 Merge remote-tracking branch 'upstream/master' 2014-01-08 04:47:20 +00:00
João Bolila
82a48cf85c codeblock as a widget and plugin for highlight code blocks 2014-01-07 22:57:46 +00:00
Stephan Hradek
9fee9b1043 Fix for Paul's concerns 2014-01-07 21:12:59 +01:00
Jermolene
d57010d2fb Docs updates 2014-01-07 11:57:42 +00:00
Jermolene
f2409d4245 Fixed problem with positioning of the sidebar in the centralised theme 2014-01-07 11:09:56 +00:00
João Bolila
4181de5b74 sign contributor license agreement 2014-01-05 20:01:26 +00:00
Jermolene
954901d788 Start adding export options to the control panel 2014-01-05 17:24:53 +00:00
Jermolene
4688190c96 Docs update 2014-01-05 16:33:01 +00:00
João Bolila
a1d2e70307 Plugin for syntax highlighting with highlight.js from Ivan Sagalaev 2014-01-05 09:58:01 +00:00
Jermolene
e0f428b9b2 Fixed problem with Element.ELEMENT_NODE undefined on Safari 2014-01-04 15:15:12 +00:00
Jermolene
504f353844 Update docs with new video tutorials 2014-01-04 13:56:21 +00:00
Jermolene
7857464ab5 Correct another npm typo 2014-01-04 12:05:24 +00:00
Stephan Hradek
103f4f6637 added some more filters 2014-01-04 00:01:17 +01:00
Jermolene
b06e09a4d3 Fix typo in default date format string for view widget
Fixes #320
2014-01-03 18:34:27 +00:00
Jermolene
9d72570092 Update version number for next version 2014-01-03 18:33:03 +00:00
Jermolene
1638824adc Version number update for 5.0.6-beta 2014-01-03 17:16:19 +00:00
Jermolene
79bed656bb Update release date of 5.0.6 2014-01-03 17:15:27 +00:00
Jermolene
6fcfa2738a Docs updates 2014-01-03 17:14:01 +00:00
Jermolene
47ebed87f9 Docs updates 2014-01-03 17:13:03 +00:00
Jermolene
3c35c9ecf8 Improved instructions for TiddlyFox on Android 2014-01-03 13:55:30 +00:00
Jermolene
027421f5e6 More coding style consistency 2014-01-03 10:54:00 +00:00
Jermolene
1a74e2538c Cleaning up further coding style inconsistencies that have crept in 2014-01-03 10:50:00 +00:00
Jermolene
8fc5c1d4a0 Further style tweaks to #321 2014-01-03 10:48:00 +00:00
Jermolene
1374bd9d78 Coding style fixes for #321 2014-01-03 10:43:08 +00:00
Jermolene
307b5c7d6b Merging #321 Table valign from @Skeeve 2014-01-03 10:39:55 +00:00
Jeremy Ruston
5dea8ca758 Merge pull request #324 from Skeeve/nsort
Add numeric sort filter operators
2014-01-03 02:30:12 -08:00
Jermolene
3677fdd3b0 Moved docs to right edition 2014-01-03 09:18:36 +00:00
Jermolene
5758fcb69b Add instructions for adding a Twitter Follow button 2014-01-03 09:16:58 +00:00
Jermolene
385099c4f7 Clarify references to sudo 2014-01-02 21:47:01 +00:00
Jermolene
2343bb3e5b Switch to using 127.0.0.1 in docs 2014-01-02 20:07:05 +00:00
Jermolene
b132e1023d Add error checking to $tw.utils.setStyle() 2014-01-02 19:00:46 +00:00
Jermolene
2d99f4dc15 Update copyright year 2014-01-02 10:55:19 +00:00
Stephan Hradek
c9b319c41c nsort - adapted documentation 2014-01-01 23:59:09 +01:00
Stephan Hradek
b652238650 fixed issue #241 - created first, last, rest and reverse filter functions 2014-01-01 22:38:08 +01:00
Jermolene
d0cd72ed85 Docs update 2014-01-01 20:51:38 +00:00
Jermolene
4289367b7f Add some more filter examples 2014-01-01 18:37:46 +00:00
Jermolene
b76ca5dc3b Clarify use of double square brackets in default tiddlers 2014-01-01 18:27:27 +00:00
Jermolene
71b5c561f2 Docs update 2014-01-01 18:19:50 +00:00
Jermolene
6a02535d08 Docs update 2014-01-01 17:59:55 +00:00
Jermolene
87fbd988f1 Add support for running TiddlyWiki under node-webkit 2014-01-01 17:59:47 +00:00
Jermolene
3d79eb87d1 First pass at an advanced search tiddler 2013-12-31 13:11:01 +00:00
Jermolene
089a838611 Docs update 2013-12-31 11:36:51 +00:00
Jermolene
e48e7e9443 Style improvements for alltiddlers.html 2013-12-31 11:34:10 +00:00
Stephan Hradek
917865c393 fixed an initialization error 2013-12-31 11:09:17 +01:00
Stephan Hradek
ec14a0a16d vertical alignment of cells - version 2 2013-12-31 11:05:08 +01:00
Jermolene
b9e80a270b All-in-one static HTML support
Added a first pass at generating an all-in-one static HTML
representation of a wiki, incorporating anchor links for wiki links
2013-12-31 09:43:46 +00:00
Jermolene
44568dc6ef Hide encryption status when running on the server
A partial fix for #303
2013-12-30 15:05:07 +00:00
Jermolene
d043bdd289 Fix problem with view widget relativedate format
Fixes #319
2013-12-30 13:08:48 +00:00
Stephan Hradek
ce8cc7607f changed to conform to Jeremy's standards - sorry… 2013-12-30 13:44:32 +01:00
Jermolene
6d6e8afb9c Add a style rule for padding paragraphs within dropdowns
Fixes #306
2013-12-30 12:38:45 +00:00
Jermolene
bb0be9e02f Correct npm upgrading instructions
Fixes #304
2013-12-30 12:16:06 +00:00
Jermolene
5dd33904e7 Update docs for double backtick syntax 2013-12-30 12:13:23 +00:00
Jeremy Ruston
2ee5093944 Merge pull request #305 from Skeeve/issue_186
added a fix for issue #186
2013-12-30 04:06:05 -08:00
Jermolene
87a553d75d Docs update 2013-12-30 11:54:56 +00:00
Jermolene
ec7dff291d Fix problem with "import" button not working
Fixes #308
2013-12-30 11:54:51 +00:00
Jeremy Ruston
de2e5adf15 Merge pull request #307 from Skeeve/issue_94
added fix for issue #94 for horizontal rules, tables and typed block
2013-12-30 03:46:16 -08:00
Jermolene
b3ad61ce20 Add a failing test for @Skeeve's upcoming #307 2013-12-30 11:45:18 +00:00
Jeremy Ruston
5eb57365b6 Merge pull request #312 from Skeeve/issue_232
fixed issue#232
2013-12-30 03:25:37 -08:00
Jermolene
c49bc2b0a6 Update docs for tables in wikitext
Fixes #314
2013-12-30 10:51:25 +00:00
Jeremy Ruston
3494dd019d Merge pull request #318 from davidjade/master
Fix for #317
2013-12-30 02:33:27 -08:00
Jermolene
784e6d17f0 Update issues policy 2013-12-30 10:16:32 +00:00
Jermolene
9efd45dda9 Docs update 2013-12-30 10:16:24 +00:00
Stephan Hradek
eb7b82696b fixed documentation for issue #314 2013-12-30 09:51:54 +01:00
David Jade
3b114371d0 Only set placeholders when field has no data (fixes #317) 2013-12-29 17:18:00 -08:00
Stephan Hradek
14868d8228 also fixed issue #315 2013-12-30 00:28:43 +01:00
Stephan Hradek
3cc8138133 fixed issue #314 - fix for > at end of line 2013-12-29 23:57:42 +01:00
Jermolene
b6f2f1e1aa Add margin around message box icons 2013-12-29 22:54:26 +00:00
Jermolene
424147234e Add TiddlyWikiClassic upgrading warning 2013-12-29 22:52:46 +00:00
Stephan Hradek
8e080eac0a fixed issue #314 2013-12-29 23:51:22 +01:00
Stephan Hradek
38142d2b19 Missed that I need to explicitly need to git rm … 2013-12-29 22:32:23 +01:00
Jermolene
bd7db62da0 Added support for specifying hostname for the --server command
Fixes #301
2013-12-29 13:07:06 +00:00
Jermolene
4cdfbd6b36 Docs update 2013-12-29 12:54:08 +00:00
Jermolene
ef59a3743f Fix crashes when attempting full screen mode on browsers that don't support it
Fixes #311
2013-12-29 12:54:00 +00:00
Stephan Hradek
cee1bc0863 small typofix 2013-12-29 00:19:51 +01:00
Stephan Hradek
ce8c79ecfa changed sort and sortcs to support nsort and nsortcs 2013-12-29 00:15:11 +01:00
Jermolene
ac81d9d43f Docs update
Hopefully fixing #309
2013-12-28 17:57:11 +00:00
Jermolene
d69614259f Add TiddlyWiki Classic markup to type dropdown 2013-12-28 17:56:48 +00:00
Jermolene
0e88417e62 Update version number for next release 2013-12-28 17:49:35 +00:00
Stephan Hradek
46892371cb fixed issue#232 2013-12-28 17:46:53 +01:00
Stephan Hradek
f9de55ad5f added fix for issue #94 for horizontal rules, tables and typed block 2013-12-25 23:06:42 +01:00
Stephan Hradek
81106e500d added a fix for issue #186 2013-12-25 14:31:35 +01:00
Jermolene
cfad04a5d0 Version number update for 5.0.5-beta 2013-12-24 14:22:28 +00:00
Jermolene
1aa5dedfaf Docs update 2013-12-24 14:21:35 +00:00
Jermolene
98fdd3e184 Fix problem with modal positioning on narrow screens
Fixes #302
2013-12-24 09:44:40 +00:00
Jermolene
73c5ecdaa7 Added a green version of the favicon for the static pages 2013-12-24 09:09:01 +00:00
Jermolene
eef32e70e3 Added support for dynamic favicons
Now it’s possible to edit $:/favicon.ico with the image editor, and see
the changes instantly reflected in the browser.
2013-12-24 09:08:25 +00:00
Jermolene
ad6bf4f9c5 Extend support for .ico files
Now we can parse image/x-icon tiddlers for display, and provide an
entry for them in the type dropdown.
2013-12-24 09:07:25 +00:00
Jermolene
7db31dc138 Typo correction 2013-12-24 09:06:09 +00:00
Jermolene
7b7e799a70 Fixed problem with static content being included in empty.html
A bit of a hack to fix this problem:

https://groups.google.com/forum/#!topic/tiddlywikidev/Ucpbq5eeq8g
2013-12-23 09:53:31 +00:00
Jermolene
3aab737bea Docs update 2013-12-23 08:55:15 +00:00
Jermolene
12b4cc5d3e Update wiki.readFiles() to call the callback just once
Now we accumulate the results and just pass them to the callback once.
2013-12-23 08:55:11 +00:00
Jermolene
10c25c1692 Fix slow regexp in importing TiddlyWiki HTML files 2013-12-23 08:54:33 +00:00
Jermolene
c35742f916 Prepare version info for 5.0.5 2013-12-23 08:54:07 +00:00
Jermolene
15a41d7e57 Docs update 2013-12-22 16:25:01 +00:00
Jermolene
4e37fa7e47 Docs updates 2013-12-22 15:50:27 +00:00
214 changed files with 6974 additions and 562 deletions

11
bld.cmd
View File

@@ -38,9 +38,12 @@ node .\tiddlywiki.js ^
--savetiddler $:/favicon.ico %TW5_BUILD_OUTPUT%\favicon.ico ^
--rendertiddler ReadMe .\readme.md text/html ^
--rendertiddler ContributingTemplate .\contributing.md text/html ^
--rendertiddler $:/core/copyright.txt .\licenses\copyright.md text/plain ^
--rendertiddler $:/editions/tw5.com/download-empty %TW5_BUILD_OUTPUT%\empty.html text/plain ^
--rendertiddler $:/editions/tw5.com/download-empty %TW5_BUILD_OUTPUT%\empty.hta text/plain ^
--savetiddler $:/green_favicon.ico %TW5_BUILD_OUTPUT%/static/favicon.ico ^
--rendertiddler $:/core/templates/static.template.html %TW5_BUILD_OUTPUT%\static.html text/plain ^
--rendertiddler $:/core/templates/alltiddlers.template.html %TW5_BUILD_OUTPUT%\alltiddlers.html text/plain ^
--rendertiddler $:/core/templates/static.template.css %TW5_BUILD_OUTPUT%\static\static.css text/plain ^
--rendertiddlers [!is[system]] $:/core/templates/static.tiddler.html %TW5_BUILD_OUTPUT%\static text/plain ^
|| exit 1
@@ -87,6 +90,14 @@ node .\tiddlywiki.js ^
|| exit 1
rem highlightdemo.html: wiki to demo highlight plugin
node .\tiddlywiki.js ^
.\editions\highlightdemo ^
--verbose ^
--rendertiddler $:/core/save/all %TW5_BUILD_OUTPUT%\highlightdemo.html text/plain ^
|| exit 1
rem Make the CNAME file that GitHub Pages requires
echo tiddlywiki.com > %TW5_BUILD_OUTPUT%\CNAME

11
bld.sh
View File

@@ -39,9 +39,12 @@ node ./tiddlywiki.js \
--savetiddler $:/favicon.ico $TW5_BUILD_OUTPUT/favicon.ico \
--rendertiddler ReadMe ./readme.md text/html \
--rendertiddler ContributingTemplate ./contributing.md text/html \
--rendertiddler $:/core/copyright.txt ./licenses/copyright.md text/plain \
--rendertiddler $:/editions/tw5.com/download-empty $TW5_BUILD_OUTPUT/empty.html text/plain \
--rendertiddler $:/editions/tw5.com/download-empty $TW5_BUILD_OUTPUT/empty.hta text/plain \
--savetiddler $:/green_favicon.ico $TW5_BUILD_OUTPUT/static/favicon.ico \
--rendertiddler $:/core/templates/static.template.html $TW5_BUILD_OUTPUT/static.html text/plain \
--rendertiddler $:/core/templates/alltiddlers.template.html $TW5_BUILD_OUTPUT/alltiddlers.html text/plain \
--rendertiddler $:/core/templates/static.template.css $TW5_BUILD_OUTPUT/static/static.css text/plain \
--rendertiddlers [!is[system]] $:/core/templates/static.tiddler.html $TW5_BUILD_OUTPUT/static text/plain \
|| exit 1
@@ -87,6 +90,14 @@ node ./tiddlywiki.js \
--rendertiddler $:/core/save/all $TW5_BUILD_OUTPUT/markdowndemo.html text/plain \
|| exit 1
# highlightdemo.html: wiki to demo highlight plugin
node ./tiddlywiki.js \
./editions/highlightdemo \
--verbose \
--rendertiddler $:/core/save/all $TW5_BUILD_OUTPUT/highlightdemo.html text/plain \
|| exit 1
# Run the test edition to run the Node.js tests and to generate test.html for tests in the browser
./test.sh

View File

@@ -14,10 +14,10 @@ Error message and password prompt
z-index: 20000;
position: fixed;
text-align: center;
width: 480px;
width: 200px;
top: 4em;
left: 50%;
margin-left: -264px; /* - width/2 - paddingHorz/2 - border */
margin-left: -144px; /* - width/2 - paddingHorz/2 - border */
padding: 16px 16px 16px 16px;
-webkit-border-radius: 8px;
-moz-border-radius: 8px;
@@ -29,6 +29,8 @@ Error message and password prompt
text-shadow: 0 1px 0 rgba(0, 0, 0, 0.5);
background-color: rgb(255, 75, 75);
border: 8px solid rgb(255, 0, 0);
width: 480px;
margin-left: -244px; /* - width/2 - paddingHorz/2 - border */
}
.tw-error-form div {
@@ -54,4 +56,9 @@ Error message and password prompt
.tw-password-wrapper h1 {
font-size: 16px;
line-height: 20px;
padding-bottom: 16px;
}
.tw-password-wrapper input {
width: 100%;
}

View File

@@ -38,7 +38,7 @@ $tw.boot = $tw.boot || {};
/////////////////////////// Standard node.js libraries
var fs, path, vm;
if(!$tw.browser) {
if($tw.node) {
fs = require("fs");
path = require("path");
vm = require("vm");
@@ -46,15 +46,6 @@ if(!$tw.browser) {
/////////////////////////// Utility functions
/*
Log a message
*/
$tw.utils.log = function(/* args */) {
if(console !== undefined && console.log !== undefined) {
return Function.apply.call(console.log, console, arguments);
}
};
/*
Check if an object has a property
*/
@@ -207,10 +198,10 @@ $tw.utils.deepDefaults = function(object /*, sourceObjectList */) {
};
/*
Convert "&amp;" to &, "&lt;" to <, "&gt;" to > and "&quot;" to "
Convert "&amp;" to &, "&nbsp;" to nbsp, "&lt;" to <, "&gt;" to > and "&quot;" to "
*/
$tw.utils.htmlDecode = function(s) {
return s.toString().replace(/&lt;/mg,"<").replace(/&gt;/mg,">").replace(/&quot;/mg,"\"").replace(/&amp;/mg,"&");
return s.toString().replace(/&lt;/mg,"<").replace(/&nbsp;/mg,"\x40").replace(/&gt;/mg,">").replace(/&quot;/mg,"\"").replace(/&amp;/mg,"&");
};
/*
@@ -246,7 +237,7 @@ $tw.utils.parseDate = function(value) {
parseInt(value.substr(10,2)||"00",10),
parseInt(value.substr(12,2)||"00",10),
parseInt(value.substr(14,3)||"000",10)));
} else if ($tw.utils.isDate(value)) {
} else if($tw.utils.isDate(value)) {
return value;
} else {
return null;
@@ -282,7 +273,7 @@ $tw.utils.parseStringArray = function(value) {
}
} while(match);
return results;
} else if ($tw.utils.isArray(value)) {
} else if($tw.utils.isArray(value)) {
return value;
} else {
return null;
@@ -448,11 +439,13 @@ Adds a new password prompt. Options are:
submitText: text to use for submit button (defaults to "Login")
serviceName: text of the human readable service name
noUserName: set true to disable username prompt
canCancel: set true to enable a cancel button (callback called with null)
callback: function to be called on submission with parameter of object {username:,password:}. Callback must return `true` to remove the password prompt
*/
$tw.utils.PasswordPrompt.prototype.createPrompt = function(options) {
// Create and add the prompt to the DOM
var submitText = options.submitText || "Login",
var self = this,
submitText = options.submitText || "Login",
dm = $tw.utils.domMaker,
children = [dm("h1",{text: options.serviceName})];
if(!options.noUserName) {
@@ -465,6 +458,19 @@ $tw.utils.PasswordPrompt.prototype.createPrompt = function(options) {
attributes: {type: "password", name: "password", placeholder: "Password"},
"class": "input-small"
}));
if(options.canCancel) {
children.push(dm("button",{
text: "Cancel",
"class": "btn",
eventListeners: [{
name: "click",
handlerFunction: function(event) {
self.removePrompt(promptInfo);
options.callback(null);
}
}]
}));
}
children.push(dm("button",{
attributes: {type: "submit"},
text: submitText,
@@ -492,12 +498,7 @@ $tw.utils.PasswordPrompt.prototype.createPrompt = function(options) {
// Call the callback
if(options.callback(data)) {
// Remove the prompt if the callback returned true
var i = self.passwordPrompts.indexOf(promptInfo);
if(i !== -1) {
self.passwordPrompts.splice(i,1);
promptInfo.form.parentNode.removeChild(promptInfo.form);
self.setWrapperDisplay();
}
self.removePrompt(promptInfo);
} else {
// Clear the password if the callback returned false
$tw.utils.each(form.elements,function(element) {
@@ -520,17 +521,29 @@ $tw.utils.PasswordPrompt.prototype.createPrompt = function(options) {
this.setWrapperDisplay();
};
$tw.utils.PasswordPrompt.prototype.removePrompt = function(promptInfo) {
var i = this.passwordPrompts.indexOf(promptInfo);
if(i !== -1) {
this.passwordPrompts.splice(i,1);
promptInfo.form.parentNode.removeChild(promptInfo.form);
this.setWrapperDisplay();
}
}
/*
Crypto helper object for encrypted content. It maintains the password text in a closure, and provides methods to change
the password, and to encrypt/decrypt a block of text
*/
$tw.utils.Crypto = function() {
var sjcl = $tw.browser ? window.sjcl : require("./sjcl.js"),
password = null,
callSjcl = function(method,inputText) {
currentPassword = null,
callSjcl = function(method,inputText,password) {
password = password || currentPassword;
var outputText;
try {
outputText = sjcl[method](password,inputText);
if(password) {
outputText = sjcl[method](password,inputText);
}
} catch(ex) {
console.log("Crypto error:" + ex);
outputText = null;
@@ -538,22 +551,22 @@ $tw.utils.Crypto = function() {
return outputText;
};
this.setPassword = function(newPassword) {
password = newPassword;
currentPassword = newPassword;
this.updateCryptoStateTiddler();
};
this.updateCryptoStateTiddler = function() {
if($tw.wiki && $tw.wiki.addTiddler) {
$tw.wiki.addTiddler(new $tw.Tiddler({title: "$:/isEncrypted", text: password ? "yes" : "no"}));
$tw.wiki.addTiddler(new $tw.Tiddler({title: "$:/isEncrypted", text: currentPassword ? "yes" : "no"}));
}
};
this.hasPassword = function() {
return !!password;
return !!currentPassword;
}
this.encrypt = function(text) {
return callSjcl("encrypt",text);
this.encrypt = function(text,password) {
return callSjcl("encrypt",text,password);
};
this.decrypt = function(text) {
return callSjcl("decrypt",text);
this.decrypt = function(text,password) {
return callSjcl("decrypt",text,password);
};
};
@@ -779,7 +792,9 @@ $tw.Wiki.prototype.addTiddler = function(tiddler) {
if(!(tiddler instanceof $tw.Tiddler)) {
tiddler = new $tw.Tiddler(tiddler);
}
this.tiddlers[tiddler.fields.title] = tiddler;
if(tiddler.fields.title) {
this.tiddlers[tiddler.fields.title] = tiddler;
}
};
$tw.Wiki.prototype.addTiddlers = function(tiddlers) {
@@ -859,10 +874,12 @@ $tw.Wiki.prototype.unpackPluginTiddlers = function() {
// Extract the constituent tiddlers
$tw.utils.each(pluginInfo.tiddlers,function(constituentTiddler,constituentTitle) {
// Save the tiddler object
self.shadowTiddlers[constituentTitle] = {
source: tiddler.fields.title,
tiddler: new $tw.Tiddler(constituentTiddler,{title: constituentTitle})
};
if(constituentTitle) {
self.shadowTiddlers[constituentTitle] = {
source: tiddler.fields.title,
tiddler: new $tw.Tiddler(constituentTiddler,{title: constituentTitle})
};
}
});
});
};
@@ -911,7 +928,7 @@ $tw.Wiki.prototype.getTiddler = function(title) {
var t = this.tiddlers[title];
if(t instanceof $tw.Tiddler) {
return t;
} else if($tw.utils.hop(this.shadowTiddlers,title)) {
} else if(title !== undefined && $tw.utils.hop(this.shadowTiddlers,title)) {
return this.shadowTiddlers[title].tiddler;
} else {
return undefined;
@@ -1096,7 +1113,7 @@ $tw.modules.define("$:/boot/tiddlerdeserializer/dom","tiddlerdeserializer",{
}
});
$tw.loadTiddlers = function() {
$tw.loadTiddlersBrowser = function() {
// In the browser, we load tiddlers from certain elements
var containerIds = [
"libraryModules",
@@ -1131,6 +1148,12 @@ $tw.boot.decryptEncryptedTiddlers = function(callback) {
callback();
};
}
/////////////////////////// Node definitions
if($tw.node) {
/*
Load the tiddlers contained in a particular file (and optionally extract fields from the accompanying .meta file) returned as {filepath:,type:,tiddlers:[],hasMetaFile:}
*/
@@ -1226,7 +1249,9 @@ $tw.loadPluginFolder = function(filepath,excludeRegExp) {
// Save the plugin tiddlers into the plugin info
pluginInfo.tiddlers = pluginInfo.tiddlers || {};
for(t=0; t<pluginTiddlers.length; t++) {
pluginInfo.tiddlers[pluginTiddlers[t].title] = pluginTiddlers[t];
if(pluginTiddlers[t].title) {
pluginInfo.tiddlers[pluginTiddlers[t].title] = pluginTiddlers[t];
}
}
}
}
@@ -1357,7 +1382,7 @@ $tw.loadWikiTiddlers = function(wikiPath,parentPaths) {
return wikiInfo;
};
$tw.loadTiddlers = function() {
$tw.loadTiddlersNode = function() {
// Load the boot tiddlers
$tw.utils.each($tw.loadTiddlersFromPath($tw.boot.bootPath),function(tiddlerFile) {
$tw.wiki.addTiddlers(tiddlerFile.tiddlers);
@@ -1370,12 +1395,17 @@ $tw.loadTiddlers = function() {
}
};
// End of if(!$tw.browser)
// End of if($tw.node)
}
/////////////////////////// Main startup function called once tiddlers have been decrypted
$tw.boot.startup = function() {
/*
Startup TiddlyWiki. Options are:
readBrowserTiddlers: whether to read tiddlers from the HTML file we're executing within; if not, tiddlers are read from the file system with Node.js APIs
*/
$tw.boot.startup = function(options) {
options = options || {};
// Initialise some more $tw properties
$tw.utils.deepDefaults($tw,{
modules: { // Information about each module
@@ -1394,7 +1424,7 @@ $tw.boot.startup = function() {
contentTypeInfo: {} // Map type to {encoding:,extension:}
}
});
if(!$tw.browser) {
if(!options.readBrowserTiddlers) {
// For writable tiddler files, a hashmap of title to {filepath:,type:,hasMetaFile:}
$tw.boot.files = {};
// System paths and filenames
@@ -1413,7 +1443,7 @@ $tw.boot.startup = function() {
$tw.boot.wikiPath = process.cwd();
}
// Read package info
$tw.packageInfo = require("../package");
$tw.packageInfo = require("../package.json");
// Check node version number
if($tw.utils.checkVersions($tw.packageInfo.engines.node.substr(2),process.version.substr(1))) {
$tw.utils.error("TiddlyWiki5 requires node.js version " + $tw.packageInfo.engines.node);
@@ -1444,7 +1474,11 @@ $tw.boot.startup = function() {
$tw.Wiki.tiddlerDeserializerModules = {};
$tw.modules.applyMethods("tiddlerdeserializer",$tw.Wiki.tiddlerDeserializerModules);
// Load tiddlers
$tw.loadTiddlers();
if(options.readBrowserTiddlers) {
$tw.loadTiddlersBrowser();
} else {
$tw.loadTiddlersNode();
}
// Unpack plugin tiddlers
$tw.wiki.registerPluginTiddlers("plugin");
$tw.wiki.unpackPluginTiddlers();
@@ -1453,7 +1487,9 @@ $tw.boot.startup = function() {
// And any modules within plugins
$tw.wiki.defineShadowModules();
// Make sure the crypto state tiddler is up to date
$tw.crypto.updateCryptoStateTiddler();
if($tw.crypto) {
$tw.crypto.updateCryptoStateTiddler();
}
// Run any startup modules
$tw.modules.forEachModuleOfType("startup",function(title,module) {
if(module.startup) {
@@ -1474,13 +1510,15 @@ $tw.boot.boot = function() {
// Preload any encrypted tiddlers
$tw.boot.decryptEncryptedTiddlers(function() {
// Startup
$tw.boot.startup();
$tw.boot.startup({
readBrowserTiddlers: !!$tw.browser
});
});
};
/////////////////////////// Autoboot in the browser
if($tw.browser) {
if($tw.browser && !$tw.boot.suppressBoot) {
$tw.boot.boot();
}

View File

@@ -16,7 +16,12 @@ var _bootprefix = (function($tw) {
"use strict";
$tw = $tw || {browser: typeof(window) !== "undefined" ? {} : null};
$tw = $tw || {};
// Detect platforms
$tw.browser = typeof(window) !== "undefined" ? {} : null;
$tw.node = typeof(process) === "object" ? {} : null;
$tw.nodeWebKit = $tw.node && global.window && global.window.nwDispatcher ? {} : null;
/*
Information about each module is kept in an object with these members:
@@ -92,6 +97,3 @@ if(typeof(exports) === "undefined") {
// Export functionality as a module
exports.bootprefix = _bootprefix;
}

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,3 @@
title: $:/config/EditorTypeMappings/image/gif
bitmap

View File

@@ -0,0 +1,3 @@
title: $:/config/EditorTypeMappings/image/jpeg
bitmap

View File

@@ -0,0 +1,3 @@
title: $:/config/EditorTypeMappings/image/jpg
bitmap

View File

@@ -0,0 +1,3 @@
title: $:/config/EditorTypeMappings/image/png
bitmap

View File

@@ -0,0 +1,3 @@
title: $:/config/EditorTypeMappings/image/x-icon
bitmap

View File

@@ -0,0 +1,3 @@
title: $:/config/EditorTypeMappings/text/vnd.tiddlywiki
text

View File

@@ -4,7 +4,7 @@ type: text/plain
TiddlyWiki created by Jeremy Ruston, (jeremy [at] jermolene [dot] com)
Copyright © Jeremy Ruston 2004-2007
Copyright © UnaMesa Association 2007-2013
Copyright © UnaMesa Association 2007-2014
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:

View File

@@ -0,0 +1,3 @@
title: $:/docs/types/image/x-icon
description: ICO format icon file
name: image/x-icon

View File

@@ -1,3 +1,3 @@
title: $:/docs/types/text/vnd.tiddlywiki
description: TW5 wikitext
description: TiddlyWiki version 5 wikitext
name: text/vnd.tiddlywiki

View File

@@ -0,0 +1,3 @@
title: $:/docs/types/text/x-tiddlywiki
description: TiddlyWiki Classic wikitext
name: text/x-tiddlywiki

View File

@@ -42,7 +42,7 @@ Command.prototype.execute = function() {
$tw.utils.each(tiddlers,function(title) {
var parser = wiki.parseTiddler(template),
widgetNode = wiki.makeWidget(parser,{variables: {currentTiddler: title}});
var container = $tw.document.createElement("div");
var container = $tw.fakeDocument.createElement("div");
widgetNode.render(container,null);
var text = type === "text/html" ? container.innerHTML : container.textContent;
fs.writeFileSync(path.resolve(pathname,encodeURIComponent(title) + extension),text,"utf8");

View File

@@ -79,7 +79,7 @@ SimpleServer.prototype.checkCredentials = function(request,incomingUsername,inco
}
}
SimpleServer.prototype.listen = function(port) {
SimpleServer.prototype.listen = function(port,host) {
var self = this;
http.createServer(function(request,response) {
// Compose the state object
@@ -125,7 +125,7 @@ SimpleServer.prototype.listen = function(port) {
});
break;
}
}).listen(port);
}).listen(port,host);
};
var Command = function(params,commander,callback) {
@@ -264,7 +264,8 @@ Command.prototype.execute = function() {
renderType = this.params[2] || "text/plain",
serveType = this.params[3] || "text/html",
username = this.params[4],
password = this.params[5];
password = this.params[5],
host = this.params[6] || "127.0.0.1";
this.server.set({
rootTiddler: rootTiddler,
renderType: renderType,
@@ -272,8 +273,8 @@ Command.prototype.execute = function() {
username: username,
password: password
});
this.server.listen(port);
console.log("Serving on port " + port);
this.server.listen(port,host);
console.log("Serving on " + host + ":" + port);
console.log("(press ctrl-C to exit)");
return null;
};

View File

@@ -36,30 +36,35 @@ var parseTiddlerDiv = function(text /* [,fields] */) {
}
}
// Parse the DIV body
var divRegExp = /^\s*<div\s+([^>]*)>([(?:\s|\S)]*)<\/div>\s*$/gi,
subDivRegExp = /^\s*<pre>([(?:\s|\S)]*)<\/pre>\s*$/gi,
attrRegExp = /\s*([^=\s]+)\s*=\s*"([^"]*)"/gi,
match = divRegExp.exec(text);
var startRegExp = /^\s*<div\s+([^>]*)>(\s*<pre>)?/gi,
endRegExp,
match = startRegExp.exec(text);
if(match) {
var subMatch = subDivRegExp.exec(match[2]); // Body of the <DIV> tag
if(subMatch) {
result.text = subMatch[1];
// Old-style DIVs don't have the <pre> tag
if(match[2]) {
endRegExp = /<\/pre>\s*<\/div>\s*$/gi;
} else {
result.text = match[2];
endRegExp = /<\/div>\s*$/gi;
}
var endMatch = endRegExp.exec(text);
if(endMatch) {
// Extract the text
result.text = text.substring(match.index + match[0].length,endMatch.index);
// Process the attributes
var attrRegExp = /\s*([^=\s]+)\s*=\s*"([^"]*)"/gi,
attrMatch;
do {
attrMatch = attrRegExp.exec(match[1]);
if(attrMatch) {
var name = attrMatch[1];
var value = attrMatch[2];
result[name] = value;
}
} while(attrMatch);
return result;
}
var attrMatch;
do {
attrMatch = attrRegExp.exec(match[1]);
if(attrMatch) {
var name = attrMatch[1];
var value = attrMatch[2];
result[name] = value;
}
} while(attrMatch);
return result;
} else {
return undefined;
}
return undefined;
};
exports["application/x-tiddler-html-div"] = function(text,fields) {
@@ -95,7 +100,7 @@ exports["text/html"] = function(text,fields) {
var storeAreaMarkerRegExp = /<div id=["']?storeArea['"]?( style=["']?display:none;["']?)?>/gi,
match = storeAreaMarkerRegExp.exec(text);
if(match) {
// If so, it's either a classic TiddlyWiki file or a TW5 file
// If so, it's either a classic TiddlyWiki file or an unencrypted TW5 file
// First read the normal tiddlers
var results = deserializeTiddlyWikiFile(text,storeAreaMarkerRegExp.lastIndex,!!match[1],fields);
// Then any system tiddlers
@@ -106,8 +111,15 @@ exports["text/html"] = function(text,fields) {
}
return results
} else {
// It's not a TiddlyWiki so we'll return the entire HTML file as a tiddler
return deserializeHtmlFile(text,fields);
// Check whether we've got an encrypted file
var encryptedStoreArea = $tw.utils.extractEncryptedStoreArea(text);
if(encryptedStoreArea) {
// If so, attempt to decrypt it using the current password
return $tw.utils.decryptStoreArea(encryptedStoreArea);
} else {
// It's not a TiddlyWiki so we'll return the entire HTML file as a tiddler
return deserializeHtmlFile(text,fields);
}
}
};

View File

@@ -33,31 +33,55 @@ function parseFilterOperation(operators,filterString,p) {
operator.prefix = filterString.charAt(p++);
}
// Get the operator name
bracketPos = filterString.indexOf("[",p);
curlyBracketPos = filterString.indexOf("{",p);
if((bracketPos === -1) && (curlyBracketPos === -1)) {
var nextBracketPos = filterString.substring(p).search(/[\[\{\/]/);
if(nextBracketPos === -1) {
throw "Missing [ in filter expression";
}
if(bracketPos === -1 || (curlyBracketPos !== -1 && curlyBracketPos < bracketPos)) {
// Curly brackets
operator.indirect = true;
operator.operator = filterString.substring(p,curlyBracketPos);
p = curlyBracketPos + 1;
} else {
// Square brackets
operator.operator = filterString.substring(p,bracketPos);
p = bracketPos + 1;
nextBracketPos += p;
var bracket = filterString.charAt(nextBracketPos);
operator.operator = filterString.substring(p,nextBracketPos);
// Any suffix?
var colon = operator.operator.indexOf(':');
if(colon > -1) {
operator.suffix = operator.operator.substring(colon + 1);
operator.operator = operator.operator.substring(0,colon) || "field";
}
if(operator.operator === "") {
// Empty operator means: title
else if(operator.operator === "") {
operator.operator = "title";
}
// Get the operand
bracketPos = filterString.indexOf(operator.indirect ? "}" : "]",p);
if(bracketPos === -1) {
p = nextBracketPos + 1;
switch (bracket) {
case '{': // Curly brackets
operator.indirect = true;
nextBracketPos = filterString.indexOf('}',p);
break;
case '[': // Square brackets
nextBracketPos = filterString.indexOf(']',p);
break;
case '/': // regexp brackets
var rex = /^((?:[^\\\/]*|\\.))*\/(?:\(([mygi]+)\))?/g,
rexMatch = rex.exec(filterString.substring(p));
if(rexMatch) {
operator.regexp = new RegExp(rexMatch[1], rexMatch[2]);
nextBracketPos = p + rex.lastIndex - 1;
}
else {
throw "Unterminated regular expression in filter expression";
}
break;
}
if(nextBracketPos === -1) {
throw "Missing closing bracket in filter expression";
}
operator.operand = filterString.substring(p,bracketPos);
p = bracketPos + 1;
if(!operator.regexp) {
operator.operand = filterString.substring(p,nextBracketPos);
}
p = nextBracketPos + 1;
// Push this operator
operators.push(operator);
} while(filterString.charAt(p) !== "]");
@@ -161,7 +185,9 @@ exports.compileFilter = function(filterString) {
results = operatorFunction(accumulator,{
operator: operator.operator,
operand: operand,
prefix: operator.prefix
prefix: operator.prefix,
suffix: operator.suffix,
regexp: operator.regexp
},{
wiki: self,
currTiddlerTitle: currTiddlerTitle

View File

@@ -16,12 +16,19 @@ Filter operator for comparing fields for equality
Export our filter function
*/
exports.field = function(source,operator,options) {
var results = [];
var results = [],
fieldname = (operator.suffix || operator.operator).toLowerCase();
// Function to check an individual title
function checkTiddler(title) {
var tiddler = options.wiki.getTiddler(title);
if(tiddler) {
var match = tiddler.getFieldString(operator.operator) === operator.operand;
var match,
text = tiddler.getFieldString(fieldname);
if(operator.regexp) {
match = !!operator.regexp.exec(text);
} else {
match = text === operator.operand;
}
if(operator.prefix === "!") {
match = !match;
}

View File

@@ -21,7 +21,7 @@ exports.has = function(source,operator,options) {
function checkTiddler(title) {
var tiddler = options.wiki.getTiddler(title);
if(tiddler) {
var match = $tw.utils.hop(tiddler.fields,operator.operand);
var match = $tw.utils.hop(tiddler.fields,operator.operand) && tiddler.fields[operator.operand] !== "";
if(operator.prefix === "!") {
match = !match;
}

View File

@@ -17,7 +17,8 @@ Export our filter function
*/
exports.list = function(source,operator,options) {
var results = [],
list = options.wiki.getTiddlerList(operator.operand);
tr = $tw.utils.parseTextReference(operator.operand),
list = options.wiki.getTiddlerList(tr.title,tr.field,tr.index);
function checkTiddler(title) {
var match = list.indexOf(title) !== -1;
if(operator.prefix === "!") {

View File

@@ -0,0 +1,87 @@
/*\
title: $:/core/modules/filters/listops.js
type: application/javascript
module-type: filteroperator
Filter operators for manipulating the current selection list
\*/
(function(){
/*jslint node: true, browser: true */
/*global $tw: false */
"use strict";
/*
Reverse list
*/
exports.reverse = function(source,operator,options) {
var results = [];
if(!$tw.utils.isArray(source)) {
source = Object.keys(source).sort();
}
$tw.utils.each(source,function(title) {
results.unshift(title);
});
return results;
};
/*
First entry/entries in list
*/
exports.first = function(source,operator,options) {
var count = parseInt(operator.operand) || 1;
if(!$tw.utils.isArray(source)) {
source = Object.keys(source).sort();
}
return source.slice(0,Math.min(count,source.length));
};
/*
Last entry/entries in list
*/
exports.last = function(source,operator,options) {
var count = parseInt(operator.operand) || 1;
if(!$tw.utils.isArray(source)) {
source = Object.keys(source).sort();
}
return source.slice(-count);
};
/*
All but the first entry/entries of the list
*/
exports.rest = function(source,operator,options) {
var count = parseInt(operator.operand) || 1;
if(!$tw.utils.isArray(source)) {
source = Object.keys(source).sort();
}
return source.slice(count);
};
exports.butfirst = exports.rest;
exports.bf = exports.rest;
/*
All but the last entry/entries of the list
*/
exports.butlast = function(source,operator,options) {
var count = parseInt(operator.operand) || 1;
if(!$tw.utils.isArray(source)) {
source = Object.keys(source).sort();
}
return source.slice(0,-count);
};
exports.bl = exports.butlast;
/*
The nth member of the list
*/
exports.nth = function(source,operator,options) {
var count = parseInt(operator.operand) || 1;
if(!$tw.utils.isArray(source)) {
source = Object.keys(source).sort();
}
return source.slice(count-1,count);
};
})();

View File

@@ -16,6 +16,30 @@ Filter operator for sorting
Export our filter function
*/
exports.sort = function(source,operator,options) {
var results = prepare_results(source);
options.wiki.sortTiddlers(results,operator.operand,operator.prefix === "!",false,false);
return results;
};
exports.nsort = function(source,operator,options) {
var results = prepare_results(source);
options.wiki.sortTiddlers(results,operator.operand,operator.prefix === "!",false,true);
return results;
};
exports.sortcs = function(source,operator,options) {
var results = prepare_results(source);
options.wiki.sortTiddlers(results,operator.operand,operator.prefix === "!",true,false);
return results;
};
exports.nsortcs = function(source,operator,options) {
var results = prepare_results(source);
options.wiki.sortTiddlers(results,operator.operand,operator.prefix === "!",true,true);
return results;
};
var prepare_results = function (source) {
var results;
if($tw.utils.isArray(source)) {
results = source;
@@ -25,8 +49,7 @@ exports.sort = function(source,operator,options) {
results.push(title);
});
}
options.wiki.sortTiddlers(results,operator.operand,operator.prefix === "!");
return results;
};
}
})();

View File

@@ -1,32 +0,0 @@
/*\
title: $:/core/modules/filters/sortcs.js
type: application/javascript
module-type: filteroperator
Filter operator for case-sensitive sorting
\*/
(function(){
/*jslint node: true, browser: true */
/*global $tw: false */
"use strict";
/*
Export our filter function
*/
exports.sortcs = function(source,operator,options) {
var results;
if($tw.utils.isArray(source)) {
results = source;
} else {
results = [];
$tw.utils.each(source,function(element,title) {
results.push(title);
});
}
options.wiki.sortTiddlers(results,operator.operand,operator.prefix === "!",true);
return results;
};
})();

View File

@@ -38,6 +38,7 @@ exports["image/jpeg"] = ImageParser;
exports["image/png"] = ImageParser;
exports["image/gif"] = ImageParser;
exports["application/pdf"] = ImageParser;
exports["image/x-icon"] = ImageParser;
})();

View File

@@ -28,6 +28,7 @@ exports["text/x-tiddlywiki"] = TextParser;
exports["application/javascript"] = TextParser;
exports["application/json"] = TextParser;
exports["text/css"] = TextParser;
exports["application/x-tiddler-dictionary"] = TextParser;
})();

View File

@@ -23,14 +23,15 @@ exports.types = {block: true};
exports.init = function(parser) {
this.parser = parser;
// Regexp to match
this.matchRegExp = /```\r?\n/mg;
// Regexp to match and get language if defined
this.matchRegExp = /```([\w-]*)\r?\n/mg;
};
exports.parse = function() {
var reEnd = /(\r?\n```$)/mg;
// Move past the match
this.parser.pos = this.matchRegExp.lastIndex;
// Look for the end of the block
reEnd.lastIndex = this.parser.pos;
var match = reEnd.exec(this.parser.source),
@@ -43,14 +44,14 @@ exports.parse = function() {
text = this.parser.source.substr(this.parser.pos);
this.parser.pos = this.parser.sourceLength;
}
// Return the pre element
// Return the $codeblock widget
return [{
type: "element",
tag: "pre",
children: [{
type: "text",
text: text
}]
type: "element",
tag: "$codeblock",
attributes: {
code: {type: "string", value: text},
language: {type: "string", value: this.match[1]}
}
}];
};

View File

@@ -7,6 +7,7 @@ Wiki text inline rule for code runs. For example:
```
This is a `code run`.
This is another ``code run``
```
\*/
@@ -22,13 +23,13 @@ exports.types = {inline: true};
exports.init = function(parser) {
this.parser = parser;
// Regexp to match
this.matchRegExp = /`/mg;
this.matchRegExp = /(``?)/mg;
};
exports.parse = function() {
// Move past the match
this.parser.pos = this.matchRegExp.lastIndex;
var reEnd = /`/mg;
var reEnd = new RegExp(this.match[1], "mg");
// Look for the end marker
reEnd.lastIndex = this.parser.pos;
var match = reEnd.exec(this.parser.source),

View File

@@ -22,7 +22,7 @@ exports.types = {block: true};
exports.init = function(parser) {
this.parser = parser;
// Regexp to match
this.matchRegExp = /-{3,}\r?\n/mg;
this.matchRegExp = /-{3,}\r?(?:\n|$)/mg;
};
exports.parse = function() {

View File

@@ -59,7 +59,7 @@ exports.parse = function() {
// before handling the cite, parse the body of the quote
var tree= this.parser.parseBlocks(reEndString);
// If we got a cite, put it before the text
if ( cite.length > 0 ) {
if(cite.length > 0) {
tree.unshift({
type: "element",
tag: "cite",
@@ -71,7 +71,7 @@ exports.parse = function() {
this.parser.skipWhitespace({treatNewlinesAsNonWhitespace: true});
var cite = this.parser.parseInlineRun(/(\r?\n)/mg);
// If we got a cite, push it
if ( cite.length > 0 ) {
if(cite.length > 0) {
tree.push({
type: "element",
tag: "cite",

View File

@@ -18,11 +18,11 @@ exports.types = {block: true};
exports.init = function(parser) {
this.parser = parser;
// Regexp to match
this.matchRegExp = /^\|(?:[^\n]*)\|(?:[fhck]?)\r?\n/mg;
this.matchRegExp = /^\|(?:[^\n]*)\|(?:[fhck]?)\r?(?:\n|$)/mg;
};
var processRow = function(prevColumns) {
var cellRegExp = /(?:\|([^\n\|]*)\|)|(\|[fhck]?\r?\n)/mg,
var cellRegExp = /(?:\|([^\n\|]*)\|)|(\|[fhck]?\r?(?:\n|$))/mg,
cellTermRegExp = /((?:\x20*)\|)/mg,
tree = [],
col = 0,
@@ -38,7 +38,8 @@ var processRow = function(prevColumns) {
if(last) {
last.rowSpanCount++;
$tw.utils.addAttributeToParseTreeNode(last.element,"rowspan",last.rowSpanCount);
$tw.utils.addAttributeToParseTreeNode(last.element,"valign","center");
var vAlign = $tw.utils.getAttributeValueFromParseTreeNode(last.element,"valign","center");
$tw.utils.addAttributeToParseTreeNode(last.element,"valign",vAlign);
if(colSpanCount > 1) {
$tw.utils.addAttributeToParseTreeNode(last.element,"colspan",colSpanCount);
colSpanCount = 1;
@@ -51,9 +52,20 @@ var processRow = function(prevColumns) {
colSpanCount++;
// Move to just before the `|` terminating the cell
this.parser.pos = cellRegExp.lastIndex - 1;
} else if(cellMatch[1] === "<" && prevCell) {
colSpanCount = 1 + $tw.utils.getAttributeValueFromParseTreeNode(prevCell,"colspan",1);
$tw.utils.addAttributeToParseTreeNode(prevCell,"colspan",colSpanCount);
colSpanCount = 1;
// Move to just before the `|` terminating the cell
this.parser.pos = cellRegExp.lastIndex - 1;
} else if(cellMatch[2]) {
// End of row
if(prevCell && colSpanCount > 1) {
if(prevCell.attributes && prevCell.attributes && prevCell.attributes.colspan) {
colSpanCount += prevCell.attributes.colspan.value;
} else {
colSpanCount -= 1;
}
$tw.utils.addAttributeToParseTreeNode(prevCell,"colspan",colSpanCount);
}
this.parser.pos = cellRegExp.lastIndex - 1;
@@ -63,7 +75,16 @@ var processRow = function(prevColumns) {
this.parser.pos++;
// Look for a space at the start of the cell
var spaceLeft = false,
chr = this.parser.source.substr(this.parser.pos,1);
vAlign = null;
if(this.parser.source.substr(this.parser.pos).search(/^\^([^\^]|\^\^)/) === 0) {
vAlign = "top";
} else if(this.parser.source.substr(this.parser.pos).search(/^,([^,]|,,)/) === 0) {
vAlign = "bottom";
}
if(vAlign) {
this.parser.pos++;
}
var chr = this.parser.source.substr(this.parser.pos,1);
while(chr === " ") {
spaceLeft = true;
this.parser.pos++;
@@ -89,7 +110,10 @@ var processRow = function(prevColumns) {
// Parse the cell
cell.children = this.parser.parseInlineRun(cellTermRegExp,{eatTerminator: true});
// Set the alignment for the cell
if(cellMatch[1].substr(cellMatch[1].length-1,1) === " ") { // spaceRight
if(vAlign) {
$tw.utils.addAttributeToParseTreeNode(cell,"valign",vAlign);
}
if(this.parser.source.substr(this.parser.pos - 2,1) === " ") { // spaceRight
$tw.utils.addAttributeToParseTreeNode(cell,"align",spaceLeft ? "center" : "left");
} else if(spaceLeft) {
$tw.utils.addAttributeToParseTreeNode(cell,"align","right");
@@ -107,8 +131,8 @@ var processRow = function(prevColumns) {
exports.parse = function() {
var rowContainerTypes = {"c":"caption", "h":"thead", "":"tbody", "f":"tfoot"},
table = {type: "element", tag: "table", children: []},
rowRegExp = /^\|([^\n]*)\|([fhck]?)\r?\n/mg,
rowTermRegExp = /(\|(?:[fhck]?)\r?\n)/mg,
rowRegExp = /^\|([^\n]*)\|([fhck]?)\r?(?:\n|$)/mg,
rowTermRegExp = /(\|(?:[fhck]?)\r?(?:\n|$))/mg,
prevColumns = [],
currRowType,
rowContainer,
@@ -124,7 +148,7 @@ exports.parse = function() {
this.parser.pos = rowMatch.index + rowMatch[0].length;
} else {
// Otherwise, create a new row if this one is of a different type
if(rowType != currRowType) {
if(rowType !== currRowType) {
rowContainer = {type: "element", tag: rowContainerTypes[rowType], children: []};
table.children.push(rowContainer);
currRowType = rowType;

View File

@@ -40,7 +40,7 @@ exports.init = function(parser) {
};
exports.parse = function() {
var reEnd = /\r?\n\$\$\$\r?\n/mg;
var reEnd = /\r?\n\$\$\$\r?(?:\n|$)/mg;
// Save the type
var parseType = this.match[1],
renderType = this.match[2];
@@ -66,7 +66,7 @@ exports.parse = function() {
} else {
// Otherwise, render to the rendertype and return in a <PRE> tag
var widgetNode = this.parser.wiki.makeWidget(parser),
container = $tw.document.createElement("div");
container = $tw.fakeDocument.createElement("div");
widgetNode.render(container,null);
var text = renderType === "text/html" ? container.innerHTML : container.textContent;
return [{

View File

@@ -28,7 +28,7 @@ DownloadSaver.prototype.save = function(text,method,callback) {
// Set up the link
var link = document.createElement("a");
link.setAttribute("target","_blank");
if(Blob != undefined) {
if(Blob !== undefined) {
var blob = new Blob([text], {type: "text/html"});
link.setAttribute("href", URL.createObjectURL(blob));
} else {

View File

@@ -32,7 +32,7 @@ FSOSaver.prototype.save = function(text,method,callback) {
if(/^\/[A-Z]\:\\[^\\]+/i.test(pathname)) { // ie: ^/[a-z]:/[^/]+
// Remove the leading slash
pathname = pathname.substr(1);
} else if (document.location.hostname !== "" && /^\/\\[^\\]+\\[^\\]+/i.test(pathname)) { // test for \\server\share\blah... - ^/[^/]+/[^/]+
} else if(document.location.hostname !== "" && /^\/\\[^\\]+\\[^\\]+/i.test(pathname)) { // test for \\server\share\blah... - ^/[^/]+/[^/]+
// Remove the leading slash
pathname = pathname.substr(1);
// reconstruct UNC path

View File

@@ -27,10 +27,11 @@ UploadSaver.prototype.save = function(text,method,callback) {
return false;
}
// Get the various parameters we need
var backupDir = ".",
var backupDir = this.wiki.getTextReference("$:/UploadBackupDir") || ".",
username = this.wiki.getTextReference("$:/UploadName"),
password = $tw.utils.getPassword("upload"),
uploadDir = ".",
uploadDir = this.wiki.getTextReference("$:/UploadDir") || ".",
uploadFilename = this.wiki.getTextReference("$:/UploadFilename") || "index.html",
url = this.wiki.getTextReference("$:/UploadURL");
// Bail out if we don't have the bits we need
if(!username || username.toString().trim() === "" || !password || password.toString().trim() === "") {
@@ -47,7 +48,7 @@ UploadSaver.prototype.save = function(text,method,callback) {
head.push("--" + boundary + "\r\nContent-disposition: form-data; name=\"UploadPlugin\"\r\n");
head.push("backupDir=" + backupDir + ";user=" + username + ";password=" + password + ";uploaddir=" + uploadDir + ";;");
head.push("\r\n" + "--" + boundary);
head.push("Content-disposition: form-data; name=\"userfile\"; filename=\"index.html\"");
head.push("Content-disposition: form-data; name=\"userfile\"; filename=\"" + uploadFilename + "\"");
head.push("Content-Type: text/html;charset=UTF-8");
head.push("Content-Length: " + text.length + "\r\n");
head.push("");
@@ -60,7 +61,7 @@ UploadSaver.prototype.save = function(text,method,callback) {
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.trim() === "0 - Fileindex.html") {
if(http.responseText.substr(0,4) === "0 - ") {
callback(null);
} else {
callback(http.responseText);
@@ -77,7 +78,7 @@ Information about this saver
*/
UploadSaver.prototype.info = {
name: "upload",
priority: 500
priority: 2000
};
/*

View File

@@ -16,10 +16,13 @@ var widget = require("$:/core/modules/widgets/widget.js");
exports.startup = function() {
var modules,n,m,f,commander;
// Load modules
// Load utility modules and initialise the logger
$tw.modules.applyMethods("utils",$tw.utils);
$tw.logger = new $tw.utils.Logger();
$tw.log = $tw.logger.log;
// Load other modules
$tw.modules.applyMethods("global",$tw);
$tw.modules.applyMethods("config",$tw.config);
$tw.modules.applyMethods("utils",$tw.utils);
if($tw.browser) {
$tw.utils.getBrowserInfo($tw.browser);
}
@@ -103,8 +106,11 @@ exports.startup = function() {
serviceName: "Set a new password for this TiddlyWiki",
noUserName: true,
submitText: "Set password",
canCancel: true,
callback: function(data) {
$tw.crypto.setPassword(data.password);
if(data) {
$tw.crypto.setPassword(data.password);
}
return true; // Get rid of the password prompt
}
});
@@ -112,11 +118,26 @@ exports.startup = function() {
$tw.rootWidget.addEventListener("tw-clear-password",function(event) {
$tw.crypto.setPassword(null);
});
// Set up the favicon
var faviconTitle = "$:/favicon.ico",
faviconLink = document.getElementById("faviconLink"),
setFavicon = function() {
var tiddler = $tw.wiki.getTiddler(faviconTitle);
if(tiddler) {
faviconLink.setAttribute("href","data:" + tiddler.fields.type + ";base64," + tiddler.fields.text);
}
};
setFavicon();
$tw.wiki.addEventListener("change",function(changes) {
if($tw.utils.hop(changes,faviconTitle)) {
setFavicon();
}
});
// Set up the styles
var styleTemplateTitle = "$:/core/ui/PageStylesheet",
styleParser = $tw.wiki.parseTiddler(styleTemplateTitle);
$tw.styleWidgetNode = $tw.wiki.makeWidget(styleParser,{document: $tw.document});
$tw.styleContainer = $tw.document.createElement("style");
$tw.styleWidgetNode = $tw.wiki.makeWidget(styleParser,{document: $tw.fakeDocument});
$tw.styleContainer = $tw.fakeDocument.createElement("style");
$tw.styleWidgetNode.render($tw.styleContainer,null);
$tw.styleElement = document.createElement("style");
$tw.styleElement.innerHTML = $tw.styleContainer.textContent;

View File

@@ -19,6 +19,8 @@ wiki: wiki to be synced
function Syncer(options) {
var self = this;
this.wiki = options.wiki;
// Make a logger
this.log = $tw.logger.makeLog("syncer");
// Find a working syncadaptor
this.syncadaptor = undefined;
$tw.modules.forEachModuleOfType("syncadaptor",function(title,module) {
@@ -36,18 +38,7 @@ function Syncer(options) {
Error handling
*/
Syncer.prototype.showError = function(error) {
alert("Syncer error: " + error);
$tw.utils.log("Syncer error: " + error);
};
/*
Message logging
*/
Syncer.prototype.log = function(/* arguments */) {
var args = Array.prototype.slice.call(arguments,0);
args[0] = "Syncer: " + args[0];
// Temporarily disable logging to help the wood vs. trees situation; we need better filtering of log messages
//$tw.utils.log.apply(null,args);
this.log("Error: " + error);
};
/*
@@ -384,7 +375,7 @@ Syncer.prototype.processTaskQueue = function() {
// Dispatch the task
this.dispatchTask(task,function(err) {
if(err) {
console.log("Sync error while processing '" + task.title + "':\n" + err);
self.showError("Sync error while processing '" + task.title + "':\n" + err);
}
// Mark that this task is no longer in progress
delete self.taskInProgress[task.title];

View File

@@ -0,0 +1,81 @@
/*\
title: $:/core/modules/utils/crypto.js
type: application/javascript
module-type: utils
Utility functions related to crypto.
\*/
(function(){
/*jslint node: true, browser: true */
/*global $tw: false */
"use strict";
/*
Look for an encrypted store area in the text of a TiddlyWiki file
*/
exports.extractEncryptedStoreArea = function(text) {
var encryptedStoreAreaStartMarker = "<pre id=\"encryptedStoreArea\" type=\"text/plain\" style=\"display:none;\">",
encryptedStoreAreaStart = text.indexOf(encryptedStoreAreaStartMarker);
if(encryptedStoreAreaStart !== -1) {
var encryptedStoreAreaEnd = text.indexOf("</pre>",encryptedStoreAreaStart);
if(encryptedStoreAreaEnd !== -1) {
return $tw.utils.htmlDecode(text.substring(encryptedStoreAreaStart + encryptedStoreAreaStartMarker.length,encryptedStoreAreaEnd-1));
}
}
return null;
};
/*
Attempt to extract the tiddlers from an encrypted store area using the current password. If the password is not provided then the password in the password store will be used
*/
exports.decryptStoreArea = function(encryptedStoreArea,password) {
var decryptedText = $tw.crypto.decrypt(encryptedStoreArea,password);
if(decryptedText) {
var json = JSON.parse(decryptedText),
tiddlers = [];
for(var title in json) {
if(title !== "$:/isEncrypted") {
tiddlers.push(json[title]);
}
}
return tiddlers;
} else {
return null;
}
};
exports.decryptStoreAreaInteractive = function(encryptedStoreArea,callback) {
// Try to decrypt with the current password
var tiddlers = $tw.utils.decryptStoreArea(encryptedStoreArea);
if(tiddlers) {
callback(tiddlers);
} else {
// Prompt for a new password and keep trying
$tw.passwordPrompt.createPrompt({
serviceName: "Enter a password to decrypt the imported TiddlyWiki",
noUserName: true,
canCancel: true,
submitText: "Decrypt",
callback: function(data) {
// Exit if the user cancelled
if(!data) {
return false;
}
// Attempt to decrypt the tiddlers
var tiddlers = $tw.utils.decryptStoreArea(encryptedStoreArea,data.password);
if(tiddlers) {
callback(tiddlers);
// Exit and remove the password prompt
return true;
} else {
// We didn't decrypt everything, so continue to prompt for password
return false;
}
}
});
}
};
})();

View File

@@ -18,9 +18,11 @@ Set style properties of an element
styles: ordered array of {name: value} pairs
*/
exports.setStyle = function(element,styles) {
for(var t=0; t<styles.length; t++) {
for(var styleName in styles[t]) {
element.style[$tw.utils.convertStyleNameToPropertyName(styleName)] = styles[t][styleName];
if(element.nodeType === 1) { // Element.ELEMENT_NODE
for(var t=0; t<styles.length; t++) {
for(var styleName in styles[t]) {
element.style[$tw.utils.convertStyleNameToPropertyName(styleName)] = styles[t][styleName];
}
}
}
};

View File

@@ -18,7 +18,7 @@ Code thanks to John Resig, http://ejohn.org/blog/comparing-document-position/
*/
exports.domContains = function(a,b) {
return a.contains ?
a != b && a.contains(b) :
a !== b && a.contains(b) :
!!(a.compareDocumentPosition(b) & 16);
};

View File

@@ -67,13 +67,12 @@ Notifier.prototype.display = function(title,options) {
{opacity: "0.0"},
{transform: "translateX(" + (notification.offsetWidth) + "px)"}
]);
// Set up an event for the transition end
notification.addEventListener($tw.utils.convertEventName("transitionEnd"),function(event) {
// Remove the modal message from the DOM once the transition ends
setTimeout(function() {
if(notification.parentNode) {
// Remove the modal message from the DOM
document.body.removeChild(notification);
}
},false);
},duration);
},$tw.config.preferences.notificationDuration);
};

View File

@@ -182,6 +182,6 @@ var document = {
},
};
exports.document = document;
exports.fakeDocument = document;
})();

View File

@@ -0,0 +1,43 @@
/*\
title: $:/core/modules/utils/logger.js
type: application/javascript
module-type: utils
A basic logging implementation
\*/
(function(){
/*jslint node: true, browser: true */
/*global $tw: false */
"use strict";
/*
Make a new logger
*/
function Logger() {
}
/*
Make a log function for a particular component
*/
Logger.prototype.makeLog = function(componentName) {
var self = this;
return function(/* args */) {
self.log.apply(self.log,[componentName + ":"].concat(Array.prototype.slice.call(arguments,0)));
};
};
/*
Log a message
*/
Logger.prototype.log = function(/* args */) {
if(console !== undefined && console.log !== undefined) {
return Function.apply.call(console.log, console, arguments);
}
};
exports.Logger = Logger;
})();

View File

@@ -19,6 +19,13 @@ exports.addAttributeToParseTreeNode = function(node,name,value) {
}
};
exports.getAttributeValueFromParseTreeNode = function(node,name,defaultValue) {
if(node.type === "element" && node.attributes && node.attributes[name] && node.attributes[name].value !== undefined) {
return node.attributes[name].value;
}
return defaultValue;
};
exports.addClassToParseTreeNode = function(node,classString) {
var classes = [];
if(node.type === "element") {

View File

@@ -275,7 +275,7 @@ exports.unescapeLineBreaks = function(s) {
// Copied from peg.js, thanks to David Majda
exports.escape = function(ch) {
var charCode = ch.charCodeAt(0);
if (charCode <= 0xFF) {
if(charCode <= 0xFF) {
return '\\x' + $tw.utils.pad(charCode.toString(16).toUpperCase());
} else {
return '\\u' + $tw.utils.pad(charCode.toString(16).toUpperCase(),4);

View File

@@ -39,8 +39,8 @@ BrowseWidget.prototype.render = function(parent,nextSibling) {
domNode.setAttribute("multiple","multiple");
// Add a click event handler
domNode.addEventListener("change",function (event) {
self.wiki.readFiles(event.target.files,function(tiddlerFields) {
self.dispatchEvent({type: "tw-import-tiddlers", param: JSON.stringify([tiddlerFields])});
self.wiki.readFiles(event.target.files,function(tiddlerFieldsArray) {
self.dispatchEvent({type: "tw-import-tiddlers", param: JSON.stringify(tiddlerFieldsArray)});
});
return false;
},false);

View File

@@ -0,0 +1,64 @@
/*\
title: $:/core/modules/widgets/codeblock.js
type: application/javascript
module-type: widget
Code block node widget
\*/
(function(){
/*jslint node: true, browser: true */
/*global $tw: false */
"use strict";
var Widget = require("$:/core/modules/widgets/widget.js").widget;
var CodeBlockWidget = function(parseTreeNode,options) {
this.initialise(parseTreeNode,options);
};
/*
Inherit from the base widget class
*/
CodeBlockWidget.prototype = new Widget();
/*
Render this widget into the DOM
*/
CodeBlockWidget.prototype.render = function(parent,nextSibling) {
this.parentDomNode = parent;
this.computeAttributes();
this.execute();
var codeNode = this.document.createElement("code");
if(this.getAttribute("language")) {
codeNode.setAttribute("class",this.getAttribute("language"));
}
var domNode = this.document.createElement("pre");
codeNode.appendChild(this.document.createTextNode(this.getAttribute("code")));
domNode.appendChild(codeNode);
parent.insertBefore(domNode,nextSibling);
this.domNodes.push(domNode);
if(this.postRender) {
this.postRender();
}
};
/*
Compute the internal state of the widget
*/
CodeBlockWidget.prototype.execute = function() {
// Nothing to do for a text node
};
/*
Selectively refreshes the widget if needed. Returns true if the widget or any of its children needed re-rendering
*/
CodeBlockWidget.prototype.refresh = function(changedTiddlers) {
return false;
};
exports.codeblock = CodeBlockWidget;
})();

View File

@@ -87,12 +87,14 @@ DropZoneWidget.prototype.handleDropEvent = function(event) {
this.dragEnterCount = 0;
// Remove highlighting
$tw.utils.removeClass(this.domNodes[0],"tw-dragover");
// Try to import the various data types we understand
this.importData(dataTransfer);
// Import any files in the drop
this.wiki.readFiles(dataTransfer.files,function(tiddlerFields) {
self.dispatchEvent({type: "tw-import-tiddlers", param: JSON.stringify([tiddlerFields])});
var numFiles = this.wiki.readFiles(dataTransfer.files,function(tiddlerFieldsArray) {
self.dispatchEvent({type: "tw-import-tiddlers", param: JSON.stringify(tiddlerFieldsArray)});
});
// Try to import the various data types we understand
if(numFiles === 0) {
this.importData(dataTransfer);
}
// Tell the browser that we handled the drop
event.preventDefault();
// Stop the drop ripple up to any parent handlers

View File

@@ -37,11 +37,12 @@ EditTextWidget.prototype.render = function(parent,nextSibling) {
// Execute our logic
this.execute();
// Create our element
var editInfo = this.getEditInfo();
var domNode = this.document.createElement(this.editTag);
if(this.editType) {
domNode.setAttribute("type",this.editType);
}
if(this.editPlaceholder) {
if(editInfo.value === "" && this.editPlaceholder) {
domNode.setAttribute("placeholder",this.editPlaceholder);
}
// Assign classes
@@ -49,7 +50,6 @@ EditTextWidget.prototype.render = function(parent,nextSibling) {
domNode.className = this.editClass;
}
// Set the text
var editInfo = this.getEditInfo();
if(this.editTag === "textarea") {
domNode.appendChild(this.document.createTextNode(editInfo.value));
} else {

View File

@@ -33,16 +33,8 @@ EditWidget.prototype.render = function(parent,nextSibling) {
this.renderChildren(parent,nextSibling);
};
// Mappings from content type to editor type
// TODO: This information should be configurable/extensible
var editorTypeMappings = {
"text/vnd.tiddlywiki": "text",
"image/svg+xml": "text",
"image/jpg": "bitmap",
"image/jpeg": "bitmap",
"image/gif": "bitmap",
"image/png": "bitmap"
};
// Mappings from content type to editor type are stored in tiddlers with this prefix
var EDITOR_MAPPING_PREFIX = "$:/config/EditorTypeMappings/";
/*
Compute the internal state of the widget
@@ -64,7 +56,7 @@ EditWidget.prototype.execute = function() {
}
type = type || "text/vnd.tiddlywiki";
// Choose the appropriate edit widget
var editorType = editorTypeMappings[type] || "text";
var editorType = this.wiki.getTiddlerText(EDITOR_MAPPING_PREFIX + type) || "text";
// Make the child widgets
this.makeChildWidgets([{
type: "edit-" + editorType,

View File

@@ -91,6 +91,9 @@ FieldManglerWidget.prototype.handleRemoveTagEvent = function(event) {
var modification = this.wiki.getModificationFields();
modification.tags = (tiddler.fields.tags || []).slice(0);
modification.tags.splice(p,1);
if(modification.tags.length === 0) {
modification.tags = undefined;
}
this.wiki.addTiddler(new $tw.Tiddler(tiddler,modification));
}
}

View File

@@ -330,7 +330,9 @@ NavigatorWidget.prototype.handleNewTiddlerEvent = function(event) {
var draftTitle = this.generateDraftTitle(title),
draftTiddler = new $tw.Tiddler({
text: ""
},templateTiddler,{
},templateTiddler,
this.wiki.getCreationFields(),
{
title: draftTitle,
"draft.title": title,
"draft.of": title

View File

@@ -84,7 +84,7 @@ RadioWidget.prototype.setValue = function() {
};
RadioWidget.prototype.handleChangeEvent = function(event) {
if (this.inputDomNode.checked) {
if(this.inputDomNode.checked) {
this.setValue();
}
};

View File

@@ -157,7 +157,8 @@ RevealWidget.prototype.refresh = function(changedTiddlers) {
} else {
var refreshed = false;
if(changedTiddlers[this.stateTitle]) {
this.updateState();
// this.updateState();
this.refreshSelf();
refreshed = true;
}
return this.refreshChildren(changedTiddlers) || refreshed;

View File

@@ -28,8 +28,10 @@ Render this widget into the DOM
*/
TextNodeWidget.prototype.render = function(parent,nextSibling) {
this.parentDomNode = parent;
this.computeAttributes();
this.execute();
var textNode = this.document.createTextNode(this.parseTreeNode.text);
var text = this.getAttribute("text",this.parseTreeNode.text),
textNode = this.document.createTextNode(text);
parent.insertBefore(textNode,nextSibling);
this.domNodes.push(textNode);
};

View File

@@ -148,7 +148,7 @@ ViewWidget.prototype.getValueAsDoubleUrlEncoded = function() {
};
ViewWidget.prototype.getValueAsDate = function(format) {
format = format || "YYYY MM DD 0hh:0ss";
format = format || "YYYY MM DD 0hh:0mm";
var value = $tw.utils.parseDate(this.getValue());
if(value && $tw.utils.isDate(value) && value.toString() !== "Invalid Date") {
return $tw.utils.formatDateString(value,format);
@@ -158,8 +158,8 @@ ViewWidget.prototype.getValueAsDate = function(format) {
};
ViewWidget.prototype.getValueAsRelativeDate = function(format) {
var value = this.getValue();
if(value) {
var value = $tw.utils.parseDate(this.getValue());
if(value && $tw.utils.isDate(value) && value.toString() !== "Invalid Date") {
return $tw.utils.getRelativeDate((new Date()) - (new Date(value))).description;
} else {
return "";

View File

@@ -204,10 +204,12 @@ exports.addTiddler = function(tiddler) {
// Get the title
var title = tiddler.fields.title;
// Save the tiddler
this.tiddlers[title] = tiddler;
this.clearCache(title);
this.clearGlobalCache();
this.enqueueTiddlerEvent(title);
if(title) {
this.tiddlers[title] = tiddler;
this.clearCache(title);
this.clearGlobalCache();
this.enqueueTiddlerEvent(title);
}
};
/*
@@ -305,21 +307,27 @@ Sort an array of tiddler titles by a specified field
isDescending: true if the sort should be descending
isCaseSensitive: true if the sort should consider upper and lower case letters to be different
*/
exports.sortTiddlers = function(titles,sortField,isDescending,isCaseSensitive) {
exports.sortTiddlers = function(titles,sortField,isDescending,isCaseSensitive,isNumeric) {
var self = this;
titles.sort(function(a,b) {
if(sortField !== "title") {
a = self.getTiddler(a).fields[sortField] || "";
b = self.getTiddler(b).fields[sortField] || "";
}
if(!isCaseSensitive) {
if(typeof a === "string") {
a = a.toLowerCase();
}
if(typeof b === "string") {
b = b.toLowerCase();
if(!isNumeric || isNaN(a) || isNaN(b)) {
if(!isCaseSensitive) {
if(typeof a === "string") {
a = a.toLowerCase();
}
if(typeof b === "string") {
b = b.toLowerCase();
}
}
}
else {
a-= 0;
b-= 0;
}
if(a < b) {
return isDescending ? +1 : -1;
} else {
@@ -603,10 +611,14 @@ exports.setTiddlerData = function(title,data) {
/*
Return the content of a tiddler as an array containing each line
*/
exports.getTiddlerList = function(title) {
exports.getTiddlerList = function(title,field,index) {
if(index) {
return $tw.utils.parseStringArray(this.extractTiddlerDataItem(title,index,""));
}
field = field || "list";
var tiddler = this.getTiddler(title);
if(tiddler && $tw.utils.isArray(tiddler.fields.list)) {
return tiddler.fields.list.slice(0);
if(tiddler) {
return ($tw.utils.parseStringArray(tiddler.fields[field]) || []).slice(0);
}
return [];
};
@@ -813,7 +825,7 @@ exports.makeWidget = function(parser,options) {
// Create the widget
return new widget.widget(widgetNode,{
wiki: this,
document: options.document || $tw.document,
document: options.document || $tw.fakeDocument,
parentWidget: options.parentWidget
});
};
@@ -832,7 +844,7 @@ exports.renderText = function(outputType,textType,text,options) {
options = options || {};
var parser = this.parseText(textType,text,options),
widgetNode = this.makeWidget(parser,options);
var container = $tw.document.createElement("div");
var container = $tw.fakeDocument.createElement("div");
widgetNode.render(container,null);
return outputType === "text/html" ? container.innerHTML : container.textContent;
};
@@ -850,7 +862,7 @@ exports.renderTiddler = function(outputType,title,options) {
options = options || {};
var parser = this.parseTiddler(title),
widgetNode = this.makeWidget(parser,options);
var container = $tw.document.createElement("div");
var container = $tw.fakeDocument.createElement("div");
widgetNode.render(container,null);
return outputType === "text/html" ? container.innerHTML : container.textContent;
};
@@ -1024,16 +1036,24 @@ exports.getTiddlerText = function(title,defaultText) {
};
/*
Read an array of browser File objects, invoking callback(tiddlerFields) for each loaded file
Read an array of browser File objects, invoking callback(tiddlerFieldsArray) once they're all read
*/
exports.readFiles = function(files,callback) {
var result = [],
outstanding = files.length;
for(var f=0; f<files.length; f++) {
this.readFile(files[f],callback);
this.readFile(files[f],function(tiddlerFieldsArray) {
result.push.apply(result,tiddlerFieldsArray);
if(--outstanding === 0) {
callback(result);
}
});
};
return files.length;
};
/*
Read a browser File object, invoking callback(tiddlerFields) with the tiddler fields object
Read a browser File object, invoking callback(tiddlerFieldsArray) with an array of tiddler fields objects
*/
exports.readFile = function(file,callback) {
// Get the type, falling back to the filename extension
@@ -1056,21 +1076,27 @@ exports.readFile = function(file,callback) {
// Onload
reader.onload = function(event) {
// Deserialise the file contents
var tiddlerFields = {title: file.name || "Untitled", type: type};
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 = event.target.result.indexOf(",");
var commaPos = text.indexOf(",");
if(commaPos !== -1) {
tiddlerFields.text = event.target.result.substr(commaPos+1);
callback(tiddlerFields);
tiddlerFields.text = text.substr(commaPos+1);
callback([tiddlerFields]);
}
} else {
var tiddlers = self.deserializeTiddlers(type,event.target.result,tiddlerFields);
if(tiddlers) {
$tw.utils.each(tiddlers,function(tiddlerFields) {
callback(tiddlerFields);
// 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));
}
}
};

View File

@@ -0,0 +1,3 @@
title: $:/core/templates/alltiddlers.content
{{{ [!is[system]sort[title]] ||$:/core/templates/static-tiddler}}}

View File

@@ -0,0 +1,28 @@
title: $:/core/templates/alltiddlers.template.html
type: text/vnd.tiddlywiki-html
\define tw-wikilink-template() #$uri_encoded$
\rules only filteredtranscludeinline transcludeinline
<!doctype html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<meta name="generator" content="TiddlyWiki" />
<meta name="tiddlywiki-version" content="{{$:/core/templates/version}}" />
<meta name="format-detection" content="telephone=no">
<link id="faviconLink" rel="shortcut icon" href="favicon.ico">
<title>{{$:/core/wiki/title}}</title>
<div id="styleArea">
{{{ [is[system]type[text/css]] ||$:/core/templates/css-tiddler}}}
</div>
<style type="text/css">
{{{ [tag[$:/tags/stylesheet]] [is[shadow]tag[$:/tags/stylesheet]] ||$:/core/templates/wikified-tiddler}}}
</style>
</head>
<body class="tw-body">
{{$:/StaticBanner||$:/core/templates/html-tiddler}}
<section class="story-river">
{{$:/core/templates/alltiddlers.content||$:/core/templates/html-tiddler}}
</section>
</body>
</html>

View File

@@ -1,6 +1,6 @@
title: $:/core/save/all
\define saveTiddlerFilter()
[is[tiddler]] -[type[text/css]] -[type[application/javascript]has[module-type]] -[type[application/javascript]library[yes]] -[[$:/boot/boot.js]] -[[$:/boot/bootprefix.js]] +[sort[title]]
[is[tiddler]] -[type[text/css]] -[type[application/javascript]library[yes]] -[[$:/boot/boot.js]] -[[$:/boot/bootprefix.js]] +[sort[title]]
\end
{{$:/core/templates/tiddlywiki5.html}}

View File

@@ -1,6 +1,6 @@
title: $:/core/save/empty
\define saveTiddlerFilter()
[is[system]] -[type[text/css]] -[type[application/javascript]has[module-type]] -[type[application/javascript]library[yes]] -[[$:/boot/boot.js]] -[[$:/boot/bootprefix.js]] +[sort[title]]
[is[system]] -[type[text/css]] -[type[application/javascript]library[yes]] -[[$:/boot/boot.js]] -[[$:/boot/bootprefix.js]] +[sort[title]]
\end
{{$:/core/templates/tiddlywiki5.html}}

View File

@@ -0,0 +1,5 @@
title: $:/core/templates/static-tiddler
<a name=<<currentTiddler>>>
<$transclude tiddler="$:/core/ui/ViewTemplate"/>
</a>

View File

@@ -10,6 +10,7 @@ type: text/vnd.tiddlywiki-html
<meta name="generator" content="TiddlyWiki" />
<meta name="tiddlywiki-version" content="{{$:/core/templates/version}}" />
<meta name="format-detection" content="telephone=no">
<link id="faviconLink" rel="shortcut icon" href="favicon.ico">
<title>{{$:/core/wiki/title}}</title>
<div id="styleArea">
{{{ [is[system]type[text/css]] ||$:/core/templates/css-tiddler}}}

View File

@@ -8,6 +8,7 @@ title: $:/core/templates/static.tiddler.html
<meta name="generator" content="TiddlyWiki" />
<meta name="tiddlywiki-version" content="`{{$:/core/templates/version}}`" />
<meta name="format-detection" content="telephone=no">
<link id="faviconLink" rel="shortcut icon" href="favicon.ico">
<link rel="stylesheet" href="static.css">
<title>`{{$:/core/wiki/title}}`</title>
</head>

View File

@@ -14,7 +14,7 @@ title: $:/core/templates/tiddlywiki5.html
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
<meta name="format-detection" content="telephone=no" />
<meta name="copyright" content="{{$:/core/copyright.txt}}" />
<link rel="shortcut icon" href="favicon.ico">
<link id="faviconLink" rel="shortcut icon" href="favicon.ico">
<title>{{$:/core/wiki/title}}</title>
<!--~~ This is a Tiddlywiki file. The points of interest in the file are marked with this pattern ~~-->
@@ -42,10 +42,6 @@ title: $:/core/templates/tiddlywiki5.html
<div id="bootKernelPrefix" style="display:none;">
{{ $:/boot/bootprefix.js ||$:/core/templates/javascript-tiddler}}
</div>
<!--~~ Plugin modules ~~-->
<div id="modules" style="display:none;">
{{{ [is[system]type[application/javascript]has[module-type]] ||$:/core/templates/module-tiddler}}}
</div>
<!--~~ Boot kernel ~~-->
<div id="bootKernel" style="display:none;">
{{ $:/boot/boot.js ||$:/core/templates/javascript-tiddler}}

View File

@@ -0,0 +1,3 @@
title: $:/AdvancedSearch
<div class="tw-advanced-search"><<tabs "[is[shadow]!has[draft.of]tag[$:/tags/AdvancedSearch]] [!is[shadow]!has[draft.of]tag[$:/tags/AdvancedSearch]] +[tag[$:/tags/AdvancedSearch]]" "$:/core/ui/AdvancedSearch/System">></div>

View File

@@ -0,0 +1,27 @@
title: $:/core/ui/AdvancedSearch/Shadows
tags: $:/tags/AdvancedSearch
caption: Shadows
<$linkcatcher to="$:/temp/advancedsearch">
Search for shadow tiddlers:
<div class="tw-search"><$edit-text tiddler="$:/temp/advancedsearch" type="search" tag="input"/><$reveal state="$:/temp/advancedsearch" type="nomatch" text=""> <$link to="" class="btn-invisible">{{$:/core/images/close-button}}</$link></$reveal></div>
</$linkcatcher>
<$reveal state="$:/temp/advancedsearch" type="nomatch" text="">
<div class="tw-search-results">
//<small><$count filter="[is[shadow]search{$:/temp/advancedsearch}]"/> matches</small>//
<$list filter="[is[shadow]search{$:/temp/advancedsearch}sort[title]limit[250]]" template="$:/core/ui/ListItemTemplate"/>
</div>
</$reveal>
<$reveal state="$:/temp/advancedsearch" type="match" text="">
</$reveal>

View File

@@ -0,0 +1,27 @@
title: $:/core/ui/AdvancedSearch/System
tags: $:/tags/AdvancedSearch
caption: System
<$linkcatcher to="$:/temp/advancedsearch">
Search for system tiddlers:
<div class="tw-search"><$edit-text tiddler="$:/temp/advancedsearch" type="search" tag="input"/><$reveal state="$:/temp/advancedsearch" type="nomatch" text=""> <$link to="" class="btn-invisible">{{$:/core/images/close-button}}</$link></$reveal></div>
</$linkcatcher>
<$reveal state="$:/temp/advancedsearch" type="nomatch" text="">
<div class="tw-search-results">
//<small><$count filter="[is[system]search{$:/temp/advancedsearch}]"/> matches</small>//
<$list filter="[is[system]search{$:/temp/advancedsearch}sort[title]limit[250]]" template="$:/core/ui/ListItemTemplate"/>
</div>
</$reveal>
<$reveal state="$:/temp/advancedsearch" type="match" text="">
</$reveal>

View File

@@ -7,7 +7,7 @@ caption: Basics
|[[Subtitle|SiteSubtitle]] |<$edit-text tiddler="SiteSubtitle" default="" tag="input"/> |
|[[Username for signing edits|$:/status/UserName]] |<$edit-text tiddler="$:/status/UserName" default="" tag="input"/> |
|[[Animation duration|$:/config/AnimationDuration]] |<$edit-text tiddler="$:/config/AnimationDuration" default="" tag="input"/> |
|[[DefaultTiddlers|$:/DefaultTiddlers]] |Choose which tiddlers are displayed at startup:<br> <$edit-text tag="textarea" tiddler="$:/DefaultTiddlers"/> |
|[[DefaultTiddlers|$:/DefaultTiddlers]] |Choose which tiddlers are displayed at startup:<br> <$edit-text tag="textarea" tiddler="$:/DefaultTiddlers"/><br>//Use &#91;&#91;double square brackets&#93;&#93; for titles with spaces. Or you can choose to <$button set="$:/DefaultTiddlers" setTo="[list[$:/StoryList]]">retain story ordering</$button>// |
|Tiddlers |''<$count filter="[!is[system]]"/>'' |
|System tiddlers |''<$count filter="[is[system]]"/>'' |
|Shadow tiddlers |''<$count filter="[is[shadow]]"/>'' |

View File

@@ -16,7 +16,14 @@ http://$(userName)$.tiddlyspot.com/backup/
|[[Wiki name|$:/UploadName]] |<$edit-text tiddler="$:/UploadName" default="" tag="input"/> |
|Password |<$password name="upload"/> |
|Server URL |<$edit-text tiddler="$:/UploadURL" default="" tag="input"/> |
|Backups |<<backupLink>> |
!! Advanced settings
|Server URL |<$edit-text tiddler="$:/UploadURL" default="" tag="input"/> |
|Upload filename |<$edit-text tiddler="$:/UploadFilename" default="index.html" tag="input"/> |
|Upload directory |<$edit-text tiddler="$:/UploadDir" default="." tag="input"/> |
|Backup directory |<$edit-text tiddler="$:/UploadBackupDir" default="." tag="input"/> |
//The server URL defaults to `http://<wikiname>.tiddlyspot.com/store.cgi` and can be changed to use a custom server address//

View File

@@ -8,6 +8,10 @@ caption: Tools
Browse for files on your computer to import their contents (the individual tiddlers within TiddlyWiki HTML files are imported separately). You can also drag and drop files directly to the browser window.
! Export
<$button message="tw-download-file" param="$:/core/templates/alltiddlers.template.html" class="btn-big-green">Download all tiddlers as static HTML {{$:/core/images/save-button}}</$button>
! Encryption
{{$:/snippets/encryptionstatus}}

View File

@@ -5,7 +5,7 @@ tags: $:/tags/EditTemplate
Type the text for this tiddler
\end
<$reveal state="$:/ShowEditPreview" type="match" text="yes">
//<$transclude tiddler="$:/core/ui/EditorHint"/>// <$button type="set" set="$:/ShowEditPreview" setTo="no">hide preview</$button>
<em class="tw-edit"><$transclude tiddler="$:/core/ui/EditorHint"/></em> <$button type="set" set="$:/ShowEditPreview" setTo="no">hide preview</$button>
<div class="tw-tiddler-preview">
<div class="tw-tiddler-preview-preview">
<$transclude />
@@ -16,6 +16,6 @@ Type the text for this tiddler
</div>
</$reveal>
<$reveal state="$:/ShowEditPreview" type="nomatch" text="yes">
//<$transclude tiddler="$:/core/ui/EditorHint"/>// <$button type="set" set="$:/ShowEditPreview" setTo="yes">show preview</$button>
<em class="tw-edit"><$transclude tiddler="$:/core/ui/EditorHint"/></em> <$button type="set" set="$:/ShowEditPreview" setTo="yes">show preview</$button>
<$edit field="text" class="tw-edit-texteditor" placeholder=<<prompt>>/>
</$reveal>

View File

@@ -9,6 +9,6 @@ tags: $:/tags/EditTemplate
</table>
</div>
<div class="tw-edit-field-add">//Add a new field:// <span class="tw-edit-field-add-name"><$edit-text tiddler="$:/NewFieldName" tag="input" default="" placeholder="field name" class="tw-edit-texteditor"/></span> <span class="tw-edit-field-add-button"><$button message="tw-add-field" param={{$:/NewFieldName}} set="$:/NewFieldName" setTo="" class="">add</$button></span></div>
<div class="tw-edit-field-add"><em class="tw-edit">Add a new field:</em> <span class="tw-edit-field-add-name"><$edit-text tiddler="$:/NewFieldName" tag="input" default="" placeholder="field name" class="tw-edit-texteditor"/></span> <span class="tw-edit-field-add-button"><$button message="tw-add-field" param={{$:/NewFieldName}} set="$:/NewFieldName" setTo="" class="">add</$button></span></div>
</$fieldmangler>

View File

@@ -4,7 +4,7 @@ tags: $:/tags/EditTemplate
\define tag-styles()
background-color:$(backgroundColor)$;
\end
<div class="tw-edit-tags"><$fieldmangler><$list filter="[is[current]tags[]sort[title]]" storyview="pop" itemClass="tw-tag-editor-label"><$set name="backgroundColor" value={{!!color}}><span style=<<tag-styles>> class="tw-tag-label"><$view field="title" format="text" /><$button message="tw-remove-tag" param={{!!title}} class="btn-invisible tw-remove-tag-button">&times;</$button></span></$set>
<div class="tw-edit-tags"><$fieldmangler><$list filter="[is[current]tags[]sort[title]]" storyview="pop"><$set name="backgroundColor" value={{!!color}}><span style=<<tag-styles>> class="tw-tag-label"><$view field="title" format="text" /><$button message="tw-remove-tag" param={{!!title}} class="btn-invisible tw-remove-tag-button">&times;</$button></span></$set>
</$list>
<div class="tw-edit-add-tag"><span class="tw-add-tag-name"><$edit-text tiddler="$:/NewTagName" tag="input" default="" placeholder="tag name" focusPopup=<<qualify "$:/state/tagsAutoComplete">> class="tw-edit-texteditor"/></span> <$button popup=<<qualify "$:/state/tagsAutoComplete">> class="btn-invisible btn-dropdown">{{$:/core/images/down-arrow}}</$button> <span class="tw-add-tag-button"><$button message="tw-add-tag" param={{$:/NewTagName}} set="$:/NewTagName" setTo="" class="">add</$button></span></div>

View File

@@ -1,7 +1,7 @@
title: $:/core/ui/EditTemplate/type
tags: $:/tags/EditTemplate
<p>//Type:// <$edit-text field="type" tag="input" default="" placeholder="type" focusPopup=<<qualify "$:/state/typeDropdown">> class="tw-edit-typeeditor"/> <$button popup=<<qualify "$:/state/typeDropdown">> class="btn-invisible btn-dropdown">{{$:/core/images/down-arrow}}</$button></p>
<p><$fieldmangler><em class="tw-edit">Type:</em> <$edit-text field="type" tag="input" default="" placeholder="type" focusPopup=<<qualify "$:/state/typeDropdown">> class="tw-edit-typeeditor"/> <$button popup=<<qualify "$:/state/typeDropdown">> class="btn-invisible btn-dropdown">{{$:/core/images/down-arrow}}</$button> <$button message="tw-remove-field" param="type" class="btn-invisible btn-icon">{{$:/core/images/delete-button}}</$button></$fieldmangler></p>
<div class="tw-block-dropdown-wrapper">
<$reveal state=<<qualify "$:/state/typeDropdown">> type="nomatch" text="" default="">

View File

@@ -2,4 +2,4 @@ title: $:/core/ui/MoreSideBar/All
tags: $:/tags/MoreSideBar
caption: All
<$list filter="[!is[system]sort[title]]" itemClass="tw-menu-list-item" template="$:/core/ui/ListItemTemplate"/>
<$list filter="[!is[system]sort[title]]" template="$:/core/ui/ListItemTemplate"/>

View File

@@ -2,4 +2,4 @@ title: $:/core/ui/MoreSideBar/Drafts
tags: $:/tags/MoreSideBar
caption: Drafts
<$list filter="[has[draft.of]sort[title]]" itemClass="tw-menu-list-item" template="$:/core/ui/ListItemTemplate"/>
<$list filter="[has[draft.of]sort[title]]" template="$:/core/ui/ListItemTemplate"/>

View File

@@ -2,4 +2,4 @@ title: $:/core/ui/MoreSideBar/Missing
tags: $:/tags/MoreSideBar
caption: Missing
<$list filter="[is[missing]sort[title]]" itemClass="tw-menu-list-item" template="$:/core/ui/MissingTemplate"/>
<$list filter="[is[missing]sort[title]]" template="$:/core/ui/MissingTemplate"/>

View File

@@ -2,4 +2,4 @@ title: $:/core/ui/MoreSideBar/Orphans
tags: $:/tags/MoreSideBar
caption: Orphans
<$list filter="[is[orphan]sort[title]]" itemClass="tw-menu-list-item" template="$:/core/ui/ListItemTemplate"/>
<$list filter="[is[orphan]sort[title]]" template="$:/core/ui/ListItemTemplate"/>

View File

@@ -2,4 +2,4 @@ title: $:/core/ui/MoreSideBar/Shadows
tags: $:/tags/MoreSideBar
caption: Shadows
<$list filter="[is[shadow]sort[title]]" itemClass="tw-menu-list-item" template="$:/core/ui/ListItemTemplate"/>
<$list filter="[is[shadow]sort[title]]" template="$:/core/ui/ListItemTemplate"/>

View File

@@ -2,4 +2,4 @@ title: $:/core/ui/MoreSideBar/System
tags: $:/tags/MoreSideBar
caption: System
<$list filter="[is[system]sort[title]]" itemClass="tw-menu-list-item" template="$:/core/ui/ListItemTemplate"/>
<$list filter="[is[system]sort[title]]" template="$:/core/ui/ListItemTemplate"/>

View File

@@ -2,7 +2,7 @@ title: $:/core/ui/MoreSideBar/Tags
tags: $:/tags/MoreSideBar
caption: Tags
<$list filter="[tags[]sort[title]]" itemClass="tw-menu-list-item">
<$list filter="[tags[]sort[title]]">
<$transclude tiddler="$:/core/ui/TagTemplate"/> <small class="tw-menu-list-count"><$count filter="[is[current]tagging[]]"/></small>
</$list>
----

View File

@@ -2,7 +2,7 @@ title: $:/core/ui/SideBar/Open
tags: $:/tags/SideBar
caption: Open
<$list filter="[list[$:/StoryList]]" history="$:/HistoryList" storyview="pop" itemClass="tw-menu-list-item tw-open-tiddler-list">
<$list filter="[list[$:/StoryList]]" history="$:/HistoryList" storyview="pop">
<$button message="tw-close-tiddler" class="btn-invisible btn-mini">&times;</$button> <$link to={{!!title}}><$view field="title"/></$link>
</$list>
<$button message="tw-close-all-tiddlers" class="btn-invisible btn-mini">close all</$button>

View File

@@ -6,6 +6,10 @@ caption: Tools
---
[[AdvancedSearch|$:/AdvancedSearch]]
---
{{$:/snippets/minithemeswitcher}}
---

View File

@@ -2,11 +2,7 @@ title: $:/core/ui/SideBarLists
<div class="tw-sidebar-lists">
<$linkcatcher to="$:/temp/search">
<div class="tw-search"><$edit-text tiddler="$:/temp/search" type="search" tag="input"/><$reveal state="$:/temp/search" type="nomatch" text=""> <$link to="" class="btn-invisible">{{$:/core/images/close-button}}</$link></$reveal></div>
</$linkcatcher>
<div class="tw-search"><$edit-text tiddler="$:/temp/search" type="search" tag="input"/> <$reveal state="$:/temp/search" type="nomatch" text=""><$linkcatcher to="$:/temp/search"><$link to="" class="btn-invisible">{{$:/core/images/close-button}}</$link></$linkcatcher></$reveal><$reveal state="$:/temp/search" type="match" text=""> &nbsp;<$link to="$:/AdvancedSearch" class="btn-invisible">&hellip;</$link></$reveal></div>
<$reveal state="$:/temp/search" type="nomatch" text="">

View File

@@ -2,4 +2,4 @@ title: $:/core/ui/TiddlerInfo/List
tags: $:/tags/TiddlerInfo
caption: List
<$list filter="[list{!!title}]" itemClass="tw-menu-list-item" emptyMessage="This tiddler does not have a list" template="$:/core/ui/ListItemTemplate"/>
<$list filter="[list{!!title}]" emptyMessage="This tiddler does not have a list" template="$:/core/ui/ListItemTemplate"/>

View File

@@ -2,4 +2,4 @@ title: $:/core/ui/TiddlerInfo/Listed
tags: $:/tags/TiddlerInfo
caption: Listed
<$list filter="[is[current]listed[]!is[system]]" itemClass="tw-menu-list-item" emptyMessage="This tiddler is not listed by any others" template="$:/core/ui/ListItemTemplate"/>
<$list filter="[is[current]listed[]!is[system]]" emptyMessage="This tiddler is not listed by any others" template="$:/core/ui/ListItemTemplate"/>

View File

@@ -2,4 +2,4 @@ title: $:/core/ui/TiddlerInfo/Tagging
tags: $:/tags/TiddlerInfo
caption: Tagging
<$list filter="[is[current]tagging[]]" itemClass="tw-menu-list-item" emptyMessage="No tiddlers are tagged with this one" template="$:/core/ui/ListItemTemplate"/>
<$list filter="[is[current]tagging[]]" emptyMessage="No tiddlers are tagged with this one" template="$:/core/ui/ListItemTemplate"/>

View File

@@ -1,4 +1,4 @@
title: $:/core/ui/ViewTemplate/tags
tags: $:/tags/ViewTemplate
<div class="tw-tags-wrapper"><$list filter="[is[current]tags[]sort[title]]" template="$:/core/ui/TagTemplate" storyview="pop" itemClass="tw-tag-list-item"/></div>
<div class="tw-tags-wrapper"><$list filter="[is[current]tags[]sort[title]]" template="$:/core/ui/TagTemplate" storyview="pop"/></div>

View File

@@ -1,3 +1,4 @@
title: $:/DefaultTiddlers
GettingStarted
GettingStarted
[!is[system]sort[modified]limit[25]]

View File

@@ -7,7 +7,7 @@ To get started, first verify that you can save changes successfully - see http:/
Then you can:
* Create new tiddlers using the 'plus' button in the sidebar
* Visit the [[control panel|$:/ControlPanel]] using the 'cog' button in the sidebar to customise your wiki
** Stop this message appearing by changing the default tiddlers under the ''Basics'' tab
* Save changes using the 'download' button in the sidebar
* Edit [[DefaultTiddlers|$:/DefaultTiddlers]] to determine which tiddlers appear when you open this wiki
* Edit the SiteTitle and SiteSubtitle
* Learn more about [[WikiText|http://tiddlywiki.com/static/WikiText.html]]

View File

@@ -0,0 +1,2 @@
title: $:/temp/advancedsearch

View File

@@ -1,9 +1,9 @@
title: $:/snippets/recentchanges
<$list filter="[!is[system]has[modified]!sort[modified]limit[100]eachday[modified]]" itemClass="tw-menu-list-item">
<$list filter="[!is[system]has[modified]!sort[modified]limit[100]eachday[modified]]">
<div class="tw-menu-list-item">
<$view field="modified" format="date" template="DDth MMM YYYY"/>
<$list filter="[sameday{!!modified}!is[system]!sort[modified]]" itemClass="tw-menu-list-subitem">
<$list filter="[sameday{!!modified}!is[system]!sort[modified]]">
<div class="tw-menu-list-subitem">
<$link to={{!!title}}>
<$view field="title"/>

View File

@@ -2,7 +2,8 @@
"plugins": [
"tiddlywiki/tiddlyweb",
"tiddlywiki/filesystem",
"tiddlywiki/codemirror"
"tiddlywiki/codemirror",
"tiddlywiki/highlight"
],
"themes": [
"tiddlywiki/vanilla",
@@ -17,4 +18,4 @@
"includeWikis": [
"../tw5.com"
]
}
}

View File

@@ -7,3 +7,5 @@ Try editing the tiddler LoremIpsum to try out the editor.
To add the plugin to your own TiddlyWiki5, just drag this link to the browser window:
[[$:/plugins/tiddlywiki/codemirror]]
{{$:/plugins/tiddlywiki/codemirror/instructions}}

View File

@@ -0,0 +1,4 @@
title: $:/DefaultTiddlers
[[HelloThere]]
[[HighlightExample]]

View File

@@ -0,0 +1,13 @@
title: HelloThere
This is a demo of TiddlyWiki5 incorporating a plugin for the [[highlight.js|https://github.com/isagalaev/highlight.js]] Syntax highlighting for the Web from Ivan Sagalaev.
The HighlightExample tiddler have fenced blocks of code.
To add the plugin to your own TiddlyWiki5, just drag this link to the browser window:
[[$:/plugins/tiddlywiki/highlight]]
To add your prefered [[theme|http://highlightjs.org/static/test.html]] append to your:
[[$:/tags/stylesheet]]

View File

@@ -0,0 +1,57 @@
title: HighlightExample
''Javascript'' fenced code:
```javascript
(function(a,b){
var result = a+b;
return result;
})(10,20)
```
''CSS'' fenced code:
```css
* { margin: 0; padding: 0; } /* micro reset */
html { font-size: 62.5%; }
body { font-size: 14px; font-size: 1.4rem; } /* =14px */
h1 { font-size: 24px; font-size: 2.4rem; } /* =24px */
```
''Perl'' fenced code:
```perl
package Name;
my $singleton;
BEGIN {
$singleton = {
attribute => 'value',
another => 'something',
};
bless $singleton, "Name";
}
sub new {
my $class = shift;
return $singleton;
}
```
''Python'' fenced code:
```
class Singleton:
__single = None
def __init__( self ):
if Singleton.__single:
raise Singleton.__single
Singleton.__single = self
```
''~No-Highlight'' now
```no-highlight
$ TW5_BUILD_OUTPUT=tmp/ ./bld.sh
```

Some files were not shown because too many files have changed in this diff Show More