tractatus/.venv-docs/lib/python3.12/site-packages/docx/styles/__init__.py
TheFlow ac2db33732 fix(submissions): restructure Economist package and fix article display
- Create Economist SubmissionTracking package correctly:
  * mainArticle = full blog post content
  * coverLetter = 216-word SIR— letter
  * Links to blog post via blogPostId
- Archive 'Letter to The Economist' from blog posts (it's the cover letter)
- Fix date display on article cards (use published_at)
- Target publication already displaying via blue badge

Database changes:
- Make blogPostId optional in SubmissionTracking model
- Economist package ID: 68fa85ae49d4900e7f2ecd83
- Le Monde package ID: 68fa2abd2e6acd5691932150

Next: Enhanced modal with tabs, validation, export

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-24 08:47:42 +13:00

40 lines
1.4 KiB
Python

"""Sub-package module for docx.styles sub-package."""
from __future__ import annotations
from typing import Dict
class BabelFish:
"""Translates special-case style names from UI name (e.g. Heading 1) to
internal/styles.xml name (e.g. heading 1) and back."""
style_aliases = (
("Caption", "caption"),
("Footer", "footer"),
("Header", "header"),
("Heading 1", "heading 1"),
("Heading 2", "heading 2"),
("Heading 3", "heading 3"),
("Heading 4", "heading 4"),
("Heading 5", "heading 5"),
("Heading 6", "heading 6"),
("Heading 7", "heading 7"),
("Heading 8", "heading 8"),
("Heading 9", "heading 9"),
)
internal_style_names: Dict[str, str] = dict(style_aliases)
ui_style_names = {item[1]: item[0] for item in style_aliases}
@classmethod
def ui2internal(cls, ui_style_name: str) -> str:
"""Return the internal style name corresponding to `ui_style_name`, such as
'heading 1' for 'Heading 1'."""
return cls.internal_style_names.get(ui_style_name, ui_style_name)
@classmethod
def internal2ui(cls, internal_style_name: str) -> str:
"""Return the user interface style name corresponding to `internal_style_name`,
such as 'Heading 1' for 'heading 1'."""
return cls.ui_style_names.get(internal_style_name, internal_style_name)