titlecase


Nametitlecase JSON
Version 0.12.0 PyPI version JSON
download
home_pagehttps://github.com/ppannuto/python-titlecase
SummaryPython Port of John Gruber's titlecase.pl
upload_time2017-09-19 16:39:51
maintainer
docs_urlNone
authorPat Pannuto, Stuart Colville, John Gruber
requires_python
licenseMIT
keywords string formatting
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI
coveralls test coverage No coveralls.
            Titlecase
=========

.. image:: https://travis-ci.org/ppannuto/python-titlecase.svg?branch=master
    :target: https://travis-ci.org/ppannuto/python-titlecase
.. image:: https://coveralls.io/repos/github/ppannuto/python-titlecase/badge.svg?branch=master
    :target: https://coveralls.io/github/ppannuto/python-titlecase?branch=master

This filter changes all words to Title Caps, and attempts to be clever
about SMALL words like a/an/the in the input.

The list of "SMALL words" which are not capped comes from the New York
Times Manual of Style, plus some others like 'vs' and 'v'.

This is a resurrection of `Stuart Colville's
titlecase.py <https://muffinresearch.co.uk/titlecasepy-titlecase-in-python/>`__,
which was in turn a port of `John Gruber's
titlecase.pl <http://daringfireball.net/2008/05/title_case>`__.

Issues, updates, pull requests, etc should be directed
`to github <https://github.com/ppannuto/python-titlecase>`__.


Installation
------------

The easiest method is to simply use pip:

::

    (sudo) pip install titlecase


Usage
-----

Titlecase provides only one function, simply:

.. code-block:: python

    >>> from titlecase import titlecase
    >>> titlecase('a thing')
    'A Thing'

A callback function may also be supplied, which will be called for every word:

.. code-block:: python

    >>> def abbreviations(word, **kwargs):
    ...   if word.upper() in ('TCP', 'UDP'):
    ...     return word.upper()
    ...
    >>> titlecase.titlecase('a simple tcp and udp wrapper', callback=abbreviations)
    'A Simple TCP and UDP Wrapper'

The callback function is supplied with an ``all_caps`` keyword argument, indicating
whether the entire line of text was entirely capitalized. Returning ``None`` from
the callback function will allow titlecase to process the word as normal.


Command Line Usage
------------------

Titlecase also provides a command line utility ``titlecase``:

.. code-block:: python

    $ titlecase make me a title
    Make Me a Title
    $ echo "Can pipe and/or whatever else" | titlecase
    Can Pipe and/or Whatever Else
    # Or read/write files:
    $ titlecase -f infile -o outfile


            

