Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

At the bottom of the html document produced by Mathematica is a link to Wolfram's site.

It says: Created by Wolfram Mathematica 8.0

I think it would be nifty to have the option to precede that link with a custom link.

For example: Copyright 2012, Fred Daniel Kline - foo@bar.com

Note: I prefer my email as an image to prevent netbots from grabbing it.

Perhaps we could have a special cell that, if present in the notebook, would be displayed automatically. Edited: Also would like this option for pdf's.

share|improve this question
    
By using Export[] to save the HTML format, you can specify your own .css stylesheet –  belisarius May 29 '12 at 6:02
    
@belisarius, I'm aware of that, thanks. I also want this to happen for pdf file. I edited the OP to make it clearer. –  Fred Kline May 29 '12 at 6:41
3  
We don't really need your email, so you could've very well written foo@example.com ;) That way you needn't have worried about bots... –  rm -rf May 29 '12 at 6:57
1  
What I would do is to import the resulting HTML page as an XMLObject and postprocess, then export again. I did something similar for the web version of my book. –  Leonid Shifrin May 29 '12 at 13:12
1  
For PDFs you can change the PageFooter option of the notebook. This'll put a footer text on every page, which may be too much. If it is, perhaps the easiest way is to add a cell at the end by hand.. –  Szabolcs May 29 '12 at 15:16
add comment

1 Answer

up vote 3 down vote accepted
filename = "MathematicaToHTMLExample";
nb = First[Notebooks[filename<>".nb"]];
dir = NotebookDirectory[nb]
SetDirectory[dir];
Export[filename<>".html", nb, "HTML",
"CSS"->dir<>"stylesheet.css",
"ConversionRules" -> {
    "Text" -> {"<p class='Text' style='font-size: 100%'>","</p>"},
    "DisplayFormula" -> {
"<p class=\"DisplayFormula\" style='text-align: center;"<> 
    "font-size: 200%'>","</p>"}
}]
in = ReadList[filename<>".html", "String", NullRecords -> True];

out= Join[
in[[1;;16]],
{
"<div id=\"wrap\">\n",
"<div id=\"top\"></div>\n",
"<div id=\"content\">\n",
"<div class=\"header\">\n",
"<h1> Page Header </h1> \n",
"<h2> subtitle </h2> \n",
"</div>\n",
"<div class=\"middle\">\n"},
in[[17;;-8]],
{"<p> Your custom footer </p>"},
in[[-7;;-4]],
{"\<
</div>
<div id =\"clear\"></div>
</div>
<div id =\"bottom\"></div>
</div>
</body>
</html>
\>"}];

strm = OpenWrite[filename <>".html"];
WriteString[strm,#<>"\n"]&/@out;
Close[strm]
share|improve this answer
    
Assume you have a notebook saved and currently open called MathematicaToHTMLExample.nb that you would like to convert to html.To convert it with a custom stylesheet and footer just run this code changing two things: 1. Replace "stylesheet.css" with your stylesheet saved in the in the same directory as MathematicaToHTMLExample.nb 2. Replace the string "footer" with what you want. –  M.R. May 31 '12 at 16:38
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.