Prevent emdash replacing 2 dashes?

405 views
Skip to first unread message

amreus

unread,
Nov 22, 2020, 1:27:15 PM11/22/20
to TiddlyWiki

I'm playing with an idea of a command-line builder where I can build the command line using a form and copy the command to the clipboard.

Most commands accept 2 dashes for long options but in my example (attached) the double-dashes get converted to an emdash. Can this be prevented?

Thanks.

Delete Old Files.json

BurningTreeC

unread,
Nov 22, 2020, 2:17:46 PM11/22/20
to TiddlyWiki
Hi @amreus, I tried your file on tiddlywiki.com ... try the following code:

<pre><$text text={{!!cmd}}/></pre>
<$wikify name=a text="""<$text text={{!!cmd}}/>""">
<$macrocall $name="copy-to-clipboard" src=<<a>>/>
</$wikify>
<table>
<tr><td>Days:</td><td><$edit-text field="old"/></td></tr>
<tr><td>Depth:</td><td><$edit-text field=depth/></td></tr>
</table>

@@font-family: mono;
cmd: <$text text={{!!cmd}}/>
@@

BurningTreeC

unread,
Nov 22, 2020, 2:21:25 PM11/22/20
to TiddlyWiki
@amreus - sorry I overlooked that this breaks the wikification of {{!!cmd}}

soren.b...@gmail.com

unread,
Nov 23, 2020, 10:07:05 PM11/23/20
to TiddlyWiki

The promotion of -- to – is caused by a parse rule, called dash. If you're willing to turn it off for this entire wiki, you can find the option in Control Panel/Info/Advanced/Parsing (note that you have to reload the page to see the change).

Otherwise...normally, you can disable parse rules on a tiddler-by-tiddler basis with the \rules except pragma, like:

```
\rules except dash

This will be two hyphens: --
```

I could not get this to work in combination with the $wikify widget though, either by just putting the widget inside a tiddler with a rules pragma or by using a macro to concatenate the pragma to the command before passing it in to $wikify. Maybe there is a way to use pragmas with $wikify that I'm missing, but if so it doesn't appear to be documented.

amreus

unread,
Feb 6, 2021, 10:01:19 AM2/6/21
to TiddlyWiki
Thank you, Soren.  Turning the dash option off for the entire wiki seems to be working fine.  If I actually ever need a mdash or ndash, I can use &mdash; and &ndash;

TW Tones

unread,
Feb 7, 2021, 6:51:56 PM2/7/21
to TiddlyWiki
Amreus,

When considering a similar action to generate scripts another method I came across was to open a tiddler displaying a script in a "new window" and Printing the result to a Generic text printer/file. This way you get to name the file as desired and only text.

Regards
Tony

Reply all
Reply to author
Forward
Message has been deleted
0 new messages