-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Issue with Leaflet's addPolygons in bs4_book #1491
Comments
The error comes from some Lines 308 to 314 in 882e8d4
Somehow, something makes the call That is what to look for |
I think the problem is that the file is too big for xml2 parser, but it does not throw any warning or error. From the code above, this is what we get:
Somehow, it does not see the
But it can find the two scripts for leaflet > xml2::xml_find_all(html, "//script[contains(@data-for, 'htmlwidget')]")
{xml_nodeset (2)}
[1] <script type="application/json" data-for="htmlwidget- ...
[2] <script type="application/json" data-for="htmlwidget- ... Something prevent the end of the file to be imported. It does not see any siblings after the > xml2::xml_find_all(html, "//head/following-sibling::*")
{xml_nodeset (1)}
[1] <body data-spy="scroll" data-target="#toc">\r\n\r\n<d ...
> xml2::xml_find_all(html, "//main/following-sibling::*")
{xml_nodeset (0)} Here is the full structure seen by xml2 - nothing after the last leaflet script
> xml2::xml_structure(html)
<html [lang]>
<head>
<meta [http-equiv, content]>
<meta [charset]>
<meta [name, content]>
<title>
{text}
<meta [name, content]>
<meta [name, content]>
<meta [name, content]>
<meta [property, content]>
<meta [property, content]>
<meta [property, content]>
<meta [name, content]>
<meta [name, content]>
<meta [name, content]>
{comment}
<script [src, integrity, crossorigin]>
<script [src, integrity, crossorigin]>
<script [src, crossorigin]>
<script [src]>
<meta [name, content]>
<link [href, rel]>
<script [src]>
<script [src]>
<script [src]>
<script [src]>
<link [href, rel]>
<script [src]>
<link [href, rel]>
<script [src]>
<link [href, rel]>
<script [src]>
<link [href, rel]>
<script [src]>
<script [src]>
<link [href, rel]>
<script [src]>
<script [src]>
<script [src]>
<script [src, integrity, crossorigin]>
<script [src, integrity, crossorigin]>
{comment}
<style [type]>
{cdata}
<style [type]>
{cdata}
<link [rel, href]>
<body [data-spy, data-target]>
{text}
<div [class]>
{text}
<div [class]>
{text}
<header [class]>
<a [class, href]>
{text}
{text}
<div [class]>
{text}
<h1>
{text}
<a [href, title]>
{text}
{text}
{text}
<button [class, type, data-toggle, data-target, aria-expanded, aria-controls]>
<i [class]>
<span [class]>
{text}
{text}
{text}
<div [id, class]>
{text}
<form [role]>
{text}
<input [id, class, type, placeholder, aria-label]>
{text}
<nav [aria-label]>
<h2>
{text}
{text}
<div [id]>
{text}
<div [class]>
{text}
<p>
<a [id, href]>
{text}
<i [class]>
{text}
{text}
{text}
<main [class, id]>
<div [id, class, number]>
{text}
<h1>
<span [class]>
{text}
{text}
{text}
<div [id, class, number]>
{text}
<h3>
<span [class]>
{text}
{text}
{text}
<div [class, id, style]>
{text}
<script [type, data-for]>
{cdata}
{text}
<div [id, class, number]>
{text}
<h3>
<span [class]>
{text}
{text}
{text}
<div [class, id, style]>
{text}
<script [type, data-for]>
{cdata} So to make this work, xml2 needs to be fixed. In bookdown I am not sure how we should handle it. |
I have open issue in xml2 |
@cderv Thanks for looking into this! |
I have a leaflet map inside of a
bs4_book
that I'm rendering usingbookdown
. I've noticed that when I add 2+ (number can be different depending on data)addPolygons()
to the leaflet map I get the following error message,I can render this map in the browser or in RStudio's Viewer tab just fine. If the number of
addPolyons()
is less than 2, it'll render.I try to render the book by running the following in the directory of the
index.Rmd
files, provided in the mwe.zip,bookdown::render_book('index.Rmd', 'all')
Session info (but also fails in GH action when I install most recent packages):
Checklist
When filing a bug report, please check the boxes below to confirm that you have provided us with the information we need. Have you:
formatted your issue so it is easier for us to read?
included a minimal, self-contained, and reproducible example?
pasted the output from
xfun::session_info('bookdown')
in your issue?upgraded all your packages to their latest versions (including your versions of R, the RStudio IDE, and relevant R packages)?
installed and tested your bug with the development version of the bookdown package using
remotes::install_github("rstudio/bookdown")
?The text was updated successfully, but these errors were encountered: