Message Boards Message Boards

1
|
10340 Views
|
6 Replies
|
4 Total Likes
View groups...
Share
Share this post:

Avoid HTML Export error in 11.2?

Posted 7 years ago

The following piece of code worked fine in Mathematica 11.1:

notesgrid = Text[Grid[{{ Hyperlink["pdf link 1", "notes-1.pdf"]}}]]
Export[FileNameJoin[{NotebookDirectory[], "notes.html"}], notesgrid];

But in 11.2 it fails to produce the hyperlink in the html source code (it doesn't create the <area> tags), though the link does appear in the Mathematica output cell.

Is this a known problem? Is there a workaround (other than going back to 11.1)?

POSTED BY: Andrew
6 Replies
Posted 7 years ago

Carlo, thanks for the tip/trick but what I need are: 1) the image that Export creates and 2) the html code (<area> tags, etc) so that I can use them to build my website (I create a large table that has pdf links).

As Alexey suggests, I think I will report this as a bug and just do this exporting in 11.1 until it gets fixed.

POSTED BY: Andrew

I'm not sure I understand why you want to transform text into an image, but if you want to do that you can always explicitly call Rasterize before exporting.

POSTED BY: Carlo Barbieri
Posted 7 years ago

I use Mathematica to create a set of Grade 10 math notes that go on my website. I use Grid (and Text) to create a formatted table that provides the links to the PDFs (100+ topics). You can see the result here [1].

Prior to 11.2, the Export function did the job just fine: it created an image and produced the HTML code, which were easy to add to my website.

If there is an alternative way of doing this and getting the formatting to be similar, I'd be interested in pointers on how to do it.

Thanks, Andrew.

POSTED BY: Andrew

A little known trick is to use the same HTML exporter that the cloud uses:

notesgrid = Grid[{{Hyperlink["pdf link 1", "notes-1.pdf"]}}];
Export[FileNameJoin[{NotebookDirectory[], "notes.html"}], notesgrid, "HTMLFragment",  "FullDocument" -> True]

I removed Text because it's not yet supported, and stuff is styled as Text by default by this exporter anyway.

POSTED BY: Carlo Barbieri
Posted 7 years ago

A related bug:

Unfortunately the workaround suggested in that thread doesn't work in this case.

It is also worth to note that exporting such a little expression takes a lot of time on my machine: about 10 seconds, what isn't appropriate.

POSTED BY: Alexey Popkov
Posted 7 years ago

I confirm that with Mathematica 11.2.0 on Windows 7 x64 the text "pdf link 1" in the exported web page is converted to a GIF image which isn't a hyperlink. I recommend reporting this to the tech support as a bug. The expected behavior is to get the exported Hyperlink as a hyperlinked text, not as an image of text.

POSTED BY: Alexey Popkov
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract