用于替换“智能引号”字符的预提交修复器。
项目描述
fix-smartquotes
自动查找和替换智能引号字符的预提交钩子,以标准的ASCII "
和 '
字符。
这修复了某些应用程序从双引号到花括号引号的复制粘贴问题。它不会转换角括号、盲文引号或尖角引号。这些字符通常不是复制粘贴错误的产物,因此被允许。
低引号在不同语言中的用法和意义各不相同,有些语言使用面向“外部”的引号(与英语相反)。就大多数情况而言,这些和异国情调的字符(双重引号)被忽略。
在包含违规标记的文件中,它们会被替换,并且运行会被标记为失败。
支持的钩子
只提供了一个钩子,即fix-smartquotes
。
在.pre-commit-config.yaml
中使用它如下
- repo: https://github.com/sirosen/fix-smartquotes
rev: 0.1.1
hooks:
- id: fix-smartquotes
覆盖引号字符
有两种选项可用于指定将替换哪些字符。为了方便使用,它们被指定为十六进制编码的Unicode代码点。
假设你想要避免替换“重单引号装饰引号”(275C
)和“重单转逗号装饰引号”(275B
)字符。你可以按如下方式覆盖单引号代码点
- 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"]
独立使用
你也可以使用pip install fix-smartquotes
手动运行工具。
有关完整使用信息
fix-smartquotes --help
项目详情
关闭
fix-smartquotes-0.2.0.tar.gz 的哈希值
算法 | 哈希摘要 | |
---|---|---|
SHA256 | 7a5f95179139d4f3b8872c7415e91187d29bc3c320c1f8a5918ba9edf1b3a175 |
|
MD5 | b094044c762eaaebc1899555cc132c59 |
|
BLAKE2b-256 | 8b42885970ca04bbf0f72fd834aa0f6ba0189e879174f5ed6ee657070757967b |
关闭
fix_smartquotes-0.2.0-py2.py3-none-any.whl 的哈希值
算法 | 哈希摘要 | |
---|---|---|
SHA256 | 44a4752ede08d118b4babe8f8fa2ee94eb55e16a5465751c79b845d420de6ea9 |
|
MD5 | d8ad83d3d9ea24c21e11939fc601b2dd |
|
BLAKE2b-256 | 6a20d92c3923b8d1e15467d40e23a5856c4aec3e3cea9ebd18fd2ad57249d6c6 |