Support » Plugin: Preserved HTML Editor Markup » [Plugin: Preserved HTML Editor Markup] HTML comments spanning multiple tags are not preserved

  • Resolved cwlee_klagroup

    (@cwlee_klagroup)


    Original code loaded into HTML editor
    
    <!--  preserved-html-editor-markup TEST 1 -->
    
    <!-- test of code commented out across multiple tags -->
    
    <!--   <h2 style="margin-top:0px; padding-top:5px;">Welcome CPSL Sales Team</h2>
    <p>It’s never been more difficult to reach sales prospects, but  in this training program you’ll learn new strategies to combine cold calling, email, and social media prospecting to gain access to your top prospects.</p>
    <p>You’ll discover how to:</p>
    <ul>
      <li>Craft  attention-getting messages</li>
      <li>Initiate  memorable conversations</li>
      <li>Close  first appointments</li>
      <li>Handle  stubborn gatekeepers and objections</li>
    </ul> -->  // <== ENDING COMMENT TAG STARTED OUT AS '-->'
    
    <!-- End preserved-html-editor-markup TEST 1 -->
    
    Code returned by TinyMCE Visual Editor with preserved-html-editor-markup plug-in activated  
    
    <!--  preserved-html-editor-markup TEST 1 -->
    
    <!-- test of code commented out across multiple tags -->
    
    <!--   <h2 style="margin-top:0px; padding-top:5px;">Welcome CPSL Sales Team</h2>
    <p>It’s never been more difficult to reach sales prospects, but in this training program you’ll learn new strategies to combine cold calling, email, and social media prospecting to gain access to your top prospects.</p>
    <p>You’ll discover how to:</p>
    <ul>
    <li>Craft attention-getting messages</li>
    <li>Initiate memorable conversations</li>
    <li>Close first appointments</li>
    <li>Handle stubborn gatekeepers and objections</li>
    </ul>--> // <== ENDING COMMENT TAG CONVERTED TO --& g t ; (Ignore spaces between & g t ;)
    
    <!-- End preserved-html-editor-markup TEST 1 -->

    http://wordpress.org/extend/plugins/preserved-html-editor-markup/

