Hi Jeremy,

среда, 3 июля 2013 г., 23:16:39 UTC+4 пользователь Jeremy Ruston написал:
>
> Hi Yakov
>
> Thanks for the feedback. I'm keen to add syntax for some higher level 
> constructs like sliders, and have been thinking along similar lines. I 
> would like to throw in some related open questions that might be useful to 
> explore.
>
> First, a bit of background. In TW5, sliders and several other interactive 
> features are composed from two simpler widgets working together: the 
> 'button' widget can change the value of a tiddler in response to a click, 
> and the 'reveal' widget shows or hides a block of text depending on whether 
> a tiddler has a given value.
>

That's nice, I'd use separate buttons and contents in one of my TWs were 
TW5.

>
> Here's an example of a raw slider in TW5:
>
> <$button popup="StateTiddler">Open</$button>
> <$reveal type="nomatch" state="StateTiddler" text="">
> This is the text that will be hid or shown
> </$reveal>
>
> If you paste that into a tiddler, open the tiddler called "StateTiddler" 
> and then click the "open" button, you'll see the value of the tiddler 
> change.
>
> Obviously, the syntax above is a bit clumsy for everyday use. The primary 
> alternative is to define and use a macro that encapsulates the slider 
> functionality. For example:
>
> \define slider(caption,state,text)
> <$button popup="$state$">$caption$</$button>
> <$reveal type="nomatch" state="$state$" text="">
> $text$
> </$reveal>
> \end
>
> <<slider "Open" "StateTiddler" "This is the text that will be hid or 
> shown">>
>
> So, what you're suggesting is essentially to devise a wikitext syntax that 
> can be parsed and rendered as that <$button>/<$reveal> combination. Along 
> the same lines, I'm interested in wikitext syntax for tabs, which are 
> actually implemented as a set of interleaved sliders. I've been considering 
> something like this:
>
> __|Title|__
> Some content to go in this tab
> __|Title2|__
> More content
> ____(statetiddler)
> The end of the tab control
>
> ('statetiddler' denotes the tiddler that contains the state of the tab 
> control -- the information that was stored in a cookie in TWClassic)
>
> Now, I'm wondering if the syntax for sliders and tabs could be or should 
> be in any sort of harmony?
>

Well, I suppose this can be done in a quite simple way:

+++[label tab 1]
contents of the tab 1
+++[label tab 2]
contents of the tab 2
...
===

I guess one would hardly need "tabs" with one tab; and, at least in Eric's 
implementation, nested sliders can't be used one inside another.

>
> Because sliders can be represented as macros so neatly, I'm wondering 
> about providing a special type of parser rule that basically maps a regexp 
> to a macro invocation.
>
> One could imagine such a rule being encoded like this:
>
> regexp: 
> \+\+\+\(([a-zA-Z0-9-_]+)\)\[([a-zA-Z0-9-_]+)\]\n([a-zA-Z0-9-_]+)\n===
> macro: slider
> params: state caption text
>
> In practice,  the regexp would need to be more complicated than that, but 
> you get the idea. Hopefully a lot easier than authoring a full blown JS 
> module.
>

Well, I guess the implementation can be grabbed right from the 
NestedSlidersPlugin (with "unnecessary" part removed), although I don't 
know how those "rules" are processed and whether they have names/can be 
hijacked (I mean, if Eric reimplements NestedSliderPlugin for TW5, it 
should substitute a simpler "rule").

Best regards,
Yakov.

>
> What do you think?
>
> Best wishes
>
> Jeremy
>
>
> On Tue, Jul 2, 2013 at 9:19 PM, Yakov <[email protected]<javascript:>
> > wrote:
>
>> Hello all, hi Jeremy,
>>
>> I've got a small proposal for TiddlyWiki 5. Sorry, I haven't dug much, 
>> only took a look at TW5 at the main site [1] to make sure what I propose is 
>> not the case.
>>
>> In TiddlyWiki classic, sliders have somewhat bulky syntax, especially 
>> when a slider opens something in the same tiddler. But we also have 
>> NestedSlidersPlugin from Eric [2], which simplifies this much. My proposal 
>> is to support partially NestedSlidersPlugin's syntax in TW5:
>>
>> +++(cookie)[label]
>> content
>> ===
>>
>> This would:
>> * be simple and clean
>> * ease a bit migration of content from TW classic to TW5
>> * may be ease implementation of NestedSlidersPlugin in TW5
>>
>> Best regards,
>> Yakov
>>
>> [1] http://five.tiddlywiki.com/
>> [2] http://tiddlytools.com/#NestedSlidersPlugin
>>
>> -- 
>> 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] <javascript:>.
>> To post to this group, send email to [email protected]<javascript:>
>> .
>> Visit this group at http://groups.google.com/group/tiddlywiki.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>  
>>  
>>
>
>
>
> -- 
> Jeremy Ruston
> mailto:[email protected] <javascript:>
>  

-- 
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 http://groups.google.com/group/tiddlywiki.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to