User:Chocolateboy/smart quotes.user.js

Description

This Greasemonkey user script converts typewriter quotation marks to “smart” quotes and triple periods to ellipses. Text inside

and is not affected.

Usage

  1. Install [http://greasemonkey.mozdev.org/ Greasemonkey] >= 0.3
  2. Open the URL in the Script section below

Test

  • “double quotes” should appear as smart quotes: “double quotes”
  • single–hyphen should appear as an en dash: single–hyphen
  • double — hyphen should appear as an em dash: double — hyphen
  • ellipsis… should appear as a single character: ellipsis…

Script

  • https://raw.github.com/chocolateboy/userscripts/master/wikipedia_smart_quotes.user.js

Changelog

  • 1.0.1 don't change hyphens to dashes
  • 1.0.0 add support for HTTPS; support other languages; add grant
  • 0.14 refine exclusions
  • 0.13 exclude diffs
  • 0.12 exclude articles with unbalanced quotation marks
  • 0.11 var cleanup
  • 0.10 remove redundant loop
  • 0.09 order the replacements so that double hyphens are processed before single hyphens
  • 0.08 properly fix ellipsis regex
  • 0.07 exclude preformatted text
  • 0.06 access text node children of rather than

    so that

  • nodes are included
  • 0.05 better handling of double quotes
  • 0.04 further constrain ellipsis regex + correct JavaScript replacement pattern syntax
  • 0.03 fix ellipsis regex
  • 0.02 only modify text nodes that are descendants of

    nodes

  • 0.01 original version

See also