• Resolved jimappleg8

    (@jimappleg8)


    Nice job on this plugin. I’m happy to be using it.

    The Prettify documentation indicates that you should be able to have some HTML interpreted as HTML if you include the ‘nocode’ class. For example, if you have

    <span class="redbold">server_name</span>

    inside your pre tags, you will see the HTML just as it is written , but if you use

    <span class="nocode redbold">server_name</span>

    you should see just ‘server_name’ formatted according to the redbold class.

    That is not working with your plugin, and I tracked it down to the WPCP_ParseCode() method. You are converting some special characters into entities starting on line 57:

    $html_entities_match = array( "|\<br \/\>|", "#\<#", "#\>#", "|/|", '#\[#', '#\]#', '#"#', "#'#" );
    $html_entities_replace = array( "\n", '<', '>', '/', '[', ']', """, ''');
    
    $plaincode = preg_replace( $html_entities_match, $html_entities_replace, $plaincode );

    If I comment out those lines, nocode works as expected. I assume you had a good reason to put these lines of code in, however, so I don’t think I can recommend that you remove them for everyone. I’m not seeing any adverse affects, but I’m using the ‘pre’ tag exclusively, and I suspect the ‘code’ tag might need the extra processing.

    If you can tell me what the lines are intended to fix, maybe I can come up with a way to do it that doesn’t break nocode.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Soli

    (@allnull)

    If you comment out those lines,

    <span class=”redbold”>server_name</span>

    will show as

    server_name

    , and that is not we expected.

    I think this could be a bug of Google Code Prettify.

    Thread Starter jimappleg8

    (@jimappleg8)

    I did a little research on this and it looks my original assumption was wrong. I seems that if you have a line of HTML in your ‘pre’ tag, Google Code Prettify is not expected to display the HTML any more than the actual ‘pre’ tags does. Neither the ‘pre’ or ‘code’ tag displays HTML code unless you escape it first, and that is how Code Prettify works as well.

    So, your example above actually is expected behavior for Google Code Prettify and is not a bug.

    Your plugin automatically escapes HTML so it will display, and that is fine, but I don’t think that is what I need. I just want Google Code Prettify implemented in WordPress without any additional features. I suppose you could consider allowing users to turn escaping off and on in the settings if you want to allow for Code Prettify’s default behavior.

    Thank you for building this plugin and contributing to the community. I think you can consider this issue resolved.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘nocode style is not being recognized’ is closed to new replies.