CtrlK
CommunityDocumentationLog inGet started
Tessl Logo

tessl/pypi-titlecase

tessl install tessl/pypi-titlecase@2.4.0

Python port of John Gruber's titlecase.pl for intelligent title case conversion with style guide compliance

Agent Success

Agent success rate when using this tile

79%

Improvement

Agent success rate improvement when using this tile compared to baseline

0.92x

Baseline

Agent success rate without this tile

86%

task.mdevals/scenario-7/

Article Title Formatter

Build a utility to format article titles and quotes following journalistic title case standards.

Problem Description

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:

  • Titles with quoted text that need proper capitalization
  • Small words that appear at the beginning of quoted phrases
  • Mixed quote types (single and double quotes)
  • Multiple quoted segments within a single title

Requirements

Create a Python module with a format_title function that:

  • Takes a string input representing a raw title
  • Returns the properly formatted title with correct capitalization
  • Properly capitalizes small words when they appear at the start of quoted phrases
  • Handles both single and double quotes correctly

Test Cases

  • Converting 'by the way, small word at the start but within quotes.' produces 'By the Way, Small Word at the Start but Within Quotes.' @test
  • Converting "nothing to be afraid of?" produces "Nothing to Be Afraid Of?" @test
  • Converting the article titled "a new beginning" was published produces The Article Titled "A New Beginning" Was Published @test
  • Converting she said 'the end of the world' produces She Said 'The End of the World' @test

Implementation

@generates

API

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
    """
    pass

Dependencies { .dependencies }

titlecase { .dependency }

Provides intelligent title case conversion with quote handling support.

@satisfied-by

Version

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
pypipkg:pypi/titlecase@2.4.x
tile.json