From 44ade01a4aabd9b9e9ffd2afa51a719cf6bc5bd9 Mon Sep 17 00:00:00 2001
From: Pierre Aubert <pierre.aubert.lapp@gmail.com>
Date: Tue, 23 Aug 2022 18:06:34 +0200
Subject: [PATCH 01/18] Add base of theme variables and function to update it

---
 share/PhoenixTex2Html/THEME/CMakeLists.txt |   8 +
 share/PhoenixTex2Html/THEME/book.html      | 166 +++++++++++++++++++++
 share/PhoenixTex2Html/THEME/default.html   |  32 ++++
 src/PLatexObj/platexobj_formulae.cpp       |   9 +-
 src/PLatexObj/platexobj_formulae.h         |   7 +
 src/main.cpp                               | 101 ++++++++-----
 6 files changed, 286 insertions(+), 37 deletions(-)
 create mode 100644 share/PhoenixTex2Html/THEME/CMakeLists.txt
 create mode 100644 share/PhoenixTex2Html/THEME/book.html
 create mode 100644 share/PhoenixTex2Html/THEME/default.html

diff --git a/share/PhoenixTex2Html/THEME/CMakeLists.txt b/share/PhoenixTex2Html/THEME/CMakeLists.txt
new file mode 100644
index 0000000..1114e69
--- /dev/null
+++ b/share/PhoenixTex2Html/THEME/CMakeLists.txt
@@ -0,0 +1,8 @@
+
+file(GLOB listFile "${CMAKE_CURRENT_SOURCE_DIR}/*.html")
+
+install(FILES ${listFile} DESTINATION share/PhoenixTex2Html/THEME)
+
+
+
+
diff --git a/share/PhoenixTex2Html/THEME/book.html b/share/PhoenixTex2Html/THEME/book.html
new file mode 100644
index 0000000..b14f5b0
--- /dev/null
+++ b/share/PhoenixTex2Html/THEME/book.html
@@ -0,0 +1,166 @@
+<!DOCTYPE html>
+<html class="js sidebar-visible navy" lang="fr">
+	<head>
+		<meta charset="UTF-8">
+		<title>${PAGE_TITLE}</title>
+		<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+		<meta name="description" content="${PAGE_TITLE}">
+		<meta name="viewport" content="width=device-width, initial-scale=1">
+		<meta name="theme-color" content="rgba(0, 0, 0, 0)">
+		<link rel="stylesheet" href="variables.css">
+		<link rel="stylesheet" href="dark_style.css" />
+		<link rel="stylesheet" href="general.css">
+		<link rel="stylesheet" href="chrome.css">
+		<link rel="stylesheet" href="highlight.css" disabled="">
+		<link rel="stylesheet" href="tomorrow-night.css">
+		<link rel="stylesheet" href="ayu-highlight.css" disabled="">
+		<!-- Fonts -->
+		<link rel="stylesheet" href="font-awesome.css">
+		<link rel="stylesheet" href="fonts.css">
+	</head>
+	<body>
+		<div id="MathJax_Message" style="display: none;"></div>
+		<!-- Provide site root to javascript -->
+		<script type="text/javascript">
+		    var path_to_root = "./";
+		    var default_theme = window.matchMedia("(prefers-color-scheme: dark)").matches ? "navy" : "light";
+		</script>
+		
+		<!-- Work around some values being stored in localStorage wrapped in quotes -->
+		<script type="text/javascript">
+			try {
+				var theme = localStorage.getItem('mdbook-theme');
+				var sidebar = localStorage.getItem('mdbook-sidebar');
+		
+			if (theme.startsWith('"') && theme.endsWith('"')) {
+				localStorage.setItem('mdbook-theme', theme.slice(1, theme.length - 1));
+			}
+		
+			if (sidebar.startsWith('"') && sidebar.endsWith('"')) {
+				localStorage.setItem('mdbook-sidebar', sidebar.slice(1, sidebar.length - 1));
+			}
+			} catch (e) { }
+		</script>
+		
+		<!-- Set the theme before any content is loaded, prevents flash -->
+		<script type="text/javascript">
+			var theme;
+			try { theme = localStorage.getItem('mdbook-theme'); } catch(e) { }
+			if (theme === null || theme === undefined) { theme = default_theme; }
+			var html = document.querySelector('html');
+			html.classList.remove('no-js')
+			html.classList.remove('light')
+			html.classList.add(theme);
+			html.classList.add('js');
+		</script>
+		
+		<!-- Hide / unhide sidebar before it is displayed -->
+		<script type="text/javascript">
+			var html = document.querySelector('html');
+			var sidebar = 'hidden';
+			if (document.body.clientWidth >= 1080) {
+				try { sidebar = localStorage.getItem('mdbook-sidebar'); } catch(e) { }
+				sidebar = sidebar || 'visible';
+			}
+			html.classList.remove('sidebar-visible');
+			html.classList.add("sidebar-" + sidebar);
+		</script>
+		<nav id="sidebar" class="sidebar" aria-label="Table of contents">
+			<div class="sidebar-scrollbox">
+				<ol class="chapter">
+					<li class="chapter-item "><a href="index.html">Main Page</a></li>
+					<li class="chapter-item expanded"><a href="1-38.html"><strong aria-hidden="true">1.</strong> Simple figure</a></li>
+					<li class="chapter-item affix "><li class="part-title">Separator before developement </li>
+					<li class="chapter-item "><a href="2-64.html"><strong aria-hidden="true">2.</strong> Developement</a><a class="toggle"><div>❱</div></a></li>
+					<li>
+						<ol class="section">
+							<li class="chapter-item "><a href="2-1-66.html"><strong aria-hidden="true">2.1.</strong> <span id="0" class="progStyle">CMake</span></a></li>
+							<li class="chapter-item "><a href="2-2-75.html"><strong aria-hidden="true">2.2.</strong> <span id="0" class="libStyle">C++</span></a></li>
+							<li class="chapter-item "><a href="2-3-83.html"><strong aria-hidden="true">2.3.</strong> Compilation</a></li>
+						</ol>
+					</li>
+					<li class="chapter-item "><a href="3-89.html"><strong aria-hidden="true">3.</strong> Extra environement</a></li>
+				</ol>
+			</div>
+			<div id="sidebar-resize-handle" class="sidebar-resize-handle"></div>
+		</nav>
+		<div id="page-wrapper" class="page-wrapper">
+			<div class="page">
+				<div id="menu-bar-hover-placeholder"></div>
+				<div id="menu-bar" class="menu-bar" style="top: 0px;">
+					<div class="left-buttons">
+						<button id="sidebar-toggle" class="icon-button book-button" type="button" title="Toggle Table of Contents" aria-label="Toggle Table of Contents" aria-controls="sidebar" aria-expanded="true">
+							<i class="fa book-toggle-sidebar-icon"></i>
+						</button>
+						<button id="theme-toggle" class="icon-button book-button" type="button" title="Change theme" aria-label="Change theme" aria-haspopup="true" aria-expanded="false" aria-controls="theme-list">
+							<i class="fa book-theme-icon"></i>
+						</button>
+						<ul id="theme-list" class="theme-popup" aria-label="Themes" role="menu">
+							<li role="none"><button role="menuitem" class="theme" id="navy">Navy</button></li>
+						</ul>
+						${IS_GITLAB_URL_BEGIN}<a href="${GITLAB_URL}" title="Git repository" aria-label="Git repository">
+							<i id="git-repository-button" class="fa book-gitlab-icon"></i>
+						</a>${IS_GITLAB_URL_END}
+						<a href="mailto: your.address@amail.com" title="Send email to authors" aria-label="Send mail">
+							<i id="git-repository-button" class="fa book-mail-icon"></i>
+						</a>
+						${IS_GITLAB_URL_BEGIN}<a href="${GITLAB_URL}/-/edit/master
+/TESTS/TEST_BOOK_SEPARATOR_IMAGE_DARK/testsection.tex#L27" title="Suggest an edit" aria-label="Suggest an edit">
+							<i id="git-edit-button" class="fa book-edit-icon"></i>
+						</a>${IS_GITLAB_URL_END}
+						${IS_GITLAB_URL_BEGIN}<a href="${GITLAB_URL}" title="Master project" aria-label="Master projec">
+							<i id="master-project-button" class="fa book-home-icon"></i>
+						</a>${IS_GITLAB_URL_END}
+					</div>
+					<h1 class="menu-title"></h1>
+				
+					<div class="right-buttons">
+						<a href="https://gitlab.in2p3.fr/CTA-LAPP/PHOENIX_LIBS/PhoenixTex2Html/" title="PhoenixTex2Html" aria-label="PhoenixTex2Html compiler">
+							<i id="git-repository-button" class="fa book-gitlab-icon"></i>
+						</a>
+				
+					</div>
+				</div>
+				<!-- Apply ARIA attributes after the sidebar and the sidebar toggle button are added to the DOM -->
+				<script type="text/javascript">
+					document.getElementById('sidebar-toggle').setAttribute('aria-expanded', sidebar === 'visible');
+					document.getElementById('sidebar').setAttribute('aria-hidden', sidebar !== 'visible');
+					Array.from(document.querySelectorAll('#sidebar a')).forEach(function(link) {
+						link.setAttribute('tabIndex', sidebar === 'visible' ? 0 : -1);
+					});
+				</script>
+				<div id="content" class="content">
+					<main>
+${PAGE_CONTENT}
+					</main>
+					<nav class="nav-wrapper" aria-label="Page navigation">
+						<!-- Mobile navigation buttons -->
+						${IS_PREV_PAGE_BEGIN}<a rel="prev" href="${PREV_PAGE}" class="mobile-nav-chapters previous" title="Previous page" aria-label="Previous page" aria-keyshortcuts="Left">
+							<i class="book-prev-icon"></i>
+						</a>${IS_PREV_PAGE_END}
+						${IS_NEXT_PAGE_BEGIN}<a rel="next" href="${NEXT_PAGE}" class="mobile-nav-chapters next" title="Next page" aria-label="Next page" aria-keyshortcuts="Right">
+							<i class="book-next-icon"></i>
+						</a>${IS_NEXT_PAGE_END}
+						<div style="clear: both"></div>
+					</nav>
+				</div>
+			</div>
+			<nav class="nav-wide-wrapper" aria-label="Page navigation">
+				<!-- Mobile navigation buttons -->
+				${IS_PREV_PAGE_BEGIN}<a rel="prev" href="${PREV_PAGE}" class="nav-chapters previous" title="Previous page" aria-label="Previous page" aria-keyshortcuts="Left">
+					<i class="book-prev-icon"></i>
+				</a>${IS_PREV_PAGE_END}
+				${IS_NEXT_PAGE_BEGIN}<a rel="next" href="${NEXT_PAGE}" class="nav-chapters next" title="Next page" aria-label="Next page" aria-keyshortcuts="Right">
+					<i class="book-next-icon"></i>
+				</a>${IS_NEXT_PAGE_END}
+			</nav>
+		</div>
+		<script type="text/javascript">
+			window.playground_copyable = true;
+		</script>
+		<script src="clipboard.js" type="text/javascript" charset="utf-8"></script>
+		<script src="highlight.js" type="text/javascript" charset="utf-8"></script>
+		<script src="book.js" type="text/javascript" charset="utf-8"></script>
+	</body>
+</html>
+
diff --git a/share/PhoenixTex2Html/THEME/default.html b/share/PhoenixTex2Html/THEME/default.html
new file mode 100644
index 0000000..211a0cc
--- /dev/null
+++ b/share/PhoenixTex2Html/THEME/default.html
@@ -0,0 +1,32 @@
+<!DOCTYPE html>
+<html lang="fr">
+	<head>
+		<meta charset="utf-8" />
+		<title>${PAGE_TITLE}</title>
+		<link rel="stylesheet" href="base_style.css" />
+	</head>
+	<body>
+		<table class="navigationMenu">
+			<tr>
+			${IS_PREV_PAGE_BEGIN}<td style="text-align: left;">Previous<br /><a href="${PREV_PAGE}">${PREV_PAGE_TITLE}</a></td>${IS_PREV_PAGE_END}
+			<td style="text-align: center;">Parent<br /><a href="index.html">Main Page</a></td>
+			<td><a href="outline.html">Outline</a></td>
+			${IS_BIBLIOGRAPHY_BEGIN}<td><a href="bibliography.html">Bibliography</a></td>${IS_BIBLIOGRAPHY_END}
+			${IS_NEXT_PAGE_BEGIN}<td style="text-align: right;">Next<br /><a href="${NEXT_PAGE}">${NEXT_PAGE_TITLE}</a></td>${IS_NEXT_PAGE_END}
+			</tr>
+		</table>
+		<div class="pageContent">
+${PAGE_CONTENT}
+		</div>
+		<table class="navigationMenuBottom">
+			<tr>
+			${IS_PREV_PAGE_BEGIN}<td style="text-align: left;">Previous<br /><a href="${PREV_PAGE}">${PREV_PAGE_TITLE}</a></td>${IS_PREV_PAGE_END}
+			<td style="text-align: center;">Parent<br /><a href="index.html">Main Page</a></td>
+			<td><a href="outline.html">Outline</a></td>
+			${IS_BIBLIOGRAPHY_BEGIN}<td><a href="bibliography.html">Bibliography</a></td>${IS_BIBLIOGRAPHY_END}
+			${IS_NEXT_PAGE_BEGIN}<td style="text-align: right;">Next<br /><a href="${NEXT_PAGE}">${NEXT_PAGE_TITLE}</a></td>${IS_NEXT_PAGE_END}
+			</tr>
+		</table>
+	</body>
+</html>
+
diff --git a/src/PLatexObj/platexobj_formulae.cpp b/src/PLatexObj/platexobj_formulae.cpp
index 426e08a..7628723 100644
--- a/src/PLatexObj/platexobj_formulae.cpp
+++ b/src/PLatexObj/platexobj_formulae.cpp
@@ -172,6 +172,11 @@ std::string platexobj_htmlStrInlineMath(POutoutMode & outputMode, const PLatexOb
 	return body;
 }
 
-
-
+///Update the theme of the generated website
+/**	@param[out] outputMode : POutoutMode to be updated
+ * 	@param themeBaseFile : file which contains the theme we want to use
+*/
+void platexobj_update_theme(POutoutMode & outputMode, const std::string & themeBaseFile){
+	dico_create_nested_call(outputMode.themeCall, getFileContent(themeBaseFile), "${", "}");
+}
 
diff --git a/src/PLatexObj/platexobj_formulae.h b/src/PLatexObj/platexobj_formulae.h
index ae5e61d..816c9d7 100644
--- a/src/PLatexObj/platexobj_formulae.h
+++ b/src/PLatexObj/platexobj_formulae.h
@@ -10,6 +10,7 @@
 #include <string>
 #include <map>
 
+#include "FileParser/dico_replace_var.h"
 #include "PLatexObj.h"
 
 ///Define the name of the file which contains the formulae and the path to the created file
@@ -43,6 +44,10 @@ struct POutoutMode{
 	std::string bookMail;
 	///Master project url in book mode
 	std::string bookMasterProjectUrl;
+	///Parsed theme to be used
+	PNestedCall themeCall;
+	///Map of output var which are use to fill the output themes
+	PMapKnownVar mapVar;
 };
 
 #include "platexobj_utils.h"
