Fullscreen
Loading...
 
Skip to main content

Monospaced text not correctly formatted

Status
Closed
Subject
Monospaced text not correctly formatted
Version
2.x
Category
  • Conflict of two features (each works well independently)
  • Usability
Feature
Wiki Syntax (text area, parser, external wiki, etc)
Resolution status
New
Submitted by
Atticus0307
Lastmod by
Landry Bitege
Rating
(0)
Description

Issue was described here:
http://tikiwiki.org/tiki-view_forum_thread.php?comments_parentId=31233&topics_sort_mode=lastPost_desc&forumId=4Question

When you insert text like:

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

This is caused by the regular expression used to replace the Wiki Syntax with HTML.

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

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

The first group captures the whitespace. But only the second capturing group is saved.

Solution

Just as a proposal:

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

This would preserve the whitespace if there is one.

Workaround
Importance
3
Priority
15
Demonstrate Bug on Tiki 19+
Demonstrate Bug (older Tiki versions)
Ticket ID
2211
Created
Tuesday 09 December, 2008 18:03:53 UTC
by Unknown
LastModif
Monday 06 April, 2026 19:42:52 UTC


Show PHP error messages