Wikitext "output types"

58 views
Skip to first unread message

Mat

unread,
Apr 19, 2018, 5:01:34 AM4/19/18
to TiddlyWikiDev
In another discussion, @Jermolene wrote:

I'd love to find a suitable, concise wikitext syntax for plain text wikification.


So, taking a more general approach to formatting output, I'd like to know how y'all feel about these ideas:

We're all familiar with template transclusion syntax which, from an end users POV, "re-formats the output" to match that of the template.

{{mytransclusion||mytemplate}}

The following proposal extends this {{*||*}} syntax.

The equivalent of "tiddler type" formats could be applied to transcluded output, for example text/plain and image/png 

{{mytranscl||/plain}}
{{mytranscl||/
png}}

i.e regardless of type in the original mytranscl tiddler, the current output is in the specified format - an "output type".

Also other output types could be introduced, for example

{{!!title||/link}}

Incidentally, this specific format could spare us from the frequently recurring mouthful

<$link to={{!!title}}><$view field="title"/></$link>

The latter is not intuitive and the more intuitive use of {{!!title}} instead of the viewwidget risks side effects that are difficult to notice!.


Style classes - another "formatting of output" - could be applied using equivalent syntax:

{{mytranscl||.myclass}}

Yes, we already have

@@.myclass
{{mytranscl}}
@@


...but, frankly, I'm not very fond of it and it feels like a half measure step from

<div class="myclass">
{{mytranscl>>
</div>


For macros and tiddler links?
"Output types" could probably be useful also for macros and tiddler links. I have not quite thought this one through)

<<mymacro||/plain>>
<
<another "foo"||.mystyle>>

[[mytitle||.mystyle]]
[[mytitle|pretty||.mystyle]]

...

An optional syntax instead of {{*||*}} might be  {{*}*} , i.e to declare the output type or style inside the last (or first) bracket pair. The output types are a limited and predefined set so we'd have a set of closing delimiters instead of just the single one. I always felt these "between the brackets" positions were under used  in wikitext. We could use these positions for arguments or flags or stuff to {do{transclusion}things} or [apply[mytitle]stuff] in the middle of the text. 


Thoughts?


<:-)

PMario

unread,
Apr 19, 2018, 6:33:52 AM4/19/18
to tiddly...@googlegroups.com
Hi Mat,

I think, everything, that you describe here can be created with "templated transclusions" .. No new code needed. ... It's just a new convention you may need to use.

{{mytranscl||/plain}}
{{mytranscl||/
png}}

Works out of the box, if you want to name your templates that way. Just create a tiddler

title: \plain
text: <$view format=text/>

usage: {{tiddlerTitle||\plain}}

-----

{{mytranscl||.myclass}}

Not possible, since transclusions may not create visible DOM elements.
This form of a transclusion is a macro call with parameters so just do it with macros.

-----------------


<<mymacro||/plain>>
<
<another "foo"||.mystyle>
>

Same as above. This is just a new way to list unnamed parameters, which will cause a lot of trouble, because they are not named. So IMO this approach will not be maintainable very well. It may work for 2 or 3 parameters, but if you have 10 it will blow up.

Use named macro parameters as many as you want:

<<another text:"foo" class="mystyle" tooltip:"something useful, that shows up if hovered" link-to:"any thing">> ..

Works out of the box. IMO nothing new needed.

If you don't want to type much. Just give the macro definition some sensible defaults and you are good with

<<another "foo">>

have fun!
mario

Mat

unread,
Apr 20, 2018, 10:43:48 AM4/20/18
to TiddlyWikiDev
Thanks for your reply Mario

The proposal is not really about my personal need though. I really suggest if for core. Here is some background:

Jeremy is asking for a "concise wikitext syntax for plain text wikification", as universal as possible. His mention arose from my complaint about having to type out this just to get a common title link:

<$link to={{!!title}}><$view field="title"/></$link>

That statement is much to (1)complex (2)complicated (3)even risky for (4)recurring so frequently! There should (obviously!) be a better alternative in the core! 

But, as noted, Jeremy requests "universality". So I realized that the  {{*||*}} syntax, which is both familiar and concise, is suitable for definition of links but also for much more. And rather than introducing new syntax, it is merely a matter of changing the perception of it:  {{*||*}} "is about shaping transclusion output". I don't think it matters if it is purely syntactic or just a convention.

Implementing it in ones own TW would mean you have tiddlers named "/plain" but that should really be system tiddlers.

That said, your suggestions are interesting and I'm going to test some things. Thanks.


<:-)

PMario

unread,
Apr 20, 2018, 11:01:45 AM4/20/18
to TiddlyWikiDev
On Friday, April 20, 2018 at 4:43:48 PM UTC+2, Mat wrote:
....
Implementing it in ones own TW would mean you have tiddlers named "/plain" but that should really be system tiddlers.

... and what's the problem?

IMO It should _not_ be a system tiddler. If I want it to be a system tiddler, I name it: $:/plain or better $:/text/plain and it will be invisible in the sidebar.

If I don't want it to use "$:/text/plain" I can use "/plain", which I personally think is wrong anyway. ... There is no mime-type /plain it's text/plain for a reason, because /plain is not specific enough.

-m
Reply all
Reply to author
Forward
0 new messages