The Haiku/BeOS Tip Server
Tips and tricks for Haiku/BeOS users

Pe: Integrate HTML Tidy

Contributed by: Watts Martin
This tip is valid for: Both BeOS and Haiku

If you use HTML Tidy to clean up your HTML, and Pe for your HTML editing needs, you can integrate the two by addinng an HTML Tidy entry to Pe’s Extensions menu, so you can call it as if it were part of the editor. To do this, you only need to create a simple two-line shell script and save it to Pe’s “Extensions” folder.

In Pe (or another editor), type the following shell script:


tidy 

If you normally run tidy with command line options, you can put them after the program’s name (for instance, tidy -wrap 75).

Save your new script in Pe’s extension folder (by default, this is /boot/apps/Hekkelman/Extensions). Give it the name Tidy HTML. (You can name it anything you want, but due to a quirk in Pe’s programming, shell script extensions can’t start with the word “HTML”.)

To make the script appear in the Extensions menu, you must make it executable. Open a Terminal and type:

chmod a+x '/boot/apps/edit/Hekkelman/Extensions/Tidy HTML'

(you may have to tweak that path if Pe is installed in a different location).

To use the program, select everything in your document (Cmd/Alt-A) and then select “Tidy HTML” from Pe’s extensions menu. The cleaned-up version of the document will replace your text, and any errors Pe finds will be shown to you in a separate window.

Note that any shell script or program that reads and writes to standard input and output can be added to Pe’s Extensions menu in this way.

Posted in Applications


(comments are closed).