PhoenixLecture  2.0.0
Set of tools to make lectures
PMarkdownParser Class Reference

Class which parses Markdown as into for web site generator. More...

#include <PMarkdownParser.h>

+ Inheritance diagram for PMarkdownParser:
+ Collaboration diagram for PMarkdownParser:

Public Member Functions

void addCommentConfig (const PMultiCommentConfig &commentConfig)
 Adds a comment config for the parser. More...
 
void addCommentConfig (const PString &beginStringComment, const PString &endStringComment="\n")
 Adds a comment config for the parser. More...
 
bool checkExpectedMatch (const PString &tokenExpected, const PString &tokenBefore="")
 Check if the tokenExpected match. More...
 
bool checkExpectedToken (const PString &tokenExpected, const PString &tokenBefore="")
 Check if the p_currentToken == tokenExpected. More...
 
void clearComment ()
 Clear comment. More...
 
void errorAt ()
 Write a parsing error. More...
 
bool fullParsing ()
 Perform the full parsing pf data. More...
 
bool getBookEnableFeedback () const
 Say if the book feedback if enable or not. More...
 
const PStringgetBookGitlabUrl () const
 Get the book gitlab url. More...
 
const PStringgetBookMail () const
 Get the book mail list. More...
 
const PLatexObjgetBookMainPageLink () const
 Get the book main page link. More...
 
const PStringgetBookMasterProjectUrl () const
 Get the book master project url. More...
 
const PStringgetBookSideBarWidth () const
 Get the width of the book sidebar. More...
 
PFileParsergetCurrentParser ()
 Gets the current parser. More...
 
void getCurrentTokenWithoutComment ()
 Get the current token and skip the comment. More...
 
PStringgetLastComment ()
 Get the last comment. More...
 
const PStringgetLastComment () const
 Get the last comment. More...
 
PMapBiblioEntrygetMapBiblioEntry ()
 Get the map of all bibliography entries. More...
 
const PMapBiblioEntrygetMapBiblioEntry () const
 Get the map of all bibliography entries. More...
 
PLatexObjgetSource ()
 Get the current source. More...
 
const PLatexObjgetSource () const
 Get the current source. More...
 
PString getStrComposedOf (const PString &charset)
 Get the string composed of charset charcters. More...
 
std::vector< PString > & getVecIncludeDir ()
 Get the vector of include directories. More...
 
const std::vector< PString > & getVecIncludeDir () const
 Get the vector of include directories. More...
 
bool isMatch (const PString &patern, const PString &forbiddenCharBefore)
 Says if the patern match with the current caracters of the PFileParser. More...
 
bool isMatch (const PString &token)
 Check if the given token matches the current read file. More...
 
PString isMatch (const PVecString &vecToken)
 Check if the one entry of the vector of token matches. More...
 
bool isMatchRewind (const PString &token)
 Check if the given token matches the current read file and goes back even if the token matches. More...
 
bool isMatchSeq (const PVecString &patern, bool alwaysPopBack=false)
 Match a sequence of token in a vector. More...
 
PString isMatchToken (const PVecString &vecToken)
 Check the matching between the current caracters and all the string in the vector but treats the string as a token (cannot be part of a word) More...
 
bool load (const PPath &configFile)
 Load the PMultiFileParser with the configFile. More...
 
PMarkdownParseroperator= (const PMarkdownParser &other)
 Definition of equal operator of PMarkdownParser. More...
 
 PMarkdownParser (const PGenericParser &other)
 Copy constructor of PMarkdownParser. More...
 
 PMarkdownParser (const PMarkdownParser &other)
 Copy constructor of PMarkdownParser. More...
 
 PMarkdownParser (const PString &installPrefix="")
 Default constructor of PMarkdownParser. More...
 
void pointAtRow ()
 Point the problem. More...
 
bool saveCss ()
 Save the css file. More...
 
void setDebugMode (bool isDebugMode)
 Set if the PGenericParser is in debug mode. More...
 
void setFileContent (const PString &fileContent)
 Set the file content to be parsed. More...
 
void skipComment ()
 Skip comment. More...
 
void stopParsing ()
 Stop the parsing of all the files. More...
 
void unexpectedToken ()
 Print unexpected token error. More...
 
virtual ~PMarkdownParser ()
 Destructor of PMarkdownParser. More...
 

Protected Member Functions

void addLatexObj (PLatexObj &parent, const PLatexObj &obj)
 Add latex obj in parent. More...
 
void clearLatexObj (PLatexObj &obj)
 Clear a latex obj. More...
 
PPath copyFile (const PPath &outputDir, const PPath &fileName)
 Copy a file. More...
 
void copyPGenericParser (const PGenericParser &other)
 Copy function of PGenericParser. More...
 
void copyPMarkdownParser (const PMarkdownParser &other)
 Copy function of PMarkdownParser. More...
 
PString executeLatexCommand (const PString &inputStr)
 Execute the given latex command. More...
 
PPath getAbsoluteFileName (const PPath &fileName)
 Get the absolute path of a file. More...
 
PString getOptionStringBetweenBraces ()
 Get optional string between braces {...}. More...
 
PString getOptionStringBetweenHook ()
 Get optional string between hooks [...]. More...
 
PString getStringBetweenBraces (const PString &previousToken)
 Get the string between the braces {...}. More...
 
void incrementCurrentChar (PLatexObj &textObj)
 Increment current char position. More...
 
void loadCss (const PPath &inputDir)
 Load the css. More...
 
void loadDirExtraEnvironement (const PPath &inputDir)
 Load the extra environements. More...
 
void loadDirExtraEnvironementFile (const PPath &inputFile)
 Load the extra environements with input file. More...
 
void loadDirExtraFunction (const PPath &inputDir)
 Load the extra functions. More...
 
void loadDirExtraFunctionFile (const PPath &inputFile)
 Load the extra functions with input file. More...
 
void loadDirExtraParser (const PPath &inputDir)
 Load the extra parsers. More...
 
void loadDirExtraParserFile (const PPath &inputFile)
 Load the extra environements with input file. More...
 
void loadMapFile ()
 Load the map of copied files. More...
 
bool parseBookEnableFeedback (PLatexObj &parent, PLatexObj &textObj)
 Parse the book enable feedback mode. More...
 
bool parseBookGitlabUrl (PLatexObj &parent, PLatexObj &textObj)
 Parse the gitlab url in book mode. More...
 
bool parseBookMail (PLatexObj &parent, PLatexObj &textObj)
 Parse the mail in book mode. More...
 
bool parseBookMasterProject (PLatexObj &parent, PLatexObj &textObj)
 Parse the master project in book mode. More...
 
bool parseBookSizeBarWidth (PLatexObj &parent, PLatexObj &textObj)
 Parse the width of the book sidebar. More...
 
virtual bool parseFile ()
 Parse the input file. More...
 
bool parseGenericLatexObj (PLatexObj &parent, PLatexObj &textObj)
 Parse the generic latex function which have to be used in the latex parser and the markdown parser too. More...
 
bool parseLabel (PLatexObj &parent, PLatexObj &textObj)
 Parse latex label. More...
 
bool parseMainAuthor (PLatexObj &parent, PLatexObj &textObj)
 Parse the main author of the site. More...
 
bool parseMainDate (PLatexObj &parent, PLatexObj &textObj)
 Parse the main date of the site. More...
 
bool parseMainSubTitle (PLatexObj &parent, PLatexObj &textObj)
 Parse the main title of the site. More...
 
bool parseMainTitle (PLatexObj &parent, PLatexObj &textObj)
 Parse the main title of the site. More...
 
bool parseMonoParam (PLatexObj &parent, PLatexObj &textObj, const PString &functionName, PLatexType::PLatexType type)
 Parse all the functions which have mono parameter in braces {...}. More...
 
bool parserGetEnv (PLatexObj &parent, PLatexObj &textObj)
 Parse a getenv function. More...
 
bool playTextLatexObj (PLatexObj &parent, PLatexObj &textObj, bool isRemoveFirstLastSpace=false)
 Play the text latex obj. More...
 
virtual void postLoadFile ()
 Initialisation to be done just after loading a file. More...
 
virtual void preLoadFile ()
 Initialisation to be done just before loading a file. More...
 
void saveMapFile ()
 Save the map of copied files. More...
 

Protected Attributes

PString p_bookGitlabUrl
 Gitlab url of the current sources of the project. More...
 
PString p_bookMail
 Mail to be used to contact authors in book mode. More...
 
PLatexObj p_bookMainPageLink
 Main page definition of the full site. More...
 
PString p_bookMasterProjectUrl
 Master project url in book mode. More...
 
PString p_bookSideBarWidth
 Witdh of the book side bar. More...
 
std::map< PString, PStringp_cssContent
 Css of all the configurations. More...
 
PLatexObj p_currentSource
 Current completed source. More...
 
PLatexObj p_currentText
 Current text. More...
 
PString p_currentToken
 CurrentToken parsed. More...
 
PPath p_inputDirectory
 Input directory of the parser. More...
 
bool p_isDebugMode
 True if be parse in debug mode. More...
 
bool p_isEnableBookFeedback
 True to enable feedback in book mode. More...
 
PString p_lastComment
 last comment More...
 
std::list< PFileParserp_listFileParser
 List of all the parsers for all the loaded files. More...
 
PMapBiblioEntry p_mapBiblioEntry
 Map of all bibliography entries. More...
 
PMapFile p_mapCopiedFile
 Map of copied files. More...
 
PPath p_outputDirectory
 Output directory of the parser. More...
 
PFileParserp_parser
 Parser helper for the config file. More...
 
bool p_run
 Run the parsing if true. More...
 
PVecLatexEnv p_vecEnv
 Vector of all the environements. More...
 
PMapExtraEnv p_vecExtraEnv
 Vector of extra environements. More...
 
PMapExtraEnv p_vecExtraFunction
 Vector of extra function. More...
 
PVecParserEnv p_vecExtraParser
 Vector of extra parser. More...
 
PVecLatexFunc p_vecFunc
 Vector of all the functions. More...
 
std::vector< PStringp_vecIncludeDir
 Vector of the include directories. More...
 
std::vector< PStringp_vecNameExtraEnv
 Vector of the name of the extra environement. More...
 
std::vector< PStringp_vecNameExtraFunction
 Vector of the name of the extra function. More...
 
std::vector< PStringp_vecNameExtraParser
 Vector of the name of the extra environement. More...
 
std::vector< PStringp_vecNameFunctionExtraEnv
 Vector of the name of the extra environement. More...
 
std::vector< PStringp_vecNameFunctionExtraParser
 Vector of the function name of the extra environement. More...
 
std::vector< PStringp_vecNameMarkdownExtraEnv
 Vector of the name of the extra environement (for markdown) More...
 
std::vector< PStringp_vecNameMarkdownExtraParser
 Vector of the markdown name of the extra environement. More...
 
std::vector< PStringp_vecRemoveLatexKeyword
 Vector of removed latex functions. More...
 
std::vector< PLatexSpeakerp_vecSpeaker
 Vector of all Speakers in the project. More...
 

Private Member Functions

PLatexObjgetProperParent (PLatexObj &parent, std::vector< size_t > &vecLevel, size_t itemLevel, PLatexType::PLatexType listItemType)
 Get the proper parent for the item with the given level. More...
 
void initialisationPGenericParser (const PString &baseInstallPrefix)
 Initialisation function of the class PGenericParser. More...
 
void initialisationPMarkdownParser ()
 Initialisation function of the class PMarkdownParser. More...
 
void initialisationPMultiFileParser (const PPath &inputDirectory, const PPath &outputDirectory)
 Initialisation function of the class PMultiFileParser. More...
 
void insertItemInItemize (PLatexObj &parent, const std::vector< std::pair< size_t, PLatexObj > > &vecItemLevel, PLatexType::PLatexType listItemType)
 Insert the item in the proper itemize. More...
 
bool isEnumerateItem (bool rewind=false)
 Say if there is no space between the last return and the current char. More...
 
bool isItem (bool rewind=false)
 Say if there is no space between the last return and the current char. More...
 
bool parseAllLatexObj (PLatexObj &parent, PLatexObj &textObj)
 Parse all the latex obj, but in markdown style. More...
 
bool parseComment (PLatexObj &parent, PLatexObj &textObj)
 Parse a new line. More...
 
bool parseComplexMonoParam (PLatexObj &parent, PLatexObj &textObj, const PString &functionName, PLatexType::PLatexType type)
 Parse all the functions which have complex mono parameter in braces {...}. More...
 
bool parseEnumerate (PLatexObj &parent, PLatexObj &textObj)
 Parse some enumerate. More...
 
bool parseEnumerateItem (std::vector< std::pair< size_t, PLatexObj > > &vecItemLevel)
 Parse an item in the markdown enumerate. More...
 
bool parseEnvDecoration (PLatexObj &parent, PLatexObj &textObj, const PString &patern, const PString &cssStyle, PLatexType::PLatexType type, const PString &balise)
 Parse a text decoration (bold, italic, etc) More...
 
bool parseEnvLatexObj (PLatexObj &parent, PLatexObj &textObj)
 Parse all the latex obj in environement, but in markdown style. More...
 
bool parseExtraEnvironement (PLatexObj &parent, PLatexObj &textObj)
 Parse extra environement (terminal, cplusplus, cmake, conseil, attention, ...) More...
 
bool parseExtraParser (PLatexObj &parent, PLatexObj &textObj)
 Parse extra environement (terminal, cplusplus, cmake, conseil, attention, ...) More...
 
bool parseHref (PLatexObj &parent, PLatexObj &textObj)
 Parse latex Href. More...
 
bool parseIncludeGraphic (PLatexObj &parent, PLatexObj &textObj)
 Parse the includegraphic command. More...
 
bool parseItem (std::vector< std::pair< size_t, PLatexObj > > &vecItemLevel)
 Parse an item in the markdown itemize. More...
 
bool parseItemize (PLatexObj &parent, PLatexObj &textObj)
 Parse some itemize. More...
 
bool parseItemLatexObj (PLatexObj &parent, PLatexObj &textObj)
 Parse all the latex obj in item, but in markdown style. More...
 
bool parseNewLine (PLatexObj &parent, PLatexObj &textObj)
 Parse a new line. More...
 
bool parsePercent (PLatexObj &parent, PLatexObj &textObj)
 Parse latex percent. More...
 
bool parseSectionTitle (PLatexObj &parent, PLatexObj &textObj, const PString &functionName, PLatexType::PLatexType type)
 Parse all the functions which have complex mono parameter in braces. More...
 
bool parseTextDecoration (PLatexObj &parent, PLatexObj &textObj, const PString &patern, const PString &cssStyle, PLatexType::PLatexType type, const PString &balise)
 Parse a text decoration (bold, italic, etc) More...
 
bool parseUrl (PLatexObj &parent, PLatexObj &textObj)
 Parse latex url. More...
 
void parseVecLatexObj (PLatexObj &parent, PLatexObj &textObj, const PString &beginPatern, const PString &endPatern)
 Parse a vector of latex object. More...
 
bool parseWip (PLatexObj &parent, PLatexObj &textObj)
 Parse a work in progress. More...
 

Private Attributes

PListMultiCommentConfig p_listCommentConfig
 Defines the differents comments we allow in the parsing. More...
 

Detailed Description

Class which parses Markdown as into for web site generator.

Definition at line 13 of file PMarkdownParser.h.

Constructor & Destructor Documentation

◆ PMarkdownParser() [1/3]

PMarkdownParser::PMarkdownParser ( const PString installPrefix = "")

Default constructor of PMarkdownParser.

Parameters
installPrefix: installation prefix

Definition at line 13 of file PMarkdownParser.cpp.

14  :PGenericParser(installPrefix)
15 {
17 }
PGenericParser(const PString &installPrefix="")
Default constructor of PGenericParser.
void initialisationPMarkdownParser()
Initialisation function of the class PMarkdownParser.

References initialisationPMarkdownParser().

+ Here is the call graph for this function:

◆ PMarkdownParser() [2/3]

PMarkdownParser::PMarkdownParser ( const PGenericParser other)

Copy constructor of PMarkdownParser.

Parameters
other: class to copy

Definition at line 22 of file PMarkdownParser.cpp.

23  :PGenericParser(other)
24 {
25 
26 }

◆ PMarkdownParser() [3/3]

PMarkdownParser::PMarkdownParser ( const PMarkdownParser other)

Copy constructor of PMarkdownParser.

Parameters
other: class to copy

Definition at line 31 of file PMarkdownParser.cpp.

32  :PGenericParser(other)
33 {
34  copyPMarkdownParser(other);
35 }
void copyPMarkdownParser(const PMarkdownParser &other)
Copy function of PMarkdownParser.

References copyPMarkdownParser().

+ Here is the call graph for this function:

◆ ~PMarkdownParser()

PMarkdownParser::~PMarkdownParser ( )
virtual

Destructor of PMarkdownParser.

Definition at line 38 of file PMarkdownParser.cpp.

38  {
39 
40 }

Member Function Documentation

◆ addCommentConfig() [1/2]

void PMultiFileParser::addCommentConfig ( const PMultiCommentConfig commentConfig)
inherited

Adds a comment config for the parser.

Parameters
commentConfig: comment config for the PMultiFileParser

Definition at line 84 of file PMultiFileParser.cpp.

84  {
85  p_listCommentConfig.push_back(commentConfig);
86 }
PListMultiCommentConfig p_listCommentConfig
Defines the differents comments we allow in the parsing.

References PMultiFileParser::p_listCommentConfig.

◆ addCommentConfig() [2/2]

void PMultiFileParser::addCommentConfig ( const PString beginStringComment,
const PString endStringComment = "\n" 
)
inherited

Adds a comment config for the parser.

Parameters
beginStringComment: string which defines the begining of a comment
endStringComment: string which defines the ending of a comment

Definition at line 92 of file PMultiFileParser.cpp.

92  {
93  p_listCommentConfig.push_back(PMultiCommentConfig(beginStringComment, endStringComment));
94 }
std::pair< PString, PString > PMultiCommentConfig
Describes a comment config.

References PMultiFileParser::p_listCommentConfig.

◆ addLatexObj()

void PGenericParser::addLatexObj ( PLatexObj parent,
const PLatexObj obj 
)
protectedinherited

Add latex obj in parent.

Parameters
[out]parent: parent PLatexObj
obj: PLatexObj to be added into parent

Definition at line 296 of file PGenericParser.cpp.

296  {
297  parent.getVecContent().push_back(obj);
298 }
const std::vector< PLatexObj > & getVecContent() const
Gets the vecContent of the PLatexObj.
Definition: PLatexObj.cpp:410

References PLatexObj::getVecContent().

Referenced by getProperParent(), insertItemInItemize(), PConfigParser::loadInclude(), PConfigParser::parseComment(), parseComment(), PConfigParser::parseComplexMonoParam(), parseComplexMonoParam(), PConfigParser::parseDebug(), PConfigParser::parseDots(), PConfigParser::parseDoubleInlineMath(), parseEnumerate(), parseEnvDecoration(), PConfigParser::parseEnvironementContent(), PConfigParser::parseEnvStringOnly(), parseExtraEnvironement(), PConfigParser::parseExtraEnvironementFunction(), PConfigParser::parseExtraFunction(), parseExtraParser(), PConfigParser::parseHref(), parseHref(), PConfigParser::parseIncludeGraphic(), parseIncludeGraphic(), PConfigParser::parseInlineMath(), PConfigParser::parseItem(), parseItemize(), PGenericParser::parseMonoParam(), PConfigParser::parseNewLine(), parseNewLine(), PConfigParser::parseParserLanguage(), PConfigParser::parseParserLanguageFunction(), PConfigParser::parsePercent(), parsePercent(), PConfigParser::parserCallDot(), PConfigParser::parserDetails(), PConfigParser::parseRealNewLine(), PGenericParser::parserGetEnv(), PConfigParser::parserQuote(), PConfigParser::parserSvgToPng(), PConfigParser::parseSectionTitle(), parseSectionTitle(), PConfigParser::parseSpaceParagraphe(), PConfigParser::parseTabular(), parseTextDecoration(), parseUrl(), PConfigParser::parseVideo(), and parseWip().

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

◆ checkExpectedMatch()

bool PMultiFileParser::checkExpectedMatch ( const PString tokenExpected,
const PString tokenBefore = "" 
)
inherited

