Commit Graph

292 Commits

Author SHA1 Message Date
Rob Hoelz e9aa3c6c93
Add $timestamp argument for <$action-deletefield> widget (#8115)
* Start on some tests for <$action-deletefield />

* Only update modified field if we actually delete a field

…in the <$action-deletefield /> widget.

Fixes a bug where <$action-deletefield foo /> would update the modified field
if the "foo" field wasn't present on a tiddler.

* action-deletefield: Test when modified does and doesn't exist

* Add $timestamp argument to action-deletefield

To make it more consistent with other tiddler-manipulating action widgets

* Add docs for action-deletefield $timestamp
2024-04-04 16:03:15 +01:00
Mario Pietsch b4d7e34a5a
Add unusedtitle macro tests - should have full code covery (#7939)
* add unusedtitle macro tests - should have full code covery

* remove numbering from tests
2024-03-28 18:39:57 +00:00
Jeremy Ruston 967e2b7fef Import variables should not parse with whitespace trim
Fixes #7909
2024-03-10 15:03:52 +00:00
lin onetwo 36fc8170a4
Basic Backtranscludes filter (#6081)
* feat: add transcludes and backtranscludes filter and its relying indexer

* feat: add test about backtranscludes

* docs: add doc about transcludes and backtranscludes Operator

* refactor: merge backlinks and backtranscludes indexer

* fix: test not executed

* fix: latest transclude use $tiddler instead of tiddler

* feat: A tiddler transclude with template will still use the tiddler as result.

* docs: wrong comment
2024-02-18 09:14:23 +00:00
Saq Imtiaz aa4aeb187c
Fixes functions to use variables set by filter runs (#7906)
* fix: functions should use variables set by filter runs

* refactor: code clean up

* chore: added more tests
2024-01-24 11:33:50 +00:00
btheado fb85e91f82
Allows whitespace-only macro/procedure to be closed by \end (#7911)
* Added some passing macro definition parsing tests

* Added two failing tests to illustrate bug #3460

* Allow \end to end an whitespace only/empty macro definition. Fixes #3460

* Added some passing procedure definition tests

* Added two failing procedure tests to illustrate bug #3460

* Allow \end to end a whitespace only/empty procedure/function/widget definition. Fixes #3640

* Fixed wording of comment
2024-01-24 11:32:58 +00:00
Mario Pietsch 100eaeff30
Moves some exsiting macro tests to their own folders (#7940) 2024-01-22 17:43:23 +00:00
Saq Imtiaz 46a22ef585
Fix: resolved issues with select widget after refactoring (#7905) 2023-12-21 11:50:33 +00:00
Jeremy Ruston a3e5ace458
Remove whitespace immediately after pragmas (#7895)
This is intended to revert some of the behaviour introduced in #7835, see the discussion here: https://github.com/Jermolene/TiddlyWiki5/pull/7888#issuecomment-1856184592
2023-12-21 10:36:45 +00:00
Jeremy Ruston e2d4388c48
Fix for list widget with an empty paragraph as inline template (#7903)
Fixes #7902
2023-12-21 10:35:40 +00:00
Jeremy Ruston c282208668 Fix jsonset crash when applied to primitive types
See https://talk.tiddlywiki.org/t/final-checks-before-release-of-v5-3-2/8560/7
2023-11-29 12:06:40 +00:00
Robin Munn 64812f5c06
Add join attribute to list widget (#7694)
* Add join attribute to list widget

* Use new join attribute in HTML saving templates

This simplifies the logic involved in saving tiddlers in JSON format
into TW html files, and should also slightly speed up the saving process
depending on how often that list widget gets refreshed.

* Unit tests for list widget's new join attribute

* Add `<$list-join>` widget

Allows specifying complicated join text more easily than an attribute
2023-11-25 09:35:05 +00:00
Jeremy Ruston 62bb8affa4
Add data attribute support to button and other widgets (#7769)
* Add data attribute support to button widget

* Fix typo

* Refactor ready for making mechanism more generic

* Apply more generic implementation to multiplate widgets

* Refactor to use existing widget.assignAttributes() method

* Fix typo

* Clarify docs

* Update docs

* Update select widget to support style.* attributes

* Remove obsolete comment

* Fixes refresh issues for checkbox and links widgets for data attributes (#7846)

* fix: refresh issues with checkbox and links widgets

* fix: indenting

* Feat: add support for data attributes to Draggable and Droppable widgets (#7845)

* Docs clarification

* docs: add style and data attributes to Draggable and Droppable widget docs (#7850)

* Refactors Select widget to directly create DOM node (#7848)

* fix: refactored SelectWidget to directly create DOM nodes

* fix: refactored SelectWidget to directly create DOM nodes

* fix: improve refresh handling for select widget

* Fixes issues in the PR "Button widget data attributes" (#7852)

* fix: fixed ordered attributes handling and improved tests to catch event attributes

* fix: clean up code from testing

* fix: more tests and refactoring

* fix: use lowercase when checking for event attribute prefix

* fix: use lowercase when checking for event attribute prefix

* fix: changed comment wording

* fix: minor refactoring

* refactor: for brevity

---------

Co-authored-by: Saq Imtiaz <saq.imtiaz@gmail.com>
2023-11-22 20:05:40 +00:00
Robin Munn ab72cc7b09
Allow negative indexes in json operators (#7849)
* Add unit tests for negative indexes in json ops

* Allow negative indexes in JSON operators

Negative indexes will be treated as counting from the end, so -1 means
last item of the array, -2 means next-to-last item, and so on.

* Add documentation for negative indexes
2023-11-21 11:05:13 +00:00
Saq Imtiaz bf8b3cff03
Fixes Text Parser being impacted by overrides to codeblock widget (#7844)
* fix: overriding codeblock widget should not impact text parser

* fix: whitespace changes
2023-11-20 08:38:04 +00:00
Maurycy Zarzycki 4b56cb4298
Add support for running in-browser tests via playwright in GitHub CLI (#7820)
* Add support for running in-browser tests via playwright in GitHub CLI

* `ci.yml` was updated to store the report so that it can be inspected on failure
* `ci-test.sh` was added as an expansion to `test.sh` which installs and runs playwright
* `playwright.spec.js` does the actual verification of opening the test TW edition in browser, waiting for the tests to finish and then verifying it has indeed passed
* `playwright.config.js` Playwrifht configuration

* Add support for running in-browser tests via playwright in GitHub CLI

* `ci.yml` was updated to store the report so that it can be inspected on failure
* `ci-test.sh` was added as an expansion to `test.sh` which installs and runs playwright
* `playwright.spec.js` does the actual verification of opening the test TW edition in browser, waiting for the tests to finish and then verifying it has indeed passed
* `playwright.config.js` Playwrifht configuration

* Fix file permissions for `ci-test.sh`

* Increased node version for github actions to support playwright

* Add installation of the required @playwright/test library during CI test execution
2023-10-29 09:05:24 +00:00
Robin Munn 246751be1b
Fix last filter operator when zero items selected (#7809)
Previously, [last[0]] was incorrectly returning the entire list. It now
returns zero items as it should.
2023-10-25 13:14:49 +01:00
Robin Munn 326ae61929
Fix encodebase64 and decodebase64 filters (#7683)
* Fix encodebase64 and decodebase64 filters

The documentation for encodebase64 says that the input is treated as
binary data, but in fact the input is being treated as text data, with
an extra UTF-8 encoding step being performed first.

Likewise, the decodebase64 documentation says that it outputs binary
data, but in fact it will do a UTF-8 decoding step before producing
output, which will in fact garble binary data.

This commit changes the behavior of encodebase64 and decodebase64 to
match what the documentation says they do. It also adds an optional
`text` suffix to both filters to keep the current behavior.

Finally, an optional `urlsafe` suffix is added to both filters to allow
them to use the "URL-safe" variant of base64 (using `-` instead of `+`
and `_` instead of `/`).

* Try to fix failing test

Turns out a little more than this is going to be needed.

* Fix binary base64 encoding, including unit tests

* Update base64 filter documentation

* Can't use replaceAll, too new

Have to use String.replace with a global regex instead

* Replace uses of window.btoa() in rest of code

Since window.btoa() is not available under Node.js, we'll replace all
uses of it with the $tw.utils.base64encode() function that now works
correctly for binary data.

* Add link to UTF-8 glossary definition at MDN
2023-10-18 16:08:56 +01:00
Jeremy Ruston ff1437e439
Fix refreshing of transcluded functions (#7698)
* Passing test

* Failing test

* Fix test

It still fails, but now fails correctly

* Fix refreshing transcluded functions (#7755)

We store the previous result of the filter function and recalculate it
when the transclude widget needs to be refreshed, refreshing the widget
if the result is different.

---------

Co-authored-by: Jeremy Ruston <174761+Jermolene@users.noreply.github.com>
Co-authored-by: Robin Munn <rmunn@pobox.com>
2023-10-14 09:44:18 +01:00
Jeremy Ruston 32966c9e91
Introduce jsonset operator (#7742) 2023-10-14 09:43:23 +01:00
Jeremy Ruston b7562f0c7b
Conditional Shortcut Syntax (#7710)
* Initial Commit

* Update docs

* Add support for elseif blocks

* Another test

* WIP

* Change from `{%if%}` to `<%if%>`

See discussion here - https://talk.tiddlywiki.org/t/proposed-if-widget/7882/64

* Don't use the widget body as the template if a list-empty widget is present

See discussion here - https://github.com/Jermolene/TiddlyWiki5/pull/7710#issuecomment-1717193296

* List widget should search recursively for list-template and list-empty

* Allow block mode content within an if/then/else clause

* Update docs

* Add from-version tag to docs
2023-10-14 09:41:21 +01:00
Jeremy Ruston 4c9c85aec5
Add support for list-template and list-empty widgets for specifying list widget templates (#7784)
Cherry picked from #7710
2023-10-14 09:31:11 +01:00
Robin Munn 8effb3f218
Fix list widget bug with counter-last when appending items (#7712)
* Add failing test for list widget with counter-last

The failing test appends a value to a list without changing the rest of
the list, and the counter-last value doesn't get updated correctly when
that happens. Also added another test, which passes, testing removing
the last item of the list, just in case of a regression.

* Improve unit tests for counter-last list widget bug

The unit tests were looking very similar to each other, so I factored
out the common code and made them into simple data-driven tests.

* Fix bug where counter-last fails in list widget

The only scenario that was failing was when counter-last was used, but
the list was strictly appended to with no other changes made. The one
unit test that was failing now passes with this fix.

* Improve bugfix to list widget counter-last

Now we only refresh the last item if it was truly necessary.
2023-09-24 20:19:50 +01:00
Jeremy Ruston 4bdac09872
Fix transclude inefficiency (#7647)
* Refactor parse mode out of getTransclusionTarget

* Refactor missing transclusion target

* Add a test to avoid regressions on the handling of macros vs procedures

* Refactor condition logic

* Preparing to split getTransclusionTarget into two separate functions

* Split getTransclusionTarget into getTransclusionTargetIncludingParseTreeNodes

* Resolve another inefficiency

The transclusion target was sometimes being parsed twice when transcluding as text/plain

Associated test results are also made more consistent

* Simplify method naming

* Neatening up
2023-07-30 18:04:05 +01:00
Saq Imtiaz 61a08cbd7b
Feat: allow new pragmas to be indented (#7624) 2023-07-21 13:40:42 +01:00
Saq Imtiaz 284669544b
Trim whitespace when importing variables in $importvariables (#7611)
* fix: trim whitespace when importing variables

* feat: added tests for importing variables
2023-07-17 09:18:42 +01:00
Jeremy Ruston ff7214ff56 New test for importvariables widget 2023-07-15 17:56:20 +01:00
btheado 8e9d8d4fef
Allow attribute substitution to handle variables containing non-word characters (#7606)
* Added failing test for #7604

* Fix attribute substitution regexp

Use the same regexp in wiki.getSubstitutedText as is used in
Widget.prototype.substituteVariableReferences. Fixes #7604.

* Added a test for a variable name containing spaces
2023-07-14 21:42:31 +01:00
Jeremy Ruston 08bad90e51 Ensure shadow tiddler listings are always sorted
Currently shadow tiddler ordering depends upon the order in which the shadows appear in the plugin JSON
2023-07-13 19:27:50 +01:00
yaisog f2d6c5a6eb
Add a `:then` filter run prefix (#7392)
* Initial commit

* Replace previous result only when non-empty

* Add doc tiddler

* Small change in rp-output description

* Update FRP title

lowercase with colon prefix

* Integrate with other doc tiddlers

* Add two doc-styles for reuse

* Add tests

* Add another test

* Correct indentation in stylesheet

* Change title and tags, add example to doc tiddler

* Replace leading spaces with tabs

* Improve docs text and structure
2023-06-24 18:07:34 +01:00
Saq Imtiaz 3825e2579f
Adds Text substitution support in widget attributes and new operator (#7526)
* feat: new text substitution support, first pass

* fix: use the widget method instead of evaluating a filter

* revert to earlier implementation that emulates macro syntax

* fix: capitalize comments

* feat: add support for triple backticks for substituted attributes

* docs: added docs for substitute operator

* chore: more docs tweaks

* docs: substituted attributes, refactored docs for widget attributes

* docs: fixed typo

* docs: more examples for substituted attributes

* docs: updated prior documentation on concatenating text and variables

* docs: documentation corrections

* Update editions/tw5.com/tiddlers/filters/examples/substitute Operator (Examples).tid

Co-authored-by: btheado <brian.theado@gmail.com>

---------

Co-authored-by: btheado <brian.theado@gmail.com>
2023-06-24 14:57:15 +01:00
Saq Imtiaz f4626aa69e
Fix: Fix tests for deserialize[] so they can be run on browser as well as node.js (#7543) 2023-06-14 17:57:43 +01:00
Jeremy Ruston 0095ea60d9
Switch off CamelCase linking by default (#7513)
* Disable camelcase by default

* New parse rule for ~CamelCase

For backwards compatibility with text that includes ~ to suppress camelcase links

* Enable CamelCase for main documentation wikis

Will take us a bit longer to convert all the links over

* Fix tests

* Release note update
2023-06-08 21:45:14 +01:00
Saq Imtiaz 2221b8e08a
Adds a deserialize filter operator (#7511)
* feat: added deserialize operator, tests and documentation

* fix: correct typo in lingo file

* fix: remove test that fails on node but succeeds in browser due to different availability of DOM deserializer
2023-06-03 14:33:10 +01:00
jeremy@jermolene.com 68a7655396 Custom widgets and filter operator names must now contain a period
Fixes #7428
2023-06-01 08:06:28 +01:00
Robin Munn fb10b1ee91
Checkbox widget should not affect date fields (#7448)
* Checkbox widget should not affect date fields

If a date field like `created` or `modified` is passed as the listField
attribute of the checkbox widget, it will be left unchanged and actions
on the checkbox widget will *not* fire.

Includes unit tests to ensure that the "created" and "modified" fields
will not be touched by checkboxes and will continue to be Date objects.

* Replace const with var in checkbox tests
2023-05-11 18:28:44 +01:00
Jeremy Ruston 8aa0db59a3 Transclude widget should use fallback content if variable is missing or blank
Fixes #7424
2023-05-11 16:26:18 +01:00
yaisog d6533b9ee1
Add the timestamp suffix to the format operator (#7292)
* Create timestamp.js

Taken verbatim from @ericshulman.

* Add description of the timestamp suffix

* Add an example for timestamp use

I also snuck it a couple of cosmetic corrections, because I was too lazy to open a new PR. 😢

* Correct example 4 to use the right date formats

* Correct description of the default date format

* Add a test for the timestamp suffix

* Add more format:timestamp tests

* Drop invalid input

* Update version tag in docs

---------

Co-authored-by: jeremy@jermolene.com <jeremy@jermolene.com>
2023-05-06 11:44:22 +01:00
Jeremy Ruston a6ced74a13
Introduce "thisTiddler" variable (#7182)
* Initial Commit

* Change of mind: Do not blank thisTiddler within macros

* Revert previous implementation

* Somewhat simpler implementation

* Add docs

* Add docs version tag
2023-05-06 11:40:22 +01:00
Jeremy Ruston 6bd4127e88
Parameterised transclusions (#6666)
* Initial commit

Everything is draft.

* Fix test execution

* Fix and test missing target handling

* Use the ubertransclude widget for the wikitext transclusion syntax

* Changed transclude widget in binary parser to ubertransclude

* Add a test for custom action widgets

* Don't worry about ordered attributes

The changes in 0bffae2108 mean that we don't need to explicitly maintain the ordered attributes

* Remove need to explicitly clear widget mapping variable when invoking overridden widget

* Use ts- prefix for system slot names

* Add a definition for the value widget just so that it doesn't cause errors

Of course, it doesn't actually need to be a JS widget, it could be a wikitext widget...

* Add support for positional parameters

* Ubertransclusion positional parameters should be based on name, not position

* Add support for shortcut syntax for positional transclusion parameters

* Importvariables should skip parameters widgets

* Refactor transclude widget before uberfying it

* Refactor ubertransclude functionality into transclude widget

* Replace ubertransclude widget with transclude widget

* Add wikitext shortcut for new-style function definitions

* Allow brackets to be omitted for function definitions with no parameters

* Add pragma rule for parameters declarations

* Remove erroneous "tag" property

* Add support for accessing function parameters as name/value pairs

* Be as permissive as possible with parameter names

Previously restricted to upper and lower case, digits and dash and underscore

* Rewrite some tests to use the shortcut syntaxes

* Mustn't allow commas in parameter names

* Fix crash when transcluding an undefined variable

Thanks @pmario

See https://github.com/Jermolene/TiddlyWiki5/pull/6666#issuecomment-1114692359

* Unquoted parameters should not eat a succeeding comma

Fixes #6672

* Remove extraneous code

* Allow the let widget to create variables starting with $

* Fix addAttributeToParseTreeNode handling of ordered attributes

* Reuse attribute objects when executing custom widgets

* Fix importing of function definitions

* Fix parameter handling

* Introduce genesis widget for dynamically creating widgets

See the "RedefineLet" test for a contrived example of usage

* Change tiddler separator used in wikitext tests

Underscore looked ambiguous; I kept typing dashes by accident

* Cache parse trees when transcluding variables

* Fix bug with empty strings ignored in $tw.utils.stringifyList/parseStringArray

I will pull this out into a separate PR. Fixing it doesn't cause problems for the core but I imagine it might cause issues for 3rd party code.

* Fixes to enable the transclude widget itself to be overridden

There are two big changes here:

Replace the previous "ts-wrapper" mechanism, which we had been using to redefine custom widgets inside their definitions to prevent recursive calls. Now we've got the genesis widget we can instead control recursion through a new "$remappable" attribute that allows the custom widget mechanism to be skipped.

We also extend the slot widget to allow a depth to be specified; it then reaches up by the indicated number of transclusion widgets to find the one from which it should retrieve the slot value.

* Fix genesis widget example

* Use enlist:raw to preserve duplicates

* Don't create variables with value undefined for missing parameters

* Fix variable retrieval bug with test harness

* Improve recursion detection

While retaining backwards compatibility

* Experimental support for custom filter operators

Just as we can define custom widgets we can also define custom parameterised filter operators

* Add visible transclusions component and demo

Very useful to see transclusions explicitly

Makes a good demo of a super-complicated widget override.

* Genesis widget should pass raw attributes onto child widget...

...so that it can more efficiently handle refreshing itself.

* Use consistent parse tree node property for params

* Extend transclude widget to work with old-style macros and use it for the macrocall shortcut syntax

* Clarify that the recent changes allow functions to be invoked with the double bracket syntax

In other words, the transclude widget distinguishes between functions and macros and handles the parameters appropriately

* Make the macrocall widget delegate to the transclude widget

* Switch to using \procedure to define new-style macros, and \function for custom filter operator functions

I now need to update the OP!

* Fix visible transclusion example

* Remove obsolete code

Left over after refactoring

* Better backwards compatibility for legacy recursion marker

Fixes the problem with tag dropdowns @btheado

* Fix stringifying/parsing string arrays containing newlines

A very old bug.

Fixes the ActionListOpsWidget problem @btheado

* Transclude: replace paramNames/paramValues with more robust JSON payload

More details at https://github.com/Jermolene/TiddlyWiki5/pull/6666#issuecomment-1123719153

* Rename internal "unknown" filter operator so that users cannot invoke it

* Detect recursion by tracking widget tree depth

The old recursion marker approach was very slow, and didn't catch test cases like editions/test/tiddlers/tests/data/transclude/Recursion.tid

* Use \widget for custom widget definitions, and remove need for angle brackets

Need to do some refactoring of all those isFunctionDefinition/isProcedureDefinition/isWidgetDefinition flags into a single property

* Rename <$value> widget to <$fill>

* Require $$ for custom widgets, and that overridden JS widgets must exist

See https://github.com/Jermolene/TiddlyWiki5/pull/6666#issuecomment-1133637763

* Fix invocation of JS macros

* Experimental update of the parse-tree preview visualisation

An experiment to try out using the new JSON operators for rendering the JSON parse tree that we get back from the wikify widget.

As usual with these experiments, this one is going to require quite a lot more work to finish up:

* The formatting is via direct styles rather than classes
* The formatting for attributes and properties is not yet completed
* The same thing needs to also be done to the widget tree preview

* Procedures and widgets inherit whitespace trim setting from their definition

* Missed off 22e7ec2381

* Require period prefix for custom filter operator functions

To ensure that custom filter operators cannot clash with future core operators.

* Allow custom functions to be invoked as attributes

* WIP

* Remove unneeded test tiddler

* Make is[variable] and variables[] operators resilient to fake widgets

* Fix importvariables to work with setvariables as well as set (they are aliases)

* Add support for $:/tags/Global

* Remove accidental commit 6cc99fcbe3

* Add utility function for parsing macro parameter definitions

* Introduce true global variables

The basic idea is that if we don't find a variable `foo` then we fallback to retrieving the value from the tiddler `$:/global/foo`, if it exists.

This allows us to replace the usual importvariables-based mechanism for global definitions, avoiding cluttering up the variable namespace with every macro.

In order to permit subprocedures to be overridden, we also introduce a mechanism for conditional definitions: preceding the word definition|procedure|function|widget with a + causes the definition only to occur if the specified variable doesn't already exist. In the next commit we'll apply this mechanism to the tabs macro

* Convert the tabs macro into a global

So far it appears to be totally backwards compatible... In practice, I think maybe this and the conversion of the other macros should go into a separate subsequent PR.

* Change to `?` for conditional definitions

* Fix tabs global so it doesn't crash when viewed directly

* Test showing how to un-override a core widget

* Cleaning up after f636349007

* Minor cleanups

* Clean up unknown filter

* Introduce function operator for calling functions

Can invoke any functions, not just those start with a period. And can pass zero parameters (in contrast when invoked as a custom filter operator there's no way to omit the first parameter).

* Use underscores for new system fields for global variable tiddlers

For consistency with `_canonical_uri`; unlike many system fields, the behaviour of these fields is baked into the core JS code.

* Refactor $parameters widget

The objective is to add a $depth attribute so that it is possible to reach up to retrieve the parameters of ancestor transclusions. However, doing so requires changing the encoding of parameter names so that it is not possible for a user parameter to clash with an attribute like $depth. So now we have to double up dollars on any attribute names seen by the parameters widget, just like with the transclude widget itself.

* Fix refreshing of global variables

Global variables access within attributes will automatically trigger a refresh if the attribute text changes, but that wasn't happening for transclusions.

* Remove support for $:/tags/Global

It is not needed now that we have true global variables

* Typo from f513b403fe

* Make slot fill data available to transclusions

Allows transcluded content to dynamically process <$fill> widgets within the calling transclusion

* Mark docs as v5.3.0

* Simplify metaparameters implementation

* Fix typo

* Adjust naming of transclusion metaparameter

* Fix up handling of slot/fill for custom widgets

Previously we were wrapping the body in an implicit `<$fill $name="ts-body">` widget

* Add format:json operator

I've been finding this useful for debugging, and it kind of goes with the JSON operators

* Docs: JSON operators and tweaks to genesis widget

* Docs: format:json

Also tweak to the behaviour of format:json if the input string is not valid JSON

* Fix #6721

* Revert "Fix #6721"

This reverts commit b216579255 which was committed to the wrong branch

* Fix new selection tracker to return relative coordinates

* Make use of type attribute consistent

* Docs: Transclude widget

* Simplify the fill widget

We can rely on the default processing in the base class

* Slot widget: be more defensive about negative depth values

* Parameters widget: Be defensive about negative depths

* Protect against excessively recursive functions

* FIx transcluding of functions

This first implementation concatenates the results of the filter (with no separator) and then wikifies the result.

The test in this commit is quite interesting...

* Tweak semantics of JSON operators to match #6932

This allows us to later bring in the optimisations without breaking backwards compatibility.

* Revert obsolete changes to boot.js

* Fix inadvertent whitespace change

* Remove tests related to obsolete changes to boot.js

Should have been part of 2f494ba152

* Revert changes to parse tree preview

This implementation requires #6666

* Add test to show that global widgets need not use the _parameters field

* Disable overriding core widgets in safe mode

* Coding style tweak

* More comments

* Fix caching of parse variables/macros/procedures

* Transcluded functions should operate on the entire store

* Refactor filter recursion detection to avoid an unneeded wrapper function

* Fix error in 25312b3e32

* WIP

* Revert "WIP"

This reverts commit 8654dfc679.

* When transcluding functions, pass an empty item list to the filter, and just return the first item

* Rejig genesis widget to be easier to use

* Parameters widget: protect against negative $depth

* Docs updates

* Docs updates

* Tweak comments

* Add custom view template body for globals, and a new sidebar tab under "more"

And also a custom view template title that greys out the $:/global/ part of the title

* Update function operator to return the input list if the function is missing

* Remove negation from function operator

This implementation was not useful.

* Tests and docs for function operator

* Docs tweaks

* Improve indentation

See https://github.com/Jermolene/TiddlyWiki5/pull/6666#discussion_r967655251

* Missing tests for parameters widget

* Fix visible transclude

* Docs update

* Docs typo

* Huge Documentation Update

Not quite finished, but definitely on the home stretch

* Slight optimisation to user defined widgets

* Remove implementation of $:/globals/

Performance with this implementation is inherently poor because of the need to perform a wiki lookup for each child widget created.

* Docs clarification

* Docs update

* Some widget.js cleanups

* Remove support for conditional definitions

It was introduced for use cases associated with the global mechanism that was dropped in e3d13696c8

* Docs updates

* Revert change to setwidget docs

* Docs update

* Docs updates

* Clarify/simplify some tests

* More docs updates

* Fix doc file locations

* Docs updates

* Revert modified date of docs that have only had minor tweaks

* Docs typo

https://github.com/Jermolene/TiddlyWiki5/pull/6666#discussion_r990811220

Thanks @btheado

* Transcluding functions: fix missing parameters passed as undefined

Thanks @btheado – see https://github.com/Jermolene/TiddlyWiki5/pull/6666#issuecomment-1276187372

* Parameter parenthesis should be mandatory in function/procedure/widget definitions

See https://github.com/Jermolene/TiddlyWiki5/pull/6666#issuecomment-1280404387

* Attempt to build this branch with CI

* Add release note etc for 5.3.0

* Temporary new release banner for v5.3.0

* New New Release Banner

* New test for undefined parameters

* Adjust modified times of docs tiddlers to make them easier to find

* Update release note

* Add parenthesis to the visible transclusion definition

Parenthesis were made mandatory in 5194b24108

Fixes #6998

* Fix macrocall refresh issue

It turns out that this.transcludeTitle is always truthy, even if we are transcluding a variable

Fixes #7001

* Filter run prefixes should use widget.makeFakeWidgetWithVariables

* Docs typo

Thanks @twMat

* Docs: clarify function operator invocation

See discussion at https://github.com/Jermolene/TiddlyWiki5/issues/6991#issuecomment-1301703599

* Docs: Update \define pragma to cover named ends

* Docs: move tiddlers to correct directory

* Add support for named end markers for procedures, functions and widgets

* Docs note about nested macro definitions

* Rename test

* Fix detection of empty transclusions

See https://talk.tiddlywiki.org/t/exploring-default-tiddler-links-hackability-in-v5-3-0/5745/25?u=jeremyruston

* New test missed off a45349cc99

* Refactor wikified function tests

* Refactor function invocation

* Introduce new widget helper function to evaluate variables.Functions are evaluated as parameterised filter strings, macros as text with textual substitution of parameters and variables, and procedures and widgets as plain text
* Refactor the function operator and unknown operator to use the new helper
* Use the new helper to evaluate variables within filter strings, thus fixing a bug whereby functions called in such a way were being returned as plain text instead of being evaluated
* Refactor the transclude widget to use the new helper
* Update tests

* Fix positional parameters in widget.evaluateVariable()

This should clear up the remaining anomalies in #7009, let me know how you get on @btheado

* Remove 5.2.8 release note

* Fix nonstandard initialisation code for fill/parameter/slot widgets

* Update modification times of doc tiddlers

So that they are at the top of the recent tab

* Update 5.3.0 release note

* Remove custom CI step for this branch

* Restore standard sitetitle
2023-04-19 11:55:25 +01:00
Cameron Fischer bcca4eca81
Fixed issue with trailing newlines in macrodefs (#7371) 2023-03-23 22:37:35 +00:00
jeremy@jermolene.com 589813f233 Improved fix for #7270 2023-03-10 09:41:36 +00:00
jeremy@jermolene.com 007b759421 Undefined variables in let widget: Revert fix for #7270
Reverts 8c378e0d24 and adds a test
2023-03-10 09:41:18 +00:00
Jeremy Ruston 11ffc83493
Introduce new levenshtein, makepatches, applypatches operators (#7290)
* Initial Commit

* Fix crash with invalid patches

See https://github.com/Jermolene/TiddlyWiki5/pull/7290#issuecomment-1453155311

Thanks @yaisog

* Add words and lines options to makepatches (#7326)

* Prevent infinite loop for single-word texts (#7327)

* Add docs and examples for the new operators (#7328)

* Create makepatches Operator.tid

* Improve wording

* Doc and examples for the new operators

---------

Co-authored-by: yaisog <m@rcuswinter.de>
2023-03-04 21:16:26 +00:00
btheado 95dc56d850
Fix importTitle and autoOpenOnImport in the tm-import-tiddler message (#7243)
* Add initial tm-import-tiddler test

* Add failing test for tm-import-tiddlers importTitle #7234

* Add failing test for tm-import-tiddlers autoOpenOnImport #7234

* Use event.paramObject instead of event to access tm-import-tiddlers options. Fixes #7234.

* Added a clarifying comment

* Allow mixing tm-import-tiddler params in both event and event.paramObject

* Added import test using tv-auto-open-on-import variable

* Removed stray punctuation
2023-02-11 09:15:44 +00:00
Cameron Fischer 028dfe39b7
Fixed issue where $genesis didn't pass isBlock (#7230)
* Fixed issue where $genesis didn't pass isBlock

* Added $mode attribute for genesis

* Added documentation for $mode attribute
2023-02-10 10:17:32 +00:00
jeremy@jermolene.com 89fd8871b6 Add encodebase64/decodebase64 operators
Proposed by @ericshulman
2023-02-02 09:55:54 +00:00
Jeremy Ruston a5894946de
Extend encodeuricomponent to process additional characters (#7128)
* First commit

* Fix version number in docs

* Add code comment
2023-01-19 17:45:54 +00:00
jeremy@jermolene.com 02d28c100b Merge branch 'tiddlywiki-com' 2023-01-15 18:46:46 +00:00
Wincent Balin 0ee53bbc01
Use British English (#7180)
Fixed some typos too.
2023-01-12 20:59:34 +00:00