Loading...
 
Skip to main content

Features / Usability


Formatting of monospaced text

posts: 7

Hi!

According to the manual, you need to surround monospaced text with "-+" and "+-".
I wonder why it's necessary to put an additional whitespace before the starting tag. Is there a reason for this?

Example:
If I write: "You should call -+intValue()+- in ...." then that comes out as:
"You should callintValue() in ...." with "intValue()" monospaced. Note the missing space.

I am asking because it is pretty annoying having to put two whitespaces before monospaced text so that one is displayed.

Thanks,

Sascha

posts: 7

Hi!

Since no one cares to answer, I did some more digging in the PHP files myself (and I am a Java developer!).

The bug is in tikilib.php, line 6467.
It reads:

// Replace monospaced text
$line = preg_replace("/(^|\s)-\+(.*?)\+-/", "< code >$2< /code >", $line);


Obviously, the first group captures the whitespace. Wouldn't it better to replace with "$1< code >$2< /code >" to preserve the whitespace if there is one?!

Sascha