HTML Tidy, Don't move those comments!

♀尐吖头ヾ 提交于 2019-12-08 08:43:13

问题


I was working with html-tidy and a couple of my comments were moved from the head to the root of the document. Is there anyway to avoid this behavior?

(I'm trying to turn some really really bad markup into xhtml complaint code) Oh and additionally it uses an in-house developed semi-server-side scripting language that uses comments to place data within the html, very, very non-standard... I'd love to completely change it over...but you know how employers are...

Here is the problem:

Before Tidy:

    <head>
    ...
        <!-- BODY_ON_LOAD_SECTION -->
           <script type="text/javascript" language="Javascript">
                function init() {
                openWin('BODY_ON_LOAD_SECTION_REFERENCE','','resizable=yes,width=400,height=400,left=50,top=50');
            }
           </script>
        <!-- END_BODY_ON_LOAD_SECTION -->
    </head>

After Tidy:

        <script type="text/javascript" language="Javascript"> 
        function init() {   
            openWin('BODY_ON_LOAD_SECTION_REFERENCE','','resizable=yes,width=400,height=400,left=50,top=50'); 
} 
    </script> 
</head><!-- BODY_ON_LOAD_SECTION --> <!-- END_BODY_ON_LOAD_SECTION --> 

回答1:


They're comment. Do you really need them in the tidy version?

The only two options I see in tidy that relate to comments are hiding them and fixing bad comments so you may be out of luck.



来源:https://stackoverflow.com/questions/537112/html-tidy-dont-move-those-comments

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!