Re: Re: Making raw HTML appear in a notebook exported to
- To: mathgroup at smc.vnet.net
- Subject: [mg103721] Re: [mg103680] Re: Making raw HTML appear in a notebook exported to
- From: Mark McClure <mcmcclur at unca.edu>
- Date: Sat, 3 Oct 2009 09:05:12 -0400 (EDT)
- References: <h9v6qo$9b1$1@smc.vnet.net> <200910021223.IAA13461@smc.vnet.net>
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 the
>> 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
- 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