Check if the tokenExpected match.

Parameters
tokenExpected: token we expect
tokenBefore: token before the exprected one
Returns
true if the p_currentToken == tokenExpected, false otherwise with an error message

Definition at line 166 of file PMultiFileParser.cpp.

166  {
167  if(p_parser->isMatch(tokenExpected)) return true;
168  errorAt();
169  std::cerr << "Unexpected token '"<<p_parser->getNextToken()<<"'" << std::endl;
170  std::cerr << "Expected token '"<<tokenExpected<<"'" << std::endl;
171  if(tokenBefore != "") std::cerr << " after " << tokenBefore << std::endl;
172  stopParsing();
173  return false;
174 }
PString getNextToken()
Get the next token.
bool isMatch(const PString &patern)
Says if the patern match with the current caracters of the PFileParser.
void errorAt()
Write a parsing error.
PFileParser * p_parser
Parser helper for the config file.
void stopParsing()
Stop the parsing of all the files.

References PMultiFileParser::errorAt(), PFileParser::getNextToken(), PFileParser::isMatch(), PMultiFileParser::p_parser, and PMultiFileParser::stopParsing().

+ Here is the call graph for this function:

◆ checkExpectedToken()

bool PMultiFileParser::checkExpectedToken ( const PString tokenExpected,
const PString tokenBefore = "" 
)
inherited

Check if the p_currentToken == tokenExpected.

Parameters
tokenExpected: token we expect
tokenBefore: token before the exprected one
Returns
true if the p_currentToken == tokenExpected, false otherwise with an error message

Definition at line 151 of file PMultiFileParser.cpp.

151  {
152  if(tokenExpected == p_currentToken) return true;
153  errorAt();
154  std::cerr << "Unexpected token '"<<p_currentToken<<"'" << std::endl;
155  std::cerr << "Expected token '"<<tokenExpected<<"'" << std::endl;
156  if(tokenBefore != "") std::cerr << " after " << tokenBefore << std::endl;
157  stopParsing();
158  return false;
159 }
PString p_currentToken
CurrentToken parsed.

References PMultiFileParser::errorAt(), PMultiFileParser::p_currentToken, and PMultiFileParser::stopParsing().

+ Here is the call graph for this function:

◆ clearComment()

void PMultiFileParser::clearComment ( )
inherited

Clear comment.

Definition at line 193 of file PMultiFileParser.cpp.

193  {
194  p_lastComment = "";
195 }
PString p_lastComment
last comment

References PMultiFileParser::p_lastComment.

Referenced by PMultiFileParser::initialisationPMultiFileParser().

+ Here is the caller graph for this function:

◆ clearLatexObj()

void PGenericParser::clearLatexObj ( PLatexObj obj)
protectedinherited

Clear a latex obj.

Parameters
[out]obj: PLatexObj to be cleared

Definition at line 255 of file PGenericParser.cpp.

255  {
256  obj.getVecContent().clear();
257  obj.setLabelName("");
258  obj.setText("");
259  obj.setName("");
261 }
void setLabelName(const PString &labelName)
Sets the labelName of the PLatexObj.
Definition: PLatexObj.cpp:158
void setName(const PString &name)
Sets the name of the PLatexObj.
Definition: PLatexObj.cpp:144
void setType(const PLatexType::PLatexType &type)
Sets the type of the PLatexObj.
Definition: PLatexObj.cpp:130
void setText(const PString &text)
Sets the text of the PLatexObj.
Definition: PLatexObj.cpp:137

References PLatexObj::getVecContent(), PLatexObj::setLabelName(), PLatexObj::setName(), PLatexObj::setText(), PLatexObj::setType(), and PLatexType::TEXT.

Referenced by PGenericParser::playTextLatexObj(), PConfigParser::preLoadFile(), and preLoadFile().

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

◆ copyFile()

PPath PGenericParser::copyFile ( const PPath outputDir,
const PPath fileName 
)
protectedinherited

Copy a file.

Parameters
outputDir: output directory where to put the input file
fileName; name of the file to be copied
Returns
the name of the copied file, empty string on fail

Definition at line 832 of file PGenericParser.cpp.

832  {
833  if(fileName == ""){
834  std::cerr << "PGenericParser::copyFile : fileName is empty" << std::endl;
835  return PPath("");
836  }
837  PPath fileToBeCopied(getAbsoluteFileName(fileName));
838  if(fileToBeCopied == ""){ //If the fileName does not exists, it is relative to the current parsed file
839  std::cerr << "PGenericParser::copyFile : file '"<<fileName<<"' does not exists, even relative to the current parsed file that gives '"<<fileToBeCopied<<"'" << std::endl;
840  return PPath("");
841  }
842 
843  PString baseFileName(fileToBeCopied.getFileName());
844  PString linkDir(fileName.getParentDirectory().replace("../", ""));
845  PPath buildFileName(outputDir + PPath("/") + linkDir + PPath("/") + baseFileName);
846 
847  //Do we know the input file (did we already copy it)
848  PMapFile::iterator it(p_mapCopiedFile.find(fileName));
849  if(it != p_mapCopiedFile.end()){
850  //Let's check if the copied file still exists
851  if(buildFileName.isFileExist()){
852  //Ok, now let's get it's last modification time to be sure
853  time_t currentModifTime = fileToBeCopied.getFileModificationTime();
854  //Now let's check if it is the same one
855  if(currentModifTime == it->second && currentModifTime > 0){ //negative value is an error
856  //Ok, no need to copy, we already did it and the file if up to date
857  std::cout << "PGenericParser::copyFile : no need to copy file '"<<fileName<<"' already updated at time " << currentModifTime << std::endl;
858  return buildFileName;
859  }
860  }
861  }
862 
863  if(linkDir != ""){ //If there is other directories
864  if(!PPath(outputDir + "/" + linkDir).createDirectory()){
865  std::cerr << "PGenericParser::copyFile : cannot create directory '"<<(outputDir + "/" + linkDir)<<"'" << std::endl;
866  return PPath("");
867  }
868  }else{
869  if(!outputDir.createDirectory()){
870  std::cerr << "PGenericParser::copyFile : cannot create directory '"<<outputDir<<"'" << std::endl;
871  return PPath("");
872  }
873  }
874 
875  //Set the modification time
876  time_t lastModifTime = fileToBeCopied.getFileModificationTime();
877 
878  PString command("cp "+fileToBeCopied+" " + buildFileName);
879  if(system(command.c_str()) != 0){
880  errorAt();
881  std::cerr << "PGenericParser::copyFile : can't copy file '"<<fileToBeCopied<<"' into '"<<buildFileName<<"' directory" << std::endl;
882  stopParsing();
883  return PPath("");
884  }
885 // std::cout << "PGenericParser::copyFile : copy file '"<<fileToBeCopied<<"' at time " << lastModifTime << std::endl;
886  p_mapCopiedFile[fileToBeCopied] = lastModifTime;
887  return buildFileName;
888 }
PPath getAbsoluteFileName(const PPath &fileName)
Get the absolute path of a file.
PMapFile p_mapCopiedFile
Map of copied files.
Path of a directory or a file.
Definition: PPath.h:17
bool createDirectory(mode_t mode=0755) const
Create the current directory.
Definition: PPath.cpp:331
PPath getParentDirectory() const
Get path of parent directory of current path.
Definition: PPath.cpp:207
Extends the std::string.
Definition: PString.h:16
PString replace(const PString &pattern, const PString &replaceStr) const
Replace a PString into an other PString.
Definition: PString.cpp:204

References PPath::createDirectory(), PMultiFileParser::errorAt(), PGenericParser::getAbsoluteFileName(), PPath::getFileModificationTime(), PPath::getFileName(), PPath::getParentDirectory(), PPath::isFileExist(), PGenericParser::p_mapCopiedFile, PString::replace(), and PMultiFileParser::stopParsing().

Referenced by PConfigParser::parseHref(), parseHref(), PConfigParser::parseIncludeGraphic(), parseIncludeGraphic(), and PConfigParser::parseVideo().

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

◆ copyPGenericParser()

void PGenericParser::copyPGenericParser ( const PGenericParser other)
protectedinherited

Copy function of PGenericParser.

Parameters
other: class to copy

Vector of all the environements

Vector of all the functions

Vector of the include directories

Vector of the name of the extra environement

Vector of the name of the extra environement

Vector of the name of the extra environement

Vector of extra environements

Vector of the name of the extra function

Vector of extra function

Vector of the name of the extra environement

Vector of the function name of the extra environement

Vector of the markdown name of the extra environement

Vector of removed latex functions

Vector of extra parser

Css of all the configurations

Map of all bibliography entries

Map of copied files

Definition at line 201 of file PGenericParser.cpp.

201  {
203 
205  p_vecEnv = other.p_vecEnv;
207  p_vecFunc = other.p_vecFunc;
208 
211 
220 
225 
236 
238  p_cssContent = other.p_cssContent;
243 
247  p_bookMail = other.p_bookMail;
250 }
PLatexObj p_bookMainPageLink
Main page definition of the full site.
std::vector< PString > p_vecNameExtraParser
Vector of the name of the extra environement.
PMapExtraEnv p_vecExtraEnv
Vector of extra environements.
std::map< PString, PString > p_cssContent
Css of all the configurations.
PMapExtraEnv p_vecExtraFunction
Vector of extra function.
std::vector< PString > p_vecNameFunctionExtraParser
Vector of the function name of the extra environement.
PString p_bookMasterProjectUrl
Master project url in book mode.
PMapBiblioEntry p_mapBiblioEntry
Map of all bibliography entries.
std::vector< PString > p_vecIncludeDir
Vector of the include directories.
PVecLatexEnv p_vecEnv
Vector of all the environements.
PString p_bookSideBarWidth
Witdh of the book side bar.
std::vector< PString > p_vecNameExtraFunction
Vector of the name of the extra function.
std::vector< PString > p_vecNameExtraEnv
Vector of the name of the extra environement.
bool p_isEnableBookFeedback
True to enable feedback in book mode.
std::vector< PString > p_vecNameMarkdownExtraParser
Vector of the markdown name of the extra environement.
PString p_bookGitlabUrl
Gitlab url of the current sources of the project.
std::vector< PString > p_vecNameFunctionExtraEnv
Vector of the name of the extra environement.
PVecLatexFunc p_vecFunc
Vector of all the functions.
std::vector< PString > p_vecNameMarkdownExtraEnv
Vector of the name of the extra environement (for markdown)
PString p_bookMail
Mail to be used to contact authors in book mode.
bool p_isDebugMode
True if be parse in debug mode.
std::vector< PString > p_vecRemoveLatexKeyword
Vector of removed latex functions.
PVecParserEnv p_vecExtraParser
Vector of extra parser.

References PGenericParser::p_bookGitlabUrl, PGenericParser::p_bookMail, PGenericParser::p_bookMainPageLink, PGenericParser::p_bookMasterProjectUrl, PGenericParser::p_bookSideBarWidth, PGenericParser::p_cssContent, PGenericParser::p_isDebugMode, PGenericParser::p_isEnableBookFeedback, PGenericParser::p_mapBiblioEntry, PGenericParser::p_mapCopiedFile, PGenericParser::p_vecEnv, PGenericParser::p_vecExtraEnv, PGenericParser::p_vecExtraFunction, PGenericParser::p_vecExtraParser, PGenericParser::p_vecFunc, PGenericParser::p_vecIncludeDir, PGenericParser::p_vecNameExtraEnv, PGenericParser::p_vecNameExtraFunction, PGenericParser::p_vecNameExtraParser, PGenericParser::p_vecNameFunctionExtraEnv, PGenericParser::p_vecNameFunctionExtraParser, PGenericParser::p_vecNameMarkdownExtraEnv, PGenericParser::p_vecNameMarkdownExtraParser, and PGenericParser::p_vecRemoveLatexKeyword.

Referenced by PConfigParser::loadInclude(), PGenericParser::operator=(), and PGenericParser::PGenericParser().

+ Here is the caller graph for this function:

◆ copyPMarkdownParser()

void PMarkdownParser::copyPMarkdownParser ( const PMarkdownParser other)
protected

Copy function of PMarkdownParser.

Parameters
other: class to copy

Definition at line 54 of file PMarkdownParser.cpp.

54  {
55 
56 }

Referenced by operator=(), and PMarkdownParser().

+ Here is the caller graph for this function:

◆ errorAt()

void PMultiFileParser::errorAt ( )
inherited

Write a parsing error.

Definition at line 126 of file PMultiFileParser.cpp.

126  {
127  std::cerr << "\033[31mError at " << p_parser->getLocation() << " :\033[0m" << std::endl;
128 }
PLocation getLocation() const
Fonction qui renvoie la PLocation du PFileParser.

References PFileParser::getLocation(), and PMultiFileParser::p_parser.

Referenced by PMultiFileParser::checkExpectedMatch(), PMultiFileParser::checkExpectedToken(), PGenericParser::copyFile(), getProperParent(), PGenericParser::getStringBetweenBraces(), PConfigParser::loadInclude(), PConfigParser::parseAddSpeaker(), PConfigParser::parseExtraEnvironement(), PConfigParser::parseHref(), parseHref(), PConfigParser::parseIncludeGraphic(), parseIncludeGraphic(), PConfigParser::parseTimeTable(), PConfigParser::parseVideo(), and PMultiFileParser::unexpectedToken().

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

◆ executeLatexCommand()

PString PGenericParser::executeLatexCommand ( const PString inputStr)
protectedinherited

Execute the given latex command.

Parameters
inputStr: input latex string
Returns
text string

Definition at line 304 of file PGenericParser.cpp.

304  {
305  PConfigParser parser;
306  parser.setFileContent(inputStr + "\n");
307  PString out("");
308  if(parser.fullParsing()){
309  out = platexobj_text(parser.getSource());
310  }else{
311  out = inputStr;
312  }
313  return out;
314 }
Parse the pdata confguration file.
Definition: PConfigParser.h:13
const PLatexObj & getSource() const
Get the current source.
void setFileContent(const PString &fileContent)
Set the file content to be parsed.
bool fullParsing()
Perform the full parsing pf data.
PString platexobj_text(const std::vector< PLatexObj > &vecObj)
Convert a PLatexObj in text.

References PMultiFileParser::fullParsing(), PGenericParser::getSource(), platexobj_text(), and PMultiFileParser::setFileContent().

Referenced by PGenericParser::parseBookEnableFeedback(), PGenericParser::parseBookGitlabUrl(), PGenericParser::parseBookMail(), PGenericParser::parseBookMasterProject(), PGenericParser::parseBookSizeBarWidth(), PGenericParser::parseMainAuthor(), PGenericParser::parseMainDate(), PGenericParser::parseMainSubTitle(), and PGenericParser::parseMainTitle().

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

◆ fullParsing()

bool PMultiFileParser::fullParsing ( )
inherited

Perform the full parsing pf data.

Returns
true on success, false otherwise

Definition at line 57 of file PMultiFileParser.cpp.

57  {
58  if(p_parser == NULL){
59  std::cerr << "PMultiFileParser::fullParsing : the parser is not initialised, please call PMultiFileParser::load or PMultiFileParser::setFileContent before this function" << std::endl;
60  return false;
61  }
62  preLoadFile();
63  bool isParseGood(true);
64  while(!p_parser->isEndOfFile() && isParseGood && p_run){
65  long unsigned int currentPos = p_parser->getCurrentCharIdx();
66  isParseGood = parseFile();
67  if(currentPos == p_parser->getCurrentCharIdx() && !p_parser->isEndOfFile()){
68  std::cerr << "PMultiFileParser::fullParsing : the parser is stucked at the position :" << std::endl << "\t" << p_parser->getLocation() << std::endl;
70  pointAtRow();
71  p_run = false;
72  }
73  }
74  if(p_run) postLoadFile();
75  p_listFileParser.pop_back();
76  if(p_listFileParser.size() > 0lu) p_parser = &p_listFileParser.back();
77  else p_parser = NULL;
78  return p_run;
79 }
size_t getCurrentCharIdx() const
Return the index of the current character.
bool isEndOfFile() const
Dit si on est à la fin du fichier.
Definition: PFileParser.cpp:88
virtual void postLoadFile()
Post load file.
virtual bool parseFile()=0
virtual void preLoadFile()
Pre load file.
std::list< PFileParser > p_listFileParser
List of all the parsers for all the loaded files.
void unexpectedToken()
Print unexpected token error.
void pointAtRow()
Point the problem.
bool p_run
Run the parsing if true.

References PFileParser::getCurrentCharIdx(), PFileParser::getLocation(), PFileParser::isEndOfFile(), PMultiFileParser::p_listFileParser, PMultiFileParser::p_parser, PMultiFileParser::p_run, PMultiFileParser::parseFile(), PMultiFileParser::pointAtRow(), PMultiFileParser::postLoadFile(), PMultiFileParser::preLoadFile(), and PMultiFileParser::unexpectedToken().

Referenced by checkPMultiFileParser(), PGenericParser::executeLatexCommand(), PMultiFileParser::load(), and platexobj_parseStr().

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

◆ getAbsoluteFileName()

PPath PGenericParser::getAbsoluteFileName ( const PPath fileName)
protectedinherited

Get the absolute path of a file.

Parameters
fileName: file to be used
Returns
corresponding absolute file name

Definition at line 815 of file PGenericParser.cpp.

815  {
816  PPath fileToBeCopied(fileName);
817  if(!fileToBeCopied.isFileExist()){ //If the fileName does not exists, it is relative to the current parsed file
818  fileToBeCopied = p_parser->getFileName().getParentDirectory() / fileName;
819  if(!fileToBeCopied.isFileExist()){ //Il the fileName still does not exists, we have to complain
820  std::cerr << "PGenericParser::getAbsoluteFileName : file '"<<fileName<<"' does not exists, even relative to the current parsed file that gives '"<<fileToBeCopied<<"'" << std::endl;
821  return PPath("");
822  }
823  }
824  return fileToBeCopied;
825 }
PPath getFileName() const
Fonction qui renvoie le nom du fichier que l'on a ouvert.

References PFileParser::getFileName(), PPath::getParentDirectory(), PPath::isFileExist(), and PMultiFileParser::p_parser.

Referenced by PGenericParser::copyFile(), and PConfigParser::parseVideo().

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

◆ getBookEnableFeedback()

bool PGenericParser::getBookEnableFeedback ( ) const
inherited

Say if the book feedback if enable or not.

Returns
true if the book feedback if enable, false if not

Definition at line 139 of file PGenericParser.cpp.

139  {
140  return p_isEnableBookFeedback;
141 }

References PGenericParser::p_isEnableBookFeedback.

◆ getBookGitlabUrl()

const PString & PGenericParser::getBookGitlabUrl ( ) const
inherited

Get the book gitlab url.

Returns
width of the book sidebar

Definition at line 132 of file PGenericParser.cpp.

132  {
133  return p_bookGitlabUrl;
134 }

References PGenericParser::p_bookGitlabUrl.

◆ getBookMail()

const PString & PGenericParser::getBookMail ( ) const
inherited

Get the book mail list.

Returns
book mail list

Definition at line 146 of file PGenericParser.cpp.

146  {
147  return p_bookMail;
148 }

References PGenericParser::p_bookMail.

◆ getBookMainPageLink()

const PLatexObj & PGenericParser::getBookMainPageLink ( ) const
inherited

Get the book main page link.

Returns
book main page link

Definition at line 160 of file PGenericParser.cpp.

160  {
161  return p_bookMainPageLink;
162 }

References PGenericParser::p_bookMainPageLink.

◆ getBookMasterProjectUrl()

const PString & PGenericParser::getBookMasterProjectUrl ( ) const
inherited

Get the book master project url.

Returns
book master project url

Definition at line 153 of file PGenericParser.cpp.

153  {
154  return p_bookMasterProjectUrl;
155 }

References PGenericParser::p_bookMasterProjectUrl.

◆ getBookSideBarWidth()

const PString & PGenericParser::getBookSideBarWidth ( ) const
inherited

Get the width of the book sidebar.

Returns
width of the book sidebar

Definition at line 125 of file PGenericParser.cpp.

125  {
126  return p_bookSideBarWidth;
127 }

References PGenericParser::p_bookSideBarWidth.

◆ getCurrentParser()

PFileParser * PMultiFileParser::getCurrentParser ( )
inherited

