https://github.com/jpdevries/wool
Typographic crime-stopping snippet for MODX 2.x.
https://github.com/jpdevries/wool
Last synced: 5 months ago
JSON representation
Typographic crime-stopping snippet for MODX 2.x.
- Host: GitHub
- URL: https://github.com/jpdevries/wool
- Owner: jpdevries
- Created: 2014-12-22T00:00:41.000Z (over 11 years ago)
- Default Branch: develop
- Last Pushed: 2016-06-23T11:44:02.000Z (almost 10 years ago)
- Last Synced: 2024-11-22T01:41:58.063Z (over 1 year ago)
- Language: PHP
- Size: 23.4 KB
- Stars: 9
- Watchers: 5
- Forks: 1
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
wool
====
Wool contains RegEx to combat and rectify all [10 HTML crimes you really shouldn't commit](http://line25.com/articles/10-html-entity-crimes-you-really-shouldnt-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.
## Installation
Install via the MODX Package Manager.
## Overview
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](http://line25.com/articles/10-html-entity-crimes-you-really-shouldnt-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.
## Options
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`
## Granular Usage
Wool comes packaged with several easy to use Snippets so you can have your wool in peices.
### Adopt
> 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:
```html
[[*longtitle:wool.adopt]]
[[wool.adopt?input=`[[*longtitle]]` &minWords=`24`]]
```
### Copyright
Crime 5 of the [10 HTML crimes you really shouldn't commit](http://line25.com/articles/10-html-entity-crimes-you-really-shouldnt-commit) is the DIY Copyright(c) symbol. Using wool, we combat this like sloppy (c) and replace it with © using `[[wool.copyright]]` like so:
```html
[[*legal:wool.copyright]]
```
### Crazy Exclamations
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:
```html
[[*description:wool.crazy-exclamations]]
```
### Crazy Question Marks
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:
```html
[[*description:wool.crazy-question-marks]]
```
### Degree Symbols
Crime 9 of the [10 HTML crimes you really shouldn't commit](http://line25.com/articles/10-html-entity-crimes-you-really-shouldnt-commit) is using supersized degree symbols. `[[wool.degree-symbol]]` like so:
```html
[[*weather:wool.degree-symbol]]
```
### Ellipsis
Crime 2 of the [10 HTML crimes you really shouldn't commit](http://line25.com/articles/10-html-entity-crimes-you-really-shouldnt-commit) is making your own ellipsis. We combat this using `[[wool.ellipsis]]` like so:
```html
[[*description:ellipsis]]
```
### Em & En Dashes
Crime 3 and Crime 4 of the [10 HTML crimes you really shouldn't commit](http://line25.com/articles/10-html-entity-crimes-you-really-shouldnt-commit) is the incorrect use of em and en dashes. We combat this using `[[wool.mdash]]` and `[[wool.ndash]]` like so:
```html
[[*description:mdash:ndash]]
```
### Em & En Spaces
Using Wool, long run on series of blank spaces can be converted to a single ` ` using `[[wool.emsp]]` like so:
```html
[[*description:emsp]]
```
### Encode Ampersands
Crime 1 of the [10 HTML crimes you really shouldn't commit](http://line25.com/articles/10-html-entity-crimes-you-really-shouldnt-commit) is to not convert your ampersands. We combat this using `[[wool.encode-ampersands]]` like so:
```html
[[*pagetitle:wool.encode-ampersands]]
```
### Mathematics Symbols
Crime 8 of the [10 HTML crimes you really shouldn't commit](http://line25.com/articles/10-html-entity-crimes-you-really-shouldnt-commit) is using plain text mathematics symbols. We combat this using `[[wool.division-signs]]`, `[[wool.multiplication-signs]]` and `[[wool.fractions]]` like so:
```html
[[*description:wool.fractions:wool.division-signs:wool.multiplication-signs]]
```
### Quotations
Crime 10 of the [10 HTML crimes you really shouldn't commit](http://line25.com/articles/10-html-entity-crimes-you-really-shouldnt-commit) is the incorrect use of quotations. We combat this using `[[wool.encode-quotes]]` like so:
```html
[[*pagetitle:wool.encode-quotes]]
```
### Shout Caps
Sometimes people shout too much when they type. We combat this using `[[wool.shout-caps]]` like so:
```html
[[*introtext:wool.shout-caps]]
```
### Trademark
Crime 10 of the [10 HTML crimes you really shouldn't commit](http://line25.com/articles/10-html-entity-crimes-you-really-shouldnt-commit) is to make your own trademark symbols. We combat this using `[[wool.trademark]]` like so:
```html
[[*legal:wool.trademark]]
```