Presenting: StretchText - an alternative to links or popups

1,155 views
Skip to first unread message

Mat

unread,
May 25, 2016, 5:28:19 PM5/25/16
to TiddlyWiki
StretchText - a long time fantasy of mine... that I was informed was old hat (heh!)

  • It enables writing text that turn to readers with varying levels of knowledge or interest and...
  • provides a more subtle alternative to hyperlinking than regular links or popups.

Unfortunately I don't have the skills to straighten out some issues in it so it's only a Beta and I'd appreciate any advice.

<:-)

RichardWilliamSmith

unread,
May 25, 2016, 10:01:13 PM5/25/16
to TiddlyWiki
Thanks Mat,

You inspired me to search again for something I had previously found and then lost, because it was very hard to google for - the term I was lacking was "telescopic text", check this out -


This Medium article links to some examples of it in use.


Cool, huh?

Regards,
Richard

Alex Hough

unread,
May 25, 2016, 10:26:01 PM5/25/16
to tiddl...@googlegroups.com
Thanks Mr Von Twaddle,

Stretch test is new to me too. Over the years if tried to write text with links which reads well, I never got there. Stretchtext is one of those things which exist in the world, like a song which seems so simple and obvious you believe that you would have written it if only Paul MaCartney hadn't got there first.

And thanks Jeremy, who would have known that Ted Nelson had the idea nearly 50 years ago? 

An idea.. Here is the text from the TiddlyWiki:


StretchText is an  hypertext concept. It enables for the author to write text that turn to different readers with varying  of interest or knowledge.


Instinctively id like the StretchText tiddler to have  a field containing one of more Stretchtexts. Rather than the author adding the stretches inline, they are stored in an appropriate tiddler. It paves the way for transclusion-centric authoring.

All this brings Steve SUNY and {{DesignWrite}} to mind. Thinking in StretchText could be something to add to thinking hypertextually.  And what other Ted Nlson concepts are out there?


Best wishes 

Alex
--
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 tiddlywiki+...@googlegroups.com.
To post to this group, send email to tiddl...@googlegroups.com.
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/198522af-d294-472b-8790-025e3ac883aa%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Mat

unread,
May 26, 2016, 4:55:04 AM5/26/16
to TiddlyWiki

@Richard - thanks for the links! Yes, similar concept but/and with a few interesting differences that I'll reflect on for anyone who is interested in the concept;

In creating StretchText I wanted it to be very simple to use but this typically comes at the expense of flexibility of course. My first attempt was to merely make the label expand directly. But, as I mention in my creation, this made the remaining right part of the original sentence hang like an appendix at the end. It seems to me that telescopic text does not deal with this, even if they've polished their sample texts so it's not obvious. If you try to actually compose text like this it is immediately clear it is totally unpractical.

...or just maybe their version allows to completely exchange the label word/s for the content, I can't tell. The telescopic text does also show before the original label text, so that's an indication. With complete exchange, you could make the whole sentence be the label so this is exchanged, which seems useful and solves the appendix problem. In StretchText I wanted the syntax to follow the actual sentence, so you basically just insert the macro brackets and parameter quotation marks. Complete exchange might be better though.

...but I do miss a reverse/back toggle in their version. StretchText obviously leaves the button for toggling.

There is also difference in visual guidance as to what part is the appearing text - both for the actual appearance and what it was that was added. Telescopictext takes the easy route in just having it appear in a blink. I found this too twitchy for StretchText (interestingly it doesn't appear quite as twitchy in telescopic text. Not sure why.) I made early attempts to make the content text visually "feed out" (by animating font-size, line-height etc) but this was not good because all text occurring in the rest of the document was then pushed visually, including the repositioning of the line breaks etc, making for an unappealing visual rattling. I ended up with a compromise; the content "space" does appear in a blink but there is a (quick) fade in for the actual content.

Their decision to leave the text as a completely integrated part, contrary to my outlining border, might be a good idea for readability though. I'm thinking I should change it so the border fades away.

Interesting stuff.


<:-)

Mat

unread,
May 26, 2016, 5:05:44 AM5/26/16
to TiddlyWiki
@Alex

thanks for calling me the Paul McCartney of TW... (..no? not quite what you said? Oh, ok... ;-)


Instinctively id like the StretchText tiddler to have  a field containing one of more Stretchtexts. Rather than the author adding the stretches inline, they are stored in an appropriate tiddler. It paves the way for transclusion-centric authoring.


