Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/honza/punctuation
Add real HTML punctuation
https://github.com/honza/punctuation
Last synced: about 5 hours ago
JSON representation
Add real HTML punctuation
- Host: GitHub
- URL: https://github.com/honza/punctuation
- Owner: honza
- License: other
- Created: 2011-09-23T01:59:49.000Z (about 13 years ago)
- Default Branch: master
- Last Pushed: 2011-09-23T02:08:15.000Z (about 13 years ago)
- Last Synced: 2024-04-16T01:44:55.663Z (7 months ago)
- Language: Python
- Homepage:
- Size: 97.7 KB
- Stars: 2
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Punctuation
===========`punctuation` is a Python utility that converts common punctuation markers in a
string of text into proper HTML entities.Source HTML entity Description
----------------------------------------------------------------------
--- — em dash
-- – en dash
"" ... "" “ and ” opening and closing double quotes
' ... ' ‘ and ’ opening and closing single quotes
' ’ apostropheInstallation
------------Install with pip:
$ pip install punctuation
Or, the latest from Github:
$ pip install -e git+git://github.com/honza/punctuation.git#egg=punctuation
Usage
-----Command line utility:
$ punctuation path/to/file.html
Or, API:
from punctuation import HtmlPunctuationMaker
string = "This is a test---that's right"
html = HtmlPunctuationMaker(string).html
print html
>>>
"This is a test—that’s right"Credits
-------The recommendations and entity characters come from the excellent [The Trouble
With EM & EN (and Other Shady Characters)][1] article.License
-------BSD, short and sweet.
[1]: http://www.alistapart.com/articles/emen/