phase5inc
When I started building web pages in 1999 I used Ulli Meybohms HTML Editor. It was renamed to phase 5 later and development was continued by hdb. Development still goes on and the editor is available as freeware for individuals on http://www.phase5.info/. One thing I really liked on this editor was its capability for so called »includes«. You put some text in an include file in the include folder, e.g. in foo.inc:
<a href="index.htm">Home</a> :: <a href="contact.htm">Contact</a>
phase 5 lets you include this in your HTML documents and it appears there as follows:
<!--INC:"foo.inc","12.11.2006 20:52:46"--> <a href="index.htm">Home</a> :: <a href="contact.htm">Contact</a> <!--/INC:"foo.inc"-->
This is quite useful for stuff which appears on multiple pages of your project. You can select »Update includes« from the editor menu and the editor steps through every single HTML file of your project, searches for include blocks and updates them with the file content if necessary.
When changing the editor or even the operating system, you lose this functionality and maintaining your old project gets ugly. The goal of phase5inc is to write a platform independent Perl script which does the whole include updating stuff described above.
Ideas
How should a typical run look?
- Call script.
- Script searches for HTML files with includes (the described blocks between the special formatted HTML comments).
- possibly recursive searching for HTML files with File::Find, see Perl Cookbook section 9.7
- Script steps through all found include blocks (in all files).
- Search for the include file found in the header of the block (comment, see above). This file should be in a special folder together with all other include files.
- Check include file modification date with date saved in include block header.
- Replace content if necessary.
- Update include block header.
What information is necessary a priori?
- Where to search for HTML files?
- Folder the script was started from?
- Folder handed over with command line parameters?
- Folder configured in some special project config file in the current folder?
- Where to search for include files?
- Special named folder below the current folder?
- Command line argument?
- Project settings file?
And what should be the defaults for all the above?
Additional ideas
- dry run
- functionality going beyond the stuff phase5 does, especially using capabilities of subversion
- line endings??
What to implement first
- straight forward »hack« with defaults to make it work
- refactoring ;-)
Remember
You (should) have read PBP and Perl Cookbook… ;-)