Yeah. I intentionally wanted it inline because I think of it as a small/quick tool to not break authoring flow - but it is possible to transclude the content. Just put
 
{{!!fieldname}}

as the content. Or do I misunderstand your idea?


<:-)

Hegart Dmishiv

unread,
May 26, 2016, 6:51:32 PM5/26/16
to tiddl...@googlegroups.com
Hi Mat,

I remember looking at the concept of StretchText during the {{DesignWrite}} course. I had a go at implementing it myself using Tobias' <$appear> plugin. Your macro looks interesting though, and much neater to code than my nested appears.

Hegart.

Mat

unread,
May 27, 2016, 8:59:09 AM5/27/16
to TiddlyWiki
@Hegart, thanks for showing this. Funny how a concept that I'm interested in has been there all the time and I've just missed it. Probably partly because I didn't know the term for it.

Yes, nesting does seem to complicate it but I hope to come up with something that keeps simplicity for the author. (This is not prio right now tho). I think a difficulty is that you cannot nest macro calls, as far as I know.

<:-)

prog...@assays.tv

unread,
May 27, 2016, 9:27:16 AM5/27/16
to TiddlyWiki
When I read http://www.telescopictext.com I really understood the point. I can see how the power of transclusion in TW lends itself to it.

Mat

unread,
Jun 1, 2016, 5:15:40 PM6/1/16
to TiddlyWiki
StretchText updated.

The earlier main issues to format the label text properly, now works. Also some styling updates.

It's probably ready to be packaged into a plugin now but will let it stay in Beta for more testing in actual use.

Do tell if you hit any problems.

<:-)

Birthe C

unread,
Jun 2, 2016, 5:45:30 AM6/2/16
to TiddlyWiki
Hi Mat,

I think the grey frames may confuse the reader. I updated my  wiki  and right after my partner refused to read any further. He thought he had ruined something ;-)


Birthe

Mat

unread,
Jun 2, 2016, 12:17:47 PM6/2/16
to TiddlyWiki
Birthe C wrote:

I think the grey frames may confuse the reader. I updated my  wiki  and right after my partner refused to read any further. He thought he had ruined something ;-)


Whupps!? :-)  

Do you mean the idea with the outline alltogether? (I think it would be confusing if there was no indication of what was added, no?)

Or are you perhaps referring to that currently, when clicking opening a label, the outline animation is;

  fade-in...fade-out...[and if mouse remains on the label]...instant-outline

If I could, I would not include that last instant outline there, but I do want the instant outline to appear when one mouses out and then hovers again over the label.

I don't know how to make the instant-outline not be active that first time. Trying to figure it out tho.

<:-)

Birthe C

unread,
Jun 2, 2016, 4:42:29 PM6/2/16
to TiddlyWiki
Hi Mat,

It looks perfect in Chrome and now I understand what you mean with animation.
I totally agree with you that we want to see what was added.

We used Firefox.  Two grey frames, one framing the content and the other to the right and on my small screen often covering sidebar.


Birthe




Mat

unread,
Jun 2, 2016, 5:49:04 PM6/2/16
to TiddlyWiki
Firefox 
 
What the fu..ddlywiki... Where do those thingies come from? Sorry for that. Now I understand what your partner meant with broken. Will look into it. 

Thanx for reporting!

<:-)

Mat

unread,
Jun 2, 2016, 6:12:44 PM6/2/16
to TiddlyWiki
Updated

Happy to say the mysterious Firefox artefacts were... not that mysterious after all.

Thanks for reporting Birthe!

<:-)

pedruchini

unread,
Jun 21, 2016, 9:37:39 AM6/21/16
to TiddlyWiki
Let's suppose  several contents are displayed at the same time.
Now, I need to hide them in one click, instead of clicking on every label.

Is it possible to create a "clear" button or something that hides all the contents ?

If the contents remain displayed when I close the tiddler, the next time I open that tiddler the contents appear displayed. Even if I close my whole TW or Firefox, when reopened, Firefox remembers that the contents were displayed.

I find stretchText very useful and with a "clear" or "refresh" button it would be perfect.




Mat

unread,
Jun 22, 2016, 11:45:23 AM6/22/16
to TiddlyWiki
pedruchini,


>Let's suppose  several contents are displayed at the same time.

