Skip to content
Closed
Show file tree
Hide file tree
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
Revert to previous syntax, make script change to standard markdown
  • Loading branch information
pmiquelm committed Aug 18, 2016
commit f9a06128b60a736fe0b222eb0a592820440a0bd3
21 changes: 18 additions & 3 deletions documentation/doxygen/converttonotebook.py
Original file line number Diff line number Diff line change
Expand Up @@ -515,16 +515,20 @@ def removePaletteEditor(code):
code = code.replace("img->StartPaletteEditor();", "")
code = code.replace("Open the color editor", "")
return code


def runEventExe(code):
if "copytree" in tutName:
return "# <codecell> \n.! $ROOTSYS/test/eventexe 1000 1 1 1 \n" + code
return code


def getLibMathMore(code):
if "quasirandom" == tutName:
return "# <codecell> \ngSystem->Load(\"libMathMore\"); \n# <codecell> \n" + code
return code


def roofitRemoveSpacesComments(code):

def changeString(matchObject):
Expand Down Expand Up @@ -557,19 +561,19 @@ def rs401dGetFiles(code):
return code




def declareIncludes(code):
if tutName != "fitcont":
code = re.sub(r"# <codecell>\s*#include", "# <codecell>\n%%cpp -d\n#include" , code)
return code


def tree4GetFiles(code):
if tutName == "tree4":
code = code.replace(
"""#include \"../test/Event.h\"""" , """# <codecell>\nTString dir = "$ROOTSYS/test/Event.h";\ngSystem->ExpandPathName(dir);\nTString includeCommand = TString::Format("#include \\\"%s\\\"" , dir.Data());\ngROOT->ProcessLine(includeCommand);""")
return code


