-
Notifications
You must be signed in to change notification settings - Fork 70
tagQuery(): Relocate html deps to child objects
#302
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
Conversation
|
I'm not saying we need to do this now, but there's another possible way to approach this which may simplify things in the long run: in the tag to tag-environment conversion, convert all html dependency attributes into children. This would provide a normalized data structure where the html deps are always children, instead of sometimes being children and sometimes being attributes. This does mean that when the tag env object is converted back into a tag, the structure will be changed, but I think that already happens in other ways. If we want to push this even further, it may make sense to always make html deps children, even on regular tag objects. For example, |
FWIW, I vaguely recall going down this road for something else and I'm pretty sure I backed out because it was going to break a lot of stuff (maybe because lots of people were using |
|
While I like the list item structure as well, I agree with @cpsievert . Moving to a list item completely breaks retrieving html deps using
I'm totally up for standardization, but it will cause breakages in the near term. |
|
I think it's arguable that the current behavior of library(htmltools)
x <- div("hello", htmlDependency("foo", "1.0", "/foo"))
htmlDependencies(x)
#> NULL
findDependencies(x)
#> [[1]]
#> List of 10
#> $ name : chr "foo"
#> $ version : chr "1.0"
#> $ src :List of 1
#> ..$ file: chr "/foo"
#> $ meta : NULL
#> $ script : NULL
#> $ stylesheet: NULL
#> $ head : NULL
#> $ attachment: NULL
#> $ package : NULL
#> $ all_files : logi TRUE
#> - attr(*, "class")= chr "html_dependency"In this search I see some cases where the code accesses At any rate, this isn't something we necessarily need to do in this PR, but if not, we should open another issue about it. |
wch
left a comment
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.
We can merge this, but should also file an issue referring back to the discussion here, about normalizing the html dependency data structures in general.
|
Hey, first of all thank you all for catching up on this issue! remotes::install_github("rstudio/htmltools", ref = "taglist_squash")Without looking into details I cannot notice any differences regarding my example given here. Cheers |
|
Dang. Still missed some. 😞 Will explore more soon. Maybe we use @wch's approach on the HTML deps for anything that goes through |
…ngs (where appropriate)
|
@DavidJesse21 Can you check again? I have confirmed it on my side, but want to be sure. Changes:
This works recursively and will expand on the children slots and remove the brittleness of attributes when flattening all This change seems warranted as the The agreement of |
|
This seems to work now, thank you :) |
tagQuery(): Copy html deps found on tag list items to the flattened tag listtagQuery(): Relocate html deps to child objects
Fixes #301
cc @DavidJesse21