[MKDoc-modules] Escaping backslashes

William McKee william at knowmad.com
Mon Oct 27 16:46:13 GMT 2003


Jean-Michel,

Did you see my post to the Petal list last week that explained the root
cause of the splitpath errors I was receiving? The problem was that the
template being used contained \ characters within html comments (there
was a DOS filename in the comments). This made the regex being used in
MKDoc think that the following characters were escape sequences.

As the template was being parsed, Perl tried to interpret these with the
regex. When not using the Safe environment, this results in warnings
being written and may make subtle changes to the document (see example).
In the Safe environment, it caused my code to hang in CGI::Carp.

Backslashes, whether in html comments or the body of the document, do
not appear to be properly escaped. I don't have a fix, but have included
a sample that demonstrates this behavior. At least, it'd be useful to
document this as a known bug so as to save some time for the next user
who stumbles into it. As far as I can tell, it is not illegal to have
backslashes in html; indeed, the attached template is valid XHTML
according to the W3C validator.

Thanks,
William

-- 
Knowmad Services Inc.
http://www.knowmad.com
-------------- next part --------------
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<title>TEST</title>
	</head>
	<body>
		<h1>Petal Test \\ The birds &amp; the bees</h1>
		<p>\See the bee</p>
		<p>Oops, \see \the \bee</p>
		<!-- c:\This\Causes\Mkdoc\To\Emit\Warnings -->
	</body>
</html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: petaltest.pl
Type: application/x-perl
Size: 918 bytes
Desc: not available
Url : http://lists.webarch.co.uk/pipermail/mkdoc-modules/attachments/20031027/2cb2888a/petaltest.bin


More information about the MKDoc-modules mailing list