def fixes(code):
codeTransformers=[removePaletteEditor, runEventExe, getLibMathMore,
roofitRemoveSpacesComments, declareNamespace, rs401dGetFiles ,
Expand All @@ -580,6 +584,14 @@ def fixes(code):

return code


def changeMarkdown(code):
code = code.replace("~~~" , "```")
code = code.replace("{.cpp}", "cpp")
code = code.replace("{.bash}", "bash")
return code


def isCpp():
"""
Return True if extension is a C++ file
Expand Down Expand Up @@ -635,11 +647,14 @@ def mainfunction(text):

# Perform last minute fixes to the notebook, used for specific fixes needed by some tutorials
text = fixes(text)

# Change to standard Markdown
newDescription = changeMarkdown(description)

# Add the title and header of the notebook
text = "# <markdowncell> \n# # %s\n%s# \n# \n# **Author:** %s \n# <i><small>This notebook tutorial was automatically generated " \
"with <a href= \"https://github.com/root-mirror/root/blob/master/documentation/doxygen/converttonotebook.py\">ROOTBOOK-izer (Beta)</a> " \
"from the macro found in the ROOT repository on %s.</small></i>\n# <codecell>\n%s" % (tutTitle, description, author, date, text)
"from the macro found in the ROOT repository on %s.</small></i>\n# <codecell>\n%s" % (tutTitle, newDescription, author, date, text)

# Add cell at the end of the notebook that draws all the canveses. Add a Markdown cell before explaining it.
if isJsroot and not nodraw:
Expand Down
4 changes: 2 additions & 2 deletions tutorials/eve/track.C
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
/// field configurations.
/// Needs to be run in compiled mode.
/// root
/// ```cpp
/// ~~~{.cpp}
/// .L track.C+
/// track(3, kTRUE)
/// ```
/// ~~~
/// void track(Int_t mode = 5, Bool_t isRungeKutta = kTRUE)
/// Modes are
/// 0. B = 0, no difference btween signed and charge particles;
Expand Down
4 changes: 2 additions & 2 deletions tutorials/fit/ErrorIntegral.C
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
///
/// run the macro doing:
///
/// ```cpp
/// ~~~{.cpp}
/// .x ErrorIntegral.C
/// ```
/// ~~~
///
/// \macro_image
/// \macro_output
Expand Down
4 changes: 2 additions & 2 deletions tutorials/fit/FittingDemo.C
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
/// Example for fitting signal/background.
/// This example can be executed with:
///
/// ```cpp
/// ~~~{.cpp}
/// root > .x FittingDemo.C (using the CINT interpreter)
/// root > .x FittingDemo.C+ (using the native complier via ACLIC)
/// ```
/// ~~~
///
/// \macro_image
/// \macro_output
Expand Down
8 changes: 4 additions & 4 deletions tutorials/fit/Ifit.C
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@
/// More details on the various functions or parameters for these functions
/// can be obtained in an interactive ROOT session with:
///
/// ```cpp
/// ~~~{.cpp}
/// Root > TMinuit *minuit = new TMinuit(10);
/// ```
/// ~~~
///
/// ```cpp
/// ~~~{.cpp}
/// Root > minuit->mnhelp("*") to see the list of possible keywords
/// Root > minuit->mnhelp("SET") explains most parameters
/// ```
/// ~~~
///
/// \macro_output
/// \macro_code
Expand Down
8 changes: 4 additions & 4 deletions tutorials/fit/TestBinomial.C
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@
///
/// to show the bias performing 100 fits for 1000 events per "experiment"
///
/// ```cpp
/// ~~~{.cpp}
/// root[0]: .x TestBinomial.C+
/// ```
/// ~~~
///
/// to show the bias performing 100 fits for 1000 events per "experiment"
///
/// ```cpp
/// ~~~{.cpp}
/// .x TestBinomial.C+(100, 1000)
/// ```
/// ~~~
///
/// \macro_image
/// \macro_output
Expand Down
4 changes: 2 additions & 2 deletions tutorials/fit/fit2.C
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@
///
/// This example can be executed via the interpreter or ACLIC
///
/// ```cpp
/// ~~~{.cpp}
/// root > .x fit2.C
/// root > .x fit2.C++
/// ```
/// ~~~
///
/// \macro_image
/// \macro_output
Expand Down
4 changes: 2 additions & 2 deletions tutorials/fit/fit2a.C
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@
///
/// This example can be executed via the interpreter or/and the compiler
///
/// ```cpp
/// ~~~{.cpp}
/// root > .x fit2a.C
/// root > .x fit2a.C++
/// ```
/// ~~~
///
/// \macro_image
/// \macro_output
Expand Down
20 changes: 10 additions & 10 deletions tutorials/fit/fit2dHist.C
Original file line number Diff line number Diff line change
Expand Up @@ -6,32 +6,32 @@
///
/// To execute this tutorial, you can do:
///
/// ```cpp
/// ~~~{.cpp}
/// root > .x fit2dHist.C (executing via CINT, slow)
/// ```
/// ~~~
///
/// or
/// ```cpp
/// ~~~{.cpp}
/// root > .x fit2dHist.C+ (executing via ACLIC , fast, with Minuit)
/// root > .x fit2dHist.C+(2) (executing via ACLIC , fast, with Minuit2)
/// ```
/// ~~~
///
/// or using the option to fit independently the 2 histos
/// ```cpp
/// ~~~{.cpp}
/// root > .x fit2dHist.C+(10) (via ACLIC, fast, independent fits with Minuit)
/// root > .x fit2dHist.C+(12) (via ACLIC, fast, independent fits with Minuit2)
/// ```
/// ~~~
///
/// Note that you can also execute this script in batch with eg,
/// ```cpp
/// ~~~{.cpp}
/// root -b -q "fit2dHist.C+(12)"
/// ```
/// ~~~
///
/// or execute interactively from the shell
/// ```cpp
/// ~~~{.cpp}
/// root fit2dHist.C+
/// root "fit2dHist.C+(12)"
/// ```
/// ~~~
///
/// \macro_image
/// \macro_output
Expand Down
4 changes: 2 additions & 2 deletions tutorials/fit/fitCircle.C
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
/// Fit a circle through the points and draw
/// To run the script, do, eg
///
/// ```cpp
/// ~~~{.cpp}
/// root > .x fitCircle.C (10000 points by default)
/// root > .x fitCircle.C(100); (with only 100 points
/// root > .x fitCircle.C(100000); with ACLIC
/// ```
/// ~~~
///
/// \macro_image
/// \macro_output
Expand Down
8 changes: 4 additions & 4 deletions tutorials/fit/langaus.C
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@
///
/// to execute this example, do:
///
/// ```cpp
/// ~~~{.cpp}
/// root > .x langaus.C
/// ```
/// ~~~
///
/// or
///
/// ```cpp
/// ~~~{.cpp}
/// root > .x langaus.C++
/// ```
/// ~~~
///
/// \macro_image
/// \macro_output
Expand Down
4 changes: 2 additions & 2 deletions tutorials/fit/line3Dfit.C
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
///
/// run this macro by doing:
///
/// ```cpp
/// ~~~{.cpp}
/// root>.x line3Dfit.C+
/// ```
/// ~~~
///
/// \macro_image
/// \macro_output
Expand Down
4 changes: 2 additions & 2 deletions tutorials/foam/foam_demo.C
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
///
/// To run this macro type from CINT command line
///
/// ```cpp
/// ~~~{.cpp}
/// root [0] gSystem->Load("libFoam.so")
/// root [1] .x foam_demo.C+
/// ```
/// ~~~
///
/// \macro_code
///
Expand Down
4 changes: 2 additions & 2 deletions tutorials/foam/foam_kanwa.C
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
/// \notebook -js
/// This program can be execute from the command line as folows:
///
/// ```cpp
/// ~~~{.cpp}
/// root -l foam_kanwa.C
/// ```
/// ~~~
///
/// \macro_code
///
Expand Down
28 changes: 14 additions & 14 deletions tutorials/geom/RadioNuclides.C
Original file line number Diff line number Diff line change
Expand Up @@ -9,36 +9,36 @@
///
/// The radionuclides table is loaded on demand by any call:
///
/// ```cpp
/// ~~~{.cpp}
/// TGeoElementRN *TGeoElementTable::GetElementRN(Int_t atomic_number,
/// Int_t atomic_charge,
/// Int_t isomeric_number)
/// ```
/// ~~~
///
/// The isomeric number is optional and the default value is 0.
///
/// To create a radioactive material based on a radionuclide, one should use the
/// constructor:
///
/// ```cpp
/// ~~~{.cpp}
/// TGeoMaterial(const char *name, TGeoElement *elem, Double_t density)
/// ```
/// ~~~
///
/// To create a radioactive mixture, one can use radionuclides as well as stable
/// elements:
///
/// ```cpp
/// ~~~{.cpp}
/// TGeoMixture(const char *name, Int_t nelements, Double_t density);
/// TGeoMixture::AddElement(TGeoElement *elem, Double_t weight_fraction);
/// ```
/// ~~~
///
/// Once defined, one can retrieve the time evolution for the radioactive
/// materials/mixtures by using one of the 2 methods:
///
/// ```cpp
/// ~~~{.cpp}
/// void TGeoMaterial::FillMaterialEvolution(TObjArray *population,
/// Double_t precision=0.001)
/// ```
/// ~~~
///
/// To use this method, one has to provide an empty TObjArray object that will
/// be filled with all elements coming from the decay chain of the initial
Expand All @@ -47,26 +47,26 @@
/// The POPULATION list may contain stable elements as well as radionuclides,
/// depending on the initial elements. To test if an element is a radionuclide:
///
/// ```cpp
/// ~~~{.cpp}
/// Bool_t TGeoElement::IsRadioNuclide() const
/// ```
/// ~~~
///
/// All radionuclides in the output population list have attached objects that
/// represent the time evolution of their fraction of nuclei with respect to the
/// top radionuclide in the decay chain. These objects (Bateman solutions) can be
/// retrieved and drawn:
///
/// ```cpp
/// ~~~{.cpp}
/// TGeoBatemanSol *TGeoElementRN::Ratio();
/// void TGeoBatemanSol::Draw();
/// ```
/// ~~~
///
/// Another method allows to create the evolution of a given radioactive
/// material/mixture at a given moment in time:
///
/// ```cpp
/// ~~~{.cpp}
/// TGeoMaterial::DecayMaterial(Double_t time, Double_t precision=0.001)
/// ```
/// ~~~
///
/// The method will create the mixture that result from the decay of a initial
/// material/mixture at TIME, while all resulting elements having a fractional
Expand Down
4 changes: 2 additions & 2 deletions tutorials/geom/runplugin.C
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@
/// volumes acording some arbitrary criteria *WITHOUT* changing the color of the
/// same volume drawn on branches that do not match the criteria.
///
/// ```cpp
/// ~~~{.cpp}
/// To run:
/// root[0] .L iterplugin.cxx+
/// root[1] .x runplugin.C
/// root[2] select(2,kMagenta);
/// root[3] select(3,kBlue)
/// ...
/// ```
/// ~~~
///
/// \macro_code
///
Expand Down
Loading