mwilliamson / python-mammoth

Convert Word documents (.docx files) to HTML
BSD 2-Clause "Simplified" License
785 stars 121 forks source link

all-caps style-mapping rule not understood #98

Closed valentinoli closed 3 years ago

valentinoli commented 3 years ago

Hello

I tried using the following rule in my style-map but mammoth would not parse it.

all-caps => span.b-uppercase

I expect explicitly applied uppercasing to be mapped as

<span class="b-uppercase">{text}</span>

I received the following warning message:

Did not understand this style mapping, so ignored it: all-caps => span.b-uppercase

mammoth version: 1.4.12 Python version: 3.9.1 OS: Windows 10

mwilliamson commented 3 years ago

Hmm, that's strange. Could you upload thethe style map file you're using?

valentinoli commented 3 years ago

Thanks for the prompt response! Here it is (the first part of it):

# Inline mappings
i => span.b-italic
b => span.b-bold
u => span.b-underline
small-caps => span.b-smallcaps
all-caps => span.b-uppercase

# Ignored generic styles
p[style-name='Normal'] => !
p[style-name='Heading 1'] => !
p[style-name='Heading 2'] => !
p[style-name='Heading 3'] => !
p[style-name='Heading 4'] => !
p[style-name='Heading 5'] => !
p[style-name='Heading 6'] => !
# ...
mwilliamson commented 3 years ago

Could you upload the file, rather than copying and pasting it, to make sure that I've got the file exactly as you do?

valentinoli commented 3 years ago

Ah yes of course style-map.txt

mwilliamson commented 3 years ago

Ah, I should have paid attention to your original description: you're using a version of Mammoth before support was added for all-caps.

valentinoli commented 3 years ago

Ahhh, that's it! Thank you :)