@@ -54,4 +59,6 @@ std::string platexobj_htmlStrLatex(POutoutMode & outputMode, const PLatexObj & o
 std::string platexobj_htmlStrInlineMath(POutoutMode & outputMode, const PLatexObj & obj);
 
 
+void platexobj_update_theme(POutoutMode & outputMode, const std::string & themeBaseFile);
+
 #endif
diff --git a/src/main.cpp b/src/main.cpp
index d9c2b1a..a862b89 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -28,6 +28,40 @@
 #include "PConfigParser.h"
 #include "PMarkdownParser.h"
 
+///@brief Parsed arguments passed to the program
+struct ParsedArg{
+	///True to use the MathJax backend, false to use the latex backend
+	bool useMathJax;
+	///True to use remote install of mathjax
+	bool useRemoteMathjax;
+	///Installation prefix directory to get the program ressources (/usr or /local/usr)
+	std::string installPrefix;
+	///True to propagate the Work In Progress in the titles of corresponding parts, to make them visible and see what is ongoing in an easier way
+	bool isWorkInProgress;
+	///True to activate the latex backend
+	bool isLatexBackEnd;
+	///True to enable book theme
+	bool isBookTheme;
+	///Style to be used as the default css style
+	std::string styleCss;
+	///File which describes the theme of the web site
+	std::string themeFile;
+};
+
+///Init default values in the ParsedArg
+/**	@param[out] arg : ParseArg to be updated
+*/
+void defaultParsedArg(ParsedArg & arg){
+	arg.useMathJax = false;
+	arg.useRemoteMathjax = false;
+	arg.installPrefix = getProgramPrefix();
+	arg.isWorkInProgress = false;
+	arg.isLatexBackEnd = false;
+	arg.isBookTheme = false;
+	arg.styleCss = "";
+	arg.themeFile = getProgramPrefix() + "/../share/PhoenixTex2Html/THEME/default.html";
+}
+
 ///Create the OptionParser of this program
 /**	@return OptionParser of this program
 */
@@ -55,6 +89,8 @@ OptionParser createOptionParser(){
 	
 	std::string installPrefix(getProgramPrefix());
 	parser.addOption("prefix", "p", installPrefix, "Installation prefix directory (/usr or /local/usr to get shared files");
+	std::string defaultTheme(getProgramPrefix() + "/../share/PhoenixTex2Html/THEME/default.html");
+	parser.addOption("theme", "a", defaultTheme, "base theme to be used as canevas to all generated web pages");
 	return parser;
 }
 
@@ -62,22 +98,15 @@ OptionParser createOptionParser(){
 /**	@param fileinput : input files
  * 	@param inputBibliography : input bobliography file
  * 	@param listInclude : list of the extra include directories
- * 	@param useMathJax ; true to use the MathJax backend, false to use the latex backend
- * 	@param useRemoteMathjax : true to use remote install of mathjax
- * 	@param installPrefix : installation prefix directory to get the program ressources (/usr or /local/usr)
- * 	@param isWorkInProgress : true to propagate the Work In Progress in the titles of corresponding parts, to make them visible and see what is ongoing in an easier way
- * 	@param isLatexBackEnd : true to activate the latex backend
- * 	@param isBookTheme : true to enable book theme
- * 	@param styleCss : style to be used as the default css style
+ * 	@param arg : extra arguments passed to the program
 */
 template<typename T>
 int processAllFile(const std::string & fileinput, const std::string & inputBibliography,
-		const std::list<std::string> & listInclude, bool useMathJax, bool useRemoteMathjax,
-		const std::string & installPrefix, bool isWorkInProgress, bool isLatexBackEnd, bool isBookTheme, const std::string & styleCss)
+		const std::list<std::string> & listInclude, const ParsedArg & arg)
 {
 	if(fileinput == "") return 0;
 	
-	T parser(installPrefix);
+	T parser(arg.installPrefix);
 	parser.setDebugMode(true);
 	bool isBibliography(inputBibliography != "");
 	if(isBibliography){
@@ -101,7 +130,7 @@ int processAllFile(const std::string & fileinput, const std::string & inputBibli
 		return -1;
 	}
 	PLatexObj latexFile(parser.getSource());
-	std::string firstStyleCss(styleCss);
+	std::string firstStyleCss(arg.styleCss);
 	update_firstCss(firstStyleCss, latexFile);
 	platexobj_updateId(latexFile);
 	
@@ -119,12 +148,12 @@ int processAllFile(const std::string & fileinput, const std::string & inputBibli
 	}
 	POutoutMode outputMode;
 	outputMode.currentStyle = firstStyleCss;
-	outputMode.isMathJaxMode = useMathJax;
-	outputMode.isRemoteMathjax = useRemoteMathjax;
+	outputMode.isMathJaxMode = arg.useMathJax;
+	outputMode.isRemoteMathjax = arg.useRemoteMathjax;
 	
 	platexobj_loadFormulaeMap(outputMode.mapFormula);
 	
-	if(isWorkInProgress && !isLatexBackEnd){
+	if(arg.isWorkInProgress && !arg.isLatexBackEnd){
 		updateWip(orderLatex);
 	}
 	
@@ -132,8 +161,8 @@ int processAllFile(const std::string & fileinput, const std::string & inputBibli
 	updateNextPrev(outputMode, orderLatex);
 	updateParent(outputMode, orderLatex);
 	updateNewLine(orderLatex);
-	outputMode.isBookTheme = isBookTheme;
-	if(isBookTheme){
+	outputMode.isBookTheme = arg.isBookTheme;
+	if(arg.isBookTheme){
 		outputMode.fullMenu = platexobj_toMenu(orderLatex, parser.getBookMainPageLink());
 		
 		outputMode.bookSideBarWidth = parser.getBookSideBarWidth();
@@ -141,15 +170,16 @@ int processAllFile(const std::string & fileinput, const std::string & inputBibli
 		outputMode.isEnableBookFeedback = parser.getBookEnableFeedback();
 		outputMode.bookMail = parser.getBookMail();
 		outputMode.bookMasterProjectUrl = parser.getBookMasterProjectUrl();
+		platexobj_update_theme(outputMode, arg.themeFile);
 	}
-	if(isBibliography && !isLatexBackEnd){	//Save the bibliography if there is one
+	if(isBibliography && !arg.isLatexBackEnd){	//Save the bibliography if there is one
 		PMapBiblioEntry & mapBibio = parser.getMapBiblioEntry();
 		if(!pbiblio_html("bibliography.html", mapBibio, outputMode)){
 			std::cerr << "processAllFile : can't save bibliography" << std::endl;
 			return -1;
 		}
 	}
-	if(isLatexBackEnd){
+	if(arg.isLatexBackEnd){
 		POutputTex outputTexMode(defaultPOutputTex());
 		orderLatex.setLink("index.tex");
 		if(!platexobj_tex(outputTexMode, orderLatex)){	//Save the html pages
@@ -157,11 +187,11 @@ int processAllFile(const std::string & fileinput, const std::string & inputBibli
 			return -1;
 		}
 	}else{
-		if(!platexobj_html(outputMode, orderLatex, isBibliography, installPrefix)){	//Save the html pages
+		if(!platexobj_html(outputMode, orderLatex, isBibliography, arg.installPrefix)){	//Save the html pages
 			std::cerr << "processAllFile : can't files 'save html'" << std::endl;
 			return -1;
 		}
-		if(!isBookTheme){
+		if(!arg.isBookTheme){
 			if(!createOutlineHtml(outputMode, orderLatex, isBibliography)){	//Save the outline
 				std::cerr << "processAllFile : can't save file 'outline.html'" << std::endl;
 				return -1;
@@ -185,25 +215,26 @@ int main(int argc, char** argv){
 	
 	std::list<std::string> listInclude;
 	defaultMode.getValue(listInclude, "includedirs");
-	std::string styleCss("");
-	defaultMode.getValue(styleCss, "style");
-	
-	bool useMathJax = defaultMode.isOptionExist("mathjax");
-	bool useRemoteMathjax = defaultMode.isOptionExist("remotemathjax");
-	useMathJax |= useRemoteMathjax;
-	bool isWorkInProgress = defaultMode.isOptionExist("workinprogress");
-	bool isLatexBackEnd = defaultMode.isOptionExist("tex");
-	bool isBookTheme = defaultMode.isOptionExist("book");
-	std::string installPrefix(getProgramPrefix());
-	defaultMode.getValue(installPrefix, "prefix");
+	
+	ParsedArg arg;
+	defaultParsedArg(arg);
+	
+	defaultMode.getValue(arg.styleCss, "style");
+	
+	arg.useMathJax = defaultMode.isOptionExist("mathjax");
+	arg.useRemoteMathjax = defaultMode.isOptionExist("remotemathjax");
+	arg.useMathJax |= arg.useRemoteMathjax;
+	arg.isWorkInProgress = defaultMode.isOptionExist("workinprogress");
+	arg.isLatexBackEnd = defaultMode.isOptionExist("tex");
+	arg.isBookTheme = defaultMode.isOptionExist("book");
+	defaultMode.getValue(arg.installPrefix, "prefix");
+	defaultMode.getValue(arg.themeFile, "theme");
 	
 	std::string fileExtention(getExtention(inputFile));
 	if(fileExtention == "md"){
-		return processAllFile<PMarkdownParser>(inputFile, inputBibliography, listInclude, useMathJax, useRemoteMathjax, installPrefix,
-			isWorkInProgress, isLatexBackEnd, isBookTheme, styleCss);
+		return processAllFile<PMarkdownParser>(inputFile, inputBibliography, listInclude, arg);
 	}else if(fileExtention == "tex" || fileExtention == "ptex"){
-		return processAllFile<PConfigParser>(inputFile, inputBibliography, listInclude, useMathJax, useRemoteMathjax, installPrefix,
-			isWorkInProgress, isLatexBackEnd, isBookTheme, styleCss);
+		return processAllFile<PConfigParser>(inputFile, inputBibliography, listInclude, arg);
 	}else{
 		std::cerr << "phoenix_tex2html : Unknow file extention '"<<fileExtention<<"' of input file '"<<inputFile<<"'" << std::endl;
 		return -1;
-- 
GitLab


From 558329fccf6dbdbf075b7b7578c44b6ddbc4ceb4 Mon Sep 17 00:00:00 2001
From: Pierre Aubert <pierre.aubert.lapp@gmail.com>
Date: Tue, 23 Aug 2022 22:01:18 +0200
Subject: [PATCH 02/18] Add utils functions to manage theme

---
 share/PhoenixTex2Html/THEME/book.html    | 29 ++++-------------------
 share/PhoenixTex2Html/THEME/default.html |  2 +-
 src/PLatexObj/platexobj_formulae.cpp     | 30 ++++++++++++++++++++++++
 src/PLatexObj/platexobj_formulae.h       |  2 ++
 4 files changed, 38 insertions(+), 25 deletions(-)

diff --git a/share/PhoenixTex2Html/THEME/book.html b/share/PhoenixTex2Html/THEME/book.html
index b14f5b0..16b67e7 100644
--- a/share/PhoenixTex2Html/THEME/book.html
+++ b/share/PhoenixTex2Html/THEME/book.html
@@ -8,7 +8,7 @@
 		<meta name="viewport" content="width=device-width, initial-scale=1">
 		<meta name="theme-color" content="rgba(0, 0, 0, 0)">
 		<link rel="stylesheet" href="variables.css">
-		<link rel="stylesheet" href="dark_style.css" />
+		<link rel="stylesheet" href="${STYLE}.css" />
 		<link rel="stylesheet" href="general.css">
 		<link rel="stylesheet" href="chrome.css">
 		<link rel="stylesheet" href="highlight.css" disabled="">
@@ -65,25 +65,7 @@
 			html.classList.remove('sidebar-visible');
 			html.classList.add("sidebar-" + sidebar);
 		</script>
-		<nav id="sidebar" class="sidebar" aria-label="Table of contents">
-			<div class="sidebar-scrollbox">
-				<ol class="chapter">
-					<li class="chapter-item "><a href="index.html">Main Page</a></li>
-					<li class="chapter-item expanded"><a href="1-38.html"><strong aria-hidden="true">1.</strong> Simple figure</a></li>
-					<li class="chapter-item affix "><li class="part-title">Separator before developement </li>
-					<li class="chapter-item "><a href="2-64.html"><strong aria-hidden="true">2.</strong> Developement</a><a class="toggle"><div>❱</div></a></li>
-					<li>
-						<ol class="section">
-							<li class="chapter-item "><a href="2-1-66.html"><strong aria-hidden="true">2.1.</strong> <span id="0" class="progStyle">CMake</span></a></li>
-							<li class="chapter-item "><a href="2-2-75.html"><strong aria-hidden="true">2.2.</strong> <span id="0" class="libStyle">C++</span></a></li>
-							<li class="chapter-item "><a href="2-3-83.html"><strong aria-hidden="true">2.3.</strong> Compilation</a></li>
-						</ol>
-					</li>
-					<li class="chapter-item "><a href="3-89.html"><strong aria-hidden="true">3.</strong> Extra environement</a></li>
-				</ol>
-			</div>
-			<div id="sidebar-resize-handle" class="sidebar-resize-handle"></div>
-		</nav>
+		${BOOK_TABLE_OF_CONTENT}
 		<div id="page-wrapper" class="page-wrapper">
 			<div class="page">
 				<div id="menu-bar-hover-placeholder"></div>
@@ -101,11 +83,10 @@
 						${IS_GITLAB_URL_BEGIN}<a href="${GITLAB_URL}" title="Git repository" aria-label="Git repository">
 							<i id="git-repository-button" class="fa book-gitlab-icon"></i>
 						</a>${IS_GITLAB_URL_END}
-						<a href="mailto: your.address@amail.com" title="Send email to authors" aria-label="Send mail">
+						${IS_AUTHOR_EMAIL_BEGIN}<a href="mailto: ${AUTHOR_EMAIL}" title="Send email to authors" aria-label="Send mail">
 							<i id="git-repository-button" class="fa book-mail-icon"></i>
-						</a>
-						${IS_GITLAB_URL_BEGIN}<a href="${GITLAB_URL}/-/edit/master
-/TESTS/TEST_BOOK_SEPARATOR_IMAGE_DARK/testsection.tex#L27" title="Suggest an edit" aria-label="Suggest an edit">
+						</a>${IS_AUTHOR_EMAIL_END}
+						${IS_GITLAB_URL_BEGIN}<a href="${GITLAB_URL}/-/edit/master/${CURRENT_SOURCE_FILE}#L${CURRENT_SOURCE_LINE}" title="Suggest an edit" aria-label="Suggest an edit">
 							<i id="git-edit-button" class="fa book-edit-icon"></i>
 						</a>${IS_GITLAB_URL_END}
 						${IS_GITLAB_URL_BEGIN}<a href="${GITLAB_URL}" title="Master project" aria-label="Master projec">
diff --git a/share/PhoenixTex2Html/THEME/default.html b/share/PhoenixTex2Html/THEME/default.html
index 211a0cc..9d713aa 100644
--- a/share/PhoenixTex2Html/THEME/default.html
+++ b/share/PhoenixTex2Html/THEME/default.html
@@ -3,7 +3,7 @@
 	<head>
 		<meta charset="utf-8" />
 		<title>${PAGE_TITLE}</title>
-		<link rel="stylesheet" href="base_style.css" />
+		<link rel="stylesheet" href="${STYLE}.css" />
 	</head>
 	<body>
 		<table class="navigationMenu">
diff --git a/src/PLatexObj/platexobj_formulae.cpp b/src/PLatexObj/platexobj_formulae.cpp
index 7628723..0845090 100644
--- a/src/PLatexObj/platexobj_formulae.cpp
+++ b/src/PLatexObj/platexobj_formulae.cpp
@@ -180,3 +180,33 @@ void platexobj_update_theme(POutoutMode & outputMode, const std::string & themeB
 	dico_create_nested_call(outputMode.themeCall, getFileContent(themeBaseFile), "${", "}");
 }
 
+///Set a variable in the map of variable for theme (will take account the IS_XXX_BEGIN accordingly if the value is empty or not)
+/**	@param[out] outputMode : POutoutMode to be updated
+ * 	@param varName : name of the variable to be set
+ * 	@param value : value of the variable to be set
+*/
+void platexobj_theme_set_var(POutoutMode & outputMode, const std::string & varName, const std::string & value){
+	outputMode.mapVar[varName] = value;
+	if(value == ""){
+		outputMode.mapVar["IS_" + varName + "_BEGIN"] = "<!-- ";
+		outputMode.mapVar["IS_" + varName + "_END"] = " -->";
+	}else{
+		outputMode.mapVar["IS_" + varName + "_BEGIN"] = "";
+		outputMode.mapVar["IS_" + varName + "_END"] = "";
+	}
+}
+
+///Initialise basic variables of POutoutMode
+/**	@param[out] outputMode : POutoutMode to init variables
+*/
+void platexobj_theme_init_var(POutoutMode & outputMode){
+	outputMode.mapVar["STYLE"] = outputMode.currentStyle;
+	if(outputMode.isBookTheme){
+		platexobj_theme_set_var(outputMode, "AUTHOR_EMAIL", outputMode.bookMail);
+		platexobj_theme_set_var(outputMode, "GITLAB_URL", outputMode.bookMasterProjectUrl);
+		outputMode.mapVar["BOOK_TABLE_OF_CONTENT"] = "";
+	}
+}
+
+
+
diff --git a/src/PLatexObj/platexobj_formulae.h b/src/PLatexObj/platexobj_formulae.h
index 816c9d7..1c6dbda 100644
--- a/src/PLatexObj/platexobj_formulae.h
+++ b/src/PLatexObj/platexobj_formulae.h
@@ -60,5 +60,7 @@ std::string platexobj_htmlStrInlineMath(POutoutMode & outputMode, const PLatexOb
 
 
 void platexobj_update_theme(POutoutMode & outputMode, const std::string & themeBaseFile);
+void platexobj_theme_set_var(POutoutMode & outputMode, const std::string & varName, const std::string & value);
+void platexobj_theme_init_var(POutoutMode & outputMode);
 
 #endif
-- 
GitLab


From 6c72330fcae01c6edb1cc5d769a3e8621e44f0cf Mon Sep 17 00:00:00 2001
From: Pierre Aubert <pierre.aubert.lapp@gmail.com>
Date: Wed, 24 Aug 2022 12:06:54 +0200
Subject: [PATCH 03/18] Still ongoing. Trouble with vec menu even if they are
 not empty. And trouble with section order

---
 share/PhoenixTex2Html/CMakeLists.txt     |   1 +
 share/PhoenixTex2Html/THEME/book.html    |   4 +-
 share/PhoenixTex2Html/THEME/default.html |  16 +--
 src/PLatexObj/platexobj_formulae.cpp     |  63 ++++++++++--
 src/PLatexObj/platexobj_formulae.h       |   8 +-
 src/PLatexObj/platexobj_html.cpp         |  73 ++++++++------
 src/PLatexObj/platexobj_html_book.cpp    | 121 ++++++++++++-----------
 src/main.cpp                             |   9 +-
 8 files changed, 189 insertions(+), 106 deletions(-)

diff --git a/share/PhoenixTex2Html/CMakeLists.txt b/share/PhoenixTex2Html/CMakeLists.txt
index 2fb2ce2..c332da5 100644
--- a/share/PhoenixTex2Html/CMakeLists.txt
+++ b/share/PhoenixTex2Html/CMakeLists.txt
@@ -7,4 +7,5 @@ add_subdirectory(SCRIPTS)
 add_subdirectory(Images)
 add_subdirectory(highlighter)
 add_subdirectory(javascript)
+add_subdirectory(THEME)
 
diff --git a/share/PhoenixTex2Html/THEME/book.html b/share/PhoenixTex2Html/THEME/book.html
index 16b67e7..313ff8e 100644
--- a/share/PhoenixTex2Html/THEME/book.html
+++ b/share/PhoenixTex2Html/THEME/book.html
@@ -8,7 +8,7 @@
 		<meta name="viewport" content="width=device-width, initial-scale=1">
 		<meta name="theme-color" content="rgba(0, 0, 0, 0)">
 		<link rel="stylesheet" href="variables.css">
-		<link rel="stylesheet" href="${STYLE}.css" />
+		<link rel="stylesheet" href="${STYLE}_style.css" />
 		<link rel="stylesheet" href="general.css">
 		<link rel="stylesheet" href="chrome.css">
 		<link rel="stylesheet" href="highlight.css" disabled="">
@@ -112,6 +112,8 @@
 				</script>
 				<div id="content" class="content">
 					<main>
+${MAIN_TITLE}
+${SUB_MENU}
 ${PAGE_CONTENT}
 					</main>
 					<nav class="nav-wrapper" aria-label="Page navigation">
diff --git a/share/PhoenixTex2Html/THEME/default.html b/share/PhoenixTex2Html/THEME/default.html
index 9d713aa..c7505af 100644
--- a/share/PhoenixTex2Html/THEME/default.html
+++ b/share/PhoenixTex2Html/THEME/default.html
@@ -3,27 +3,31 @@
 	<head>
 		<meta charset="utf-8" />
 		<title>${PAGE_TITLE}</title>
-		<link rel="stylesheet" href="${STYLE}.css" />
+		<link rel="stylesheet" href="${STYLE}_style.css" />
 	</head>
 	<body>
 		<table class="navigationMenu">
 			<tr>
-			${IS_PREV_PAGE_BEGIN}<td style="text-align: left;">Previous<br /><a href="${PREV_PAGE}">${PREV_PAGE_TITLE}</a></td>${IS_PREV_PAGE_END}
-			<td style="text-align: center;">Parent<br /><a href="index.html">Main Page</a></td>
+			${IS_PREV_PAGE_BEGIN} <td style="text-align: left;">Previous<br /><a href="${PREV_PAGE}">${PREV_PAGE_TITLE}</a></td> ${IS_PREV_PAGE_END}
+			${IS_PARENT_SECTION_BEGIN}<td style="text-align: center;">Parent<br /><a href="${PARENT_SECTION}">${PARENT_SECTION_TITLE}</a></td>${IS_PARENT_SECTION_END}
 			<td><a href="outline.html">Outline</a></td>
-			${IS_BIBLIOGRAPHY_BEGIN}<td><a href="bibliography.html">Bibliography</a></td>${IS_BIBLIOGRAPHY_END}
+			${IS_BIBLIOGRAPHY_BEGIN}<td><a href="${BIBLIOGRAPHY}">Bibliography</a></td>${IS_BIBLIOGRAPHY_END}
 			${IS_NEXT_PAGE_BEGIN}<td style="text-align: right;">Next<br /><a href="${NEXT_PAGE}">${NEXT_PAGE_TITLE}</a></td>${IS_NEXT_PAGE_END}
 			</tr>
 		</table>
 		<div class="pageContent">
+${MAIN_TITLE}
+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+${SUB_MENU}
+BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB
 ${PAGE_CONTENT}
 		</div>
 		<table class="navigationMenuBottom">
 			<tr>
 			${IS_PREV_PAGE_BEGIN}<td style="text-align: left;">Previous<br /><a href="${PREV_PAGE}">${PREV_PAGE_TITLE}</a></td>${IS_PREV_PAGE_END}
-			<td style="text-align: center;">Parent<br /><a href="index.html">Main Page</a></td>
+			${IS_PARENT_SECTION_BEGIN}<td style="text-align: center;">Parent<br /><a href="${PARENT_SECTION}">${PARENT_SECTION_TITLE}</a></td>${IS_PARENT_SECTION_END}
 			<td><a href="outline.html">Outline</a></td>
-			${IS_BIBLIOGRAPHY_BEGIN}<td><a href="bibliography.html">Bibliography</a></td>${IS_BIBLIOGRAPHY_END}
+			${IS_BIBLIOGRAPHY_BEGIN}<td><a href="${BIBLIOGRAPHY}">Bibliography</a></td>${IS_BIBLIOGRAPHY_END}
 			${IS_NEXT_PAGE_BEGIN}<td style="text-align: right;">Next<br /><a href="${NEXT_PAGE}">${NEXT_PAGE_TITLE}</a></td>${IS_NEXT_PAGE_END}
 			</tr>
 		</table>
diff --git a/src/PLatexObj/platexobj_formulae.cpp b/src/PLatexObj/platexobj_formulae.cpp
index 0845090..97d83de 100644
--- a/src/PLatexObj/platexobj_formulae.cpp
+++ b/src/PLatexObj/platexobj_formulae.cpp
@@ -11,6 +11,7 @@
 #include "data_all.h"
 #include "string_utils.h"
 #include "convertToString.h"
+#include "platexobj_menu.h"
 
 #include "platexobj_formulae.h"
 
@@ -178,6 +179,7 @@ std::string platexobj_htmlStrInlineMath(POutoutMode & outputMode, const PLatexOb
 */
 void platexobj_update_theme(POutoutMode & outputMode, const std::string & themeBaseFile){
 	dico_create_nested_call(outputMode.themeCall, getFileContent(themeBaseFile), "${", "}");
+	std::cerr << "platexobj_update_theme : nb nested call : " << outputMode.themeCall.getVecNestedStr().size() << std::endl;
 }
 
 ///Set a variable in the map of variable for theme (will take account the IS_XXX_BEGIN accordingly if the value is empty or not)
@@ -186,13 +188,13 @@ void platexobj_update_theme(POutoutMode & outputMode, const std::string & themeB
  * 	@param value : value of the variable to be set
 */
 void platexobj_theme_set_var(POutoutMode & outputMode, const std::string & varName, const std::string & value){
-	outputMode.mapVar[varName] = value;
+	outputMode.mapVar["${" + varName + "}"] = value;
 	if(value == ""){
-		outputMode.mapVar["IS_" + varName + "_BEGIN"] = "<!-- ";
-		outputMode.mapVar["IS_" + varName + "_END"] = " -->";
+		outputMode.mapVar["${IS_" + varName + "_BEGIN}"] = "<!-- ";
+		outputMode.mapVar["${IS_" + varName + "_END}"] = " -->";
 	}else{
-		outputMode.mapVar["IS_" + varName + "_BEGIN"] = "";
-		outputMode.mapVar["IS_" + varName + "_END"] = "";
+		outputMode.mapVar["${IS_" + varName + "_BEGIN}"] = "";
+		outputMode.mapVar["${IS_" + varName + "_END}"] = "";
 	}
 }
 
@@ -200,13 +202,60 @@ void platexobj_theme_set_var(POutoutMode & outputMode, const std::string & varNa
 /**	@param[out] outputMode : POutoutMode to init variables
 */
 void platexobj_theme_init_var(POutoutMode & outputMode){
-	outputMode.mapVar["STYLE"] = outputMode.currentStyle;
+	outputMode.mapVar["${STYLE}"] = outputMode.currentStyle;
 	if(outputMode.isBookTheme){
 		platexobj_theme_set_var(outputMode, "AUTHOR_EMAIL", outputMode.bookMail);
 		platexobj_theme_set_var(outputMode, "GITLAB_URL", outputMode.bookMasterProjectUrl);
-		outputMode.mapVar["BOOK_TABLE_OF_CONTENT"] = "";
+		outputMode.mapVar["${BOOK_TABLE_OF_CONTENT}"] = "";
+	}
+	std::string bibliography("");
+	if(outputMode.isBibliography){
+		bibliography = "bibliography.html";
+	}
+	platexobj_theme_set_var(outputMode, "BIBLIOGRAPHY", bibliography);
+}
+
+///Update var of POutoutMode for current section
+/**	@param[out] outputMode : POutoutMode to be modified
+ * 	@param pageLink : link of the current page
+ * 	@param pageTitle : title of the current page
+ * 	@param prevSecLink : link of the previous section
+ * 	@param prevSecTitle : title of the previous section
+ * 	@param nextSecLink : link of the next section
+ * 	@param nextSecTitle : title of the next section
+ * 	@param parentSecLink : link of the parent section
+ * 	@param parentSecTitle : title of the parent section
+*/
+void platexobj_theme_update_var(POutoutMode & outputMode, const std::string & pageLink, const std::string & pageTitle,
+			const std::string & prevSecLink, const std::string & prevSecTitle,
+			const std::string & nextSecLink, const std::string & nextSecTitle,
+			const std::string & parentSecLink, const std::string & parentSecTitle)
+{
+	outputMode.mapVar["${PAGE_LINK}"] = pageLink;
+	outputMode.mapVar["${PAGE_TITLE}"] = pageTitle;
+	outputMode.mapVar["${PARENT_SECTION_TITLE}"] = parentSecTitle;
+	platexobj_theme_set_var(outputMode, "PARENT_SECTION", parentSecLink);
+	outputMode.mapVar["${PREV_PAGE_TITLE}"] = prevSecTitle;
+	platexobj_theme_set_var(outputMode, "PREV_PAGE", prevSecLink);
+	outputMode.mapVar["${NEXT_PAGE_TITLE}"] = nextSecTitle;
+	platexobj_theme_set_var(outputMode, "NEXT_PAGE", nextSecLink);
+	
+	outputMode.mapVar["${MAIN_TITLE}"] = "";
+	outputMode.mapVar["${SUB_MENU}"] = "";
+	
+	if(outputMode.isBookTheme){
+		outputMode.mapVar["${BOOK_TABLE_OF_CONTENT}"] = platexobj_menuToHtml(outputMode.fullMenu, pageLink, outputMode.isBibliography);
 	}
 }
 
+///Create the page from variables in POutoutMode
+/**	@param[out] outputMode : POutoutMode to be used
+ * 	@return html page content
+*/
+std::string platexobj_theme_createPage(POutoutMode & outputMode){
+	std::string body("");
+	dico_replace_nested_call(body, outputMode.themeCall, outputMode.mapVar, "${", "}");
+	return body;
+}
 
 
diff --git a/src/PLatexObj/platexobj_formulae.h b/src/PLatexObj/platexobj_formulae.h
index 1c6dbda..23534d2 100644
--- a/src/PLatexObj/platexobj_formulae.h
+++ b/src/PLatexObj/platexobj_formulae.h
@@ -31,7 +31,8 @@ struct POutoutMode{
 	bool isRemoteMathjax;
 	///Full menu for book theme
 	PFullMenu fullMenu;
-	
+	///True if the generated web site has a bibliography, false otherwise
+	bool isBibliography;
 	///True to activate the book theme
 	bool isBookTheme;
 	///Witdh of the book side bar
@@ -62,5 +63,10 @@ std::string platexobj_htmlStrInlineMath(POutoutMode & outputMode, const PLatexOb
 void platexobj_update_theme(POutoutMode & outputMode, const std::string & themeBaseFile);
 void platexobj_theme_set_var(POutoutMode & outputMode, const std::string & varName, const std::string & value);
 void platexobj_theme_init_var(POutoutMode & outputMode);
+void platexobj_theme_update_var(POutoutMode & outputMode, const std::string & pageLink, const std::string & pageTitle,
+			const std::string & prevSecLink, const std::string & prevSecTitle,
+			const std::string & nextSecLink, const std::string & nextSecTitle,
+			const std::string & parentSecLink, const std::string & parentSecTitle);
+std::string platexobj_theme_createPage(POutoutMode & outputMode);
 
 #endif
diff --git a/src/PLatexObj/platexobj_html.cpp b/src/PLatexObj/platexobj_html.cpp
index efd54e9..a19fa74 100644
--- a/src/PLatexObj/platexobj_html.cpp
+++ b/src/PLatexObj/platexobj_html.cpp
@@ -546,34 +546,34 @@ void platexobj_sectionHtml(POutoutMode & outputMode, const PLatexObj & obj, cons
 // 	std::string objTitle(convertStrToHtml(obj.getName()));
 	std::string objTitle(getSectionTitle(outputMode, obj));	//Content of the section title
 	
-	std::string body("");
-	body += getHtmlHeader(objTitle, outputMode.isMathJaxMode, outputMode.isRemoteMathjax, outputMode.currentStyle);
+	platexobj_theme_update_var(outputMode, obj.getLink(), objTitle,
+				obj.getPrevSec().getLink(), obj.getPrevSec().getText(),
+				obj.getNextSec().getLink(), obj.getNextSec().getText(),
+				obj.getParentSec().getLink(), obj.getParentSec().getText());
 	
-	body += createNavigationMenu(obj.getPrevSec(), obj.getParentSec(), obj.getNextSec(), "navigationMenu", isBibliography);
 	
-	body += "\t\t<div class=\"pageContent\">\n";
+// 	body += getHtmlHeader(objTitle, outputMode.isMathJaxMode, outputMode.isRemoteMathjax, outputMode.currentStyle);
 	
-	body += "\t\t" + platexobj_createTitle(obj, baliseName, cssClassName, objTitle, prefixTitle, true);
+// 	body += createNavigationMenu(obj.getPrevSec(), obj.getParentSec(), obj.getNextSec(), "navigationMenu", isBibliography);
 	
-// 	body += "\t\t<"+baliseName+" id=\""+convertToString(obj.getId())+"\" class=\""+cssClassName+"\">";
-// 	if(prefixTitle != ""){
-// 		body += prefixTitle + " ";
-// 	}
-// 	body += vecNumberToString(obj.getVecSecNumber());
-// 	
-// 	body += " : "+objTitle+platexobj_createLabelSearchLink(obj.getLabelName())+"</"+baliseName+">\n";
+// 	body += "\t\t<div class=\"pageContent\">\n";
+	
+	outputMode.mapVar["${MAIN_TITLE}"] = "\t\t" + platexobj_createTitle(obj, baliseName, cssClassName, objTitle, prefixTitle, true);
 	
-	body += vecMenuToHtml(obj.getVecMenu());
+	outputMode.mapVar["${SUB_MENU}"] = vecMenuToHtml(obj.getVecMenu());
 	
+	std::string body("");
 	const PVecLatexObj & vecObj = obj.getVecContent();
 	for(PVecLatexObj::const_iterator it(vecObj.begin()); it != vecObj.end(); ++it){
 		body += platexobj_htmlStr(outputMode, *it, isBibliography);
 	}
-	body += "\t\t</div>\n";
-	body += createNavigationMenu(obj.getPrevSec(), obj.getParentSec(), obj.getNextSec(), "navigationMenuBottom", isBibliography);
-	body += getHtmlFooter();
+// 	body += "\t\t</div>\n";
+// 	body += createNavigationMenu(obj.getPrevSec(), obj.getParentSec(), obj.getNextSec(), "navigationMenuBottom", isBibliography);
+// 	body += getHtmlFooter();
+	outputMode.mapVar["${PAGE_CONTENT}"] = body;
+	
 	std::string fileName(obj.getLink());
-	if(!saveFileContent(fileName, body)){
+	if(!saveFileContent(fileName, platexobj_theme_createPage(outputMode))){
 		std::cerr << "platexobj_sectionHtml : can't save file '"<<fileName<<"' for object '" << obj.getName() << "'" << std::endl;
 	}else{
 		std::cout << "platexobj_sectionHtml : save file '"<<fileName<<"'" << std::endl;
@@ -599,26 +599,35 @@ std::string platexobj_htmlMainTitle(const std::string & title, const std::string
  * 	@param isBibliography : true if there is a bibliography, false otherwise
 */
 std::string platexobj_indexHtml(POutoutMode & outputMode, const PLatexObj & obj, bool isBibliography){
-	std::string body("");
-	body += getHtmlHeader(obj.getName(), outputMode.isMathJaxMode, outputMode.isRemoteMathjax, outputMode.currentStyle);
-	
-	body += createNavigationMenu(obj.getPrevSec(), obj.getParentSec(), obj.getNextSec(), "navigationMenu", isBibliography);
-	body += "\t\t<div class=\"pageContent\">\n";
-	body += platexobj_htmlMainTitle(obj.getName(), "h1", "mainTitle");
-	body += platexobj_htmlMainTitle(obj.getSubTitle(), "h2", "mainSubTitle");
-	body += platexobj_htmlMainTitle(obj.getAuthor(), "h5", "author");
-	body += platexobj_htmlMainTitle(obj.getDate(), "h6", "date");
-	
-	body += vecMenuToHtml(obj.getVecMenu());
+	platexobj_theme_update_var(outputMode, obj.getLink(), obj.getName(),
+				obj.getPrevSec().getLink(), obj.getPrevSec().getText(),
+				obj.getNextSec().getLink(), obj.getNextSec().getText(),
+				obj.getParentSec().getLink(), obj.getParentSec().getText());
 	
+// 	body += getHtmlHeader(obj.getName(), outputMode.isMathJaxMode, outputMode.isRemoteMathjax, outputMode.currentStyle);
+// 	
+// 	body += createNavigationMenu(obj.getPrevSec(), obj.getParentSec(), obj.getNextSec(), "navigationMenu", isBibliography);
+// 	body += "\t\t<div class=\"pageContent\">\n";
+	std::string bodyTitle("");
+	bodyTitle += platexobj_htmlMainTitle(obj.getName(), "h1", "mainTitle");
+	bodyTitle += platexobj_htmlMainTitle(obj.getSubTitle(), "h2", "mainSubTitle");
+	bodyTitle += platexobj_htmlMainTitle(obj.getAuthor(), "h5", "author");
+	bodyTitle += platexobj_htmlMainTitle(obj.getDate(), "h6", "date");
+	outputMode.mapVar["${MAIN_TITLE}"] = bodyTitle;
+	std::cerr << "platexobj_indexHtml : number of menu entries : " << obj.getVecMenu().size() << std::endl;
+	outputMode.mapVar["${SUB_MENU}"] = vecMenuToHtml(obj.getVecMenu());
+	std::cerr << "outputMode.mapVar[\"${SUB_MENU}\"] = '" << outputMode.mapVar["${SUB_MENU}"] << "'" << std::endl;
+	std::string body("");
 	const PVecLatexObj & vecObj = obj.getVecContent();
 	for(PVecLatexObj::const_iterator it(vecObj.begin()); it != vecObj.end(); ++it){
 		body += platexobj_htmlStr(outputMode, *it, isBibliography);
 	}
-	body += "\t\t</div>\n";
-	body += createNavigationMenu(obj.getPrevSec(), obj.getParentSec(), obj.getNextSec(), "navigationMenuBottom", isBibliography);
-	body += getHtmlFooter();
-	return body;
+// 	body += "\t\t</div>\n";
+// 	body += createNavigationMenu(obj.getPrevSec(), obj.getParentSec(), obj.getNextSec(), "navigationMenuBottom", isBibliography);
+// 	body += getHtmlFooter();
+	
+	outputMode.mapVar["${PAGE_CONTENT}"] = body;
+	return platexobj_theme_createPage(outputMode);
 }
 
 ///Convert an itemize environement in html
diff --git a/src/PLatexObj/platexobj_html_book.cpp b/src/PLatexObj/platexobj_html_book.cpp
index 4157b91..c4b2209 100644
--- a/src/PLatexObj/platexobj_html_book.cpp
+++ b/src/PLatexObj/platexobj_html_book.cpp
@@ -292,42 +292,47 @@ std::string platexobj_getTopBar(const POutoutMode & outputMode, const std::strin
 bool platexobj_book_createPage(POutoutMode & outputMode, const PLatexObj & obj,
 				const std::string & baliseName, const std::string & cssClassName, const std::string & prefixTitle, bool isBibliography)
 {
-	std::string body("");
 	std::string objTitle(getSectionTitle(outputMode, obj));	//Content of the section title
-	body += platexobj_book_getHeader(objTitle, "", outputMode.currentStyle, outputMode.isMathJaxMode, outputMode.isRemoteMathjax);
-	body += platexobj_book_getBeginJs();
-	
-	body += platexobj_menuToHtml(outputMode.fullMenu, obj.getLink(), isBibliography);
-	
-	body += "\t\t<div id=\"page-wrapper\" class=\"page-wrapper\">\n";
-	body += "\t\t\t<div class=\"page\">\n";
-	body += platexobj_getTopBar(outputMode, obj.getSourceFile(), obj.getSourceLine(), "\t\t\t\t");
-	body += platexobj_book_getSidebarJs();
-	
-	body += "\t\t\t\t<div id=\"content\" class=\"content\">\n";
-	body += "\t\t\t\t\t<main>\n";
 	
-// 	body += "\t\t<div class=\"pageContent\">\n";
-	body += "\t\t" + platexobj_createTitle(obj, baliseName, cssClassName, objTitle, prefixTitle, true);
+	platexobj_theme_update_var(outputMode, obj.getLink(), objTitle,
+				obj.getPrevSec().getLink(), obj.getPrevSec().getText(),
+				obj.getNextSec().getLink(), obj.getNextSec().getText(),
+				obj.getParentSec().getLink(), obj.getParentSec().getText());
 	
-	body += vecMenuToHtml(obj.getVecMenu());
+// 	body += platexobj_book_getHeader(objTitle, "", outputMode.currentStyle, outputMode.isMathJaxMode, outputMode.isRemoteMathjax);
+// 	body += platexobj_book_getBeginJs();
+// 	
+// 	body += platexobj_menuToHtml(outputMode.fullMenu, obj.getLink(), isBibliography);
+// 	
+// 	body += "\t\t<div id=\"page-wrapper\" class=\"page-wrapper\">\n";
+// 	body += "\t\t\t<div class=\"page\">\n";
+// 	body += platexobj_getTopBar(outputMode, obj.getSourceFile(), obj.getSourceLine(), "\t\t\t\t");
+// 	body += platexobj_book_getSidebarJs();
+// 	
+// 	body += "\t\t\t\t<div id=\"content\" class=\"content\">\n";
+// 	body += "\t\t\t\t\t<main>\n";
+// 	
+// // 	body += "\t\t<div class=\"pageContent\">\n";
+	outputMode.mapVar["${MAIN_TITLE}"] = "\t\t" + platexobj_createTitle(obj, baliseName, cssClassName, objTitle, prefixTitle, true);
 	
+	outputMode.mapVar["${SUB_MENU}"] = vecMenuToHtml(obj.getVecMenu());
+	std::string body("");
 	const PVecLatexObj & vecObj = obj.getVecContent();
 	for(PVecLatexObj::const_iterator it(vecObj.begin()); it != vecObj.end(); ++it){
 		body += platexobj_bookHtml(outputMode, *it, isBibliography, true);
 	}
-	
+	outputMode.mapVar["${PAGE_CONTENT}"] = body;
+// 	body += "\t\t\t\t\t</main>\n";
+// 	body += platexobj_book_getNavigationButton(obj.getPrevSec().getLink(), obj.getNextSec().getLink(), false, "\t\t\t\t\t");
+// 	body += "\t\t\t\t</div>\n";
+// 	body += "\t\t\t</div>\n";
+// 	body += platexobj_book_getNavigationButton(obj.getPrevSec().getLink(), obj.getNextSec().getLink(), true, "\t\t\t");
 // 	body += "\t\t</div>\n";
-	body += "\t\t\t\t\t</main>\n";
-	body += platexobj_book_getNavigationButton(obj.getPrevSec().getLink(), obj.getNextSec().getLink(), false, "\t\t\t\t\t");
-	body += "\t\t\t\t</div>\n";
-	body += "\t\t\t</div>\n";
-	body += platexobj_book_getNavigationButton(obj.getPrevSec().getLink(), obj.getNextSec().getLink(), true, "\t\t\t");
-	body += "\t\t</div>\n";
-	body += platexobj_book_getEndJs();
-	body += getHtmlFooter();
+// 	body += platexobj_book_getEndJs();
+// 	body += getHtmlFooter();
+
 	std::string fileName(obj.getLink());
-	if(!saveFileContent(fileName, body)){
+	if(!saveFileContent(fileName, platexobj_theme_createPage(outputMode))){
 		std::cerr << "platexobj_book_createPage : can't save file '"<<fileName<<"' for object '" << obj.getName() << "'" << std::endl;
 		return false;
 	}else{
@@ -342,45 +347,51 @@ bool platexobj_book_createPage(POutoutMode & outputMode, const PLatexObj & obj,
  * 	@param isBibliography : true if there is a bibliography, false otherwise
 */
 std::string platexobj_bookIndexHtml(POutoutMode & outputMode, const PLatexObj & obj, bool isBibliography){
-	std::string body("");
+	
 // 	std::string objTitle(getSectionTitle(outputMode, obj));	//Content of the section title
 	std::string objTitle(obj.getName());	//Content of the section title
-	body += platexobj_book_getHeader(objTitle, "", outputMode.currentStyle, outputMode.isMathJaxMode, outputMode.isRemoteMathjax);
-	body += platexobj_book_getBeginJs();
-	
-	body += platexobj_menuToHtml(outputMode.fullMenu, obj.getLink(), isBibliography);
-	
-	body += "\t\t<div id=\"page-wrapper\" class=\"page-wrapper\">\n";
-	body += "\t\t\t<div class=\"page\">\n";
-	body += platexobj_getTopBar(outputMode, obj.getSourceFile(), obj.getSourceLine(), "\t\t\t\t");
-	body += platexobj_book_getSidebarJs();
-	
-	body += "\t\t\t\t<div id=\"content\" class=\"content\">\n";
-	body += "\t\t\t\t\t<main>\n";
+	platexobj_theme_update_var(outputMode, obj.getLink(), objTitle,
+				obj.getPrevSec().getLink(), obj.getPrevSec().getText(),
+				obj.getNextSec().getLink(), obj.getNextSec().getText(),
+				obj.getParentSec().getLink(), obj.getParentSec().getText());
 	
-// 	body += "\t\t<div class=\"pageContent\">\n";
-	body += platexobj_htmlMainTitle(obj.getName(), "h1", "mainTitle");
-	body += platexobj_htmlMainTitle(obj.getSubTitle(), "h2", "mainSubTitle");
-	body += platexobj_htmlMainTitle(obj.getAuthor(), "h5", "author");
-	body += platexobj_htmlMainTitle(obj.getDate(), "h6", "date");
 	
-	body += vecMenuToHtml(obj.getVecMenu());
+// 	body += platexobj_book_getHeader(objTitle, "", outputMode.currentStyle, outputMode.isMathJaxMode, outputMode.isRemoteMathjax);
+// 	body += platexobj_book_getBeginJs();
+// 	
+// 	body += platexobj_menuToHtml(outputMode.fullMenu, obj.getLink(), isBibliography);
+// 	
+// 	body += "\t\t<div id=\"page-wrapper\" class=\"page-wrapper\">\n";
+// 	body += "\t\t\t<div class=\"page\">\n";
+// 	body += platexobj_getTopBar(outputMode, obj.getSourceFile(), obj.getSourceLine(), "\t\t\t\t");
+// 	body += platexobj_book_getSidebarJs();
+// 	
+// 	body += "\t\t\t\t<div id=\"content\" class=\"content\">\n";
+// 	body += "\t\t\t\t\t<main>\n";
+	std::string bodyTitle("");
+	bodyTitle += platexobj_htmlMainTitle(obj.getName(), "h1", "mainTitle");
+	bodyTitle += platexobj_htmlMainTitle(obj.getSubTitle(), "h2", "mainSubTitle");
+	bodyTitle += platexobj_htmlMainTitle(obj.getAuthor(), "h5", "author");
+	bodyTitle += platexobj_htmlMainTitle(obj.getDate(), "h6", "date");
+	outputMode.mapVar["${MAIN_TITLE}"] = bodyTitle;
 	
+	outputMode.mapVar["${SUB_MENU}"] = vecMenuToHtml(obj.getVecMenu());
+	std::string body("");
 	const PVecLatexObj & vecObj = obj.getVecContent();
 	for(PVecLatexObj::const_iterator it(vecObj.begin()); it != vecObj.end(); ++it){
 		body += platexobj_bookHtml(outputMode, *it, isBibliography, true);
 	}
+// 	body += "\t\t\t\t\t</main>\n";
+// 	body += platexobj_book_getNavigationButton(obj.getPrevSec().getLink(), obj.getNextSec().getLink(), false, "\t\t\t\t\t");
+// 	body += "\t\t\t\t</div>\n";
+// 	body += "\t\t\t</div>\n";
+// 	body += platexobj_book_getNavigationButton(obj.getPrevSec().getLink(), obj.getNextSec().getLink(), true, "\t\t\t");
 // 	body += "\t\t</div>\n";
-	body += "\t\t\t\t\t</main>\n";
-	body += platexobj_book_getNavigationButton(obj.getPrevSec().getLink(), obj.getNextSec().getLink(), false, "\t\t\t\t\t");
-	body += "\t\t\t\t</div>\n";
-	body += "\t\t\t</div>\n";
-	body += platexobj_book_getNavigationButton(obj.getPrevSec().getLink(), obj.getNextSec().getLink(), true, "\t\t\t");
-	body += "\t\t</div>\n";
-	
-	body += platexobj_book_getEndJs();
-	body += getHtmlFooter();
-	return body;
+// 	
+// 	body += platexobj_book_getEndJs();
+// 	body += getHtmlFooter();
+	outputMode.mapVar["${PAGE_CONTENT}"] = body;
+	return platexobj_theme_createPage(outputMode);
 }
 
 ///Convert a PLatexObj into a string with book theme
diff --git a/src/main.cpp b/src/main.cpp
index a862b89..f478f85 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -59,7 +59,7 @@ void defaultParsedArg(ParsedArg & arg){
 	arg.isLatexBackEnd = false;
 	arg.isBookTheme = false;
 	arg.styleCss = "";
-	arg.themeFile = getProgramPrefix() + "/../share/PhoenixTex2Html/THEME/default.html";
+	arg.themeFile = getProgramPrefix() + "/share/PhoenixTex2Html/THEME/default.html";
 }
 
 ///Create the OptionParser of this program
@@ -89,7 +89,7 @@ OptionParser createOptionParser(){
 	
 	std::string installPrefix(getProgramPrefix());
 	parser.addOption("prefix", "p", installPrefix, "Installation prefix directory (/usr or /local/usr to get shared files");
-	std::string defaultTheme(getProgramPrefix() + "/../share/PhoenixTex2Html/THEME/default.html");
+	std::string defaultTheme(getProgramPrefix() + "/share/PhoenixTex2Html/THEME/default.html");
 	parser.addOption("theme", "a", defaultTheme, "base theme to be used as canevas to all generated web pages");
 	return parser;
 }
@@ -150,7 +150,7 @@ int processAllFile(const std::string & fileinput, const std::string & inputBibli
 	outputMode.currentStyle = firstStyleCss;
 	outputMode.isMathJaxMode = arg.useMathJax;
 	outputMode.isRemoteMathjax = arg.useRemoteMathjax;
-	
+	outputMode.isBibliography = isBibliography;
 	platexobj_loadFormulaeMap(outputMode.mapFormula);
 	
 	if(arg.isWorkInProgress && !arg.isLatexBackEnd){
@@ -162,6 +162,7 @@ int processAllFile(const std::string & fileinput, const std::string & inputBibli
 	updateParent(outputMode, orderLatex);
 	updateNewLine(orderLatex);
 	outputMode.isBookTheme = arg.isBookTheme;
+	platexobj_update_theme(outputMode, arg.themeFile);
 	if(arg.isBookTheme){
 		outputMode.fullMenu = platexobj_toMenu(orderLatex, parser.getBookMainPageLink());
 		
@@ -170,7 +171,6 @@ int processAllFile(const std::string & fileinput, const std::string & inputBibli
 		outputMode.isEnableBookFeedback = parser.getBookEnableFeedback();
 		outputMode.bookMail = parser.getBookMail();
 		outputMode.bookMasterProjectUrl = parser.getBookMasterProjectUrl();
-		platexobj_update_theme(outputMode, arg.themeFile);
 	}
 	if(isBibliography && !arg.isLatexBackEnd){	//Save the bibliography if there is one
 		PMapBiblioEntry & mapBibio = parser.getMapBiblioEntry();
@@ -187,6 +187,7 @@ int processAllFile(const std::string & fileinput, const std::string & inputBibli
 			return -1;
 		}
 	}else{
+		platexobj_theme_init_var(outputMode);	//Init theme basic variables
 		if(!platexobj_html(outputMode, orderLatex, isBibliography, arg.installPrefix)){	//Save the html pages
 			std::cerr << "processAllFile : can't files 'save html'" << std::endl;
 			return -1;
-- 
GitLab


From 1c17ee2c2fe581c8f0b471e53691072242d29f4e Mon Sep 17 00:00:00 2001
From: Pierre Aubert <pierre.aubert.lapp@gmail.com>
Date: Wed, 24 Aug 2022 17:30:49 +0200
Subject: [PATCH 04/18] It is working

---
 share/PhoenixTex2Html/THEME/default.html |  2 -
 src/PLatexObj/platexobj_formulae.cpp     |  4 +-
 src/PLatexObj/platexobj_html.cpp         | 44 ++++----------
 src/PLatexObj/platexobj_html_book.cpp    | 73 ++++--------------------
 src/main.cpp                             |  5 ++
 5 files changed, 28 insertions(+), 100 deletions(-)

diff --git a/share/PhoenixTex2Html/THEME/default.html b/share/PhoenixTex2Html/THEME/default.html
index c7505af..7b1e480 100644
--- a/share/PhoenixTex2Html/THEME/default.html
+++ b/share/PhoenixTex2Html/THEME/default.html
@@ -17,9 +17,7 @@
 		</table>
 		<div class="pageContent">
 ${MAIN_TITLE}
-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
 ${SUB_MENU}
-BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB
 ${PAGE_CONTENT}
 		</div>
 		<table class="navigationMenuBottom">
diff --git a/src/PLatexObj/platexobj_formulae.cpp b/src/PLatexObj/platexobj_formulae.cpp
index 97d83de..1a7ae3b 100644
--- a/src/PLatexObj/platexobj_formulae.cpp
+++ b/src/PLatexObj/platexobj_formulae.cpp
@@ -240,8 +240,8 @@ void platexobj_theme_update_var(POutoutMode & outputMode, const std::string & pa
 	outputMode.mapVar["${NEXT_PAGE_TITLE}"] = nextSecTitle;
 	platexobj_theme_set_var(outputMode, "NEXT_PAGE", nextSecLink);
 	
-	outputMode.mapVar["${MAIN_TITLE}"] = "";
-	outputMode.mapVar["${SUB_MENU}"] = "";
+// 	outputMode.mapVar["${MAIN_TITLE}"] = "";
+// 	outputMode.mapVar["${SUB_MENU}"] = "";
 	
 	if(outputMode.isBookTheme){
 		outputMode.mapVar["${BOOK_TABLE_OF_CONTENT}"] = platexobj_menuToHtml(outputMode.fullMenu, pageLink, outputMode.isBibliography);
diff --git a/src/PLatexObj/platexobj_html.cpp b/src/PLatexObj/platexobj_html.cpp
index a19fa74..b1706d4 100644
--- a/src/PLatexObj/platexobj_html.cpp
+++ b/src/PLatexObj/platexobj_html.cpp
@@ -543,33 +543,18 @@ std::string createNavigationMenu(const PLatexMenu & prevSec, const PLatexMenu &
 void platexobj_sectionHtml(POutoutMode & outputMode, const PLatexObj & obj, const std::string & baliseName, const std::string & cssClassName,
 			   const std::string & prefixTitle, bool isBibliography)
 {
-// 	std::string objTitle(convertStrToHtml(obj.getName()));
+	std::string body("");
+	const PVecLatexObj & vecObj = obj.getVecContent();
+	for(PVecLatexObj::const_iterator it(vecObj.begin()); it != vecObj.end(); ++it){
+		body += platexobj_htmlStr(outputMode, *it, isBibliography);
+	}
 	std::string objTitle(getSectionTitle(outputMode, obj));	//Content of the section title
-	
 	platexobj_theme_update_var(outputMode, obj.getLink(), objTitle,
 				obj.getPrevSec().getLink(), obj.getPrevSec().getText(),
 				obj.getNextSec().getLink(), obj.getNextSec().getText(),
 				obj.getParentSec().getLink(), obj.getParentSec().getText());
-	
-	
-// 	body += getHtmlHeader(objTitle, outputMode.isMathJaxMode, outputMode.isRemoteMathjax, outputMode.currentStyle);
-	
-// 	body += createNavigationMenu(obj.getPrevSec(), obj.getParentSec(), obj.getNextSec(), "navigationMenu", isBibliography);
-	
-// 	body += "\t\t<div class=\"pageContent\">\n";
-	
 	outputMode.mapVar["${MAIN_TITLE}"] = "\t\t" + platexobj_createTitle(obj, baliseName, cssClassName, objTitle, prefixTitle, true);
-	
 	outputMode.mapVar["${SUB_MENU}"] = vecMenuToHtml(obj.getVecMenu());
-	
-	std::string body("");
-	const PVecLatexObj & vecObj = obj.getVecContent();
-	for(PVecLatexObj::const_iterator it(vecObj.begin()); it != vecObj.end(); ++it){
-		body += platexobj_htmlStr(outputMode, *it, isBibliography);
-	}
-// 	body += "\t\t</div>\n";
-// 	body += createNavigationMenu(obj.getPrevSec(), obj.getParentSec(), obj.getNextSec(), "navigationMenuBottom", isBibliography);
-// 	body += getHtmlFooter();
 	outputMode.mapVar["${PAGE_CONTENT}"] = body;
 	
 	std::string fileName(obj.getLink());
@@ -599,15 +584,15 @@ std::string platexobj_htmlMainTitle(const std::string & title, const std::string
  * 	@param isBibliography : true if there is a bibliography, false otherwise
 */
 std::string platexobj_indexHtml(POutoutMode & outputMode, const PLatexObj & obj, bool isBibliography){
+	std::string body("");
+	const PVecLatexObj & vecObj = obj.getVecContent();
+	for(PVecLatexObj::const_iterator it(vecObj.begin()); it != vecObj.end(); ++it){
+		body += platexobj_htmlStr(outputMode, *it, isBibliography);
+	}
 	platexobj_theme_update_var(outputMode, obj.getLink(), obj.getName(),
 				obj.getPrevSec().getLink(), obj.getPrevSec().getText(),
 				obj.getNextSec().getLink(), obj.getNextSec().getText(),
 				obj.getParentSec().getLink(), obj.getParentSec().getText());
-	
-// 	body += getHtmlHeader(obj.getName(), outputMode.isMathJaxMode, outputMode.isRemoteMathjax, outputMode.currentStyle);
-// 	
-// 	body += createNavigationMenu(obj.getPrevSec(), obj.getParentSec(), obj.getNextSec(), "navigationMenu", isBibliography);
-// 	body += "\t\t<div class=\"pageContent\">\n";
 	std::string bodyTitle("");
 	bodyTitle += platexobj_htmlMainTitle(obj.getName(), "h1", "mainTitle");
 	bodyTitle += platexobj_htmlMainTitle(obj.getSubTitle(), "h2", "mainSubTitle");
@@ -617,15 +602,6 @@ std::string platexobj_indexHtml(POutoutMode & outputMode, const PLatexObj & obj,
 	std::cerr << "platexobj_indexHtml : number of menu entries : " << obj.getVecMenu().size() << std::endl;
 	outputMode.mapVar["${SUB_MENU}"] = vecMenuToHtml(obj.getVecMenu());
 	std::cerr << "outputMode.mapVar[\"${SUB_MENU}\"] = '" << outputMode.mapVar["${SUB_MENU}"] << "'" << std::endl;
-	std::string body("");
-	const PVecLatexObj & vecObj = obj.getVecContent();
-	for(PVecLatexObj::const_iterator it(vecObj.begin()); it != vecObj.end(); ++it){
-		body += platexobj_htmlStr(outputMode, *it, isBibliography);
-	}
-// 	body += "\t\t</div>\n";
-// 	body += createNavigationMenu(obj.getPrevSec(), obj.getParentSec(), obj.getNextSec(), "navigationMenuBottom", isBibliography);
-// 	body += getHtmlFooter();
-	
 	outputMode.mapVar["${PAGE_CONTENT}"] = body;
 	return platexobj_theme_createPage(outputMode);
 }
diff --git a/src/PLatexObj/platexobj_html_book.cpp b/src/PLatexObj/platexobj_html_book.cpp
index c4b2209..7503e13 100644
--- a/src/PLatexObj/platexobj_html_book.cpp
+++ b/src/PLatexObj/platexobj_html_book.cpp
@@ -292,45 +292,20 @@ std::string platexobj_getTopBar(const POutoutMode & outputMode, const std::strin
 bool platexobj_book_createPage(POutoutMode & outputMode, const PLatexObj & obj,
 				const std::string & baliseName, const std::string & cssClassName, const std::string & prefixTitle, bool isBibliography)
 {
+	std::string body("");
+	const PVecLatexObj & vecObj = obj.getVecContent();
+	for(PVecLatexObj::const_iterator it(vecObj.begin()); it != vecObj.end(); ++it){
+		body += platexobj_bookHtml(outputMode, *it, isBibliography, true);
+	}
 	std::string objTitle(getSectionTitle(outputMode, obj));	//Content of the section title
-	
 	platexobj_theme_update_var(outputMode, obj.getLink(), objTitle,
 				obj.getPrevSec().getLink(), obj.getPrevSec().getText(),
 				obj.getNextSec().getLink(), obj.getNextSec().getText(),
 				obj.getParentSec().getLink(), obj.getParentSec().getText());
-	
-// 	body += platexobj_book_getHeader(objTitle, "", outputMode.currentStyle, outputMode.isMathJaxMode, outputMode.isRemoteMathjax);
-// 	body += platexobj_book_getBeginJs();
-// 	
-// 	body += platexobj_menuToHtml(outputMode.fullMenu, obj.getLink(), isBibliography);
-// 	
-// 	body += "\t\t<div id=\"page-wrapper\" class=\"page-wrapper\">\n";
-// 	body += "\t\t\t<div class=\"page\">\n";
-// 	body += platexobj_getTopBar(outputMode, obj.getSourceFile(), obj.getSourceLine(), "\t\t\t\t");
-// 	body += platexobj_book_getSidebarJs();
-// 	
-// 	body += "\t\t\t\t<div id=\"content\" class=\"content\">\n";
-// 	body += "\t\t\t\t\t<main>\n";
-// 	
-// // 	body += "\t\t<div class=\"pageContent\">\n";
 	outputMode.mapVar["${MAIN_TITLE}"] = "\t\t" + platexobj_createTitle(obj, baliseName, cssClassName, objTitle, prefixTitle, true);
-	
 	outputMode.mapVar["${SUB_MENU}"] = vecMenuToHtml(obj.getVecMenu());
-	std::string body("");
-	const PVecLatexObj & vecObj = obj.getVecContent();
-	for(PVecLatexObj::const_iterator it(vecObj.begin()); it != vecObj.end(); ++it){
-		body += platexobj_bookHtml(outputMode, *it, isBibliography, true);
-	}
 	outputMode.mapVar["${PAGE_CONTENT}"] = body;
-// 	body += "\t\t\t\t\t</main>\n";
-// 	body += platexobj_book_getNavigationButton(obj.getPrevSec().getLink(), obj.getNextSec().getLink(), false, "\t\t\t\t\t");
-// 	body += "\t\t\t\t</div>\n";
-// 	body += "\t\t\t</div>\n";
-// 	body += platexobj_book_getNavigationButton(obj.getPrevSec().getLink(), obj.getNextSec().getLink(), true, "\t\t\t");
-// 	body += "\t\t</div>\n";
-// 	body += platexobj_book_getEndJs();
-// 	body += getHtmlFooter();
-
+	
 	std::string fileName(obj.getLink());
 	if(!saveFileContent(fileName, platexobj_theme_createPage(outputMode))){
 		std::cerr << "platexobj_book_createPage : can't save file '"<<fileName<<"' for object '" << obj.getName() << "'" << std::endl;
@@ -347,49 +322,23 @@ bool platexobj_book_createPage(POutoutMode & outputMode, const PLatexObj & obj,
  * 	@param isBibliography : true if there is a bibliography, false otherwise
 */
 std::string platexobj_bookIndexHtml(POutoutMode & outputMode, const PLatexObj & obj, bool isBibliography){
-	
-// 	std::string objTitle(getSectionTitle(outputMode, obj));	//Content of the section title
+	std::string body("");
+	const PVecLatexObj & vecObj = obj.getVecContent();
+	for(PVecLatexObj::const_iterator it(vecObj.begin()); it != vecObj.end(); ++it){
+		body += platexobj_bookHtml(outputMode, *it, isBibliography, true);
+	}
 	std::string objTitle(obj.getName());	//Content of the section title
 	platexobj_theme_update_var(outputMode, obj.getLink(), objTitle,
 				obj.getPrevSec().getLink(), obj.getPrevSec().getText(),
 				obj.getNextSec().getLink(), obj.getNextSec().getText(),
 				obj.getParentSec().getLink(), obj.getParentSec().getText());
-	
-	
-// 	body += platexobj_book_getHeader(objTitle, "", outputMode.currentStyle, outputMode.isMathJaxMode, outputMode.isRemoteMathjax);
-// 	body += platexobj_book_getBeginJs();
-// 	
-// 	body += platexobj_menuToHtml(outputMode.fullMenu, obj.getLink(), isBibliography);
-// 	
-// 	body += "\t\t<div id=\"page-wrapper\" class=\"page-wrapper\">\n";
-// 	body += "\t\t\t<div class=\"page\">\n";
-// 	body += platexobj_getTopBar(outputMode, obj.getSourceFile(), obj.getSourceLine(), "\t\t\t\t");
-// 	body += platexobj_book_getSidebarJs();
-// 	
-// 	body += "\t\t\t\t<div id=\"content\" class=\"content\">\n";
-// 	body += "\t\t\t\t\t<main>\n";
 	std::string bodyTitle("");
 	bodyTitle += platexobj_htmlMainTitle(obj.getName(), "h1", "mainTitle");
 	bodyTitle += platexobj_htmlMainTitle(obj.getSubTitle(), "h2", "mainSubTitle");
 	bodyTitle += platexobj_htmlMainTitle(obj.getAuthor(), "h5", "author");
 	bodyTitle += platexobj_htmlMainTitle(obj.getDate(), "h6", "date");
 	outputMode.mapVar["${MAIN_TITLE}"] = bodyTitle;
-	
 	outputMode.mapVar["${SUB_MENU}"] = vecMenuToHtml(obj.getVecMenu());
-	std::string body("");
-	const PVecLatexObj & vecObj = obj.getVecContent();
-	for(PVecLatexObj::const_iterator it(vecObj.begin()); it != vecObj.end(); ++it){
-		body += platexobj_bookHtml(outputMode, *it, isBibliography, true);
-	}
-// 	body += "\t\t\t\t\t</main>\n";
-// 	body += platexobj_book_getNavigationButton(obj.getPrevSec().getLink(), obj.getNextSec().getLink(), false, "\t\t\t\t\t");
-// 	body += "\t\t\t\t</div>\n";
-// 	body += "\t\t\t</div>\n";
-// 	body += platexobj_book_getNavigationButton(obj.getPrevSec().getLink(), obj.getNextSec().getLink(), true, "\t\t\t");
-// 	body += "\t\t</div>\n";
-// 	
-// 	body += platexobj_book_getEndJs();
-// 	body += getHtmlFooter();
 	outputMode.mapVar["${PAGE_CONTENT}"] = body;
 	return platexobj_theme_createPage(outputMode);
 }
diff --git a/src/main.cpp b/src/main.cpp
index f478f85..52b5657 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -164,6 +164,7 @@ int processAllFile(const std::string & fileinput, const std::string & inputBibli
 	outputMode.isBookTheme = arg.isBookTheme;
 	platexobj_update_theme(outputMode, arg.themeFile);
 	if(arg.isBookTheme){
+		std::cout << "processAllFile : book mode enabled" << std::endl;
 		outputMode.fullMenu = platexobj_toMenu(orderLatex, parser.getBookMainPageLink());
 		
 		outputMode.bookSideBarWidth = parser.getBookSideBarWidth();
@@ -171,6 +172,7 @@ int processAllFile(const std::string & fileinput, const std::string & inputBibli
 		outputMode.isEnableBookFeedback = parser.getBookEnableFeedback();
 		outputMode.bookMail = parser.getBookMail();
 		outputMode.bookMasterProjectUrl = parser.getBookMasterProjectUrl();
+		
 	}
 	if(isBibliography && !arg.isLatexBackEnd){	//Save the bibliography if there is one
 		PMapBiblioEntry & mapBibio = parser.getMapBiblioEntry();
@@ -230,6 +232,9 @@ int main(int argc, char** argv){
 	arg.isBookTheme = defaultMode.isOptionExist("book");
 	defaultMode.getValue(arg.installPrefix, "prefix");
 	defaultMode.getValue(arg.themeFile, "theme");
+	if(arg.isBookTheme){
+		arg.themeFile = getProgramPrefix() + "/share/PhoenixTex2Html/THEME/book.html";
+	}
 	
 	std::string fileExtention(getExtention(inputFile));
 	if(fileExtention == "md"){
-- 
GitLab


From 358e97732841bf8d8a86563e140c27962d59f2f2 Mon Sep 17 00:00:00 2001
From: Pierre Aubert <pierre.aubert.lapp@gmail.com>
Date: Wed, 24 Aug 2022 17:45:52 +0200
Subject: [PATCH 05/18] Fix markers used in tab title

---
 src/PLatexObj/platexobj_formulae.cpp  |  1 -
 src/PLatexObj/platexobj_html.cpp      |  5 +--
 src/PLatexObj/platexobj_html_book.cpp |  3 +-
 src/PLatexObj/platexobj_menu.cpp      |  2 -
 src/PLatexObj/platexobj_rawtext.cpp   | 57 +++++++++++++++++++++++++++
 src/PLatexObj/platexobj_rawtext.h     | 16 ++++++++
 6 files changed, 77 insertions(+), 7 deletions(-)
 create mode 100644 src/PLatexObj/platexobj_rawtext.cpp
 create mode 100644 src/PLatexObj/platexobj_rawtext.h

diff --git a/src/PLatexObj/platexobj_formulae.cpp b/src/PLatexObj/platexobj_formulae.cpp
index 1a7ae3b..bcd777f 100644
--- a/src/PLatexObj/platexobj_formulae.cpp
+++ b/src/PLatexObj/platexobj_formulae.cpp
@@ -179,7 +179,6 @@ std::string platexobj_htmlStrInlineMath(POutoutMode & outputMode, const PLatexOb
 */
 void platexobj_update_theme(POutoutMode & outputMode, const std::string & themeBaseFile){
 	dico_create_nested_call(outputMode.themeCall, getFileContent(themeBaseFile), "${", "}");
-	std::cerr << "platexobj_update_theme : nb nested call : " << outputMode.themeCall.getVecNestedStr().size() << std::endl;
 }
 
 ///Set a variable in the map of variable for theme (will take account the IS_XXX_BEGIN accordingly if the value is empty or not)
diff --git a/src/PLatexObj/platexobj_html.cpp b/src/PLatexObj/platexobj_html.cpp
index b1706d4..ca0eae1 100644
--- a/src/PLatexObj/platexobj_html.cpp
+++ b/src/PLatexObj/platexobj_html.cpp
@@ -11,6 +11,7 @@
 #include "string_utils.h"
 #include "parser_utils.h"
 #include "platexobj_text.h"
+#include "platexobj_rawtext.h"
 
 #include "platexobj_html_book.h"
 
@@ -549,7 +550,7 @@ void platexobj_sectionHtml(POutoutMode & outputMode, const PLatexObj & obj, cons
 		body += platexobj_htmlStr(outputMode, *it, isBibliography);
 	}
 	std::string objTitle(getSectionTitle(outputMode, obj));	//Content of the section title
-	platexobj_theme_update_var(outputMode, obj.getLink(), objTitle,
+	platexobj_theme_update_var(outputMode, obj.getLink(), platexobj_rawtext(obj.getComplexTitle()),
 				obj.getPrevSec().getLink(), obj.getPrevSec().getText(),
 				obj.getNextSec().getLink(), obj.getNextSec().getText(),
 				obj.getParentSec().getLink(), obj.getParentSec().getText());
@@ -599,9 +600,7 @@ std::string platexobj_indexHtml(POutoutMode & outputMode, const PLatexObj & obj,
 	bodyTitle += platexobj_htmlMainTitle(obj.getAuthor(), "h5", "author");
 	bodyTitle += platexobj_htmlMainTitle(obj.getDate(), "h6", "date");
 	outputMode.mapVar["${MAIN_TITLE}"] = bodyTitle;
-	std::cerr << "platexobj_indexHtml : number of menu entries : " << obj.getVecMenu().size() << std::endl;
 	outputMode.mapVar["${SUB_MENU}"] = vecMenuToHtml(obj.getVecMenu());
-	std::cerr << "outputMode.mapVar[\"${SUB_MENU}\"] = '" << outputMode.mapVar["${SUB_MENU}"] << "'" << std::endl;
 	outputMode.mapVar["${PAGE_CONTENT}"] = body;
 	return platexobj_theme_createPage(outputMode);
 }
diff --git a/src/PLatexObj/platexobj_html_book.cpp b/src/PLatexObj/platexobj_html_book.cpp
index 7503e13..fa7c11f 100644
--- a/src/PLatexObj/platexobj_html_book.cpp
+++ b/src/PLatexObj/platexobj_html_book.cpp
@@ -7,6 +7,7 @@
 #include "string_system.h"
 #include "platexobj_html.h"
 #include "platexobj_menu.h"
+#include "platexobj_rawtext.h"
 
 #include "platexobj_html_book.h"
 
@@ -298,7 +299,7 @@ bool platexobj_book_createPage(POutoutMode & outputMode, const PLatexObj & obj,
 		body += platexobj_bookHtml(outputMode, *it, isBibliography, true);
 	}
 	std::string objTitle(getSectionTitle(outputMode, obj));	//Content of the section title
-	platexobj_theme_update_var(outputMode, obj.getLink(), objTitle,
+	platexobj_theme_update_var(outputMode, obj.getLink(), platexobj_rawtext(obj.getComplexTitle()),
 				obj.getPrevSec().getLink(), obj.getPrevSec().getText(),
 				obj.getNextSec().getLink(), obj.getNextSec().getText(),
 				obj.getParentSec().getLink(), obj.getParentSec().getText());
diff --git a/src/PLatexObj/platexobj_menu.cpp b/src/PLatexObj/platexobj_menu.cpp
index 17ea9ed..f785f21 100644
--- a/src/PLatexObj/platexobj_menu.cpp
+++ b/src/PLatexObj/platexobj_menu.cpp
@@ -48,10 +48,8 @@ void platexobj_toMenuAll(PFullMenu & menu, const PLatexObj & obj){
 PFullMenu platexobj_toMenu(const PLatexObj & obj, const PLatexObj & mainPageLink){
 	PFullMenu menu;
 	platexobj_toMenuAll(menu, obj);
-	std::cout << "platexobj_toMenu : mainPageLink.getType("<<((int)mainPageLink.getType())<<"), PLatexType::BOOKMAINPAGELINK = " << ((int)PLatexType::BOOKMAINPAGELINK) << std::endl;
 	if(mainPageLink.getType() == PLatexType::BOOKMAINPAGELINK){
 		std::string textMainPage(platexobj_text(mainPageLink.getVecContent()));
-		std::cout << "platexobj_toMenu : textMainPage = '" << textMainPage<< "'" << std::endl;
 		if(textMainPage != ""){
 			menu.setMainPageLink(textMainPage);
 		}else{
diff --git a/src/PLatexObj/platexobj_rawtext.cpp b/src/PLatexObj/platexobj_rawtext.cpp
new file mode 100644
index 0000000..561dd5d
--- /dev/null
+++ b/src/PLatexObj/platexobj_rawtext.cpp
@@ -0,0 +1,57 @@
+/***************************************
+	Auteur : Pierre Aubert
+	Mail : aubertp7@gmail.com
+	Licence : CeCILL-C
+****************************************/
+
+#include "platexobj_html.h"
+
+#include "platexobj_rawtext.h"
+
+
+///Convert a PLatexObj into a raw text string
+/**	@param[out] outputMode : output mode of the html backend
+ * 	@param obj : PLatexObj to be converted into a raw text string
+ * 	@return output string which contains the PLatexObj
+*/
+std::string platexobj_rawtextContent(const PLatexObj & obj){
+	std::string body("");
+	body += platexobj_rawtext(obj.getVecContent());
+	return body;
+}
+
+///Convert a PLatexObj in text
+/**	@param vecObj : vector of PLatexObj
+ * 	@return corresponding text
+*/
+std::string platexobj_rawtext(const std::vector<PLatexObj> & vecObj){
+	std::string body("");
+	for(std::vector<PLatexObj>::const_iterator it(vecObj.begin()); it != vecObj.end(); ++it){
+		body += platexobj_rawtext(*it);
+	}
+	return body;
+}
+
+///Convert a PLatexObj in text
+/**	@param obj : PLatexObj
+ * 	@return corresponding text
+*/
+std::string platexobj_rawtext(const PLatexObj & obj){
+	std::string body("");
+	PLatexType::PLatexType type(obj.getType());
+	if(type == PLatexType::TEXT){body = platexobj_htmlStrText(obj);}
+	else if(type == PLatexType::URL){body = platexobj_htmlStrUrl(obj);}
+	else if(type == PLatexType::PERCENT){body += "%";}
+	
+	else if(type == PLatexType::HREF){body = platexobj_rawtextContent(obj);}
+	else if(type == PLatexType::TEXTBF){body = platexobj_rawtextContent(obj);}
+	else if(type == PLatexType::TEXTIT){body = platexobj_rawtextContent(obj);}
+	else if(type == PLatexType::DEBUG){body = platexobj_htmlStrTextDebug(obj);}
+	else if(type == PLatexType::FUNCTION){body = platexobj_rawtextContent(obj);}
+	return body;
+}
+
+
+
+
+
diff --git a/src/PLatexObj/platexobj_rawtext.h b/src/PLatexObj/platexobj_rawtext.h
new file mode 100644
index 0000000..90b8645
--- /dev/null
+++ b/src/PLatexObj/platexobj_rawtext.h
@@ -0,0 +1,16 @@
+/***************************************
+	Auteur : Pierre Aubert
+	Mail : aubertp7@gmail.com
+	Licence : CeCILL-C
+****************************************/
+
+#ifndef __PLATEXOBJ_RAWTEXT_H__
+#define __PLATEXOBJ_RAWTEXT_H__
+
+#include "string_utils.h"
+#include "platexobj_formulae.h"
+
+std::string platexobj_rawtext(const std::vector<PLatexObj> & vecObj);
+std::string platexobj_rawtext(const PLatexObj & obj);
+
+#endif
-- 
GitLab


From ad5280cecf4fdd04ae4754452ef72bd8fde9669f Mon Sep 17 00:00:00 2001
From: Pierre Aubert <pierre.aubert.lapp@gmail.com>
Date: Wed, 24 Aug 2022 17:47:37 +0200
Subject: [PATCH 06/18] Update test in consequence

---
 TESTS/TEST_SECTION_DARK/testsection.tex | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/TESTS/TEST_SECTION_DARK/testsection.tex b/TESTS/TEST_SECTION_DARK/testsection.tex
index 715d877..4d133a3 100644
--- a/TESTS/TEST_SECTION_DARK/testsection.tex
+++ b/TESTS/TEST_SECTION_DARK/testsection.tex
@@ -53,7 +53,7 @@ cmake_minimum_required(VERSION 2.8)
 add_executable(test main.cpp)
 \end{cmake}
 
-\chapter{C++}
+\chapter{\lib{C++}}
 
 Let's try with C++ :
 
-- 
GitLab


From 46bb627b1ff263698ff63b845b0a7dcb98d4fc2e Mon Sep 17 00:00:00 2001
From: Pierre Aubert <pierre.aubert.lapp@gmail.com>
Date: Wed, 24 Aug 2022 18:00:20 +0200
Subject: [PATCH 07/18] Fix include

---
 src/PLatexObj/platexobj_formulae.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/PLatexObj/platexobj_formulae.h b/src/PLatexObj/platexobj_formulae.h
index 23534d2..fdd857c 100644
--- a/src/PLatexObj/platexobj_formulae.h
+++ b/src/PLatexObj/platexobj_formulae.h
@@ -10,7 +10,7 @@
 #include <string>
 #include <map>
 
-#include "FileParser/dico_replace_var.h"
+#include "dico_replace_var.h"
 #include "PLatexObj.h"
 
 ///Define the name of the file which contains the formulae and the path to the created file
-- 
GitLab


From 865c59a93de46eb8ceb7b8f2b75fdcaed2fb2de0 Mon Sep 17 00:00:00 2001
From: Pierre Aubert <pierre.aubert.lapp@gmail.com>
Date: Thu, 25 Aug 2022 10:34:04 +0200
Subject: [PATCH 08/18] Improve test coverage

---
 TESTS/TEST_BASE/CMakeLists.txt        |   6 +
 src/PLatexObj/platexobj_html.cpp      |  48 -----
 src/PLatexObj/platexobj_html_book.cpp | 269 --------------------------
 3 files changed, 6 insertions(+), 317 deletions(-)

diff --git a/TESTS/TEST_BASE/CMakeLists.txt b/TESTS/TEST_BASE/CMakeLists.txt
index c1a19d3..32413ba 100644
--- a/TESTS/TEST_BASE/CMakeLists.txt
+++ b/TESTS/TEST_BASE/CMakeLists.txt
@@ -12,4 +12,10 @@ add_test(NAME Test_baseToTex
 add_test(NAME Test_phoenix_tex2htmlAllBase
 	WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
 	COMMAND ${PHOENIXUNITTEST_PHOENIX_DRIPFILE_EXECUTABLE} -i ${CMAKE_CURRENT_SOURCE_DIR}/testBase.tex -d "{}&$" -x -c "${PHOENIX_TEX_2_HTML_EXECUTABLE} -i FILENAME -p ${SHARE_PREFIX}")
+	
+add_test(NAME Test_baseWrongFileExtension
+	WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
+	COMMAND ${PHOENIX_TEX_2_HTML_EXECUTABLE} -i ${CMAKE_CURRENT_SOURCE_DIR}/tb_tweety.png -p ${SHARE_PREFIX})
+set_tests_properties(Test_baseWrongFileExtension PROPERTIES WILL_FAIL true)
+
 
diff --git a/src/PLatexObj/platexobj_html.cpp b/src/PLatexObj/platexobj_html.cpp
index ca0eae1..e9e0711 100644
--- a/src/PLatexObj/platexobj_html.cpp
+++ b/src/PLatexObj/platexobj_html.cpp
@@ -485,54 +485,6 @@ std::string getHtmlFooter(){
 	
 }
 
-///Create the section menu link
-/**	@param menuSec : current section menu
- * 	@param prefixMenu : prefix of the menu text
- * 	@return html string
-*/
-std::string createSectionMenuLink(const PLatexMenu & menuSec, const std::string & prefixMenu){
-	std::string body("");
-	const std::string & link(menuSec.getLink());
-// 	const std::string & text(convertStrToHtml(menuSec.getText()));
-	const std::string & text(menuSec.getText());
-	if(link != "" && text != ""){
-		std::string textAlign("center");
-		if(prefixMenu == "Next"){
-			textAlign = "right";
-		}else if(prefixMenu == "Previous"){
-			textAlign = "left";
-		}
-		body += "\t\t\t<td style=\"text-align: "+textAlign+";\">"+prefixMenu+"<br /><a href=\""+link+"\">"+text+"</a></td>\n";
-	}
-	return body;
-}
-
-///Create the navigation menu
-/**	@param prevSec : previous section name and link
- * 	@param parentSec : parent section name and link
- * 	@param nextSec : next section name and link
- * 	@param cssClassName : css class name to be used
- * 	@param isBibliography : true if there is a bibliography, false otherwise
- * 	@return output html string
-*/
-std::string createNavigationMenu(const PLatexMenu & prevSec, const PLatexMenu & parentSec, const PLatexMenu & nextSec, const std::string & cssClassName,
-				bool isBibliography)
-{
-	std::string body("");
-	body += "\t\t<table class=\""+cssClassName+"\">\n";
-	body += "\t\t\t<tr>\n";
-	body += createSectionMenuLink(prevSec, "Previous");
-	body += createSectionMenuLink(parentSec, "Parent");
-	body += "\t\t\t<td><a href=\"outline.html\">Outline</a></td>\n";
-	if(isBibliography){
-		body += "\t\t\t<td><a href=\"bibliography.html\">Bibliographie</a></td>\n";
-	}
-	body += createSectionMenuLink(nextSec, "Next");
-	body += "\t\t\t</tr>\n";
-	body += "\t\t</table>\n";
-	return body;
-}
-
 ///Save a section in html
 /**	@param[out] outputMode : output mode of the html backend
  * 	@param obj : PLatexObj to be saved
diff --git a/src/PLatexObj/platexobj_html_book.cpp b/src/PLatexObj/platexobj_html_book.cpp
index fa7c11f..5f91998 100644
--- a/src/PLatexObj/platexobj_html_book.cpp
+++ b/src/PLatexObj/platexobj_html_book.cpp
@@ -11,275 +11,6 @@
 
 #include "platexobj_html_book.h"
 
-///Get the meta of the page
-/**	@param pageTitle : title of the page
- * 	@param favIcon : fav icon of the page
- * 	@param currentStyle : current style to be used
- * 	@param useMathJax : true to use MathJax, false otherwise
- * 	@param useRemoteMathjax : true if we use remote mathjax
- * 	@return corresponding html
-*/
-std::string platexobj_book_getHeader(const std::string & pageTitle, const std::string & favIcon, const std::string & currentStyle, bool useMathJax, bool useRemoteMathjax){
-	std::string body(""), baseIndentation("");
-	body += baseIndentation+"<!DOCTYPE html>\n";
-	body += baseIndentation+"<html class=\"js sidebar-visible navy\" lang=\"fr\">\n";
-	body += baseIndentation+"\t<head>\n";
-	body += baseIndentation+"\t\t<meta charset=\"UTF-8\">\n";
-        body += baseIndentation+"\t\t<title>"+pageTitle+"</title>\n";
-	
-	body += baseIndentation+"\t\t<meta content=\"text/html; charset=UTF-8\" http-equiv=\"Content-Type\">\n";
-	body += baseIndentation+"\t\t<meta name=\"description\" content=\""+pageTitle+"\">\n";
-	body += baseIndentation+"\t\t<meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n";
-	body += baseIndentation+"\t\t<meta name=\"theme-color\" content=\"rgba(0, 0, 0, 0)\">\n";
-	
-	if(favIcon != ""){
-		body += baseIndentation+"\t\t<link rel=\"shortcut icon\" href=\""+favIcon+"\">\n";
-	}
-	body += baseIndentation+"\t\t<link rel=\"stylesheet\" href=\"variables.css\">\n";
-	body += baseIndentation+"\t\t<link rel=\"stylesheet\" href=\""+currentStyle+"_style.css\" />\n";
-	body += baseIndentation+"\t\t<link rel=\"stylesheet\" href=\"general.css\">\n";
-	body += baseIndentation+"\t\t<link rel=\"stylesheet\" href=\"chrome.css\">\n";
-	
-	body += baseIndentation+"\t\t<link rel=\"stylesheet\" href=\"highlight.css\" disabled=\"\">\n";
-	body += baseIndentation+"\t\t<link rel=\"stylesheet\" href=\"tomorrow-night.css\">\n";
-	body += baseIndentation+"\t\t<link rel=\"stylesheet\" href=\"ayu-highlight.css\" disabled=\"\">\n";
-	
-	body += baseIndentation+"\t\t<!-- Fonts -->\n";
-	body += baseIndentation+"\t\t<link rel=\"stylesheet\" href=\"font-awesome.css\">\n";
-	body += baseIndentation+"\t\t<link rel=\"stylesheet\" href=\"fonts.css\">\n";
-	
-	if(useMathJax){
-		if(useRemoteMathjax){
-			body += baseIndentation+"\t\t<script src=\"load-mathjax.js\" async></script>\n";
-		}else{
-			body += baseIndentation+"\t\t<script type=\"text/x-mathjax-config\">\n";
-			body += baseIndentation+"\t\t\tMathJax.Hub.Config({\n";
-			body += baseIndentation+"\t\t\t\tjax: [\"input/TeX\",\"output/HTML-CSS\"],\n";
-			body += baseIndentation+"\t\t\t\textensions: [\"tex2jax.js\"],\n";
-			body += baseIndentation+"\t\t\t\ttex2jax: {inlineMath: [[\"$\",\"$\"],[\"\\\\(\",\"\\\\)\"]]}\n";
-			body += baseIndentation+"\t\t\t});\n";
-			body += baseIndentation+"\t\t</script>\n";
-			body += baseIndentation+"\t\t<script type=\"text/javascript\" src=\"MathJax.js\"></script>\n";
-		}
-	}
-	
-	body += baseIndentation+"\t</head>\n";
-	body += baseIndentation+"\t<body>\n";
-	body += baseIndentation+"\t\t<div id=\"MathJax_Message\" style=\"display: none;\"></div>\n";
-	return body;
-}
-
-
-///Get the last javascript command to be used at the begining of the page
-/**	@return corresponding html
-*/
-std::string platexobj_book_getBeginJs(){
-	std::string body(""), baseIndentation("\t\t");
-	body += baseIndentation+"<!-- Provide site root to javascript -->\n";
-	body += baseIndentation+"<script type=\"text/javascript\">\n";
-	body += baseIndentation+"    var path_to_root = \"./\";\n";
-	body += baseIndentation+"    var default_theme = window.matchMedia(\"(prefers-color-scheme: dark)\").matches ? \"navy\" : \"light\";\n";
-	body += baseIndentation+"</script>\n";
-	body += baseIndentation+"\n";
-	body += baseIndentation+"<!-- Work around some values being stored in localStorage wrapped in quotes -->\n";
-	body += baseIndentation+"<script type=\"text/javascript\">\n";
-	body += baseIndentation+"\ttry {\n";
-	body += baseIndentation+"\t\tvar theme = localStorage.getItem('mdbook-theme');\n";
-	body += baseIndentation+"\t\tvar sidebar = localStorage.getItem('mdbook-sidebar');\n";
-	body += baseIndentation+"\n";
-	body += baseIndentation+"\tif (theme.startsWith('\"') && theme.endsWith('\"')) {\n";
-	body += baseIndentation+"\t\tlocalStorage.setItem('mdbook-theme', theme.slice(1, theme.length - 1));\n";
-	body += baseIndentation+"\t}\n";
-	body += baseIndentation+"\n";
-	body += baseIndentation+"\tif (sidebar.startsWith('\"') && sidebar.endsWith('\"')) {\n";
-	body += baseIndentation+"\t\tlocalStorage.setItem('mdbook-sidebar', sidebar.slice(1, sidebar.length - 1));\n";
-	body += baseIndentation+"\t}\n";
-	body += baseIndentation+"\t} catch (e) { }\n";
-	body += baseIndentation+"</script>\n";
-	body += baseIndentation+"\n";
-	body += baseIndentation+"<!-- Set the theme before any content is loaded, prevents flash -->\n";
-	body += baseIndentation+"<script type=\"text/javascript\">\n";
-	body += baseIndentation+"\tvar theme;\n";
-	body += baseIndentation+"\ttry { theme = localStorage.getItem('mdbook-theme'); } catch(e) { }\n";
-	body += baseIndentation+"\tif (theme === null || theme === undefined) { theme = default_theme; }\n";
-	body += baseIndentation+"\tvar html = document.querySelector('html');\n";
-	body += baseIndentation+"\thtml.classList.remove('no-js')\n";
-	body += baseIndentation+"\thtml.classList.remove('light')\n";
-	body += baseIndentation+"\thtml.classList.add(theme);\n";
-	body += baseIndentation+"\thtml.classList.add('js');\n";
-	body += baseIndentation+"</script>\n";
-	body += baseIndentation+"\n";
-	body += baseIndentation+"<!-- Hide / unhide sidebar before it is displayed -->\n";
-	body += baseIndentation+"<script type=\"text/javascript\">\n";
-	body += baseIndentation+"\tvar html = document.querySelector('html');\n";
-	body += baseIndentation+"\tvar sidebar = 'hidden';\n";
-	body += baseIndentation+"\tif (document.body.clientWidth >= 1080) {\n";
-	body += baseIndentation+"\t\ttry { sidebar = localStorage.getItem('mdbook-sidebar'); } catch(e) { }\n";
-	body += baseIndentation+"\t\tsidebar = sidebar || 'visible';\n";
-	body += baseIndentation+"\t}\n";
-	body += baseIndentation+"\thtml.classList.remove('sidebar-visible');\n";
-	body += baseIndentation+"\thtml.classList.add(\"sidebar-\" + sidebar);\n";
-	body += baseIndentation+"</script>\n";
-	return body;
-}
-
-///Get the last javascript command to define sidebar of the page
-/**	@return corresponding html
-*/
-std::string platexobj_book_getSidebarJs(){
-	std::string body(""), baseIndentation("\t\t\t\t");
-	body += baseIndentation+"<!-- Apply ARIA attributes after the sidebar and the sidebar toggle button are added to the DOM -->\n";
-	body += baseIndentation+"<script type=\"text/javascript\">\n";
-	body += baseIndentation+"\tdocument.getElementById('sidebar-toggle').setAttribute('aria-expanded', sidebar === 'visible');\n";
-	body += baseIndentation+"\tdocument.getElementById('sidebar').setAttribute('aria-hidden', sidebar !== 'visible');\n";
-	body += baseIndentation+"\tArray.from(document.querySelectorAll('#sidebar a')).forEach(function(link) {\n";
-	body += baseIndentation+"\t\tlink.setAttribute('tabIndex', sidebar === 'visible' ? 0 : -1);\n";
-	body += baseIndentation+"\t});\n";
-	body += baseIndentation+"</script>\n";
-	return body;
-}
-
-///Get the last javascript command to be used at the end of the page
-/**	@return corresponding html
-*/
-std::string platexobj_book_getEndJs(){
-	std::string body(""), baseIndentation("\t\t");
-	body += baseIndentation+"<script type=\"text/javascript\">\n";
-	body += baseIndentation+"\twindow.playground_copyable = true;\n";
-	body += baseIndentation+"</script>\n";
-	body += baseIndentation+"<script src=\"clipboard.js\" type=\"text/javascript\" charset=\"utf-8\"></script>\n";
-	body += baseIndentation+"<script src=\"highlight.js\" type=\"text/javascript\" charset=\"utf-8\"></script>\n";
-	body += baseIndentation+"<script src=\"book.js\" type=\"text/javascript\" charset=\"utf-8\"></script>\n";
-	return body;
-}
-
-///Get the navigation bar
-/**	@param prevPage : previous page
- * 	@param nextPage : next page
- * 	@param isWideVrapper : true if the nav wrapper is wide, false otherwise
- * 	@param indentation : indentation of the html
-*/
-std::string platexobj_book_getNavigationButton(const std::string & prevPage, const std::string & nextPage, bool isWideVrapper, const std::string & indentation){
-	std::string body(""), baseIndentation(indentation);
-	std::string navClass("nav-wrapper"), mobileNavWrapper("mobile-nav-chapters");
-	if(isWideVrapper){
-		navClass = "nav-wide-wrapper";
-		mobileNavWrapper = "nav-chapters";
-	}
-	
-	body += baseIndentation+"<nav class=\""+navClass+"\" aria-label=\"Page navigation\">\n";
-	body += baseIndentation+"\t<!-- Mobile navigation buttons -->\n";
-	if(prevPage != ""){
-		body += baseIndentation+"\t<a rel=\"prev\" href=\""+prevPage+"\" class=\""+mobileNavWrapper+" previous\" title=\"Previous page\" aria-label=\"Previous page\" aria-keyshortcuts=\"Left\">\n";
-// 		body += baseIndentation+"\t\t<i class=\"fa fa-angle-left\"></i>\n";
-		body += baseIndentation+"\t\t<i class=\"book-prev-icon\"></i>\n";
-		body += baseIndentation+"\t</a>\n";
-	}
-	if(nextPage != ""){
-		body += baseIndentation+"\t<a rel=\"next\" href=\""+nextPage+"\" class=\""+mobileNavWrapper+" next\" title=\"Next page\" aria-label=\"Next page\" aria-keyshortcuts=\"Right\">\n";
-// 		body += baseIndentation+"\t\t<i class=\"fa fa-angle-right\"></i>\n";
-		body += baseIndentation+"\t\t<i class=\"book-next-icon\"></i>\n";
-		body += baseIndentation+"\t</a>\n";
-	}
-	if(!isWideVrapper){
-		body += baseIndentation+"\t<div style=\"clear: both\"></div>\n";
-	}
-	body += baseIndentation+"</nav>\n";
-	return body;
-}
-
-///Get he top bar
-/**	@param outputMode : output mode of the html backend
- * 	@param sourceFile : source file of the current section to edit
- * 	@param sourceLine : line of the current section to edit
- * 	@param indentation : indentation of the html
- * 	@return corresponding html
-*/
-std::string platexobj_getTopBar(const POutoutMode & outputMode, const std::string & sourceFile, size_t sourceLine, const std::string & indentation){
-	std::string body("");
-	body += indentation + "<div id=\"menu-bar-hover-placeholder\"></div>\n";
-	
-	body += indentation + "<div id=\"menu-bar\" class=\"menu-bar\" style=\"top: 0px;\">\n";
-	body += indentation + "\t<div class=\"left-buttons\">\n";
-	
-	body += indentation + "\t\t<button id=\"sidebar-toggle\" class=\"icon-button book-button\" type=\"button\" title=\"Toggle Table of Contents\" aria-label=\"Toggle Table of Contents\" aria-controls=\"sidebar\" aria-expanded=\"true\">\n";
-// 	body += indentation + "\t\t\t<i class=\"fa fa-bars\"></i>\n";
-	body += indentation + "\t\t\t<i class=\"fa book-toggle-sidebar-icon\"></i>\n";
-	body += indentation + "\t\t</button>\n";
-	
-	//Themes list
-	body += indentation + "\t\t<button id=\"theme-toggle\" class=\"icon-button book-button\" type=\"button\" title=\"Change theme\" aria-label=\"Change theme\" aria-haspopup=\"true\" aria-expanded=\"false\" aria-controls=\"theme-list\">\n";
-// 	body += indentation + "\t\t\t<i class=\"fa fa-paint-brush\"></i>\n";
-	body += indentation + "\t\t\t<i class=\"fa book-theme-icon\"></i>\n";
-	body += indentation + "\t\t</button>\n";
-	body += indentation + "\t\t<ul id=\"theme-list\" class=\"theme-popup\" aria-label=\"Themes\" role=\"menu\">\n";
-// 	body += indentation + "\t\t\t<li role=\"none\"><button role=\"menuitem\" class=\"theme\" id=\"light\">Light (default)</button></li>\n";
-// 	body += indentation + "\t\t\t<li role=\"none\"><button role=\"menuitem\" class=\"theme\" id=\"rust\">Rust</button></li>\n";
-// 	body += indentation + "\t\t\t<li role=\"none\"><button role=\"menuitem\" class=\"theme\" id=\"coal\">Coal</button></li>\n";
-	body += indentation + "\t\t\t<li role=\"none\"><button role=\"menuitem\" class=\"theme\" id=\"navy\">Navy</button></li>\n";
-// 	body += indentation + "\t\t\t<li role=\"none\"><button role=\"menuitem\" class=\"theme\" id=\"ayu\">Ayu</button></li>\n";
-	body += indentation + "\t\t</ul>\n";
-	
-	//Link to the gitlab repository
-	if(outputMode.bookGitlabUrl != ""){
-		body += indentation + "\t\t<a href=\""+outputMode.bookGitlabUrl+"\" title=\"Git repository\" aria-label=\"Git repository\">\n";
-// 		body += indentation + "\t\t\t<i id=\"git-repository-button\" class=\"fa fa-gitlab\"></i>\n";
-		body += indentation + "\t\t\t<i id=\"git-repository-button\" class=\"fa book-gitlab-icon\"></i>\n";
-		body += indentation + "\t\t</a>\n";
-	}
-	if(outputMode.bookMail != ""){
-		body += indentation + "\t\t<a href=\"mailto: "+outputMode.bookMail+"\" title=\"Send email to authors\" aria-label=\"Send mail\">\n";
-// 		body += indentation + "\t\t\t<i id=\"git-repository-button\" class=\"fa fa-mail-reply-all\"></i>\n";
-		body += indentation + "\t\t\t<i id=\"git-repository-button\" class=\"fa book-mail-icon\"></i>\n";
-		body += indentation + "\t\t</a>\n";
-	}
-	
-	if(outputMode.isEnableBookFeedback && outputMode.bookGitlabUrl != "" && sourceFile != ""){
-		std::string sourceUrl(getUnderPath(removePathDots(makeAbsolutePath(sourceFile)), getFileName(outputMode.bookGitlabUrl)));
-		std::string currentBranch(phoenix_getenv("CI_COMMIT_BRANCH"));
-		if(currentBranch == ""){
-			if(phoenix_popen(currentBranch, "git branch --show-current 2> /dev/null") != 0){
-				currentBranch = "master";
-			}
-		}
-		if(currentBranch == "" || currentBranch == "(HEAD"){currentBranch = "master";}
-		//Link to suggest an edit
-		body += indentation + "\t\t<a href=\""+outputMode.bookGitlabUrl+"/-/edit/"+currentBranch+"/"+sourceUrl+"#L"+convertToString(sourceLine)+"\" title=\"Suggest an edit\" aria-label=\"Suggest an edit\">\n";
-// 		body += indentation + "\t\t\t<i id=\"git-edit-button\" class=\"fa fa-edit\"></i>\n";
-		body += indentation + "\t\t\t<i id=\"git-edit-button\" class=\"fa book-edit-icon\"></i>\n";
-		body += indentation + "\t\t</a>\n";
-	}
-	if(outputMode.bookMasterProjectUrl != ""){
-		body += indentation + "\t\t<a href=\""+outputMode.bookMasterProjectUrl+"\" title=\"Master project\" aria-label=\"Master projec\">\n";
-		body += indentation + "\t\t\t<i id=\"master-project-button\" class=\"fa book-home-icon\"></i>\n";
-		body += indentation + "\t\t</a>\n";
-	}
-	
-	//Search toolbar
-// 	body += indentation + "\t\t<button id=\"search-toggle\" class=\"icon-button\" type=\"button\" title=\"Search. (Shortkey: s)\" aria-label=\"Toggle Searchbar\" aria-expanded=\"false\" aria-keyshortcuts=\"S\" aria-controls=\"searchbar\">\n";
-// 	body += indentation + "\t\t\t<i class=\"fa fa-search\"></i>\n";
-// 	body += indentation + "\t\t</button>\n";
-	body += indentation + "\t</div>\n";	//End of left buttons
-	
-	body += indentation + "\t<h1 class=\"menu-title\"></h1>\n";
-        body += indentation + "\n";
-	body += indentation + "\t<div class=\"right-buttons\">\n";
-	body += indentation + "\t\t<a href=\"https://gitlab.in2p3.fr/CTA-LAPP/PHOENIX_LIBS/PhoenixTex2Html/\" title=\"PhoenixTex2Html\" aria-label=\"PhoenixTex2Html compiler\">\n";
-	body += indentation + "\t\t\t<i id=\"git-repository-button\" class=\"fa book-gitlab-icon\"></i>\n";
-	body += indentation + "\t\t</a>\n";
-
-	//Command to print the current page
-//         body += indentation + "\t\t<a href=\"print.html\" title=\"Print this book\" aria-label=\"Print this book\">\n";
-//         body += indentation + "\t\t\t<i id=\"print-button\" class=\"fa fa-print\"></i>\n";
-//         body += indentation + "\t\t</a>\n";
-	
-	
-        body += indentation + "\n";
-        body += indentation + "\t</div>\n";
-        body += indentation + "</div>\n";
-	
-	return body;
-}
 
 ///Create a page with book theme
 /**	@param[out] outputMode : output mode of the html backend
-- 
GitLab


From 4649b21d33bf18672de1bef2b64228bda655cd25 Mon Sep 17 00:00:00 2001
From: Pierre Aubert <pierre.aubert.lapp@gmail.com>
Date: Thu, 25 Aug 2022 10:47:44 +0200
Subject: [PATCH 09/18] Ignore tmp_project to generate the documentation to
 lignten it

---
 doc/Doxyfile.cmake | 1 +
 1 file changed, 1 insertion(+)

diff --git a/doc/Doxyfile.cmake b/doc/Doxyfile.cmake
index 72d5c3f..6e43d11 100644
--- a/doc/Doxyfile.cmake
+++ b/doc/Doxyfile.cmake
@@ -890,6 +890,7 @@ EXCLUDE                = ./ \
                          @CMAKE_BINARY_DIR@ \
                          @CMAKE_BINARY_DIR@2 \
                          @CMAKE_SOURCE_DIR@/TESTS \
+                         @CMAKE_SOURCE_DIR@/tmp_project \
                          hessio2shadok \
                          @CMAKE_BIN_DIR@
 
-- 
GitLab


From 710382357b518842dfcf7b6d21c37778e081a646 Mon Sep 17 00:00:00 2001
From: Pierre Aubert <pierre.aubert.lapp@gmail.com>
Date: Thu, 25 Aug 2022 11:37:06 +0200
Subject: [PATCH 10/18] Disable save of html doxygen documentation in artifact
 to make pages appears again

---
 .gitlab-ci.yml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 1cfff2b..3fb0c36 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -90,7 +90,7 @@ Doc:
     - make install
     - make doc
     - scp -r doc/platex/* ../public
-    - scp -r doc/html/* ../public/html
+    #- scp -r doc/html/* ../public/html
     artifacts:
       paths:
       - public
-- 
GitLab


From 08a0c12a007980a1aabb26d1437c94a2a86653a8 Mon Sep 17 00:00:00 2001
From: Pierre Aubert <pierre.aubert.lapp@gmail.com>
Date: Thu, 25 Aug 2022 18:38:50 +0200
Subject: [PATCH 11/18] Add scripts to make automatic release within CI

---
 .gitlab-ci.yml                  | 247 +++++++++++++++++++-------------
 cmake/createReleaseCurl.py      | 135 +++++++++++++++++
 cmake/phoenix_createPackages.sh | 110 ++++++++++++++
 3 files changed, 394 insertions(+), 98 deletions(-)
 create mode 100644 cmake/createReleaseCurl.py
 create mode 100755 cmake/phoenix_createPackages.sh

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 3fb0c36..0b543f2 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -1,117 +1,168 @@
-image: gitlab-registry.in2p3.fr/cta-lapp/phoenix_libs/phoenix/phoenix_minimal:0.2
 
 stages:
 - BuildTestinstall
 - DocCoverage
 - deploy
 
-image: gitlab-registry.in2p3.fr/cta-lapp/phoenix_libs/phoenix/phoenix_minimal:0.2
-
-stages:
-- BuildTestinstall
-- DocCoverage
-- deploy
-
-#- build
-#- test
-#- deploy
-
 dailyBuildMasterAll:
-    #cache:
-        #untracked: true
-        #paths:
-        #- build/
-
-    stage: BuildTestinstall
-    script:
-    - export LD_LIBRARY_PATH=/usr/lib
-    - env
-    - mkdir -p build
-    - cd build
-    - >
-        cmake ..
-        -DCMAKE_INSTALL_PREFIX=/usr
-        -DRELEASE_MODE=yes
-        -DSELF_TESTS_MODE=yes
-    - make all
-    - make install
-    - make test
-    only:
-    - branches
-    - tags
-    tags:
+        #cache:
+                #untracked: true
+                #paths:
+                #- build/
+        image: gitlab-registry.in2p3.fr/cta-lapp/phoenix_libs/phoenix/phoenix_minimal:0.2
+        stage: BuildTestinstall
+        script:
+        - export LD_LIBRARY_PATH=/usr/lib
+        - env
+        - mkdir -p build
+        - cd build
+        - >
+                cmake ..
+                -DCMAKE_INSTALL_PREFIX=/usr
+                -DRELEASE_MODE=yes
+                -DSELF_TESTS_MODE=yes
+        - make all
+        - make install
+        - make test
+        only:
+        - branches
+        - tags
+        tags:
 
 TestCoverage:
-    stage: DocCoverage
-    script:
-    - export LD_LIBRARY_PATH=/usr/lib
-    - env
-    - mkdir -p build coverage
-    - cd build
-    - >
-        cmake ..
-        -DCMAKE_INSTALL_PREFIX=/usr
-        -DRELEASE_MODE=yes
-        -DSELF_TESTS_MODE=yes
-        -DCMAKE_BUILD_TYPE=Coverage
-    - make all
-    - make install
-    - make test
-    - make ExperimentalCoverage
-    - cd ../coverage
-    - gcovr -r ../ --exclude-throw-branches --html cov_report.html --html-details
-    - gcovr -r ../ --exclude-throw-branches --xml Coverage.xml
-    - gcovr -r ../ --exclude-throw-branches
-    artifacts:
-        paths:
-        - coverage
-        expire_in: 8d
-    only:
-    - branches
-    - tags
-    tags:
+        image: gitlab-registry.in2p3.fr/cta-lapp/phoenix_libs/phoenix/phoenix_minimal:0.2
+        stage: DocCoverage
+        script:
+        - export LD_LIBRARY_PATH=/usr/lib
+        - env
+        - mkdir -p build coverage
+        - cd build
+        - >
+                cmake ..
+                -DCMAKE_INSTALL_PREFIX=/usr
+                -DRELEASE_MODE=yes
+                -DSELF_TESTS_MODE=yes
+                -DCMAKE_BUILD_TYPE=Coverage
+        - make all
+        - make install
+        - make test
+        - make ExperimentalCoverage
+        - cd ../coverage
+        - gcovr -r ../ --exclude-throw-branches --html cov_report.html --html-details
+        - gcovr -r ../ --exclude-throw-branches --xml Coverage.xml
+        - gcovr -r ../ --exclude-throw-branches
+        artifacts:
+                paths:
+                - coverage
+                expire_in: 8d
+        only:
+        - branches
+        - tags
+        tags:
 
 Doc:
-    stage: DocCoverage
-    script:
-    - export LD_LIBRARY_PATH=/usr/lib
-    - env
-    - rm -fr build public
-    - mkdir -p build
-    - mkdir -p public
-    - mkdir -p public/html
-    - cd build
-    - >
-        cmake ..
-        -DCMAKE_INSTALL_PREFIX=/usr
-        -DRELEASE_MODE=yes
-        -DDOC_MODE=yes
-    - make all
-    - make install
-    - make doc
-    - scp -r doc/platex/* ../public
-    #- scp -r doc/html/* ../public/html
-    artifacts:
-      paths:
-      - public
-      expire_in: 8d
-    only:
-    - branches
-    - tags
-    tags:
+        image: gitlab-registry.in2p3.fr/cta-lapp/phoenix_libs/phoenix/phoenix_minimal:0.2
+        stage: DocCoverage
+        script:
+        - export LD_LIBRARY_PATH=/usr/lib
+        - env
+        - rm -fr build public
+        - mkdir -p build
+        - mkdir -p public
+        - mkdir -p public/html
+        - cd build
+        - >
+                cmake ..
+                -DCMAKE_INSTALL_PREFIX=/usr
+                -DRELEASE_MODE=yes
+                -DDOC_MODE=yes
+        - make all
+        - make install
+        - make doc
+        - scp -r doc/platex/* ../public
+        #- scp -r doc/html/* ../public/html
+        artifacts:
+                paths:
+                - public
+                expire_in: 8d
+        only:
+        - branches
+        - tags
+        tags:
 
 
 pages:
-  stage: deploy
-  script:
-    - mv coverage public/
-  artifacts:
-    paths:
-      - public
-    expire_in: 8d
-    
+        stage: deploy
+        script:
+        - mv coverage public/
+        artifacts:
+                paths:
+                - public
+                expire_in: 8d
     
     
+Ubuntu 2004:
+        image: gitlab-registry.in2p3.fr/cta-lapp/phoenix_libs/phoenixdocker/package_ubuntu2004_gcc9:0.1
+        stage: DocCoverage
+        script:
+                - ./cmake/phoenix_createPackages.sh DEB package_ubuntu2004 false
+        artifacts:
+                paths:
+                - package_ubuntu2004
+                expire_in: 8d
+        only:
+        #- branches
+        - tags
+
+Ubuntu 2204:
+        image: gitlab-registry.in2p3.fr/cta-lapp/phoenix_libs/phoenixdocker/package_ubuntu2204_gcc11:0.1
+        stage: DocCoverage
+        script:
+                - ./cmake/phoenix_createPackages.sh DEB package_ubuntu2204 false
+        artifacts:
+                paths:
+                - package_ubuntu2204
+                expire_in: 8d
+        only:
+        #- branches
+        - tags
+        
+Fedora 31:
+        image: gitlab-registry.in2p3.fr/cta-lapp/phoenix_libs/phoenixdocker/package_fedora31:0.1
+        stage: DocCoverage
+        script:
+                - ./cmake/phoenix_createPackages.sh RPM package_fedora31 false
+        artifacts:
+                paths:
+                - package_fedora31
+                expire_in: 8d
+        only:
+        #- branches
+        - tags
+
+Fedora 36:
+        image: gitlab-registry.in2p3.fr/cta-lapp/phoenix_libs/phoenixdocker/package_fedora36:0.1
+        stage: DocCoverage
+        script:
+                - ./cmake/phoenix_createPackages.sh RPM package_fedora36 false
+        artifacts:
+                paths:
+                - package_fedora36
+                expire_in: 8d
+        only:
+        #- branches
+        - tags
+        
+Release:
+        image: gitlab-registry.in2p3.fr/cta-lapp/phoenix_libs/phoenixdocker/package_ubuntu2204_python3:0.1
+        stage: deploy
+        script:
+        - echo "Let's do some release"
+        - uname -a
+        - python3 ./cmake/createReleaseCurl.py -n ${CI_PROJECT_TITLE} -i ${CI_PROJECT_ID} -t ${CI_COMMIT_TAG} -p ${CI_RELEASE_TOKEN}
+        only:
+        #- branches
+        - tags
     
 
 
diff --git a/cmake/createReleaseCurl.py b/cmake/createReleaseCurl.py
new file mode 100644
index 0000000..657a4fe
--- /dev/null
+++ b/cmake/createReleaseCurl.py
@@ -0,0 +1,135 @@
+#!/usr/bin/env python
+# coding: utf-8
+
+import sys
+import os
+import subprocess
+import json
+import glob
+import argparse
+
+server="gitlab.in2p3.fr"
+apiProject="/api/v4/projects/"
+
+
+def getListArchiveFile(inputDirectory, projectName):
+	'''
+	Get the list of the archives file for a given project name
+	Parameters:
+		inputDirectory : directory (for one OS) where all the binary packages are created
+		projectName : name of the project
+	Return:
+		list of corresponding binary packages
+	'''
+	listPackage = glob.glob(inputDirectory + "/*/" + projectName + "-*" )
+	print(listPackage)
+	return listPackage
+
+
+#curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" --form "file=@dk.png" "https://gitlab.example.com/api/v4/projects/5/uploads"
+def uploadFileCommand(projectIdOwn, fileName, token):
+	'''
+	Upload a file in the given gitlab project
+	Parameters:
+		projectIdOwn : id of the project
+		fileName : name of the file to be uploaded
+		token : token to be used to create the release
+	Return:
+		url of the uploaded file
+	'''
+	print("Upload file",fileName)
+	URL = '"https://'+server+apiProject+str(projectIdOwn)+'/uploads"'
+	privateToken='--header "PRIVATE-TOKEN: '+token+'" '
+	fileCmd = '--form "file=@'+fileName+'" '
+	command = "curl --insecure --request POST " + privateToken + fileCmd + URL
+	#print("Updload file command :", command)
+	output = subprocess.getoutput(command)
+	print("Upload file output :",output)
+	outputDico = json.loads('{' + output.split("{")[1])
+	outputFile = outputDico["full_path"]
+	outputUrl = outputDico["full_path"]
+	print("Upload file output file ",outputFile, ", url :",outputUrl)
+	return outputFile, outputUrl
+
+
+
+#{ "name": "hoge", "url": "https://google.com", "filepath": "/binaries/linux-amd64", "link_type":"other" }
+
+def getListArchiveLinks(projectIdOwn, listPackage, useComma, token):
+	'''
+	Create the list of link to the archive uploaded binary packages
+	Parameters:
+		projectIdOwn : id of the project to be used
+		listPackage : list of the binary packages to be uploaded and linked
+		useComma : True to add a comma in the first place, false otherwise
+		token : token to be used to create the release
+	Return:
+		string of the list of archive links corresponding to the given list of packages
+	'''
+	linksData = ""
+	for packageName in listPackage:
+		if useComma:
+			linksData += ", "
+		baseName = os.path.basename(packageName)
+		packageOsName = packageName.split('/')[-2]
+		nameData = "\"name\": \"" + packageOsName + " " + baseName+"\""
+		
+		uploadedFullPath, outputUrl = uploadFileCommand(projectIdOwn, packageName, token)
+		print("outputUrl =",outputUrl)
+		fullPathToFile = 'https://'+server+"/"+uploadedFullPath
+		#filePathData = '"filepath": "'+fullPathToFile+'"' 
+		linkType = '"link_type": "other" '
+		urlData = '"url": "'+fullPathToFile+'"'
+		
+		addDataLink = '{ '+nameData + ", " + urlData + ", " + linkType +'}'
+		print("addDataLink =",addDataLink)
+		linksData += addDataLink
+		useComma = True
+	
+	return linksData
+
+
+def createReleaseCurlCommand(projectIdOwn, projectName, projectTagName, basePackageDir, token):
+	'''
+	Create a release of the given project
+	Parameters:
+		projectIdOwn : id of the project on gitlab
+		projectName : name of the project
+		projectTagName : tag name of the project
+		basePackageDir : base directory wher eto find binary packages
+		token : token to be used to create the release
+	'''
+	postURL="--request POST https://"+server+apiProject+str(projectIdOwn)+"/releases"
+	header="--header 'Content-Type: application/json' "
+	privateToken='--header "PRIVATE-TOKEN: '+token+'" '
+	versionName="version " + projectTagName
+	dataStr = "--data '{ \"name\": \"Release "+versionName+"\"," + "\"tag_name\": \""+projectTagName+"\","
+	dataStr += "\"description\": \"Automatic release, "+versionName+"\""
+	
+	useComma = False
+	linksData = ", \"assets\": { \"links\": ["
+	listArchiveFile = getListArchiveFile(basePackageDir + "/", projectName)
+	linksData += getListArchiveLinks(projectIdOwn, listArchiveFile, useComma, token)
+	linksData += "] } "
+	dataStr += linksData
+	dataStr += "}' "
+	command = "curl --insecure " + header + privateToken + dataStr + postURL
+	print("Create Release command :",command)
+	output = subprocess.getoutput(command)
+	print("Release Output :",output)
+
+
+if __name__ == "__main__":
+	parser = argparse.ArgumentParser(description="Program which creates release with given tag")
+	parser.add_argument('-n', '--projectname', help="Name of the current projet", required=True, type=str)
+	parser.add_argument('-i', '--projectid', help="Id of the current projet", required=True, type=int)
+	parser.add_argument('-t', '--tag', help="Tag to be used to create the current release", required=True, type=str)
+	parser.add_argument('-p', '--token', help="Token to be used to create the release", required=True, type=str)
+	parser.add_argument('-d', '--packagedirectory', help="Directory where to find packages", required=False, type=str, default="./")
+	args = parser.parse_args()
+	
+	createReleaseCurlCommand(args.projectid, args.projectname, args.tag, args.packagedirectory, args.token)
+
+
+
+
diff --git a/cmake/phoenix_createPackages.sh b/cmake/phoenix_createPackages.sh
new file mode 100755
index 0000000..6fa3a1a
--- /dev/null
+++ b/cmake/phoenix_createPackages.sh
@@ -0,0 +1,110 @@
+#!/bin/bash
+
+PACKAGE_TYPE="$1"
+OUTPUT_LINUX_DIR="$2"
+USE_VECTORISATION="$3"
+
+DIR_SOFT_NAME=`basename ${PWD}`
+
+rm -fr ${OUTPUT_LINUX_DIR}
+mkdir -p ${OUTPUT_LINUX_DIR}
+
+function createBinaryArchive(){
+	EXTENTION="$1"
+	echo "Create binary archive for extension '${EXTENTION}'"
+	
+	if [ ! -z "$1" ]
+	then
+		cd ..
+		mv $DIR_SOFT_NAME $DIR_SOFT_NAME-${EXTENTION}
+		cd $DIR_SOFT_NAME-${EXTENTION}
+	fi
+	
+	if [ -d build ]
+	then
+		echo "Remove existing directory build"
+		rm -fr build
+	fi
+	
+	mkdir -p build
+	cd build
+	
+	if [ -z "$1" ]
+	then
+		cmake .. -DSELF_TESTS_MODE=no -DCMAKE_INSTALL_PREFIX=/usr || cmake3 .. -DSELF_TESTS_MODE=no -DCMAKE_INSTALL_PREFIX=/usr
+	else
+		cmake .. -D${EXTENTION}=yes -DPROGRAM_EXTENSION=${EXTENTION} -DSELF_TESTS_MODE=no -DCMAKE_INSTALL_PREFIX=/usr || cmake3 .. -D${EXTENTION}=yes -DPROGRAM_EXTENSION=${EXTENTION} -DSELF_TESTS_MODE=no -DCMAKE_INSTALL_PREFIX=/usr
+	fi
+# 	make -j `nproc`
+	make
+	cpack
+	cd ..
+	if [ ! -z "$1" ]
+	then
+		cd ..
+		mv $DIR_SOFT_NAME-${EXTENTION} $DIR_SOFT_NAME
+		cd $DIR_SOFT_NAME
+	fi
+}
+
+function createPackage(){
+	PACKAGE_TYPE="$1"
+	EXTENTION="$2"
+	echo "Create Package '${PACKAGE_TYPE}' for extension '${EXTENTION}'"
+	
+	if [ ! -z "$1" ]
+	then
+		cd ..
+		mv $DIR_SOFT_NAME $DIR_SOFT_NAME-${EXTENTION}
+		cd $DIR_SOFT_NAME-${EXTENTION}
+	fi
+	
+	if [ -d build ]
+	then
+		echo "Remove existing directory build"
+		rm -fr build
+	fi
+	mkdir -p build
+	cd build
+# 	The  -DCMAKE_INSTALL_PREFIX=/usr is needed because the install prefix of CPack is /usr
+	if [ -z "$2" ]
+	then
+		cmake .. -DCREATE_${PACKAGE_TYPE}=yes -DSELF_TESTS_MODE=no -DCMAKE_INSTALL_PREFIX=/usr || cmake3 .. -DCREATE_${PACKAGE_TYPE}=yes -DSELF_TESTS_MODE=no -DCMAKE_INSTALL_PREFIX=/usr
+	else
+		cmake .. -D${EXTENTION}=yes -DPROGRAM_EXTENSION=${EXTENTION} -DCREATE_${PACKAGE_TYPE}=yes -DSELF_TESTS_MODE=no -DCMAKE_INSTALL_PREFIX=/usr || cmake3 .. -D${EXTENTION}=yes -DPROGRAM_EXTENSION=${EXTENTION} -DCREATE_${PACKAGE_TYPE}=yes -DSELF_TESTS_MODE=no -DCMAKE_INSTALL_PREFIX=/usr
+	fi
+# 	make -j `nproc`
+	make
+	cpack
+	cd ..
+	if [ ! -z "$1" ]
+	then
+		cd ..
+		mv $DIR_SOFT_NAME-${EXTENTION} $DIR_SOFT_NAME
+		cd $DIR_SOFT_NAME
+	fi
+}
+
+echo "Create package, activate extension '${USE_VECTORISATION}'"
+if [[ "$USE_VECTORISATION" == "true"* ]]
+then
+	echo "Create packages for set of extension (AVX, AVX2, AVX512F, ...)"
+	for extension in "AVX512_2" "AVX512VPOPCNTDQ" "AVX512BW" "AVX512PF" "AVX512ER" "AVX512F" "AVX2" "AVX" "SSE4.2" "SSE4.1" "SSSE3" "SSE2" "NOVECTORIZATION"
+	do
+		createPackage ${PACKAGE_TYPE} ${extension}
+		cp build/${DIR_SOFT_NAME}-* "${OUTPUT_LINUX_DIR}"
+		createBinaryArchive ${extension}
+		cp build/${DIR_SOFT_NAME}-* "${OUTPUT_LINUX_DIR}"
+	done
+else
+	echo "Create packages for generic extension"
+	createPackage ${PACKAGE_TYPE}
+	cp build/${DIR_SOFT_NAME}-* "${OUTPUT_LINUX_DIR}"
+	createBinaryArchive
+	cp build/${DIR_SOFT_NAME}-* "${OUTPUT_LINUX_DIR}"
+fi
+
+
+
+
+
-- 
GitLab


From 065592f559ef2bb2d3ae62d3685e2b1b755542f8 Mon Sep 17 00:00:00 2001
From: Pierre Aubert <pierre.aubert.lapp@gmail.com>
Date: Sat, 27 Aug 2022 11:09:08 +0200
Subject: [PATCH 12/18] Fix split names

---
 src/tools/PSRC_SPLIT_LIB/psrc_split_lib.cpp | 33 +++++++++++++++------
 src/tools/PSRC_SPLIT_LIB/psrc_split_lib.h   |  2 ++
 src/tools/PSRC_SPLIT_PTEX_DIR/main.cpp      | 21 ++++++-------
 3 files changed, 37 insertions(+), 19 deletions(-)

diff --git a/src/tools/PSRC_SPLIT_LIB/psrc_split_lib.cpp b/src/tools/PSRC_SPLIT_LIB/psrc_split_lib.cpp
index c97449b..c75eb53 100644
--- a/src/tools/PSRC_SPLIT_LIB/psrc_split_lib.cpp
+++ b/src/tools/PSRC_SPLIT_LIB/psrc_split_lib.cpp
@@ -149,6 +149,20 @@ bool createPTexFile(const std::string & outputFile, const std::string & inputFil
 	return true;
 }
 
+///Get the output file name
+/**	@param outputFile : name of the output file
+ * 	@param isPlatexMode : true if we want to create ptex output files
+ * 	@return output file name
+*/
+std::string getSplitOutputFileName(const std::string & outputFile, bool isPlatexMode){
+	std::string nameOutputFile(outputFile);
+	std::string ext(getExtention(outputFile));
+	if(isPlatexMode && ext != "ptex"){
+		nameOutputFile += ".ptex";
+	}
+	return nameOutputFile;
+}
+
 ///Process the input file
 /**	@param outputFile : file to be written
  * 	@param inputFile : file to be red
@@ -165,28 +179,29 @@ bool processFile(const std::string & outputFile, const std::string & inputFile,
 		std::cerr << "processFile : missing input or output file" << std::endl;
 		return false;
 	}
+	std::string nameOutputFile(getSplitOutputFileName(outputFile, isPlatexMode));
 	std::string ext(getExtention(inputFile));
 	std::string baseFileName(eraseExtension(getFileName(inputFile)));
 	if(ext == "c" || ext == "cpp" || ext == "c++" || ext == "h" || ext == "hpp"){
-		return createPTexFile(outputFile, inputFile, keepComment, keepTex, removefirstcomment, isPlatexMode, "cpp", "/*", "*/", "//");
+		return createPTexFile(nameOutputFile, inputFile, keepComment, keepTex, removefirstcomment, isPlatexMode, "cpp", "/*", "*/", "//");
 	}else if(ext == "cu"){
-		return createPTexFile(outputFile, inputFile, keepComment, keepTex, removefirstcomment, isPlatexMode, "cuda", "/*", "*/", "//");
+		return createPTexFile(nameOutputFile, inputFile, keepComment, keepTex, removefirstcomment, isPlatexMode, "cuda", "/*", "*/", "//");
 	}else if(ext == "cmake" || baseFileName == "CMakeLists"){
 		return createPTexFile(outputFile, inputFile, keepComment, keepTex, removefirstcomment, isPlatexMode, "cmake", "#[[", "]]", "#");
 	}else if(ext == "py"){
-		return createPTexFile(outputFile, inputFile, keepComment, keepTex, removefirstcomment, isPlatexMode, "python", "'''", "'''", "#");
+		return createPTexFile(nameOutputFile, inputFile, keepComment, keepTex, removefirstcomment, isPlatexMode, "python", "'''", "'''", "#");
 	}else if(ext == "sh"){
-		return createPTexFile(outputFile, inputFile, keepComment, keepTex, removefirstcomment, isPlatexMode, "bash", ": '", "'", "#");
+		return createPTexFile(nameOutputFile, inputFile, keepComment, keepTex, removefirstcomment, isPlatexMode, "bash", ": '", "'", "#");
 	}else if(baseFileName == "Dockerfile"){
-		return createPTexFile(outputFile, inputFile, keepComment, keepTex, removefirstcomment, isPlatexMode, "dockerfile", "", "", "#");
+		return createPTexFile(nameOutputFile, inputFile, keepComment, keepTex, removefirstcomment, isPlatexMode, "dockerfile", "", "", "#");
 	}else if(ext == "yml"){
-		return createPTexFile(outputFile, inputFile, keepComment, keepTex, removefirstcomment, isPlatexMode, "yml", "", "", "#");
+		return createPTexFile(nameOutputFile, inputFile, keepComment, keepTex, removefirstcomment, isPlatexMode, "yml", "", "", "#");
 	}else if(ext == "md"){
-		return createPTexFile(outputFile, inputFile, keepComment, keepTex, removefirstcomment, isPlatexMode, "markdown", "<!--", "-->", "");
+		return createPTexFile(nameOutputFile, inputFile, keepComment, keepTex, removefirstcomment, isPlatexMode, "markdown", "<!--", "-->", "");
 	}else{
-		std::cout << "Copy file '"<<inputFile<<"' into '"<<outputFile<<"'" << std::endl;
+		std::cout << "Copy file '"<<inputFile<<"' into '"<<nameOutputFile<<"'" << std::endl;
 		std::ifstream ifs(inputFile.c_str());
-		std::ofstream fs(outputFile.c_str());
+		std::ofstream fs(nameOutputFile.c_str());
 		fs << ifs.rdbuf();
 		fs.close();
 		return true;
diff --git a/src/tools/PSRC_SPLIT_LIB/psrc_split_lib.h b/src/tools/PSRC_SPLIT_LIB/psrc_split_lib.h
index 7db281a..91f9046 100644
--- a/src/tools/PSRC_SPLIT_LIB/psrc_split_lib.h
+++ b/src/tools/PSRC_SPLIT_LIB/psrc_split_lib.h
@@ -19,6 +19,8 @@ namespace PTypeCode{
 	};
 }
 
+std::string getSplitOutputFileName(const std::string & outputFile, bool isPlatexMode);
+
 bool processFile(const std::string & outputFile, const std::string & inputFile,
 		bool keepComment, bool keepTex, bool removefirstcomment, bool isPlatexMode);
 
diff --git a/src/tools/PSRC_SPLIT_PTEX_DIR/main.cpp b/src/tools/PSRC_SPLIT_PTEX_DIR/main.cpp
index cbdfeaa..88d45db 100644
--- a/src/tools/PSRC_SPLIT_PTEX_DIR/main.cpp
+++ b/src/tools/PSRC_SPLIT_PTEX_DIR/main.cpp
@@ -83,23 +83,24 @@ bool processFileOrDir(const std::string & outputDir, const std::string & inputFi
 		phoenix_print(listFileInDir);
 		return createDirectoryWithFiles(outputDir, inputFile, listFileInDir, keepComment, keepTex, removefirstcomment, isPlatexMode);
 	}
-	std::cout << "processFileOrDir : create file " << fileName << std::endl;
-	std::string outputFile(outputDir + "/" + getFileName(inputFile));
+	std::cout << "processFileOrDir : create file '" << fileName << "'" << std::endl;
+	std::string outputFile(getSplitOutputFileName(outputDir + "/" + getFileName(inputFile), isPlatexMode));
 	//Get the permissions on the input file
 	
 	int fullMode(0);
 	bool hasMode(true);
-	struct stat fileStat;
-	if(stat(inputFile.c_str(), &fileStat) < 0){
-		hasMode = false;
-		std::cerr << "processFileOrDir : can't get permission of file '"<<inputFile<<"'" << std::endl;
-	}else{
-		fullMode = fileStat.st_mode;
+	if(!isPlatexMode){
+		struct stat fileStat;
+		if(stat(inputFile.c_str(), &fileStat) < 0){
+			hasMode = false;
+			std::cerr << "processFileOrDir : can't get permission of file '"<<inputFile<<"'" << std::endl;
+		}else{
+			fullMode = fileStat.st_mode;
+		}
 	}
-	
 	bool  b(processFile(outputFile, inputFile, keepComment, keepTex, removefirstcomment, isPlatexMode));
 	//Modify the permissions on the output file
-	if(hasMode){
+	if(hasMode && !isPlatexMode){
 		if(chmod(outputFile.c_str(), fullMode) < 0){
 			std::cerr << "processFileOrDir : Cannot set mode of file '"<<outputFile<<"'" << std::endl;
 		}
-- 
GitLab


From ec68a2fe2da1e36191fc9acb83044d2480b2c475 Mon Sep 17 00:00:00 2001
From: Pierre Aubert <pierre.aubert.lapp@gmail.com>
Date: Sat, 27 Aug 2022 11:11:32 +0200
Subject: [PATCH 13/18] Add test for sub directory, OK

---
 .../TestFiles/docker/CMakeLists.txt           | 11 +++++
 .../TestFiles/docker/Dockerfile               | 41 +++++++++++++++++++
 2 files changed, 52 insertions(+)
 create mode 100644 TESTS/TEST_SLIT_PTEX/TestFiles/docker/CMakeLists.txt
 create mode 100644 TESTS/TEST_SLIT_PTEX/TestFiles/docker/Dockerfile

diff --git a/TESTS/TEST_SLIT_PTEX/TestFiles/docker/CMakeLists.txt b/TESTS/TEST_SLIT_PTEX/TestFiles/docker/CMakeLists.txt
new file mode 100644
index 0000000..db259c9
--- /dev/null
+++ b/TESTS/TEST_SLIT_PTEX/TestFiles/docker/CMakeLists.txt
@@ -0,0 +1,11 @@
+#{On récupère toutes les sources du dossier :
+file(GLOB mainSource "${CMAKE_CURRENT_SOURCE_DIR}/*.cpp")
+#{On créé notre bibliothèque de calcul naïve :
+add_library(gray_scott_naive SHARED ${mainSource})
+#{On utilise encore un petit subterfuge pour changer le flag d'optimisation pour qu'il ne soit pas global afin de ne pas fausser les tests de performances :
+set_property(TARGET gray_scott_naive PROPERTY COMPILE_FLAGS "-O3")
+#{Enfin, on lie notre bibliothèque à d'éventuelles dépendences :
+target_link_libraries(gray_scott_naive TBB::tbb)
+
+
+
diff --git a/TESTS/TEST_SLIT_PTEX/TestFiles/docker/Dockerfile b/TESTS/TEST_SLIT_PTEX/TestFiles/docker/Dockerfile
new file mode 100644
index 0000000..4d1e2b8
--- /dev/null
+++ b/TESTS/TEST_SLIT_PTEX/TestFiles/docker/Dockerfile
@@ -0,0 +1,41 @@
+#{Tout d'abord, nous devons dire à \prog{docker} quel image nous voulons prendre comme base pour construire la notre. Si rien n'est précisé, l'image sera prise sur \href{https://www.dockerhub.com/}{docker hub} :
+
+# Version 0.1
+FROM ubuntu:20.04
+
+#{Il est possible de demander la dernière image disponible avec \b{ubuntu:latest}, mais il est préférable de la spécifier pour garantir que les différentes installations fonctionneront dans le futur.
+
+#{Ensuite, on dit à \prog{docker} que l'on veut un terminal \prog{bash} :
+# Ensure use of bash
+SHELL ["/bin/bash","-c"]
+
+#{Les images \b{Ubuntu} qui proviennent de \href{https://www.dockerhub.com/}{docker hub} sont quelques peu capricieuses depuis la version \b{20.04} car il faut leur spécifier l'heure et la zone temporelle :
+# Time Zone
+ENV TZ=Europe/Paris
+RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
+
+RUN touch /etc/apt/apt.conf.d/99verify-peer.conf \
+&& echo >>/etc/apt/apt.conf.d/99verify-peer.conf "Acquire { https::Verify-Peer false }"
+
+#{Une autre petite spécification des images \b{Ubuntu} de \href{https://www.dockerhub.com/}{docker hub} est que l'on doit informer le gestionnaire de configuration \prog{debconf} que l'on n'aura aucune intéraction pendant l'installation de notre image (donc pas de \b{yes} ou \b{no} à entrer)
+# Apt and debconf configuration
+RUN echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections
+ARG DEBIAN_FRONTEND=noninteractive
+#{La dernière spécificité des images \b{Ubuntu} de \href{https://www.dockerhub.com/}{docker hub} est que l'on doit mettre à jour la liste de paquets avant d'installer le moindre programme :
+# Update
+RUN apt-get -y update
+#{Maintenant, nous pouvons commencer à installer nos programmes. Et nous devons commencer par \prog{apt-utils} :
+# Anstallation
+RUN apt-get install -y apt-utils
+#{Ensuite, \prog{wget} qui permet de télécharger des fichiers\footnote{Le téléchargement de fichiers quelconques (données, configuration, test, etc) est très utile pour alléger le projet \prog{git}} :
+RUN apt-get install -y wget
+#{Installons nos outils de compilation, \prog{gcc} et \prog{g++} pour le C et le C++, \prog{cmake} pour gérer le projet, \prog{make} pour gérer la compilation et \prog{git} pour gérer les versions de projet (pas forcément le notre) :
+RUN apt-get install -y gcc g++ cmake make git
+#{Pour générer la documentation, nous utiliserons \prog{doxygen} et \prog{graphviz} pour construire des graphes :
+RUN apt-get install -y doxygen graphviz
+#{L'évaluation de la couverture des tests sera effectuer par \prog{gcovr}\footnote{D'où l'importante d'utiliser \prog{gcc} et \prog{g++}.} :
+# Gcov goes with gcc
+RUN apt-get install -y gcovr
+#{La dernière chose que nous devons faire est de nettoyer l'image des fichiers temporaires utilisés par l'\prog{apt-get}\footnote{Ce sont généralement les archives téléchargé des programme que l'on installe.} (il est important de le faire quelque soit l'OS utilisé afin d'obtenir une image plus petite) :
+RUN apt-get -y clean autoremove
+
-- 
GitLab


From 7d04cb704fdc408d4bb94f9733168a26d69ccd05 Mon Sep 17 00:00:00 2001
From: Pierre Aubert <pierre.aubert.lapp@gmail.com>
Date: Sat, 27 Aug 2022 11:43:28 +0200
Subject: [PATCH 14/18] Add create[Source/PTex]Dir cmake functions to handle
 full directory split

---
 phoenix_tex2html_extra.cmake | 97 ++++++++++++++++++++++++++----------
 1 file changed, 71 insertions(+), 26 deletions(-)

diff --git a/phoenix_tex2html_extra.cmake b/phoenix_tex2html_extra.cmake
index aeee95d..7300a3e 100644
--- a/phoenix_tex2html_extra.cmake
+++ b/phoenix_tex2html_extra.cmake
@@ -114,40 +114,85 @@ function(createSourcePTex targetName inputFile outputFile)
 endfunction(createSourcePTex)
 
 
-
-# Create a source for all a directory
+# Call the psrcsplitptex program
 # 	targetName : name of the target to be generated
-# 	inputDirectory : input file to be processed
-# 	the output directory will be the CMAKE_CURRENT_BINARY_DIR
-function(createSourceDir targetName inputDirectory)
-	get_filename_component(baseOutputDir ${inputDirectory} NAME)
+# 	inputDir : input file to be processed
+# 	programOption : options passed to the program
+# 	outputDir : file to be generated
+function(phoenix_callsrcsplitptexdir targetName inputDir programOption outputDir)
+	set(CALL_COMMAND ${PHOENIXTEX2HTML_PHOENIX_SRCSPLITTEXDIR_EXECUTABLE} ${programOption} -i ${inputDir} -o ${outputDir})
+	string(REPLACE ";" " " REAL_COMMAND "${CALL_COMMAND}")
+	file(GLOB_RECURSE listDependencies "${inputDir}/*")
+	file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${outputDir})
 	add_custom_command(
-		OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${baseOutputDir}
-		COMMAND ${PHOENIXTEX2HTML_PHOENIX_SRCSPLITTEXDIR_EXECUTABLE} -k -i ${inputDirectory} -o ${CMAKE_CURRENT_BINARY_DIR} > "${CMAKE_CURRENT_BINARY_DIR}/${baseOutputDir}.log"
-		COMMENT "Create sources with directory ${inputDirectory}"
-		DEPENDS ${inputDirectory}
-		WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
+		OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${outputDir}
+		COMMAND bash -c ${REAL_COMMAND}
+		COMMENT "Call phoenix_srcsplittexdir ${programOption} -i ${inputDir} -o ${outputDir}"
+		DEPENDS ${listDependencies}
+		WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${outputDir}
 	)
-	add_custom_target("${targetName}" ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${baseOutputDir})
-endfunction(createSourceDir)
+	add_custom_target("${targetName}" ALL DEPENDS ${outputDir})
+endfunction(phoenix_callsrcsplitptexdir)
 
-# Create a ptex for all a directory
+# Create a ptex file with a input source
 # 	targetName : name of the target to be generated
-# 	inputDirectory : input file to be processed
-# 	the output directory will be the CMAKE_CURRENT_BINARY_DIR
-function(createPTexDir targetName inputDirectory)
-	get_filename_component(baseOutputDir ${inputDirectory} NAME)
-	add_custom_command(
-		OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${baseOutputDir}
-		COMMAND ${PHOENIXTEX2HTML_PHOENIX_SRCSPLITTEXDIR_EXECUTABLE} -f -p -t -k -i ${inputDirectory} -o ${CMAKE_CURRENT_BINARY_DIR} > "${CMAKE_CURRENT_BINARY_DIR}/${baseOutputDir}.log"
-		COMMENT "Create ptex with directory ${inputDirectory}"
-		DEPENDS ${inputDirectory}
-		WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
-	)
-	add_custom_target("${targetName}" ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${baseOutputDir})
+# 	inputDir : input file to be processed
+# 	outputDir : output directory where files are generated
+function(createPTexDir targetName inputDir outputDir)
+	phoenix_callsrcsplitptexdir(${targetName} ${inputDir} "-f -p -t -k" ${outputDir})
 endfunction(createPTexDir)
 
 
+# Create a source file with a input source (remove ptex comment)
+# 	targetName : name of the target to be generated
+# 	inputDir : input file to be processed
+# 	outputDir : file to be generated
+function(createSourceDir targetName inputDir outputDir)
+	phoenix_callsrcsplitptexdir(${targetName} ${inputDir} "-k" ${outputDir})
+endfunction(createSourceDir)
+
+# Create a ptex file with a input source
+# 	targetName : name of the target to be generated
+# 	inputDir : input file to be processed
+# 	outputDir : output directory where files are generated
+function(createSourcePTexDir targetName inputDir outputDir)
+	createPTexDir(${targetName}_ptex ${inputDir} ${outputDir})
+	createSourceDir(${targetName}_src ${inputDir} ${outputDir})
+endfunction(createSourcePTexDir)
+
+## Create a source for all a directory
+## 	targetName : name of the target to be generated
+## 	inputDirectory : input file to be processed
+## 	the output directory will be the CMAKE_CURRENT_BINARY_DIR
+#function(createSourceDir targetName inputDirectory)
+	#get_filename_component(baseOutputDir ${inputDirectory} NAME)
+	#add_custom_command(
+		#OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${baseOutputDir}
+		#COMMAND ${PHOENIXTEX2HTML_PHOENIX_SRCSPLITTEXDIR_EXECUTABLE} -k -i ${inputDirectory} -o ${CMAKE_CURRENT_BINARY_DIR} > "${CMAKE_CURRENT_BINARY_DIR}/${baseOutputDir}.log"
+		#COMMENT "Create sources with directory ${inputDirectory}"
+		#DEPENDS ${inputDirectory}
+		#WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
+	#)
+	#add_custom_target("${targetName}" ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${baseOutputDir})
+#endfunction(createSourceDir)
+
+## Create a ptex for all a directory
+## 	targetName : name of the target to be generated
+## 	inputDirectory : input file to be processed
+## 	the output directory will be the CMAKE_CURRENT_BINARY_DIR
+#function(createPTexDir targetName inputDirectory)
+	#get_filename_component(baseOutputDir ${inputDirectory} NAME)
+	#add_custom_command(
+		#OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${baseOutputDir}
+		#COMMAND ${PHOENIXTEX2HTML_PHOENIX_SRCSPLITTEXDIR_EXECUTABLE} -f -p -t -k -i ${inputDirectory} -o ${CMAKE_CURRENT_BINARY_DIR} > "${CMAKE_CURRENT_BINARY_DIR}/${baseOutputDir}.log"
+		#COMMENT "Create ptex with directory ${inputDirectory}"
+		#DEPENDS ${inputDirectory}
+		#WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
+	#)
+	#add_custom_target("${targetName}" ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${baseOutputDir})
+#endfunction(createPTexDir)
+
+
 
 # Create a source and ptex files with a input directory
 # 	targetName : name of the target to be generated
-- 
GitLab


From 53abc71dc433bcf53e4daa91dbf90f630878f9f8 Mon Sep 17 00:00:00 2001
From: Pierre Aubert <pierre.aubert.lapp@gmail.com>
Date: Sun, 28 Aug 2022 10:17:48 +0200
Subject: [PATCH 15/18] createSourcePTexDir fully working

---
 phoenix_tex2html_extra.cmake | 25 ++++++++++++++++++++-----
 1 file changed, 20 insertions(+), 5 deletions(-)

diff --git a/phoenix_tex2html_extra.cmake b/phoenix_tex2html_extra.cmake
index 7300a3e..5f6f3e6 100644
--- a/phoenix_tex2html_extra.cmake
+++ b/phoenix_tex2html_extra.cmake
@@ -120,18 +120,18 @@ endfunction(createSourcePTex)
 # 	programOption : options passed to the program
 # 	outputDir : file to be generated
 function(phoenix_callsrcsplitptexdir targetName inputDir programOption outputDir)
-	set(CALL_COMMAND ${PHOENIXTEX2HTML_PHOENIX_SRCSPLITTEXDIR_EXECUTABLE} ${programOption} -i ${inputDir} -o ${outputDir})
+	set(CALL_COMMAND ${PHOENIXTEX2HTML_PHOENIX_SRCSPLITTEXDIR_EXECUTABLE} ${programOption} -i ${inputDir} -o ./)
 	string(REPLACE ";" " " REAL_COMMAND "${CALL_COMMAND}")
 	file(GLOB_RECURSE listDependencies "${inputDir}/*")
 	file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${outputDir})
 	add_custom_command(
-		OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${outputDir}
+		OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${outputDir}/README.md
 		COMMAND bash -c ${REAL_COMMAND}
 		COMMENT "Call phoenix_srcsplittexdir ${programOption} -i ${inputDir} -o ${outputDir}"
 		DEPENDS ${listDependencies}
 		WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${outputDir}
 	)
-	add_custom_target("${targetName}" ALL DEPENDS ${outputDir})
+	add_custom_target("${targetName}" ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${outputDir}/README.md)
 endfunction(phoenix_callsrcsplitptexdir)
 
 # Create a ptex file with a input source
@@ -156,8 +156,23 @@ endfunction(createSourceDir)
 # 	inputDir : input file to be processed
 # 	outputDir : output directory where files are generated
 function(createSourcePTexDir targetName inputDir outputDir)
-	createPTexDir(${targetName}_ptex ${inputDir} ${outputDir})
-	createSourceDir(${targetName}_src ${inputDir} ${outputDir})
+	createPTexDir("${targetName}_ptex" ${inputDir} ${outputDir}PTex)
+	createSourceDir("${targetName}_src" ${inputDir} ./)
+	get_filename_component(baseOutputDir ${inputDir} NAME)
+	set(COMPRESSED_DIR ${baseOutputDir}.tar.gz)
+	add_custom_command(
+		OUTPUT ${COMPRESSED_DIR}
+		COMMAND tar -zcf ${COMPRESSED_DIR} ${baseOutputDir} > ${CMAKE_CURRENT_BINARY_DIR}/${baseOutputDir}_compress.log
+		COMMENT "Compress directory ${baseOutputDir}"
+		DEPENDS ${inputDir}
+		WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
+	)
+	add_custom_target("${targetName}_tar_gz" ALL DEPENDS ${COMPRESSED_DIR})
+	
+	add_dependencies("${targetName}_tar_gz" "${targetName}_src" "${targetName}_ptex")
+	
+	add_custom_target(${targetName})
+	add_dependencies(${targetName} "${targetName}_tar_gz")
 endfunction(createSourcePTexDir)
 
 ## Create a source for all a directory
-- 
GitLab


From 78c29df1eabe4fa6262e8c2ccf3e6f8d10a02119 Mon Sep 17 00:00:00 2001
From: Pierre Aubert <pierre.aubert.lapp@gmail.com>
Date: Sun, 28 Aug 2022 10:18:19 +0200
Subject: [PATCH 16/18] Remove useless comments

---
 phoenix_tex2html_extra.cmake | 33 ---------------------------------
 1 file changed, 33 deletions(-)

diff --git a/phoenix_tex2html_extra.cmake b/phoenix_tex2html_extra.cmake
index 5f6f3e6..5e1a993 100644
--- a/phoenix_tex2html_extra.cmake
+++ b/phoenix_tex2html_extra.cmake
@@ -175,39 +175,6 @@ function(createSourcePTexDir targetName inputDir outputDir)
 	add_dependencies(${targetName} "${targetName}_tar_gz")
 endfunction(createSourcePTexDir)
 
-## Create a source for all a directory
-## 	targetName : name of the target to be generated
-## 	inputDirectory : input file to be processed
-## 	the output directory will be the CMAKE_CURRENT_BINARY_DIR
-#function(createSourceDir targetName inputDirectory)
-	#get_filename_component(baseOutputDir ${inputDirectory} NAME)
-	#add_custom_command(
-		#OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${baseOutputDir}
-		#COMMAND ${PHOENIXTEX2HTML_PHOENIX_SRCSPLITTEXDIR_EXECUTABLE} -k -i ${inputDirectory} -o ${CMAKE_CURRENT_BINARY_DIR} > "${CMAKE_CURRENT_BINARY_DIR}/${baseOutputDir}.log"
-		#COMMENT "Create sources with directory ${inputDirectory}"
-		#DEPENDS ${inputDirectory}
-		#WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
-	#)
-	#add_custom_target("${targetName}" ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${baseOutputDir})
-#endfunction(createSourceDir)
-
-## Create a ptex for all a directory
-## 	targetName : name of the target to be generated
-## 	inputDirectory : input file to be processed
-## 	the output directory will be the CMAKE_CURRENT_BINARY_DIR
-#function(createPTexDir targetName inputDirectory)
-	#get_filename_component(baseOutputDir ${inputDirectory} NAME)
-	#add_custom_command(
-		#OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${baseOutputDir}
-		#COMMAND ${PHOENIXTEX2HTML_PHOENIX_SRCSPLITTEXDIR_EXECUTABLE} -f -p -t -k -i ${inputDirectory} -o ${CMAKE_CURRENT_BINARY_DIR} > "${CMAKE_CURRENT_BINARY_DIR}/${baseOutputDir}.log"
-		#COMMENT "Create ptex with directory ${inputDirectory}"
-		#DEPENDS ${inputDirectory}
-		#WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
-	#)
-	#add_custom_target("${targetName}" ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${baseOutputDir})
-#endfunction(createPTexDir)
-
-
 
 # Create a source and ptex files with a input directory
 # 	targetName : name of the target to be generated
-- 
GitLab


From edb6685819c9976a9a2cc7a8a599546a54dc1c8e Mon Sep 17 00:00:00 2001
From: Pierre Aubert <pierre.aubert.lapp@gmail.com>
Date: Sun, 28 Aug 2022 12:03:02 +0200
Subject: [PATCH 17/18] Fix newline in splitter

---
 src/tools/PSRC_SPLIT_LIB/psrc_split_lib.cpp | 18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)

diff --git a/src/tools/PSRC_SPLIT_LIB/psrc_split_lib.cpp b/src/tools/PSRC_SPLIT_LIB/psrc_split_lib.cpp
index c75eb53..fe3a234 100644
--- a/src/tools/PSRC_SPLIT_LIB/psrc_split_lib.cpp
+++ b/src/tools/PSRC_SPLIT_LIB/psrc_split_lib.cpp
@@ -16,12 +16,20 @@
 */
 void flushCode(std::ofstream & fs, PTypeCode::PTypeCode typeCode, std::string & code, bool isPlatexMode, const std::string & envName, bool keepTex){
 	if(typeCode == PTypeCode::CODE){
-		code = eraseFirstLastChars(code, "\n");
+		if(isPlatexMode){
+			code = eraseFirstLastChars(code, "\t \n");
+		}else{
+			code = eraseFirstCharsInStr(code, "\t \n");
+		}
 		if(code != ""){
-			if(isPlatexMode){fs << "\\begin{" << envName << "}" << std::endl;}
-			fs << code << std::endl;
-			if(isPlatexMode){fs << "\\end{" << envName << "}" << std::endl;}
-			if(!isPlatexMode && !keepTex){fs << std::endl;}
+			if(isPlatexMode){
+				fs << "\\begin{" << envName << "}" << std::endl;
+				fs << code << std::endl;
+				fs << "\\end{" << envName << "}" << std::endl << std::endl;
+			}else{
+				fs << code /*<< std::endl*/;
+			}
+// 			if(!isPlatexMode && !keepTex){fs << std::endl;}
 		}
 		code = "";
 	}
-- 
GitLab


From a9d1833e939c413e42da23beae32cd9683384a0f Mon Sep 17 00:00:00 2001
From: Pierre Aubert <pierre.aubert.lapp@gmail.com>
Date: Sun, 28 Aug 2022 12:03:52 +0200
Subject: [PATCH 18/18] Remove useless comment

---
 src/tools/PSRC_SPLIT_LIB/psrc_split_lib.cpp | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/src/tools/PSRC_SPLIT_LIB/psrc_split_lib.cpp b/src/tools/PSRC_SPLIT_LIB/psrc_split_lib.cpp
index fe3a234..0c47245 100644
--- a/src/tools/PSRC_SPLIT_LIB/psrc_split_lib.cpp
+++ b/src/tools/PSRC_SPLIT_LIB/psrc_split_lib.cpp
@@ -27,9 +27,8 @@ void flushCode(std::ofstream & fs, PTypeCode::PTypeCode typeCode, std::string &
 				fs << code << std::endl;
 				fs << "\\end{" << envName << "}" << std::endl << std::endl;
 			}else{
-				fs << code /*<< std::endl*/;
+				fs << code;
 			}
-// 			if(!isPlatexMode && !keepTex){fs << std::endl;}
 		}
 		code = "";
 	}
-- 
GitLab