Python port of John Gruber's titlecase.pl for intelligent title case conversion with style guide compliance
Overall
score
79%
Build a utility to format article titles and quotes following journalistic title case standards.
You need to create a title formatting system that properly handles titles containing quoted text. The system should capitalize quoted phrases correctly while following standard title case rules.
Your implementation should handle:
Create a Python module with a format_title function that:
'by the way, small word at the start but within quotes.' produces 'By the Way, Small Word at the Start but Within Quotes.' @test"nothing to be afraid of?" produces "Nothing to Be Afraid Of?" @testthe article titled "a new beginning" was published produces The Article Titled "A New Beginning" Was Published @testshe said 'the end of the world' produces She Said 'The End of the World' @test@generates
def format_title(title: str) -> str:
"""
Format a title string following journalistic title case standards.
Handles quoted phrases within titles, ensuring proper capitalization
of small words at the start of quoted segments.
Args:
title: The raw title string to format
Returns:
The formatted title with proper capitalization
"""
passProvides intelligent title case conversion with quote handling support.
@satisfied-by
Install with Tessl CLI
npx tessl i tessl/pypi-titlecasedocs
evals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
scenario-10