-
-
Notifications
You must be signed in to change notification settings - Fork 120
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
Added alias table for deprecated css properties #552
base: main
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
.cache | ||
.output |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,6 +9,7 @@ import ( | |
"log" | ||
"os" | ||
"path" | ||
"sort" | ||
) | ||
|
||
type ExportType int | ||
|
@@ -21,7 +22,7 @@ const ( | |
|
||
const ( | ||
exportType = Both | ||
ResourcePath = "crates/gosub_styling/resources/definitions" | ||
ResourcePath = ".output" | ||
SingleFilePath = ResourcePath + "/definitions.json" | ||
MultiFileDir = ResourcePath | ||
MultiFilePrefix = "definitions_" | ||
|
@@ -41,7 +42,30 @@ func main() { | |
len(webrefData.Properties), len(webrefData.Values), len(webrefData.AtRules), len(webrefData.Selectors), | ||
) | ||
|
||
sort.Slice(webrefData.Properties, func(i, j int) bool { | ||
return webrefData.Properties[i].Name < webrefData.Properties[j].Name | ||
}) | ||
|
||
for _, property := range webrefData.Properties { | ||
|
||
if property.Syntax == "" { | ||
alias, err := webref.GetAlias(property.Name) | ||
if err != nil { | ||
log.Panic("failed to get alias syntax for property: " + property.Name) | ||
} | ||
|
||
for wdp := range webrefData.Properties { | ||
if webrefData.Properties[wdp].Name == alias { | ||
property.Syntax = webrefData.Properties[wdp].Syntax | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I wouldn't straight up copy the syntax, I think it makes sense to also add a property that it is an alias and which prop it aliases. So we can copy the value in the matching part directly to the aliased prop. So when we have This makes it easier in the mask implementation, since we only need to check for There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. that might make sense There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i'll move the aliases to a separate "alias" listing, and pick them up in the matcher |
||
break | ||
} | ||
} | ||
|
||
if property.Syntax == "" { | ||
log.Panic("failed to get alias syntax for property: " + property.Name) | ||
} | ||
} | ||
|
||
prop := utils.Property{ | ||
Name: property.Name, | ||
Syntax: property.Syntax, | ||
|
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.
I'm not sure if we want to sort the properties alphabetically, it might make more sense to sort them after its spec.
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.
how do you mean?
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.
When you are looking for a specific prop, and it's syntax, the computed props might be nearer then, since they are all defined in the same spec.
I guess for expanded props it isn't really an issue, since of
grid
ormask
, they all also start withgrid-
ormask
.