PhoenixLecture  2.0.0
Set of tools to make lectures
platexobj_html_book.cpp File Reference
#include "phoenix_system.h"
#include "platexobj_html.h"
#include "platexobj_menu.h"
#include "platexobj_rawtext.h"
#include "platexobj_html_book.h"
+ Include dependency graph for platexobj_html_book.cpp:

Go to the source code of this file.

Functions

bool platexobj_book_createPage (POutoutMode &outputMode, const PLatexObj &obj, const PString &baliseName, const PString &cssClassName, const PString &prefixTitle, bool isBibliography)
 Create a page with book theme. More...
 
PString platexobj_bookHtml (POutoutMode &outputMode, const PLatexObj &obj, bool isBibliography, bool allowText)
 Convert a PLatexObj into a string with book theme. More...
 
PString platexobj_bookHtml (POutoutMode &outputMode, const std::vector< PLatexObj > &vecObj, bool isBibliography, bool allowText)
 Convert a PLatexObj into a string with book theme. More...
 
PString platexobj_bookIndexHtml (POutoutMode &outputMode, const PLatexObj &obj, bool isBibliography)
 Save the index.html file. More...
 

Function Documentation

◆ platexobj_book_createPage()

bool platexobj_book_createPage ( POutoutMode outputMode,
const PLatexObj obj,
const PString baliseName,
const PString cssClassName,
const PString prefixTitle,
bool  isBibliography 
)

Create a page with book theme.

Parameters
[out]outputMode: output mode of the html backend
obj: PLatexObj to be saved
baliseName: name of the title balise
cssClassName: css class to be used
prefixTitle: prefix of the title (Part or Chapter)
isBibliography: true if there is a bibliography, false if not
Returns
true on success, false otherwise

Definition at line 24 of file platexobj_html_book.cpp.

26 {
27  PString body("");
28  const PVecLatexObj & vecObj = obj.getVecContent();
29  for(PVecLatexObj::const_iterator it(vecObj.begin()); it != vecObj.end(); ++it){
30  body += platexobj_bookHtml(outputMode, *it, isBibliography, true);
31  }
32  PString objTitle(getSectionTitle(outputMode, obj)); //Content of the section title
34  obj.getPrevSec().getLink(), obj.getPrevSec().getText(),
35  obj.getNextSec().getLink(), obj.getNextSec().getText(),
36  obj.getParentSec().getLink(), obj.getParentSec().getText(),
37  obj.getSourceFile(), obj.getSourceLine());
38 
39  outputMode.mapVar["${MAIN_TITLE}"] = "\t\t" + platexobj_createTitle(obj, baliseName, cssClassName, objTitle, prefixTitle, true);
40 // outputMode.mapVar["${SUB_MENU}"] = vecMenuToHtml(obj.getVecMenu());
41  outputMode.mapVar["${SUB_MENU}"] = "";
42  outputMode.mapVar["${PAGE_CONTENT}"] = body;
43 
44  PPath fileName(obj.getLink());
45  if(!fileName.saveFileContent(platexobj_theme_createPage(outputMode))){
46  std::cerr << "platexobj_book_createPage : can't save file '"<<fileName<<"' for object '" << obj.getName() << "'" << std::endl;
47  return false;
48  }else{
49 // std::cout << "platexobj_book_createPage : save file '"<<fileName<<"'" << std::endl;
50  return true;
51  }
52 }
const PString & getText() const
Gets the text of the PLatexMenu.
Definition: PLatexObj.cpp:69
const PString & getLink() const
Gets the link of the PLatexMenu.
Definition: PLatexObj.cpp:55
const PLatexMenu & getNextSec() const
Gets the nextSec of the PLatexObj.
Definition: PLatexObj.cpp:480
const std::vector< PLatexObj > & getVecContent() const
Gets the vecContent of the PLatexObj.
Definition: PLatexObj.cpp:410
const std::vector< PLatexObj > & getComplexTitle() const
Gets the complexTitle of the PLatexObj.
Definition: PLatexObj.cpp:396
const PString & getName() const
Gets the name of the PLatexObj.
Definition: PLatexObj.cpp:326
const PString & getLink() const
Gets the link of the PLatexObj.
Definition: PLatexObj.cpp:368
const PLatexMenu & getParentSec() const
Gets the parentSec of the PLatexObj.
Definition: PLatexObj.cpp:494
const PString & getSourceFile() const
Gets the sourceFile of the PLatexObj.
Definition: PLatexObj.cpp:536
size_t getSourceLine() const
Gets the sourceLine of the PLatexObj.
Definition: PLatexObj.cpp:550
const PLatexMenu & getPrevSec() const
Gets the prevSec of the PLatexObj.
Definition: PLatexObj.cpp:466
Path of a directory or a file.
Definition: PPath.h:17
Extends the std::string.
Definition: PString.h:16
PString platexobj_theme_createPage(POutoutMode &outputMode)
Create the page from variables in POutoutMode.
void platexobj_theme_update_var(POutoutMode &outputMode, const PString &pageLink, const PString &pageTitle, const PString &prevSecLink, const PString &prevSecTitle, const PString &nextSecLink, const PString &nextSecTitle, const PString &parentSecLink, const PString &parentSecTitle, const PPath &currentSourceFile, size_t currentSourceLine)
Update var of POutoutMode for current section.
PString platexobj_createTitle(const PLatexObj &obj, const PString &baliseName, const PString &cssClassName, const PString objTitle, const PString &prefixTitle, bool addLinkLabel)
Create a title.
PString platexobj_bookHtml(POutoutMode &outputMode, const std::vector< PLatexObj > &vecObj, bool isBibliography, bool allowText)
Convert a PLatexObj into a string with book theme.
PString platexobj_rawtext(const std::vector< PLatexObj > &vecObj)
Convert a PLatexObj in text.
PString getSectionTitle(POutoutMode &outputMode, const PLatexObj &obj)
Get the title of a part/chapter/section etc.
std::vector< PLatexObj > PVecLatexObj
Vector of obj.
PMapKnownVar mapVar
Map of output var which are use to fill the output themes.

