Ciao Mark & Mat
In the specific case I think it would be possible to capture and chunk the
thing ("action-dothing" etc as "((a)ction) ((d)o) ((t)hing)") via regex
(complex, but possible for all variants). I think the issue is that TW
filter regex don't return capturing groups so you can't leverage it? Also
need function for return of Uppercase.
Thoughts
TT
On Tuesday, 18 February 2020 16:47:15 UTC+1, Mark S. wrote:
>
> The problem is that you are attempting to find a "logical" approach to
> what is fundamentally a "human" problem --
> There is no "logic" (at the string level) to how things are named. As far
> as electrons are concerned,
> TiddlyWiki makes as much sense as TiddlYwiki .
>
> A somewhat harder, but more reliable approach, might be to grab the text
> from the widget tiddlers. At the
> bottom of each tiddler is text like:
>
> exports.setvariable = SetWidget;
>
> where you could, hypothetically, extract the widget name. Unfortunately,
> for the "action-" tiddlers, you're
> going to have to append "action" since they're named differently (did I
> mention names weren't logical?)
>
> On Monday, February 17, 2020 at 11:49:57 PM UTC-8, Mat wrote:
>>
>> Darn... turns out it ain't quite enuff. OK, here's the real issue I'm
>> trying to solve:
>>
>> I'm trying to extract the widget names from the actual js widgets in
>> order to create links to their respective widget doc on tiddlywiki.com.
>> The goal is a selectwidget where the user selects a widget title to get its
>> docs show up in iframes.
>>
>> The problem is thus about reshaping the widgets js code names into
>> tiddlywiki.com doc title format, i.e CamelCase.
>>
>> The initial extraction is done like so:
>>
>> [all[shadows]prefix[$:/core/modules/widgets/]removeprefix[$:/core/modules
>> /widgets/]removesuffix[.js]splitbefore[/]!suffix[/]]
>>
>> which gives this:
>>
>> action-createtiddler
>>> action-deletefield
>>> action-deletetiddler
>>> action-listops
>>> action-navigate
>>> action-sendmessage
>>> action-setfield
>>> browse
>>> button
>>> <http://editormagic.tiddlyspot.com/#button>...
>>
>>
>> From here, the exact manipulation depends on the title. E.g "browse"
>> merely needs a capital initial, whereas "action-creattiddler" should become
>> "ActionCreateTiddler". First this filter is added:
>>
>> sentencecase[]split[-]sentencecase[]join[]
>>
>> so "action-creattiddler" and all the other such formatted become
>> ActionCreatetiddler where only the capital T, for tiddler, is missing.
>>
>> Thus my original question - but I missed to clarify that there are
>> multiple suffixes that must also have uppercase initial:
>>
>> field
>>> tiddler
>>> message
>>> block
>>> mangler
>>> variables
>>> catcher
>>> call
>>> (possibly some more) .
>>
>>
>> Here's the full construct thus far:
>>
>> <$list filter='
>> [all[shadows]prefix[$:/core/modules/widgets/]removeprefix[$:/core/modules/widgets/]removesuffix[.js]splitbefore[/]!suffix[/]addsuffix[
>>
>> ]sentencecase[]split[-]sentencecase[]join[]split[ ]addsuffix[ ]]'/>
>>
>> Marks clever idea was in deed good for my simplified case with only one
>> suffix but can anyone come up with something efficient also for this
>> problem with multiple suffixes?
>>
>> For my use case, one may argue that the complete list is not overly long
>> so it could as well be a static title list - but the solution should not
>> have to be modified if new widgets are added. In deed, the suffix list
>> would still need to be hard coded but these are (hopefully) less likely to
>> change.
>>
>> The whole concept is part of a much more general thingy soon to be
>> released :-)
>>
>> Thank you!
>>
>> <:-)
>>
>
--
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 view this discussion on the web visit
https://groups.google.com/d/msgid/tiddlywiki/0bf7193a-53d5-406e-904c-7c6ee783b4a5%40googlegroups.com.