26 if(labelName ==
""){
return "";}
27 PString body(
"<span class=\"redirectIcon\"><a href=\"redirect.html?label="+labelName+
"\"><img src=\"images/iconlink_32.png\"></a></span>");
41 const PString objTitle,
const PString & prefixTitle,
bool addLinkLabel)
44 body +=
"\t\t<"+baliseName+
" id=\""+
valueToString(obj.
getId())+
"\" class=\""+cssClassName+
"\">";
45 if(prefixTitle !=
""){
46 body += prefixTitle +
" ";
50 body +=
" : "+objTitle;
54 body +=
"</"+baliseName+
">\n";
112 body +=
"<a href=\"" + obj.
getLink() +
"\">";
139 body +=
"<br /><br />\n";
150 body +=
"<a class=\"biblio\" href=\"" + obj.
getLink() +
"\">";
151 body +=
"[" + obj.
getText() +
"]";
152 body +=
"<span class=\"bibliospan\">";
186 body +=
"<b>" + obj.
getName() +
"</b>";
221 body +=
"<a href=\"#\">";
223 body +=
"<span class=\"footnotespan\">";
251 body +=
"\t<tr><td class=\"workinprogressimage\"><img src=\"images/wip.png\" alt=\"wip\" /></td></tr>\n";
254 body +=
"</table>\n";
267 body +=
"</summary>\n";
278 body +=
"\n<details id=\""+
valueToString(obj.
getId())+
"\" class=\"details\"><br />\n";
280 body +=
"</details>\n";
306 PPath fileName(baseContent);
308 if(fileName[0] !=
'/'){
316 phoenix_popen(
"dot -T png -o " + outputFileName +
" " + fileName);
333 if(fileName[0] !=
'/'){
354 if(cssClassName !=
""){
399 body +=
"<table id=\""+
valueToString(obj.
getId())+
"\" class=\"code\">\n\t<tbody>\n\t\t<tr>\n\t\t\t<td class=\"colLineNumbers\">\n\t\t\t\t<pre class=\"lineNumbers\">";
400 for(
long unsigned int i(0lu); i < obj.
getNbline(); ++i){
403 body +=
"</pre>\n\t\t\t</td>\n\t\t\t<td>\n\t\t\t\t<pre class=\"source\">\n";
435 body +=
"\t<tr id=\""+
valueToString(obj.
getId())+
"\" ><td class=\"timetableWeekRowStyle\">";
437 body +=
"</td></tr>\n";
438 body +=
"\t<tr class=\"timetableMainWeekRowStyle\"><td class=\"timetableMainWeekRowStyle\">\n";
440 body +=
"\t\t<table id=\""+
valueToString(obj.
getId())+
"\" class=\"timetableWeekStyle\">\n";
443 body +=
"\t</td></tr>\n";
454 body +=
"\t\t\t<tr id=\""+
valueToString(obj.
getId())+
"\" class=\"timetableTimeRow\">\n";
456 body +=
"\t\t\t</tr>\n";
475 body +=
"\" class=\"timetableDayStyle\">";
496 PString blockStyle(
"timetableBlockStyle");
500 body +=
" class=\""+blockStyle+
"\">";
521 body +=
" class=\"timetableEmptyBlockStyle\"></td>\n";
532 body +=
"\t\t\t\t<td id=\""+
valueToString(obj.
getId())+
"\" class=\"timetableTimeStyle\"><span class=\"timetableTimeTextStyle\">";
534 body +=
"</span></td>\n";
560 if(cssClassName !=
""){
561 body +=
" class=\""+cssClassName+
"\"";
602 body +=
"\t\t<td>\n";
604 body +=
"\t\t</td>\n";
618 for(PVecLatexObj::const_iterator it(vecObj.begin()); it != vecObj.end(); ++it){
623 body +=
"\t</tr>\n</table>\n";
632 if(vecNb.size() == 0lu){
return "";}
634 std::vector<long unsigned int>::const_iterator it(vecNb.begin());
637 while(it != vecNb.end()){
649 if(vecMenu.size() == 0lu){
return "";}
651 body +=
"\t\t<ul class=\"sommaire\">\n";
652 for(PVecMenu::const_iterator it(vecMenu.begin()); it != vecMenu.end(); ++it){
656 body += it->getText();
658 body +=
"</a></li>\n";
660 body +=
"\t\t</ul>\n";
673 body +=
"<!DOCTYPE html>\n";
674 body +=
"<html lang=\"fr\">\n";
675 body +=
"\t<head>\n";
676 body +=
"\t\t<meta charset=\"utf-8\" />\n";
677 body +=
"\t\t<title>"+title+
"</title>\n";
678 body +=
"\t\t<link rel=\"stylesheet\" href=\""+currentStyle+
"_style.css\" />\n";
680 if(useRemoteMathjax){
681 body +=
"\t\t<script src=\"load-mathjax.js\" async></script>\n";
683 body +=
"\t\t<script type=\"text/x-mathjax-config\">\n";
684 body +=
"\t\t\tMathJax.Hub.Config({\n";
685 body +=
"\t\t\t\textensions: [\"tex2jax.js\"],\n";
686 body +=
"\t\t\t\tjax: [\"input/TeX\",\"output/HTML-CSS\"],\n";
687 body +=
"\t\t\t\ttex2jax: {inlineMath: [[\"$\",\"$\"],[\"\\\\(\",\"\\\\)\"]]}\n";
688 body +=
"\t\t\t});\n";
689 body +=
"\t\t</script>\n";
690 body +=
"\t\t<script type=\"text/javascript\" src=\"MathJax.js\"></script>\n";
693 body +=
"\t</head>\n";
694 body +=
"\t<body>\n";
703 body +=
"\t</body>\n";
704 body +=
"</html>\n\n";
718 const PString & prefixTitle,
bool isBibliography)
722 for(PVecLatexObj::const_iterator it(vecObj.begin()); it != vecObj.end(); ++it){
734 outputMode.
mapVar[
"${PAGE_CONTENT}"] = body;
738 std::cerr <<
"platexobj_sectionHtml : can't save file '"<<fileName<<
"' for object '" << obj.
getName() <<
"'" << std::endl;
752 if(title ==
""){
return "";}
754 body +=
"\t<"+hLevel+
" class=\""+cssClassName+
"\">" + title +
"</"+hLevel+
">\n";
766 for(PVecLatexObj::const_iterator it(vecObj.begin()); it != vecObj.end(); ++it){
779 outputMode.
mapVar[
"${MAIN_TITLE}"] = bodyTitle;
781 outputMode.
mapVar[
"${PAGE_CONTENT}"] = body;
792 body +=
"\t\t<ul>\n";
794 body +=
"\t\t</ul>\n";
805 body +=
"\t\t<ol>\n";
807 body +=
"\t\t</ol>\n";
831 body +=
"\t<video width=\""+obj.
getText()+
"\" controls>\n";
832 body +=
"\t\t<!-- Be careful, if you do not have sound, check if the video has MP3 sound and not AC3 -->\n";
833 body +=
"\t\t<source src=\""+fileName+
"\" type=\"video/"+fileName.getExtension()+
"\">\n";
898 else if(type ==
PLatexType::ITEM){body = platexobj_htmlStrItem(outputMode, obj);}
929 if(type ==
PLatexType::PART){platexobj_sectionHtml(outputMode, obj,
"h1",
"ptexpart",
"Part", isBibliography);}
930 else if(type ==
PLatexType::CHAPTER){platexobj_sectionHtml(outputMode, obj,
"h2",
"ptexchapter",
"Chapter", isBibliography);}
931 else if(type ==
PLatexType::SECTION){platexobj_sectionHtml(outputMode, obj,
"h3",
"ptexsection",
"", isBibliography);}
932 else if(type ==
PLatexType::SUBSECTION){platexobj_sectionHtml(outputMode, obj,
"h4",
"ptexsubsection",
"", isBibliography);}
933 else if(type ==
PLatexType::SUBSUBSECTION){platexobj_sectionHtml(outputMode, obj,
"h5",
"ptexsubsubsection",
"", isBibliography);}
934 else if(type ==
PLatexType::FILE){body = platexobj_indexHtml(outputMode, obj, isBibliography);}
950 for(PVecLatexObj::const_iterator it(vecObj.begin()); it != vecObj.end(); ++it){
961 bool platexobj_copyFile(
const PString & inputFile,
const PString & outputDir){
962 PString command(
"cp " + inputFile +
" " + outputDir +
"/");
963 if(system(command.c_str()) != 0){
964 std::cerr <<
"platexobj_copyFile : can't copy file '"<<inputFile<<
"' into '"<<outputDir<<
"' directory" << std::endl;
976 bool platexobj_editVaraibleFile(
const PPath & inputFile,
const PPath & outputDir,
const POutoutMode & outputMode){
980 return outputFile.saveFileContent(updateContent);
1000 if(!indexHtml.saveFileContent(fileContent)){
1001 std::cerr <<
"platexobj_html : can't save file '"<<indexHtml<<
"'" << std::endl;
1009 if(!outputImageDir.createDirectory()){
1010 std::cerr <<
"platexobj_htmlStrLatex : can't create directory '" << outputImageDir <<
"'" << std::endl;
1014 PString installPrefix(CMAKE_INSTALL_PREFIX);
1015 if(baseInstallPrefix !=
""){
1016 installPrefix = baseInstallPrefix;
1020 PPath fileToBeCopied(installPrefix +
"/share/PhoenixTex2Html/Images/Mv83H.png");
1021 b &= platexobj_copyFile(fileToBeCopied, outputImageDir);
1022 PPath fileWipToBeCopied(installPrefix +
"/share/PhoenixTex2Html/Images/wip.png");
1023 b &= platexobj_copyFile(fileWipToBeCopied, outputImageDir);
1024 PPath fileLinkToBeCopied(installPrefix +
"/share/PhoenixTex2Html/Images/iconlink_32.png");
1025 b &= platexobj_copyFile(fileLinkToBeCopied, outputImageDir);
1026 PPath fileCalendarWhiteToBeCopied(installPrefix +
"/share/PhoenixTex2Html/Images/caldendar-icon-white-24x24.png");
1027 b &= platexobj_copyFile(fileCalendarWhiteToBeCopied, outputImageDir);
1028 PPath fileCalendarBlackToBeCopied(installPrefix +
"/share/PhoenixTex2Html/Images/caldendar-icon-black-24x24.png");
1029 b &= platexobj_copyFile(fileCalendarBlackToBeCopied, outputImageDir);
1032 PPath currentOutputDir(
"./");
1033 b &= platexobj_editVaraibleFile(
PPath(installPrefix +
"/share/PhoenixTex2Html/STYLE/BookTheme/variables.css"), currentOutputDir, outputMode);
1034 b &= platexobj_copyFile(installPrefix +
"/share/PhoenixTex2Html/STYLE/BookTheme/general.css", currentOutputDir);
1035 b &= platexobj_copyFile(installPrefix +
"/share/PhoenixTex2Html/STYLE/BookTheme/chrome.css", currentOutputDir);
1036 b &= platexobj_copyFile(installPrefix +
"/share/PhoenixTex2Html/STYLE/BookTheme/ayu-highlight.css", currentOutputDir);
1037 b &= platexobj_copyFile(installPrefix +
"/share/PhoenixTex2Html/STYLE/BookTheme/highlight.css", currentOutputDir);
1038 b &= platexobj_copyFile(installPrefix +
"/share/PhoenixTex2Html/STYLE/BookTheme/tomorrow-night.css", currentOutputDir);
1039 b &= platexobj_copyFile(installPrefix +
"/share/PhoenixTex2Html/STYLE/BookTheme/font-awesome.css", currentOutputDir);
1040 b &= platexobj_copyFile(installPrefix +
"/share/PhoenixTex2Html/STYLE/BookTheme/fonts.css", currentOutputDir);
1042 b &= platexobj_copyFile(installPrefix +
"/share/PhoenixTex2Html/javascript/BookTheme/clipboard.js", currentOutputDir);
1043 b &= platexobj_copyFile(installPrefix +
"/share/PhoenixTex2Html/javascript/BookTheme/highlight.js", currentOutputDir);
1044 b &= platexobj_copyFile(installPrefix +
"/share/PhoenixTex2Html/javascript/BookTheme/book.js", currentOutputDir);
1046 b &= platexobj_copyFile(installPrefix +
"/share/PhoenixTex2Html/Images/book_edit_icon.png", outputImageDir);
1047 b &= platexobj_copyFile(installPrefix +
"/share/PhoenixTex2Html/Images/book_gitlab_icon.png", outputImageDir);
1048 b &= platexobj_copyFile(installPrefix +
"/share/PhoenixTex2Html/Images/book_home_icon.png", outputImageDir);
1049 b &= platexobj_copyFile(installPrefix +
"/share/PhoenixTex2Html/Images/book_mail_icon.png", outputImageDir);
1050 b &= platexobj_copyFile(installPrefix +
"/share/PhoenixTex2Html/Images/book_next_icon.png", outputImageDir);
1051 b &= platexobj_copyFile(installPrefix +
"/share/PhoenixTex2Html/Images/book_prev_icon.png", outputImageDir);
1052 b &= platexobj_copyFile(installPrefix +
"/share/PhoenixTex2Html/Images/book_theme_icon.png", outputImageDir);
1053 b &= platexobj_copyFile(installPrefix +
"/share/PhoenixTex2Html/Images/book_toggle_sidebar_icon.png", outputImageDir);
1057 PPath fileJavascriptConfigToBeCopied(installPrefix +
"/share/PhoenixTex2Html/javascript/load-mathjax.js");
1058 b &= platexobj_copyFile(fileJavascriptConfigToBeCopied,
".");
#define LATEX_IMAGE_OUTPUT_DIR
const PLatexMenu & getNextSec() const
Gets the nextSec of the PLatexObj.
const std::vector< PLatexObj > & getVecContent() const
Gets the vecContent of the PLatexObj.
const std::vector< PLatexObj > & getComplexTitle() const
Gets the complexTitle of the PLatexObj.
const PString & getBalise() const
Gets the balise of the PLatexObj.
const std::vector< PLatexMenu > & getVecMenu() const
Gets the vecMenu of the PLatexObj.
const PString & getLabelName() const
Gets the labelName of the PLatexObj.
const PString & getSubTitle() const
Gets the subTitle of the PLatexObj.
const PLatexType::PLatexType & getType() const
Gets the type of the PLatexObj.
const PString & getName() const
Gets the name of the PLatexObj.
const PString & getLink() const
Gets the link of the PLatexObj.
const PLatexMenu & getParentSec() const
Gets the parentSec of the PLatexObj.
const PString & getAuthor() const
Gets the author of the PLatexObj.
const PString & getSourceFile() const
Gets the sourceFile of the PLatexObj.
size_t getSourceLine() const
Gets the sourceLine of the PLatexObj.
const std::vector< long unsigned int > & getVecSecNumber() const
Gets the vecSecNumber of the PLatexObj.
long unsigned int getId() const
Gets the id of the PLatexObj.
const PString & getText() const
Gets the text of the PLatexObj.
long unsigned int getRowSpan() const
Gets the rowSpan of the PLatexObj.
const PString & getDate() const
Gets the date of the PLatexObj.
const PLatexMenu & getPrevSec() const
Gets the prevSec of the PLatexObj.
long unsigned int getColSpan() const
Gets the colSpan of the PLatexObj.
long unsigned int getNbline() const
Gets the nbline of the PLatexObj.
Path of a directory or a file.
bool saveFileContent(const PString &content) const
Save a PString in a file.
PPath getParentDirectory() const
Get path of parent directory of current path.
bool isFileExist() const
Say if the current file path does exist.
PString loadFileContent() const
Get the file content in a PString.
PPath getFileName() const
Get the name of the file, from last char to /.
PString replace(const PString &pattern, const PString &replaceStr) const
Replace a PString into an other PString.
PString eraseFirstLastChar(const PString &vecChar) const
Erase first and last char in a string.
PString eraseLastChar(const PString &vecChar) const
Erase first and last char in a string.
std::string valueToString(const T &val)
Convert a type into a string.
PLatexType
Type of the PLatexObj.
PString convertStrToHtml(const PString &str)
fonction qui converti une chaîne de caractères en html (elle remplace les caractères spéciaux)
PString phoenix_getenv(const PString &varName)
Get the value of the given environment variable.
PString phoenix_popen(const PString &command)
Execute the given command and returns the output of this command.
PString platexobj_htmlStrCitation(const PLatexObj &obj)
Convert a PLatexObj into a string.
PString platexobj_htmlStrTimetable(POutoutMode &outputMode, const PLatexObj &obj)
Convert a timetable into a html string.
PString platexobj_htmlStrHtml(const PLatexObj &obj)
Convert a PLatexObj into a string.
PString platexobj_htmlStrTimetableEmptyBlock(POutoutMode &outputMode, const PLatexObj &obj)
Convert a timetable block into a html string.
PString platexobj_createLabelSearchLink(const PString &labelName)
Create the link to the label of the current PLatexObj if it exist.
PString platexobj_htmlStrTextFootnote(POutoutMode &outputMode, const PLatexObj &obj)
Convert a PLatexObj into a string.
PString vecMenuToHtml(const PVecMenu &vecMenu)
Convert the vector of menu into a html string.
PString platexobj_htmlStrNewLine(const PLatexObj &obj)
Convert a PLatexObj into a string.
PString platexobj_htmlStrUpdateStyle(POutoutMode &outputMode, const PLatexObj &obj)
Convert a PLatexObj into a string.
PString platexobj_htmlStrSpaceParagraph(const PLatexObj &obj)
Convert a PLatexObj into a string.
PString platexobj_htmlStrWip(POutoutMode &outputMode, const PLatexObj &obj)
Convert a PLatexObj into a string.
PString platexobj_htmlStrColumns(POutoutMode &outputMode, const PLatexObj &obj)
Convert a PLatexObj into a string.
PString platexobj_htmlStrCallDot(POutoutMode &outputMode, const PLatexObj &obj)
Convert a PLatexObj into a string.
PString platexobj_htmlStrTimetableTime(POutoutMode &outputMode, const PLatexObj &obj)
Convert a timetable time into a html string.
PString platexobj_htmlStrTimetableDay(POutoutMode &outputMode, const PLatexObj &obj)
Convert a timetable day into a html string.
PString platexobj_htmlStrTabCell(POutoutMode &outputMode, const PLatexObj &obj)
Convert a tabular into a html string.
PString platexobj_htmlStrTabRow(POutoutMode &outputMode, const PLatexObj &obj)
Convert a tabular into a html string.
PString vecNumberToString(const std::vector< long unsigned int > &vecNb)
Convert a vector of numbers into a string.
PString platexobj_htmlStrUrl(const PLatexObj &obj)
Convert a PLatexObj into a string.
PString platexobj_htmlStrTimetableBlock(POutoutMode &outputMode, const PLatexObj &obj)
Convert a timetable block into a html string.
PString platexobj_htmlStrBasicEnv(POutoutMode &outputMode, const PLatexObj &obj, const PString &baliseName, const PString &cssClassName, bool allowText)
Convert a basic environement into a string.
PString platexobj_htmlStrExtraEnvironement(POutoutMode &outputMode, const PLatexObj &obj)
Convert a PLatexObj into a string.
PString platexobj_htmlStrQuote(POutoutMode &outputMode, const PLatexObj &obj)
Convert a PLatexObj into a string.
PString platexobj_htmlStrTextDebug(const PLatexObj &obj)
Convert a PLatexObj into a string.
PString platexobj_htmlStrExtraFunction(POutoutMode &outputMode, const PLatexObj &obj)
Convert a PLatexObj into a string.
PString platexobj_htmlStrTextBf(const PLatexObj &obj)
Convert a PLatexObj into a string.
PString platexobj_htmlStrExtraParser(const PLatexObj &obj)
Convert a PLatexObj into a string.
PString platexobj_htmlStrSvgToPng(POutoutMode &outputMode, const PLatexObj &obj)
Convert a PLatexObj into a string.
PString platexobj_htmlStrHref(POutoutMode &outputMode, const PLatexObj &obj)
Convert a PLatexObj into a string.
PString platexobj_htmlStrRendezVous(const PLatexObj &obj)
Convert a rendez-vous into a html string.
PString getHtmlHeader(const PString &title, bool useMathJax, bool useRemoteMathjax, const PString ¤tStyle)
Get the html header.
PString platexobj_htmlStrAllPart(POutoutMode &outputMode, const PLatexObj &obj, const PString &hLevel, const PString &cssClassName)
Convert a PLatexObj into a string.
PString platexobj_htmlStrText(const PLatexObj &obj)
Convert a PLatexObj into a string.
PString platexobj_htmlStrDetail(POutoutMode &outputMode, const PLatexObj &obj)
Convert a PLatexObj into a string.
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_htmlStrGetEnv(const PLatexObj &obj)
Convert a PLatexObj into a string.
PString platexobj_htmlStrRef(const PLatexObj &obj)
Convert a PLatexObj into a string.
PString platexobj_htmlStrSummary(POutoutMode &outputMode, const PLatexObj &obj)
Convert a PLatexObj into a string.
PString platexobj_htmlStrCaption(POutoutMode &outputMode, const PLatexObj &obj)
Convert a PLatexObj into a string.
PString platexobj_htmlStrTimetableTimeRow(POutoutMode &outputMode, const PLatexObj &obj)
Convert a timetable time row into a html string.
PString platexobj_htmlStrTextIt(const PLatexObj &obj)
Convert a PLatexObj into a string.
PString platexobj_htmlStrTimetableWeek(POutoutMode &outputMode, const PLatexObj &obj)
Convert a timetable week into a html string.
PString platexobj_htmlStrTabular(POutoutMode &outputMode, const PLatexObj &obj)
Convert a tabular into a html string.
PString platexobj_htmlStr(POutoutMode &outputMode, const PLatexObj &obj, bool isBibliography=false, bool allowText=true)
PString platexobj_htmlMainTitle(const PString &title, const PString &hLevel, const PString &cssClassName)
bool platexobj_htmlStrBase(PString &body, POutoutMode &outputMode, const PLatexObj &obj, bool isBibliography, bool allowText)
bool platexobj_html(POutoutMode &outputMode, const PLatexObj &obj, bool isBibliography=false, const PString &baseInstallPrefix="")
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 platexobj_text(const std::vector< PLatexObj > &vecObj)
Convert a PLatexObj in text.
PString platexobj_htmlStrImage(const PLatexObj &obj)
Convert a PLatexObj into a string.
PString getSecNumberFromFileName(const PPath &fileName)
Get the section number from its file name.
PString getSectionTitle(POutoutMode &outputMode, const PLatexObj &obj)
Get the title of a part/chapter/section etc.
std::vector< PLatexObj > PVecLatexObj
Vector of obj.
std::vector< PLatexMenu > PVecMenu
Vector of PLatexMenu.
Output mode of the html backend.
PMapKnownVar mapVar
Map of output var which are use to fill the output themes.
bool isBookTheme
True to activate the book theme.
PString bookSideBarWidth
Witdh of the book side bar.
bool isRemoteMathjax
True to activate mathjax but in remote mode (so no need to have mathjax in the generated site)
PString currentStyle
Current style to be used for the generated pages of the site.