33 static const char* tag[] = {
"<",
"^",
">"};
34 static const char*
name[] = {
"prev",
"up",
"next"};
35 static const TNamed emptyName;
41 if (!
n)
n = &emptyName;
46 if (
id != 1) title =
n->GetName();
47 if (title.
Length()) title +=
": ";
48 title +=
n->GetTitle();
49 const char* mytag = tag[
id];
51 if (!
n->GetName()[0]) mytag =
"";
54 "<a class=\"contextheadarrow\" href=\"%s.html\">%s</a></div></td>",
55 arrowid.
Data(), ardivid.
Data(),
n->GetName(), mytag);
58 "<a class=\"contextheadentry\" href=\"%s.html\">%s</a></td>",
59 entryid.
Data(),
n->GetName(), title.
Data());
62 links += entry +
arrow;
64 links +=
arrow + entry;
80 links =
"<div id=\"toplinks\"><div class=\"descrhead\">"
81 "<table class=\"descrtitle\" id=\"contexttitle\"><tr class=\"descrtitle\">";
89 if (upLink && upLink[0])
96 links +=
TString(
"</tr></table></div><h1 class=\"convert\">") + title +
"</h1></div>\n";
104 suburl = subtitle +
"?view=markup";
106 links +=
TString::Format(
"<div class=\"location\"><h2>From <a href=\"http://root.cern.ch/viewvc/trunk/tutorials/%s\">$ROOTSYS/tutorials/%s</a></h2></div>",
138 const char *imagenew =
"";
139 cout <<
"writingItem: " << numb <<
", ref=" << ref <<
", name=" <<
name <<
", title=" << title << endl;
140 if (isnew) imagenew =
" <img src=\"http://root.cern.ch/root/images/new01.gif\" alt=\"new\" align=\"top\" />";
141 out <<
"<li class=\"idxl" << numb%2 <<
"\">";
142 out <<
"<a href=\"" << ref <<
"\"><span class=\"typename\">" << numb <<
". " <<
name <<
"</span></a> "
143 << title << imagenew <<
"</li>" << endl;
158 out <<
"<li class=\"idxl" << (
n++)%2 <<
"\"><a href=\"" << dir <<
"/index.html\">"
159 <<
"<span class=\"typename\">" << dir <<
"</span></a>" << title <<
"</li>" << endl;
161 scandir(html, dir, title, lnk);
173 const char* tutorials[][2] = {
174 {
"hist",
"Histograms"},
175 {
"graphics",
"Basic Graphics"},
176 {
"graphs",
"TGraph, TGraphErrors, etc"},
177 {
"gui",
"Graphics User Interface"},
178 {
"fit",
"Fitting tutorials"},
179 {
"fitsio",
"CFITSIO interface"},
180 {
"io",
"Input/Output"},
181 {
"tree",
"Trees I/O, Queries, Graphics"},
182 {
"math",
"Math tutorials"},
183 {
"matrix",
"Matrix packages tutorials"},
184 {
"geom",
"Geometry package"},
185 {
"gl",
"OpenGL examples"},
186 {
"eve",
"Event Display"},
187 {
"fft",
"Fast Fourier Transforms"},
188 {
"foam",
"TFoam example"},
189 {
"image",
"Image Processing"},
190 {
"mlp",
"Neural Networks"},
191 {
"net",
"Network, Client/server"},
192 {
"physics",
"Physics misc"},
193 {
"proof",
"PROOF tutorials"},
194 {
"pyroot",
"Python-ROOT"},
195 {
"pythia",
"Pythia event generator"},
196 {
"quadp",
"Quadratic Programming package"},
197 {
"roofit",
"RooFit tutorials"},
198 {
"roostats",
"Roostats tutorials"},
199 {
"spectrum",
"Peak Finder, Deconvolutions"},
200 {
"splot",
"TSPlot example"},
201 {
"sql",
"SQL Data Bases interfaces"},
202 {
"thread",
"Multi-Threading examples"},
203 {
"unuran",
"The Unuran package"},
204 {
"xml",
"XML tools"},
209 ofstream fptop(
"htmldoc/tutorials/index.html");
212 MakeTopLinks(topLinks, 0,
"ROOT Tutorials",
"../index",
"ROOT", 0,
"");
213 fptop << topLinks << endl;
214 fptop <<
"<ul id=\"indx\">" << endl;
222 TNamed curr(tutorials[0][0], tutorials[0][1]);
223 TNamed next(tutorials[1][0], tutorials[1][1]);
229 const char** iTut = tutorials[2];
239 fptop <<
"</ul>" << endl;
240 fptop <<
"<p><a href=\"http://root.cern.ch/drupal/content/downloading-root\">Download ROOT</a> and run the tutorials in $ROOTSYS/tutorials yourself!</p>" << endl;
251 FILE *fp = fopen(fullpath,
"r");
254 while (fgets(
line,240,fp)) {
256 char *com = strstr(
line,
"//");
258 if (strstr(
line,
"Author"))
continue;
259 if (strstr(
line,
"@(#)"))
continue;
260 if (strstr(
line,
"****"))
continue;
261 if (strstr(
line,
"////"))
continue;
262 if (strstr(
line,
"===="))
continue;
263 if (strstr(
line,
"...."))
continue;
264 if (strstr(
line,
"----"))
continue;
265 if (strstr(
line,
"____"))
continue;
266 if (strlen(com+1) < 5)
continue;
267 if (!strncmp(com,
"//+ ", 4)) {
274 if (nlines > 50)
break;
282 FILE *fpdate = fopen(
"MakeTutorials-tmp.log",
"r");
287 Int_t year,month,day;
288 while (fgets(
line,240,fpdate)) {
289 const char *com = strstr(
line,
"Last Changed Date: ");
291 sscanf(&com[19],
"%d-%d-%d",&year,&month,&day);
292 Int_t filedate = 365*(year-1) + 12*(month-1) + day;
293 if (now-filedate< 6*30) isnew =
kTRUE;
306 if (strstr(dir,
"net"))
return kFALSE;
307 if (strstr(dir,
"xml"))
return kFALSE;
308 if (strstr(dir,
"sql"))
return kFALSE;
309 if (strstr(dir,
"proof"))
return kFALSE;
310 if (strstr(dir,
"foam"))
return kFALSE;
311 if (strstr(dir,
"unuran"))
return kFALSE;
312 if (strstr(dir,
"roofit"))
return kFALSE;
313 if (strstr(dir,
"thread"))
return kFALSE;
320 static const char* vetoed[] = {
332 "rs401d_FeldmanCousins",
333 "graph_edit_playback",
341 for (
const char** iVetoed = vetoed; *iVetoed; ++iVetoed)
342 if (strstr(tut, *iVetoed))
352 TString fullpath(
"htmldoc/tutorials/");
355 fullpath +=
"/index.html";
357 ofstream fpind(fullpath);
362 MakeTopLinks(topLinks, 0, title,
".",
"ROOT Tutorials", toplnk, dir);
366 topLinks.
ReplaceAll(
"href=\"../http://",
"href=\"http://");
367 topLinks.
ReplaceAll(
"href=\"../https://",
"href=\"https://");
368 topLinks.
ReplaceAll(
".html\"",
"/index.html\"");
370 topLinks.
ReplaceAll(
"<h1 class=\"convert\">",
"<h1 class=\"convert\">ROOT Tutorials: ");
371 fpind << topLinks << endl;
372 fpind <<
"<ul id=\"indx\">" << endl;
374 TString outpath(
"htmldoc/tutorials/");
376 TString inpath(
"$ROOTSYS/tutorials/");
382 printf(
"MakeTutorials.C: error opening directory %s", inpath.
Data());
385 const char *direntry;
388 if(*direntry ==
'.')
continue;
389 const char *CC = strstr(direntry,
".C");
391 if (!CC || *(CC+2))
continue;
393 if(strstr(direntry,
"h1anal"))
continue;
394 if(strstr(direntry,
"hsimpleProxy"))
continue;
395 if(strstr(direntry,
"tv3"))
continue;
396 if(strstr(direntry,
"tvdemo"))
continue;
397 if(strstr(direntry,
"na49"))
continue;
398 if(strstr(direntry,
"fit1_C"))
continue;
399 if(strstr(direntry,
"c1.C"))
continue;
400 if(strstr(direntry,
"MDF.C"))
continue;
401 if(strstr(direntry,
"cms_calo_detail"))
continue;
402 TString atut(inpath + direntry);
417 TString atut(inpath + direntry);
423 if (!
gROOT->IsBatch()) {
438 html.
Convert(atut,named->
GetTitle(),outpath,
"../../",includeOutput,links);
439 gROOT->GetListOfCanvases()->Delete();
441 gROOT->GetListOfFunctions()->Delete();
442 gROOT->GetListOfBrowsers()->Delete();
443 gROOT->GetListOfGeometries()->Delete();
448 gROOT->SetStyle(
"Default");
451 fpind <<
"</ul>" << endl;
461 gEnv->
SetValue(
"Unix.*.Root.Html.SourceDir",
"$(ROOTSYS)");
462 gEnv->
SetValue(
"Root.Html.ViewCVS",
"http://root.cern.ch/viewcvs/trunk/%f?view=log");
463 gEnv->
SetValue(
"Root.Html.Search",
"http://www.google.com/search?q=%s+site%3A%u");
Bool_t IsNew(const char *filename)
void writeHeader(THtml &html, ostream &out, const char *title, const char *relPath="../")
void AppendLink(TString &links, int id, const TNamed *n)
Bool_t CreateOutput_Tutorial(const char *tut)
void GetMacroTitle(const char *fullpath, TString &comment, Bool_t &compile)
void writeItem(ostream &out, Int_t numb, const char *ref, const char *name, const char *title, Bool_t isnew)
void writeTutorials(THtml &html)
void scandir(THtml &html, const char *dir, const char *title, TObjLink *toplnk)
void writeTrailer(THtml &html, ostream &out)
Bool_t CreateOutput_Dir(const char *dir)
void MakeTopLinks(TString &links, const char *name, const char *title, const char *upLink, const char *upTitle, TObjLink *lnk, const char *dir)
void writeItemDir(THtml &html, ostream &out, TObjLink *lnk)
char * Form(const char *fmt,...)
R__EXTERN TStyle * gStyle
R__EXTERN TSystem * gSystem
This class stores the date and time with a precision of one second in an unsigned 32 bit word (950130...
void WriteHtmlFooter(std::ostream &out, const char *dir, const char *lastUpdate, const char *author, const char *copyright, const char *footer)
Write HTML footer.
void WriteHtmlHeader(std::ostream &out, const char *titleNoSpecial, const char *dir, TClass *cls, const char *header)
Write HTML header.
virtual void SetValue(const char *name, const char *value, EEnvLevel level=kEnvChange, const char *type=nullptr)
Set the value of a resource or create a new resource.
THashList implements a hybrid collection class consisting of a hash table and a list to store TObject...
Legacy ROOT documentation system.
static void LoadAllLibs()
Load all libraries known to ROOT via the rootmap system.
virtual void CreateAuxiliaryFiles() const
copy CSS, javascript file, etc to the output dir
void Convert(const char *filename, const char *title, const char *dirname="", const char *relpath="../", Int_t includeOutput=kNoOutput, const char *context="")
It converts a single text file to HTML.
virtual TObjLink * FirstLink() const
virtual void AddLast(TObject *obj)
Add object at the end of the list.
The TNamed class is the base class for all named ROOT classes.
virtual const char * GetTitle() const
Returns title of object.
virtual const char * GetName() const
Returns name of object.
virtual void SetNameTitle(const char *name, const char *title)
Set all the TNamed parameters (name and title).
Wrapper around a TObject so it can be stored in a TList.
TObject * GetObject() const
virtual const char * GetName() const
Returns name of object.
R__ALWAYS_INLINE Bool_t TestBit(UInt_t f) const
void SetBit(UInt_t f, Bool_t set)
Set or unset the user status bits as specified in f.
virtual const char * GetTitle() const
Returns title of object.
Bool_t EndsWith(const char *pat, ECaseCompare cmp=kExact) const
Return true if string ends with the specified string.
const char * Data() const
TString & ReplaceAll(const TString &s1, const TString &s2)
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString.
static void BuildStyles()
Create some standard styles.
virtual Bool_t ExpandPathName(TString &path)
Expand a pathname getting rid of special shell characters like ~.
virtual void * OpenDirectory(const char *name)
Open a directory. Returns 0 if directory does not exist.
virtual int MakeDirectory(const char *name)
Make a directory.
virtual Int_t Exec(const char *shellcmd)
Execute a command.
virtual const char * GetDirEntry(void *dirp)
Get a directory entry. Returns 0 if no more entries.
virtual int Unlink(const char *name)
Unlink, i.e.