Use of @@ in a field

I am creating tiddlers with information about organic molecules. To do this I use fields to hold assorted information and one of these is what’s called the SMILES string.

Without going into too much detail (but see Simplified molecular-input line-entry system - Wikipedia), SMILES is a line notation that allows the molecule to be encoded in a compact manner. As part of the encoding of the stereochemistry (i.e. the arrangement of atoms or groups in 3D – handedness) a clockwise or anti-clockwise priority is coded by @@ or @, respectively… of course, @@ doesn’t display and subsequent material is highlighted (in yellow).

I guess I can use @@ to escape the @@ but I’m wondereing whether that’s the only way.

Many thanks in advance for any insights.

One alternative to @@, if you want to retain easy write and readability in the field itself, is to use the @@ as you like, but invoke its contents (in whatever your viewing templates are) only inside a text widget, so the SMILES string does not get wikified:

<$text text={{!!SMILES-field}}/>

[Edited to include the slash that concludes the text widget; otherwise what comes after doesn’t render correctly.]

-Springer

2 Likes

It’s possible to deactivate certain parser rules on a per tiddler basis or globally.

Per Tiddler

\rules except styleinline

@@asdf@@

Globally

As you can see the name of the rule is “styleinline” …

  • Backup first – Backup first – Backup first – Backup first
  • Go to the ControlPanel → Info → Advanced → Parsing → deselect “styleinline”
  • save your wiki
  • reload

4 Likes

Thanks! I forgot about the option to deactivate them on a per-tiddler basis – which doesn’t require reload, and doesn’t jeopardize compatibility with tiddlers that rely on inline styles.

(In case it’s not already clear: the \rules except styleinline string would have to be at the very top of the tiddler whose display is to be affected.)

I’ll throw a curve ball in the mix.

You could wrap your SMILES string in single back-ticks.

If you are not crazy about the format, you could setup the CSS for your TiddlyWiki so that anything in single back-ticks has a different style.

2 Likes

Many thanks @Springer, @pmario and @Charlie_Veniot that’s been really helpful.

I decided to use the <$text ... /> widget method as it was easiest. I use a macro to display the contents of fields so I just had to add the widget to the macro and everything was sorted. Grand!

Take care.

2 Likes

Another sanity test/example:

1 Like

2 posts were split to a new topic: Melecules – Periodic Table – cont