Gets the current parser.

Returns
pointer to the current parser

Definition at line 303 of file PMultiFileParser.cpp.

303  {
304  return p_parser;
305 }

References PMultiFileParser::p_parser.

Referenced by ConfigParser::preLoadFile().

+ Here is the caller graph for this function:

◆ getCurrentTokenWithoutComment()

void PMultiFileParser::getCurrentTokenWithoutComment ( )
inherited

Get the current token and skip the comment.

Definition at line 280 of file PMultiFileParser.cpp.

280  {
281  if(!p_run) return;
282  p_lastComment = "";
283  if(p_listCommentConfig.size() != 0lu){
284  bool currentTokenIsComment(true);
285  while(currentTokenIsComment && p_run && !p_parser->isEndOfFile()){
286  PListMultiCommentConfig::iterator it(p_listCommentConfig.begin());
287  currentTokenIsComment = false;
288  while(it != p_listCommentConfig.end() && !currentTokenIsComment){
289  if(p_parser->isMatch(it->first)){
290  p_lastComment = p_parser->getUntilKey(it->second);
291  currentTokenIsComment = true;
292  }
293  ++it;
294  }
295  }
296  }
298 }
PString getUntilKey(const PString &patern)
Renvoie la chaine de caractère du caractère courant jusqu'à patern comprise.

References PFileParser::getNextToken(), PFileParser::getUntilKey(), PFileParser::isEndOfFile(), PFileParser::isMatch(), PMultiFileParser::p_currentToken, PMultiFileParser::p_lastComment, PMultiFileParser::p_listCommentConfig, PMultiFileParser::p_parser, and PMultiFileParser::p_run.

+ Here is the call graph for this function:

◆ getLastComment() [1/2]

PString & PMultiFileParser::getLastComment ( )
inherited

Get the last comment.

Returns
last comment

Definition at line 106 of file PMultiFileParser.cpp.

106  {
107  return p_lastComment;
108 }

References PMultiFileParser::p_lastComment.

◆ getLastComment() [2/2]

const PString & PMultiFileParser::getLastComment ( ) const
inherited

Get the last comment.

Returns
last comment

Definition at line 99 of file PMultiFileParser.cpp.

99  {
100  return p_lastComment;
101 }

References PMultiFileParser::p_lastComment.

◆ getMapBiblioEntry() [1/2]

PMapBiblioEntry & PGenericParser::getMapBiblioEntry ( )
inherited

Get the map of all bibliography entries.

Returns
map of all bibliography entries

Definition at line 120 of file PGenericParser.cpp.

120 {return p_mapBiblioEntry;}

References PGenericParser::p_mapBiblioEntry.

◆ getMapBiblioEntry() [2/2]

const PMapBiblioEntry & PGenericParser::getMapBiblioEntry ( ) const
inherited

Get the map of all bibliography entries.

Returns
map of all bibliography entries

Definition at line 115 of file PGenericParser.cpp.

115 {return p_mapBiblioEntry;}

References PGenericParser::p_mapBiblioEntry.

◆ getOptionStringBetweenBraces()

PString PGenericParser::getOptionStringBetweenBraces ( )
protectedinherited

Get optional string between braces {...}.

Returns
string between braces or empty string if there is no hook

Definition at line 335 of file PGenericParser.cpp.

335  {
336  if(!isMatch("{")){ //No hook => empty string
337  return "";
338  }
340  return link;
341 }
PString getUntilKeyWithoutPaternRecurse(const PString &patern, const PString &beginPatern, const PString &allowedCharAfterBegin)
Get the string until end sequence and take account recursive patern (embeded strings)
bool isMatch(const PString &token)
Check if the given token matches the current read file.

References PFileParser::getUntilKeyWithoutPaternRecurse(), PMultiFileParser::isMatch(), and PMultiFileParser::p_parser.

Referenced by PConfigParser::parseAddSpeaker(), PConfigParser::parseDots(), PConfigParser::parseSaveSpeaker(), PConfigParser::parseSpaceParagraphe(), PConfigParser::parseTabular(), PConfigParser::parseTimeTable(), and PConfigParser::skipMonoParam().

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

◆ getOptionStringBetweenHook()

PString PGenericParser::getOptionStringBetweenHook ( )
protectedinherited

Get optional string between hooks [...].

Returns
string between hooks or empty string if there is no hook

Definition at line 346 of file PGenericParser.cpp.

346  {
348  char ch = p_parser->getCurrentCh();
349  if(ch != '['){ //No hook => empty string
350  return "";
351  }
354  return link;
355 }
#define PARSER_SKIP_SPACE
Macro to skip space.
PString getUntilKeyWithoutPatern(const PString &patern)
Renvoie la chaine de caractère du caractère courant jusqu'à patern exclu.
char getCurrentCh() const
Renvoie le caractère courant.
char getNextChar()
Fonction qui renvoie le prochain caractère du fichier courant.

References PFileParser::getCurrentCh(), PFileParser::getNextChar(), PFileParser::getUntilKeyWithoutPatern(), PMultiFileParser::p_parser, and PARSER_SKIP_SPACE.

Referenced by PConfigParser::parseComplexMonoParam(), parseComplexMonoParam(), PGenericParser::parseMonoParam(), PConfigParser::parseSectionTitle(), and PConfigParser::skipMonoParam().

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

◆ getProperParent()

PLatexObj * PMarkdownParser::getProperParent ( PLatexObj parent,
std::vector< size_t > &  vecLevel,
size_t  itemLevel,
PLatexType::PLatexType  listItemType 
)
private

Get the proper parent for the item with the given level.

Parameters
parent: parent itemize
vecLevel: vector of the parents levels
itemLevel: current level of the item to be added to the parent
listItemType: type of the item list
Returns
pointer to the corresponding parent

Definition at line 455 of file PMarkdownParser.cpp.

455  {
456  PLatexObj * currentParent = &parent;
457  if(vecLevel.back() >= itemLevel){ //The current parent level is too high
458  while(vecLevel.back() > itemLevel && vecLevel.size() > 1lu){
459  vecLevel.pop_back();
460  }
461  if(vecLevel.size() <= 1lu){
462  return currentParent;
463  }
464  for(size_t i(1lu); i < vecLevel.size(); ++i){
465  PLatexObj * tmpParent = currentParent;
466  PLatexObj & lastItemize = tmpParent->getVecContent().back();
467  if(lastItemize.getType() == listItemType){
468  currentParent = &lastItemize;
469  }else{
470  errorAt();
471  std::cerr << "PMarkdownParser::getProperParent : unextected PLatexObj of type " << lastItemize.getType() << std::endl;
472  stopParsing();
473  return NULL;
474  }
475  }
476  return currentParent;
477  }
478  //Only if the level has to increase of one (vecLevel.back() < itemLevel)
479  //Let's take the last parent we know
480  for(size_t i(1lu); i < vecLevel.size(); ++i){
481  PLatexObj * tmpParent = currentParent;
482  PLatexObj & lastItemize = tmpParent->getVecContent().back();
483  if(lastItemize.getType() == listItemType){
484  currentParent = &lastItemize;
485  }else{
486  errorAt();
487  std::cerr << "PMarkdownParser::getProperParent : unextected PLatexObj of type " << lastItemize.getType() << std::endl;
488  stopParsing();
489  return NULL;
490  }
491  }
492  PLatexObj newItemize;
493  newItemize.setType(listItemType);
494 
495  PLatexObj * tmpParent = currentParent;
496  addLatexObj(*tmpParent, newItemize);
497 
498  currentParent = &(tmpParent->getVecContent().back());
499  vecLevel.push_back(itemLevel);
500  return currentParent;
501 }
void addLatexObj(PLatexObj &parent, const PLatexObj &obj)
Add latex obj in parent.
Describe a latex object.
Definition: PLatexObj.h:40
const PLatexType::PLatexType & getType() const
Gets the type of the PLatexObj.
Definition: PLatexObj.cpp:298

References PGenericParser::addLatexObj(), PMultiFileParser::errorAt(), PLatexObj::getType(), PLatexObj::getVecContent(), PLatexObj::setType(), and PMultiFileParser::stopParsing().

Referenced by insertItemInItemize().

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

◆ getSource() [1/2]

PLatexObj & PGenericParser::getSource ( )
inherited

Get the current source.

Returns
current source

Definition at line 94 of file PGenericParser.cpp.

94  {
95  return p_currentSource;
96 }
PLatexObj p_currentSource
Current completed source.

References PGenericParser::p_currentSource.

◆ getSource() [2/2]

const PLatexObj & PGenericParser::getSource ( ) const
inherited

Get the current source.

Returns
current source

Definition at line 87 of file PGenericParser.cpp.

87  {
88  return p_currentSource;
89 }

References PGenericParser::p_currentSource.

Referenced by PGenericParser::executeLatexCommand(), PConfigParser::loadInclude(), and platexobj_parseStr().

+ Here is the caller graph for this function:

◆ getStrComposedOf()

PString PMultiFileParser::getStrComposedOf ( const PString charset)
inherited

Get the string composed of charset charcters.

Parameters
charset: set of allowed characters
Returns
corresponding string composed of characters in the given charset

Definition at line 272 of file PMultiFileParser.cpp.

272  {
273  //Remove comments
274  skipComment();
275  //Check if the token matches
276  return p_parser->getStrComposedOf(charset);
277 }
PString getStrComposedOf(const PString &charset)
Get string composed of the characters in the string charset.
void skipComment()
Skip comment.

References PFileParser::getStrComposedOf(), PMultiFileParser::p_parser, and PMultiFileParser::skipComment().

+ Here is the call graph for this function:

◆ getStringBetweenBraces()

PString PGenericParser::getStringBetweenBraces ( const PString previousToken)
protectedinherited

Get the string between the braces {...}.

Parameters
previousToken: previous token to be used
Returns
string between {...}

Definition at line 320 of file PGenericParser.cpp.

320  {
321  if(!isMatch("{")){
322  errorAt();
323  std::cerr << "PGenericParser::getStringBetweenBraces : expect '{' after '"<<previousToken<<"' instead of '"<<p_parser->getNextChar()<<"'" << std::endl;
324  stopParsing();
325  return "";
326  }
327 // PString link(p_parser->getUntilKeyWithoutPatern("}"));
329  return link;
330 }

References PMultiFileParser::errorAt(), PFileParser::getNextChar(), PFileParser::getUntilKeyWithoutPaternRecurse(), PMultiFileParser::isMatch(), PMultiFileParser::p_parser, and PMultiFileParser::stopParsing().

Referenced by PGenericParser::parseBookEnableFeedback(), PGenericParser::parseBookGitlabUrl(), PGenericParser::parseBookMail(), PGenericParser::parseBookMasterProject(), PGenericParser::parseBookSizeBarWidth(), PConfigParser::parseDebug(), PConfigParser::parseEnvStringOnly(), PConfigParser::parseHref(), PConfigParser::parseIncludeFile(), PConfigParser::parseInputFile(), PGenericParser::parseLabel(), PGenericParser::parseMainAuthor(), PGenericParser::parseMainDate(), PGenericParser::parseMainSubTitle(), PGenericParser::parseMainTitle(), PGenericParser::parseMonoParam(), and PGenericParser::parserGetEnv().

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

◆ getVecIncludeDir() [1/2]

PVecString & PGenericParser::getVecIncludeDir ( )
inherited

Get the vector of include directories.

Returns
vector of include directories

Definition at line 108 of file PGenericParser.cpp.

108  {
109  return p_vecIncludeDir;
110 }

References PGenericParser::p_vecIncludeDir.

◆ getVecIncludeDir() [2/2]

const PVecString & PGenericParser::getVecIncludeDir ( ) const
inherited

Get the vector of include directories.

Returns
vector of include directories

Definition at line 101 of file PGenericParser.cpp.

101  {
102  return p_vecIncludeDir;
103 }

References PGenericParser::p_vecIncludeDir.

◆ incrementCurrentChar()

void PGenericParser::incrementCurrentChar ( PLatexObj textObj)
protectedinherited

Increment current char position.

Parameters
[out]textObj: obh to be used to store text

Definition at line 266 of file PGenericParser.cpp.

266  {
267  //If nothing is known I need to save the current char in the MACRO TEXT
268  char ch = p_parser->getCurrentCh();
269  textObj.getText() += ch;
271 }
const PString & getText() const
Gets the text of the PLatexObj.
Definition: PLatexObj.cpp:312

References PFileParser::getCurrentCh(), PFileParser::getNextChar(), PLatexObj::getText(), and PMultiFileParser::p_parser.

Referenced by PConfigParser::loadInclude(), parseEnumerateItem(), PConfigParser::parseEnvironementContent(), parseExtraEnvironement(), PConfigParser::parseFile(), parseFile(), PConfigParser::parseItem(), parseItem(), PConfigParser::parserDetails(), PConfigParser::parserQuote(), PConfigParser::parseTabular(), PConfigParser::parseVecLatexObj(), parseVecLatexObj(), and parseWip().

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

◆ initialisationPGenericParser()

void PGenericParser::initialisationPGenericParser ( const PString baseInstallPrefix)
privateinherited

Initialisation function of the class PGenericParser.

Parameters
baseInstallPrefix: installation prefix

Definition at line 893 of file PGenericParser.cpp.

893  {
894  p_isDebugMode = false;
897 
898  PString installPrefix(CMAKE_INSTALL_PREFIX);
899  if(baseInstallPrefix != ""){
900  installPrefix = baseInstallPrefix;
901  }
902 
903  PPath dirExtraEnv(installPrefix+"/share/PhoenixTex2Html/ENVIRONEMENT");
904  loadDirExtraEnvironement(dirExtraEnv);
905 
906  PPath dirExtraFunction(installPrefix+"/share/PhoenixTex2Html/FUNCTION");
907  loadDirExtraFunction(dirExtraFunction);
908 
909  PPath dirExtraParser(installPrefix+"/share/PhoenixTex2Html/PARSER");
910  loadDirExtraParser(dirExtraParser);
911 
912  PPath dirCss(installPrefix+"/share/PhoenixTex2Html/STYLE");
913  loadCss(dirCss);
914 
915  p_vecRemoveLatexKeyword.push_back("\\toprule");
916  p_vecRemoveLatexKeyword.push_back("\\midrule");
917  p_vecRemoveLatexKeyword.push_back("\\bottomrule");
918  p_vecRemoveLatexKeyword.push_back("\\hline");
919  loadMapFile();
920 
921  p_bookSideBarWidth = "300px";
922  p_isEnableBookFeedback = false;
923 
924  p_bookMainPageLink.setType(PLatexType::NONE); //None by default, type will be updated on update
925 }
void loadDirExtraParser(const PPath &inputDir)
Load the extra parsers.
void loadDirExtraFunction(const PPath &inputDir)
Load the extra functions.
PLatexObj p_currentText
Current text.
void loadCss(const PPath &inputDir)
Load the css.
void loadMapFile()
Load the map of copied files.
void loadDirExtraEnvironement(const PPath &inputDir)
Load the extra environements.

References PLatexType::FILE, PGenericParser::loadCss(), PGenericParser::loadDirExtraEnvironement(), PGenericParser::loadDirExtraFunction(), PGenericParser::loadDirExtraParser(), PGenericParser::loadMapFile(), PLatexType::NONE, PGenericParser::p_bookMainPageLink, PGenericParser::p_bookSideBarWidth, PGenericParser::p_currentSource, PGenericParser::p_currentText, PGenericParser::p_isDebugMode, PGenericParser::p_isEnableBookFeedback, PGenericParser::p_vecRemoveLatexKeyword, PLatexObj::setType(), and PLatexType::TEXT.

Referenced by PGenericParser::PGenericParser().

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

◆ initialisationPMarkdownParser()

void PMarkdownParser::initialisationPMarkdownParser ( )
private

Initialisation function of the class PMarkdownParser.

Definition at line 95 of file PMarkdownParser.cpp.

95  {
96 
97 }

Referenced by PMarkdownParser().

+ Here is the caller graph for this function:

◆ initialisationPMultiFileParser()

void PMultiFileParser::initialisationPMultiFileParser ( const PPath inputDirectory,
const PPath outputDirectory 
)
privateinherited

Initialisation function of the class PMultiFileParser.

Parameters
inputDirectory: input directory of the PMultiFileParser
outputDirectory: output directory of the PMultiFileParser

Definition at line 311 of file PMultiFileParser.cpp.

311  {
312  p_run = true;
313  p_inputDirectory = inputDirectory;
314  p_outputDirectory = outputDirectory;
315  p_currentToken = "";
316  clearComment();
317  p_parser = NULL;
318 }
PPath p_inputDirectory
Input directory of the parser.
void clearComment()
Clear comment.
PPath p_outputDirectory
Output directory of the parser.

References PMultiFileParser::clearComment(), PMultiFileParser::p_currentToken, PMultiFileParser::p_inputDirectory, PMultiFileParser::p_outputDirectory, PMultiFileParser::p_parser, and PMultiFileParser::p_run.

Referenced by PMultiFileParser::PMultiFileParser().

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

◆ insertItemInItemize()

void PMarkdownParser::insertItemInItemize ( PLatexObj parent,
const std::vector< std::pair< size_t, PLatexObj > > &  vecItemLevel,
PLatexType::PLatexType  listItemType 
)
private

Insert the item in the proper itemize.

Parameters
[out]parent: itemize to be filled
vecItemLevel: vector of initialised items with theirs levels
listItemType: type of the item list

Definition at line 508 of file PMarkdownParser.cpp.

508  {
509  std::vector<size_t> parentLevel;
510  parentLevel.push_back(vecItemLevel.front().first);
511  for(std::vector<std::pair<size_t, PLatexObj> >::const_iterator it(vecItemLevel.begin()); it != vecItemLevel.end(); ++it){
512  //Get the proper parent
513  PLatexObj * currentParent = getProperParent(parent, parentLevel, it->first, listItemType);
514  if(currentParent == NULL){return;}
515  //Add the current item to it
516  addLatexObj(*currentParent, it->second);
517  }
518 }
PLatexObj * getProperParent(PLatexObj &parent, std::vector< size_t > &vecLevel, size_t itemLevel, PLatexType::PLatexType listItemType)
Get the proper parent for the item with the given level.

References PGenericParser::addLatexObj(), and getProperParent().

Referenced by parseEnumerate(), and parseItemize().

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

◆ isEnumerateItem()

bool PMarkdownParser::isEnumerateItem ( bool  rewind = false)
private

Say if there is no space between the last return and the current char.

Parameters
rewind: true to test and go back before the parsed token even if it is an item
Returns
true if there is no space between the last return and the current char, false otherwise

Definition at line 574 of file PMarkdownParser.cpp.

574  {
576  size_t currentCol(p_parser->getColumn());
577  PString listFigure(p_parser->getStrComposedOf("0123456789"));
578  if(listFigure == ""){
580  return false;
581  }
582  if(!p_parser->isMatch(". ")){
584  return false;
585  }
586  PString space(" \t"), currentRow(p_parser->getCurrentRow());
587  size_t i(0lu);
588  while(i < currentCol){
589  char ch = currentRow[i];
590  if(!space.find(ch)){
592  return false;
593  }
594  ++i;
595  }
596  if(rewind){
598  }
599  return true;
600 }
PString getCurrentRow() const
Get the current parsed row.
size_t getColumn() const
Fonction qui renvoie le numéro de la colonne du caractère courant.
void popPosition()
Get to the last saved position of the PFileParser in the current file.
Definition: PFileParser.cpp:99
void pushPosition()
Remember the current position of the PFileParser in the current file.
Definition: PFileParser.cpp:93

References PFileParser::getColumn(), PFileParser::getCurrentRow(), PFileParser::getStrComposedOf(), PFileParser::isMatch(), PMultiFileParser::p_parser, PFileParser::popPosition(), and PFileParser::pushPosition().

Referenced by parseEnumerate(), and parseEnumerateItem().

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

◆ isItem()

bool PMarkdownParser::isItem ( bool  rewind = false)
private

Say if there is no space between the last return and the current char.

Parameters
rewind: true to test and go back before the parsed token even if it is an item
Returns
true if there is no space between the last return and the current char, false otherwise

Definition at line 425 of file PMarkdownParser.cpp.

