About Super Smartypants

Super Smartypants is a replacement for Smartypants core which adds language support and fine-tuned configuration for each language.

Category Text Formatters
Textformatter modules that provide run-time formatting for blocks of text (typically used with Text/Textarea fields).
Release StateStable
Should be safe for use in production environments. *
Authorplauclair
Module Version1.0.0
Class NameTextformatterSuperSmartypants
Compatibility2.4, 2.5, 2.6, 2.7
Date AddedJune 21, 2014
Last UpdatedMay 11, 2015
Recommended ByNew recommendations may take up to 1 day to appear.

Instructions

This module's files should be placed in /site/modules/TextformatterSuperSmartypants/
How to install or uninstall modules

README

Super Smartypants module documentation

Super Smartypants is a ProcessWire textformatter module which adds support for languages. It also allows you to set the different Smartypants Typographer parser attributes to customize which rules apply and fixes some bugs.

Usage

After installation, add /site/modules/TextformatterSuperSmartypants/smartypants.php to your language translations.

To enable Super Smartypants for a language, set the Smartypants attributes field to 1 (or see below for details), otherwise to disable leave the field empty.

Change default strings according to your masterful typographic knowledge.

Smartypants Typographer parser available attributes

These attributes can be inserted in the Smartypants attributes field. Note that attributes 1, 2, 3 do not mix with individual settings (you cannot do 1:+ for example). This is a limitation from the original Smartypants code, there is no plan to improve this right now.

leave empty : do nothing

1 ⇒ set all, except dash spacing

2 ⇒ except dash spacing, using old school en- and em- dash shortcuts

3 ⇒ except dash spacing, using inverted old school en and em- dash shortcuts

Punctuation

q ⇒ quotes

b ⇒ backtick quotes (``double'' only)

B ⇒ backtick quotes (``double'' and `single')

c ⇒ comma quotes (,,double`` only)

g ⇒ guillemets (<<double>> only)

d ⇒ dashes ("--" for em-dashes; no en-dash support)

D ⇒ old school dashes ("---" for em-dashes; "--" for en-dashes)

i ⇒ inverted old school dashes ("--" for em-dashes; "---" for en-dashes)

e ⇒ ellipses

Spacing

You can add a plus sign after some of these options denoted by + to add the space when it is not already present, or you can add a minus sign to completly remove any space present. For example, use :+ to add spacing before colons, and inversely :- to remove them.

: ⇒ colon spacing (optional additional + or -)

; ⇒ semicolon spacing (optional additional + or -)

m ⇒ question and exclamation marks spacing (optional additional + or -)

h ⇒ em-dash spacing (optional additional + or -)

H ⇒ en-dash spacing (optional additional + or -)

f ⇒ french quote spacing (optional additional + or -)

t ⇒ thousand separator spacing (optional additional -) Note that this doesn't add spaces when there are none, it only converts them

u ⇒ unit spacing (optional additional + or -)

A typographer's HTML character entities cheatsheet

Spaces

&#32; ⇒ Regular (breaking) space

&nbsp; ⇒ Non-breaking space

&ensp; ⇒ En space

&emsp; ⇒ Em space

&#8196; ⇒ Three-per-em space

&#8197; ⇒ Four-per-em space

&thinsp; ⇒ Thin space

&#8239; ⇒ Narrow no-break space

&#8202; ⇒ Hair space

Characters

&laquo; («) ⇒ Left-pointing double guillemets

&raquo; (») ⇒ Right-pointing double guillemets

&lsaquo; (‹) ⇒ Left-pointing single guillemets

&rsaquo; (›) ⇒ Right-pointing single guillemets

License

The MIT License (MIT)

Copyright (c) 2014 Pierre-Luc Auclair

Permission is hereby granted, free of charge, to any person obtaining a copyof this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included inall copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS ORIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Comments

No comments yet. Be the first to post!

Post a Comment

Your e-mail is kept confidential and not included with your comment. Website is optional.