Discussion:
[tw5] Confused about character interpretation
(too old to reply)
Sjaak Adriaanse
2018-12-10 18:15:35 UTC
Permalink
Hi all,

I keep bumping into the same problem: the characters I use in coding,
especially the various kind of brackets (including quotes), are not
interpreted the way I think they will be. This keeps confusing me.

Is this documented clearly somewhere? Where (and why) are some brackets
interpreted as one thing, and where as another, or not at all as something
special?
To start with: why are double square brackets used for both 1) a link to a
tiddler, 2) keeping a string with spaces in it together? On several
occasions I used them for the second purpose and saw a link appearing where
I did not want one.

I will give a small example here. This is meant to show what confuses me,
not a plea to solve this little problem for me.

I have a number of small text tiddlers that are transcluded in larger
tiddlers.
Now I want to start the transcluded version with the title in 2-level
header, followed by the text 'src' in superscript, that links to the text
tiddler itself (the source, hence 'src'). This makes it easy for me to jump
to the source tiddler if I want to change the text. So I defined a macro:

\define srct()
!!{{!!title}}^^[[src|{{!!title}}]]^^
\end

and put
<<srct>>

as first (non-define) line of the small tiddler. I hope this is all clear.

The macro call produces the title header all right, followed by 'src' in
superscript, but the link on 'src' is not interpreted and goes to the
string "{{!!title}}". ??????? Why doesn't TW fill in the actual title there?

Confused,
Sjaak
--
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 ***@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/1b4be154-10b6-4d7e-9fc7-bc3259d662b3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Jed Carty
2018-12-10 18:47:40 UTC
Permalink
The parser used in wikitext can be a bit confusing.

There are two important parts here, lists in wikitext are space separated
and things between [[ and ]] are normally interpreted as literal titles
(you show one exception where you have a | that separates the displayed
text from the title it links to).

So [[a title]] being a link to a tiddler and

title [[title with spaces]] somethingElse

is a list of 3 titles.

Both cases are dealing with titles as the atomic units where [[ and ]]
aren't to show that it is a string with spaces, it is to show that it is a
tiddler title. Depending on context a tiddler title can be a link or it can
be an element in a list. Much of what tiddlywiki does is based around lists
and titles.

There are very few limitations on what can be a title, so often anything
between [[ and ]] is considered a literal title. The exception comes from
filters which are actually a superset of the cases where you use [[ and ]]
to denote a title with a string in it.

This explanation could get very long, so to prevent that the answer is that
[[ and ]] is used consistently, but it isn't to show a string, it is to
show a title. In wikitext without a special context like a widget a title
written like that is converted into a link. So your example is being
interpreted as linking to the tiddler with the title {{!!title}} because
otherwise we would have to put restrictions on tiddler naming.
--
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 ***@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/f7174ab0-7e33-4ee5-af66-ab1fc0942f57%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
'Mark S.' via TiddlyWiki
2018-12-10 18:44:26 UTC
Permalink
It actually looks like you're getting a good handle on how to use TW. Your
first questions concern wiki-text. A good place to start with that is
https://tiddlywiki.com/#WikiText.

But your actual question, in the macro, is really about concatenation. You
want to "glue" (concatenate) the results of {{!!title}} into the middle of
a wikitext link [[stuff|ref]]. Both {{}} and [[]] are wikitext, not actual
widgets or objects. Putting wikitext inside of wikitext doesn't usually
work except for formatting.

What you need to fix this is a widget. A widget can take a transclusion
inside of it. The most universal way would be to use the macrocall widget
and call macro with your transcluded value as a parameter.

So if you rewrite your macro like this:

\define srct(title)
!!{{!!title}}^^[[src|$title$]]^^
\end

Then you can call it like this:

<$macrocall $name="srct" title={{!!title}}/>

And that should get you pretty close.

Or you could use the link widget and rewrite your macro like:

\define srct()
!!{{!!title}}^^<$link to={{!!title}}>src</$link>^^
\end

The point is, that when you want to insert the value of a wikitext
transclusion into something else, that something else will need to be an
attribute of widget or of an HTML tag.

Hope I haven't muddied things here too much ;-)