425  {
426  size_t currentCol(p_parser->getColumn());
428  if(!p_parser->isMatch("-")){
430  return false;
431  }
432  PString space(" \t"), currentRow(p_parser->getCurrentRow());
433  size_t i(0lu);
434  while(i < currentCol){
435  char ch = currentRow[i];
436  if(!space.find(ch)){
438  return false;
439  }
440  ++i;
441  }
442  if(rewind){
444  }
445  return true;
446 }

References PFileParser::getColumn(), PFileParser::getCurrentRow(), PFileParser::isMatch(), PMultiFileParser::p_parser, PFileParser::popPosition(), and PFileParser::pushPosition().

Referenced by parseItem(), and parseItemize().

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

◆ isMatch() [1/3]

bool PMultiFileParser::isMatch ( const PString patern,
const PString forbiddenCharBefore 
)
inherited

Says if the patern match with the current caracters of the PFileParser.

Parameters
patern: patern we want to check (this patern should not begin with white caracters)
forbiddenCharBefore: lisr of characters which cannot be just before the first character of the patern
Returns
true if the patern match, false otherwise If the patern match, the current char will be in the next char of the patern

Definition at line 239 of file PMultiFileParser.cpp.

239  {
240  //Remove comments
241  skipComment();
242  //Check if the token matches
243  return p_parser->isMatch(patern, forbiddenCharBefore);
244 }

References PFileParser::isMatch(), PMultiFileParser::p_parser, and PMultiFileParser::skipComment().

+ Here is the call graph for this function:

◆ isMatch() [2/3]

bool PMultiFileParser::isMatch ( const PString token)
inherited

Check if the given token matches the current read file.

Parameters
token: token to be checked
Returns
true on success, false otherwise This function isMatch takes account the comments

Definition at line 202 of file PMultiFileParser.cpp.

202  {
203  //Remove comments
204  skipComment();
205  //Check if the token matches
206  return p_parser->isMatch(token);
207 }

References PFileParser::isMatch(), PMultiFileParser::p_parser, and PMultiFileParser::skipComment().

Referenced by PGenericParser::getOptionStringBetweenBraces(), PGenericParser::getStringBetweenBraces(), ConfigParser::parseDocString(), PConfigParser::parseDots(), ConfigParser::parseFile(), and PConfigParser::parseSpaceParagraphe().

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

◆ isMatch() [3/3]

PString PMultiFileParser::isMatch ( const PVecString vecToken)
inherited

Check if the one entry of the vector of token matches.

Parameters
vecToken: vector of token
Returns
matched string, or empty string if there is no match

Definition at line 250 of file PMultiFileParser.cpp.

250  {
251  //Remove comments
252  skipComment();
253  //Check if the token matches
254  return p_parser->isMatch(vecToken);
255 }

References PFileParser::isMatch(), PMultiFileParser::p_parser, and PMultiFileParser::skipComment().

+ Here is the call graph for this function:

◆ isMatchRewind()

bool PMultiFileParser::isMatchRewind ( const PString token)
inherited

Check if the given token matches the current read file and goes back even if the token matches.

Parameters
token: token to be checked
Returns
true on success, false otherwise This function isMatch takes account the comments

Definition at line 214 of file PMultiFileParser.cpp.

214  {
215  //Remove comments
216  skipComment();
217  //Check if the token matches
218  return p_parser->isMatchRewind(token);
219 }
bool isMatchRewind(const PString &patern)
Do a isMatch and then go back at the previous position.

References PFileParser::isMatchRewind(), PMultiFileParser::p_parser, and PMultiFileParser::skipComment().

Referenced by PConfigParser::parseExtraFunction().

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

◆ isMatchSeq()

bool PMultiFileParser::isMatchSeq ( const PVecString patern,
bool  alwaysPopBack = false 
)
inherited

Match a sequence of token in a vector.

Parameters
patern: set of token to match in this order and totally
alwaysPopBack: true to make the PFileParser at the exact same place before the check even is the sequence matches
Returns
true if the full sequence matches, false otherwise

Definition at line 226 of file PMultiFileParser.cpp.

226  {
227  //Remove comments
228  skipComment();
229  //Check if the token matches
230  return p_parser->isMatchSeq(patern, alwaysPopBack);
231 }
bool isMatchSeq(const PVecString &patern, bool alwaysPopBack=false)
Match a sequence of token in a vector.

References PFileParser::isMatchSeq(), PMultiFileParser::p_parser, and PMultiFileParser::skipComment().

+ Here is the call graph for this function:

◆ isMatchToken()

PString PMultiFileParser::isMatchToken ( const PVecString vecToken)
inherited

Check the matching between the current caracters and all the string in the vector but treats the string as a token (cannot be part of a word)

Parameters
vecToken: vector of token
Returns
matched string, or empty string if there is no match

Definition at line 261 of file PMultiFileParser.cpp.

261  {
262  //Remove comments
263  skipComment();
264  //Check if the token matches
265  return p_parser->isMatchToken(vecToken);
266 }
bool isMatchToken(const PString &patern)
Says if the patern match with the current caracters of the PFileParser but treats the string as a tok...

References PFileParser::isMatchToken(), PMultiFileParser::p_parser, and PMultiFileParser::skipComment().

+ Here is the call graph for this function:

◆ load()

bool PMultiFileParser::load ( const PPath configFile)
inherited

Load the PMultiFileParser with the configFile.

Parameters
configFile: file name of the cnofiguration file
Returns
true on success, false otherwise

Definition at line 27 of file PMultiFileParser.cpp.

27  {
28  if(configFile == "") return false;
29  PFileParser parser;
30  p_listFileParser.push_back(parser);
32  p_parser = &p_listFileParser.back();
33  if(!p_parser->open(configFile)){
34  std::cerr << "PMultiFileParser::load : can't open file '" << configFile << "'" << std::endl;
35  return false;
36  }
37  return fullParsing();
38 }
#define MULTI_PARSER_SEPARATORS_STRING
classe qui permet de parser des fichiers texte en renvoyant les tokens les uns après les autres
Definition: PFileParser.h:20
bool open(const PPath &fileName)
Fonction qui ouvre le fichier que l'on va parser.
Definition: PFileParser.cpp:24

References PMultiFileParser::fullParsing(), MULTI_PARSER_SEPARATORS_STRING, PFileParser::open(), PMultiFileParser::p_listFileParser, and PMultiFileParser::p_parser.

Referenced by checkPMultiFileParser(), and PConfigParser::loadInclude().

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

◆ loadCss()

void PGenericParser::loadCss ( const PPath inputDir)
protectedinherited

Load the css.

Parameters
inputDir: input directory

Definition at line 786 of file PGenericParser.cpp.

786  {
787  PListFile listInputFile = inputDir.getAllElementInDir();
788  if(listInputFile.size() == 0lu){
789  std::cerr << "PGenericParser::loadCss : can't read directory '"<<inputDir<<"'" << std::endl;
790  return;
791  }
792  for(PListFile::iterator it(listInputFile.begin()); it != listInputFile.end(); ++it){
793  PString styleName(it->getFileName().eraseExtension());
794  PPath tmpFile(inputDir / (*it));
795  p_cssContent[styleName] = tmpFile.loadFileContent();
796  }
797 }
std::vector< PPath > getAllElementInDir() const
Get the list of all elements in a directory.
Definition: PPath.cpp:503
PVecPath PListFile
List of file.

References PPath::getAllElementInDir(), PPath::loadFileContent(), and PGenericParser::p_cssContent.

Referenced by PGenericParser::initialisationPGenericParser().

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

◆ loadDirExtraEnvironement()

void PGenericParser::loadDirExtraEnvironement ( const PPath inputDir)
protectedinherited

Load the extra environements.

Parameters
inputDir: input directory

Definition at line 622 of file PGenericParser.cpp.

622  {
623  PListFile listInputFile = inputDir.getAllElementInDir();
624  if(listInputFile.size() == 0lu){
625  std::cerr << "PGenericParser::loadDirExtraEnvironement : can't read directory '"<<inputDir<<"'" << std::endl;
626  return;
627  }
628  for(PListFile::iterator it(listInputFile.begin()); it != listInputFile.end(); ++it){
629  loadDirExtraEnvironementFile(inputDir / (*it));
630  }
631 }
void loadDirExtraEnvironementFile(const PPath &inputFile)
Load the extra environements with input file.

References PPath::getAllElementInDir(), and PGenericParser::loadDirExtraEnvironementFile().

Referenced by PGenericParser::initialisationPGenericParser().

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

◆ loadDirExtraEnvironementFile()

void PGenericParser::loadDirExtraEnvironementFile ( const PPath inputFile)
protectedinherited

Load the extra environements with input file.

Parameters
inputFile: input directory

Definition at line 572 of file PGenericParser.cpp.

572  {
573  PXml root;
574  if(!pxml_parserFile(root, inputFile)){
575  std::cerr << "PGenericParser::loadDirExtraEnvironementFile : can't read file '"<<inputFile<<"'" << std::endl;
576  return;
577  }
578  PXml & childXml = root.getVecChild().front();
579  if(!pxml_getChildIfExist(childXml, root, "environement")){
580  std::cerr << "PGenericParser::loadDirExtraEnvironementFile : can't find <environement> </environement> balise in file '"<<inputFile<<"'" << std::endl;
581  return;
582  }
583  PVecXml listEnv;
584  if(pxml_getVecChildIfExist(listEnv, childXml, "env")){
585  for(PVecXml::iterator it(listEnv.begin()); it != listEnv.end(); ++it){
586  PXmlAttr attrName;
587  if(!pxml_getAttrIfExist(attrName, *it, "name")){continue;}
588  PString name(attrName.getValue());
589  if(name == ""){
590  std::cerr << "PGenericParser::loadDirExtraEnvironementFile : expect name in balise" << std::endl;
591  continue;
592  }
593  PString balise("div");
594  PXmlAttr attr;
595  if(pxml_getAttrIfExist(attr, *it, "balise")){
596  balise = attr.getValue();
597  }
598  bool isAllowComment(true), isAllowMath(true);
599  setBoolFromAttr(isAllowComment, *it, "comment");
600  setBoolFromAttr(isAllowMath, *it, "math");
601 
602  PString contentStr(pxml_getFullContent(*it));
603 
604  PEnvironement tmp;
605  tmp.setName(name);
606  tmp.setBalise(balise);
607  tmp.setCss(contentStr);
608  tmp.setIsAllowComment(isAllowComment);
609  tmp.setIsAlloxMath(isAllowMath);
610 
611  p_vecExtraEnv[name] = tmp;
612  p_vecNameExtraEnv.push_back(name);
613  p_vecNameFunctionExtraEnv.push_back("\\" + name);
614  p_vecNameMarkdownExtraEnv.push_back("```" + name);
615  }
616  }
617 }
void setBoolFromAttr(bool &isAllowComment, const PXml &xml, const PString &name)
Get a boolean from xml attribute.
describe a CSS environement for latex
Definition: PLatexObj.h:272
void setName(const PString &name)
Sets the name of the PEnvironement.
Definition: PLatexObj.cpp:1082
void setCss(const PString &css)
Sets the css of the PEnvironement.
Definition: PLatexObj.cpp:1089
void setBalise(const PString &balise)
Sets the balise of the PEnvironement.
Definition: PLatexObj.cpp:1096
void setIsAllowComment(bool isAllowComment)
Sets the isAllowComment of the PEnvironement.
Definition: PLatexObj.cpp:1103
void setIsAlloxMath(bool isAlloxMath)
Sets the isAlloxMath of the PEnvironement.
Definition: PLatexObj.cpp:1110
Attribute from xml.
Definition: PXml.h:30
const PString & getValue() const
Get the variable p_value.
Definition: PXml.cpp:82
Class used to parse xml.
Definition: PXml.h:54
const std ::vector< PXml > & getVecChild() const
Get the variable p_vecChild.
Definition: PXml.cpp:264
bool pxml_getVecChildIfExist(PVecXml &vecMatch, const PXml &xml, const PString &childName)
Get the vector of childs with given name if exist.
Definition: pxml_utils.cpp:197
bool pxml_getAttrIfExist(PXmlAttr &attr, const PXml &xml, const PString &attrName)
Get the attribute with given name if exist.
Definition: pxml_utils.cpp:251
PString pxml_getFullContent(const PXml &xml)
Get the content of the PXml (children or value)
Definition: pxml_utils.cpp:395
bool pxml_parserFile(PXml &xml, const PPath &fileName, bool isSvg)
Parse a PXml with a file.
Definition: pxml_utils.cpp:38
bool pxml_getChildIfExist(PXml &match, const PXml &xml, const PString &childName)
Get the child with given name if exist.
Definition: pxml_utils.cpp:215
std::vector< PXml > PVecXml
Vector of PXml.
Definition: pxml_utils.h:14

References PXmlAttr::getValue(), PXml::getVecChild(), PGenericParser::p_vecExtraEnv, PGenericParser::p_vecNameExtraEnv, PGenericParser::p_vecNameFunctionExtraEnv, PGenericParser::p_vecNameMarkdownExtraEnv, pxml_getAttrIfExist(), pxml_getChildIfExist(), pxml_getFullContent(), pxml_getVecChildIfExist(), pxml_parserFile(), PEnvironement::setBalise(), setBoolFromAttr(), PEnvironement::setCss(), PEnvironement::setIsAllowComment(), PEnvironement::setIsAlloxMath(), and PEnvironement::setName().

Referenced by PGenericParser::loadDirExtraEnvironement().

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

◆ loadDirExtraFunction()

void PGenericParser::loadDirExtraFunction ( const PPath inputDir)
protectedinherited

Load the extra functions.

Parameters
inputDir: input directory

Definition at line 677 of file PGenericParser.cpp.

677  {
678  PListFile listInputFile = inputDir.getAllElementInDir();
679  if(listInputFile.size() == 0lu){
680  std::cerr << "PGenericParser::loadDirExtraFunction : can't read directory '"<<inputDir<<"'" << std::endl;
681  return;
682  }
683  for(PListFile::iterator it(listInputFile.begin()); it != listInputFile.end(); ++it){
684  loadDirExtraFunctionFile(inputDir / (*it));
685  }
686 }
void loadDirExtraFunctionFile(const PPath &inputFile)
Load the extra functions with input file.

References PPath::getAllElementInDir(), and PGenericParser::loadDirExtraFunctionFile().

Referenced by PGenericParser::initialisationPGenericParser().

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

◆ loadDirExtraFunctionFile()

void PGenericParser::loadDirExtraFunctionFile ( const PPath inputFile)
protectedinherited

Load the extra functions with input file.

Parameters
inputFile: input directory

Definition at line 636 of file PGenericParser.cpp.

636  {
637  PXml root;
638  if(!pxml_parserFile(root, inputFile)){
639  std::cerr << "PGenericParser::loadDirExtraFunctionFile : can't read file '"<<inputFile<<"'" << std::endl;
640  return;
641  }
642  PXml & childXml = root.getVecChild().front();
643  if(!pxml_getChildIfExist(childXml, root, "function")){
644  std::cerr << "PGenericParser::loadDirExtraFunctionFile : can't find <function> </function> balise in file '"<<inputFile<<"'" << std::endl;
645  return;
646  }
647  PVecXml listEnv;
648  if(pxml_getVecChildIfExist(listEnv, childXml, "fct")){
649  for(PVecXml::iterator it(listEnv.begin()); it != listEnv.end(); ++it){
650  PXmlAttr attrName;
651  if(!pxml_getAttrIfExist(attrName, *it, "name")){continue;}
652  PString name(attrName.getValue());
653  if(name == ""){
654  std::cerr << "PGenericParser::loadDirExtraFunctionFile : expect name in balise" << std::endl;
655  continue;
656  }
657  PString balise("span");
658  PXmlAttr attr;
659  if(pxml_getAttrIfExist(attr, *it, "balise")){
660  balise = attr.getValue();
661  }
662  PString contentStr(pxml_getFullContent(*it));
663  PEnvironement tmp;
664  tmp.setName(name);
665  tmp.setBalise(balise);
666  tmp.setCss(contentStr);
667 
668  p_vecExtraFunction[name] = tmp;
669  p_vecNameExtraFunction.push_back("\\" + name);
670  }
671  }
672 }

References PXmlAttr::getValue(), PXml::getVecChild(), PGenericParser::p_vecExtraFunction, PGenericParser::p_vecNameExtraFunction, pxml_getAttrIfExist(), pxml_getChildIfExist(), pxml_getFullContent(), pxml_getVecChildIfExist(), pxml_parserFile(), PEnvironement::setBalise(), PEnvironement::setCss(), and PEnvironement::setName().

Referenced by PGenericParser::loadDirExtraFunction().

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

◆ loadDirExtraParser()

void PGenericParser::loadDirExtraParser ( const PPath inputDir)
protectedinherited

Load the extra parsers.

Parameters
inputDir: input directory

Definition at line 772 of file PGenericParser.cpp.

772  {
773  PListFile listInputFile = inputDir.getAllElementInDir();
774  if(listInputFile.size() == 0lu){
775  std::cerr << "PGenericParser::loadDirExtraParser : can't read directory '"<<inputDir<<"'" << std::endl;
776  return;
777  }
778  for(PListFile::iterator it(listInputFile.begin()); it != listInputFile.end(); ++it){
779  loadDirExtraParserFile(inputDir / (*it));
780  }
781 }
void loadDirExtraParserFile(const PPath &inputFile)
Load the extra environements with input file.

References PPath::getAllElementInDir(), and PGenericParser::loadDirExtraParserFile().

Referenced by PGenericParser::initialisationPGenericParser().

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

◆ loadDirExtraParserFile()

void PGenericParser::loadDirExtraParserFile ( const PPath inputFile)
protectedinherited

Load the extra environements with input file.

Parameters
inputFile: input directory

Definition at line 691 of file PGenericParser.cpp.