Viewing 15 replies - 1 through 15 (of 34 total)
  • Plugin Author MarcusPope

    (@marcuspope)

    Hi cwlee – thanks for submitting the support request. Unfortunately there isn’t much I can do about this paricular problem because my plugin relies on injecting special html comments to preserve the whitepsace and markup. Multi-line html comments end up with nested children comments that represent where newlines should be re-injected in html mode, and nested html comments are not supported by web browsers. Unfortunately this was my only option for preserving meta info between the two tabs.

    I’ll add this to the FAQ as a warning for other users. If you happen to think of a way around this I’d be glad to implement a fix.

    Thanks,
    Marcus

    Hi Marcus, Thank you. I have found a resolution for Preserving commented HTML code.

    <code><!-- </p>
    <p>commented HTML code</p>
    <p>--> <\code>
    
    This prevents the trailing > from being returned as '& g t ;'
    Plugin Author MarcusPope

    (@marcuspope)

    And even with a personal policy of “never saying something can’t be done in software” it seems I get to eat my own words still :D. I’ll look into what is happening at the tinymce layer with the above markup and implement a solution at the plugin layer that simulates the above. I don’t think it will make it into the next release but I will try.

    Plugin Author MarcusPope

    (@marcuspope)

    Ok cwlee, I have a fix for this problem almost complete. But quick question, how do you get around wordpress texturize converting the closing html comment --> into this &8211;>? I’d hate to disable wp_texturize from my plugin because it’s not really germane to its purpose. But from what I can tell it’s pretty much required, and wordpress core seems to close bugs on the subject as wontfix. Let me know if you have an alternate solution – I’m so close to being able to publish this plugin tomorrow.

    `<?php
    //disable auto p
    remove_filter (‘the_content’, ‘wpautop’);

    //disable wptexturize
    remove_filter(‘the_content’, ‘wptexturize’);
    ?>

    I put the hooks above in my theme’s functions.php. Then I put the code /code tags before and after all commented code

    Re-reading your note I believe the leading code tag and trailing /code tag are all that’s required. I’m pretty sure wp_texturize leaves everything between these code tags unchanged except “php” tags which it never leaves alone! I’ll pay a king’s ransom to the bugger who solves that one!

    So give this a try and see what results you get.`<code><!– </p>
    <p>commented HTML code</p>
    <p>–> <\code>

    This prevents the trailing > from being returned as ‘& g t ;’`

    Plugin Author MarcusPope

    (@marcuspope)

    Yeah I discovered the code tag was the only tag necessary yesterday and that part works great. But since a code block with only an html comment in it will still render on screen depending on styling I actually only temporarily use a code tag while switching between the editor visual/html tabs. And I hard-code a display:none in it as well. Then on save I strip out the code tag and just leave the html comment which is where the wp_texturize problem steps in. After sleeping on it I have a solution to the wp_texturize problem that doesn’t require disabling it entirely… though it’s crazy that it will turn any instance of ‘–‘ into &8211; and the wp core devs don’t see this as a problem… sheesh.

    I’ll keep the php code block concept in mind for my next plugin project. Considering what I’ve managed to do with root relative urls and this plugin I just might be able to collect that king’s ransom from you 😀 I’m glad to hear the other problem you were having was finally resolved. Sometime around lunch I should have the new version of this tool posted.

    Plugin Author MarcusPope

    (@marcuspope)

    Whew! Finally done, after every issue I fixed another would rear its head from the WP Core code! But alas, I was able to fix them all, including multi-line html comments. Just type them in the HTML editor as you would in any other editor, hack free and my plugin will ensure they are not trumped by wptexturize or wpautop.

    Some other good features were added too so check out version 1.2. (I just committed the code and it can take up to 20 minutes for the plugin download to be repackaged by WordPress.)

    RE: Just type them in the HTML editor as you would in any other editor, hack free and my plugin will ensure they are not trumped by wptexturize or wpautop.

    I have assumed I dont need to click on extra buttons or write some extra wrapping code like say [marcus tag] write anything here [/marcus tag]

    So:
    I was really happy that multiline HTML commenting was supposed to work
    Except it doesnt
    I only use html editor I never use visual thing
    Obviously I have activated the plug in etc I just downloaded it so assume its the latest version you speak of…

    Trying some more…

    I Explorer = worked like you say
    Firefox = I put the code tags around the comment tags so now work ok
    (like cwlee_klagroup suggestion)

    So hopefully “code” workaround is good for any other non complying browser

    Should say thanks too =
    its great that multiline spacing and & n b s p ;  and <center> tags and much else now works, presumably thanks to you
    (downloaded a bunch of plugins in frustration… would like to be able to code as if in blank notepad type editor!)

    Plugin Author MarcusPope

    (@marcuspope)

    @peterdub – Weird. I’m using FireFox version 14.0.1 on Windows 7 and it is working just fine for me. All of your assumptions were correct, and it should just work for you. I tried without accessing the visual tab, and that too worked as designed.

    I am the developer of the plugin, and I appreciate both the thanks, and the time on your part for letting me know about the problem you’re having. I’d definitely like to figure out the problem you’re having, so would you mind letting me know the browser version and OS you’re using? Also if you could try disabling other plugins one by one until you have just mine enabled to see if that fixes the problem that would be awesome. Even if it’s a compatibility issue with another plugin I can either fix it on my end, or send a patch to the other developer if it’s an issue on their end.

    I almost didn’t catch this because I had closed this support ticket. If you don’t mind opening a new one to keep track of the issue I’d really appreciate it. I can’t re-open this one otherwise I’d save you the hastle 😀

    Thanks,
    Marcus

    Many Thanks Marcus

    Windows 7 Ultimate
    Firefox version 7.0
    (sounds old but seemingly from sep 2011.. er, maybe thats old!)

    If its not the old Firefox maybe some interaction like you say…

    btw click to donate goes to marcuspope.com that seems in redevelopment

    btw am using public computers this summer for a bit…
    so its not a big deal if it’s the firefox, which I cant really upgrade,
    can still use other browsers for now
    maybe you can try in firefox 7, if thats possible, just to confirm thats the issue

Viewing 15 replies - 1 through 15 (of 34 total)
  • The topic ‘[Plugin: Preserved HTML Editor Markup] HTML comments spanning multiple tags are not preserved’ is closed to new replies.