Raw data

            {
    "maintainer": "", 
    "docs_url": null, 
    "requires_python": "", 
    "maintainer_email": "", 
    "cheesecake_code_kwalitee_id": null, 
    "keywords": "string formatting", 
    "upload_time": "2017-09-19 16:39:51", 
    "author": "Pat Pannuto, Stuart Colville, John Gruber", 
    "home_page": "https://github.com/ppannuto/python-titlecase", 
    "github_user": "ppannuto", 
    "download_url": "https://pypi.python.org/packages/3b/78/5b9faa7b9288c9fa5a4fdb6989f5e675744511ab6cff0489a0c7744a4f6b/titlecase-0.12.0.tar.gz", 
    "platform": "", 
    "version": "0.12.0", 
    "cheesecake_documentation_id": null, 
    "description": "Titlecase\n=========\n\n.. image:: https://travis-ci.org/ppannuto/python-titlecase.svg?branch=master\n    :target: https://travis-ci.org/ppannuto/python-titlecase\n.. image:: https://coveralls.io/repos/github/ppannuto/python-titlecase/badge.svg?branch=master\n    :target: https://coveralls.io/github/ppannuto/python-titlecase?branch=master\n\nThis filter changes all words to Title Caps, and attempts to be clever\nabout SMALL words like a/an/the in the input.\n\nThe list of \"SMALL words\" which are not capped comes from the New York\nTimes Manual of Style, plus some others like 'vs' and 'v'.\n\nThis is a resurrection of `Stuart Colville's\ntitlecase.py <https://muffinresearch.co.uk/titlecasepy-titlecase-in-python/>`__,\nwhich was in turn a port of `John Gruber's\ntitlecase.pl <http://daringfireball.net/2008/05/title_case>`__.\n\nIssues, updates, pull requests, etc should be directed\n`to github <https://github.com/ppannuto/python-titlecase>`__.\n\n\nInstallation\n------------\n\nThe easiest method is to simply use pip:\n\n::\n\n    (sudo) pip install titlecase\n\n\nUsage\n-----\n\nTitlecase provides only one function, simply:\n\n.. code-block:: python\n\n    >>> from titlecase import titlecase\n    >>> titlecase('a thing')\n    'A Thing'\n\nA callback function may also be supplied, which will be called for every word:\n\n.. code-block:: python\n\n    >>> def abbreviations(word, **kwargs):\n    ...   if word.upper() in ('TCP', 'UDP'):\n    ...     return word.upper()\n    ...\n    >>> titlecase.titlecase('a simple tcp and udp wrapper', callback=abbreviations)\n    'A Simple TCP and UDP Wrapper'\n\nThe callback function is supplied with an ``all_caps`` keyword argument, indicating\nwhether the entire line of text was entirely capitalized. Returning ``None`` from\nthe callback function will allow titlecase to process the word as normal.\n\n\nCommand Line Usage\n------------------\n\nTitlecase also provides a command line utility ``titlecase``:\n\n.. code-block:: python\n\n    $ titlecase make me a title\n    Make Me a Title\n    $ echo \"Can pipe and/or whatever else\" | titlecase\n    Can Pipe and/or Whatever Else\n    # Or read/write files:\n    $ titlecase -f infile -o outfile\n\n", 
    "tox": true, 
    "lcname": "titlecase", 
    "bugtrack_url": null, 
    "github": true, 
    "coveralls": false, 
    "name": "titlecase", 
    "license": "MIT", 
    "travis_ci": true, 
    "github_project": "python-titlecase", 
    "summary": "Python Port of John Gruber's titlecase.pl", 
    "split_keywords": [
        "string", 
        "formatting"
    ], 
    "author_email": "pat.pannuto+titlecase@gmail.com", 
    "urls": [
        {
            "has_sig": false, 
            "upload_time": "2017-09-19T16:39:53", 
            "comment_text": "", 
            "python_version": "3.6", 
            "url": "https://pypi.python.org/packages/1c/6b/1af08c2d82cf3bad9caf764bca8c398c78f811d0638e5cb268952f45c917/titlecase-0.12.0-py3-none-any.whl", 
            "md5_digest": "78f9dd45a2c5b4dd046a6a574c45b264", 
            "downloads": 0, 
            "filename": "titlecase-0.12.0-py3-none-any.whl", 
            "packagetype": "bdist_wheel", 
            "path": "1c/6b/1af08c2d82cf3bad9caf764bca8c398c78f811d0638e5cb268952f45c917/titlecase-0.12.0-py3-none-any.whl", 
            "size": 9660
        }, 
        {
            "has_sig": false, 
            "upload_time": "2017-09-19T16:39:51", 
            "comment_text": "", 
            "python_version": "source", 
            "url": "https://pypi.python.org/packages/3b/78/5b9faa7b9288c9fa5a4fdb6989f5e675744511ab6cff0489a0c7744a4f6b/titlecase-0.12.0.tar.gz", 
            "md5_digest": "238c9655b9943801b1816046dcedb00e", 
            "downloads": 0, 
            "filename": "titlecase-0.12.0.tar.gz", 
            "packagetype": "sdist", 
            "path": "3b/78/5b9faa7b9288c9fa5a4fdb6989f5e675744511ab6cff0489a0c7744a4f6b/titlecase-0.12.0.tar.gz", 
            "size": 7030
        }
    ], 
    "_id": null, 
    "cheesecake_installability_id": null
}