This project has been archived by its maintainers, and is no longer receiving any updates.
fix-smartquotes
A pre-commit hook for automatically finding and replacing smartquote
characters with the standard ascii " and ' characters.
This fixes copy-paste from some applications which replace double-quotes with curly quotes. It does not convert corner brackets, braile quotation marks, or angle quotation marks. Those characters are not typically the result of copy-paste errors, so they are allowed.
Low quotation marks vary in usage and meaning by language, and some languages use quotation marks which are facing "outwards" (opposite facing from english). For the most part, these and exotic characters (double-prime quotes) are ignored.
In files with the offending marks, they are replaced and the run is marked as failed.
Supported Hooks
Only one hook is provided, fix-smartquotes.
Use it in .pre-commit-config.yaml like so:
- repo: https://github.com/sirosen/fix-smartquotes
rev: 0.1.1
hooks:
- id: fix-smartquotes
Overriding Quotation Characters
Two options are available for specifying exactly which characters will be replaced. For ease of use, they are specified as hex-encoded unicode codepoints.
Suppose you wanted to avoid replacing the "Heavy single comma quotation
mark ornament" (275C) and the "Heavy single turned comma quotation mark
ornament" (275B) characters. You could override the single quote codepoints
as follows:
- repo: https://github.com/sirosen/fix-smartquotes
rev: 0.1.1
hooks:
- id: fix-smartquotes
# replace default single quote chars with this set:
# apostrophe, fullwidth apostrophe, left single quote, single high
# reversed-9 quote, right single quote
args: ["--single-quote-codepoints", "0027,FF07,2018,201B,2019"]
Standalone Usage
You can also pip install fix-smartquotes to run the tool manually.
For full usage info:
fix-smartquotes --help
Release files for fix-smartquotes 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| fix-smartquotes-0.2.0.tar.gz | 4.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| fix_smartquotes-0.2.0-py2.py3-none-any.whl | Python 2, Python 3 | none | any | Details |
Total release size: 9.7 kB
Release files / fix-smartquotes-0.2.0.tar.gz
| Download URL | fix-smartquotes-0.2.0.tar.gz |
|---|---|
| Size | 4.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7a5f95179139d4f3b8872c7415e91187d29bc3c320c1f8a5918ba9edf1b3a175
|
|
BLAKE2b-256 checksum How to use checksums |
8b42885970ca04bbf0f72fd834aa0f6ba0189e879174f5ed6ee657070757967b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/51.1.1 requests-toolbelt/0.9.1 tqdm/4.55.1 CPython/3.6.9
|
Release files / fix_smartquotes-0.2.0-py2.py3-none-any.whl
| Download URL | fix_smartquotes-0.2.0-py2.py3-none-any.whl |
|---|---|
| Size | 5.5 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
44a4752ede08d118b4babe8f8fa2ee94eb55e16a5465751c79b845d420de6ea9
|
|
BLAKE2b-256 checksum How to use checksums |
6a20d92c3923b8d1e15467d40e23a5856c4aec3e3cea9ebd18fd2ad57249d6c6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/51.1.1 requests-toolbelt/0.9.1 tqdm/4.55.1 CPython/3.6.9
|