about summary refs log tree commit diff
path: root/.venv/lib/python3.12/site-packages/docx/styles/__init__.py
diff options
context:
space:
mode:
authorS. Solomon Darnell2025-03-28 21:52:21 -0500
committerS. Solomon Darnell2025-03-28 21:52:21 -0500
commit4a52a71956a8d46fcb7294ac71734504bb09bcc2 (patch)
treeee3dc5af3b6313e921cd920906356f5d4febc4ed /.venv/lib/python3.12/site-packages/docx/styles/__init__.py
parentcc961e04ba734dd72309fb548a2f97d67d578813 (diff)
downloadgn-ai-master.tar.gz
two version of R2R are here HEAD master
Diffstat (limited to '.venv/lib/python3.12/site-packages/docx/styles/__init__.py')
-rw-r--r--.venv/lib/python3.12/site-packages/docx/styles/__init__.py40
1 files changed, 40 insertions, 0 deletions
diff --git a/.venv/lib/python3.12/site-packages/docx/styles/__init__.py b/.venv/lib/python3.12/site-packages/docx/styles/__init__.py
new file mode 100644
index 00000000..6358baf3
--- /dev/null
+++ b/.venv/lib/python3.12/site-packages/docx/styles/__init__.py
@@ -0,0 +1,40 @@
+"""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)