If you ever looked at the HTML code that Jade or OpenJade produce, you may have noticed that it looks pretty peculiar. While it is lean and mean HTML code and as such essentially beautiful, it uses a strange way to place the linebreaks - they are between the name of the end tag and the closing angle bracket. While this is valid SGML code (the standard explicitly allows whitespace at this position), at least two programs have problems with the dbslide HTML output: HTML tidy, a HTML cleanup tool, and Lynx, the tried-and-true textmode browser (MS Internet Explorer and Netscape don't have a problem here). You might argue that Lynx isn't suitable for dbslide anyway, as it doesn't run JavaScript code and is text-mode only. It is still nice to be compatible (better show your presentation in Lynx than not at all!), and HTML tidy simply increases the readability if you have to make hotfixes in the generated HTML code.
The culprit is actually the </script> end tag. While both programs don't have problems with the strange linebreaks in any other elements, they cannot find this end tag properly. The reason is that the enclosed code has to be parsed in a different way from the HTML code proper, and both programs obviously use different code to detect the </script> end tag as compared to all other end tags.
I actually came across this problem first in Lynx. Then I thought that this could easily be fixed by running the HTML files through tidy - but this was also broken. So I went ahead to fix this bug in tidy. This fix is necessary for the current version (August 2000) but may be incorporated into later versions.
Save the following patch to the file lexer.c.diff and apply it to the tidy source with the command patch < lexer.c.diff:
--- lexer.c.orig Fri Aug 4 16:21:05 2000 +++ lexer.c Thu Oct 26 16:23:44 2000 @@ -1381,13 +1381,21 @@ } else if (c == '\r') { + if (endtag) { + continue; /* discard whitespace in endtag */ + } + else { c = ReadChar(lexer->in); if (c != '\n') UngetChar(c, lexer->in); c = '\n'; + } } + else if ((c == '\n' || c == '\t' || c == ' ') && endtag) { + continue; /* discard whitespace in endtag */ + } AddCharToLexer(lexer, (uint)c); lexer->txtend = lexer->lexsize; |
Then rebuild tidy according to the build instructions.