691  {
692  PXml root;
693  if(!pxml_parserFile(root, inputFile)){
694  std::cerr << "PGenericParser::loadDirExtraParserFile : can't read file '"<<inputFile<<"'" << std::endl;
695  return;
696  }
697  PXml & childXml = root.getVecChild().front();
698  if(!pxml_getChildIfExist(childXml, root, "highlighting")){
699  std::cerr << "PGenericParser::loadDirExtraParserFile : can't find <highlighting> </highlighting> balise in file '"<<inputFile<<"'" << std::endl;
700  return;
701  }
702  PString environementName(inputFile.getFileName().eraseExtension());
703  p_vecNameExtraParser.push_back(environementName);
704  p_vecNameFunctionExtraParser.push_back("\\" + environementName);
705  p_vecNameMarkdownExtraParser.push_back("```" + environementName);
706 
707  PParserEnv parserEnv;
708  parserEnv.setName(environementName);
709 
710  PXml matchPlainText;
711  if(pxml_getChildIfExist(matchPlainText, childXml, "plainText")){
712  parserEnv.setPlainText(convertBackSlahedStr(pxml_getFullContent(matchPlainText)));
713  }
714  PVecXml listEnv;
715  if(pxml_getVecChildIfExist(listEnv, childXml, "context")){
716  for(PVecXml::iterator itBalise(listEnv.begin()); itBalise != listEnv.end(); ++itBalise){
717  PXmlAttr attrClass;
718  if(!pxml_getAttrIfExist(attrClass, *itBalise, "class")){continue;}
719  PString nameClass(attrClass.getValue());
720  if(nameClass == ""){
721  std::cerr << "PGenericParser::loadDirExtraEnvironementFile : expect 'class' in balise" << std::endl;
722  continue;
723  }
724  PContext tmp;
725  tmp.setName(nameClass);
726 
727  PXml matchBegin;
728  if(pxml_getChildIfExist(matchBegin, *itBalise, "begin")){
730  }
731  PXml matchEnd;
732  if(pxml_getChildIfExist(matchEnd, *itBalise, "end")){
734  }
735  PXml matchNotBeforeBegin;
736  if(pxml_getChildIfExist(matchNotBeforeBegin, *itBalise, "notBeforeBegin")){
738  }
739  PXml matchNotAfterBegin;
740  if(pxml_getChildIfExist(matchNotAfterBegin, *itBalise, "notAfterBegin")){
742  }
743  PXml matchNotBeforEnd;
744  if(pxml_getChildIfExist(matchNotBeforEnd, *itBalise, "notBeforeEnd")){
746  }
747  PVecXml listKw;
748  if(pxml_getVecChildIfExist(listKw, *itBalise, "keyword")){
749  for(PVecXml::iterator it(listKw.begin()); it != listKw.end(); ++it){
751  }
752  }
753 
754  PXml matchSequence;
755  if(pxml_getChildIfExist(matchSequence, *itBalise, "sequence")){
756  PParseSeq seq;
757  if(loadParserSeq(seq, matchSequence)){
758  tmp.setSeq(seq);
759  }else{
760  std::cerr << "PGenericParser::loadDirExtraParserFile : can't initialise sequence with balise in file '"<<inputFile<<"'" << std::endl;
761  }
762  }
763  parserEnv.getVecContext().push_back(tmp);
764  }
765  p_vecExtraParser.getVecEnv().push_back(parserEnv);
766  }
767 }
bool loadParserSeq(PParseSeq &seq, const PXml &xmlSeq)
Load a ParseSeq with a XML balise.
Context for parser environement.
Definition: PLatexObj.h:310
void setBegin(const PString &begin)
Sets the begin of the PContext.
Definition: PLatexObj.cpp:1240
void setNotBeforeBegin(const PString &notBeforeBegin)
Sets the notBeforeBegin of the PContext.
Definition: PLatexObj.cpp:1254
void setSeq(const PParseSeq &seq)
Sets the seq of the PContext.
Definition: PLatexObj.cpp:1282
void setNotBeforeEnd(const PString &notBeforeEnd)
Sets the notBeforeEnd of the PContext.
Definition: PLatexObj.cpp:1268
const std::vector< PString > & getVecKeyword() const
Gets the vecKeyword of the PContext.
Definition: PLatexObj.cpp:1373
void setEnd(const PString &end)
Sets the end of the PContext.
Definition: PLatexObj.cpp:1247
void setNotAfterBegin(const PString &notAfterBegin)
Sets the notAfterBegin of the PContext.
Definition: PLatexObj.cpp:1261
void setName(const PString &name)
Sets the name of the PContext.
Definition: PLatexObj.cpp:1233
Parsing sequence.
Definition: PParseSeq.h:77
Parser environement.
Definition: PLatexObj.h:363
void setName(const PString &name)
Sets the name of the PParserEnv.
Definition: PLatexObj.cpp:1451
void setPlainText(const PString &plainText)
Sets the plainText of the PParserEnv.
Definition: PLatexObj.cpp:1458
const std::vector< PContext > & getVecContext() const
Gets the vecContext of the PParserEnv.
Definition: PLatexObj.cpp:1500
PPath & eraseExtension()
Erase the extension of the PPath.
Definition: PPath.cpp:292
PPath getFileName() const
Get the name of the file, from last char to /.
Definition: PPath.cpp:172
const std::vector< PParserEnv > & getVecEnv() const
Gets the vecEnv of the PVecParserEnv.
Definition: PLatexObj.cpp:1562
PString convertBackSlahedStr(const PString &str)
Convert all the echaped char.

References convertBackSlahedStr(), PPath::eraseExtension(), PPath::getFileName(), PXmlAttr::getValue(), PXml::getVecChild(), PParserEnv::getVecContext(), PVecParserEnv::getVecEnv(), PContext::getVecKeyword(), loadParserSeq(), PGenericParser::p_vecExtraParser, PGenericParser::p_vecNameExtraParser, PGenericParser::p_vecNameFunctionExtraParser, PGenericParser::p_vecNameMarkdownExtraParser, pxml_getAttrIfExist(), pxml_getChildIfExist(), pxml_getFullContent(), pxml_getVecChildIfExist(), pxml_parserFile(), PContext::setBegin(), PContext::setEnd(), PContext::setName(), PParserEnv::setName(), PContext::setNotAfterBegin(), PContext::setNotBeforeBegin(), PContext::setNotBeforeEnd(), PParserEnv::setPlainText(), and PContext::setSeq().

Referenced by PGenericParser::loadDirExtraParser().

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

◆ loadMapFile()

void PGenericParser::loadMapFile ( )
protectedinherited

Load the map of copied files.

Definition at line 800 of file PGenericParser.cpp.

800  {
801  PString fileName(COPIED_RECOVER_FILE);
802  if(!data_load(fileName, p_mapCopiedFile)){return;}
803 }
#define COPIED_RECOVER_FILE
Define the name of the file which contains the formulae and the path to the created file.
bool data_load(FILE *iter, T &data)
Load data from a message.
Definition: data_file.h:39

References COPIED_RECOVER_FILE, data_load(), and PGenericParser::p_mapCopiedFile.

Referenced by PGenericParser::initialisationPGenericParser().

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

◆ operator=()

PMarkdownParser & PMarkdownParser::operator= ( const PMarkdownParser other)

Definition of equal operator of PMarkdownParser.

Parameters
other: class to copy
Returns
copied class

Definition at line 46 of file PMarkdownParser.cpp.

46  {
47  copyPMarkdownParser(other);
48  return *this;
49 }

References copyPMarkdownParser().

+ Here is the call graph for this function:

◆ parseAllLatexObj()

bool PMarkdownParser::parseAllLatexObj ( PLatexObj parent,
PLatexObj textObj 
)
private

Parse all the latex obj, but in markdown style.

Parameters
[out]parent: parent PLatexObj
[out]textObj: PLatexObj to deal with text
Returns
true on success, false otherwise

Definition at line 126 of file PMarkdownParser.cpp.

126  {
127  if(parseSectionTitle(parent, textObj, "##### ", PLatexType::SUBSUBSECTION)){}
128  else if(parseSectionTitle(parent, textObj, "#### ", PLatexType::SUBSECTION)){}
129  else if(parseSectionTitle(parent, textObj, "### ", PLatexType::SECTION)){}
130  else if(parseSectionTitle(parent, textObj, "## ", PLatexType::CHAPTER)){}
131  else if(parseSectionTitle(parent, textObj, "# ", PLatexType::PART)){}
132 
133  else if(parseExtraEnvironement(parent, textObj)){}
134  else if(parseExtraParser(parent, textObj)){}
135  else if(parseWip(parent, textObj)){}
136  else if(parseEnvDecoration(parent, textObj, "```", "terminal", PLatexType::ENVIRONEMENT, "pre")){}
137 
138  else if(parseGenericLatexObj(parent, textObj)){}
139  else if(parseComplexMonoParam(parent, textObj, "\\footnote", PLatexType::FOOTNOTE)){}
140  else if(parseComplexMonoParam(parent, textObj, "\\caption", PLatexType::CAPTION)){}
141 
142  else if(parseEnvLatexObj(parent, textObj)){}
143  else{
144  return false;
145  }
146  return true;
147 }
bool parseGenericLatexObj(PLatexObj &parent, PLatexObj &textObj)
Parse the generic latex function which have to be used in the latex parser and the markdown parser to...
bool parseEnvDecoration(PLatexObj &parent, PLatexObj &textObj, const PString &patern, const PString &cssStyle, PLatexType::PLatexType type, const PString &balise)
Parse a text decoration (bold, italic, etc)
bool parseSectionTitle(PLatexObj &parent, PLatexObj &textObj, const PString &functionName, PLatexType::PLatexType type)
Parse all the functions which have complex mono parameter in braces.
bool parseExtraEnvironement(PLatexObj &parent, PLatexObj &textObj)
Parse extra environement (terminal, cplusplus, cmake, conseil, attention, ...)
bool parseWip(PLatexObj &parent, PLatexObj &textObj)
Parse a work in progress.
bool parseEnvLatexObj(PLatexObj &parent, PLatexObj &textObj)
Parse all the latex obj in environement, but in markdown style.
bool parseComplexMonoParam(PLatexObj &parent, PLatexObj &textObj, const PString &functionName, PLatexType::PLatexType type)
Parse all the functions which have complex mono parameter in braces {...}.
bool parseExtraParser(PLatexObj &parent, PLatexObj &textObj)
Parse extra environement (terminal, cplusplus, cmake, conseil, attention, ...)
@ SUBSUBSECTION
Definition: PLatexType.h:54
@ ENVIRONEMENT
Definition: PLatexType.h:85

References PLatexType::CAPTION, PLatexType::CHAPTER, PLatexType::ENVIRONEMENT, PLatexType::FOOTNOTE, parseComplexMonoParam(), parseEnvDecoration(), parseEnvLatexObj(), parseExtraEnvironement(), parseExtraParser(), PGenericParser::parseGenericLatexObj(), parseSectionTitle(), parseWip(), PLatexType::PART, PLatexType::SECTION, PLatexType::SUBSECTION, and PLatexType::SUBSUBSECTION.

Referenced by parseFile(), and parseVecLatexObj().

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

◆ parseBookEnableFeedback()

bool PGenericParser::parseBookEnableFeedback ( PLatexObj parent,
PLatexObj textObj 
)
protectedinherited

Parse the book enable feedback mode.

Parameters
[out]parent: parent PLatexObj
[out]textObj: PLatexObj to deal with text
Returns
true on success, false otherwise

Definition at line 521 of file PGenericParser.cpp.

521  {
522  if(!p_parser->isMatchToken("\\bookEnableFeedback")){return false;}
523  playTextLatexObj(parent, textObj);
524  PString title(getStringBetweenBraces("\\bookEnableFeedback").toLower());
525  title = executeLatexCommand(title);
526  p_isEnableBookFeedback = (title == "true" || title == "yes" || title == "1");
527  return true;
528 }
bool playTextLatexObj(PLatexObj &parent, PLatexObj &textObj, bool isRemoveFirstLastSpace=false)
Play the text latex obj.
PString executeLatexCommand(const PString &inputStr)
Execute the given latex command.
PString getStringBetweenBraces(const PString &previousToken)
Get the string between the braces {...}.

References PGenericParser::executeLatexCommand(), PGenericParser::getStringBetweenBraces(), PFileParser::isMatchToken(), PGenericParser::p_isEnableBookFeedback, PMultiFileParser::p_parser, and PGenericParser::playTextLatexObj().

Referenced by PGenericParser::parseGenericLatexObj().

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

◆ parseBookGitlabUrl()

bool PGenericParser::parseBookGitlabUrl ( PLatexObj parent,
PLatexObj textObj 
)
protectedinherited

Parse the gitlab url in book mode.

Parameters
[out]parent: parent PLatexObj
[out]textObj: PLatexObj to deal with text
Returns
true on success, false otherwise

Definition at line 508 of file PGenericParser.cpp.

508  {
509  if(!p_parser->isMatchToken("\\bookGitlabUrl")){return false;}
510  playTextLatexObj(parent, textObj);
511  PString title(getStringBetweenBraces("\\bookGitlabUrl"));
513  return true;
514 }
PString eraseLastChar(const PString &vecChar) const
Erase first and last char in a string.
Definition: PString.cpp:521

References PString::eraseLastChar(), PGenericParser::executeLatexCommand(), PGenericParser::getStringBetweenBraces(), PFileParser::isMatchToken(), PGenericParser::p_bookGitlabUrl, PMultiFileParser::p_parser, and PGenericParser::playTextLatexObj().

Referenced by PGenericParser::parseGenericLatexObj().

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

◆ parseBookMail()

bool PGenericParser::parseBookMail ( PLatexObj parent,
PLatexObj textObj 
)
protectedinherited

Parse the mail in book mode.

Parameters
[out]parent: parent PLatexObj
[out]textObj: PLatexObj to deal with text
Returns
true on success, false otherwise

Definition at line 535 of file PGenericParser.cpp.

535  {
536  if(!p_parser->isMatchToken("\\bookMail")){return false;}
537  playTextLatexObj(parent, textObj);
538  PString title(getStringBetweenBraces("\\bookMail"));
540  return true;
541 }

References PGenericParser::executeLatexCommand(), PGenericParser::getStringBetweenBraces(), PFileParser::isMatchToken(), PGenericParser::p_bookMail, PMultiFileParser::p_parser, and PGenericParser::playTextLatexObj().

Referenced by PGenericParser::parseGenericLatexObj().

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

◆ parseBookMasterProject()

bool PGenericParser::parseBookMasterProject ( PLatexObj parent,
PLatexObj textObj 
)
protectedinherited

Parse the master project in book mode.

Parameters
[out]parent: parent PLatexObj
[out]textObj: PLatexObj to deal with text
Returns
true on success, false otherwise

Definition at line 548 of file PGenericParser.cpp.

548  {
549  if(!p_parser->isMatchToken("\\bookMasterProject")){return false;}
550  playTextLatexObj(parent, textObj);
551  PString title(getStringBetweenBraces("\\bookMasterProject"));
553  return true;
554 }

References PString::eraseLastChar(), PGenericParser::executeLatexCommand(), PGenericParser::getStringBetweenBraces(), PFileParser::isMatchToken(), PGenericParser::p_bookMasterProjectUrl, PMultiFileParser::p_parser, and PGenericParser::playTextLatexObj().

Referenced by PGenericParser::parseGenericLatexObj().

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

◆ parseBookSizeBarWidth()

bool PGenericParser::parseBookSizeBarWidth ( PLatexObj parent,
PLatexObj textObj 
)
protectedinherited

Parse the width of the book sidebar.

Parameters
[out]parent: parent PLatexObj
[out]textObj: PLatexObj to deal with text
Returns
true on success, false otherwise

Definition at line 495 of file PGenericParser.cpp.

495  {
496  if(!p_parser->isMatchToken("\\bookSizebarWidth")){return false;}
497  playTextLatexObj(parent, textObj);
498  PString title(getStringBetweenBraces("\\bookSizebarWidth"));
500  return true;
501 }

References PGenericParser::executeLatexCommand(), PGenericParser::getStringBetweenBraces(), PFileParser::isMatchToken(), PGenericParser::p_bookSideBarWidth, PMultiFileParser::p_parser, and PGenericParser::playTextLatexObj().

Referenced by PGenericParser::parseGenericLatexObj().

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

◆ parseComment()

bool PMarkdownParser::parseComment ( PLatexObj parent,
PLatexObj textObj 
)
private

Parse a new line.

Parameters
[out]parent: parent PLatexObj
[out]textObj: PLatexObj to deal with text
Returns
true on success, false otherwise

Definition at line 382 of file PMarkdownParser.cpp.

382  {
383  if(!p_parser->isMatch("<!--")){return false;}
384  playTextLatexObj(parent, textObj);
385  PString comment(p_parser->getUntilKeyWithoutPatern("-->"));
386  PLatexObj tmp;
388  tmp.setName(comment);
389  addLatexObj(parent, tmp);
390  return true;
391 }

References PGenericParser::addLatexObj(), PLatexType::COMMENT, PFileParser::getUntilKeyWithoutPatern(), PFileParser::isMatch(), PMultiFileParser::p_parser, PGenericParser::playTextLatexObj(), PLatexObj::setName(), and PLatexObj::setType().

Referenced by parseItemLatexObj().

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

◆ parseComplexMonoParam()

bool PMarkdownParser::parseComplexMonoParam ( PLatexObj parent,
PLatexObj textObj,
const PString functionName,
PLatexType::PLatexType  type 
)
private

Parse all the functions which have complex mono parameter in braces {...}.

Parameters
[out]parent: parent PLatexObj
[out]textObj: PLatexObj to deal with text
functionName: name of the expected function
type: type of the expected function
Returns
true on success, false otherwise

Definition at line 106 of file PMarkdownParser.cpp.

106  {
107  if(!p_parser->isMatchToken(functionName)){return false;}
108  playTextLatexObj(parent, textObj);
109  PLatexObj tmp;
110  tmp.setType(type);
111 
112  PString textOption(getOptionStringBetweenHook());
113  tmp.setText(textOption);
114 
115  parseVecLatexObj(tmp, textObj, "{", "}");
116 
117  addLatexObj(parent, tmp);
118  return true;
119 }
PString getOptionStringBetweenHook()
Get optional string between hooks [...].
void parseVecLatexObj(PLatexObj &parent, PLatexObj &textObj, const PString &beginPatern, const PString &endPatern)
Parse a vector of latex object.

References PGenericParser::addLatexObj(), PGenericParser::getOptionStringBetweenHook(), PFileParser::isMatchToken(), PMultiFileParser::p_parser, parseVecLatexObj(), PGenericParser::playTextLatexObj(), PLatexObj::setText(), and PLatexObj::setType().

Referenced by parseAllLatexObj().

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

◆ parseEnumerate()

bool PMarkdownParser::parseEnumerate ( PLatexObj parent,
PLatexObj textObj 
)
private

Parse some enumerate.

Parameters
[out]parent: parent PLatexObj
[out]textObj: PLatexObj to deal with text
Returns
true on success, false otherwise

Definition at line 607 of file PMarkdownParser.cpp.

607  {
608  if(!isEnumerateItem(true)){return false;}
609  playTextLatexObj(parent, textObj);
610  PLatexObj tmp;
612  std::vector<std::pair<size_t, PLatexObj> > vecItemLevel;
613  while(!p_parser->isEndOfFile() && p_run && !p_parser->isMatch("\n\n")){
614  //Let's parse the current item
615  parseEnumerateItem(vecItemLevel);
616  }
617  insertItemInItemize(tmp, vecItemLevel, PLatexType::ENUMERATE);
618 
619  addLatexObj(parent, tmp);
620  return true;
621 }
bool parseEnumerateItem(std::vector< std::pair< size_t, PLatexObj > > &vecItemLevel)
Parse an item in the markdown enumerate.
bool isEnumerateItem(bool rewind=false)
Say if there is no space between the last return and the current char.
void insertItemInItemize(PLatexObj &parent, const std::vector< std::pair< size_t, PLatexObj > > &vecItemLevel, PLatexType::PLatexType listItemType)
Insert the item in the proper itemize.

References PGenericParser::addLatexObj(), PLatexType::ENUMERATE, insertItemInItemize(), PFileParser::isEndOfFile(), isEnumerateItem(), PFileParser::isMatch(), PMultiFileParser::p_parser, PMultiFileParser::p_run, parseEnumerateItem(), PGenericParser::playTextLatexObj(), and PLatexObj::setType().

Referenced by parseEnvLatexObj().

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

◆ parseEnumerateItem()

bool PMarkdownParser::parseEnumerateItem ( std::vector< std::pair< size_t, PLatexObj > > &  vecItemLevel)
private

Parse an item in the markdown enumerate.

Parameters
[out]vecItemLevel: vector of itemize level
Returns
true on success, false otherwise

Definition at line 546 of file PMarkdownParser.cpp.

546  {
547  if(p_parser->isMatchRewind("\n\n")){return false;}
548  if(!isEnumerateItem()){
549  return false;
550  }
551  size_t itemLevel(p_parser->getColumn());
552  PLatexObj itemObj;
553  itemObj.setType(PLatexType::ITEM);
554 
555  PLatexObj tmpText;
556  tmpText.setType(PLatexType::TEXT);
557 
558  //Do some loop to fill the item
559  while(!p_parser->isEndOfFile() && !p_parser->isMatchRewind("\n\n") && !isEnumerateItem(true) && p_run){
560  if(parseItemLatexObj(itemObj, tmpText)){}
561  else{
562  incrementCurrentChar(tmpText);
563  }
564  }
565  playTextLatexObj(itemObj, tmpText);
566  vecItemLevel.push_back(std::pair<size_t, PLatexObj>(itemLevel, itemObj));
567  return true;
568 }
void incrementCurrentChar(PLatexObj &textObj)
Increment current char position.
bool parseItemLatexObj(PLatexObj &parent, PLatexObj &textObj)
Parse all the latex obj in item, but in markdown style.

References PFileParser::getColumn(), PGenericParser::incrementCurrentChar(), PFileParser::isEndOfFile(), isEnumerateItem(), PFileParser::isMatchRewind(), PLatexType::ITEM, PMultiFileParser::p_parser, PMultiFileParser::p_run, parseItemLatexObj(), PGenericParser::playTextLatexObj(), PLatexObj::setType(), and PLatexType::TEXT.

Referenced by parseEnumerate().

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

◆ parseEnvDecoration()

bool PMarkdownParser::parseEnvDecoration ( PLatexObj parent,
PLatexObj textObj,
const PString patern,
const PString cssStyle,
PLatexType::PLatexType  type,
const PString balise 
)
private

Parse a text decoration (bold, italic, etc)

