Tinderbox Forum

Help understanding punctuation and .format codes

Continuing the discussion from Zettelkasten compatibility with Markdown apps:

I’m trying to export tags so that they would have links that would work in a markdown app such as NValt.

I have a note with the following $Tags: red, yellow, blue

This export snippet

^value($Tags.format(""," #",",",""))^

Exports as

#red, #yellow, #orange,

How do I learn more about
(""," #",",",""))

Some of the things I tried. I'm just guessing!
  1. ^value($Tags.format(""," [[",",",""))^

  2. ^value($Tags.format(", " ))^

  3. ^value($Tags.format("[[ " ))^]]

  4. [[^value($Tags.format("[[ " ))^]]

  5. ^value($Tags.format("[[ " ))]]^

  6. ^value($Tags.format("[[ " ))^]]

is this regex? or some other language?

What if I wanted to export as
[[red]] [[yellow]] [[orange]]

or

* [[red]]
* [[yellow]]
* [[blue]]

Here’s the relevant section from aTBref:

Optionally, you may supply four arguments to format the list or set as an HTML list:

List/Set.format("listPrefix","itemPrefix","itemSuffix","listSuffix") 

For example:

$Classes.format("<ul>","<li>","/li>","</ul>") 

will return HTML code for a bulleted list with each set member marked up as a list item. Note that the tags must be in double quotes. To have each element on a separate line and indent the items add tabs and line breaks:

$Classes.format("<ul>\n","\t<li>","</li>\n","</ul>\n") 

To make this easier to use in a code export context, you might pass the output of format into another attribute and call the latter within the template with a ^value()^ code. By a repeated use of format it is possible to export lists of links.

https://www.acrobatfaq.com/atbref8/index/ActionsRules/Operators/FullOperatorList/ListSetformatformatStrin.html

The \n will get you a new line, the \t gets you a “tab” character.

No time to fully test, but I think

Would be achieved by:

^value($Tags.format("","[[","]]","))^

[edit by @mwra to fix quotes]
(Don’t copy and paste the above because it’s a mess of curly quotes instead of straight ones).

@derekvan, thanks for the help. This code

^value($Tags.format(“”,”[[“,”]]”,””))^

exports like this

“””[[“red”]]””[[“blue”]]””[[“yellow”]]”””

I’ve studied https://www.acrobatfaq.com/atbref8/index/ActionsRules/Operators/FullOperatorList/ListSetformatformatStrin.html , but I haven’t been able to figure it out.

Here is my sample document

exporting tags as wiki links.tbx (110.2 KB)

I’ll keep trying and report back if I figure it out.

Try

^value($Tags.format("","[[","]]""))^

Because some people’s eyes are offended by " straight double quotes the forum software substitutes ‘typographic’ quotes, i.e .“” for "".

Action code never uses/allows typographic quotes to mark string (i.e. text) inputs. So, unless you are looking at very occasional code that intentionally is trying to handle typographic quote, when copy/pasting to Tinderbox, change the quotes to ‘straight’ quotes.

I can’t understand your demo file as there are no templates! Anyway, here is a file that shows what to do.

Tag-export.tbx (95.2 KB)

Select the ‘Tag list’ note and look at the ‘HTML’ and ‘Preview’ tabs pf the text pane to see the formatted tags.

Thanks Mark. I appreciate you taking the time to create a demo.

I’m trying to export as
[[red]] [[yellow]] [[orange]]

I tried to replace your code with
^value($Tags.format("","[[","]]""))^

It seems just print out white space instead of the tags.

Tag-export-broken.tbx (98.5 KB)

The format string expect 4 parameters separated by commas. You’ve only provided 3—by missing out a comma and a set of double quotes. Let’s break it into lines to see:

^value($Tags.format(
"",
"[[",
"]]""
))^

No wonder Tinderbox is getting confused. I think you meant to use

^value($Tags.format("","[[","]] ",""))^

which breaks out as

^value($Tags.format(
"",
"[[",
"]] ",
""
))^

Notice I also added the space after the ]], as described per your idealised example. See : Tag-export-fixed.tbx (93.2 KB)

This is the point where the temptation is to blame the ‘complexity’ of the app, But, as I hope I’ve shown, this is a simply case of user error—albeit unintentional. The docs tell you 4 parameters are needed, you only provided 3. When the code fails, this is just the sort of thing to check. My break-out of to code above shows a simple low-tech way to check this sort of thing.

(post withdrawn by author, will be automatically deleted in 24 hours unless flagged)

1 Like

Kind words, thanks! :grinning:

I accidentally withdrew my post. . . I’m reposting it!

@mwra, you are such a gift to the community. I admire your patience and understanding with non-programmers like me.

I’ve come to realize the “complexity” of the program is one of the trade-offs of the tinderbox, because a .tbx can go where you want it to go.

My lessons in returning to Tinderbox is to create something that I really want and to go after it incrementally. As I’m building my Zettelkasten TBX, I’m still adding notes and using it. Having export options is important, but no where near as vital as making good notes.

Thank you for the years of guidance and support @mwra. I have never been in an online community where one guides as consistently as you.

1 Like