Outbound Link Summary:
17 years ago
p3k dots

on quotation marks.

my main contact with practical computing (besides the first encounter of the c64 kind and after a long break) was at different universities focusing on typography and publishing.

suddenly, there were hard disks, megabytes of memory and - most of all - the graphical user interface.

thus, for the time being i typeset instructional or scientific texts using tex.

regarding typography there wasn't much thinking necessary, since tex made all necessary concessions for a typophile's needs and expectations to achieve satisfying results - even without paying a lot of attention on typesetting details (or knowing about your computer keyboard's secret key combinations) but rather relying on a bunch of simple rule sets.

quotation marks, for example, shouldn't be typeset using the foot " or inch ' marks everywhere. instead, it was advised to emulate the opening and closing quotes with different characters available on a generic keyboard, i.e. the accent grave ` and the inch mark ', depending on the quoting style either `once' or ``twice''.

tex would then transform these not less dumb quotation marks into what i call beautiful typography, ‘once’ or “twice”, accordingly.

enters html.

unfortunately, the world wide web (although a pure text medium in the beginning) didn't get the appropriate attention on typesetting. the "www's tex" is called html and still today, even after more than 10 years, there is no sign of meaningful typographic support in current html implementations.

sure, all the entity codes are available - ‘ ’ “ ” - but i am still using the same keyboard layout originating from the first standardized typewriters as i did with tex; and such acronym codes apparently are not very helpful when writing, either (au contraire, as they interrupt my "flow", prevent me from thinking about my writing and make me wonder about the right entity code.)

fortunately, the web is full of people who consider such flaws unacceptable and thus, created wonderful helpers like smartypants or textile.

nevertheless, i am still not satisfied: for one thing, these scripts are not easily usable in a web context. smartypants is written in perl, i would like to have javascript. (i only found the web front-end of textile so i cannot judge its code, but obviously it's not thought to be used elsewhere at all, which renders it useless, anyway.)

for another, they either lack support for the various quotation styles in the world or even bring you unnecessary features which imho belong to some different text filter thingie.

so, as you might already guessed it, i did it myself.

...and really struggled hard.

starting off trying to rewrite the smartypants code in javascript i soon got stuck with perl's regular expressions (i am not very good at this) and decided to take another approach.

which was leading the way forward.

but even bigger difficulties were waiting for me: the “english” quoting style works very well with the pretty universal typographic apostrophe , not causing any troubles in special cases (like rockin’ or smartypants’ features).

however, using „german“ or «french» styles some mishaps can occur which need to be circumvented to prevent rendering the above examples from shockingly looking like rockin‘ or, even worse, smartypants› features.

btw. the above is the equivalent to the leading apostrophe problem, e.g. as in 'cause i don't care. since this is not solved in smartypants or any word processor either, i assume there is no easy solution at hand, yet.

another lesson in how cultural differences can ease programming - or make it more difficult, if not impossible.

to make this long story end.

please take a look at typolisher (text/html, 3 KB) , a typographic text filter i am currently developing in javascript. (it already runs in your browser everytime it is loading this page.)