Yeah, that's a reasonable request. I think I know how to do this so probably try within the next few days. If you want to try it yourself before I have a go; Bascially, the idea is to make the state tiddlers be titled with a common prefix for all StretchTexts and then have a button to batch delete of all those statetiddlers.

<:-)

Josiah

unread,
Jun 22, 2016, 12:28:19 PM6/22/16
to TiddlyWiki
Its a great tool already. VERY useful.

For instance, it allows texts in variant languages to give definitions and clarifications inline without any saga.

To be FULLY compliant with Mr Ted's aims (which he has never actually realized in any way) it would need to be able to NEST expansions AND  contractions too.

One step at a time.

j x
Message has been deleted

pedruchini

unread,
Jun 23, 2016, 8:59:25 AM6/23/16
to TiddlyWiki
I'm afraid I don't have the skills. I'm just a TW5 user who appreciates your work and I think that button would be a nice addition.

Thomas Elmiger

unread,
Jul 10, 2016, 2:41:11 PM7/10/16
to TiddlyWiki

Hi everyone,

May I introduce my own variant of this great idea? I tried to simplify a bit for my limited usecase and I gave it a stretchy appearance (tested in some browsers only).

The result can be found here: http://tid.li/tw5/hacks.html#TextStretch – Yep, I just switched the components of the name, I hope this is not confusing …

Thanks for the inspiration, Mat!

Kind regards and happy stretching
Thomas

Birthe C

unread,
Jul 11, 2016, 12:27:15 PM7/11/16
to TiddlyWiki
Hi Thomas Elmiger,

Now we are really spoilt for choice. I looks cool and I like that we are able to use transclusion from fields. I had great fun testing this.


Birthe

Thomas Elmiger

unread,
Jul 11, 2016, 2:01:14 PM7/11/16
to TiddlyWiki
Hej Birthe, mange tak for din kommentar! – Thanks for testing and giving feedbak, I am glad you like it!

Mat

unread,
Jul 11, 2016, 5:43:12 PM7/11/16
to TiddlyWiki
Thomas - great work! You really got the text to stretch in a visual way - really cool!

<:-)

codacoder...@outlook.com

unread,
Jul 11, 2016, 11:05:10 PM7/11/16
to TiddlyWiki

It's a beautiful things Thomas. However, it would be vastly improved if the user did not need to supply the id. If you look at Mat's original, it did not need an id. That makes Mat's "better" for larger texts/TWs - managing ids will become a huge headache for those users working on vast tomes/thousands of tiddlers.

If you can manage the id internally to the macro, you'll have the killer stretchy-thing (tm) ;)

Coda

Thomas Elmiger

unread,
Jul 12, 2016, 1:26:13 AM7/12/16
to TiddlyWiki
Thanks for your feedback, Coda!
You are right, I will have to explain the id better … and in fact I had tried to eliminate this parameter at first. But I came to the conclusion that it might be a feature in some cases, while it is not a real issue in most others.
In fact, the id is only needed to separate TextStretch-elements from the *same* tiddler. TiddlyWiki’s state-mechanism cares for the rest. So thousands of tiddlers are not a problem.
If you analyse Mat’s solution, you will find an id element too, hidden in the appendix (e.g. _1) to the label. This results in more complex macro code, because you have to separate the label from the id again. Whe I realised this, I opted for transparency and simpler code. And yes: to bother users with an additional parameter.
I hope I find the time to update the docs soon.
Cheers, Thomas

codacoder...@outlook.com

unread,
Jul 12, 2016, 4:33:06 PM7/12/16
to TiddlyWiki
Thanks Thomas. Replies within..


On Tuesday, July 12, 2016 at 12:26:13 AM UTC-5, Thomas Elmiger wrote:
Thanks for your feedback, Coda!
You are right, I will have to explain the id better … and in fact I had tried to eliminate this parameter at first. But I came to the conclusion that it might be a feature in some cases, while it is not a real issue in most others.

If it's a feature in some cases, make it optional (and apply a guid perhaps if the id is not supplied by the user).

If it's "not a real issue" for the user then it's (usually) not too difficult to handle it in the code, either.

Believe me, I'd *love* to use it, but the id is one param too many, for the reasons I described.  Let me expand on that here...