Parameters
[out]parent: parent PLatexObj
[out]textObj: PLatexObj to deal with text
patern: begin and end patern of the markdown command
cssStyle: css style to put in the PLatexObj
type: type of the object to be parsed
balise: delimitor of the object to be parsed
Returns
true on success, false otherwise

Definition at line 244 of file PMarkdownParser.cpp.

246 {
247  if(!p_parser->isMatch(patern)){return false;}
248  playTextLatexObj(parent, textObj);
249  PLatexObj tmp;
250  tmp.setType(type);
251  tmp.setName(cssStyle);
252  tmp.setBalise(balise);
253 
254  parseVecLatexObj(tmp, textObj, "", patern);
255  addLatexObj(parent, tmp);
256  return true;
257 }
void setBalise(const PString &balise)
Sets the balise of the PLatexObj.
Definition: PLatexObj.cpp:172

References PGenericParser::addLatexObj(), PFileParser::isMatch(), PMultiFileParser::p_parser, parseVecLatexObj(), PGenericParser::playTextLatexObj(), PLatexObj::setBalise(), PLatexObj::setName(), and PLatexObj::setType().

Referenced by parseAllLatexObj().

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

◆ parseEnvLatexObj()

bool PMarkdownParser::parseEnvLatexObj ( PLatexObj parent,
PLatexObj textObj 
)
private

Parse all the latex obj in environement, but in markdown style.

Parameters
[out]parent: parent PLatexObj
[out]textObj: PLatexObj to deal with text
Returns
true on success, false otherwise

Definition at line 154 of file PMarkdownParser.cpp.

154  {
155  if(parseItemize(parent, textObj)){}
156  else if(parseEnumerate(parent, textObj)){}
157  else if(parseNewLine(parent, textObj)){}
158  else if(parseItemLatexObj(parent, textObj)){}
159  else{
160  return false;
161  }
162 
163  return true;
164 }
bool parseItemize(PLatexObj &parent, PLatexObj &textObj)
Parse some itemize.
bool parseNewLine(PLatexObj &parent, PLatexObj &textObj)
Parse a new line.
bool parseEnumerate(PLatexObj &parent, PLatexObj &textObj)
Parse some enumerate.

References parseEnumerate(), parseItemize(), parseItemLatexObj(), and parseNewLine().

Referenced by parseAllLatexObj(), parseExtraEnvironement(), and parseWip().

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

◆ parseExtraEnvironement()

bool PMarkdownParser::parseExtraEnvironement ( PLatexObj parent,
PLatexObj textObj 
)
private

Parse extra environement (terminal, cplusplus, cmake, conseil, attention, ...)

Parameters
[out]parent: parent PLatexObj
[out]textObj: PLatexObj to deal with text
Returns
true on success, false otherwise

Definition at line 655 of file PMarkdownParser.cpp.

655  {
656  if(p_vecNameMarkdownExtraEnv.size() == 0lu){return false;}
659  if(matchFunc == ""){
661  return false;
662  }
663 
664  playTextLatexObj(parent, textObj);
665  PLatexObj env;
667  PString matchEnv(matchFunc.eraseChar('`'));
668  env.setName(matchEnv);
669 
670  PEnvironement & configEnv = p_vecExtraEnv[matchEnv];
671  env.setBalise(configEnv.getBalise());
672  PLatexObj tmpText;
673  tmpText.setType(PLatexType::TEXT);
674 
675  while(!p_parser->isEndOfFile() && !p_parser->isMatch("```") && p_run){
676  if(parseEnvLatexObj(env, tmpText)){}
677  else{
678  incrementCurrentChar(tmpText);
679  }
680  }
681  playTextLatexObj(env, tmpText);
682 
683  addLatexObj(parent, env);
684  return true;
685 }
const PString & getBalise() const
Gets the balise of the PEnvironement.
Definition: PLatexObj.cpp:1145

References PGenericParser::addLatexObj(), PLatexType::ENVIRONEMENT, PString::eraseChar(), PEnvironement::getBalise(), PGenericParser::incrementCurrentChar(), PFileParser::isEndOfFile(), PFileParser::isMatch(), PMultiFileParser::p_parser, PMultiFileParser::p_run, PGenericParser::p_vecExtraEnv, PGenericParser::p_vecNameMarkdownExtraEnv, parseEnvLatexObj(), PGenericParser::playTextLatexObj(), PFileParser::popPosition(), PFileParser::pushPosition(), PLatexObj::setBalise(), PLatexObj::setName(), PLatexObj::setType(), and PLatexType::TEXT.

Referenced by parseAllLatexObj().

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

◆ parseExtraParser()

bool PMarkdownParser::parseExtraParser ( PLatexObj parent,
PLatexObj textObj 
)
private

Parse extra environement (terminal, cplusplus, cmake, conseil, attention, ...)

Parameters
[out]parent: parent PLatexObj
[out]textObj: PLatexObj to deal with text
Returns
true on success, false otherwise

Definition at line 693 of file PMarkdownParser.cpp.

693  {
694  if(p_vecNameMarkdownExtraParser.size() == 0lu){return false;}
697  if(matchFunc == ""){
699  return false;
700  }
701 
702  playTextLatexObj(parent, textObj);
703  PLatexObj tmp;
705  PString matchEnv(matchFunc.eraseChar('`'));
706  tmp.setName(matchEnv);
707 
708  PParserEnv parser(getParserEnv(p_vecExtraParser, matchEnv));
709 
710  PString inputFileContent(p_parser->getUntilKeyWithoutPatern("```").eraseFirstLastChar(" \n") + "\n");
711 
712  tmp.setNbline(inputFileContent.count('\n'));
713 
714  PString envContent(parser_makeHighlighting(inputFileContent, parser));
715  tmp.setText(envContent);
716  tmp.setSubTitle(inputFileContent);
717  addLatexObj(parent, tmp);
718  return true;
719 }
void setNbline(long unsigned int nbline)
Sets the nbline of the PLatexObj.
Definition: PLatexObj.cpp:193
void setSubTitle(const PString &subTitle)
Sets the subTitle of the PLatexObj.
Definition: PLatexObj.cpp:151
PString eraseFirstLastChar(const PString &vecChar) const
Erase first and last char in a string.
Definition: PString.cpp:545
PString parser_makeHighlighting(const PString &strContent, const PParserEnv &parser)
Do the highlighting of the input text.
PParserEnv getParserEnv(const PVecParserEnv &vecParser, const PString &nameParser)
Get the parser env.

References PGenericParser::addLatexObj(), PString::count(), PString::eraseChar(), PString::eraseFirstLastChar(), getParserEnv(), PFileParser::getUntilKeyWithoutPatern(), PFileParser::isMatch(), PMultiFileParser::p_parser, PGenericParser::p_vecExtraParser, PGenericParser::p_vecNameMarkdownExtraParser, PLatexType::PARSER, parser_makeHighlighting(), PGenericParser::playTextLatexObj(), PFileParser::popPosition(), PFileParser::pushPosition(), PLatexObj::setName(), PLatexObj::setNbline(), PLatexObj::setSubTitle(), PLatexObj::setText(), and PLatexObj::setType().

Referenced by parseAllLatexObj().

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

◆ parseFile()

bool PMarkdownParser::parseFile ( )
protectedvirtual

Parse the input file.

Returns
true on success, false otherwise

Implements PMultiFileParser.

Definition at line 61 of file PMarkdownParser.cpp.

61  {
62  if(!p_run) return false;
64  p_currentSource.setLink("index.html");
68 
69  //To parse the file we need to read char by char until we get something we know
70  while(!p_parser->isEndOfFile() && p_run){ //If we are not at the end of the file
72  else{
74  }
75  }
77  return true;
78 }
void setLink(const PString &link)
Sets the link of the PLatexObj.
Definition: PLatexObj.cpp:165
void setSourceFile(const PString &sourceFile)
Sets the sourceFile of the PLatexObj.
Definition: PLatexObj.cpp:249
void setSourceLine(size_t sourceLine)
Sets the sourceLine of the PLatexObj.
Definition: PLatexObj.cpp:256
bool parseAllLatexObj(PLatexObj &parent, PLatexObj &textObj)
Parse all the latex obj, but in markdown style.

References PPath::eraseExtension(), PLatexType::FILE, PPath::getFileName(), PFileParser::getFileName(), PGenericParser::incrementCurrentChar(), PFileParser::isEndOfFile(), PGenericParser::p_currentSource, PGenericParser::p_currentText, PMultiFileParser::p_parser, PMultiFileParser::p_run, parseAllLatexObj(), PGenericParser::playTextLatexObj(), PLatexObj::setLink(), PLatexObj::setName(), PLatexObj::setSourceFile(), PLatexObj::setSourceLine(), and PLatexObj::setType().

+ Here is the call graph for this function:

◆ parseGenericLatexObj()

bool PGenericParser::parseGenericLatexObj ( PLatexObj parent,
PLatexObj textObj 
)
protectedinherited

Parse the generic latex function which have to be used in the latex parser and the markdown parser too.

Parameters
[out]parent: parent PLatexObj
[out]textObj: PLatexObj to deal with text
Returns
true on success, false otherwise

Definition at line 385 of file PGenericParser.cpp.

385  {
386  if(parseMonoParam(parent, textObj, "\\updateStyle", PLatexType::UPDATESTYLE)){}
387  else if(parseMonoParam(parent, textObj, "\\ref", PLatexType::REF)){}
388  else if(parseMonoParam(parent, textObj, "\\cite", PLatexType::CITATION)){}
389  else if(parseLabel(parent, textObj)){}
390  else if(parserGetEnv(parent, textObj)){}
391  else if(parseMainTitle(parent, textObj)){}
392  else if(parseMainSubTitle(parent, textObj)){}
393  else if(parseMainAuthor(parent, textObj)){}
394  else if(parseMainDate(parent, textObj)){}
395  else if(parseBookSizeBarWidth(parent, textObj)){}
396  else if(parseBookGitlabUrl(parent, textObj)){}
397  else if(parseBookEnableFeedback(parent, textObj)){}
398  else if(parseBookMail(parent, textObj)){}
399  else if(parseBookMasterProject(parent, textObj)){}
400  else{return false;}
401  return true;
402 }
bool parserGetEnv(PLatexObj &parent, PLatexObj &textObj)
Parse a getenv function.
bool parseBookMail(PLatexObj &parent, PLatexObj &textObj)
Parse the mail in book mode.
bool parseBookSizeBarWidth(PLatexObj &parent, PLatexObj &textObj)
Parse the width of the book sidebar.
bool parseBookGitlabUrl(PLatexObj &parent, PLatexObj &textObj)
Parse the gitlab url in book mode.
bool parseMainDate(PLatexObj &parent, PLatexObj &textObj)
Parse the main date of the site.
bool parseMainSubTitle(PLatexObj &parent, PLatexObj &textObj)
Parse the main title of the site.
bool parseMainAuthor(PLatexObj &parent, PLatexObj &textObj)
Parse the main author of the site.
bool parseBookEnableFeedback(PLatexObj &parent, PLatexObj &textObj)
Parse the book enable feedback mode.
bool parseMainTitle(PLatexObj &parent, PLatexObj &textObj)
Parse the main title of the site.
bool parseBookMasterProject(PLatexObj &parent, PLatexObj &textObj)
Parse the master project in book mode.
bool parseMonoParam(PLatexObj &parent, PLatexObj &textObj, const PString &functionName, PLatexType::PLatexType type)
Parse all the functions which have mono parameter in braces {...}.
bool parseLabel(PLatexObj &parent, PLatexObj &textObj)
Parse latex label.

References PLatexType::CITATION, PGenericParser::parseBookEnableFeedback(), PGenericParser::parseBookGitlabUrl(), PGenericParser::parseBookMail(), PGenericParser::parseBookMasterProject(), PGenericParser::parseBookSizeBarWidth(), PGenericParser::parseLabel(), PGenericParser::parseMainAuthor(), PGenericParser::parseMainDate(), PGenericParser::parseMainSubTitle(), PGenericParser::parseMainTitle(), PGenericParser::parseMonoParam(), PGenericParser::parserGetEnv(), PLatexType::REF, and PLatexType::UPDATESTYLE.

Referenced by PConfigParser::parseAllLatexObj(), and parseAllLatexObj().

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

◆ parseHref()

bool PMarkdownParser::parseHref ( PLatexObj parent,
PLatexObj textObj 
)
private

Parse latex Href.

Parameters
[out]parent: parent PLatexObj
[out]textObj: PLatexObj to deal with text
Returns
true on success, false otherwise

Definition at line 318 of file PMarkdownParser.cpp.

318  {
320  if(!p_parser->isMatch("[")){return false;}
321  playTextLatexObj(parent, textObj);
322  PLatexObj tmp;
324 
325  parseVecLatexObj(tmp, textObj, "", "]"); //We alrday parse the begin patern at the begining of this method
326  if(!p_parser->isMatch("(")){
328  return false;
329  }
331  tmp.setName(link);
332 
333  if(!tmp.getName().isSameBegining("http") && !tmp.getName().isSameBegining("https")){
334  PString buildFileName(copyFile(PPath(LATEX_RESSOURCES_OUTPUT_DIR), link));
335  if(buildFileName == ""){
336  if(PPath(tmp.getName()).getExtension() != "html"){
337  errorAt();
338  std::cerr << "PMarkdownParser::parseHref : cannot copy file '"<<link<<"' in '" LATEX_RESSOURCES_OUTPUT_DIR "'" << std::endl;
339  return true;
340  }
341  buildFileName = link;
342  }
343  tmp.setName(buildFileName);
344  }
345  addLatexObj(parent, tmp);
346  return true;
347 }
#define LATEX_RESSOURCES_OUTPUT_DIR
Definition: PLatexObj_def.h:13
PPath copyFile(const PPath &outputDir, const PPath &fileName)
Copy a file.
const PString & getName() const
Gets the name of the PLatexObj.
Definition: PLatexObj.cpp:326
PString getExtension() const
Get file extension.
Definition: PPath.cpp:252
bool isSameBegining(const PString &beginStr) const
Say if the current PString has the same begining of beginStr.
Definition: PString.cpp:306

References PGenericParser::addLatexObj(), PGenericParser::copyFile(), PMultiFileParser::errorAt(), PPath::getExtension(), PLatexObj::getName(), PFileParser::getUntilKeyWithoutPaternRecurse(), PLatexType::HREF, PFileParser::isMatch(), PString::isSameBegining(), LATEX_RESSOURCES_OUTPUT_DIR, PMultiFileParser::p_parser, parseVecLatexObj(), PGenericParser::playTextLatexObj(), PFileParser::popPosition(), PFileParser::pushPosition(), PLatexObj::setName(), and PLatexObj::setType().

Referenced by parseItemLatexObj().

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

◆ parseIncludeGraphic()

bool PMarkdownParser::parseIncludeGraphic ( PLatexObj parent,
PLatexObj textObj 
)
private

Parse the includegraphic command.

Parameters
[out]parent: parent PLatexObj
[out]textObj: PLatexObj to deal with text
Returns
true on success, false otherwise

Definition at line 264 of file PMarkdownParser.cpp.

264  {
265  if(!p_parser->isMatch("![")){return false;}
266  playTextLatexObj(parent, textObj);
268  if(!p_parser->isMatch("(")){
269  errorAt();
270  std::cerr << "PMarkdownParser::parseIncludeGraphic : expect '(' after '!["+option+"]' instead of '"<<p_parser->getNextChar()<<"'" << std::endl;
271  stopParsing();
272  return "";
273  }
274  PPath imageFile(p_parser->getUntilKeyWithoutPatern(")"));
275  PLatexObj tmp;
276  bool isVideo(imageFile.getExtension() == "mp4");
277  if(isVideo){ //This is not an image
279  }else{
281  }
282  PString outputDir(LATEX_IMAGE_OUTPUT_DIR);
283  if(isVideo){
284  outputDir = LATEX_VIDEO_OUTPUT_DIR;
285  }
286  PString buildFileName(copyFile(outputDir, imageFile));
287  if(buildFileName == ""){return true;}
288  tmp.setName(buildFileName);
289  tmp.setText(option);
290 
291  addLatexObj(parent, tmp);
292  return true;
293 }
#define LATEX_IMAGE_OUTPUT_DIR
Definition: PLatexObj_def.h:11
#define LATEX_VIDEO_OUTPUT_DIR
Definition: PLatexObj_def.h:12

References PGenericParser::addLatexObj(), PGenericParser::copyFile(), PMultiFileParser::errorAt(), PPath::getExtension(), PFileParser::getNextChar(), PFileParser::getUntilKeyWithoutPatern(), PLatexType::IMAGE, PFileParser::isMatch(), LATEX_IMAGE_OUTPUT_DIR, LATEX_VIDEO_OUTPUT_DIR, PMultiFileParser::p_parser, PGenericParser::playTextLatexObj(), PLatexObj::setName(), PLatexObj::setText(), PLatexObj::setType(), PMultiFileParser::stopParsing(), and PLatexType::VIDEO.

Referenced by parseItemLatexObj().

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

◆ parseItem()

bool PMarkdownParser::parseItem ( std::vector< std::pair< size_t, PLatexObj > > &  vecItemLevel)
private

Parse an item in the markdown itemize.

Parameters
[out]vecItemLevel: vector of itemize level
Returns
true on success, false otherwise

Definition at line 397 of file PMarkdownParser.cpp.

397  {
398  if(p_parser->isMatchRewind("\n\n")){return false;}
399  if(!isItem()){
400  return false;
401  }
402  size_t itemLevel(p_parser->getColumn());
403  PLatexObj itemObj;
404  itemObj.setType(PLatexType::ITEM);
405 
406  PLatexObj tmpText;
407  tmpText.setType(PLatexType::TEXT);
408 
409  //Do some loop to fill the item
410  while(!p_parser->isEndOfFile() && !p_parser->isMatchRewind("\n\n") && !isItem(true) && p_run){
411  if(parseItemLatexObj(itemObj, tmpText)){}
412  else{
413  incrementCurrentChar(tmpText);
414  }
415  }
416  playTextLatexObj(itemObj, tmpText);
417  vecItemLevel.push_back(std::pair<size_t, PLatexObj>(itemLevel, itemObj));
418  return true;
419 }
bool isItem(bool rewind=false)
Say if there is no space between the last return and the current char.

References PFileParser::getColumn(), PGenericParser::incrementCurrentChar(), PFileParser::isEndOfFile(), isItem(), PFileParser::isMatchRewind(), PLatexType::ITEM, PMultiFileParser::p_parser, PMultiFileParser::p_run, parseItemLatexObj(), PGenericParser::playTextLatexObj(), PLatexObj::setType(), and PLatexType::TEXT.

Referenced by parseItemize().

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

◆ parseItemize()

bool PMarkdownParser::parseItemize ( PLatexObj parent,
PLatexObj textObj 
)
private

Parse some itemize.

Parameters
[out]parent: parent PLatexObj
[out]textObj: PLatexObj to deal with text
Returns
true on success, false otherwise

Definition at line 525 of file PMarkdownParser.cpp.

525  {
526  if(!isItem(true)){return false;}
527  playTextLatexObj(parent, textObj);
528  PLatexObj tmp;
530  std::vector<std::pair<size_t, PLatexObj> > vecItemLevel;
531  while(!p_parser->isEndOfFile() && p_run && !p_parser->isMatch("\n\n")){
532  //Let's parse the current item
533  parseItem(vecItemLevel);
534  }
535 
536  insertItemInItemize(tmp, vecItemLevel, PLatexType::ITEMIZE);
537 
538  addLatexObj(parent, tmp);
539  return true;
540 }
bool parseItem(std::vector< std::pair< size_t, PLatexObj > > &vecItemLevel)
Parse an item in the markdown itemize.

References PGenericParser::addLatexObj(), insertItemInItemize(), PFileParser::isEndOfFile(), isItem(), PFileParser::isMatch(), PLatexType::ITEMIZE, PMultiFileParser::p_parser, PMultiFileParser::p_run, parseItem(), PGenericParser::playTextLatexObj(), and PLatexObj::setType().

Referenced by parseEnvLatexObj().

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

◆ parseItemLatexObj()

bool PMarkdownParser::parseItemLatexObj ( PLatexObj parent,
PLatexObj textObj 
)
private

Parse all the latex obj in item, but in markdown style.

Parameters
[out]parent: parent PLatexObj
[out]textObj: PLatexObj to deal with text
Returns
true on success, false otherwise

