\define checkRest(rest,start,end,prefix,suffix,limit,rmQuotes,mode)<$set name="text" value="""$rest$"""><$list variable="beforeStart" filter="""[<text>splitbefore[$start$]]"""> <$set name="proceed" filter="""[<beforeStart>removesuffix[$start$]] +[addsuffix[ç-TestPassed-ç]]""" emptyValue="es"> <$set name="proceedto" filter="""[<proceed>removesuffix[ç-TestPassed-ç]regexp[es]]""" emptyValue="extractSnippet"> <$list variable="newRest" filter="""[<text>removeprefix<beforeStart>]"""> <$macrocall $name=<<proceedto>> rest=<<newRest>> start="""$start$""" end="""$end$""" prefix="""$prefix$""" suffix="""$suffix$""" limit="$limit$" rmQuotes='$rmQuotes$' mode="$mode$"/> </$list> </$set> </$set></$list></$set>\end<$set name="proceedto" filter="""[<proceed>removesuffix[ç-TestPassed-ç]regexp[es]]""" emptyValue="extractSnippet"> <$list variable="newRest" filter="""[<text>removeprefix<beforeStart>]"""> <$macrocall $name=<<proceedto>>As you can see the is a variable and then it has been called as a macro again! See below part of above code:<$set name="proceedto" filter="""[<proceed>removesuffix[ç-TestPassed-ç]regexp[es]]""" emptyValue="extractSnippet"><$list variable="newRest" filter="""[<text>removeprefix<beforeStart>]"""><$macrocall $name=<<proceedto>>
- How this is possible with TW5?
- Is this a valid TW5 syntax?
\define mextract(text start, stop)
<$set name="fulltext"
value=<<__text__>>
>
''fulltext'': <$text text=<<fulltext>> /><br>
<$list variable="p1" filter="[<fulltext>splitbefore[$start$]]">
''p1'': <$text text=<<p1>> /><br>
<$list variable="p2" filter="[<fulltext>removeprefix<p1>]">
''p2'': <$text text=<<p2>> /><br>
<$list variable="p3" filter="[<p2>splitbefore[$stop$]removesuffix[$stop$]]">
''p3'': <span style="color:red;"><$text text=<<p3>> /></span><br>
<$macrocall $name="mextract"
text={{{[<p2>removeprefix<p3>removeprefix[$stop$]]}}}
start=<<__start__>>
stop=<<__stop__>>
/>
</$list>
</$list>
</$list>
</$set>
\end
<$macrocall $name="mextract" text={{newTest2!!text}} start="''" stop="''">>/>This is //italic// and //italic2//.
This is ''bold'' and this is ''bold2''
I am here to call it `code` and `code2`.
//Thomas//