Nothing in vanilla TW5 forces me to "think" about IDs - Jeremy got this 100% right. When moving stuff around between tiddlers (i.e. cut and paste wikitext/markup) I generally do not need to worry about the surrounding context (unless it's macro/template code, of course). But when the text contains IDs, I certainly will need to ensure I don't have clashes so that all id="5" TS blocks don't open up when the intent was one specific TS. And searching through a chapter/section of a book, 12,000 chars long for id clashes is not my idea of productive (or fun) use of my time.

The bigger a TW5 tome becomes, the review-edit-change cycle will get more "expensive" on the user and resistance-to-change will build due to the tediousness of having to manage those IDs by hand. Trust me - I know. I have a catalogue of my own (early TW5) mistakes in this regard which are now so embedded in my system, "life's too short" to fix them.

I hope that made sense?

The key benefit of Mat's solution was "speed of use" at "authoring-time". And whether or not he uses an id internally, it wasn't left to me to manage it during the scenario I mention above. (I only decided not to use it on cosmetic grounds... but that was a while ago, I should check it out again.)

Anyway, I hope this feedback is useful...


Thomas Elmiger

unread,
Jul 13, 2016, 1:42:25 AM7/13/16
to TiddlyWiki
Hi Coda, thanks for stretching your points out in this way ;–)

This is exactly the kind of discussion I had been looking for, very helpful indeed.
In the meantime I have updated the docs, have a look at http://tid.li/tw5/hacks.html#TextStretch

It was of course my intention to make authoring as efficient as possible, that’s why I use default values. When writing a book, I think you want to stay consitent and use these all/most of the time. Your effort with my solution would look like this:

<tiddler>
Some text <
<macroname "your content">> and for the second TextStretch element with the preset label <<macroname "other content" id>>.
</tiddler>



Alternatively, with Mat’s solution, you would have to write

<tiddler>
Some text <
<macroname label "your content">> and for the second StretchText element with the same label <<macroname label_id "other content">>.
</tiddler>

As you can see: you need an id in both cases.

My second concern was computing power. The steps to process my macro call are:
  1. receive params
  2. use content, id and label (as they are defined by the author or the default)

Mat’s solution does this (simplified):

  1. receive params
  2. separate id from label (this is not a simple step!)
  3. use content, label and id

So please reconsider, whitch way suits you best, and let us know, if you find an even better way!

Concerning the last point, I have added some licence information in my docs :–D


All the best, Thomas






Birthe C

unread,
Jul 13, 2016, 4:41:11 AM7/13/16
to TiddlyWiki
Hi Thomas

Textstretch is a very long name prone for spelling errors. It is an exact name, but I wonder if a shorter and easier spelled name could be found? It is not easy I am not good enough in english to have a suggestion but maybe somebody else have suggestions.


Birthe

Thomas Elmiger

unread,
Jul 13, 2016, 7:37:09 AM7/13/16
to TiddlyWiki
Hej Birthe

A valid point. How about tex – the Text EXpander?

Has anyone ever heard of a macro named “tex”?

Thomas

Eric Shulman

unread,
Jul 13, 2016, 10:19:33 AM7/13/16
to TiddlyWiki
On Wednesday, July 13, 2016 at 4:37:09 AM UTC-7, Thomas Elmiger wrote:
A valid point. How about tex – the Text EXpander?
Has anyone ever heard of a macro named “tex”?

Though there may not currently be a macro named "tex", it seems to me that keyword should not be used, since "TeX" is already a well-established name for a document formatting system:


quote:
In several technical fields, in particular, computer science, mathematics, engineering, and physics, TeX has become a de facto standard. Many thousands of books have been published using TeX, including books published by Addison-Wesley, Cambridge University Press, Elsevier, Oxford University Press and Springer. Numerous journals in these fields are produced using TeX or LaTeX, allowing authors to submit their raw manuscript written in TeX.

Thomas Elmiger

unread,
Jul 13, 2016, 12:04:36 PM7/13/16
to TiddlyWiki
Thank you, Eric, for pointing this out.

How about “strex”?
Reminds of stretch and expand, could also stand for STRing EXpander.

(According to Google it is also used in life science as well as mobile payment in Norway.)

Suggestions welcome!
Thomas

codacoder...@outlook.com

unread,
Jul 13, 2016, 12:35:31 PM7/13/16
to TiddlyWiki

Thomas Elmiger

unread,
Jul 13, 2016, 1:48:09 PM7/13/16
to TiddlyWiki
nota sounds good for me!

