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
saveWidget doesn't specify a <title> element #289
Comments
I noticed the same thing with jjallaire/sigma. I installed pandoc-1.19.2.1 and pandoc-2.0.1 under C:\Pandoc and switched between them by fiddling with htmlwidgets:::.pandoc. When using
Is this because htmlwidgets:::pandoc_self_contained_html claims to pandoc
|
Fixing the @BillDunlap based on the output you posted, it seems like pandoc is escaping html tags. I will try to reproduce this with pandoc 2.0.1 and the latest version of |
With pandoc-2.0.1 you also do not get the base64 encoding of the
supporting library
scripts. My suspicion is that when you claim the input is markdown but it
is really
html, pandoc-2.0.1 will give you problems.
At this point, is pandoc only being used to incorporate the library scripts
into the main
file and to base64 encode them? If so, we could do that in R code.
…On Thu, Nov 2, 2017 at 5:05 PM, Ramnath Vaidyanathan < ***@***.***> wrote:
Fixing the title requirement is straightforward. We can explicitly allow
users to specify a title in saveWidget. What should we default it to? Any
thoughts @cpsievert <https://github.com/cpsievert>.
@BillDunlap <https://github.com/billdunlap> based on the output you
posted, it seems like pandoc is escaping html tags. I will try to reproduce
this with pandoc 2.0.1 and the latest version of htmlwidgets.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#289 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ALHWBWzb4eMQy6R_GcUibpHgYFxW7gFCks5syli2gaJpZM4QO7L_>
.
|
@BillDunlap |
I am also having this issue. Any updates? |
I am not very familiar with all of what htmlwidgets can do, but the
following function makes a self-contained html file similar to the one
pandoc makes if all the required files are *.js files and if there is no
need to recursively process the required files. Apply it to the
readLInes() of the file
that htmlwidgets::saveWidget(selfcontained=FALSE,...) produces, after
setting the working directory to dirname() of that html file and then call
writeLines() on its output.
It uses regular expressions instead parsing the html so it is not robust,
but it helped me see what was going on.
replaceScriptSrcLines <- function(htmlText)
{
# replace lines of form
# <script src="dir/file.js"></script>
# by
# <script
src="data:application/x-javascript;base64,*BASE64_ENCODED_JSFILE*"></script>"
# where *BASE64_ENCODED_JSFILE* is the string returned by
base64enc::base64encode("dir/file.js").
# Apply this to readLines() of the file that
srcPattern <- "(^.*<script src=\")([^:\"]+.js)(\"></script>.*)"
srcLineNos <- grep(srcPattern, htmlText)
cap <- strcapture(srcPattern, htmlText[srcLineNos],
proto=list(start="", script="", end=""))
for(j in seq_along(srcLineNos)) {
htmlText[srcLineNos[j]] <- paste0(cap$start[j],
"data:application/x-javascript;base64,",
base64enc::base64encode(cap$script[j]), cap$end[j])
}
htmlText
}
…On Mon, Nov 13, 2017 at 1:59 PM, Kiefer Smith ***@***.***> wrote:
I am also having this issue. Any updates?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#289 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ALHWBQ15iRrOuQhKxy2HrVaufIPmElCyks5s2LvUgaJpZM4QO7L_>
.
|
I seem to have circumvented the issue via |
I'm going to submit a PR for this (the original issue) today. My proposal is that |
That sounds good to me!
…On Tue, Nov 14, 2017 at 1:52 PM, Joe Cheng ***@***.***> wrote:
I'm going to submit a PR for this (the original issue) today. My proposal
is that saveWidget will get a new title parameter that defaults to
class(widget)[[1]]. Any objections to that?
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#289 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAGXx45RjeWiYqGdgrscJ_gJoUjWVW0rks5s2eFygaJpZM4QO7L_>
.
|
Turns out this is significantly more annoying than we originally thought. The
Rather than try to feed pandoc a well-formed HTML document, I think it's a better idea to fork the body of |
This was fixed by #292 |
And, as consequence, produces unsavory results with pandoc >= 2.0
The text was updated successfully, but these errors were encountered: