[regexp:created[201909]]
<$set name="digit-pattern" value="[0-9]{2}"> <<list-links "[regexp:title<digit-pattern>]">> </$set>
@TiddlyTweeterAfter this regexp Operator (Examples)I can do in Tools; Advanced Search; Filter:
[regexp:created[201909]]and I get a list with all Tiddlers created in September 2019.But
What's wrong? 4 brackets [ and 4 brackets ].
<$set name=pattern value="201909(0[1-9]|1[0-4])">
<$list filter="[regexp:created<pattern>]">
</$list>
</$set>
How do I apply this hint in my case?
<$set name="digit-pattern" value="[0-9]{2}"> <<list-links "[regexp:title<digit-pattern>]">> </$set>
\define my-macro()
<$set name=pattern value="201909(0[1-9]|1[0-4])">
<$list filter="[regexp:created<pattern>]">
</$list>
</$set>
\end
[regexp:created[(^2019090|^2019091(0|1|2|3|4|5))]]
Advanced search cannot handle regexp when special characters are used
<$set name="date_between" value="201909(0[1-9]|1[0-5])">
<<list-links "[regexp:created<date_between>]">>
</$set>
... a safer way to change the core ...This plugin allows shadow tiddlers in a wiki to be patched at boot-time. This makes it possible to change the TiddlyWiki core without creating conflicts or errors when the wiki is upgraded. Almost any code in the core can be patched. † It's also possible to patch other, non-core plugins. If any conflicts do arise, the patch operation is aborted and the wiki will load without modifications.
Filter-Var: <$edit-text tiddler="$:/temp/filtervar" tag=input/><br>
Filter: <$edit-text tiddler="$:/temp/filter" tag=input/> can also use `<filter-var>`<br>
<$set name=filter-var value={{$:/temp/filtervar}}>
<$set name=filter value={{$:/temp/filter}}>
<$list filter={{$:/temp/filter}}>
</$list>
</$set>
</$set>
201909(0[1-9|1[0-5])
[regexp:created<filter-var>]
title text modified modifier created creator tags type list caption
[fields[]!subfilter<filter-var>]
[fields[]!subfilter{$:/temp/filtervar}]
201909(0[1-9|1[0-5])
[regexp:created{$:/temp/filtervar}]
\define varname() 201909(0[1-9|1[0-5])
[regexp:created<varname>]
[field:created/^201909[2]/]
[regexp:created[^201909(2)]]
[search:created:regexp[^201909(2)]]
[created/^201909[2]/]
[my-totally-nonexistent-operator:created/^201909[2]/]
Ciao Cd.K & TonyMYou may not be aware there is already a DIRECT way to use "[...]", without a variable in TW.
It emerged, I think, for the older field operator that is not, possibly, fully documented?I discovered what it can do by accident.I assume it still works that way for backwards compatibility.Here is an example you can test in the latest online TiddlyWiki version Advanced Search ...
[field:created/^201909[2]/]... equivalent to ...
[regexp:created[^201909(2)]]
Result for either ...
Filter-Var: <$edit-text tiddler="$:/temp/filtervar" tag=input/><br>
Filter: <$edit-text tiddler="$:/temp/filter" tag=input/> can also use `<filter-var>`<br>
<$set name=filter-var value={{$:/temp/filtervar}}>
<$set name=filter value={{$:/temp/filter}}>
<$list filter={{$:/temp/filter}}>
</$list>
</$set>
</$set>
fields[]!subfilter{$:/temp/filtervar}]`
- and as result the Advanced Search lists the matches Filter-Var: <$edit-text tiddler="$:/temp/filtervar" tag=input/><br>
Filter: <$edit-text tiddler="$:/temp/filter" tag=input/> can also use `<filter-var>`<br>
<$set name=filter-var value={{$:/temp/filtervar}}>
<$set name=filter value={{$:/temp/filter}}>
<$list filter={{$:/temp/filter}}>
</$list>
</$set>
</$set>
<$button to="My Search">
<$action-setfield $tiddler="$:/temp/filtervar" text="[is[current]fields[]]"/>
<$action-setfield $tiddler="$:/temp/filter" text="[fields[]!subfilter{$:/temp/filtervar}]"/>
Go
</$button>
{$:/temp/filtervar}
or
<filter-var>
But I think it's better to have a new rule `linebreak` that reacts on leading point or trailing 2 or more spaces. For each trigger I want to append a different style, because I use `<br/>` to reduce the line spacing.
<$action-sendmessage $message="tm-edit-text-operation" $param="prefix-lines" character="." count="1" />
I would also like a button that removes the period.
Regards
Tony
Oh, wouldn't you like four ?
BTW, I think it's pretty amazing if /.../ works.
Cd, K
But I think it's better to have a new rule `linebreak` that reacts on leading point or trailing 2 or more spaces. For each trigger I want to append a different style, because I use `<br/>` to reduce the line spacing.I haven't quite figured out how to introduce a new rule yet and I haven't got any further with the mod-loader plugin.
/*\
title: $:/core/modules/parsers/wikiparser/rules/list.js
type: application/javascript
module-type: wikirule
Wiki text block rule for lists. For example:
```
* This is an unordered list
* It has two items
# This is a numbered list
## With a subitem
# And a third item
; This is a term that is being defined
: This is the definition of that term
```
Note that lists can be nested arbitrarily:
```
#** One
#* Two
#** Three
#**** Four
#**# Five
#**## Six
## Seven
### Eight
## Nine
```
A CSS class can be applied to a list item as follows:
```
* List item one
*.active List item two has the class `active`
* List item three
```
\*/
(function(){
/*jslint node: true, browser: true */
/*global $tw: false */
"use strict";
exports.name = "list";
exports.types = {block: true};
exports.init = function(parser) {
this.parser = parser;
// Regexp to match
this.matchRegExp = /([\*#;:>\.]+)|([ ]{2,}$)/mg; // Cd.K dot, double blank
};
var listTypes = {
"*": {listTag: "ul", itemTag: "li"},
"#": {listTag: "ol", itemTag: "li"},
";": {listTag: "dl", itemTag: "dt"},
":": {listTag: "dl", itemTag: "dd"},
">": {listTag: "blockquote", itemTag: "p"},
".": {listTag: "p", itemTag: "p"}, // Cd.K dot
" ": {listTag: "p", itemTag: "p"} // Cd.K blank
};
/*
Parse the most recent match
*/
exports.parse = function() {
// Array of parse tree nodes for the previous row of the list
var listStack = [];
// Cycle through the items in the list
while(true) {
// Match the list marker
var reMatch = /([\*#;:>\.]+)|([ ]{2,}$)/mg; // Cd.K dot, double blank
reMatch.lastIndex = this.parser.pos;
var match = reMatch.exec(this.parser.source);
if(!match || match.index !== this.parser.pos) {
break;
}
// Check whether the list type of the top level matches
var listInfo = listTypes[match[0].charAt(0)];
// Cd.K
if (match[0].charAt(0) == ".") {
console.log("Cd.K wikparser/rules/list.js 87 found leading '.' case")
}
if (match[0].charAt(0) == " ") {
console.log("Cd.K wikparser/rules/list.js 90 found trailing blank case")
}
if(listStack.length > 0 && listStack[0].tag !== listInfo.listTag) {
break;
}
// Move past the list marker
this.parser.pos = match.index + match[0].length;
// Walk through the list markers for the current row
for(var t=0; t<match[0].length; t++) {
listInfo = listTypes[match[0].charAt(t)];
// Remove any stacked up element if we can't re-use it because the list type doesn't match
if(listStack.length > t && listStack[t].tag !== listInfo.listTag) {
listStack.splice(t,listStack.length - t);
}
// Construct the list element or reuse the previous one at this level
if(listStack.length <= t) {
var listElement = {type: "element", tag: listInfo.listTag, children: [
{type: "element", tag: listInfo.itemTag, children: []}
]};
// Link this list element into the last child item of the parent list item
if(t) {
var prevListItem = listStack[t-1].children[listStack[t-1].children.length-1];
prevListItem.children.push(listElement);
}
// Save this element in the stack
listStack[t] = listElement;
} else if(t === (match[0].length - 1)) {
listStack[t].children.push({type: "element", tag: listInfo.itemTag, children: []});
}
}
if(listStack.length > match[0].length) {
listStack.splice(match[0].length,listStack.length - match[0].length);
}
// Process the body of the list item into the last list item
var lastListChildren = listStack[listStack.length-1].children,
lastListItem = lastListChildren[lastListChildren.length-1],
classes = this.parser.parseClasses();
this.parser.skipWhitespace({treatNewlinesAsNonWhitespace: true});
var tree = this.parser.parseInlineRun(/(\r?\n)/mg);
lastListItem.children.push.apply(lastListItem.children,tree);
if(classes.length > 0) {
$tw.utils.addClassToParseTreeNode(lastListItem,classes.join(" "));
}
// Consume any whitespace following the list item
this.parser.skipWhitespace();
}
// Return the root element of the list
return [listStack[0]];
};
})();
Cd.K
Thanks so much for that. I will test today. I started to modify this tiddler myself in an attempt to achieve this but did not succeed.
I am keen to test your trailing blank idea. I presume this means a space just before a line break. Or a space at the end of a paragraph results in a forced line break?
With a working example perhaps we can put an argument to include it in the standard distribution even if they were rules that are off by default.
Regards
Tony
CdKThanks so much for that. I will test today. I started to modify this tiddler myself in an attempt to achieve this but did not succeed.
I am keen to test your trailing blank idea. I presume this means a space just before a line break. Or a space at the end of a paragraph results in a forced line break?
With a working example perhaps we can put an argument to include it in the standard distribution even if they were rules that are off by default.
But WHY? Help me understand that because I cannot see the reason for adding end spaces. Isn't a break enough? What is the advantage of adding end spaces?
With a working example perhaps we can put an argument to include it in the standard distribution even if they were rules that are off by default.
Unlikely.
.test
.test
.test
.test
.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Pellentesque dignissim enim sit amet venenatis urna cursus eget. Eu tincidunt tortor aliquam nulla. Sapien pellentesque habitant morbi tristique senectus et netus et. Dignissim sodales ut eu sem integer vitae justo eget magna. Ut enim blandit volutpat maecenas. Bibendum neque egestas congue quisque. Proin fermentum leo vel orci porta non. Congue quisque egestas diam in. Magna eget est lorem ipsum dolor sit amet consectetur. Pellentesque habitant morbi tristique senectus et. Ipsum suspendisse ultrices gravida dictum fusce. Volutpat odio facilisis mauris sit. Cursus euismod quis viverra nibh cras pulvinar mattis nunc. Nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Dui id ornare arcu odio. Libero id faucibus nisl tincidunt. Mattis nunc sed blandit libero volutpat sed cras ornare.
Dui vivamus arcu felis bibendum. Fames ac turpis egestas maecenas. Mauris in aliquam sem fringilla ut morbi tincidunt augue interdum. Laoreet non curabitur gravida arcu ac tortor dignissim. Enim diam vulputate ut pharetra sit. Diam maecenas ultricies mi eget mauris pharetra et ultrices neque. Eu turpis egestas pretium aenean. Risus in hendrerit gravida rutrum. A erat nam at lectus urna. Enim lobortis scelerisque fermentum dui. At ultrices mi tempus imperdiet nulla malesuada pellentesque elit eget. In ante metus dictum at tempor commodo ullamcorper. Orci dapibus ultrices in iaculis nunc. Tellus elementum sagittis vitae et. Vel pretium lectus quam id. Dictum varius duis at consectetur lorem donec. Porttitor rhoncus dolor purus non enim praesent elementum.
I love the operation of the leading period on a 5.1.20 Scratch wiki but I am not so happy with some of the changes the mod loader added. Big link icons on every tab, can't set fluid story.
Unless there is a clash in my wiki there has to be a better way to distribute your patch?
Work in progress.
5.1.22-prerelease is doing the same as your 5.1.19 example ".text .text" - this is with nothing loaded ie no modloader patch?
.test
test
test
.test
test
test test .test
test
test test
test
<p>test</p>
test
test
<p>test</p>
<p>
<p>test</p>
</p>
<p>test test .test</p>
To get the content of an HTML element to be parsed in block mode, the opening tag must be followed by two linebreaks.
Without the two linebreaks, the tag content will be parsed in inline mode which means that block mode formatting such as wikitext tables, lists and headings is not recognised.
.test
test
test
.test
.test
test
test
.test
<hr>
<p style="display: block">test</p>
test
test
<p style="display: block">test</p>
<style>
.parra {display: block}
</style>
<p class="parra">test</p>
test
test
<p class="parra">test</p>
<style>
.parra {display: block}
</style>
<p class="parra">test</p>
test
test
<p class="parra">test</p>
Perhaps my reasoning was wrong but my fix awas correct.This works as expected
<style>
.parra {display: block}
</style>
<p class="parra">test</p>
test
test
<p class="parra">test</p>
<style>
.parra {display: block}
</style>
<p class="parra">test</p>
test
test
<p class="parra">test</p>
<p class="Xparra">test</p>
test
test
<p class="Xparra">test</p>
I think something that is too muted in ... is the RELATION between any new parser rule you add and what the existing parsers do with any "residue"--text between text you marking-up.
Coda & TonyMInterested ... What happens to bits in pale violet ...?<p>test</p>
test
test
<p>test</p>
... innocent sloppy spaces which will "break" the flow. HTML deals with sloppy spaces itself - something that's been around for what... >25 years? This idea breaks that.
<pre>Text in a pre element
is displayed in a fixed-width
font, and it preserves
both spaces and
line breaks</pre>
Reasoning: When copy-pasting external text, now I have to police the text at the character level to watch for ...
$tw.Wiki.prototype.deserializeTiddlers`.
coda coder wrote... innocent sloppy spaces which will "break" the flow. HTML deals with sloppy spaces itself - something that's been around for what... >25 years? This idea breaks that.Have you ever heard of DARING FIREBALL Markdown?
And in HTML there is a tag to preserve white spaces: <pre> ... </pre>(w3schools.com)
<pre>Text in a pre element
is displayed in a fixed-width
font, and it preserves
both spaces and
line breaks</pre>
coda coder wroteReasoning: When copy-pasting external text, now I have to police the text at the character level to watch for
Which objects do you use in Jermolene/TiddlyWiki5 for your policing?
I'm trying to find the location in TiddlyWiki where the white spaces characters are removed from the <pre> tag. This happens before parsing. I found this while debugging so far: `$tw.Wiki.prototype.deserializeTiddlers`.
But even here one space is missing. But this space is definitely present in the html file and also in the tiddler in edit mode.
Can you help me out here too?
... (if your proposal were adopted) would mess up my pasted external text ....
however adding these leading characters is quick and easy. Testing also shows an edit toolbar button that prefixes every line produces a nice out put. Ensuring paragraphs are clear and line breaks / empty lines collapse.
Regards
Tony
I will open a new thread with the help of CdK when back at a desktop. Thanks
Tony