Rustem

unread,
Jul 13, 2016, 3:58:52 PM7/13/16
to TiddlyWiki


Wow. I need a plugin for Microsoft Outlook. :D

Jeremy Ruston

unread,
Jul 15, 2016, 6:51:00 AM7/15/16
to tiddl...@googlegroups.com
I’m here at the meetup with Matias, Mario and Xavier. We were searching my email to find peoples first posts to the group, and I found the attached personal email from Matias on 5th June 2007… Very consistently, Mat is asking about stretchtext!

Best wishes

Jeremy


Dear Jeremy,

Regarding TW: I can find directions for reporting bugs, contributing code etc but none for posting suggestions. Therefore I'm writing to you here, hoping to get an answer or information where to go with it. (I'm unfortunately not competent enough to program myself.) Thanks in advance. 


Problem:
Sometimes opening full tiddler is a bit "too much" or risks distracting the reading, e.g if I want to allow the user to, say, get a synonym for a word in a text 

Suggestion:
I suggest "something" that expands inside the current tiddler. (A kind of mini-tiddler, perhaps, if you will?)

Example:
This text with a complicated word in it would perhaps look like this.
This text with a complicated [syn: complex, difficult] word in it would perhaps look like this. 

Another example:
Here's a text talking about the detail X that is part of a complex system.
Here's a text talking about the detail X [ <small image>] that is part of a complex system.

Note:
Because it is done within a tiddler, there is no need to add date, who edited etc - i.e this is already included in the head of the tiddler itself. 


Sincerest thanks for TW.


/Matias Goldman, Sweden


On 13 Jul 2016, at 20:58, Rustem <8pa...@gmail.com> wrote:



Wow. I need a plugin for Microsoft Outlook. :D

--
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 tiddlywiki+...@googlegroups.com.
To post to this group, send email to tiddl...@googlegroups.com.
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/a3689c31-944a-4bb3-9787-870d3668a208%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Thomas Elmiger

unread,
Jul 15, 2016, 7:09:50 AM7/15/16
to TiddlyWiki
Oh, this is wonderful! How I would love to be there with you now … have a great [wonderful, lovely] time!
Cheers, Thomas

Jeremy Ruston

unread,
Jul 15, 2016, 7:43:19 AM7/15/16
to TiddlyWiki
A reminder that the livestream for the meetup is now running:


Best wishes

Jeremy

On Fri, Jul 15, 2016 at 12:09 PM, Thomas Elmiger <thomas....@gmail.com> wrote:
Oh, this is wonderful! How I would love to be there with you now … have a great [wonderful, lovely] time!
Cheers, Thomas
--
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 tiddlywiki+...@googlegroups.com.
To post to this group, send email to tiddl...@googlegroups.com.
Visit this group at https://groups.google.com/group/tiddlywiki.

For more options, visit https://groups.google.com/d/optout.



--
Jeremy Ruston
mailto:jeremy...@gmail.com

pedruchini

unread,
Jul 17, 2016, 11:52:04 AM7/17/16
to tiddl...@googlegroups.com
Based on Mabalele's post (https://groups.google.com/forum/#!topic/tiddlywiki/F_laLj-y5lk), I found two solutions

<$button>
<$action-deletetiddler $filter="[search:title[$:/state/]]"/>
clear
</$button>

and

<$button>
<$action-deletetiddler $filter="[prefix[$:/state/]]"/>
clear
</$button>

I pasted one on these on top of the tiddler and it works. 

And I found a third solution:

Firstly, put this in your tiddler:

{{$:/_Buttons/SaveWiki}}

Secondly, Create another tiddler named $:/_Buttons/SaveWiki and put this inside:

<$button message="tm-save-wiki" param={{$:/config/SaveWikiButton/Template}} tooltip="CLEAR" aria-label={{$:/language/Buttons/SaveWiki/Caption}} class=<<tv-config-toolbar-class>>>
<$action-deletetiddler $filter="[prefix[$:/state/]]"/>
<span class="tc-dirty-indicator">
<$list filter="[<tv-config-toolbar-icons>prefix[yes]]">
{{$:/core/images/refresh-button}}
</$list>
<$list filter="[<tv-config-toolbar-text>prefix[yes]]">
<span class="tc-btn-text"><$text text={{$:/language/Buttons/SaveWiki/Caption}}/></span>
</$list>
</span>
</$button>

But, is it safe to do that? Any side effect? Which one of this three solutions is better?
Message has been deleted

Thomas Elmiger

unread,
Jul 17, 2016, 1:08:47 PM7/17/16
to TiddlyWiki
Hi pedruchini

Concerning solutions one and two: they do nearly the same and delete ALL state tiddlers (also search, active tabs, …). This is why I prefixed the state tiddlers of TextStretch. To delete these you can filter for $:/state/txtstr_ with solution one or two (I would prefer two because it filters for a prefix). BUT: This is not possible for the state tiddlers of StretchText as they are not prefixed at the moment.
Good luck!
Thomas

pedruchini

unread,
Jul 17, 2016, 5:10:57 PM7/17/16
to TiddlyWiki
Hi Thomas

Thanks for your quick reply. I some cases the id of TextStretch is an advantage, but not in my use case, I don't mind if it also deletes search states and tab states.

Pedro.

Thomas Elmiger

unread,
Aug 6, 2016, 9:26:44 AM8/6/16
to TiddlyWiki
There is a new version of TextStretch – I spent quite some time on ease of use, functionality and documentation. But still I am afraid, it is far from being finished or even perfect. A short overview of changes (taken from the new versions tiddler):

This is a major update, it is not backwards compatible.

  • Renaming of the macro formerly known as stretchtext. Finally, I opted for the unique string strex. It can be found and replaced easily, if necessary.
  • Parameter class added for styling purposes.
  • CSS update to show the power of classes.
  • TextStretch Examples added.
  • TiddlyWiki update to version 5.1.13.
  • An id parameter is now generated automatically  as a hash number obtained from the content  . The macro parameter id is still available, but was moved to the end of the parameter list.
  • Documentation update.
Give it a try and let me know what you think, if you find the time. There is no hurry, I will be mostly offline the next few days.

Kind regards, Thomas

@codacoder: You were right and wrong. Right: It was possible to automate the id. Wrong: It wasn’t "not too difficult" but it was really difficult indeed, at least for me. Now I call a macro from a macro that is called from a macro and uses a helper macro. Maybe not the most elegant solution, but working. – Thanks for insisting anyway ;–)

@Birthe, @Eric, @codacoder: Although I like nota (derived from nota bene) very much, I opted for strex as the new macro name – mostly because this artificial word is NOT used in normal texts. And because I am the kind of guy who loves the search (and replace) function of text editors. Thanks again for your inputs on this matter.

c pa

unread,
Aug 8, 2016, 12:38:07 AM8/8/16
to TiddlyWiki
I copied and used your macros. Cool

Your instructions are missing how to import the uuid macro so I replaced it with <<qualify "$:/state/strex/$id$">>
Within the macro definitions you don't need to set so many variables,

Rather than using <$set name="var" value="$var$"><$macrocall $name="macroname" variable=<<var>> />
Use <$macrocall $name="macroname" variable="$var$" />

c pa

unread,
Aug 8, 2016, 1:11:05 AM8/8/16
to TiddlyWiki
Here's the replacement. Seems to work

\define strex(content:"TextStretch", label:"…", start:"[", end:"]", class:"", id:"default")
    <$set name="state" value=<<qualify "$:/state/strex/$id$">> >
        <span class="strex-container $class$">
                <$reveal type="nomatch" state=<<state>> text="visible" animate="yes">
                    <$button set=<<state>> setTo="visible" class="strex-open $class$" tooltip="more info">
                        $label$
                    </$button>
                </$reveal>
                <$reveal type="match" state=<<state>> text="visible" animate="yes">
                    <span class="strex-all $class$">
                        <span class="strex-inner $class$">
                            <$button set=<<state>> setTo="hidden" class="strex-close strex-start $class$" tooltip="hide text part">
                                $start$
                                <$action-setfield $tiddler=<<state>> $value="" />
                            </$button>
                            <span class="strex-content $class$">$content$</span>
                        </span><$button set=<<state>> setTo="hidden" class="strex-close strex-end $class$" tooltip="hide info">
                            $end$
                            <$action-setfield $tiddler=<<state>>/>
                        </$button>
                    </span>
                </$reveal>
        </span>
    </$set>
\end

Thomas Elmiger

