4

I have been lurking for a long time on this forum and I found it to be the most useful. This is my first question so forgive me if it is not phrased properly. I am looking for a simple nawk based (the server doesn't belong to me so I can not install gawk even if I wanted) CMS or collection of shell/awk scripts to help me manage my growing collection of pure XHTML 1.0/CSS files which represent my personal website. I tried TinyTim and Blis on my personal computer. Apart of being non-portable (sorry but Bash and gawk are not standard Unix tools) I found them not to be fully functional. Can anybody suggest any other solutions? I have my own growing collection of quick scripts but I need something more robust. I am willing to consider simple Perl based solution. Python would be a stretch but I really like the language and I am using it daily for scientific computing so I am willing at least to learn about that option.

3 Answers3

4

I wrote a static site generator using awk and sh called Zodiac. It supports Markdown and plain HTML, a main site layout, metadata and its written in POSIX awk and sh. This could be the awk-based content management system you're looking for.

nu-ex
  • 691
  • 4
  • 9
  • Thanks for posting your answer! Please be sure to read the [FAQ on Self-Promotion](http://stackoverflow.com/faq#promotion) carefully. Also note that it is *required* that you post a disclaimer every time you link to your own site/product. – Andrew Barber May 11 '12 at 02:50
3

An interesting question! But this is not a traditional answer. I have numerous comments that won't fit well into the S.O. comment format, so please forgive this violation of etiquette.

As much as I like *awk, I can see several obstacles.

1. I'm not aware of any CMS tools created with nawk. I have a wide range of experience of what is available with awk, and as you've discovered, there are several, (TinyTim and Blis), but they're based on bash/gawk and they're not as fully featured as you require.

When I went to the mother-ship of awk (www.awk.info), I got the distinct impression that the site has been hacked. I did find A tiny CMS in awk , but assume it is a gawk based system. The two sites have related authors, so I'm afraid it may be hacked too. Beware!

2. It sounds like you are thinking of a traditional awk command-line and shell script based system. If so, my limited experience with CMS systems has been that they are GUI based systems for content creation and management, so a GUI page creator, AND THEN a GUI wrapper around something similar to a traditional unix repository/SCCS system. CMS experts are welcome to enumerate the differences.

So, why not just make some wrapper scripts around CVS or similar that allow you to control your repository as you need?

3. System effectiveness I: using CVS as a place holder for the repository side of your CMS system, think how big that source code is, and that it is written in 'C', which gives much finer access and control to sub-systems related to file ownership and security issues (as well as many others) than you can access in nawk or any shell. (Compiled C executes much faster of course, but in this day of 3Ghz+ processors, it's not an absolute requirement to insist on complied code)

4. system effectiveness II: You say you want to store mostly XHTML 1.0/CSS type files. That is a major set-back for your project, awk is reg-ex based language and can't effectively parse XML-like data. Have you lurked enough here to have read parse xml in bash OR complex conversions

Of course, the post I was really looking for, I can't find! Search for phrases like 'friends don't let friends do XML in sed/awk/bash' ;-)!

5. Re TinyTim and Blis: Reconsider your objection to gawk/bash: these 2 excellent languages are super-sets of nawk and ksh(88). Depending on how little/much the script rely on gawk/bash specific features, at the easy end, you may only need to change the 'she-bang' at the top of the file to #!/bin/nawk , #!/bin/ksh OR more realistically, make that change and then rewrite some code for nawk/ksh. Worst case is that the gawk and bash code rely so heavily on specific 'branded' features that is really impractical to rewrite. It's worth a look.

To complete the picture, also see gawkxml. Obviously a gawk system, but I did make a conversion to nawk with some code changes. It worked for my needs, but I didn't try to fix the case of the self-verifying aspect of the code that didn't work ;-(

EDIT

6. Finally, look at the range of systems from the original awk creators in their classic book 'The Awk Programming Language', Chap 4 Reports and Databases, 'A relational database system' AND Chap. 6, Little Languages. There may be ideas there for you (no prebaked CMS however ;-).


So, given that perl and python both have good-to-great XML processing built-in via imported modules, I think you have to seriously consider them OR install something like xmlstarlet (per the S.O. links above) and write your shell system wrappers to work with it.

I hope this helps.

Community
  • 1
  • 1
shellter
  • 36,525
  • 7
  • 83
  • 90
  • Sniff sniff... You remind me of a teacher I never had in school!! +1 – jaypal singh Jan 05 '12 at 05:06
  • lol! not by half ;-) but thanks for the nice thoughts. You've been posting some very nice answers lately and will quickly surpass my rep-points. Keep up the good work! Good luck to all. – shellter Jan 05 '12 at 05:08
  • Thanks Shellter … rep-points are nothing compared to the wealth of knowledge you share over here so thank you!! :) – jaypal singh Jan 05 '12 at 05:20
  • Great post even though I realized how poorly my question was stated! Thank you so much for your effort to write the answer. I really like your idea of using CVS as the place holder for the repository site! Essentially that takes care of 50% CMS functionality. I think that the only reason I have not used up to now was historical. I started with handful of XHTML/CSS files and I never believed that it will grow so much. The awk solution, I was really looking after really boils down to shell/awk scripts for quick update and creation of new pages. – Predrag Punosevac Jan 05 '12 at 14:17
  • So maybe Jekyll can help you? Else, I would guess that there are rather fully-featured CMS systems based on perl or python available. If you try Tiny awk CMS, please let me know what you think. Good luck and thanks for the nice feedback. – shellter Jan 05 '12 at 14:27
2

Try Jekyll:

http://jekyllrb.com/

You just write up some text files using some simple, intuitive syntax. Then when you run Jekyll, it generates a whole folder full of plain HTML files, ready to upload.

The code can be extended using Ruby plugins which add extra functionality.

It is supported on GitHub Pages: if you upload a repository full of Markdown files, GitHub will run Jekyll on it automatically and host it on your personal subdomain.

There's also Hyde which is written in Python, but I haven't tried it.

A Google search for "static website generator" will yield millions of results. Try a few and pick what you like!

Lambda Fairy
  • 13,814
  • 7
  • 42
  • 68
  • Yes after the decision that I adopt CVS that is actually what is left. Please see my above comment. I need something which will quickly generate/update static web pages. At the moment I am experimenting with Markdown language since it is easier to write than pure XHTML. I have not look at Jekyll since I am not familiar with Ruby but I have Google before. As you observed the Google returns million results which you can usually disregard after 10min of testing. I needed somebody to clear my mind just like you guys did. – Predrag Punosevac Jan 05 '12 at 14:29