0% found this document useful (0 votes)
64 views3 pages

BBEdit Format HTML

Uploaded by

Connector
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
64 views3 pages

BBEdit Format HTML

Uploaded by

Connector
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

A BBEdit Extension for quickly formatting HTML

Copyright ©1996, by Chad Magendanz. All rights reserved.

Version 1.0 - 10 Feb 96

Description
Format HTML was created for two basic purposes:

1. To display Web pages generated with PageMill in readable form:

I'm a big fan of PageMill. It provides a means of generating very simple Web pages with almost instant gratification. However,
it's rare that I'm completely satisfied with the results of my Web page after its initial conception in PageMill. I usually wish to
add some more complex structures (like tables) and find myself back in BBEdit flirting with HTML tags in their native form.
Unfortunately, this is often easier said than done. PageMill doesn't lay out the HTML in any particular format, frequently
squishing them all together in a mass of tags that are difficult for humans to interpret.

Format HTML was designed to quickly fix this problem, breaking down HTML tags into individual lines and indenting them in a
programmatic style that is easier to read and understand. The utility makes a great addition to Lindsay Davies' HTML Tools,
complementing the PageMill Cleaner utility. When importing HTML from PageMill to BBEdit, I first use PageMill Cleaner, then
Format HTML to set things right.

2. To assist Web authors in debugging their HTML:

The Check HTML command in HTML Tools is a probably the most useful element of BBEdit's Web authoring environment. Like the
best compilers, BBEdit displays which tags are likely to be problems and suggests a reasonable cause. Frequently, the solution
is obvious, but for those cases where it's not, Format HTML can be a valuable tool. Just running your HTML through Format
HTML will tell you whether you have balanced all of your HTML tags and quickly indicate when a tag block has not been closed
properly.

Installation

Install Format HTML by decompressing the StuffIt™ archive and dragging the BBEdit Extension to your BBEdit Extension folder.
If you have Lindsay Davies' HTML Tools installed, you will probably want to place Format HTML in the Misc folder with PageMill
Cleaner. In either case, the new Format HTML command should be available from the Extensions menu the next time you launch
BBEdit.

System Requirements

Format HTML requires BBEdit version 3.5 or later. BBEdit Lite will *not* suffice. For more information on BBEdit, check out
the BBEdit Web site at www.barebones.com.

What it Actually Does


Format HTML conducts several operations on your HTML source in one command. Specifically,

1. All extraneous tabs, spaces and returns are removed.

2. Each HTML tag is placed on its own line.

3. HTML commands are parsed for basic structure (not syntax).

4. Tabs are added to each line to indent appropriately for its level of nesting.

-1-
Using Format HTML
To format any HTML file in BBEdit, just select the Format HTML command from the Extensions menu. To undo the changes, just
select Undo Extension from the Edit menu.

>> Note: It is good practice whenever first using the first release of a new utility to keep a backup of whatever source you
feed it. Format HTML is no exception. <<

Changing Tab Indents:

The default tab stop is 4 characters. You can change this setting to suit your taste using the Fonts & Tabs command from the
Text menu. Changes will be reflected immediately in your file. The use of tabs also allows you to adjust block indentation using
the Shift Left and Shift Right commands.

Customization:

Format HTML can be customized to some extent by editing several resources with ResEdit. This should normally not be required
and is not for the faint of heart. However, HTML tags appear and disappear fairly quickly these days and I've provided a basic
mechanism to keep Format HTML updated as new tags fall in and out of favor.

Here is a quick description of the resources involved:

Target Strings (STR#128), Substitute Strings (STR#129) - These two resources indicate which substitutes are immediately
made on your file. They are preset to remove extraneous tabs, spaces and returns. If you decide to edit these, keep in mind
that you must do so using the Hex Editor, since the non-visible ASCII codes like HT and CR are difficult to enter in the STR#
template editor.

>> Note: Format HTML actually replaces *all* occurrences of the Target String for its respective Substitute String. Beware
of substituting a string that contains the target string, as this will cause your machine to hang. <<

Open Tags (STR#130) - This presently only consists of a one character string tag "<", indicating a tag that is opening a block
and should cause all following lines to be indented in one tab stop. Theoretically, you could itemize *each* tag that you wish to
have this behavior, but this would be a long list.

Close Tags (STR#131) - This presently only consists of a two character string tag "</", indicating a tag that is closing a block
and should cause it and all following lines to moved out one tab stop. As with the Open Tag, you could itemize each tag that you
wish to have this behavior.

Exceptions Tags (STR#132) - This resource lists all tags that have no corresponding close tag. The list I've supplied is current
to the best of my knowledge, but it has not been adjusted for new extensions currently being added by Netscape and Microsoft.
If you find a new tag that stands alone with no closing form, add it here.

>> Note: HTML lines are parsed in the following order: Exception Tags, Close Tags and finally Open Tags. When a tag is
identified, the parser looks no further. Parsing is also not case sensitive. <<

Known Problems
1. Since each HTML command is currently placed on its own line, most browsers show an extra space underlined at the end of
Anchor and Underline tag blocks. This must currently be corrected by hand.

2. The HTML+ version of the Paragraph tag is *not* an Exception Tag and has both opening and closing forms. If you
consistently use the Paragraph tag in this form, you should remove it from the Exception Tags list using the customization
instructions above.

Format HTML is Freeware


Freeware is copyrighted software freely distributed via the Internet, local bulletin board systems (BBS), commercial on-line
services, user groups, and between friends. There is no charge for individual or commercial use of Format HTML.

-2-
Keep in mind that Format HTML is copyrighted and that no one has the right to sell or alter it in any way without my written
consent. I also will not be liable for any damages, including lost of data, lost profits, cost of cover or other special, incidental,
consequential or indirect damages arising from the use of this program.

Contacting the Author


I am not planning to actively support Format HTML, since it was just a quick hack. (Yes, Peter! Slightly longer than 4 hours.)
However, if you would like to obtain the latest version of ShrinkWrap™, suggest new features, or complain about a bug, just
contact me at:

E-mail:
Internet: [email protected] (preferred)
America Online & eWorld: Magendanz

World Wide Web:


http://www.halcyon.com/shrinkwrap/

Address:
Chad Magendanz
15220 263rd Ave. SE
Issaquah, WA USA

-3-

You might also like