CodeIgniter Forums
issue with auto_typography - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: issue with auto_typography (/showthread.php?tid=7508)



issue with auto_typography - El Forum - 04-12-2008

[eluser]GSV Sleeper Service[/eluser]
I'm getting an extra close paragraph tag if I run text with code tags through auto_typography, example output below.

Code:
<code>$this->badger->mushroom("snake")</p></code>

any idea what's causing this? the close paragraph is not there in the database


issue with auto_typography - El Forum - 04-12-2008

[eluser]Référencement Google[/eluser]
Without more infos on what do $this->badger->mushroom("snake") it's difficult to say.


issue with auto_typography - El Forum - 04-12-2008

[eluser]GSV Sleeper Service[/eluser]
forget about $this->badger->mushroom("snake"), it was just an example, it means nothing and has nothing to do with this problem. let me explain again

I create some text eg

here is some text<code>example code goes here</code>

when I pass this text through auto_typography() I get

[code]<p>here is some text</p><code>example code goes here</p></code>[code]

and as you can see, an extra close paragraph tag is being added within the code tag.


issue with auto_typography - El Forum - 04-13-2008

[eluser]Crimp[/eluser]
Move on to markdown. If you provide the exact phrases used, we may be able to spot the "bug". Basically, regex fails in certain cases. The trouble is then that you can't always control that those cases do not happen and using auto_typography() is therefore not a good idea. Markdown can easily be implemented as a helper.


issue with auto_typography - El Forum - 04-14-2008

[eluser]GSV Sleeper Service[/eluser]
well, I've fixed it. I'm not sure if this is a bug, but I fixed it by modifying system/helpers/typography_helper.php.

I changed line 100 from
Code:
var $skip_elements    = 'pre|ol|ul';
to
Code:
var $skip_elements    = 'pre|ol|ul|code';