Good luck!
-- Mark
Post by Sjaak Adriaanse
Hi all,
I keep bumping into the same problem: the characters I use in coding,
especially the various kind of brackets (including quotes), are not
interpreted the way I think they will be. This keeps confusing me.
Is this documented clearly somewhere? Where (and why) are some brackets
interpreted as one thing, and where as another, or not at all as something
special?
To start with: why are double square brackets used for both 1) a link to a
tiddler, 2) keeping a string with spaces in it together? On several
occasions I used them for the second purpose and saw a link appearing where
I did not want one.
I will give a small example here. This is meant to show what confuses me,
not a plea to solve this little problem for me.
I have a number of small text tiddlers that are transcluded in larger
tiddlers.
Now I want to start the transcluded version with the title in 2-level
header, followed by the text 'src' in superscript, that links to the text
tiddler itself (the source, hence 'src'). This makes it easy for me to jump
\define srct()
!!{{!!title}}^^[[src|{{!!title}}]]^^
\end
and put
<<srct>>
as first (non-define) line of the small tiddler. I hope this is all clear.
The macro call produces the title header all right, followed by 'src' in
superscript, but the link on 'src' is not interpreted and goes to the
string "{{!!title}}". ??????? Why doesn't TW fill in the actual title there?
Confused,
Sjaak
--
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 ***@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/7f2d90a1-10a9-4ee5-b1c3-bd01d562420a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Jeremy Ruston
2018-12-10 18:49:54 UTC
Permalink
Hi Sjaak

There is some confusion from the fact that the various brackets we use tend to serve more than one purpose, just as punctuation like periods might serve several different purposes within a conventional programming language.

Further, as you've discovered, while one can write <a href={{blah}}> or <a href=<<blah>>>, you can't write <a href={{<<blah>>}}/>. The brackets in that situation are special string delimiters, rather than operators as one might expect.

Each type of bracket is associated with a different phenomenon:

* Double square brackets are used to delimit tiddler titles in lists that contain spaces
* Double square brackets are also used to indicate links
* Double curly braces are used to delimit a tiddler title (aka text reference) whose content is to be transcluded
* Triple curly braces are used to delimit a filter expression whose content is to be transcluded
* Double angle brackets are used to delimit a variable name whose content is to be transcluded

Generally, TiddlyWiki's wikitext has two layers:

* At a high level there are a multitude of special wikitext constructions made from symbols. For example, the link construction [[text|link]], ''bold'', or * for bullet lists. These constructions are designed to be concise and memorable, and favour simple syntax over flexibility.

* At a low level, there is a generic HTML element syntax that is also used for widgets, the special custom elements that give TW5 its interactive behaviours. All of those high level constructions are actually just shortcuts for a longer formulation expressed as raw widgets. For example, one can link with [[Hello There]] or <$link to="Hello There">Hello There</$link>. The element/widget syntax is designed to be generic, consistent and flexible.

Best wishes

Jeremy


--
Jeremy Ruston
***@jermolene.com
https://jermolene.com
Post by Sjaak Adriaanse
Hi all,
I keep bumping into the same problem: the characters I use in coding, especially the various kind of brackets (including quotes), are not interpreted the way I think they will be. This keeps confusing me.
Is this documented clearly somewhere? Where (and why) are some brackets interpreted as one thing, and where as another, or not at all as something special?
To start with: why are double square brackets used for both 1) a link to a tiddler, 2) keeping a string with spaces in it together? On several occasions I used them for the second purpose and saw a link appearing where I did not want one.
I will give a small example here. This is meant to show what confuses me, not a plea to solve this little problem for me.
I have a number of small text tiddlers that are transcluded in larger tiddlers.
\define srct()
!!{{!!title}}^^[[src|{{!!title}}]]^^
\end
and put
<<srct>>
as first (non-define) line of the small tiddler. I hope this is all clear.
The macro call produces the title header all right, followed by 'src' in superscript, but the link on 'src' is not interpreted and goes to the string "{{!!title}}". ??????? Why doesn't TW fill in the actual title there?
Confused,
Sjaak
--
You received this message because you are subscribed to the Google Groups "TiddlyWiki" group.
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/1b4be154-10b6-4d7e-9fc7-bc3259d662b3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
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 ***@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/9A547369-0D66-4FA1-85B0-11A55928A771%40gmail.com.
For more options, visit https://groups.google.com/d/optout.
Continue reading on narkive:
Loading...