Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
added section creating notebooks
  • Loading branch information
pmiquelm committed Jul 14, 2016
commit 647757bf40d0072ec9cddbc1d6520dd53da6762b
43 changes: 19 additions & 24 deletions documentation/doxygen/filter.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -161,15 +161,13 @@ void FilterClass()

// Source file.
if (gSource) {
size_t spos = 0;
while (fgets(gLine,255,f)) {
gLineString = gLine;

if (gInMacro && gLineString.find("End_Macro") != string::npos) {
if (gLineString.find("End_Macro") != string::npos) {
ReplaceAll(gLineString,"End_Macro","");
gImageSource = false;
gInMacro = 0;
spos = 0;
if (m) {
fclose(m);
m = 0;
Expand All @@ -182,7 +180,6 @@ void FilterClass()
}

if (gInMacro) {
if (spos) gLineString = gLineString.substr(spos);
if (gInMacro == 1) {
if (EndsWith(gLineString,".C\n") || (gLineString.find(".C(") != string::npos)) {
ExecuteMacro();
Expand Down Expand Up @@ -214,27 +211,14 @@ void FilterClass()
}
}

if (gLineString.find("Begin_Macro") != string::npos &&
gLineString.find("End_Macro") == string::npos) {
if (BeginsWith(gLineString, "///")) {
spos = gLineString.find_first_not_of(' ', 3);
}
if (gLineString.find("Begin_Macro") != string::npos) {
if (gLineString.find("source") != string::npos) gImageSource = true;
gImageID++;
gInMacro++;
gLineString = "\n";
}

size_t l = gLineString.length();
size_t b = 0;
do {
size_t e = gLineString.find('\n', b);
if (e != string::npos) e++;
if (spos) printf("%-*s%s", (int)spos, "///",
gLineString.substr(b, e - b).c_str());
else printf("%s", gLineString.substr(b, e - b).c_str());
b = e;
} while (b < l);
printf("%s",gLineString.c_str());
}
fclose(f);
return;
Expand Down Expand Up @@ -298,6 +282,12 @@ void FilterTutorial()
m = fopen(StringFormat("%s/macros/%s",gOutDir.c_str(),gMacroName.c_str()).c_str(), "w");
ReplaceAll(gLineString, "\\macro_code", StringFormat("\\include %s",gMacroName.c_str()));
}

// notebook found
if (gLineString.find("\\notebook") != string::npos) {
ExecuteCommand(StringFormat("python converttonotebook.py %s %s/notebooks/",
gFileName.c_str(), gOutDir.c_str()));
}

// \macro_output found
if (gLineString.find("\\macro_output") != string::npos) {
Expand Down Expand Up @@ -353,8 +343,7 @@ void GetClassName()
if (gSource) {
while (fgets(gLine,255,f)) {
gLineString = gLine;
if (gLineString.find("ClassImp") != string::npos ||
gLineString.find("NamespaceImp") != string::npos) {
if (gLineString.find("ClassImp") != string::npos) {
i1 = gLineString.find("(")+1;
i2 = gLineString.find(")")-1;
gClassName = gLineString.substr(i1,i2-i1+1);
Expand Down Expand Up @@ -386,18 +375,24 @@ void ExecuteMacro()
gMacroName = gLineString.substr(i1,i2-i1+1);

// Build the ROOT command to be executed.
bool ts = false;
if (BeginsWith(gLineString,"///")) ts = true;
if (ts) ReplaceAll(gLineString,"///", "");
if (ts) ReplaceAll(gLineString," ", "");
gLineString.insert(0, StringFormat("root -l -b -q \"makeimage.C(\\\""));
size_t l = gLineString.length();
int l = gLineString.length();
gLineString.replace(l-1,1,StringFormat("\\\",\\\"%s\\\",\\\"%s\\\",true,false)\"", gImageName.c_str(), gOutDir.c_str()));

// Execute the macro
ExecuteCommand(gLineString);

// Inline the directives to show the picture and/or the code
if (gImageSource) {
gLineString = StringFormat("\\include %s\n\\image html pict1_%s\n", gMacroName.c_str(), gImageName.c_str());
if (ts) gLineString = StringFormat("/// \\include %s\n/// \\image html pict1_%s\n", gMacroName.c_str(), gImageName.c_str());
else gLineString = StringFormat("\\include %s\n\\image html pict1_%s\n", gMacroName.c_str(), gImageName.c_str());
} else {
gLineString = StringFormat("\n\\image html pict1_%s\n", gImageName.c_str());
if (ts) gLineString = StringFormat("\n/// \\image html pict1_%s\n", gImageName.c_str());
else gLineString = StringFormat("\n\\image html pict1_%s\n", gImageName.c_str());
}
}

Expand Down