QZ qz thoughts
a blog from Eli the Bearded

Post Filter


So I started working on a method to compose posts better, for my idea of better at least. Version one of qzpostfilt (and a README and some test code) is available in the git repo and browsable here.

It's a mis-mash of Markdown and nroff/troff style commands. I picked what I thought the easiest to remember and to type on a phone keyboard methods of composing my posts would be. Basically you have markdown style inline formatting for bold, italic, code and *roff style formatting for more block level stuff. As a general rule: .foo creates <foo> and you need to explicitly close your ./foo.

my xterm composing this post

It ends up looking more like *roff than markdown.

I see this as the first step towards a composing tool. I'll also need a CGI wrapper for phone use and a command line wrapper to help with tags. As of today, it's more of a :% !qzpostfilt in vi sort of thing.

Also in blosxom blog news, I've changed the html flavor templates slightly and made changes to the CSS file mostly to better support reading on small screens, but also for a <ul> class to use in recipe posts.

Lastly, I added another two dozen logos to the mix. Previously there had been 146, so it's up to 170 now. I don't recall how I created the first logos, this time my method was to type "QZ" in libreoffice, change the font size to 180, and then go through the fonts I have installed, screenshotting all the interesting ones. I next very roughly cropped the images so that each QZ was alone on a white background. From there I started scripting the work.

# for every png file, convert to ppm (RGB color), auto-crop a white border,
# convert to pgm (grayscale), rescale so ysize (height) is 100 pixels,
# convert to png making white (and only exactly white) transparent, saving
# that result in the "new" directory
for f in *png ; do pngtoppm $f | pnmcrop -white | ppmtopgm | 
   pnmscale -ysize 100 | pnmtopng -transparent =white > new/$f ; done

(That's something I need to add to qzpostfilt: a <pre> handler. Todo. Hand fix for now.)

A second, messier, pass with identify got me the files renamed to look like "linux-biolinum-keys-h100-w205.png" instead of "linux-biolinum-keys.png". My randomlogo plugin uses the height and width information when available.

Tags Plugin, first version


Several things have become clear writing this plugin.

  1. Some sort of method to standardize tags will be helpful. Did I use "plugin" or "plugins" last time?
  2. Getting tags working and getting tags complete are different tasks. I have tags working now, complete will include non-ASCII tags working (currently they display, but won't search) and more advanced searching like TAG or TAG, TAG and TAG, TAG without TAG, and no tags at all. Even if the automatically generated links won't include that, I'll want those searches for my own use.
  3. The limits of the default interpolation become more obvious. I can set a a string to be included, but I can't have a template that includes a loop over an array, to e.g. have the top twenty tags listed in desktop view but only five in mobile view.

I don't plan to fix interpolation any time soon, but the other two I can see in my near future. I will probably code up a post composer of some sort to help standardize tags. With that I can foresee also making the post composer do preliminary HTML formatting from a simple markup language, and hooking the composer up to a cellphone friendly CGI page.

Fixing the tags plugin to move beyond "MVP" — minimum viable product — particularly for non-ASCII tags will also be a relatively high priority. Right now tags can be (roughly) /^[a-zA-Z0-9_-]+$/, with the caveat that I block leading hyphens (will probably want that available for tag negation searches) and I allow whitespace in tags, but map that to _ (underscore) for searches, so there will be no way to distinguish between this_tag and this tag.

But here it is: aaa_tags.

First off tags for any post are saved in a file with the same name but a different (configurable) extension. One tag per line. Lines starting with # are comments. Leading and trailing whitespace removed, and internal whitespace is normalized to a single space.

It creates a interpolation variable for a configurable number of top tags, I'm going to be using that instead of the old categories. (And I used the categories and subcategories to seed the tags on all the old posts.) It also creates a tags variable for interpolation just before each story is processed. Both of those make the tags shown into search links.

I've named it starting with "aaa" because I want it to have access to the %files and %others lists before any filter() edits them. This way I can build a complete list of unfiltered tags. This also means that tag search filters happen with a very high priority, which isn't as necessary. Just running that any time before pagination kicks in would have been fine.

With this plugin, I'm retiring my use of the categories, prettycategory, menu, and breadcrumbs plugins. That's leaving me pretty close to 100% plugins I wrote (or *cough*paginateqz*cough* rewrote).

Ides of March Patch


The Ides of a month in Roman counting is where they switched from counting days up in a month to counting days down. The Ides of March was also the day newly elected leaders took office. Julius Casear declared himself Emperor, no longer an elected leader, and the Ides was thus a fitting day to be elected dead.

On a totally unrelated note, I have a new patch ready.

This reorders some code, to ensure the &$interpolate() configurable function is available early. I'll use it in filter() in my new tags plugin (probably ready tomorrow). I've also fixed a bug that was sometimes doubling up the last post on a page. I didn't bother figuring out how code execution gets there, just added next; to restart the loop if it happens. I don't know if that only occurred because of my plugins, or if it was a long standing bug in blosxom for everyone.

I also removed the place were it sets -quiet as a param, I don't think that was used anywhere, but it caused it to be added to CGI parameters.

Lastly, I modified the version number in the code.

A new pagination plugin


I found my "round tuit" and rewrote the old paginate plugin to include the features of cooluri, thus superceding my modified versions of both of those (paginateqz-v0.10, nowcooluri-v0.2).

The new paginateqz handles both at once allowing me to have the "newer" and "older" pagination links on permalink pages, and those links go through posts a single entry at a time. This is the feature I really wanted. It works just like a real blog now!

At the same time I added some features. There's a new interpolation variable $paginateqz::np_sep which is a separator only set when next and previous links are set. The template filler in paginateqz now is respectful of how you may have a plugin to find templates (spoiler, I do) and how you may have a plugin to do interpolation (I do not).

Next up will be a tagging plugin. I have a draft which can find and display tags, but it does not let one search by tags, yet. I also need to actually go and tag posts for it to be useful. After that, I'll have all the features I find essential. Non-essential, but nice to have, will include searching and comments. The comments one is hard because of spammers. Tags that search takes me to 80% value of complete search, I think.