Re: HTML pretty-printing

Subject: Re: HTML pretty-printing
From: Robin Stephenson <robin.stephenson@xxxxxxxxxxxxxxx>
Date: 16 Jul 1998 10:52:02 +0100
>>>>> On 16 Jul 1998 13:24:20 +1000
>>>>> "Chris" == Christopher Grinton <cgg@xxxxxxxxxx> wrote:

Chris> Brandon,
>> [...] recommendations for a tool to pretty-up the output from
>> Jade's SGML Transformation backend, specifically HTML (ie, nice
>> indenting of structured tags, such as table stuff)? Minimally,
>> something to put the tags back together in more traditional form.

Chris> sgmlnorm should satisfy your minimal requirement. I don't think
Chris> it can nice indenting and such stuff.

XEmacs' SGML mode supports indentation, and used together with
sgmlnorm one can get a nice result.  Load the file into XEmacs and do
the following:

    M-x sgml-mode
    M-x mark-whole-buffer
    C-u M-x shell-command-on-region
    sgmlnorm
    (you may need to replace the doctype line here, and tidy up any
     extraneous output from sgmlnorm)
    M-x sgml-parse-prolog
    M-x mark-whole-buffer
    M-x indent-region

I had to tweak the customisation settings to get XEmacs to use my
catalog files -- start with the commands below:

    M-x customize
    sgml
    (middle-click psgml button, adjust settings, set & save)
    (middle-click psgml DTD button, adjust settings, set & save)

It should be possible to make a command-line tool to do this: XEmacs
can run a Lisp function in batch mode from the shell.   I assume that
what I've outlined above is pretty much identical in GNU Emacs, but
for reference I'm using XEmacs 20.4 "Emerald".

Here's an example (the first few lines of
<http://www.mulberrytech.com/dsssl/dsssldoc/procedures/index.html>,
which include the beginning of an HTML table):
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML
><HEAD
><TITLE
>DSSSL Documentation Project Procedures Library</TITLE
><META
NAME="creator"
CONTENT="DSSSL DocBook to HTML Style Sheet"><META
NAME="form"
CONTENT="html"></HEAD
><BODY
BGCOLOR="#FFFFFF"
TEXT="#000000"
><TABLE
WIDTH="515"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="3"
ALIGN="center"
>TITLE BANNER</TH
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="bottom"
>&nbsp;</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="bottom"
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="f01.html"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="515"><DIV
CLASS="BOOKINFO"
><H1
>DSSSL Documentation Project Procedures Library</H1
><P
>This software is copyrighted by its respective authors.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
  <HEAD>
    <TITLE>DSSSL Documentation Project Procedures Library</TITLE>
    <META NAME="CREATOR" CONTENT="DSSSL DocBook to HTML Style Sheet">
    <META NAME="FORM" CONTENT="html">
  </HEAD>
  <BODY BGCOLOR="#FFFFFF" TEXT="#000000"><TABLE WIDTH="515" BORDER="0" CELLSPACING="0" CELLPADDING="0">
      <TR>
        <TH COLSPAN="3" ALIGN="CENTER">TITLE BANNER</TH>
      </TR>
      <TR>
        <TD ALIGN="LEFT" VALIGN="BOTTOM" WIDTH="33%">?</TD>
        <TD ALIGN="CENTER" VALIGN="BOTTOM" WIDTH="34%"></TD>
        <TD ALIGN="RIGHT" VALIGN="BOTTOM" WIDTH="33%"><A HREF="f01.html">Next</A></TD>
      </TR>
    </TABLE><HR ALIGN="LEFT" WIDTH="515"><DIV CLASS="BOOKINFO"><H1>DSSSL Documentation Project Procedures Library</H1><P>This software is copyrighted by its respective authors.
-- 
 Robin Stephenson
 Screw Cap On Tightly
Current Thread
  • HTML pretty-printing
    • Brandon Ibach - from mail1.ability.netby web4-1.ability.net (8.8.5/8.6.12) with ESMTP id WAA10423Wed, 15 Jul 1998 22:19:15 -0400 (EDT)
      • Christopher Grinton - from mail1.ability.netby web4-1.ability.net (8.8.5/8.6.12) with ESMTP id XAA11736Wed, 15 Jul 1998 23:25:50 -0400 (EDT)
        • Robin Stephenson - from mail1.ability.netby web4-1.ability.net (8.8.5/8.6.12) with ESMTP id FAA23008Thu, 16 Jul 1998 05:53:46 -0400 (EDT) <=
      • Dave Raggett - from mail1.ability.netby web4-1.ability.net (8.8.5/8.6.12) with ESMTP id IAA25786Thu, 16 Jul 1998 08:41:34 -0400 (EDT)
        • Brandon Ibach - from mail1.ability.netby web4-1.ability.net (8.8.5/8.6.12) with ESMTP id MAA11883Thu, 16 Jul 1998 12:51:07 -0400 (EDT)