BBEdit Format HTML
BBEdit Format HTML
Description
Format HTML was created for two basic purposes:
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.
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.
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. <<
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.
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.
-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.
E-mail:
Internet: [email protected] (preferred)
America Online & eWorld: Magendanz
Address:
Chad Magendanz
15220 263rd Ave. SE
Issaquah, WA USA
-3-