Tidy and HTML tab spacing

Warren Block wblock at wonkity.com
Thu Jan 19 01:13:49 UTC 2012


On Thu, 19 Jan 2012, Hiroki Sato wrote:

> Warren Block <wblock at wonkity.com> wrote
>  in <alpine.BSF.2.00.1201181520140.40712 at wonkity.com>:
>
> wb> HTML versions of FreeBSD documents are fed through tidy (www/tidy or
> wb> www/tidy-devel) for cleanup.  There's a bug in tidy[1] that can cause
> wb> tab stops to be wrong:
> wb> http://www.freebsd.org/doc/en_US.ISO8859-1/books/porters-handbook/makefile-distfiles.html#AEN1623
> wb>
> wb> Note how DISTNAME and EXTRACT_SUFX do not line up.  They are correct
> wb> in the source book.sgml.
> wb>
> wb> So what to do?
>
> I lean to fixing Tidy if possible.  The reason why we are using Tidy
> is to fix mark-ups in rendered results from various tools like Jade,
> not (only) for human-readability.  The results of Tidy are still not
> perfect from viewpoint of standard conformance, but it is better than
> nothing even if most of modern www browsers can handle the rendered
> HTMLs directly.

Agreed.

> wb> 4. Add newlines to the HTML in the build process before it gets to
> wb>    tidy:
> wb>      s/CLASS="PROGRAMLISTING"\n>/CLASS="PROGRAMLISTING">\n/
>
> I think this will break the results because a newline just after ">"
> is recognized as CDATA.

A test run on the Porter's Handbook did seem to work:
   make -C /usr/ports/www/tidy-devel deinstall
   make clean book.html
   perl -0777 -i -pe 's/CLASS="PROGRAMLISTING"\n\>/CLASS="PROGRAMLISTING"\>\n/g' book.html
   make -C /usr/ports/www/tidy-devel install clean
   tidy -wrap 90 -m -raw -preserve -f /dev/null -asxml  book.html



More information about the freebsd-doc mailing list