{"id":17153686,"url":"https://github.com/vinodbaste/python_headline_style","last_synced_at":"2025-03-24T13:13:31.940Z","repository":{"id":65392955,"uuid":"591476286","full_name":"vinodbaste/python_headline_style","owner":"vinodbaste","description":"This filter changes a given text 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'.","archived":false,"fork":false,"pushed_at":"2023-01-21T12:29:10.000Z","size":47,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-01T23:19:27.964Z","etag":null,"topics":["library","package","python","pythonpackage"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/vinodbaste.png","metadata":{"files":{"readme":"README.rst","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2023-01-20T21:14:02.000Z","updated_at":"2023-02-09T16:16:55.000Z","dependencies_parsed_at":"2023-02-12T09:46:08.253Z","dependency_job_id":null,"html_url":"https://github.com/vinodbaste/python_headline_style","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vinodbaste%2Fpython_headline_style","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vinodbaste%2Fpython_headline_style/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vinodbaste%2Fpython_headline_style/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vinodbaste%2Fpython_headline_style/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vinodbaste","download_url":"https://codeload.github.com/vinodbaste/python_headline_style/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245276190,"owners_count":20588894,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["library","package","python","pythonpackage"],"created_at":"2024-10-14T21:46:59.828Z","updated_at":"2025-03-24T13:13:31.915Z","avatar_url":"https://github.com/vinodbaste.png","language":"Python","readme":"headline_style\n=========\n\nThis filter changes a given text to Title Caps, and attempts to be clever\nabout SMALL words like a/an/the in the input.\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\nThe filter employs some heuristics to guess abbreviations that don't need conversion.\n\n+------------------+----------------+\n| Original         | Conversion     |\n+==================+================+\n| this is a test   | This Is a Test |\n+------------------+----------------+\n| THIS IS A TEST   | This Is a Test |\n+------------------+----------------+\n| this is a TEST   | This Is a TEST |\n+------------------+----------------+\n\n\nMore examples and expected behavior for corner cases are available in the\n`package test suite \u003chttps://github.com/vinodbaste/python_headline_style/blob/main/headLineStyle/tests.py\u003e`__.\n\nIssues, updates, pull requests, etc should be directed\n`to github \u003ca href=\"https://github.com/vinodbaste/python_headline_style\u003e`__.\n\nInstallation\n------------\n\nThe easiest method is to simply use pip:\n\n    (sudo) pip install headline_style\n\n\nUsage\n-----\n\nheadline_style provides only one function, simply:\n\n.. code-block:: python\n    \u003e\u003e\u003e from headLineStyle import headLineStyle\n    \u003e\u003e\u003e headLineStyle('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    \u003e\u003e\u003e def abbreviations(word, **kwargs):\n    ...   if word.upper() in ('TCP', 'UDP'):\n    ...     return word.upper()\n    ...\n    \u003e\u003e\u003e headLineStyle.headLineStyle('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 headLineStyle to process the word as normal.\n\nCommand Line Usage\n------------------\nheadLineStyle also provides a command line utility ``headLineStyle``:\n\n.. code-block:: python\n    $ headLineStyle make me a title\n    Make Me a Title\n    $ echo \"Can pipe and/or whatever else\" | headLineStyle\n    Can Pipe and/or Whatever Else\n    # Or read/write files:\n    $ headLineStyle -f infile -o outfile\n\nIn addition, commonly used acronyms can be kept in a local file\nat `~/.headLineStyle.txt`. This file contains one acronym per line.\nThe acronym will be maintained in the title as it is provided.\nOnce there is e.g. one line saying `TCP`, then it will be automatically\nused when used from the command line.\n\n.. code-block:: python\n    $ headLineStyle I LOVE TCP\n    I Love TCP\n\n\nLimitations\n-----------\n\nThis is a best-effort library that uses regexes to try to do intelligent\nthings, but will have limitations. For example, it does not have the contextual\nawareness to distinguish acronyms from words: us (we) versus US (United States).\n\nThe regexes and titlecasing rules were written for American English. While\nthere is basic support for Unicode characters, such that something like\n\"El Niño\" will work, it is likely that accents or non-English phrases will\nnot be handled correctly.\n\nIf anyone has concrete solutions to improve these or other shortcomings of the\nlibrary, pull requests are very welcome!\n\n# License\n-----------\nCopyright [2022] [Vinod Baste]\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n    http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvinodbaste%2Fpython_headline_style","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvinodbaste%2Fpython_headline_style","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvinodbaste%2Fpython_headline_style/lists"}