On Saturday 07 August 2004 08:10, Tim Starling wrote:
Eric Pierce wrote:
Apologies if this has been brought up before, but
I am
curious about the status of automatic replacement of
dashes in the wikitext (in particular -- and ---) with
HTML-entity versions that many users seem to like so
much (ndash and mdash). I noticed that a while back
(February 2004) such a conversion was implemented, but
apparently reverted due to undesirable breakage. Any
way it could be reinstated? I may look into it once I
get familiar with the code.
That conversion consisted of two lines of code:
$text = str_replace( "---", "—", $text );
$text = str_replace( "--", "–", $text );
These were inserted near the start of the wikitext->HTML transformation.
The biggest problem in my mind was that it breaks links. Perhaps the way
to avoid this would be to act on HTML instead of wikitext, and to only
replace dashes which occur outside HTML tags.
How about only doing this replacement if the dashes are immediately preceded
and followed by whitespace/newline? Simple rule, easy to understand, easy to
implement, doesn't break URLs.
-- Jan Hidders