Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2009

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Making raw HTML appear in a notebook exported to

  • To: mathgroup at smc.vnet.net
  • Subject: [mg103744] Re: Making raw HTML appear in a notebook exported to
  • From: Albert Retey <awnl at gmx-topmail.de>
  • Date: Sun, 4 Oct 2009 05:37:50 -0400 (EDT)
  • References: <h9v6qo$9b1$1@smc.vnet.net> <200910021223.IAA13461@smc.vnet.net> <ha7itd$6so$1@smc.vnet.net>

Hi David and Leonid,

> Yes, the technique of using templates and then doing string
> replacements is exactly what I use in the Blogging code for
> http://scientificarts.com.worklife .  And that Is what I was working
> on extending to solve my problem.
> 
> Mark McClure in his answer gives the really simple way of doing this
> via ConversionRules that I was hoping for.
> 
> Thanks for your help!

I was just wondering whether doing string replacements is really the
best way to handle these kind of tasks. After all what mathematica
exports seems to be valid XHTML (and is marked as that) and thus can be
imported as XML, with e.g. Import["file.html","XML"], which gives a
'symbolic XML expression' which I think would be much more convenient
and robust to be manipulated within Mathematica than just plain strings.
Have you tried that? It might turn out to be too slow or need to much
memory, but I would give it a try if I would try to do what you are
after. I have experience in manipulating html with string replacements
in other languages and have seen some of the horror that can turn into
when things become more and more complicated (and you need to accept
non-xhtml files with missing end tags and all the quirks that you find
in these).

> On Fri, Oct 2, 2009 at 10:00 AM, Leonid Shifrin <lshifr at gmail.com> wrote:
>> Hi David,
>>
>> There is a possibility which I used in publishing my book online. The reason
>> I did not answer your initial post is that I was expecting others to come up
>> with a better solution than mine. What I did was a kind of a rudimentary
>> "template" engine. If you have a look at my site
>> <www.mathprogramming-intro.org>, you will  notice that the pages produced by
>> Mathematica are embedded in one or another template. Those templates I
>> produced separately as html pages, and then wrote Mathematica scripts which
>> took the pages generated by Export, and used some simple string recognition
>> to parse them and find how to do the embedding. It worked pretty well forme
>> given that I have more than 500 pages and the embedding was done correctly
>> for all of them. Once I realized that with this procedure I am no longer
>> confined by the way Export does things, it was a big relief. The main
>> limitations  of course are that this procedure does not scale as the
>> complexity of the site grows, and the content is static. I have it in my
>> plans to convert this into some simple html-generating framework for
>> Mathematica, but did not find time for it so far.
>>
>> I think, similar approach could work for you. You could simply use some
>> descriptors (string tokens, say) for the cell of interest so that the script
>> running after Export is done, will replace the generated html with a
>> different one, for this particular cell. This can be achieved rather easily,
>> in many cases much easier than forcing Export into submission.
>>
>> Another possibility (I never tried it so this is just a blind guess) is to
>> try webMathematica -  may be it already implements all the functionality you
>> need?
>>
>> Regards,
>> Leonid


  • Prev by Date: Re: Re: Incorrect symbolic improper integral
  • Next by Date: Re: Re: Incorrect symbolic improper integral
  • Previous by thread: Re: Re: Making raw HTML appear in a notebook exported to
  • Next by thread: Re: Re: Making raw HTML appear in a notebook exported to