Re: Re: Making raw HTML appear in a notebook exported to
- To: mathgroup at smc.vnet.net
- Subject: [mg103706] Re: [mg103680] Re: Making raw HTML appear in a notebook exported to
- From: David Reiss <dreiss at scientificarts.com>
- Date: Sat, 3 Oct 2009 09:02:20 -0400 (EDT)
- References: <h9v6qo$9b1$1@smc.vnet.net> <200910021223.IAA13461@smc.vnet.net>
Thank you Mark: this is exactly what I needed. I played around with ConversionRules, but didn't know about "HTML" -> Identity. Thanks! --David On Fri, Oct 2, 2009 at 11:25 AM, Mark McClure <mcmcclur at unca.edu> wrote: > On Fri, Oct 2, 2009 at 8:23 AM, David Reiss <dbreiss at gmail.com> wrote: > On Sep 30, 5:02 am, David Reiss <dbre... at gmail.com> wrote: >>> I want to export a notebook to html with a particular behavior of a >>> particular cell. >>> >>> The cell in question should have its contents exported so that those >>> contents appear in the html of the resulting file exactly as written >>> in the cell. ...In essence I want to be able to insert raw html into th= e >>> final html file. > > Simply create a new style definition with the following option: > ConversionRules -> {"HTML" -> Identity}. > > The complete way to do this would be to set up a new style sheet > that extends whatever style sheet you want and includes the extra > style. Here's a snippet of code that illustrates the idea, though: > > HTMLVerbatimDef = Notebook[{Cell[StyleData["HTMLVerbatim"], > ConversionRules -> {"HTML" -> Identity}]}]; > nb = CreateDocument[{TextCell[ > "<a href=\"blah.html\">blah</a>\"", "HTMLVerbatim"]}, > StyleDefinitions -> HTMLVerbatimDef]; > > That code should generate a new notebook with a single cell > containing some HTML. The cell is in the newly defined > HTMLVerbatim style. You can view the HTML that is generated > as follows: > > ExportString[nb, "HTML"] > > You should see that the HTML has been copied verbatim: > <a href="blah.html">blah</a>" > > By contrast, a simple Text cell in a Default style document > would yield: > <a href="blah.html">blah</a>" > > Hope that helps, > Mark McClure > -- This message and any attachments, may contain confidential and/or legally privileged information. If you are not the intended recipient of the message by the original sender, please destroy it. Message and attachments copyright (c) 2009, all rights reserved. Any unauthorized dissemination, distribution or copying is strictly forbidden.
- References:
- Re: Making raw HTML appear in a notebook exported to HTML
- From: David Reiss <dbreiss@gmail.com>
- Re: Making raw HTML appear in a notebook exported to HTML