No, it doesn’t currently rename titles in data tiddler text (or data tiddler indexes, for that matter). You can test this on the Relink demo site by making a new tiddler with type: application/x-tiddler-dictionary and text content
Frodo: a hobbit
Sam: [[Frodo]]'s gardener
Then use any of the demo buttons further down the page and note that [[Frodo]] does not change.
This is what I have for the view/edit component now
No wiki text except [[links]]
I am using the fieldset to get the boarder so it looks like a version of the edit box, and put white-space:pre; on that. Note reuse of the getindex through the condition variable.
However if you hand delete the text its easy for an invisible \n to remain and thus !is[blank] fails.
It’s important not to mix modern and legacy attributes (like $mode and mode, respectively) within a single $transclude because the presence of a single modern attribute will switch the entire thing into modern mode. In modern mode, any attributes that don’t start with $ are treated as parameters, not widget attributes — so in your original code mode=block is just setting the value of the (nonexistent) “mode” parameter, not switching the parsing mode. And since you have several lines of code in a row, it defaults to using the inline parser.
This is NOT true!.. the white-space:pre only affects the display of the newlines… the $transclude still wikifies the content. Try entering this content:
This is text
HelloThere
<$list filter="[range[5]]"><<currentTiddler>><br></$list>
and more text here
and you will see that HelloThere is a link, and the $list widget output (numbers 1 to 5) is displayed.
That was SOOO hard to see the mixed modern and old format. Thanks for spotting the errant $.
@EricShulman’s tc-popup-handle allows the edit to stay open now, I can dump the white-space:pre; the : and other line based wiktext were failing, but the transclusion was still broken then
The transclude modern/traditional errors means it now wikifies correctly. including \n it appears.
Just need to address some unwanted space above and below the rendered text because the transclusion is wrapped in a <p></p> that is not in the data tiddler.
This appears to be an opinionated include?
Give the user an easy way to hide the display of notes if desired.
Incidentally, I’d started responding to your OP and scrapped it when I saw Eric was answering, but I did want to ask about this part of your code…
<$button popup=<<notes.popup.tiddler>> tooltip="view/edit.notes for this tiddler" tag=div>
<%if [<notes.popup.tiddler>has[title]] %>
<button>View Notes</button>
<%else%>
<button>Edit Notes</button>
<%endif%>
</$button>
Is there a reason why you’re using HTML buttons inside a $button widget with the <div> tag? IMO, it’d be easier and more semantic to make a single button with variable content. I might do something like this:
\function button.label() [<notes.popup.tiddler>has[title]then[View]] ~Edit
<$button popup=<<notes.popup.tiddler>> tooltip="view/edit.notes for this tiddler">
<<button.label>> Notes
</$button>
It was just to illustrate an idea, that <button>name</button> only generates a look alike button.
The div was just to hide the proper button, if not used this method would look like this;
If you look closer, this is one button widget that displays according to the state of the popup, which is the existence of a temp field. Notice how the button does nothing else at all?
I believe this may be the easiest way to toggle a condition.
I was not planning to create a “canonical solution” but something to talk about and share comments on the code used. However perhaps this is not the best way to demonstrate the uses of a simple html button <button>name</button> because of the ambiguity and a standard way will suffice.
Just to show something which I subsequently did not do. Build more inside the popup button. I think it is better to demonstrate the minimalist toggle example. It can be used for many things and be present anywhere you can place it with the content it unfolds also places where you want.
It could trigger an action, delete an entry by responding to the modifier keys, that may be a good way to demonstrate %if used like a case statement.
If you can see a way to include any other smarts without complicating it too much let me know.
I think it’s very reasonable to use it for conditional content display, since that’s more or less what popup is designed to do. I’ve always used it with $reveal, myself, as suggested by the docs, but it’s nice to see that it can be used with <%if%> as well in situations where you don’t want an actual popup.
Could you expand a little more on that? I’m having trouble envisioning how action widgets could be triggered by the popup attribute alone, or how this would be more efficient than simply using a standard actions attribute. I suppose you could include a conditional that referenced the current popup state in an actions string or procedure…?
Generally, though, I’d be wary of tying action execution to something as transient as a popup. Eric’s solution is perfect for conditional display if the only thing you want to do is toggle the textarea — and I could see this being very useful for inline field editing, for instance. But even with the tc-popup-handle class in place, clicking anywhere else on the page will still delete the state tiddler; it’d be easy to do so entirely by accident. So I think you wouldn’t want to attach any actions that couldn’t be easily reversed — and you’d want to be very careful to ensure that they wouldn’t be triggered inadvertantly.
No, same as you, I would be using the actions parameter on the button using the popup. The main idea was inside an action procedure, using %if nested to be a case statement to handle different modifier keys. This is just a demo to start a conversation.
well i tested it! , ( nice idea btw ),
and tried to read through and understand what dose what
and my internal parser failed/bailed at line one
with error :WTF
You can wait until the official annotated release but consider this “exhibition code” intended to be read and cause questions.
Got Ya!
We can include variables and macros/procedures in filters. Of course their output needs to be suitable for what comes next in the filter. This example is using the qualify macro to generate a title and does exactly that.
It shows how macros/procedures/functions and variables are all a different side of the same coin.