WeasyPrint
WeasyPrint copied to clipboard
Support text-emphasis
I want these feature:
But these feature is not support on latest version 60.2
Thank you.
Hi!
writing-mode is already discussed in #577.
text-emphasis could be interesting, and should be quite "simple" to have. Interested in proposing a pull request?
Hello! This is my first open-source contribution and I'm excited to be a part of it. I have some questions about how to implement these features.
I am working on the following properties:
text-emphasistext-emphasis-styletext-emphasis-colortext-emphasis-position
I started to add text_emphasis_style in the css/validation/properties.py file and then in css/properties.py.INITIAL_VALUES here is my progress and doubts:
Code
css/validation/properties.py
# ln-1605
@property()
@single_keyword
def text_emphasis_style(keyword):
return keyword in ('filled', 'open')
Is there a clear explanation about these decorators?
For this feature that can be manipulated as a general property text-emphasis and specific as text-emphasis-style, what are the recommendations to implement them?
css/properties.py.INITIAL_VALUES
# ln-191
'text_emphasis_style': 'none',
I added text_emphasis_style to INITIAL_VALUES dict, and I guess it needs to be added in INHERITED dict too, please confirm this.
testing
test_file.html
<style>
p.ex1 {
text-emphasis-style: filled;
text-emphasis-color: red;
}
</style>
<p class="ex1">This is some text.</p>
logs.log
Ignored `text-emphasis-color: red` at 4:13, unknown property.
text-emphasis-style now is accepted...
This feature requires position changes, such as putting text above a text, vertical orientation, etc, what would be the process to add this feature?
Thank you for being patient.
Hi @SrGitQ
Sorry for the delay, and thanks for your code!
It’s often easier to review code using pull requests. You can open a draft pull request if your code isn’t ready yet.
Is there a clear explanation about these decorators? For this feature that can be manipulated as a general property
text-emphasisand specific astext-emphasis-style, what are the recommendations to implement them?
The decorators are documented in properties.py, but the easiest way to discover what they do is to look at other validators.
text-emphasis is a shorthand property, you’ll have to put it in expanders.py (text-decoration could be a good example in your case.)
I guess it needs to be added in
INHERITEDdict too, please confirm this.
Yes, it’s inherited.
text-emphasis-stylenow is accepted...
\o/
This feature requires position changes, such as putting text above a text, vertical orientation, etc, what would be the process to add this feature?
If text emphasis doesn’t change the layout (to be verified in the specification), you follow what’s done for text decoration.