unread,
Aug 8, 2016, 5:31:05 PM8/8/16
to tiddl...@googlegroups.com
Thank you, c pa, for reviewing my solution and suggesting an alternative! Your version resembles my first try (TextStretch 0.7.1) in many ways. Let me point out some differences:

1) Using the $id$ supplied by the user makes this parameter mandatory for many cases. As soon as you have two or more stretch elements you must define a unique id, else all elements will open and close at the same time. I wanted to generate an id, if it is not specified by the user:

<$set name="uid" filter="[<id>!prefix[_false_]]" value=<<id>> emptyValue=<<content>> >

If no id was set by the user, my default "_false_" is used => I assign the content value as the new id. This already works, but the state tiddler titles can get very long when the whole text-content ist appended. This is not only ugly, it also blows up the size of your wiki. This is why I generate a hash number over the text:

<$set name="xuid" filter="[<uid>prefix[_false_]]" value="error: xuid hashing" emptyValue=<<HashStr """$uid$""">> >

By the way, the instruction to import the HashStr-macro is already in my docs:

"Drag the links from the following list to your Wiki, save and reload." The link to the
is in the list. Should I emphasize the reload part?

(Maybe there is a better solution to call the core function
$tw.utils.hashString(str); ? – to call it from my own js-macro was the only one I found.)

2) The reason, why I use
<$set name="var" value="""$var$"""> a lot is this: I had some problems with $content$ containing/surrounded by "" or ' and try to sanitize it by putting it between """three quotation marks""" on each side. I copied this from Mat’s solution, actually. When I have the time, I will do further testing, if they all are needed.

Thanks again for your feedback – this is highly appreciated – and good night!
Thomas

Josiah

unread,
Aug 9, 2016, 8:26:28 AM8/9/16
to TiddlyWiki
Ciao Thomas, c pa, Mat & others...

Great stuff. Very useful.

I personally see immediate good use cases for it: For instance, inline clarifications of Middle English words in an ebook version of Chaucer's "A Canterbury Tales".

I can also see other interesting apps for "verbal games".

SUGGESTION: I'm not sure if it would be feasible but one could really go places with this is IF expansions/contractions could be NESTED.

Best wishes
Josiah

Thomas Elmiger

unread,
Aug 9, 2016, 5:25:33 PM8/9/16
to tiddl...@googlegroups.com
Ciao Josiah

Nesting is absolutely possible using transclusion. I made a new demo/testcase here: http://tid.li/tw5/hacks.html#TextStretch%20Transclusion%20Examples – hope you like it. (I transclude fields from the same tiddler plus one other tiddler in block mode.)

Verbal game sounds interesting to me, I would be happy to play ;–)

Cheers and buonanotte
Thomas

Josiah

unread,
Aug 9, 2016, 5:38:57 PM8/9/16
to TiddlyWiki
Thomas

Really excellent. Very powerful.

In essence you could replicate http://www.telescopictext.com/ ?

I will write you a text in the next couple of days that can be a bit of fun to apply this to.

Best wishes
Josiah

Mat

unread,
Aug 9, 2016, 6:25:44 PM8/9/16
to TiddlyWiki
Josiah wrote:

I personally see immediate good use cases for it: For instance, inline clarifications of Middle English words in an ebook version of Chaucer's "A Canterbury Tales".

In deed, the obvious example that comes to mind. 


SUGGESTION: I'm not sure if it would be feasible but one could really go places with this is IF expansions/contractions could be NESTED.

Incidentally I happened to recreate a kind of stretchtext thing today. Didn't realize it until after I had made it. However, it is not ready for public eyes because it is part of... let's just say it's part of the most important TW project since sliced bread... and my focus should be on that bigger project. Those who follow along know what I'm talking about.  Anyway, I'm just saying that nested stretchtext will very likely come in due time.

<:-)

Mat

unread,
Aug 9, 2016, 6:27:54 PM8/9/16
to TiddlyWiki
Thomas Elmiger wrote:
 
Nesting is absolutely possible

AH! Here I was babbling and you had already done it. Looks great!

<:-) 

Steven Schneider

unread,
Oct 17, 2016, 8:47:00 PM10/17/16
to TiddlyWiki
Great thread, folks. And thanks for the call out to {{DesignWrite}} -- a learning community for TW that will re-launch in Spring 2017, with a pilot system ready for December. Watch this space!

Thomas, your <<strex> macro is beautiful!

 //steve.
Reply all
Reply to author
Forward
0 new messages