Enable producing fully standalone html file
This optionally inlines all the plot images as data-uris. For SVG it tries to be smart and encode it directly as ascii SVG (SVG being natively ASCII) to save some space.
Note: this always inlines the layout images etc into the HTML file. I think this is fine to do as it only negligibly increases the HTML file size as opposed to inlining the plots. In principle, this can also be made optionally.
Merge request reports
Activity
Here's an example standalone file: dcube.html.zip
- Resolved by Paul Gessinger
Very nice! I have a couple of suggestions for improvement:
- add a
title
attribute (or maybe it's something else) to make sureSave Image As
gives a unique filename. For compatibility, this could be the.png
filename. Even nicer, would be to use something likeresolution_vs_eta_d0.png
- based on plot name. - remove or don't copy all the other files that aren't needed when everything is in
dcube.html
. Well, maybe still wantdcube.log
anddcube.xml
. And maybe only do this if--web-display=html
(no PHP). Would also be good to use a temporary directory for the plots files, which could be much much faster.
I could probably take a look at either or both of these if you like. In any case, they can probably wait for a separate MR.
Edited by Tim Adye- add a
Thanks @adye
- I don't think this is possible. Data URI does not have a way to communicate a file name, and you can only specify the recommended download filename on
a
. I think this is just going to have to be a limitation of the standalone format (and hence why it's good to have it optional). Anyway, as a workaround I at ana
labeled "Download" that does this with the original filename. This doesn't work with a link to an image file that's actually an HTTP url, so the link is only shown in inline mode. - For the server files this is easy enough. For the temp dir: there's no great way to communicate a common temporary directory. What I do now is always attaching a temporary directory to
self.opts
because that's passed to all the objects, and always deleted at the end of the job. If--inline-plots
is given, the plot directory is rerouted there, otherwise it stays empty.
- I don't think this is possible. Data URI does not have a way to communicate a file name, and you can only specify the recommended download filename on
added 7 commits
Toggle commit listI'm still looking through the code changes in detail, but it looks good so far. My testing shows:
- The PHP mode works without
--inline-plots
, but theNormal View
button image is missing. This isn't serious - you can still select the text - but would be good to fix. - As expected, PHP mode doesn't show any plots with
--inline-plots
. Can we disable the PHP output in this case? That way we don't even have the link from the.html
file, and don't need to generate the.php
files. That can be done by forcing--web-display=html
if--inline-plots
is specified. -
WithAh, I see this is properly dropped with--inline-plots
, I guess we don't need to copy anything toDCubeServer
.--web-display=html
- The PHP mode works without
- Resolved by Tim Adye
I committed a few small changes to remove now-unused variables. It seems in this repo, I have the power!
I hope that's OK.Edited by Tim Adyeadded 1 commit
- 229009a6 - fix tab bar for php. Remove remaining references to deleted sel_tp_left/title/right CSS classes
With that last commit, I think the only outstanding issue is in the unresolved thread above, which I'll leave to @pagessin.
In the meantime, I looked through the rest of the code changes and it all looks good. So I can merge as soon as the
dl is null
issue is fixed.added 1 commit
- 3098c27d - conditionally set href on the download links
added 1 commit
- f1c6323e - remove more unneeded vars. Use self.css and self.js
mentioned in commit 314d0927