-
-
Notifications
You must be signed in to change notification settings - Fork 30
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
WIP: Added additional arg for turning styles into properties #139
Draft
kastolars
wants to merge
9
commits into
Stranger6667:master
Choose a base branch
from
kastolars:karol/138
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
209036e
Added additional arg for turning styles into properties
kastolars 8a2a072
Added line for handling new styles as property option
kastolars cb4dd0b
Added builder function and changed process_css extra_css argument as …
kastolars 8f75d56
Changed naming of props to attributes
kastolars 7a9c350
Updated python bindings with new flag
kastolars 8d61dc4
Updated wasm bindings and python bindings tests with new flag
kastolars 0959ecc
Changed comment to 'separate attributes'
kastolars 1b9bc34
Change text to 'separate attributes'
kastolars 3365a79
Added branch for inserting attributes
kastolars File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here we'd have a similar situation to the branchs below:
styles
(similar to line 319) and callattributes.insert
with rule name / value.attributes
, merged with collected styles, and then those "final" styles should be inserted intoattributes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay so within the conditional branch I created, we will have 2 conditional branches?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay so I think I got the first bullet point completed, I'm not quite sure if I understand the second one yet, but it's also a bit late for me haha. Will take a look tomorrow.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome! I think we can use
attribute.remove
straight away instead ofget_mut
(it returns Option), so the output doesn't have the "style" attribute.For the second point, the workflow would look like the other branch with
attributes.insert
, but the existing "style" value should be merged together with ones collected from "style" tags (or other places).At the moment,
merge_styles
outputsResult<String>
which is not exactly what is needed. Instead, there could be a new function that will insert new attributes intoattributes
instead of pushing them to a string.Something like this
And the last branch would look like this:
I didn't test these code samples, but they should be alright :) The main idea is that existing "style" attribute styles are inserted as separate attributes immediately as they have the maximum priority, then the other ones are inserted only if they aren't clashing with already inserted ones.
Then, there is a small corner case with quoting the value (see the
replace_double_quotes
macro). Before inserting, each property name & value should be checked:which could be also a small macro (the naming probably isn't much important - maybe
insert_unquoted
?)Then, I think a few tests would be nice to have :) And a changelog entry