Escaping formatting (specifically -- used for strikethough)

59 views
Skip to first unread message

AllenJB

unread,
Oct 11, 2006, 8:19:39 AM10/11/06
to TiddlyWiki
Hi all,

I'm a *nix jibbler so I often note down commands which involve -- (for
example: emerge --sync ). The problem I'm having is that this is being
picked up as "start strikethrough". Is there a method of escaping
formatting, or specifically escaping the strikethrough -- code?

Thanks in advance

Allen

Daniel Baird

unread,
Oct 11, 2006, 8:28:54 AM10/11/06
to Tiddl...@googlegroups.com
It might be too much typing, but your commands will look nicer wrapped
in triple curlies, eg:

To enable the porn finder, type {{{sudo rm -Rf / }}}

..and it'll stop any formatting weirdness like strikethrough. I
think.. sorry, I'm too lazy to test it :)


Cheers

;Daniel


--
Daniel Baird
http://tiddlyspot.com (free, effortless TiddlyWiki hosting)
http://danielbaird.com (TiddlyW;nks! :: Whiteboard Koala :: Blog ::
Things That Suck)

AllenJB

unread,
Oct 11, 2006, 9:11:07 AM10/11/06
to TiddlyWiki
True, but sometimes I want to do things like tables of options (one of
the sysadmins I work with is paranoid beyond reason and removes all
manpages from their system!) and typing an extra 8 characters ('cause I
like spaces between the curlys and my commands) gets bit tiresome. If
that's the only way to do it then I guess I'll just have to put up with
it.

Allen

> Daniel Bairdhttp://tiddlyspot.com(free, effortless TiddlyWiki hosting)http://danielbaird.com(TiddlyW;nks! :: Whiteboard Koala :: Blog ::
> Things That Suck)

Simon Baird

unread,
Oct 11, 2006, 10:42:03 AM10/11/06
to Tiddl...@googlegroups.com
possibly as annoying (but only 4 more chars...)

emerge -/%%/-sync

/% and %/ are comment delimiters.



On 10/11/06, AllenJB < goo...@allenjb.me.uk> wrote:



--
Simon Baird <simon...@gmail.com>

Justin Case

unread,
Oct 11, 2006, 3:02:46 PM10/11/06
to TiddlyWiki
Allen,

You can use a plugin to get rid of formatters you don't need or want.
For example, created a new Tiddler, name it anything you want (like
NoStrikethroughPlugin, for example) and tag it as systemConfig. Then
copy the following into the tiddler:

/***
Plugin which gets rid of strikethrough formatting.
***/
//{{{
for (var i = 0; i < config.formatters.length;i++)
{
if (config.formatters[i].name == "strikeByChar")
{
config.formatters.splice(i, 1);
break;
}
}
//}}}

Be sure and save the tiddler and save changes to the TiddlyWiki. But,
basically, that gets rid of --strikethrough-- type formatting. If you
want strikethrough text, add the following to the StyleSheet tiddler:

.strikethrough
{
text-decoration: line-through;
}

And then you can use {{strikethrough{text}}} to format strikethrough
text. Of course, you can call the CSS class something shorter (like
stt) for less typing.

Anyway, from your posts, I kind of got the impression that using
strikethrough text is the exception for you. If that's the case, then
this solution may work. Good luck!

Bob McElrath

unread,
Oct 11, 2006, 3:16:40 PM10/11/06
to Tiddl...@googlegroups.com
I thought the consensus was that -- was just causing trouble and we
should go back to == or --- ? It seems now we have a confusing
situation where sometimes you get a strikethrough and sometimes you get
an mdash...

Personally I like --- since it doesn't conflict with anything. ==
conflicts with C/javascript equality and so does ===.

Justin Case [bla...@gmail.com] wrote:
> .strikethrough
> {
> text-decoration: line-through;
> }
>
> And then you can use {{strikethrough{text}}} to format strikethrough
> text. Of course, you can call the CSS class something shorter (like
> stt) for less typing.

--
Cheers,
Bob McElrath [Univ. of California at Davis, Department of Physics]

A people that values its privileges above its principles soon loses both.
- Dwight Eisenhower

signature.asc

Justin Case

unread,
Oct 11, 2006, 3:26:53 PM10/11/06
to TiddlyWiki
sheesh! I'm an idiot! It's the "mdash" formatter, not "strikeByChar"
that's giving you grief.

The code for that plugin could be something like:

