Commits

Luke Stebbing committed 960e1ee

Document 'text'.

Comments (0)

Files changed (2)

docs/modules/text.rst

 .. automodule:: webhelpers.text
 
 .. currentmodule:: webhelpers.text
+
+.. autofunction:: chop_at
+.. autofunction:: collapse
+.. autofunction:: convert_accented_entities
+.. autofunction:: convert_misc_characters
+.. autofunction:: convert_misc_entities
+.. autofunction:: excerpt
+.. autofunction:: lchop
+.. autofunction:: plural
+.. autofunction:: rchop
+.. autofunction:: remove_formatting
+.. autofunction:: replace_whitespace
+.. autofunction:: series
+.. autofunction:: strip_leading_whitespace
+.. autofunction:: truncate 
+.. autofunction:: urlify
+.. autofunction:: wrap_paragraphs

webhelpers/text.py

     """Return the singular or plural form of a word, according to the number.
 
     Usage:
+
     >>> plural(2, "ox", "oxen")
     '2 oxen'
     >>> plural(2, "ox", "oxen", False)
 def convert_accented_entities(string):
     """Converts HTML entities into the respective non-accented letters.
     
-    Examples:
+    Examples::
     
-      "á".convert_accented_entities #: "a"
-      "ç".convert_accented_entities #: "c"
-      "è".convert_accented_entities #: "e"
-      "î".convert_accented_entities #: "i"
-      "ø".convert_accented_entities #: "o"
-      "ü".convert_accented_entities #: "u"
+      >>> convert_accented_entities("á")
+      'a'
+      >>> convert_accented_entities("ç")
+      'c'
+      >>> convert_accented_entities("è")
+      'e'
+      >>> convert_accented_entities("î")
+      'i'
+      >>> convert_accented_entities("ø")
+      'o'
+      >>> convert_accented_entities("ü")
+      'u'
     
     Note: This does not do any conversion of Unicode/ASCII
     accented-characters. For that functionality please use unidecode.
     
     Examples::
       
-        convert_misc_characters("foo & bar") #: "foo and bar"
-        convert_misc_characters("Chanel #9") #: "Chanel number nine"
-        convert_misc_characters("user@host") #: "user at host"
-        convert_misc_characters("google.com") #: "google dot com"
-        convert_misc_characters("$10") #: "10 dollars"
-        convert_misc_characters("*69") #: "star 69"
-        convert_misc_characters("100%") #: "100 percent"
-        convert_misc_characters("windows/mac/linux") #: "windows slash mac slash linux"
+        >>> convert_misc_characters("foo & bar")
+        'foo and bar'
+        >>> convert_misc_characters("Chanel #9")
+        'Chanel number nine'
+        >>> convert_misc_characters("user@host")
+        'user at host'
+        >>> convert_misc_characters("google.com")
+        'google dot com'
+        >>> convert_misc_characters("$10")
+        '10 dollars'
+        >>> convert_misc_characters("*69")
+        'star 69'
+        >>> convert_misc_characters("100%")
+        '100 percent'
+        >>> convert_misc_characters("windows/mac/linux")
+        'windows slash mac slash linux'
       
     Note: Because this method will convert any '&' symbols to the string
     "and", you should run any methods which convert HTML entities 
     Defaults to a single space but any replacement string may be
     specified as an argument. Examples::
 
-        replace_whitespace("Foo       bar") # => "Foo bar"
-        replace_whitespace("Foo       bar", "-") # => "Foo-bar"
+        >>> replace_whitespace("Foo       bar")
+        'Foo bar'
+        >>> replace_whitespace("Foo       bar", "-")
+        'Foo-bar'
     
     Based on Ruby's stringex package
     (http://github.com/rsl/stringex/tree/master)
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.