Less than in sourcecode confuses tags
-
If you have a [sourcecode language='c++'] section which includes a single LESS THAN symbol (e.g. in a for loop) and then you have a blockquote section after the [/sourcecode] WordPress keeps eating the /blockquote close tag. pre, code and i all seemed to be unaffected and any subsequent blockquotes. The outline of my post was this: (‘{‘ and ‘}’ indicating “some quantity of”)
8x — snip — x8
{ preamble }
[sourcecode language='c++']// A comment
// Some code
for ( i = 0 ; i < 10 ; ++i )
{
// some stuff
}
[/sourcecode]Under Windows:
{ some output lines }<b>
</b>
Under Linux/Mac:
`{ some other output }8x — snip — x8
The first /blockquote, emphasized in bold (assuming I have any clue at how this is going to get formatted) would get eaten every time I saved no matter what I did until I replaced the
<with != which is certainly <i>a</i> solution but is a bad coding practice I don’t wish to encourage. -
Ok – that’s amazing. I carefully replaced the angled-brackets around the tags with XML entities, and the only tags that didn’t wind up marked up in the comment are the bold tags I wanted it to treat as markup… Bleah.
OK, it should read:
Under Windows:
[blockquote][pre]{
some output lines
}[/pre]<b>[/blockquote]</b>Under Linux:
[blockquote][pre]{
some other output
}[/pre][/blockquote] -
It turns out you can reproduce the problem with a much simpler example:
[sourcecode language='c++']
// comment with < symbol
[/sourcecode]<em>The following tag will now get stripped if this example is posted into a wordpress blog:</em>
- The topic ‘Less than in sourcecode confuses tags’ is closed to new replies.