for (var i = 0; i < config.formatters.length;i++)
{

if (config.formatters[i].name == "mdash")
{
config.formatters[i].match = "\\\\-\\\\-";
break;
}
}

Since your original post wanted escaping... this would fix it such that
--text would display as --text (no mdash) but \-\-text would display as
an mdash.

Please ignore that first message. Sorry.

Justin Case

unread,
Oct 11, 2006, 3:33:29 PM10/11/06
to TiddlyWiki
I'm not arguing that everyone should do this. Just that Allen might
want to do that because of how he wants -- to work. But, to be honest,
I rarely ever use the strikethrough formatter. But that's just me --
I'm sure others use it or else it wouldn't exist.

Justin Case

unread,
Oct 11, 2006, 4:25:07 PM10/11/06
to TiddlyWiki

Bob McElrath wrote:
> Personally I like --- since it doesn't conflict with anything. ==
> conflicts with C/javascript equality and so does ===.

--- for strikethrough? I like it... that plugin would be something
like:

for (var i = 0; i < config.formatters.length;i++)
{
if (config.formatters[i].name == "strikeByChar")
{

config.formatters[i].match = "---(?!\\s|$)";
config.formatters[i].termRegExp = /((?!\s)---|(?=\n\n))/mg;
break;
}
}

Very nice -- great idea -- thanks!

Daniel Baird

unread,
Oct 11, 2006, 8:17:42 PM10/11/06
to Tiddl...@googlegroups.com
Stuff like this would solve Allen's strikethrough problem, but there
are bound to be other formatters that are triggered by unix command
lines.

MediaWiki has a convenient thing where any lines that start with
whitespace gets wrapped in a pre tag.. something like that would be
cool maybe?

;D

--
Daniel Baird
http://tiddlyspot.com (free, effortless TiddlyWiki hosting)

http://danielbaird.com (TiddlyW;nks! :: Whiteboard Koala :: Blog ::
Things That Suck)

Justin Case

unread,
Oct 11, 2006, 8:41:26 PM10/11/06
to TiddlyWiki
AllenJB wrote:
> Is there a method of escaping
> formatting, or specifically escaping the strikethrough -- code?

I'm sorry but all of the plugin suggestions, so far, have not done
this. Rather, they either remove completely or change the way existing
formatters work.

To do what you suggest, above, create a new tiddler, name it anything
(say EscapeDoubleDashPlugin), give it the systemConfig tag, and then
paste this into the tiddler:

/***
This plugin escapes the double dash.
!!!Examples

|!Wiki Text|!Formatted|
|{{{gzip \-\-help}}}|gzip \-\-help|
|{{{c\-\-;}}}|c\-\-;|
|{{{\-\-text\-\-}}}|\-\-text\-\-|

!!!Code
***/
//{{{
config.formatters.push({
name: "EscapeDoubleDash",
match: "\\\\-\\\\-",
handler: function(w)
{
createTiddlyElement(w.output,"span").innerHTML = "--";
}
});
//}}}

Save the tiddler (done) and then save changes to the TiddlyWiki. On
reload, the examples actually work.

Obviously, you DO NOT want to use this plugin with the "mdash" code I
posted earlier (as they match on the exact same escape sequence (\-\-).
Also, none of the other posted plugin code needs to go in. This will
work, as is -- all by itself and just like you originally asked for.

google....@dfgh.net

unread,
Oct 11, 2006, 4:19:09 PM10/11/06
to Tiddl...@googlegroups.com
Hi,

you can use the LegacyStrikeThroughPlugin that comes with TW2.1 such that you use the TW2.0 strike through format for strikethrough.

CC

Justin Case

unread,
Oct 11, 2006, 9:39:17 PM10/11/06
to TiddlyWiki
Daniel Baird wrote:
> MediaWiki has a convenient thing where any lines that start with
> whitespace gets wrapped in a pre tag.. something like that would be
> cool maybe?

Cool -- you bet! Try this one out:

/***
Displays lines that begin with a space in a <pre> element.
!!!Example:
This displays in a <pre>.
--text--
c--
gzip --help
''bold''
//italics//

!!!Code
***/
//{{{
if(!version.extensions.PreSpacePlugin)
{
version.extensions.PreSpacePlugin = true;

config.formatters.push({
name: "PreSpace",
match: "^ ",
lookaheadRegExp: /((?:^ [^\n]*\n)+?)(^$\n?)/mg,
element: "pre",
handler: config.formatterHelpers.enclosedTextHelper
});
}
//}}}

Reply all
Reply to author
Forward
0 new messages