diff options
| author | Michael Williamson <mike@zwobble.org> | 2017-04-03 18:50:22 +0100 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2017-04-03 18:50:22 +0100 |
| commit | a22b48bb0ee1bd3411419c4c96c2b6d753bc2937 (patch) | |
| tree | 56d8532bbb966dc955df6a907a10dcb4469df721 | |
| parent | 4f201e920f95c675904033c91cf6b616b0fdf870 (diff) | |
Make font example case-insensitive
| -rw-r--r-- | README.md | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -408,11 +408,11 @@ Or if you want paragraphs that have been explicitly set to use monospace fonts t import mammoth.documents import mammoth.transforms -_monospace_fonts = set(["Courier New"]) +_monospace_fonts = set(["courier new"]) def transform_paragraph(paragraph): runs = mammoth.transforms.get_descendants_of_type(paragraph, mammoth.documents.Run) - if runs and all(run.font in _monospace_fonts for run in runs): + if runs and all(run.font and run.font.lower() in _monospace_fonts for run in runs): return paragraph.copy(style_id="code", style_name="Code") else: return paragraph |