Definition at line 171 of file PMarkdownParser.cpp.

171  {
172  if(parseComment(parent, textObj)){}
173  else if(parseTextDecoration(parent, textObj, "***", "textbfit", PLatexType::FUNCTION, "span")){}
174  else if(parseTextDecoration(parent, textObj, "**", "textbf", PLatexType::FUNCTION, "span")){}
175  else if(parseTextDecoration(parent, textObj, "*", "textit", PLatexType::FUNCTION, "span")){}
176  else if(parseTextDecoration(parent, textObj, "`", "code", PLatexType::FUNCTION, "span")){}
177 
178  else if(parseHref(parent, textObj)){}
179  else if(parseIncludeGraphic(parent, textObj)){}
180  else if(parseUrl(parent, textObj)){}
181  else if(parsePercent(parent, textObj)){}
182  else{
183  return false;
184  }
185  return true;
186 }
bool parseHref(PLatexObj &parent, PLatexObj &textObj)
Parse latex Href.
bool parseUrl(PLatexObj &parent, PLatexObj &textObj)
Parse latex url.
bool parseTextDecoration(PLatexObj &parent, PLatexObj &textObj, const PString &patern, const PString &cssStyle, PLatexType::PLatexType type, const PString &balise)
Parse a text decoration (bold, italic, etc)
bool parsePercent(PLatexObj &parent, PLatexObj &textObj)
Parse latex percent.
bool parseComment(PLatexObj &parent, PLatexObj &textObj)
Parse a new line.
bool parseIncludeGraphic(PLatexObj &parent, PLatexObj &textObj)
Parse the includegraphic command.

References PLatexType::FUNCTION, parseComment(), parseHref(), parseIncludeGraphic(), parsePercent(), parseTextDecoration(), and parseUrl().

Referenced by parseEnumerateItem(), parseEnvLatexObj(), and parseItem().

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

◆ parseLabel()

bool PGenericParser::parseLabel ( PLatexObj parent,
PLatexObj textObj 
)
protectedinherited

Parse latex label.

Parameters
[out]parent: parent PLatexObj
[out]textObj: PLatexObj to deal with text
Returns
true on success, false otherwise

Definition at line 409 of file PGenericParser.cpp.

409  {
410  if(!p_parser->isMatchToken("\\label")){return false;}
411  playTextLatexObj(parent, textObj);
412  PString link(getStringBetweenBraces("\\label"));
413 
414  PLatexObj* ptrLatex = getLastPLatexObj(parent);
415  if(ptrLatex != NULL){
416  ptrLatex->setLabelName(link);
417  }
418  return true;
419 }
PLatexObj * getLastPLatexObj(PLatexObj &obj)
Get the last PLatexObj of the given one.

References getLastPLatexObj(), PGenericParser::getStringBetweenBraces(), PFileParser::isMatchToken(), PMultiFileParser::p_parser, PGenericParser::playTextLatexObj(), and PLatexObj::setLabelName().

Referenced by PGenericParser::parseGenericLatexObj().

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

◆ parseMainAuthor()

bool PGenericParser::parseMainAuthor ( PLatexObj parent,
PLatexObj textObj 
)
protectedinherited

Parse the main author of the site.

Parameters
[out]parent: parent PLatexObj
[out]textObj: PLatexObj to deal with text
Returns
true on success, false otherwise

Definition at line 469 of file PGenericParser.cpp.

469  {
470  if(!p_parser->isMatchToken("\\author")){return false;}
471  playTextLatexObj(parent, textObj);
472  PString title(getStringBetweenBraces("\\author"));
473  parent.setAuthor(executeLatexCommand(title));
474  return true;
475 }
void setAuthor(const PString &author)
Sets the author of the PLatexObj.
Definition: PLatexObj.cpp:235

References PGenericParser::executeLatexCommand(), PGenericParser::getStringBetweenBraces(), PFileParser::isMatchToken(), PMultiFileParser::p_parser, PGenericParser::playTextLatexObj(), and PLatexObj::setAuthor().

Referenced by PGenericParser::parseGenericLatexObj().

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

◆ parseMainDate()

bool PGenericParser::parseMainDate ( PLatexObj parent,
PLatexObj textObj 
)
protectedinherited

Parse the main date of the site.

Parameters
[out]parent: parent PLatexObj
[out]textObj: PLatexObj to deal with text
Returns
true on success, false otherwise

Definition at line 482 of file PGenericParser.cpp.

482  {
483  if(!p_parser->isMatchToken("\\date")){return false;}
484  playTextLatexObj(parent, textObj);
485  PString title(getStringBetweenBraces("\\date"));
486  parent.setDate(executeLatexCommand(title));
487  return true;
488 }
void setDate(const PString &date)
Sets the date of the PLatexObj.
Definition: PLatexObj.cpp:242

References PGenericParser::executeLatexCommand(), PGenericParser::getStringBetweenBraces(), PFileParser::isMatchToken(), PMultiFileParser::p_parser, PGenericParser::playTextLatexObj(), and PLatexObj::setDate().

Referenced by PGenericParser::parseGenericLatexObj().

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

◆ parseMainSubTitle()

bool PGenericParser::parseMainSubTitle ( PLatexObj parent,
PLatexObj textObj 
)
protectedinherited

Parse the main title of the site.

Parameters
[out]parent: parent PLatexObj
[out]textObj: PLatexObj to deal with text
Returns
true on success, false otherwise

Definition at line 456 of file PGenericParser.cpp.

456  {
457  if(!p_parser->isMatchToken("\\subtitle")){return false;}
458  playTextLatexObj(parent, textObj);
459  PString title(getStringBetweenBraces("\\subtitle"));
460  parent.setSubTitle(executeLatexCommand(title));
461  return true;
462 }

References PGenericParser::executeLatexCommand(), PGenericParser::getStringBetweenBraces(), PFileParser::isMatchToken(), PMultiFileParser::p_parser, PGenericParser::playTextLatexObj(), and PLatexObj::setSubTitle().

Referenced by PGenericParser::parseGenericLatexObj().

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

◆ parseMainTitle()

bool PGenericParser::parseMainTitle ( PLatexObj parent,
PLatexObj textObj 
)
protectedinherited

Parse the main title of the site.

Parameters
[out]parent: parent PLatexObj
[out]textObj: PLatexObj to deal with text
Returns
true on success, false otherwise

Definition at line 443 of file PGenericParser.cpp.

443  {
444  if(!p_parser->isMatchToken("\\title")){return false;}
445  playTextLatexObj(parent, textObj);
446  PString title(getStringBetweenBraces("\\title"));
447  parent.setName(executeLatexCommand(title));
448  return true;
449 }

References PGenericParser::executeLatexCommand(), PGenericParser::getStringBetweenBraces(), PFileParser::isMatchToken(), PMultiFileParser::p_parser, PGenericParser::playTextLatexObj(), and PLatexObj::setName().

Referenced by PGenericParser::parseGenericLatexObj().

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

◆ parseMonoParam()

bool PGenericParser::parseMonoParam ( PLatexObj parent,
PLatexObj textObj,
const PString functionName,
PLatexType::PLatexType  type 
)
protectedinherited

Parse all the functions which have mono parameter in braces {...}.

Parameters
[out]parent: parent PLatexObj
[out]textObj: PLatexObj to deal with text
functionName: name of the expected function
type: type of the expected function
Returns
true on success, false otherwise

Definition at line 364 of file PGenericParser.cpp.

364  {
365  if(!p_parser->isMatch(functionName)){return false;}
366  playTextLatexObj(parent, textObj);
367  PLatexObj tmp;
368  tmp.setType(type);
369 
370  PString textOption(getOptionStringBetweenHook());
371  tmp.setText(textOption);
372 
373  PString title(getStringBetweenBraces(functionName));
374  tmp.setName(title);
375 
376  addLatexObj(parent, tmp);
377  return true;
378 }

References PGenericParser::addLatexObj(), PGenericParser::getOptionStringBetweenHook(), PGenericParser::getStringBetweenBraces(), PFileParser::isMatch(), PMultiFileParser::p_parser, PGenericParser::playTextLatexObj(), PLatexObj::setName(), PLatexObj::setText(), and PLatexObj::setType().

Referenced by PConfigParser::parseAllLatexObj(), and PGenericParser::parseGenericLatexObj().

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

◆ parseNewLine()

bool PMarkdownParser::parseNewLine ( PLatexObj parent,
PLatexObj textObj 
)
private

Parse a new line.

Parameters
[out]parent: parent PLatexObj
[out]textObj: PLatexObj to deal with text
Returns
true on success, false otherwise

Definition at line 368 of file PMarkdownParser.cpp.

368  {
369  if(!p_parser->isMatch("\n\n")){return false;}
370  playTextLatexObj(parent, textObj);
371  PLatexObj tmp;
373  addLatexObj(parent, tmp);
374  return true;
375 }
@ AUTOSPACEPARAGRAPH
Definition: PLatexType.h:28

References PGenericParser::addLatexObj(), PLatexType::AUTOSPACEPARAGRAPH, PFileParser::isMatch(), PMultiFileParser::p_parser, PGenericParser::playTextLatexObj(), and PLatexObj::setType().

Referenced by parseEnvLatexObj().

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

◆ parsePercent()

bool PMarkdownParser::parsePercent ( PLatexObj parent,
PLatexObj textObj 
)
private

Parse latex percent.

Parameters
[out]parent: parent PLatexObj
[out]textObj: PLatexObj to deal with text
Returns
true on success, false otherwise

Definition at line 354 of file PMarkdownParser.cpp.

354  {
355  if(!p_parser->isMatch("%")){return false;}
356  playTextLatexObj(parent, textObj);
357  PLatexObj tmp;
359  addLatexObj(parent, tmp);
360  return true;
361 }

References PGenericParser::addLatexObj(), PFileParser::isMatch(), PMultiFileParser::p_parser, PLatexType::PERCENT, PGenericParser::playTextLatexObj(), and PLatexObj::setType().

Referenced by parseItemLatexObj().

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

◆ parserGetEnv()

bool PGenericParser::parserGetEnv ( PLatexObj parent,
PLatexObj textObj 
)
protectedinherited

Parse a getenv function.

Parameters
[out]parent: parent PLatexObj
[out]textObj: PLatexObj to deal with text
Returns
true on success, false otherwise

Definition at line 426 of file PGenericParser.cpp.

426  {
427  if(!p_parser->isMatchToken("\\getenv")){return false;}
428  playTextLatexObj(parent, textObj);
429  PString title(getStringBetweenBraces("\\getenv"));
430  PLatexObj tmp;
432  tmp.setName(title);
433  addLatexObj(parent, tmp);
434 
435  return true;
436 }

References PGenericParser::addLatexObj(), PLatexType::GETENV, PGenericParser::getStringBetweenBraces(), PFileParser::isMatchToken(), PMultiFileParser::p_parser, PGenericParser::playTextLatexObj(), PLatexObj::setName(), and PLatexObj::setType().

Referenced by PGenericParser::parseGenericLatexObj().

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

◆ parseSectionTitle()

bool PMarkdownParser::parseSectionTitle ( PLatexObj parent,
PLatexObj textObj,
const PString functionName,
PLatexType::PLatexType  type 
)
private

Parse all the functions which have complex mono parameter in braces.

Parameters
[out]parent: parent PLatexObj
[out]textObj: PLatexObj to deal with text
functionName: name of the expected function
type: type of the expected function
Returns
true on success, false otherwise

Definition at line 195 of file PMarkdownParser.cpp.

195  {
196  if(!p_parser->isMatch(functionName)){return false;}
197  playTextLatexObj(parent, textObj);
198  PLatexObj tmp;
199  tmp.setType(type);
202 
203  PLatexObj objTitle;
204  parseVecLatexObj(objTitle, textObj, "", "\n");
205  tmp.setComplexTitle(objTitle.getVecContent());
206  addLatexObj(parent, tmp);
207  return true;
208 }
void setComplexTitle(const std::vector< PLatexObj > &complexTitle)
Sets the complexTitle of the PLatexObj.
Definition: PLatexObj.cpp:179
size_t getLine() const
renvoie la ligne du PLocation
Definition: PLocation.cpp:67
PPath getFileName() const
renvoie le fichier du PLocation
Definition: PLocation.cpp:60

References PGenericParser::addLatexObj(), PLocation::getFileName(), PLocation::getLine(), PFileParser::getLocation(), PLatexObj::getVecContent(), PFileParser::isMatch(), PMultiFileParser::p_parser, parseVecLatexObj(), PGenericParser::playTextLatexObj(), PLatexObj::setComplexTitle(), PLatexObj::setSourceFile(), PLatexObj::setSourceLine(), and PLatexObj::setType().

Referenced by parseAllLatexObj().

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

◆ parseTextDecoration()

bool PMarkdownParser::parseTextDecoration ( PLatexObj parent,
PLatexObj textObj,
const PString patern,
const PString cssStyle,
PLatexType::PLatexType  type,
const PString balise 
)
private

Parse a text decoration (bold, italic, etc)

Parameters
[out]parent: parent PLatexObj
[out]textObj: PLatexObj to deal with text
patern: begin and end patern of the markdown command
cssStyle: css style to put in the PLatexObj
type: type of the object to be parsed
balise: delimitor of the object to be parsed
Returns
true on success, false otherwise

Definition at line 219 of file PMarkdownParser.cpp.

221 {
222  if(p_parser->isMatch("```")){return false;}
223  if(!p_parser->isMatch(patern)){return false;}
224  playTextLatexObj(parent, textObj);
225  PLatexObj tmp;
226  tmp.setType(type);
227  tmp.setName(cssStyle);
228  tmp.setBalise(balise);
229 
230  parseVecLatexObj(tmp, textObj, "", patern);
231  addLatexObj(parent, tmp);
232  return true;
233 }

References PGenericParser::addLatexObj(), PFileParser::isMatch(), PMultiFileParser::p_parser, parseVecLatexObj(), PGenericParser::playTextLatexObj(), PLatexObj::setBalise(), PLatexObj::setName(), and PLatexObj::setType().

Referenced by parseItemLatexObj().

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

◆ parseUrl()

bool PMarkdownParser::parseUrl ( PLatexObj parent,
PLatexObj textObj 
)
private

Parse latex url.

Parameters
[out]parent: parent PLatexObj
[out]textObj: PLatexObj to deal with text
Returns
true on success, false otherwise

Definition at line 300 of file PMarkdownParser.cpp.

300  {
301  if(!p_parser->isMatch("http")){return false;}
302  playTextLatexObj(parent, textObj);
303  PLatexObj tmp;
305 
306  PString link("http" + p_parser->getUntilKeyWithoutPatern(" "));
307  tmp.setName(link);
308 
309  addLatexObj(parent, tmp);
310  return true;
311 }

References PGenericParser::addLatexObj(), PFileParser::getUntilKeyWithoutPatern(), PFileParser::isMatch(), PMultiFileParser::p_parser, PGenericParser::playTextLatexObj(), PLatexObj::setName(), PLatexObj::setType(), and PLatexType::URL.

Referenced by parseItemLatexObj().

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

◆ parseVecLatexObj()

void PMarkdownParser::parseVecLatexObj ( PLatexObj parent,
PLatexObj textObj,
const PString beginPatern,
const PString endPatern 
)
private

Parse a vector of latex object.

Parameters
[out]parent: parent PLatexObj
[out]textObj: PLatexObj to deal with text
beginPatern: starting partern to start the parsing of the vector of PLatexObj (disabled is empty)
endPatern: end patern of the vector of latex obj

Definition at line 629 of file PMarkdownParser.cpp.

629  {
630  if(beginPatern != ""){ //If we check the begin patern
631  if(!p_parser->isMatch(beginPatern)){ //And it does not match
632  return; //We stop
633  }
634  }
635  while(!p_parser->isEndOfFile() && p_run && !p_parser->isMatch(endPatern)){
636  long unsigned int currentPos = p_parser->getCurrentCharIdx();
637 
638  if(parseAllLatexObj(parent, textObj)){}
639  else{
640  incrementCurrentChar(textObj);
641  }
642  if(currentPos == p_parser->getCurrentCharIdx() && !p_parser->isEndOfFile()){
643  std::cerr << "PMarkdownParser::parseVecLatexObj : the parser is stucked at the position :" << std::endl << "\t" << p_parser->getLocation() << std::endl;
644  p_run = false;
645  }
646  }
647  if(p_run) playTextLatexObj(parent, textObj);
648 }

References PFileParser::getCurrentCharIdx(), PFileParser::getLocation(), PGenericParser::incrementCurrentChar(), PFileParser::isEndOfFile(), PFileParser::isMatch(), PMultiFileParser::p_parser, PMultiFileParser::p_run, parseAllLatexObj(), and PGenericParser::playTextLatexObj().

Referenced by parseComplexMonoParam(), parseEnvDecoration(), parseHref(), parseSectionTitle(), and parseTextDecoration().

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

◆ parseWip()

bool PMarkdownParser::parseWip ( PLatexObj parent,
PLatexObj textObj 
)
private

Parse a work in progress.

Parameters
[out]parent: parent PLatexObj
[out]textObj: PLatexObj to deal with text
Returns
true on success, false otherwise

Definition at line 726 of file PMarkdownParser.cpp.

726  {
727  if(!p_parser->isMatch("```wip")){return false;}
728 
729  playTextLatexObj(parent, textObj);
730  PLatexObj env;
732 
733  PLatexObj tmpText;
734  tmpText.setType(PLatexType::TEXT);
735 
736  while(!p_parser->isEndOfFile() && !p_parser->isMatch("```") && p_run){
737  if(parseEnvLatexObj(env, tmpText)){}
738  else{
739  incrementCurrentChar(tmpText);
740  }
741  }
742  playTextLatexObj(env, tmpText);
743 
744  addLatexObj(parent, env);
745  return true;
746 }
@ WORK_IN_PROGRESS
Definition: PLatexType.h:32

References PGenericParser::addLatexObj(), PGenericParser::incrementCurrentChar(), PFileParser::isEndOfFile(), PFileParser::isMatch(), PMultiFileParser::p_parser, PMultiFileParser::p_run, parseEnvLatexObj(), PGenericParser::playTextLatexObj(), PLatexObj::setType(), PLatexType::TEXT, and PLatexType::WORK_IN_PROGRESS.

Referenced by parseAllLatexObj().

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

◆ playTextLatexObj()

bool PGenericParser::playTextLatexObj ( PLatexObj parent,
PLatexObj textObj,
bool  isRemoveFirstLastSpace = false 
)
protectedinherited

Play the text latex obj.

Parameters
[out]parent: parent PMacro
[out]textObj: PLatexObj to deal with text
isRemoveFirstLastSpace: true to remove first and last spaces (tabs and newline) before added the text object
Returns
true if the textObj is added, false otherwise

Definition at line 279 of file PGenericParser.cpp.

279  {
280  if(isRemoveFirstLastSpace){
281  textObj.setText(textObj.getText().eraseFirstLastChar(" \t\n"));
282  }
283  if(textObj.getText() != ""){
284  parent.getVecContent().push_back(textObj);
285  clearLatexObj(textObj);
286  return true;
287  }
288  return false;
289 }
void clearLatexObj(PLatexObj &obj)
Clear a latex obj.

References PGenericParser::clearLatexObj(), PString::eraseFirstLastChar(), PLatexObj::getText(), PLatexObj::getVecContent(), and PLatexObj::setText().

