Closed PotOfCoffee2Go closed 3 months ago
Would love to get Formulas another pass and into the parser more directly..... Hooks?
Hi @PotOfCoffee2Go I think this is a good idea.
I think all we would need to do is add some tests that attempt to parse various combinations of these character sequences, and verifies that it only gets back a single text node. Something like:
{% something %}
(= something =)
Prefix-{%
Prefix-(=
{%
(=
etc.
I think all we would need to do is add some tests that attempt to parse various combinations of these character sequences
I dug around in the tests but have not been able to get my head wrapped around where in the test to start. This would be a good project for me as would provide a gateway into figuring out how all the tests are organized.
In which 'test' .js would I begin to add the tests?
Hi @PotOfCoffee2Go there are two different types of testcases in TiddlyWiki:
data
). These tests directly use the Jasmine framework to run fairly conventional JS teststiddlywiki.files
reference). These tests use a special test runner that creates a child wiki, loads it with tiddlers, and then checks the results of a wikificationWikIText tests are preferred where possible for new tests. This is because the compatibility with the testcase widget means that testcases can double as documentation examples.
For this test, we need to check that the parse tree for parsing a few simple strings such as those above, and check that the JSON representation of the parse tree is as expected.
Something like this:
title: ReservedWikiText
description: Verify that reserved wikitext constructions are not parsed
type: text/vnd.tiddlywiki-multiple
tags: [[$:/tags/wiki-test-spec]]
title: Narrative
Verifies that certain wikitext constructions that are reserved for use by other tools are not parsed by TiddlyWiki.
+
title: TestTiddler
{% something %}
(= something =)
Prefix-{%
Prefix-(=
{%
(=
+
title: Output
<$wikify name="parsetree" text={{TestTiddler}} output="parsetree">
<$text text={{{ [<parsetree>jsonget[0],[children],[0],[text]] }}}/>
</$wikify>
+
title: ExpectedResult
<p>
{% something %}
(= something =)
Prefix-{%
Prefix-(=
{%
(=
</p>
Hi @Jermolene
Thanks for the help - I realize you basically built the test - your explanation really helped - I totally missed the 'data' directory, if had drilled down into that probably would have been able to build it. Is an impressive system.
Added combinations which would not be valid constructs - but none-the-less should still not be parsed. And they pass. Will submit a PR unless there is something else is needed.
Thanks @PotOfCoffee2Go that looks good, and a PR would be welcome.
Merge of PR #8384 closes this issue.
The 'mushroom'
(= =)
delimiters is used by the formula-pluginThe 'curly percent'
{% %}
delimiters allow delimiter based 3rd party parser and template engines to inject custom content into tiddlers.Do not believe any code changes would be required.