summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYu-Jie Lin <livibetter@gmail.com>2013-08-14 13:48:43 +0800
committerYu-Jie Lin <livibetter@gmail.com>2013-08-14 13:48:43 +0800
commit7f138eb8923c1eda0e8ff5fd8d0f1968cfdeba64 (patch)
tree02219a11b850969b6f6e56e4cf89758d6e8b6d1b
parenta439633a0421453a4d58ed480d795cfd8368b44a (diff)
downloadsmartypants-7f138eb8923c1eda0e8ff5fd8d0f1968cfdeba64.tar.gz
add long_description and test, edit README and setup
-rw-r--r--README-PyPI.rst43
-rw-r--r--README.rst71
-rwxr-xr-xsetup.py14
-rwxr-xr-xsmartypants.py4
-rw-r--r--tests/test_setup.py22
5 files changed, 78 insertions, 76 deletions
diff --git a/README-PyPI.rst b/README-PyPI.rst
new file mode 100644
index 0000000..e415c6d
--- /dev/null
+++ b/README-PyPI.rst
@@ -0,0 +1,43 @@
+smartypants.py
+==============
+
+smartypants.py_ is a Python port of SmartyPants_.
+
+.. _smartypants.py: https://bitbucket.org/livibetter/smartypants.py
+.. _SmartyPants: http://daringfireball.net/projects/smartypants/
+
+Installation
+------------
+
+To install it:
+
+.. code:: sh
+
+ pip install smartypants
+
+Quick usage
+-----------
+
+To use it as a module:
+
+.. code:: python
+
+ import smartypants
+
+ text = '"SmartyPants" is smart, so is <code>smartypants.py</code> -- a Python port'
+ print(smartypants.smartyPants(text))
+
+To use the command-line script ``smartypants``:
+
+.. code:: sh
+
+ echo '"SmartyPants" is smart, so is <code>smartypants.py</code> -- a Python port' | smartypants
+
+Both produce::
+
+ &#8220;SmartyPants&#8221; is smart, so is <code>smartypants.py</code> &#8212; a Python port
+
+More information
+----------------
+
+Please visit smartypants.py_ on Bitbucket.
diff --git a/README.rst b/README.rst
index 603cd75..0ea6c75 100644
--- a/README.rst
+++ b/README.rst
@@ -41,8 +41,7 @@ smartypants.py can be installed vi pip::
Usage
=====
-As module
----------
+Using as module:
.. code:: python
@@ -51,17 +50,16 @@ As module
text = '"SmartyPants" is smart, so is <code>smartypants.py</code> -- a Python port'
print(smartypants.smartyPants(text))
-It outputs::
- &#8220;SmartyPants&#8221; is smart, so is <code>smartypants.py</code> &#8212; a Python port
-
-
-Via CLI
--------
+smartypants.py ships with a command-line script called ``smartypants``, it can be invoked like:
.. code:: sh
$ echo '"SmartyPants" is smart, so is <code>smartypants.py</code> -- a Python port' | smartypants
+
+
+Both produce same output::
+
&#8220;SmartyPants&#8221; is smart, so is <code>smartypants.py</code> &#8212; a Python port
@@ -173,65 +171,10 @@ transformations from within the SmartyPants attributes:
regular quotes so SmartyPants can educate them.
-Caveats
-=======
-
-Why You Might Not Want to Use Smart Quotes in Your Weblog
----------------------------------------------------------
-
-For one thing, you might not care.
-
-Most normal, mentally stable individuals do not take notice of proper
-typographic punctuation. Many design and typography nerds, however, break
-out in a nasty rash when they encounter, say, a restaurant sign that uses
-a straight apostrophe to spell "Joe's".
-
-If you're the sort of person who just doesn't care, you might well want to
-continue not caring. Using straight quotes -- and sticking to the 7-bit
-ASCII character set in general -- is certainly a simpler way to live.
-
-Even if you I *do* care about accurate typography, you still might want to
-think twice before educating the quote characters in your weblog. One side
-effect of publishing curly quote HTML entities is that it makes your
-weblog a bit harder for others to quote from using copy-and-paste. What
-happens is that when someone copies text from your blog, the copied text
-contains the 8-bit curly quote characters (as well as the 8-bit characters
-for em-dashes and ellipses, if you use these options). These characters
-are not standard across different text encoding methods, which is why they
-need to be encoded as HTML entities.
-
-People copying text from your weblog, however, may not notice that you're
-using curly quotes, and they'll go ahead and paste the unencoded 8-bit
-characters copied from their browser into an email message or their own
-weblog. When pasted as raw "smart quotes", these characters are likely to
-get mangled beyond recognition.
-
-That said, my own opinion is that any decent text editor or email client
-makes it easy to stupefy smart quote characters into their 7-bit
-equivalents, and I don't consider it my problem if you're using an
-indecent text editor or email client.
-
-
-Algorithmic Shortcomings
-------------------------
-
-One situation in which quotes will get curled the wrong way is when
-apostrophes are used at the start of leading contractions. For example::
-
- 'Twas the night before Christmas.
-
-In the case above, SmartyPants will turn the apostrophe into an opening
-single-quote, when in fact it should be a closing one. I don't think
-this problem can be solved in the general case -- every word processor
-I've tried gets this wrong as well. In such cases, it's best to use the
-proper HTML entity for closing single-quotes (``&#8217;``) by hand.
-
-
Bugs
====
-To file bug reports or feature requests (other than topics listed in the
-Caveats_ section above), please `open an issue`__.
+To file bug reports or feature requests, please `open an issue`__.
__ https://bitbucket.org/livibetter/smartypants.py/issues/new
diff --git a/setup.py b/setup.py
index 9fc0e44..dde9ce9 100755
--- a/setup.py
+++ b/setup.py
@@ -190,21 +190,14 @@ with open(module_file) as f:
(line.split('=') for line in f if line.startswith('__'))
)
- # renaming meta-data keys
- meta_renames = [
- ('website', 'url'),
- ('email', 'author_email'),
- ]
- for old, new in meta_renames:
- if old in meta:
- meta[new] = meta[old]
- del meta[old]
-
# keep these
meta_keys = ['name', 'description', 'version', 'license', 'url', 'author',
'author_email']
meta = dict([m for m in meta.items() if m[0] in meta_keys])
+with open('README-PyPI.rst') as f:
+ long_description = f.read()
+
classifiers = [
'Development Status :: 5 - Production/Stable',
'Intended Audience :: Developers',
@@ -218,6 +211,7 @@ classifiers = [
setup_d = dict(
name=module_name,
+ long_description=long_description,
cmdclass={
'pep8': cmd_pep8,
'pyflakes': cmd_pyflakes,
diff --git a/smartypants.py b/smartypants.py
index 78d7ac9..1c55157 100755
--- a/smartypants.py
+++ b/smartypants.py
@@ -5,11 +5,11 @@
# Licensed under the BSD License, for detailed license information, see COPYING
__author__ = 'Yu-Jie Lin'
-__email__ = 'livibetter@gmail.com'
+__author_email__ = 'livibetter@gmail.com'
__version__ = '1.7.0dev'
__license__ = 'BSD License'
__url__ = 'https://bitbucket.org/livibetter/smartypants.py'
-__description__ = 'Smart-quotes, smart-ellipses, and smart-dashes'
+__description__ = 'Python with the SmartyPants'
default_smartypants_attr = "1"
diff --git a/tests/test_setup.py b/tests/test_setup.py
new file mode 100644
index 0000000..6f5f636
--- /dev/null
+++ b/tests/test_setup.py
@@ -0,0 +1,22 @@
+# Copyright (c) 2013 Yu-Jie Lin
+# Licensed under the BSD License, for detailed license information, see COPYING
+
+from docutils.core import publish_string
+import unittest
+
+
+class SetupTestCase(unittest.TestCase):
+
+ def test_long_description(self):
+ """Ensure long description can be generated"""
+ with open('README-PyPI.rst') as f:
+ long_description = f.read()
+
+ overrides = {
+ # raises exception at warning level (2)
+ 'halt_level': 2,
+ 'raw_enabled': False,
+ }
+ html = publish_string(long_description, writer_name='html',
+ settings_overrides=overrides)
+ self.assertTrue(html)