Referenced by PConfigParser::loadInclude(), PConfigParser::parseAddSpeaker(), PGenericParser::parseBookEnableFeedback(), PGenericParser::parseBookGitlabUrl(), PGenericParser::parseBookMail(), PGenericParser::parseBookMasterProject(), PGenericParser::parseBookSizeBarWidth(), PConfigParser::parseComment(), parseComment(), PConfigParser::parseComplexMonoParam(), parseComplexMonoParam(), PConfigParser::parseDebug(), PConfigParser::parseDots(), PConfigParser::parseDoubleInlineMath(), parseEnumerate(), parseEnumerateItem(), parseEnvDecoration(), PConfigParser::parseEnvironementContent(), PConfigParser::parseEnvStringOnly(), parseExtraEnvironement(), PConfigParser::parseExtraEnvironementFunction(), PConfigParser::parseExtraFunction(), parseExtraParser(), PConfigParser::parseFile(), parseFile(), PConfigParser::parseHref(), parseHref(), PConfigParser::parseIncludeFile(), PConfigParser::parseIncludeGraphic(), parseIncludeGraphic(), PConfigParser::parseInlineMath(), PConfigParser::parseInputFile(), PConfigParser::parseItem(), parseItem(), parseItemize(), PGenericParser::parseLabel(), PGenericParser::parseMainAuthor(), PGenericParser::parseMainDate(), PGenericParser::parseMainSubTitle(), PGenericParser::parseMainTitle(), PGenericParser::parseMonoParam(), PConfigParser::parseNewLine(), parseNewLine(), PConfigParser::parseParserLanguage(), PConfigParser::parseParserLanguageFunction(), PConfigParser::parsePercent(), parsePercent(), PConfigParser::parserCallDot(), PConfigParser::parserDetails(), PConfigParser::parseRealNewLine(), PGenericParser::parserGetEnv(), PConfigParser::parserQuote(), PConfigParser::parserSvgToPng(), PConfigParser::parseSaveSpeaker(), PConfigParser::parseSectionTitle(), parseSectionTitle(), PConfigParser::parseSpaceParagraphe(), PConfigParser::parseTabular(), parseTextDecoration(), PConfigParser::parseTimeTable(), parseUrl(), PConfigParser::parseVecLatexObj(), parseVecLatexObj(), PConfigParser::parseVideo(), and parseWip().

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

◆ pointAtRow()

void PMultiFileParser::pointAtRow ( )
inherited

Point the problem.

Definition at line 138 of file PMultiFileParser.cpp.

138  {
139  std::cerr << "\tAt row :\n" << p_parser->getCurrentRow() << std::endl;
140  for(size_t i(0lu); i < p_parser->getColumn(); ++i){
141  std::cerr << " ";
142  }
143  std::cerr << "^" << std::endl;
144 }

References PFileParser::getColumn(), PFileParser::getCurrentRow(), and PMultiFileParser::p_parser.

Referenced by PMultiFileParser::fullParsing(), and ConfigParser::parseFile().

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

◆ postLoadFile()

void PMarkdownParser::postLoadFile ( )
protectedvirtual

Initialisation to be done just after loading a file.

Reimplemented from PMultiFileParser.

Definition at line 90 of file PMarkdownParser.cpp.

90  {
91 
92 }

◆ preLoadFile()

void PMarkdownParser::preLoadFile ( )
protectedvirtual

Initialisation to be done just before loading a file.

Reimplemented from PMultiFileParser.

Definition at line 81 of file PMarkdownParser.cpp.

81  {
82  //Save the current source
87 }
void setSeparator(const PString &separator)
Initialise la liste des caractères séparateurs.
Definition: PFileParser.cpp:43
void setWhiteSpace(const PString &whiteSpace)
Initialise la liste des caractères blancs.
Definition: PFileParser.cpp:35

References PGenericParser::clearLatexObj(), PGenericParser::p_currentSource, PGenericParser::p_currentText, PMultiFileParser::p_parser, PFileParser::setSeparator(), and PFileParser::setWhiteSpace().

+ Here is the call graph for this function:

◆ saveCss()

bool PGenericParser::saveCss ( )
inherited

Save the css file.

Returns
true on success, false otherwise

Definition at line 167 of file PGenericParser.cpp.

167  {
168  PVecString vecTheme;
169  for(std::map<PString, PString>::iterator itStyle(p_cssContent.begin()); itStyle != p_cssContent.end(); ++itStyle){
170  vecTheme.push_back(itStyle->first);
171  }
172 
173  for(std::map<PString, PString>::iterator itStyle(p_cssContent.begin()); itStyle != p_cssContent.end(); ++itStyle){
174  PString cssStyle(itStyle->second), cssThemeName(itStyle->first);
175  if(p_vecExtraEnv.size() != 0lu){
176  for(PMapExtraEnv::iterator it(p_vecExtraEnv.begin()); it != p_vecExtraEnv.end(); ++it){
177  cssStyle += "." + it->second.getName() + "Style{\n";
178  cssStyle += select_css_theme(vecTheme, cssThemeName, it->second.getCss());
179  cssStyle += "}\n\n";
180  }
181  }
182  if(p_vecExtraFunction.size() != 0lu){
183  for(PMapExtraEnv::iterator it(p_vecExtraFunction.begin()); it != p_vecExtraFunction.end(); ++it){
184  cssStyle += "." + it->second.getName() + "Style{\n";
185  cssStyle += select_css_theme(vecTheme, cssThemeName, it->second.getCss());
186  cssStyle += "}\n\n";
187  }
188  }
189  PPath fileName(cssThemeName + "_style.css");
190  if(!fileName.saveFileContent(cssStyle)){
191  std::cerr << "PGenericParser::saveCss : can't save the file '"<<fileName<<"'" << std::endl;
192  return false;
193  }
194  }
195  return true;
196 }
std::vector< PString > PVecString
Definition: PString.h:96
PString select_css_theme(const PVecString &vecTheme, const PString &themeName, const PString &css)
Select the right css option by respect to the given theme.

References PGenericParser::p_cssContent, PGenericParser::p_vecExtraEnv, PGenericParser::p_vecExtraFunction, PPath::saveFileContent(), and select_css_theme().

+ Here is the call graph for this function:

◆ saveMapFile()

void PGenericParser::saveMapFile ( )
protectedinherited

Save the map of copied files.

Definition at line 806 of file PGenericParser.cpp.

806  {
807  PString fileName(COPIED_RECOVER_FILE);
808  if(!data_save(fileName, p_mapCopiedFile)){return;}
809 }
bool data_save(FILE *iter, const T &data)
Save data in a message.
Definition: data_file.h:18

References COPIED_RECOVER_FILE, data_save(), and PGenericParser::p_mapCopiedFile.

Referenced by PConfigParser::~PConfigParser().

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

◆ setDebugMode()

void PGenericParser::setDebugMode ( bool  isDebugMode)
inherited

Set if the PGenericParser is in debug mode.

Parameters
isDebugMode: true if the PGenericParser is in debug mode, false if not

Definition at line 80 of file PGenericParser.cpp.

80  {
81  p_isDebugMode = isDebugMode;
82 }

References PGenericParser::p_isDebugMode.

◆ setFileContent()

void PMultiFileParser::setFileContent ( const PString fileContent)
inherited

Set the file content to be parsed.

Parameters
fileContent: file content to be parsed

Definition at line 43 of file PMultiFileParser.cpp.

43  {
44  if(p_parser == NULL){
45  PFileParser parser;
46  p_listFileParser.push_back(parser);
48  p_parser = &p_listFileParser.back();
49  }
50  p_parser = &p_listFileParser.back();
51  p_parser->setFileContent(fileContent);
52 }
void setFileContent(const PString &fileContent)
Set the file content.
Definition: PFileParser.cpp:50

References MULTI_PARSER_SEPARATORS_STRING, PMultiFileParser::p_listFileParser, PMultiFileParser::p_parser, and PFileParser::setFileContent().

Referenced by checkPMultiFileParser(), PGenericParser::executeLatexCommand(), and platexobj_parseStr().

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

◆ skipComment()

void PMultiFileParser::skipComment ( )
inherited

Skip comment.

Definition at line 177 of file PMultiFileParser.cpp.

177  {
178  bool isCommentFound(false);
179  do{
180  isCommentFound = false;
181  PListMultiCommentConfig::iterator it(p_listCommentConfig.begin());
182  while(it != p_listCommentConfig.end() && !isCommentFound && p_run && !p_parser->isEndOfFile()){
183  if(p_parser->isMatch(it->first)){
184  p_lastComment += it->first + p_parser->getUntilKey(it->second);
185  isCommentFound = true;
186  }
187  ++it;
188  }
189  }while(isCommentFound && p_run && !p_parser->isEndOfFile());
190 }

References PFileParser::getUntilKey(), PFileParser::isEndOfFile(), PFileParser::isMatch(), PMultiFileParser::p_lastComment, PMultiFileParser::p_listCommentConfig, PMultiFileParser::p_parser, and PMultiFileParser::p_run.

Referenced by PMultiFileParser::getStrComposedOf(), PMultiFileParser::isMatch(), PMultiFileParser::isMatchRewind(), PMultiFileParser::isMatchSeq(), and PMultiFileParser::isMatchToken().

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

◆ stopParsing()

◆ unexpectedToken()

void PMultiFileParser::unexpectedToken ( )
inherited

Print unexpected token error.

Definition at line 131 of file PMultiFileParser.cpp.

131  {
132  errorAt();
133  std::cerr << "PMultiFileParser::parseFile : unexpected token '"<<p_parser->getNextToken()<<"'" << std::endl;
134  stopParsing();
135 }

References PMultiFileParser::errorAt(), PFileParser::getNextToken(), PMultiFileParser::p_parser, and PMultiFileParser::stopParsing().

Referenced by PMultiFileParser::fullParsing(), and ConfigParser::parseFile().

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

Member Data Documentation

◆ p_bookGitlabUrl

PString PGenericParser::p_bookGitlabUrl
protectedinherited

Gitlab url of the current sources of the project.

Definition at line 156 of file PGenericParser.h.

Referenced by PGenericParser::copyPGenericParser(), PGenericParser::getBookGitlabUrl(), and PGenericParser::parseBookGitlabUrl().

◆ p_bookMail

PString PGenericParser::p_bookMail
protectedinherited

Mail to be used to contact authors in book mode.

Definition at line 160 of file PGenericParser.h.

Referenced by PGenericParser::copyPGenericParser(), PGenericParser::getBookMail(), and PGenericParser::parseBookMail().

◆ p_bookMainPageLink

PLatexObj PGenericParser::p_bookMainPageLink
protectedinherited

◆ p_bookMasterProjectUrl

PString PGenericParser::p_bookMasterProjectUrl
protectedinherited

◆ p_bookSideBarWidth

PString PGenericParser::p_bookSideBarWidth
protectedinherited

◆ p_cssContent

std::map<PString, PString> PGenericParser::p_cssContent
protectedinherited

Css of all the configurations.

Definition at line 146 of file PGenericParser.h.

Referenced by PGenericParser::copyPGenericParser(), PGenericParser::loadCss(), and PGenericParser::saveCss().

◆ p_currentSource

PLatexObj PGenericParser::p_currentSource
protectedinherited

◆ p_currentText

PLatexObj PGenericParser::p_currentText
protectedinherited

◆ p_currentToken

PString PMultiFileParser::p_currentToken
protectedinherited

◆ p_inputDirectory

PPath PMultiFileParser::p_inputDirectory
protectedinherited

Input directory of the parser.

Definition at line 80 of file PMultiFileParser.h.

Referenced by PMultiFileParser::initialisationPMultiFileParser().

◆ p_isDebugMode

bool PGenericParser::p_isDebugMode
protectedinherited

◆ p_isEnableBookFeedback

bool PGenericParser::p_isEnableBookFeedback
protectedinherited

◆ p_lastComment

PString PMultiFileParser::p_lastComment
protectedinherited

◆ p_listCommentConfig

PListMultiCommentConfig PMultiFileParser::p_listCommentConfig
privateinherited

Defines the differents comments we allow in the parsing.

Definition at line 88 of file PMultiFileParser.h.

Referenced by PMultiFileParser::addCommentConfig(), PMultiFileParser::getCurrentTokenWithoutComment(), and PMultiFileParser::skipComment().

◆ p_listFileParser

std::list<PFileParser> PMultiFileParser::p_listFileParser
protectedinherited

List of all the parsers for all the loaded files.

Definition at line 72 of file PMultiFileParser.h.

Referenced by PMultiFileParser::fullParsing(), PMultiFileParser::load(), PConfigParser::loadInclude(), and PMultiFileParser::setFileContent().

◆ p_mapBiblioEntry

PMapBiblioEntry PGenericParser::p_mapBiblioEntry
protectedinherited

Map of all bibliography entries.

Definition at line 148 of file PGenericParser.h.

Referenced by PGenericParser::copyPGenericParser(), and PGenericParser::getMapBiblioEntry().

◆ p_mapCopiedFile

PMapFile PGenericParser::p_mapCopiedFile
protectedinherited

◆ p_outputDirectory

PPath PMultiFileParser::p_outputDirectory
protectedinherited

Output directory of the parser.

Definition at line 82 of file PMultiFileParser.h.

Referenced by PMultiFileParser::initialisationPMultiFileParser().

◆ p_parser

PFileParser* PMultiFileParser::p_parser
protectedinherited

Parser helper for the config file.

Definition at line 70 of file PMultiFileParser.h.

Referenced by PMultiFileParser::checkExpectedMatch(), PMultiFileParser::errorAt(), PMultiFileParser::fullParsing(), PGenericParser::getAbsoluteFileName(), PMultiFileParser::getCurrentParser(), PMultiFileParser::getCurrentTokenWithoutComment(), PGenericParser::getOptionStringBetweenBraces(), PGenericParser::getOptionStringBetweenHook(), PMultiFileParser::getStrComposedOf(), PGenericParser::getStringBetweenBraces(), PGenericParser::incrementCurrentChar(), PMultiFileParser::initialisationPMultiFileParser(), isEnumerateItem(), isItem(), PMultiFileParser::isMatch(), PMultiFileParser::isMatchRewind(), PMultiFileParser::isMatchSeq(), PMultiFileParser::isMatchToken(), PMultiFileParser::load(), PConfigParser::loadInclude(), PConfigParser::parseAddSpeaker(), PConfigParser::parseAllLatexObj(), PGenericParser::parseBookEnableFeedback(), PGenericParser::parseBookGitlabUrl(), PGenericParser::parseBookMail(), PGenericParser::parseBookMasterProject(), PGenericParser::parseBookSizeBarWidth(), PConfigParser::parseComment(), parseComment(), PConfigParser::parseComplexMonoParam(), parseComplexMonoParam(), PConfigParser::parseDebug(), ConfigParser::parseDocString(), PConfigParser::parseDoubleInlineMath(), parseEnumerate(), parseEnumerateItem(), parseEnvDecoration(), PConfigParser::parseEnvironement(), PConfigParser::parseEnvironementContent(), PConfigParser::parseEnvStringOnly(), PConfigParser::parseExtraEnvironement(), parseExtraEnvironement(), PConfigParser::parseExtraEnvironementFunction(), PConfigParser::parseExtraFunction(), parseExtraParser(), ConfigParser::parseFile(), PConfigParser::parseFile(), parseFile(), PConfigParser::parseHref(), parseHref(), PConfigParser::parseIncludeFile(), PConfigParser::parseIncludeGraphic(), parseIncludeGraphic(), PConfigParser::parseInlineMath(), PConfigParser::parseInputFile(), PConfigParser::parseItem(), parseItem(), parseItemize(), PGenericParser::parseLabel(), PGenericParser::parseMainAuthor(), PGenericParser::parseMainDate(), PGenericParser::parseMainSubTitle(), PGenericParser::parseMainTitle(), PGenericParser::parseMonoParam(), PConfigParser::parseNewLine(), parseNewLine(), PConfigParser::parseParserLanguage(), PConfigParser::parseParserLanguageFunction(), PConfigParser::parsePercent(), parsePercent(), PConfigParser::parserCallDot(), PConfigParser::parserDetails(), PConfigParser::parseRealNewLine(), PGenericParser::parserGetEnv(), PConfigParser::parserQuote(), PConfigParser::parserSvgToPng(), PConfigParser::parseSaveSpeaker(), PConfigParser::parseSectionTitle(), parseSectionTitle(), PConfigParser::parseStringAndGoBack(), PConfigParser::parseTabular(), parseTextDecoration(), PConfigParser::parseTimeTable(), parseUrl(), PConfigParser::parseVecLatexObj(), parseVecLatexObj(), PConfigParser::parseVideo(), parseWip(), PMultiFileParser::pointAtRow(), PConfigParser::preLoadFile(), preLoadFile(), PMultiFileParser::setFileContent(), PMultiFileParser::skipComment(), PConfigParser::skipMonoParam(), and PMultiFileParser::unexpectedToken().

◆ p_run

◆ p_vecEnv

PVecLatexEnv PGenericParser::p_vecEnv
protectedinherited

Vector of all the environements.

Definition at line 112 of file PGenericParser.h.

Referenced by PGenericParser::copyPGenericParser().

◆ p_vecExtraEnv

◆ p_vecExtraFunction

PMapExtraEnv PGenericParser::p_vecExtraFunction
protectedinherited

◆ p_vecExtraParser

◆ p_vecFunc

PVecLatexFunc PGenericParser::p_vecFunc
protectedinherited

Vector of all the functions.

Definition at line 114 of file PGenericParser.h.

Referenced by PGenericParser::copyPGenericParser().

◆ p_vecIncludeDir

std::vector<PString> PGenericParser::p_vecIncludeDir
protectedinherited

Vector of the include directories.

Definition at line 117 of file PGenericParser.h.

Referenced by PGenericParser::copyPGenericParser(), and PGenericParser::getVecIncludeDir().

◆ p_vecNameExtraEnv

std::vector<PString> PGenericParser::p_vecNameExtraEnv
protectedinherited

Vector of the name of the extra environement.

Definition at line 120 of file PGenericParser.h.

Referenced by PGenericParser::copyPGenericParser(), PGenericParser::loadDirExtraEnvironementFile(), and PConfigParser::parseExtraEnvironement().

◆ p_vecNameExtraFunction

std::vector<PString> PGenericParser::p_vecNameExtraFunction
protectedinherited

Vector of the name of the extra function.

Definition at line 129 of file PGenericParser.h.

Referenced by PGenericParser::copyPGenericParser(), PGenericParser::loadDirExtraFunctionFile(), and PConfigParser::parseExtraFunction().

◆ p_vecNameExtraParser

std::vector<PString> PGenericParser::p_vecNameExtraParser
protectedinherited

Vector of the name of the extra environement.

Definition at line 134 of file PGenericParser.h.

Referenced by PGenericParser::copyPGenericParser(), PGenericParser::loadDirExtraParserFile(), and PConfigParser::parseParserLanguage().

◆ p_vecNameFunctionExtraEnv

std::vector<PString> PGenericParser::p_vecNameFunctionExtraEnv
protectedinherited

Vector of the name of the extra environement.

Definition at line 122 of file PGenericParser.h.

Referenced by PGenericParser::copyPGenericParser(), PGenericParser::loadDirExtraEnvironementFile(), and PConfigParser::parseExtraEnvironementFunction().

◆ p_vecNameFunctionExtraParser

std::vector<PString> PGenericParser::p_vecNameFunctionExtraParser
protectedinherited

Vector of the function name of the extra environement.

Definition at line 136 of file PGenericParser.h.

Referenced by PGenericParser::copyPGenericParser(), PGenericParser::loadDirExtraParserFile(), and PConfigParser::parseParserLanguageFunction().

◆ p_vecNameMarkdownExtraEnv

std::vector<PString> PGenericParser::p_vecNameMarkdownExtraEnv
protectedinherited

Vector of the name of the extra environement (for markdown)

Definition at line 124 of file PGenericParser.h.

Referenced by PGenericParser::copyPGenericParser(), PGenericParser::loadDirExtraEnvironementFile(), and parseExtraEnvironement().

◆ p_vecNameMarkdownExtraParser

std::vector<PString> PGenericParser::p_vecNameMarkdownExtraParser
protectedinherited

Vector of the markdown name of the extra environement.

Definition at line 138 of file PGenericParser.h.

Referenced by PGenericParser::copyPGenericParser(), PGenericParser::loadDirExtraParserFile(), and parseExtraParser().

◆ p_vecRemoveLatexKeyword

std::vector<PString> PGenericParser::p_vecRemoveLatexKeyword
protectedinherited

Vector of removed latex functions.

Definition at line 141 of file PGenericParser.h.

Referenced by PGenericParser::copyPGenericParser(), PGenericParser::initialisationPGenericParser(), and PConfigParser::parseAllLatexObj().

◆ p_vecSpeaker

std::vector<PLatexSpeaker> PGenericParser::p_vecSpeaker
protectedinherited

Vector of all Speakers in the project.

Definition at line 166 of file PGenericParser.h.

Referenced by PConfigParser::parseAddSpeaker(), PConfigParser::parseSaveSpeaker(), and PConfigParser::parseTimeTable().


The documentation for this class was generated from the following files: