Frequently Asked Questions
These are some questions (and answers) you may have.
Why Python 3?
I coded it in Python 3, because I use Python 3 in all my new Python projects.
But why Python? Why not awk, Perl or C?
It is possible to write htmlppc in awk, and it is easy to write htmlppc in Perl. Both scripting languages are more performant too. But Python is easy to read and understand, even for a beginner. Try it yourself! Just open htmlppc in your favorite editor! Read it! If you are new to Python, you may need to read some documentation, especially for the module re, but if you already know to hack in a scripting language, regular expressions are not that new concept to you. Compare it with an awk or Perl script doing something similar to reading a configuration file and processing other files while recursively walking through subdirectories, as htmlppc does. With an error handling which prevents a loss of data, so easy to do with an exception concept as in Python. It is possible, of course.
Htmlppc is a very simple tool. Someone out there may feel the urge to implement a feature I did not think about. If you are this person, I want to make your hack as easy as possible. Ever tried to understand a Perl script written by someone else? I had to do this often. Perl is a great programming language, very easy to write, but hard to read. Ever deciphered an awk script which does some nontrival task and makes some processing as a "side effect" of reading the next line? It can be a headache. For htmlppc, Python fits well in my opinion.
And of course it is possible to write htmlppc in C. I love C. But 300 lines of Python code, which does some text pattern matching, uses an associative array and makes some trivial text replacements will be thousand lines of C code. Hard to read C code. At least. And this code has to be compiled to run.
I wrote the first version of htmlppc for a friend with a small
project. He is a user of Microsoft's… ehm… great Windows
operating system. It is easy for me to say him "Install the Python
interpreter, rename the script to .pyc
and put it in the
directory of your project". Explaining him how to install a
compiler, compile a program and use it on the command line is much
harder. Not everyone has a C-compiler installed by default. And for
htmlppc, performance does not matter, so an interpreted language does
not hurt.
Why static HTML projects?
It is "overkill" to use a wiki or a CMS for a simple web project with 20 or 30 pages. Have you ever tried to explain the great Joomla CMS to someone? Have you ever seen how hard it is for an (even advanced) "normal" user even to publish a single page? Have you ever explained how to backup a MySQL database to someone who only wants a simple website (and already knows how to author HTML)? In many cases, static HTML is the easiest way to publish something on the WWW.
And of course, a webserver is much faster in delivering static pages than in dynamically creating them. And you can make a ZIP archive for offline reading easily. Or simply upload a mirror of the whole project to some cheap webspace without thinking on installation of huge software packages and administering a database server.
For which projects htmlppc does not fit?
If your web project changes very frequently, use a CMS or a flexible blogging system! Htmlppc isn't the right choice for you.
If your web project requires the collaboration of many people, which write content, a full blown CMS or a wiki is better than htmlppc.
If your web project is a single page, you don't need htmlppc. Just write your page with your favorite editor and publish it. The power of simplicity that is htmlppc comes in real handy for projects with more than one page.
If your web project is very huge, lets say thousands of pages, you probably want to use a more elaborated solution than the rather simple htmlppc tool.
I want subdirectories. How do I do it?
Of course it is much better to have some filesystem structure in projects with more than 20 pages (and associated files, images, downloads).
Htmlppc scans a directory recursively, so it is possible to use subdirectories. But you have to use separate navigation includes for the files in the subdirectories. If you format your pages with CSS, you want even to write an include for linking to the CSS file.