FiddleType

FiddleType is the utility I'm using to build my webpage.

It's designed to make writing simple webpages embarassingly easy, make simple formatting like headings, lists, and italics easier than it is in html, and to get out of the way when you really need to do something complicated.

FiddleType is implemented in PHP. I don't personally like the language, and would rather do it in Python. But practically every server I'll ever use is willing to read and execute PHP files. Case in point: I just moved this page to a new server, under totally different management, and everything worked by just copying the files. That's really, really nice.

FiddleType is (reasonably) secure. It won't try to parse information from other websites, and it doesn't do PHP includes. Plus, the code that does all of this formatting is really, really minimalistic, so it's reasonable to check its security by hand.

Still, FiddleType files are easy for me to write. I can easily edit plain text with vi across an ssh connection, and I can easily process plain text with command-line utilities. In fact, this whole website is very nearly a wiki, with the caveat that only I can edit it. (Yes, this makes it not-a-wiki-at-all.)

And this is the basic idea: with a really lightweight framework, it's easy for me to add new stuff. I like simply formatted text, so I'm not going to do any complex stuff on each individual page; I'd rather be able to just write stuff, and then present it nicely. Clearly, I'm spoiled by LaTeX.

Format

The filename of a source file is actually important. The title of a page is the filename of the source, with underscores replaced with spaces.

The units of a FiddleType source file are paragraphs, forms, and tokens.

The largest unit of a FiddleType source file is the paragraph. Paragraphs are separated from each other by empty lines; this is the same convention as, say, email and LaTeX. A paragraph contains any number of tokens and complete forms, and optionally begins with a paragraph-format token.

A form is an open square brace ([), a command token, any number of tokens and forms, and a closed square brace (]). Lisp programmers will recognize this as something much like Lisp forms, but with square parentheses. The command token will not be printed; instead, it changes how the rest of the form is interpreted. For example, [emph foo] looks like this: foo. Forms cannot span paragraphs, they need to be closed in the same paragraph in which they are opened. (Arguably, this is a misfeature. I'm not quite sure of the best way to handle those cases where this is annoying, though. On the other hand, if you need to handle these cases, you'll probably want a heavier tool. For example, HTML.)

A token is the smallest unit of text that FiddleType works with. It's either a single square brace, or a string of characters containing no whitespace. If you actually want a square brace to show up, like [this], then you need to delimit the square braces with backslashes, like \[this\].

Paragraph-Format Tokens

If any of the following is the first token of a paragraph, the token will not be printed. Instead, it will affect the format of the paragraph.

If any of the above tokens occur anywhere besides the beginning of a paragraph, they are treated as normal tokens.

Note well that unless there is whitespace between paragraph-format token and the first word of the paragraph, the token will not be recognized.

Command Tokens

The following are command tokens, and are the reason for forms in the first place.

That's plenty of syntax for my purposes. It's extends as necessary: for example, if I want to include a Java applet, I can just throw in the required HTML, a raw form. The PHP code that handles source files is simple enough that, if I really want more syntax, I can add it.

Want It?

The script itself is pretty simple. Feel free to take it and play with it. The Source. The code itself is public domain, though I appreciate it if you leave the author comments in the code and tell me if you find it useful.

The file index.php automatically adds a CC license to every page; if you copy stuff wholesale, make sure that's what you want. Also, index.php is highly specialized for my site, as are a few details in fiddletype.php. Be sure that you change these to reasonable values.

Home

Posse

Mail Matt Elder

unless otherwise noted, Creative Commons License

Changed 29 December 2007