ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Automatic XHTML formatting breaks after a SyntaxHighlighter block

September 15, 2012 1:33pm

Subscribe [2]
  • #1 / Sep 15, 2012 1:33pm

    Ataul Munim

    17 posts

    Hi guys,

    I used to use the “none” formatting option, and always used to markup my entire post until I found I’d rarely update due to tediousness. I’m trying the “XHTML” option (there’s no “Auto XHTML” option as the guide shows, but perhaps my EE is out of date) which automatically seems to add the paragraph tags to blocks of text followed by a double line break (or preceded by).

    It doesn’t add the tags after I include a script tag to use Syntax Highlighter (so my entry is mixed with untagged blocks of text which I’d like EE to mark up, and some elements I add manually like the script block, “h2"s and some links).

    Issue can be viewed at: www.ataulmunim.co.uk. Note how the text below the code sample has no line breaks (easier to see that the p tags are missing from source), but the ones before do.

    edit: It’s definitely something to do with the CDATA block - if I take the CDATA block out, but leave the script tags - it’ll parse the rest of the entry correctly and add the tags.

    This is what I have in my post text area:

    This is some placeholder text representing the text before the code sample. It includes several "paragraphs" separated by double line breaks and these have  tags enclosing them (automatically added by EE).
    
    Below is my code sample:
    
    <script type="syntaxhighlighter" class="brush: python"><![CDATA[
    # my python code
    ]]></script>
    
    Here is some more paragraphed text, also separated by double line breaks.
    
    However, EE no longer adds the  tags automatically.


    Currently using:
    Freelancer v2.5.2 - Build Date: 20120606

    Is there a workaround I can use to continue using Syntax Highlighter?
    Thanks 😊

  • #2 / Sep 16, 2012 4:48pm

    Simon Cox

    405 posts

    Two things. You can’t have a class atribute in a script tag in html4.1 (html 5 is ok). Colons on a css class name is going to run you into some trouble. Either of these may be causing the issue - you might like to try and escape that colon or use the hex code : -
    class=“brush/3A python”

    See if that works.

  • #3 / Sep 16, 2012 5:03pm

    Ataul Munim

    17 posts

    Hi Simon, thanks for the response.

    I’ve got a doctype of “html” - my understanding is that browsers should render the page as HTML5. Do you mean that as the formatter is trying to add XHTML tags, it could be breaking because of the class attribute?

    I tried using the hex code as in your example, which rendered as /3A in the source, and used & #58; (without space) too but that rendered as “& #58;” without the space too.

    I wouldn’t have thought either of these was the case as I tried saving a revision with only the script tags (without the CDATA block) and it added the p tags correctly :(

  • #4 / Sep 18, 2012 4:25am

    Ataul Munim

    17 posts

    I’ll enter this as a bug then; can’t imagine what else I could be doing wrong and it’s not the behaviour I expected from it.

  • #5 / Sep 18, 2012 1:25pm

    Kevin Smith

    4784 posts

    Hi ataulm,

    I see you’re working over this bug with Kevin Cupp in the bug report’s comments. Looks like he’s got you covered. Anything else I can help with?

  • #6 / Sep 18, 2012 1:33pm

    Ataul Munim

    17 posts

    Hi Kevin, thanks - I’ll continue this issue on the bug page.

  • #7 / Sep 19, 2012 5:42pm

    Kevin Smith

    4784 posts

    Sure thing, Ataul. Let us know if we can help again in the future!

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases