Jonathan Eunice avatar Jonathan Eunice committed 3633165

tweaked docs, tests

Comments (0)

Files changed (3)

     from quoter import Quoter
     
     bars = Quoter('|')
-    print bars('x')
+    print bars('x')                    # |x|
     
     plus = Quoter('+','')
-    print plus('x')
+    print plus('x')                    # +x
     
     doublea = Quoter(chars='<<>>')
-    print doublea('AAA')
+    print doublea('AAA')               # <<AAA>>
     
     para = Quoter('<p>', '</p>')
-    print para('this is a paragraph')
+    print para('this is a paragraph')  # <p>this is a paragraph</p>
     
     variable = Quoter('${', '}')
-    print variable('x')
-    
-yields::
-
-    |x|
-    +x
-    <<AAA>>
-    <p>this is a paragraph</p>
-    ${x}
-    
-Note that ``bars`` specifies just once quote symbol. If only one is given,
+    print variable('x')                # ${x}
+        
+Note that ``bars`` specifies just one quote symbol. If only one is given,
 the prefix and suffix are considered to be identical. If you really only want
 a prefix or a suffix, and not both, then define the ``Quoter`` with one of them
 as the empty string, as in ``plus`` above. For symmetrical quotes (i.e. where
 have to specify prefix and suffix separately. Use the ``chars`` attribute and
 the given string will be split in two.
 
+In most cases, it's cleaner and more efficient to define a style, but
+there's nothing preventing you from an on-the-fly usage::
+
+    print Quoter(chars='+[  ]+')('castle')   # +[ castle ]+
+
 Formatting and Encoding
 =======================
 
     <p class='question'>this is great?</p>
     <br>
 
-``HTMLQuoter`` basically works, but buyer beware: It's not as well tested as the
-rest of the module.
-
 ``HTMLQuoter`` quotes attributes by default with single quotes. If you
 prefer double quotes, you may set them when the element is defined::
 
     div = HTMLQuoter('div', attquote=double)
 
+``HTMLQuoter`` basically works, but buyer beware: It's not as well tested as the
+rest of the module.
+
 Installation
 ============
 
 
 setup(
     name='quoter',
-    version=verno("0.1"),
+    version=verno("0.102"),
     author='Jonathan Eunice',
     author_email='jonathan.eunice@gmail.com',
     description="A simple way to quote text",
     assert ' '.join([qs('one'), qd('two'), qb('and'), qt('three')]) == \
         "'one' \"two\" `and` \"\"\"three\"\"\""
     
+def test_instant():
+    assert Quoter(chars='+[  ]+')('castle') == '+[ castle ]+'
+    
 def test_lambda():
     f = lambda v: ('(', abs(v), ')') if v < 0 else ('', v, '')
     financial = LambdaQuoter(f)
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.