References PLatexObj::getComplexTitle(), PLatexMenu::getLink(), PLatexObj::getLink(), PLatexObj::getName(), PLatexObj::getNextSec(), PLatexObj::getParentSec(), PLatexObj::getPrevSec(), getSectionTitle(), PLatexObj::getSourceFile(), PLatexObj::getSourceLine(), PLatexMenu::getText(), PLatexObj::getVecContent(), POutoutMode::mapVar, platexobj_bookHtml(), platexobj_createTitle(), platexobj_rawtext(), platexobj_theme_createPage(), platexobj_theme_update_var(), and PPath::saveFileContent().

Referenced by platexobj_bookHtml().

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

◆ platexobj_bookHtml() [1/2]

PString platexobj_bookHtml ( POutoutMode outputMode,
const PLatexObj obj,
bool  isBibliography,
bool  allowText 
)

Convert a PLatexObj into a string with book theme.

Parameters
[out]outputMode: output mode of the html backend
obj: PLatexObj to be converted into a string
isBibliography: true if there is a bibliography, false otherwise
allowText: true if the TEXT PLatexObj are allowed, false if not
Returns
output string which contains the PLatexObj

Definition at line 105 of file platexobj_html_book.cpp.

105  {
106  PString body("");
107  PLatexType::PLatexType type(obj.getType());
108  if(type == PLatexType::PART){platexobj_book_createPage(outputMode, obj, "h1", "ptexpart", "Part", isBibliography);}
109  else if(type == PLatexType::CHAPTER){platexobj_book_createPage(outputMode, obj, "h2", "ptexchapter", "Chapter", isBibliography);}
110  else if(type == PLatexType::SECTION){platexobj_book_createPage(outputMode, obj, "h3", "ptexsection", "", isBibliography);}
111  else if(type == PLatexType::SUBSECTION){platexobj_book_createPage(outputMode, obj, "h4", "ptexsubsection", "", isBibliography);}
112  else if(type == PLatexType::SUBSUBSECTION){platexobj_book_createPage(outputMode, obj, "h5", "ptexsubsubsection", "", isBibliography);}
113  else if(type == PLatexType::FILE){body = platexobj_bookIndexHtml(outputMode, obj, isBibliography);}
114  else if(!platexobj_htmlStrBase(body, outputMode, obj, isBibliography, allowText)){
115  body = platexobj_bookHtml(outputMode, obj.getVecContent(), isBibliography, allowText);
116  }
117  return body;
118 }
const PLatexType::PLatexType & getType() const
Gets the type of the PLatexObj.
Definition: PLatexObj.cpp:298
PLatexType
Type of the PLatexObj.
Definition: PLatexType.h:12
@ SUBSUBSECTION
Definition: PLatexType.h:54
bool platexobj_htmlStrBase(PString &body, POutoutMode &outputMode, const PLatexObj &obj, bool isBibliography, bool allowText)
bool platexobj_book_createPage(POutoutMode &outputMode, const PLatexObj &obj, const PString &baliseName, const PString &cssClassName, const PString &prefixTitle, bool isBibliography)
Create a page with book theme.
PString platexobj_bookIndexHtml(POutoutMode &outputMode, const PLatexObj &obj, bool isBibliography)
Save the index.html file.

