Tuesday, August 12, 2008

AWK based AFT redux?...

I've been maintaining the current incarnations of AFT in Perl for over 10 years now. I haven't updated the code base in almost 2 years now. I can't brag that is is bug free, but it certainly is stable (at least in some interpretation of that word).

Every few months I get a question (or two) from new users of AFT. I have no idea how many people are using AFT, but it is part of the Debian and FreeBSD software archives so it is very easy to download and install on those systems.

This search indicates that there are at least folks out there using a mostly unchanged AFT to publish documents to the Web. (They haven't bothered to remove the default advertisement).

I'm pretty much completely out of touch with Perl these days, so I am not very motivated to improve or extend the current AFT. The codebase has grown complicated and I wince at some of my awkward Perl techniques.

However, I do have a very decent corpus of AFT documents. I still use AFT to do general purpose documentation and then there is the previous mentioned cache of AFT documents that can be found through Google.

If I were to analyze this corpus, would I find a simpler subset of AFT that would do for most uses? And, if I identified that subset, is it time for a rewrite?

Frankly, I would probably do such a rewrite in AWK (or GAWK). I'd keep it simple and maybe make it a little more modular (shell pipes?). I would probably drop the Windows support (although it would still run under cygwin).

Regarding modularity, I'd probably develop it to run in two phases:
  1. A single AWK script to produce
    • An intermediate markup for Phase 2.
    • Or vanilla HTML for quick view or incorporation into a larger HTML/CSS framework.
  2. A translation from intermediate markup to HTML, LaTeX, etc.
    • Similar to what I have now with the current AFT.
I definitely want to reduce the number of files needed to run AFT. For a minimal run, you would just need AFT.awk and an AWK interpreter. You could then bind/embed the invocation into your favorite editor (no locating support files or setting environment variables).

That would be sweet :-)

1 comment:

  1. Anonymous11:31 AM

    Good idea to redo the good thing!

    I just found AFT and remembered old time when I had the same idea of txt to word converter (at that time there were no Windows, HTML or such things).

    So good luck!

    I might do it on my own overtime (given the same constraints - time, priorities, etc) - btw sorry for english, I am russian.

    I would definitely use current AFT (I am on Linux) but I have this small UTF-8 problem: russian texts are converted into symbols out of AFT box...

    Will try to figure something out with this or will go for AWK-based script keeping basic AFT syntax. I guess not all of it is necessary.

    Will keep you informed, I am misha@dm.ru, just in case...

    Regards and thanks!

    ReplyDelete