Announcement

Do not use the forums to submit bug reports, feature requests or patches, submit a New Ticket instead.

#1 2008-04-16 10:00:26

Ugo
New member
Registered: 2008-04-15
Posts: 5

force html emphasis tags to i and b

Hello,

I really need to have i and b html tags instead of em and strong.
I read in the forums that this behaviour used to be browser-dependent in the past, but now it seems both firefox and IE are using em and strong.

Is there a way to set xinha so that it outputs good old i and b tags? Maybe I should hack the code and brutally add a replacement instruction somewhere, but I am too noob to do it myself! :-D

Thanks in advance for your help!

Last edited by Ugo (2008-04-16 10:03:39)

Offline

#2 2008-04-17 01:47:04

gogo
Xinha Leader
From: New Zealand
Registered: 2005-02-11
Posts: 1,015
Website

Re: force html emphasis tags to i and b

I would just replace it server side with a regexp, if you're using php

   $HTMLFromXinha = preg_replace('/<(\/?)strong>/', '<$1b>', $HTMLFromXinha);
   $HTMLFromXinha = preg_replace('/<(\/?)em>/', '<$1i>', $HTMLFromXinha);

James Sleeman

Offline

#3 2008-04-25 14:14:29

Geoffrey
Xinha Community Member
Registered: 2005-03-21
Posts: 10

Re: force html emphasis tags to i and b

I think you could also use the xinha._config.specialReplacements option in the config file, e.g.

xinha_config.specialReplacements = {
            '<i(\s[^>]*)?>' : '<em$1>',
            '<\/i>' : '<\/em>'
       };

(and then the same for <b ...> <strong ...>). This would turn all <i ...> to <em ...> on the way into xinha and would convert them all back again to <i ...> on the way out. You'd need to check the backslashes, because I think the specialReplacements function might do its own escaping of regex strings...
-- Geoffrey

Offline

#4 2008-05-01 08:40:11

ray
Xinha Administrator
From: Germany
Registered: 2005-03-23
Posts: 521
Website

Re: force html emphasis tags to i and b

This will not work this way as you can't simply put  RegExps in an object like this. Please have a look at this ticket which contains a means to do this http://xinha.webfactional.com/ticket/1201

Offline

Board footer

Powered by FluxBB