W3C home > Mailing lists > Public > html-tidy@w3.org > April to June 2013

How to stop Tidy converting my < and > tags to &lt; and &gt; ??

From: Daevid Vincent <daevid@daevid.com>
Date: Wed, 1 May 2013 17:37:45 -0700
To: <html-tidy@w3.org>
Message-ID: <13ea01ce46cd$43d22a90$cb767fb0$@daevid.com>
So I took the time to install Tidy extension and wedge it into my code. Now
there is one thing that is killing me and breaking all my pages.
 
This is what I WANT the result to be (note the dynamic part that PHP is
going to fill in from this tempate):
 
                <link rel="stylesheet" type="text/css" href="/templates/<?=
$layout_id ?>/css/styles.css" />
                <link rel="stylesheet" type="text/css" href="/templates/<?=
$layout_id ?>/css/retina.css" />
 
Which then 'renders' out to this normally WITHOUT Tidy (as viewed from the
browser's source):
 
                <link rel="stylesheet" type="text/css"
href="/templates/2/css/styles.css" />
                <link rel="stylesheet" type="text/css"
href="/templates/2/css/retina.css" />    
                
This is what Tidy does:
 
                <link rel="stylesheet" type="text/css"
href="/templates/%3C?=%20$layout_id%20?%3E/css/styles.css">
                <link rel="stylesheet" type="text/css"
href="/templates/%3C?=%20$layout_id%20?%3E/css/retina.css">
                
I found ['fix-uri' => false] which gets closer:
 
                <link rel="stylesheet" type="text/css"
href="/templates/&lt;?= $layout_id ?&gt;/css/styles.css">
                <link rel="stylesheet" type="text/css"
href="/templates/&lt;?= $layout_id ?&gt;/css/retina.css">
 
I've tried about every option I can think of. What is the solution to make
it stop trying to be smarter than me and converting my < and > tags to &lt;
and &gt; ??

//See all parameters available here:
http://tidy.sourceforge.net/docs/quickref.html
$tconfig = array(
       //'clean' => true,
       'hide-comments' => true,
       'hide-endtags' => true,
       'drop-proprietary-attributes' => true,
       //'join-classes' => true,
       //'join-styles' => true,
       //'quote-marks' => true,
       'fix-uri' => false,
       'numeric-entities' => true,
       'preserve-entities' => true,
       'doctype' => 'omit',
       'tab-size' => 1,
       'wrap' => 0,
       'wrap-php' => false,
       'char-encoding' => 'raw',
       'input-encoding' => 'raw',
       'output-encoding' => 'raw',
       'ascii-chars' => false,
       'newline' => 'LF',
       'tidy-mark' => false,
       'quiet' => true,
       'show-errors' => ($this->_debug ? 6 : 0),
       'show-warnings' => $this->_debug,
);
 
Received on Thursday, 2 May 2013 04:19:41 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 21:38:59 UTC