Using stamp to get [[]] <br/> with cursor between the brackets like editor button "wrap selection ..." possible?

151 views
Skip to first unread message

Cd.K

unread,
Sep 17, 2019, 9:13:51 AM9/17/19
to tiddl...@googlegroups.com

BurningTreeC

unread,
Sep 17, 2019, 12:09:48 PM9/17/19
to TiddlyWiki
It's possible if you create a stamp Tiddler and two additional Tiddler titled the same but with /prefix and /suffix as the ending of the titles. Then put [[ in the prefix Tiddler and ]]<br> in the suffix tiddler

TonyM

unread,
Sep 17, 2019, 6:59:18 PM9/17/19
to TiddlyWiki
Cd.K

If you step back for a second and consider that it appears you want to place the link to a tiddler inside the square brackets on its own line there are actually other approaches.

For example at present if you use ";" as the first character on the line then it will be bolded and an effective <br> will be there although it is not in the text
;[[tiddlername]]

Or if you want it indented ":"
:[[tiddlername]]

In the above there will be an effective <br/> at the end of the lines, but the text remains clearer. So the above are immediate work arounds for you.

However, After a long and trying experience with WIkitext the following is I believe a good solution "proposed".

I have tried to seek support to at least in my own wiki introduce a leading "." period to wikitext that does the same as ";" without the bold. Basically a leading period would wrap the line in 
.This is a line or paragraph

Would render (not insert)
<p>This is a line or paragraph</p>

I would then add an editor toolbar button to prefix lines with "." in bulk. Which I have tested and it works well because it collapses multiple blank lines into one blank line between paragraphs/lines. But placing a single "." on lines I want to automatically break, or become multi-line paragraphs is trivial and still quite neat. Then you need only place ".[[" in your prefix and "]]" in your suffix if at all.

Problem is I do not know how to add the wiki text parsing rule.

Regards
Tony

On Tuesday, September 17, 2019 at 11:13:51 PM UTC+10, Cd.K wrote:
 

Cd.K

unread,
Sep 18, 2019, 9:32:19 AM9/18/19
to TiddlyWiki
BurningTreeC

I had read it in the Using Stamp Tiddler, but unfortunately didn't recognize the application potential of prefix and/or suffix. I can't use it yet, because I'm using version 5.19.

But I will implement your tip in the near future.     

Thanks a lot 
Cd.K

Cd.K

unread,
Sep 18, 2019, 9:42:59 AM9/18/19
to tiddl...@googlegroups.com
TonyM

Very interesting.

I've added my "npp:" and "xpp:" wiki text parsing rules. For this application I would have to find the ":" rule, copy it and convert it to the "." rule.

There would also be the alternative to make a  "two spaces" rule instead of <br/>.


Once I have time and have updated from 5.19 to 5.20, I will address this issue.


Regards
Cd.K

TonyM

unread,
Sep 18, 2019, 4:33:12 PM9/18/19
to TiddlyWiki
Cd.K That would be greatly appreciated

Though the ":" rule uses <dl> <dd> and <dt> tags and I think the best for a "." rule would be wrap each "Paragraph"

.Line or paragraph

at render in 
<p class="period-paragraph">Line or paragraph</p>

The class will allow subsequent css to be applied only to these "." paragraphs.

Tony

Cd.K

unread,
Sep 25, 2019, 12:13:24 PM9/25/19
to TiddlyWiki
TonyM

Can you please provide me with your CSS class "period-paragraph" here?

Regards
Cd.K

TonyM

unread,
Sep 25, 2019, 6:47:57 PM9/25/19
to TiddlyWiki
CdK

The named class did not exist. However by including it in the paragraph tag it would be available to be set in a stylesheet if desired.

We could simply set css for all p tags but being able to target those handled with the lead in period could be useful.

Perhaps Jeremy or others could chime in here but I am curious why wikified content does not already use css classes for further scalability.

Not withstanding the above we can introduce css classes using @@ and or .classname (from memory).

possible futures may include automatic paragraph id setting for targeting of a specific paragraph.

Regards
Tony

coda coder

unread,
Sep 25, 2019, 11:13:05 PM9/25/19
to TiddlyWiki
Hi Tony


On Wednesday, September 25, 2019 at 5:47:57 PM UTC-5, TonyM wrote:
possible futures may include automatic paragraph id setting for targeting of a specific paragraph.



id attributes are persona non grata in tiddlywiki. Transclusion would create multiple elements with identical ids - a big fat no-no. Same reason you can't use

<a href="#fragment">stuff</a>
...
<p id="fragment">stuff</p>


TonyM

unread,
Sep 26, 2019, 2:16:36 AM9/26/19
to TiddlyWiki
Coda Coder

I am aware of what you are saying but wondering about an automatic ID generation process. If coupled with an automatic TOC within the tiddler linking to such anchors no one even needs to know the ID numbers. They can be generated just in time.

For example I have a method of my own to get a serial number for each tiddler, this + an incremental number rendered into the output would give a unique id. This is speculation of course. Since tiddler titles are unique perhaps it or its Qualified name can be used.

Are you aware of the work around using "## anchors?" I cant find the reference to it but there is surely a clue in that.

Regards
Tony

coda coder

unread,
Sep 26, 2019, 11:04:36 AM9/26/19
to TiddlyWiki


On Thursday, September 26, 2019 at 1:16:36 AM UTC-5, TonyM wrote:
Coda Coder

I am aware of what you are saying but wondering about an automatic ID generation process. If coupled with an automatic TOC within the tiddler linking to such anchors no one even needs to know the ID numbers. They can be generated just in time.

If they're non-deterministic, I don't see the benefit. In a link, I won't be able to freely target a para with an id that's been auto-generated (which will also likely have a different id, "next time").


For example I have a method of my own to get a serial number for each tiddler, this + an incremental number rendered into the output would give a unique id.

Again, I don't see the benefit. I suspect (can't prove) that's too much auto-rewiring to do as the document is being used.

 
This is speculation of course. Since tiddler titles are unique perhaps it or its Qualified name can be used.

I believe that's what the qualify macro is for/why it is needed - get around/obviate the need/lack of ids.

 

Are you aware of the work around using "## anchors?" I cant find the reference to it but there is surely a clue in that.

No? I'd appreciate a link if you find it.
Reply all
Reply to author
Forward
0 new messages