References PLatexType::CHAPTER, PLatexType::FILE, PLatexObj::getType(), PLatexObj::getVecContent(), PLatexType::PART, platexobj_book_createPage(), platexobj_bookHtml(), platexobj_bookIndexHtml(), platexobj_htmlStrBase(), PLatexType::SECTION, PLatexType::SUBSECTION, and PLatexType::SUBSUBSECTION.

+ Here is the call graph for this function:

◆ platexobj_bookHtml() [2/2]

PString platexobj_bookHtml ( POutoutMode outputMode,
const std::vector< PLatexObj > &  vecObj,
bool  isBibliography,
bool  allowText 
)

Convert a PLatexObj into a string with book theme.

Parameters
[out]outputMode: output mode of the html backend
vecObj: vector of PLatexObj to be converted into a string
isBibliography: true if there is a bibliography, false otherwise
allowText: true if the TEXT PLatexObj are allowed, false if not
Returns
output string which contains the PLatexObj

Definition at line 90 of file platexobj_html_book.cpp.

90  {
91  PString body("");
92  for(std::vector<PLatexObj>::const_iterator it(vecObj.begin()); it != vecObj.end(); ++it){
93  body += platexobj_bookHtml(outputMode, *it, isBibliography, allowText);
94  }
95  return body;
96 }

Referenced by platexobj_book_createPage(), platexobj_bookHtml(), and platexobj_bookIndexHtml().

+ Here is the caller graph for this function:

◆ platexobj_bookIndexHtml()

PString platexobj_bookIndexHtml ( POutoutMode outputMode,
const PLatexObj obj,
bool  isBibliography 
)

Save the index.html file.

Parameters
[out]outputMode: output mode of the html backend
obj: PLatexObj to be used
isBibliography: true if there is a bibliography, false otherwise

Definition at line 59 of file platexobj_html_book.cpp.

59  {
60  PString body("");
61  const PVecLatexObj & vecObj = obj.getVecContent();
62  for(PVecLatexObj::const_iterator it(vecObj.begin()); it != vecObj.end(); ++it){
63  body += platexobj_bookHtml(outputMode, *it, isBibliography, true);
64  }
65  PString objTitle(obj.getName()); //Content of the section title
66  platexobj_theme_update_var(outputMode, obj.getLink(), objTitle,
67  obj.getPrevSec().getLink(), obj.getPrevSec().getText(),
68  obj.getNextSec().getLink(), obj.getNextSec().getText(),
69  obj.getParentSec().getLink(), obj.getParentSec().getText(),
70  obj.getSourceFile(), obj.getSourceLine());
71  PString bodyTitle("");
72  bodyTitle += platexobj_htmlMainTitle(obj.getName(), "h1", "mainTitle");
73  bodyTitle += platexobj_htmlMainTitle(obj.getSubTitle(), "h2", "mainSubTitle");
74  bodyTitle += platexobj_htmlMainTitle(obj.getAuthor(), "h5", "author");
75  bodyTitle += platexobj_htmlMainTitle(obj.getDate(), "h6", "date");
76  outputMode.mapVar["${MAIN_TITLE}"] = bodyTitle;
77 // outputMode.mapVar["${SUB_MENU}"] = vecMenuToHtml(obj.getVecMenu());
78  outputMode.mapVar["${SUB_MENU}"] = "";
79  outputMode.mapVar["${PAGE_CONTENT}"] = body;
80  return platexobj_theme_createPage(outputMode);
81 }
const PString & getSubTitle() const
Gets the subTitle of the PLatexObj.
Definition: PLatexObj.cpp:340
const PString & getAuthor() const
Gets the author of the PLatexObj.
Definition: PLatexObj.cpp:508
const PString & getDate() const
Gets the date of the PLatexObj.
Definition: PLatexObj.cpp:522
PString platexobj_htmlMainTitle(const PString &title, const PString &hLevel, const PString &cssClassName)

References PLatexObj::getAuthor(), PLatexObj::getDate(), PLatexMenu::getLink(), PLatexObj::getLink(), PLatexObj::getName(), PLatexObj::getNextSec(), PLatexObj::getParentSec(), PLatexObj::getPrevSec(), PLatexObj::getSourceFile(), PLatexObj::getSourceLine(), PLatexObj::getSubTitle(), PLatexMenu::getText(), PLatexObj::getVecContent(), POutoutMode::mapVar, platexobj_bookHtml(), platexobj_htmlMainTitle(), platexobj_theme_createPage(), and platexobj_theme_update_var().

Referenced by platexobj_bookHtml().

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