just was wondering… is there a way to get a “read more” function? so a way to structure a tidder in an introduction /summery and the rest of a text?
It would not be hard! Not sure whether anyone has already done it.
I do have a glossary that shows only the first paragraph of the tiddler behind each entry the glossary, even if the tiddler itself is longer.
It would be a similar pattern to have a view template that shows only the first n characters (or words, or whatever), until a “details”-style toggle is activated to show the rest.
Alternately, there could be a “summary” or “tldr” field that appears by default, with a button that toggles the tiddler into regular view template mode… (I suppose I’d opt for a behavior where the summary field is preferred if it exists, but the first 80 words show up otherwise, or something like that.)
If nobody else chimes in with an actual link, I’m curious enough to throw something together soon. I could imagine having uses for it myself.
Not sure if either of these would do the job?
https://tid.li/tw5/hacks.html#TextStretch
TextStretch is pretty cool …
is there also a way to wrap the Syntax
<<strex "content" "label" "start" "end" "class" "id">>
into a button - so that by click the code is inserted? this would make things really easy…
No idea! I just provide the links!
Ok - this is actually than an other question: is there an addon which helps to define new buttons for the Edit Toolbar ?
TextStretch works just fine up to the point to where quotation mark - " - are part of the text you want to hide … so TextStretch does not always wok for longer text where you have quotation marks often integrated … a pity
IF the text has no single quotes you can use those instead. Try it, it should work …
<<strex 'content' 'label' 'start' 'end' 'class' 'id'>>
It could work, I think, by adding the code to the editor’s “Stamp” tool. No extra button required. It can be laid out as needed.
I recently wrote a show code macro that displays the current content as code, and stops when it reached <!-- end code -->
, or displays all code, and then renders the tiddler.
For example
\function disp() Display this as code
<!-- end code -->
Then when you use;
<<show-code>>
It displays the code upto the `<!-- end code -->`
but also renders the whole tiddler.
So what if we have a more macro
This is the initial text, abstract etc...
<<more>>
This is more
Then it would display;
This is the initial text, abstract etc...
more...
then clicking more will show the rest of the tiddler?
- FYI: It will need a cascade template, and a way to identify tiddlers using more or hide-body=yes
You can also try triple double quotes like this:
<<strex """content""" """label""" """start""" """end""" """class""" """id""">>
Fred
See the docs: How to create dynamic editor toolbar buttons
so for bold in the text field it is
<$action-sendmessage
$message="tm-edit-text-operation"
$param="wrap-selection"
prefix="''"
suffix="''"
/>
what would it be for the read more button ?
something like this:
<$action-sendmessage
$message="tm-edit-text-operation"
$param="wrap-selection"
prefix="<<strex 'content' '...' '' '' 'standardcolor' >>"
suffix=" "
/>
The tm-edit-text-operation has more info about the possibilities: https://tiddlywiki.com/#WidgetMessage%3A%20tm-edit-text-operation
There is a insert-text
where you do not need the prefix and suffix definitions
thanks … but still paragraphes do break the function
It looks like the macro isn’t designed to handle paragraphs…
I had a look at the code but I couldn’t fix it, sorry.
Fred
I am building a solution for the more operation based on this above Read More... function - #12 by TW_Tones but the devil is in the details, It responds to the existence of the comment <!-- more -->
by displaying what is above when viewing the tiddler and also what’s below once you click more.
- I need to simultaneously turn the logic upside down so if
<!-- more -->
is not present you just get the more button, and click shows the whole body.- I presume this is a desirable use?
- Or should it display the first paragraph?
Hopeful I can share the solution tomorrow.
- It makes use of an approach I only recently developed, that makes it quite simple to use, so I hope it will be quite compelling.
I’d be uncomfortable with that.
In HTML that is usually a comment. Can’t you use some non-HTML syntax?
UPDATE: I re-read your posts and see you are going a way that is better! Excuse my mis-reading.
That said.
What is the big deal with “disclosure” tools? Haven’t they been done already?
Just a comment
TT