Hi Tones Thank you for your feedback. Yes the idea is great to have an interactive ui. I also like to hear about the performance and see how I can improve the macro hslines.
Best wishes Mohammad On Sat, Jan 9, 2021 at 2:25 AM TW Tones <[email protected]> wrote: > Mohamad et al > > Nice work, I could imagine range sliders, one for the start line, one for > the number of lines, at least for setting the "code window" to be > displayed, at least in an authorship mode.. > > Tones > > On Saturday, 9 January 2021 at 03:40:05 UTC+11 Mohammad wrote: > >> This *second version* of hslines even accepts a text as source code no >> need to provide a tiddler (of course I may recommend to put your code >> inside tiddler) >> This can be used to teach Tiddlywiki scripts ;-) >> >> A minor bug is version 1 has been fixed. You can set the opacity to blur >> the other lines . >> >> >> See below examples >> >> [image: 497_msedge.png] >> >> >> Best wishes >> Mohammad >> >> >> On Fri, Jan 8, 2021 at 7:26 PM Mohammad Rahmani <[email protected]> >> wrote: >> >>> Attached is an interesting solution to transclude codes from a tiddler. >>> This is useful when you want to discuss part of the code. >>> >>> 1. The code has a macro and a stylesheet >>> 2. It is possible to transclude any part of code (say from line n to >>> line m) >>> 4. Macro accepts ALSO a composite range like "2-5, 7 9, 13-18" and *stands >>> out* those lines no matter in what order you pass the selected range >>> 5. The stand out lines have different background and high contrast while >>> other parts of the code are a little faded out >>> 6. To give a try >>> 6.1. Download attached JSON >>> 6.2. Drag and drop to https://tiddlywiki.com/prerelease/ >>> 6.3. Open highlight-selected-lines/test01 >>> >>> I would like to get feedback and tell me how the efficiency can be >>> improved. >>> >>> Best wishes >>> Mohammad >>> >>> The macro and its sub macro is given below ( >>> highlight-selected-lines/macro) >>> >>> \define hslines(tid, from, to, rng, language)<$wikify name="numbers" >>> text=<<rawlist>> ><$vars length={{{ [[$to$]subtract[$from$]add[1]] }}} >>> ><$set name="lines" filter="[[$tid$]get[text]splitregexp[\n]addsuffix[ >>> ]first[$to$]last<length>]"><ol start="$from$" class="code-list"><$list >>> filter="[range[$from$,$to$,1]]" variable=num><$list >>> filter="[enlist<numbers>nsort[]match<num>then[code-selected]else[code-notselected]]" >>> variable=selectedClass><$vars pos={{{ [<num>subtract[$from$]add[1]] }}} >>> ><span class=<<selectedClass>> ><li><$codeblock code={{{ >>> [enlist:raw<lines>nth<pos>] }}} language=<<__language__>>/></li> >>> </span></$vars></$list></$list></ol></$set></$vars></$wikify> >>> \end >>> >>> \define rng2list() {{{[range[$(start)$,$(end)$]addsuffix[ ]]}}} >>> >>> \define rawlist()<$list filter="[<__rng__>split[,]split[ ]!is[blank]]" >>> variable=num><$list filter="[<num>search:title[-]]" emptyMessage=<<num>> >>> variable=vrng><$vars start= {{{ [<vrng>split[-]first[]] }}} >>> end= {{{ [<vrng>split[-]last[]] }}} > >>> <<rng2list>></$vars> </$list></$list> >>> \end >>> >>> -- > 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/70637961-7433-47db-ace4-36f8fcafa869n%40googlegroups.com > <https://groups.google.com/d/msgid/tiddlywiki/70637961-7433-47db-ace4-36f8fcafa869n%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- 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/CAAV1gMB72fVVisD8ic9ETBK-10WxbRYK%2BeZ3RN%2B2zGoT7ZEaSw%40mail.gmail.com.

