HOW TO: Ignore specified HTML segments/sections in documents

For technical support for all editions of CSE HTML Validator. Includes bug reports.

HOW TO: Ignore specified HTML segments/sections in documents

Postby Albert Wiersch » Fri Dec 02, 2005 10:26 am

Here's a little "trick" that most people aren't aware of. If you have a certain part or section of an HTML or XHTML document that you want CSE HTML Validator to ignore, then you can enclose it in "cseignore" tags.

Example:
Code: Select all
<cseignore>bad HTML here</cseignore>
or
<!--cseignore-->bad HTML here<!--/cseignore-->


In v8.04 and above, for better compatibility with other syntax checkers and validators, <!--cseignore--> (case sensitive) can be used to simulate a <cseignore> start tag and <!--/cseignore--> (case sensitive) can be used to simulate a </cseignore> end tag. (New v8.04)

NOTE: This works only with CSE HTML Validator's own validator engine. HTML Tidy, nsgmls, JavaScript Lint, PHP, etc will not understand these special tags and comments.

If using JavaScript Lint for JavaScript checking, then you can use this to ignore part of a document:
Code: Select all
/*jsl:ignore*/
(code that fires warnings)
/*jsl:end*/


For more information (JavaScript Lint):
http://www.javascriptlint.com/docs/index.htm
Image
Albert Wiersch
User avatar
Albert Wiersch
Site Admin
Site Admin
 
Posts: 2361
Joined: Sat Dec 11, 2004 10:23 am
Location: Near Dallas, TX

Re: HOW TO: Ignore specified HTML segments/sections in documents

Postby RSteinwand » Fri Jan 15, 2010 2:35 pm

Hi Albert,

I still get a HTML Tidy warning with this:
<!--cseignore-->
<link type="text/css" media="all" href="/css/<%= InsertCSS() %>" rel="stylesheet" />
<!--/cseignore-->

... and get a Javascript SyntaxError with this:
<!--cseignore-->
<div id="nav"><script type="text/javascript"><%= InsertMenu() %></script></div>
<!--/cseignore-->

If you have code to comment out the non-CSE parts (like HTML Tidy or nsgmls), maybe you can add that to this thread as well?
Rick
User avatar
RSteinwand
Rank IV - Intermediate
Rank IV - Intermediate
 
Posts: 161
Joined: Mon Jun 09, 2008 2:12 pm
Location: Fargo, ND

Re: HOW TO: Ignore specified HTML segments/sections in documents

Postby Albert Wiersch » Fri Jan 15, 2010 10:39 pm

Thanks Rick, I've added this:
NOTE: This works only with CSE HTML Validator's own validator engine. HTML Tidy, nsgmls, JavaScript Lint, PHP, etc will not understand these special tags and comments.

I've also added information about ignoring part of a document with JavaScript Lint. I don't believe the other checkers support ignoring parts of a document.
Image
Albert Wiersch
User avatar
Albert Wiersch
Site Admin
Site Admin
 
Posts: 2361
Joined: Sat Dec 11, 2004 10:23 am
Location: Near Dallas, TX

Re: HOW TO: Ignore specified HTML segments/sections in documents

Postby roedygr » Wed Jan 20, 2010 7:27 am

There is a catch. cseignore will not let you get away with high bit characters.
User avatar
roedygr
Rank V - Professional
Rank V - Professional
 
Posts: 242
Joined: Fri Feb 17, 2006 6:22 am
Location: Victoria BC Canada

Re: HOW TO: Ignore specified HTML segments/sections in documents

Postby Albert Wiersch » Wed Jan 20, 2010 12:21 pm

roedygr wrote:There is a catch. cseignore will not let you get away with high bit characters.


True. I've added this to the documentation:
NOTE: Does not ignore "high ASCII characters" for the "high ASCII" character check, if enabled.
Image
Albert Wiersch
User avatar
Albert Wiersch
Site Admin
Site Admin
 
Posts: 2361
Joined: Sat Dec 11, 2004 10:23 am
Location: Near Dallas, TX


Return to CSE Tech Support

Who is online

Users browsing this forum: No registered users and 3 guests

cron