1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-06-24 22:33:16 +00:00
A self-contained JavaScript wiki for the browser, Node.js, AWS Lambda etc.
Go to file
Robin Munn e28af8d594
Checkbox widget: list and filter modes (#6561)
* Docs for CheckboxWidget list and filter modes

This documents the `listField` and `filter` attributes.

* Tests for checkbox widget list mode

* Implement checkbox list mode

* WIP on implementing filter attr for checkboxes

* Improve CheckboxWidget documentation

* Refactor checkbox tests: move function to top

The big findNodeOfType function belongs at the top of the describe
block, so that the checkbox tests are more compact and easy to read.

* Move checkbox widget tests to end of file

The checkbox widget tests are long and involved, so we'll move them to
the end of the file so they aren't a huge block of code you need to read
past to find the next test.

* Improve formatting of CheckboxWidget docs

The \define() calls that are short enough to fit on one line should be
put on one line, for readability. The ones that are quite long have been
kept on multiple lines, for readability.

* Added more passing tests for checkbox widget

* Add some failing tests for checkbox widget

The filter mode where neither checked nor unchecked is specified (in
which case an empty filter result means false and a non-empty result
means true) is not working yet.

* Make failing tests pass

* Uncomment (and improve) test for field mode

We're now ready to start working on making this test pass. (There was
also one small mistake in the test, which this commit corrects).

* All tests now passing

* No indeterminate checkboxes in simple modes

The simple checkbox modes (field and index) should not produce
indeterminate checkboxes. That should be reserved for the advanced modes
(list and filter).

* Minor improvement to unit tests

* Allow indeterminate checkboxes in list and filter modes

This change may require some tweaks to the unit tests to be able to test
it properly.

* Slightly easier to read tests

* Two more tests for list mode

* Greatly simplify unit test code

Turns out there's no need to jump through Object.getPrototypeOf hoops.

* Minor simplification of unit test

* Add tests for indeterminate in list & filter modes

With this, the set of tests is complete.

* More tests to specify list mode behavior

* Unfocus tests so all tests run

* Update docs to say "new in 5.2.3" insetad of 5.2.2

* Move checkbox widget tests into their own file

The test-widget.js file was getting too long with all the checkbox
tests added, so we'll move the checkbox tests into their own file.

* Add checkbox widget tests for index mode

This commit also adds tests for index list mode (with a listIndex
attribute that will parallel the listField attribute) but leaves them
commented out because they don't pass yet: the code that implements the
listIndex attribute hasn't been written yet).

* Add listIndex attribute to checkbox widget

* Remove code that lets checkboxes be indeterminate

This reverts commit 6afcb151be. We will
add this code back in a later PR.

* Remove indeterminate tests for checkbox widget

We're currently not allowing indeterminate checkboxes, so there's no
need for the tests that check for them.

* Document listIndex attribute of CheckboxWidget

* adds class tc-checkbox-checked when checked

* equivalent to #2182 (RadioWidget)
* also applies `tc-checkbox` to checkboxes by default, always

* Move macro definitions inside example text

Since the wikitext-example-without-html macro creates a new parsing
context, it's safe to have macro definitions inside it. That makes these
examples a lot easier to write, and to read.

* Remove all mention of indeterminate checkboxes

Also improve the documentation a little bit: mention what happens in
list mode if neither checked nor unchecked is specified.

* Move filter mode to bottom of checkbox docs

The `filter` attribute should be under both `listField` and `listIndex`
rather than being between them. The documentation for filter mode should
similarly be after the `listIndex` documentation.

* Improve docs for `class` attr of checkbox widget

This brings the wording of the `class` attribute more in line with how
it's worded in the RadioWidget docs.

* Fix bug with list tiddlers

If neither checked nor unchecked was specified, then the behavior should
be "empty = false, non-empty = true". But if *both* are specified yet
neither is found, then the checkbox should be unchecked (false). It had
been falling through to the "non-empty = true" behavior, which was wrong.

* Improve listIndex example of checkbox widgets

* Remove unused function from test-widget.js

