save as (regular) html problem
- To: mathgroup at smc.vnet.net
- Subject: [mg79310] save as (regular) html problem
- From: "Chris Chiasson" <chris at chiasson.name>
- Date: Tue, 24 Jul 2007 06:05:40 -0400 (EDT)
While reading my code, I noticed that it would probably be prudent to change: result=System`ConvertersDump`ExportInternal[channel,expr,format,opts]; to result=System`ConvertersDump`ExportInternal[channel,Unevaluated@expr,format,opts]; On 7/21/07, Chris Chiasson <chris at chiasson.name> wrote: > On Wed, 11 Jul 2007 15:00:00 UT, Tom Zeller <support at wolfram.com> wrote: > <snip/> > > Chris, > > > > Thanks for the clarification. I do not know of a workaround beyond > > installing the StyleSheet. I will send this in as a suggestion. > > > <snip/> > > While I was tracing Export to solve another problem, I ran across the > code that handles the stylesheets. To make a long story short, the > code at the end of this email will make both File->Save As HTML and > Export["blah.html",<<some notebook object>>] use the stylesheets that > are in the same directory as the notebook. It can be placed in the > kernel's init.m or executed manually. > > Elaboration/Speculation: > I noticed that the System`Convert`CommonDump`GetStyleSheet function > was properly finding notebook-local stylesheets, but only by > augmenting the result of Options[$FrontEnd, StyleSheetPath]. I also > noticed that MathLink`CallFrontEnd[ExportPacket[...]] was only passing > the name of the stylesheet to the front end. I concluded that the part > of the front end that is communicating with the kernel is only using > Options[$FrontEnd,StyleSheetPath]. There were several options that I > could try to make the front end find the stylesheet, but the one I > chose was to overload the multi-format calling form of > System`ConvertersDump`ExportInternal so that it would change > Options[$FrontEnd,StyleSheetPath]. Corrections are welcome. > > Code: > System`Convert`CommonDump`Workarounds`interceptStyleSheetPath=True; > System`ConvertersDump`ExportInternal[channel_,expr_NotebookObject,format_List,opts___]/;$Notebooks&&System`Convert`CommonDump`Workarounds`interceptStyleSheetPath&&MemberQ[format,"HTML"|"XHTMLMathML"|"XHTML"]:=With[{nbfile="FileName"/.NotebookInformation[expr],oldStyleSheetPath=StyleSheetPath/.AbsoluteOptions[$FrontEnd,StyleSheetPath]},Block[{System`Convert`CommonDump`Workarounds`interceptStyleSheetPath=False,result},CheckAbort[SetOptions[$FrontEnd,StyleSheetPath->Prepend[oldStyleSheetPath,nbfile[[{1}]]]];result=System`ConvertersDump`ExportInternal[channel,expr,format,opts];SetOptions[$FrontEnd,StyleSheetPath->oldStyleSheetPath];result,SetOptions[$FrontEnd,StyleSheetPath->oldStyleSheetPath];Abort[]]]/;nbfile=!="FileName"] > > -- > http://chris.chiasson.name/ >