PhoenixLecture  2.0.0
Set of tools to make lectures
createOutlineHtml.cpp File Reference
#include "parser_utils.h"
#include "platexobj_html.h"
#include "createOutlineHtml.h"
+ Include dependency graph for createOutlineHtml.cpp:

Go to the source code of this file.

Functions

bool createOutlineHtml (POutoutMode &outputMode, const PLatexObj &obj, bool isBibliography)
 Create the outline. More...
 
PString createOutlineHtmlStr (POutoutMode &outputMode, const PLatexObj &obj)
 Create the outline. More...
 

Function Documentation

◆ createOutlineHtml()

bool createOutlineHtml ( POutoutMode outputMode,
const PLatexObj obj,
bool  isBibliography 
)

Create the outline.

Parameters
[out]outputMode: deal with the formulae
obj: PLatexObj to deal with
isBibliography: true if there is a bibliography, false otherwise
Returns
true on success, false otherwise

Definition at line 37 of file createOutlineHtml.cpp.

37  {
38  if(outputMode.isBookTheme){return false;}
39  PString body("");
40  body += getHtmlHeader("Outline", false, false, outputMode.currentStyle);
41  body += "\t\t<h1 class=\"mainTitle\">Outline</h1>\n";
42  body += "\t\t<ul class=\"sommairePage\">\n";
43  body += "\t\t\t<ul>\n";
44  body += "\t\t\t\t<li><a href=\"index.html\">Main Page</a></li>\n";
45  if(isBibliography){
46  body += "\t\t\t\t<li><a href=\"bibliography.html\">Bibliographie</a></li>\n";
47  }
48 
49  const PVecLatexObj & vecObj = obj.getVecContent();
50  if(vecObj.size() != 0lu){
51  for(PVecLatexObj::const_iterator it(vecObj.begin()); it != vecObj.end(); ++it){
52  body += createOutlineHtmlStr(outputMode, *it);
53  }
54  }
55  body += "\t\t\t</ul>\n";
56  body += "\t\t</ul>\n";
57  body += getHtmlFooter();
58  PPath fileName("outline.html");
59  if(!fileName.saveFileContent(body)){
60  std::cerr << "createOutlineHtml : can't save file name '"<<fileName<<"'" << std::endl;
61  return false;
62  }else{
63  std::cerr << "createOutlineHtml : save file name '"<<fileName<<"'" << std::endl;
64  }
65 
66  return true;
67 }
const std::vector< PLatexObj > & getVecContent() const
Gets the vecContent of the PLatexObj.
Definition: PLatexObj.cpp:410
Path of a directory or a file.
Definition: PPath.h:17
Extends the std::string.
Definition: PString.h:16
PString createOutlineHtmlStr(POutoutMode &outputMode, const PLatexObj &obj)
Create the outline.
PString getHtmlHeader(const PString &title, bool useMathJax, bool useRemoteMathjax, const PString &currentStyle)
Get the html header.
PString getHtmlFooter()
std::vector< PLatexObj > PVecLatexObj
Vector of obj.
bool isBookTheme
True to activate the book theme.
PString currentStyle
Current style to be used for the generated pages of the site.

References createOutlineHtmlStr(), POutoutMode::currentStyle, getHtmlFooter(), getHtmlHeader(), PLatexObj::getVecContent(), POutoutMode::isBookTheme, and PPath::saveFileContent().

Referenced by processAllFile().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ createOutlineHtmlStr()

PString createOutlineHtmlStr ( POutoutMode outputMode,
const PLatexObj obj 
)

Create the outline.

Parameters
[out]outputMode: deal with the formulae
obj: PLatexObj to deal with
Returns
output string

Definition at line 16 of file createOutlineHtml.cpp.

16  {
17  if(!isSection(obj) && obj.getType() != PLatexType::FILE){return "";}
18  PString body("");
19  body += "\t\t\t<li><a href=\""+obj.getLink()+"\">"+vecNumberToString(obj.getVecSecNumber())+" : "+getSectionTitle(outputMode, obj)+"</a></li>\n";
20  const PVecLatexObj & vecObj = obj.getVecContent();
21  if(vecObj.size() != 0lu){
22  body += "\t\t\t\t<ul>\n";
23  for(PVecLatexObj::const_iterator it(vecObj.begin()); it != vecObj.end(); ++it){
24  body += createOutlineHtmlStr(outputMode, *it);
25  }
26  body += "\t\t\t\t</ul>\n";
27  }
28  return body;
29 }
const PLatexType::PLatexType & getType() const
Gets the type of the PLatexObj.
Definition: PLatexObj.cpp:298
const PString & getLink() const
Gets the link of the PLatexObj.
Definition: PLatexObj.cpp:368
const std::vector< long unsigned int > & getVecSecNumber() const
Gets the vecSecNumber of the PLatexObj.
Definition: PLatexObj.cpp:438
PString vecNumberToString(const std::vector< long unsigned int > &vecNb)
Convert a vector of numbers into a string.
bool isSection(const PLatexObj &obj)
Say if the PLatexObj is a part, charpter, section, subsection or subsubsection.
PString getSectionTitle(POutoutMode &outputMode, const PLatexObj &obj)
Get the title of a part/chapter/section etc.

References PLatexType::FILE, PLatexObj::getLink(), getSectionTitle(), PLatexObj::getType(), PLatexObj::getVecContent(), PLatexObj::getVecSecNumber(), isSection(), and vecNumberToString().

Referenced by createOutlineHtml().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: