Hi Mat,
thanks for your reply.
I think this code could be the key to some missing features.
Hi everyone
For my purposes it would be good to be able to set different start and
ending marks, I guess this should be possible.
I tried to understand and change the cherrypicker Macro
(http://cherrypicker.tiddlyspot.com/#CherryPicker) replacing the $mark$
by $start$ and $end$.
I understood some things, some are beyond my knowledge.
My result crashes I think due to problems with the recursion. (What
means +[first[]]?)
I made a commented version of the macro,
For those willing to help who don`t know the cherrypicker, the aim is to
list the sections between $start$ and $end$.
So thanks for help
Jan
<!--
-------------------------1. This part filters the relevant Tiddlers,
gets their Text and passes it to 2. and it creates the box with the
results ---------------------------------
-->
\define xtract(start, end)
@@.cherryheading $start$...$end$@@
<div style="margin: -0px 0 0 22px;">
<$list
filter="[!is[system]regexp:text[$start$]regexp:text[$end$]!prefix[Draft]!title[About]!tag[About]!regexp:text[cherrypicker
]] -[prefix[CherryPicker]] -[prefix[codeCherry]]" emptyMessage="NO"
variable="tid">
<$list variable="fulltext" emptyMessage="NOpfx"
filter="""[<tid>get[text]]""">
<$macrocall $name="scrubprefix" txt=<<fulltext>>
start="$start$" end="$end$"/>
</$list>
</$list>
</div>
\end
<!--
-------------------------2. This part chops off all before the
start-mark---------------------------------
-->
\define scrubprefix(txt, start, end)
<$list variable="pfx"
filter="[[$txt$]regexp[$start$\S]splitbefore[$start$]]" >
@@.pfx ''pfx'':<<pfx>><br>@@
<$list variable="txt" emptyMessage="NOtxt"
filter="[[$txt$]removeprefix<pfx>]">@@.txt ''txt:''
"""<<txt>>"""<br>@@
<$macrocall $name="pick" txt=<<txt>> start="$start$" end="$end$"/>
</$list>
</$list>
\end
<!--
-------------------------3. This macro chops off at the end-mark and
creates a section which is collected and a rest which is again passed
to the scrubprefix...---------------------------------
-->
\define pick(txt, start, end)
<$list variable="cherry" emptyMessage="NOcherry"
filter="[[$txt$]regexp[\S$end$]splitbefore[$end$]removesuffix[$end$]]
[[$txt$]!regexp[$end$]splitbefore[ ]]
[[$txt$]!regexp[\S$end$\s]splitbefore[$end$]]
+[first[]]">
<span class="cherrybullet" tooltip=<<tid>>>
<$link to=<<tid>>>{{cherrybullet.png}}</$link>
</span><<cherry>> <br>
<$list variable="rest" emptyMessage="NO3"
filter="[[$txt$]removeprefix<cherry>removeprefix[$end$ ]]
[[$txt$]removeprefix<cherry>] +[first[]]">
@@.rest ''rest'':<<rest>><br>@@
<$list filter="[<rest>regexp[$start$]]">
<$macrocall $name="scrubprefix" txt=<<rest>> start="$start$"
end="$end$"/>
</$list>
</$list>
</$list>
\end
Am 20.08.2016 um 18:01 schrieb Mat:
Hi Jan. I'd love to help you but I feel I must prioritize the
TWederation stuff - sorry.
FYI, I started refactoring the CherryPicker macro some time ago but
hit a roadblock due to the limited possibilites to work with strings
and substituting sub-strings in a controlled way, using wikitext. Hope
to get back to it because I have some really cool stuff I hope to make.
If you are experimenting yourself, and it's not obvious already, the
CherryPicker basically traverses through the text in a recursive way
until it hits the "markers" where it cuts and then continues after the
end marker. At least I think this is what it does... it was a while
ago ;-)
<:-)
--
You received this message because you are subscribed to the Google
Groups "TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send
an email to [email protected]
<mailto:[email protected]>.
To post to this group, send email to [email protected]
<mailto:[email protected]>.
Visit this group at https://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit
https://groups.google.com/d/msgid/tiddlywiki/4fde9dd9-7dcf-451f-ad26-713b9afbcb0e%40googlegroups.com
<https://groups.google.com/d/msgid/tiddlywiki/4fde9dd9-7dcf-451f-ad26-713b9afbcb0e%40googlegroups.com?utm_medium=email&utm_source=footer>.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit
https://groups.google.com/d/msgid/tiddlywiki/57BA289D.8030806%40googlemail.com.
For more options, visit https://groups.google.com/d/optout.