Content last modified Tuesday 24 August 2021
hop to #bottom
Categories:
Author:
Current version:
1.0
About It:
Get it:
Rate it:
  • Helpful?
  • 1 Yes
  • 0 No
Flag it:

If you'd like to provide updated information and do not have access to directly edit, please contact the site admin; thanks!

cnn_title_case

A while ago, John Gruber posted a nifty little Perl script that attempts to correctly convert text into Title Case. I’ll let Gruber explain more:

It’s pretty easy to write a non-clever title-casing function. The simplest way is to just capitalize the first letter of every word. That’s not right, though, because it’ll leave you with capitalized small words like if, in, of, on, etc. What you want is something that not only knows not to capitalize such words, but will un-capitalize them if they’re erroneously capitalized in the input.

Adam Nolley, ported it to PHP for use as a Wordpress plugin, and I thought it might be useful to wrap Adam’s function up into a Textpattern plugin.

Download:

cnn_title_case-1.0.txt

Usage:

You can use in an article form to title case the article’s title like this:

<txp:cnn_title_case><txp:title /></txp:cnn_title_case>
Article Request Count:
Keywords/tags:
Initially released:
8/8/08
Posted here:
20 Aug 2008

You know you want to visit the Archives.
Published with Textpattern