New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Docx Writer: Implement user-defined styles. #3070
Conversation
Divs with a "docx-style" key in the attributes will apply the corresponding key to the contained blocks.
This looks good to me. You might add to this PR some changes to MANUAL.txt, so this is documented, and of course tests. |
Bikeshedding: what do you think the key should be? I have The safest solution -- if we don't want to step on people's pass-through HTML -- would be to have a default key ( |
We want to be able to inject these into our styles.xml.
We're going to want `getMap` in the Docx Writer.
This injects new dynamic paragraph properties to be into the style file. Nothing occurs if the prop already exists in the style file.
This enables dynamic styling on spans. It uses the same prefix as we used on divs ("docx-style" for the moment). It does not yet inject the style into styles.xml.
Some new changes: it works with spans as well, and will also inject styles into style.xml if they don't exist. If they are already there, it doesn't mess with them. |
Use "custom-style" instead of "docx-style." This allows it to be used in other formats like ODT in the future.
Sometimes we will want to get back something different than we started with in a round-trip test. This allows for that, and makes the perfect roundtrip a special case.
This just tests whether a custom style with a recognizable style (italic etc, defined in a reference.docx) will roundtrip back to that format (i.e., whether `<span custom-style="Emphasized">` will roundtrip to `Emph`). The custom styles are defined in the `custom-style-reference.docx` included in the docx dir.
This supersedes #3069.
This is an RFC PR (I'll be writing to the mailing list) and shouldn't be considered final.
This would allow users to dynamically control the styles on docx output. People could either write divs by hand or -- more what I had in mind -- script to control indentation or whatever.
A few notes: