Text-wrangling help

This is a description of the text-wrangling that happens in some of the forms where you can type free-form text. Basically, if you got pointed here from a page, the big text-entry area on that page should support these things. Many of these ideas were taken from Textile, but the link style came from Flutterby, and all the code came out of my fingers, so any problems are purely my fault.

Text conversions

HTML links

Typing link text wrapped in underscores, followed by the URL in parentheses (with a space between the trailing underscore and before the opening paren): _About Dave’s Picks_ (/about/) will give you a link: About Dave’s Picks. This is a feature you want to use, because I’m eventually going to jam these links into a glossary, and hook up some way for you to re-use the links without having to retype the URL.

Apostrophes

If you type text with straight quotes contained within a word, they’ll automatically be converted to the curly apostrophe. So I type "they'll" and I get "they’ll".

Dashes

Two dashes in a row: "--" will be converted to an em-dash "—" wrapped with spaces. A single dash wrapped in spaces will be converted to an en-dash–which is a pretty handy thing, except many fonts (Microsoft’s Trebuchet, for example) have an en-dash which is too narrow (less than an en in width), so it looks goofy. Blame the font-foundry, not me.

Ellipsis

Four periods will be converted to a space, an ellipsis, and a period. Three periods will be converted … to an ellipsis with spaces around it.

Acronyms

Any string of three or more capital letters will be wrapped in an acronym tag. So if you type USA, it'll get converted to USA. If you want to provide an expansion, you can do it by typing the acronym, followed (with no white space in-between) by the expansion in parentheses: ASCII(American Standard Code for Information Interchange) will turn into ASCII. If you hover your cursor over the acronym, you'll see a tool-tip with the expansion. As with links, my long-term plans are to automatically fill in the expansions if you’ve ever used an acronym before.

Numerics

Fractions: 1/2, 1/4, 3/4 are converted to the single-character entity (½ ¼ ¾). Other fractions have the slash converted to a fractional slash, which looks a little different: 5/8 goes to 5⁄8.

Styles

You can use /text/ to get emphasized text and #text# to get strongly-emphasized text. They don't work perfectly (there has to be a space both before and after them for them to work at the moment), especially at the end of sentences. I'm working on improvements.

Other typography

Double spaces (or runs of more than two spaces) are automatically converted to a single space. This makes the breaks between sentences look better. Also (TM) is converted to ™, (C) is converted to © and (R) is converted to ®.

Accented characters

The text-conversion currently handles: á Á é É í Í ó Ó ú Ú ä Ä ë Ë ï Ï ö Ö ü Ü ÿ Ÿ à À è È ì Ì ò Ò ù Ù â Â ê Ê î Î ô Ô û Û ã Ã ñ Ñ õ Õ when they are typed from Mac Internet Explorer 5.x. I haven’t tried other browsers or OSes yet. Please let me know if you type some that don’t work correctly, and point me to the resulting file that’s incorrect. That’s the only way I’ll get around to fixing them.

Other features

"quoted strings" get wrapped in the proper HTML tags so they’ll look like real quoted strings. Quoted strings that live on their own line (only one line, so no embedded returns) get turned into blockquotes. Quoted strings do not properly nest yet.

Copyright 2009, Dave Polaschek. Last updated on Mon, 15 Feb 2010 13:48:12.