Co-authored-by: Tobias Beer <beertobias@gmail.com>
2022-04-02 15:16:08 +01:00
.github Update contributing notes and PR template 2022-03-28 10:54:51 +01:00
bin Merge branch 'tiddlywiki-com' 2022-04-01 21:06:42 +01:00
boot Fix bug introduced in #4122 2022-04-01 11:38:40 +01:00
core Checkbox widget: list and filter modes (#6561) 2022-04-02 15:16:08 +01:00
editions Checkbox widget: list and filter modes (#6561) 2022-04-02 15:16:08 +01:00
languages Polish translation updates (#6584) 2022-04-01 17:58:07 +01:00
licenses Signing the CLA (Eskha) (#6507) 2022-04-01 12:14:27 +01:00
plugins/tiddlywiki use Cascade to set dynannotate ViewTemplate (#6520) 2022-03-12 17:09:47 +00:00
themes/tiddlywiki Fix regressions cause by PR #6511 (#6567) 2022-04-01 11:42:16 +01:00
.eslintignore Add keyword-spacing rule to .eslintrc.yml to reflect the project code style. (#6431) 2022-01-29 17:41:09 +00:00
.eslintrc.yml Add keyword-spacing rule to .eslintrc.yml to reflect the project code style. (#6431) 2022-01-29 17:41:09 +00:00
.gitignore Ignore any node_modules directory 2015-12-19 18:47:58 +00:00
.jshintignore Ignore any node_modules directory 2015-12-19 18:47:58 +00:00
.npmignore Ignore any node_modules directory 2015-12-19 18:47:58 +00:00
contributing.md Update readme 2022-03-25 13:58:31 +00:00
license Update readme 2022-03-25 13:58:31 +00:00
package.json Prepare for v5.2.3-prerelease 2022-03-25 15:05:03 +00:00
readme.md Update readme 2022-03-25 13:58:31 +00:00
tiddlywiki.js Make require() compliant with CommonJS Modules/1.1 2013-10-12 13:44:09 -04:00

Welcome to TiddlyWiki, a non-linear personal web notebook that anyone can use and keep forever, independently of any corporation.

TiddlyWiki is a complete interactive wiki in JavaScript. It can be used as a single HTML file in the browser or as a powerful Node.js application. It is highly customisable: the entire user interface is itself implemented in hackable WikiText.

Learn more and see it in action at https://tiddlywiki.com/

Developer documentation is in progress at https://tiddlywiki.com/dev/

Join the Community

Official Forums

The new official forum for talking about TiddlyWiki: requests for help, announcements of new releases and plugins, debating new features, or just sharing experiences. You can participate via the associated website, or subscribe via email.

https://talk.tiddlywiki.org/

Note that talk.tiddlywiki.org is a community run service that we host and maintain ourselves. The modest running costs are covered by community contributions.

For the convenience of existing users, we also continue to operate the original TiddlyWiki group (hosted on Google Groups since 2005):

https://groups.google.com/group/TiddlyWiki

Developer Forums

There are several resources for developers to learn more about TiddlyWiki and to discuss and contribute to its development.

Other Forums

Documentation

There is also a discussion group specifically for discussing TiddlyWiki documentation improvement initiatives: https://groups.google.com/group/tiddlywikidocs

Installing TiddlyWiki on Node.js

  1. Install Node.js
    • Linux:
      Debian/Ubuntu:
      apt install nodejs
      May need to be followed up by:
      apt install npm
      Arch Linux
      pacman -S tiddlywiki
      (installs node and tiddlywiki)
    • Mac
      brew install node
    • Android
    • Other
  2. Open a command line terminal and type:
    npm install -g tiddlywiki
    If it fails with an error you may need to re-run the command as an administrator:
    sudo npm install -g tiddlywiki (Mac/Linux)
  3. Check TiddlyWiki is installed by typing:
    tiddlywiki --version
  4. In response, you should see TiddlyWiki report its current version (eg "5.2.2"; you may also see other debugging information reported)
  5. Try it out:
    1. tiddlywiki mynewwiki --init server to create a folder for a new wiki that includes server-related components
    2. tiddlywiki mynewwiki --listen to start TiddlyWiki
    3. Visit http://127.0.0.1:8080/ in your browser
    4. Try editing and creating tiddlers
  6. Optionally, make an offline copy:
    • click the save changes button in the sidebar, OR
    • tiddlywiki mynewwiki --build index

The -g flag causes TiddlyWiki to be installed globally. Without it, TiddlyWiki will only be available in the directory where you installed it.

If you are using Debian or Debian-based Linux and you are receiving a node: command not found error though node.js package is installed, you may need to create a symbolic link between nodejs and node. Consult your distro's manual and whereis to correctly create a link. See github issue 1434

Example Debian v8.0: sudo ln -s /usr/bin/nodejs /usr/bin/node

You can also install prior versions like this:

npm install -g tiddlywiki@5.1.13

Using TiddlyWiki on Node.js

TiddlyWiki5 includes a set of Commands for use on the command line to perform an extensive set of operations based on TiddlyWikiFolders, TiddlerFiles and TiddlyWikiFiles.

For example, the following command loads the tiddlers from a TiddlyWiki HTML file and then saves one of them in static HTML:

tiddlywiki --verbose --load mywiki.html --rendertiddler ReadMe ./readme.html

Running tiddlywiki from the command line boots the TiddlyWiki kernel, loads the core plugins and establishes an empty wiki store. It then sequentially processes the command line arguments from left to right. The arguments are separated with spaces.

New in: 5.1.20 First, there can be zero or more plugin references identified by the prefix + for plugin names or ++ for a path to a plugin folder. These plugins are loaded in addition to any specified in the TiddlyWikiFolder.

The next argument is the optional path to the TiddlyWikiFolder to be loaded. If not present, then the current directory is used.

The commands and their individual arguments follow, each command being identified by the prefix --.

tiddlywiki [+<pluginname> | ++<pluginpath>] [<wikipath>] [--<command> [<arg>[,<arg>]]]

For example:

tiddlywiki --version
tiddlywiki +plugins/tiddlywiki/filesystem +plugins/tiddlywiki/tiddlyweb mywiki --listen
tiddlywiki ++./mygreatplugin mywiki --listen

New in: 5.1.18 Commands such as the ListenCommand that support large numbers of parameters can use NamedCommandParameters to make things less unwieldy. For example:

tiddlywiki wikipath --listen username=jeremy port=8090

See Commands for a full listing of the available commands.

Upgrading TiddlyWiki on Node.js

If you've installed TiddlyWiki on Node.js on the usual way, when a new version is released you can upgrade it with this command:

npm update -g tiddlywiki

On Mac or Linux you'll need to add sudo like this:

sudo npm update -g tiddlywiki

Also see

This readme file was automatically generated by TiddlyWiki