Wool contains RegEx to combat and rectify all 10 HTML crimes you really shouldn't commit. As if that weren’t enough, Wool is completely free and easy to use anytime.
“Any man who would letterspace blackletter would shag sheep.” — Frederic Goudy
Stop stealing sheep & make your clients look like they know how type works with this typographic crime-stopping snippet for MODX 2.x.
Install via the MODX Package Manager.
Wool helps you keep your client's poor HTML practices from being reflected to the world by identifying and correcting them.
Currently Wool is capable of bailing your clients out of all 10 HTML entity crimes you really shouldn't commit free of charge.
Wool does this by performing clever Regular Expressions on provided $input
text and returning more typographically correct result.
While wool is currently packaged specifically for MODX Revolution, it's written in RegEx meaning it should be fairly portable to other technologies.
Wool can be used as a single [[wool]]
snippet or granularly as seen in Granular Usage below. The [[wool]]
snippet supports the below options and can be used with default options as an output modifier:
[[*introtext:wool]]
or traditionally like so:
[[wool?
&input =`[[*introtext]]`
&encodeQuotes=`false`
]]
Name | Description | Default Value |
---|---|---|
adopt | Adopts orphans by replacing the last space in sentences with a non-breaking space. | true |
fixEllipsis | Replaces sloppy ellipsis (...) with … entity |
true |
encodeQuotes | Fixes ellipsis | true |
fixGreedySpaces | Fixes ellipsis | true |
fixDashes | Replaces sloppy greedy spaces with   and   entities |
true |
fixPhonyFractions | 5 / 6 => 5⁄6 | true |
fixPhonyMultiplicationSigns | 5 x 5 => 5 × 5 | true |
fixPhonyDivisionSigns | 5 % 5 => 5 ÷ 5 | true |
fixDegreeSymbols | Replaces manual degree symbols with ° entity |
true |
fixCopyrightSymbols | Fixes phony copyright symbols | false |
fixTrademarkSymbols | Fixes phony trademark symbols | false |
encodeAmpersands | Encodes the & character properly. Intended for plain text | false |
fixShoutCaps | Fixes CRAZY CAPS SENTENCES | false |
fixCrazyExclamations | Removes consequtive exclamation points (!!!) | false |
fixCrazyQuestionMarks | Removes consequtive exclamation question marks (???) | false |
Wool comes packaged with several easy to use Snippets so you can have your wool in peices.
orphan: A word, part of a word, or very short line that appears by itself at the end of a paragraph. Orphans result in too much white space between paragraphs or at the bottom of a page.
Especially in the world of responsive design, we hook beautiful themes up to content management systems giving clients all the freedom to create every typographic sin there is. Luckily, now with wool we can ensure individual words are never left hanging by their londsome using [[wool.adopt]]
like so:
<!-- Assume a long title of “I like fried chicken and beer.” -->
<!-- Outputs: “I like fried chicken and beer.” -->
[[*longtitle:wool.adopt]]
<!-- Outputs: “I like fried chicken and beer.” (ommits adoption less than 24 words) -->
[[wool.adopt?input=`[[*longtitle]]` &minWords=`24`]]
Crime 5 of the 10 HTML crimes you really shouldn't commit is the DIY Copyright(c) symbol. Using wool, we combat this like sloppy (c) and replace it with © using [[wool.copyright]]
like so:
<!-- Replaces occurences of “(c)” with “©” -->
[[*legal:wool.copyright]]
We all have that client WHO LIKES TO WRITE COPY LIKE THIS!!! AND LIKE THIS!!! We can tone that down a bit using [[wool.crazy-exclamations]]
like so:
<!-- Replaces occurences of “!!!” with “!”-->
[[*description:wool.crazy-exclamations]]
Excesive question marks can get out of hand. Don't you think so???!!! We can tone that down a bit using [[wool.crazy-question-marks]]
like so:
<!-- Replaces occurences of “???!!!” with “?”-->
[[*description:wool.crazy-question-marks]]
Crime 9 of the 10 HTML crimes you really shouldn't commit is using supersized degree symbols. [[wool.degree-symbol]]
like so:
<!-- Replaces occurences of “71<sup>0</sup>” with “71°”-->
[[*weather:wool.degree-symbol]]
Crime 2 of the 10 HTML crimes you really shouldn't commit is making your own ellipsis. We combat this using [[wool.ellipsis]]
like so:
<!-- Replaces occurences of “...” with “…”. -->
[[*description:ellipsis]]
Crime 3 and Crime 4 of the 10 HTML crimes you really shouldn't commit is the incorrect use of em and en dashes. We combat this using [[wool.mdash]]
and [[wool.ndash]]
like so:
<!-- Replaces occurences of “--” and “-” with “—” and “–” respectively. -->
[[*description:mdash:ndash]]
Using Wool, long run on series of blank spaces can be converted to a single  
using [[wool.emsp]]
like so:
<!-- Replaces occurences of “ ” with “ ”. -->
[[*description:emsp]]
Crime 1 of the 10 HTML crimes you really shouldn't commit is to not convert your ampersands. We combat this using [[wool.encode-ampersands]]
like so:
<!-- Replaces occurences of “&” with “&”. -->
[[*pagetitle:wool.encode-ampersands]]
Crime 8 of the 10 HTML crimes you really shouldn't commit is using plain text mathematics symbols. We combat this using [[wool.division-signs]]
, [[wool.multiplication-signs]]
and [[wool.fractions]]
like so:
<!-- Replaces occurences of “1/2” with “½” -->
<!-- Replaces occurences of “2/4” or “3 % 6” with “2÷4” and “3 ÷ 6” respectively. -->
<!-- Replaces occurences of “5*5” with “5×5”. -->
[[*description:wool.fractions:wool.division-signs:wool.multiplication-signs]]
Crime 10 of the 10 HTML crimes you really shouldn't commit is the incorrect use of quotations. We combat this using [[wool.encode-quotes]]
like so:
<!-- Straight to curly quotes. -->
[[*pagetitle:wool.encode-quotes]]
Sometimes people shout too much when they type. We combat this using [[wool.shout-caps]]
like so:
<!-- “ALL CAPS” to “All <span class="text-transform">caps</span>”. -->
[[*introtext:wool.shout-caps]]
Crime 10 of the 10 HTML crimes you really shouldn't commit is to make your own trademark symbols. We combat this using [[wool.trademark]]
like so:
<!-- “<sup>TM</sup>” to “™”. -->
[[*legal:wool.trademark]]