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:408

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:156
void setName(const PString &name)
Sets the name of the PLatexObj.
Definition: PLatexObj.cpp:142
void setType(const PLatexType::PLatexType &type)
Sets the type of the PLatexObj.
Definition: PLatexObj.cpp:128
void setText(const PString &text)
Sets the text of the PLatexObj.
Definition: PLatexObj.cpp:135

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 838 of file PGenericParser.cpp.

838  {
839  if(fileName == ""){
840  std::cerr << "PGenericParser::copyFile : fileName is empty" << std::endl;
841  return PPath("");
842  }
843  PPath fileToBeCopied(getAbsoluteFileName(fileName));
844  if(fileToBeCopied == ""){ //If the fileName does not exists, it is relative to the current parsed file
845  std::cerr << "PGenericParser::copyFile : file '"<<fileName<<"' does not exists, even relative to the current parsed file that gives '"<<fileToBeCopied<<"'" << std::endl;
846  return PPath("");
847  }
848 
849  PString baseFileName(fileToBeCopied.getFileName());
850  PString linkDir(fileName.getParentDirectory().replace("../", ""));
851  PPath buildFileName(outputDir + PPath("/") + linkDir + PPath("/") + baseFileName);
852 
853  //Do we know the input file (did we already copy it)
854  PMapFile::iterator it(p_mapCopiedFile.find(fileName));
855  if(it != p_mapCopiedFile.end()){
856  //Let's check if the copied file still exists
857  if(buildFileName.isFileExist()){
858  //Ok, now let's get it's last modification time to be sure
859  time_t currentModifTime = fileToBeCopied.getFileModificationTime();
860  //Now let's check if it is the same one
861  if(currentModifTime == it->second && currentModifTime > 0){ //negative value is an error
862  //Ok, no need to copy, we already did it and the file if up to date
863  std::cout << "PGenericParser::copyFile : no need to copy file '"<<fileName<<"' already updated at time " << currentModifTime << std::endl;
864  return buildFileName;
865  }
866  }
867  }
868 
869  if(linkDir != ""){ //If there is other directories
870  if(!PPath(outputDir + "/" + linkDir).createDirectory()){
871  std::cerr << "PGenericParser::copyFile : cannot create directory '"<<(outputDir + "/" + linkDir)<<"'" << std::endl;
872  return PPath("");
873  }
874  }else{
875  if(!outputDir.createDirectory()){
876  std::cerr << "PGenericParser::copyFile : cannot create directory '"<<outputDir<<"'" << std::endl;
877  return PPath("");
878  }
879  }
880 
881  //Set the modification time
882  time_t lastModifTime = fileToBeCopied.getFileModificationTime();
883 
884  PString command("cp "+fileToBeCopied+" " + buildFileName);
885  if(system(command.c_str()) != 0){
886  errorAt();
887  std::cerr << "PGenericParser::copyFile : can't copy file '"<<fileToBeCopied<<"' into '"<<buildFileName<<"' directory" << std::endl;
888  stopParsing();
889  return PPath("");
890  }
891 // std::cout << "PGenericParser::copyFile : copy file '"<<fileToBeCopied<<"' at time " << lastModifTime << std::endl;
892  p_mapCopiedFile[fileToBeCopied] = lastModifTime;
893  return buildFileName;
894 }
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:267

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 821 of file PGenericParser.cpp.

821  {
822  PPath fileToBeCopied(fileName);
823  if(!fileToBeCopied.isFileExist()){ //If the fileName does not exists, it is relative to the current parsed file
824  fileToBeCopied = p_parser->getFileName().getParentDirectory() / fileName;
825  if(!fileToBeCopied.isFileExist()){ //Il the fileName still does not exists, we have to complain
826  std::cerr << "PGenericParser::getAbsoluteFileName : file '"<<fileName<<"' does not exists, even relative to the current parsed file that gives '"<<fileToBeCopied<<"'" << std::endl;
827  return PPath("");
828  }
829  }
830  return fileToBeCopied;
831 }
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 457 of file PMarkdownParser.cpp.

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

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:310

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 899 of file PGenericParser.cpp.

899  {
900  p_isDebugMode = false;
903 
904  PString installPrefix(CMAKE_INSTALL_PREFIX);
905  if(baseInstallPrefix != ""){
906  installPrefix = baseInstallPrefix;
907  }
908 
909  PPath dirExtraEnv(installPrefix+"/share/PhoenixTex2Html/ENVIRONEMENT");
910  loadDirExtraEnvironement(dirExtraEnv);
911 
912  PPath dirExtraFunction(installPrefix+"/share/PhoenixTex2Html/FUNCTION");
913  loadDirExtraFunction(dirExtraFunction);
914 
915  PPath dirExtraParser(installPrefix+"/share/PhoenixTex2Html/PARSER");
916  loadDirExtraParser(dirExtraParser);
917 
918  PPath dirCss(installPrefix+"/share/PhoenixTex2Html/STYLE");
919  loadCss(dirCss);
920 
921  p_vecRemoveLatexKeyword.push_back("\\toprule");
922  p_vecRemoveLatexKeyword.push_back("\\midrule");
923  p_vecRemoveLatexKeyword.push_back("\\bottomrule");
924  p_vecRemoveLatexKeyword.push_back("\\hline");
925  loadMapFile();
926 
927  p_bookSideBarWidth = "300px";
928  p_isEnableBookFeedback = false;
929 
930  p_bookMainPageLink.setType(PLatexType::NONE); //None by default, type will be updated on update
931 }
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 97 of file PMarkdownParser.cpp.

97  {
98 
99 }

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 510 of file PMarkdownParser.cpp.

510  {
511  std::vector<size_t> parentLevel;
512  parentLevel.push_back(vecItemLevel.front().first);
513  for(std::vector<std::pair<size_t, PLatexObj> >::const_iterator it(vecItemLevel.begin()); it != vecItemLevel.end(); ++it){
514  //Get the proper parent
515  PLatexObj * currentParent = getProperParent(parent, parentLevel, it->first, listItemType);
516  if(currentParent == NULL){return;}
517  //Add the current item to it
518  addLatexObj(*currentParent, it->second);
519  }
520 }
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 576 of file PMarkdownParser.cpp.

576  {
578  size_t currentCol(p_parser->getColumn());
579  PString listFigure(p_parser->getStrComposedOf("0123456789"));
580  if(listFigure == ""){
582  return false;
583  }
584  if(!p_parser->isMatch(". ")){
586  return false;
587  }
588  PString space(" \t"), currentRow(p_parser->getCurrentRow());
589  size_t i(0lu);
590  while(i < currentCol){
591  char ch = currentRow[i];
592  if(!space.find(ch)){
594  return false;
595  }
596  ++i;
597  }
598  if(rewind){
600  }
601  return true;
602 }
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 427 of file PMarkdownParser.cpp.

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

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 792 of file PGenericParser.cpp.

792  {
793  PListFile listInputFile = inputDir.getAllElementInDir();
794  if(listInputFile.size() == 0lu){
795  std::cerr << "PGenericParser::loadCss : can't read directory '"<<inputDir<<"'" << std::endl;
796  return;
797  }
798  for(PListFile::iterator it(listInputFile.begin()); it != listInputFile.end(); ++it){
799  PString styleName(it->getFileName().eraseExtension());
800  PPath tmpFile(inputDir / (*it));
801  p_cssContent[styleName] = tmpFile.loadFileContent();
802  }
803 }
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:270
void setName(const PString &name)
Sets the name of the PEnvironement.
Definition: PLatexObj.cpp:1080
void setCss(const PString &css)
Sets the css of the PEnvironement.
Definition: PLatexObj.cpp:1087
void setBalise(const PString &balise)
Sets the balise of the PEnvironement.
Definition: PLatexObj.cpp:1094
void setIsAllowComment(bool isAllowComment)
Sets the isAllowComment of the PEnvironement.
Definition: PLatexObj.cpp:1101
void setIsAlloxMath(bool isAlloxMath)
Sets the isAlloxMath of the PEnvironement.
Definition: PLatexObj.cpp:1108
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 778 of file PGenericParser.cpp.

778  {
779  PListFile listInputFile = inputDir.getAllElementInDir();
780  if(listInputFile.size() == 0lu){
781  std::cerr << "PGenericParser::loadDirExtraParser : can't read directory '"<<inputDir<<"'" << std::endl;
782  return;
783  }
784  for(PListFile::iterator it(listInputFile.begin()); it != listInputFile.end(); ++it){
785  loadDirExtraParserFile(inputDir / (*it));
786  }
787 }
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  PVecXml listDelimiter;
754  if(pxml_getVecChildIfExist(listDelimiter, *itBalise, "delimiter")){
755  for(PVecXml::iterator it(listDelimiter.begin()); it != listDelimiter.end(); ++it){
757  }
758  }
759 
760  PXml matchSequence;
761  if(pxml_getChildIfExist(matchSequence, *itBalise, "sequence")){
762  PParseSeq seq;
763  if(loadParserSeq(seq, matchSequence)){
764  tmp.setSeq(seq);
765  }else{
766  std::cerr << "PGenericParser::loadDirExtraParserFile : can't initialise sequence with balise in file '"<<inputFile<<"'" << std::endl;
767  }
768  }
769  parserEnv.getVecContext().push_back(tmp);
770  }
771  p_vecExtraParser.getVecEnv().push_back(parserEnv);
772  }
773 }
bool loadParserSeq(PParseSeq &seq, const PXml &xmlSeq)
Load a ParseSeq with a XML balise.
Context for parser environement.
Definition: PLatexObj.h:308
void setBegin(const PString &begin)
Sets the begin of the PContext.
Definition: PLatexObj.cpp:1238
void setNotBeforeBegin(const PString &notBeforeBegin)
Sets the notBeforeBegin of the PContext.
Definition: PLatexObj.cpp:1252
const std::vector< PString > & getVecDelimiter() const
Gets the vecDelimiter of the PContext.
Definition: PLatexObj.cpp:1392
void setSeq(const PParseSeq &seq)
Sets the seq of the PContext.
Definition: PLatexObj.cpp:1287
void setNotBeforeEnd(const PString &notBeforeEnd)
Sets the notBeforeEnd of the PContext.
Definition: PLatexObj.cpp:1266
const std::vector< PString > & getVecKeyword() const
Gets the vecKeyword of the PContext.
Definition: PLatexObj.cpp:1378
void setEnd(const PString &end)
Sets the end of the PContext.
Definition: PLatexObj.cpp:1245
void setNotAfterBegin(const PString &notAfterBegin)
Sets the notAfterBegin of the PContext.
Definition: PLatexObj.cpp:1259
void setName(const PString &name)
Sets the name of the PContext.
Definition: PLatexObj.cpp:1231
Parsing sequence.
Definition: PParseSeq.h:77
Parser environement.
Definition: PLatexObj.h:366
void setName(const PString &name)
Sets the name of the PParserEnv.
Definition: PLatexObj.cpp:1471
void setPlainText(const PString &plainText)
Sets the plainText of the PParserEnv.
Definition: PLatexObj.cpp:1478
const std::vector< PContext > & getVecContext() const
Gets the vecContext of the PParserEnv.
Definition: PLatexObj.cpp:1520
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:1582
PString convertBackSlahedStr(const PString &str)
Convert all the echaped char.

References convertBackSlahedStr(), PPath::eraseExtension(), PPath::getFileName(), PXmlAttr::getValue(), PXml::getVecChild(), PParserEnv::getVecContext(), PContext::getVecDelimiter(), 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 806 of file PGenericParser.cpp.

806  {
807  PString fileName(COPIED_RECOVER_FILE);
808  if(!data_load(fileName, p_mapCopiedFile)){return;}
809 }
#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 128 of file PMarkdownParser.cpp.

128  {
129  if(parseSectionTitle(parent, textObj, "##### ", PLatexType::SUBSUBSECTION)){}
130  else if(parseSectionTitle(parent, textObj, "#### ", PLatexType::SUBSECTION)){}
131  else if(parseSectionTitle(parent, textObj, "### ", PLatexType::SECTION)){}
132  else if(parseSectionTitle(parent, textObj, "## ", PLatexType::CHAPTER)){}
133  else if(parseSectionTitle(parent, textObj, "# ", PLatexType::PART)){}
134 
135  else if(parseExtraEnvironement(parent, textObj)){}
136  else if(parseExtraParser(parent, textObj)){}
137  else if(parseWip(parent, textObj)){}
138  else if(parseEnvDecoration(parent, textObj, "```", "terminal", PLatexType::ENVIRONEMENT, "pre")){}
139 
140  else if(parseGenericLatexObj(parent, textObj)){}
141  else if(parseComplexMonoParam(parent, textObj, "\\footnote", PLatexType::FOOTNOTE)){}
142  else if(parseComplexMonoParam(parent, textObj, "\\caption", PLatexType::CAPTION)){}
143 
144  else if(parseEnvLatexObj(parent, textObj)){}
145  else{
146  return false;
147  }
148  return true;
149 }
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:599

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 384 of file PMarkdownParser.cpp.

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

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 108 of file PMarkdownParser.cpp.

108  {
109  if(!p_parser->isMatchToken(functionName)){return false;}
110  playTextLatexObj(parent, textObj);
111  PLatexObj tmp;
112  tmp.setType(type);
113 
114  PString textOption(getOptionStringBetweenHook());
115  tmp.setText(textOption);
116 
117  parseVecLatexObj(tmp, textObj, "{", "}");
118 
119  addLatexObj(parent, tmp);
120  return true;
121 }
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 609 of file PMarkdownParser.cpp.

609  {
610  if(!isEnumerateItem(true)){return false;}
611  playTextLatexObj(parent, textObj);
612  PLatexObj tmp;
614  std::vector<std::pair<size_t, PLatexObj> > vecItemLevel;
615  while(!p_parser->isEndOfFile() && p_run && !p_parser->isMatch("\n\n")){
616  //Let's parse the current item
617  parseEnumerateItem(vecItemLevel);
618  }
619  insertItemInItemize(tmp, vecItemLevel, PLatexType::ENUMERATE);
620 
621  addLatexObj(parent, tmp);
622  return true;
623 }
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 548 of file PMarkdownParser.cpp.

548  {
549  if(p_parser->isMatchRewind("\n\n")){return false;}
550  if(!isEnumerateItem()){
551  return false;
552  }
553  size_t itemLevel(p_parser->getColumn());
554  PLatexObj itemObj;
555  itemObj.setType(PLatexType::ITEM);
556 
557  PLatexObj tmpText;
558  tmpText.setType(PLatexType::TEXT);
559 
560  //Do some loop to fill the item
561  while(!p_parser->isEndOfFile() && !p_parser->isMatchRewind("\n\n") && !isEnumerateItem(true) && p_run){
562  if(parseItemLatexObj(itemObj, tmpText)){}
563  else{
564  incrementCurrentChar(tmpText);
565  }
566  }
567  playTextLatexObj(itemObj, tmpText);
568  vecItemLevel.push_back(std::pair<size_t, PLatexObj>(itemLevel, itemObj));
569  return true;
570 }
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 246 of file PMarkdownParser.cpp.

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

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 156 of file PMarkdownParser.cpp.

156  {
157  if(parseItemize(parent, textObj)){}
158  else if(parseEnumerate(parent, textObj)){}
159  else if(parseNewLine(parent, textObj)){}
160  else if(parseItemLatexObj(parent, textObj)){}
161  else{
162  return false;
163  }
164 
165  return true;
166 }
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 657 of file PMarkdownParser.cpp.

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

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 695 of file PMarkdownParser.cpp.

695  {
696  if(p_vecNameMarkdownExtraParser.size() == 0lu){return false;}
699  if(matchFunc == ""){
701  return false;
702  }
703 
704  playTextLatexObj(parent, textObj);
705  PLatexObj tmp;
707  PString matchEnv(matchFunc.eraseChar('`'));
708  tmp.setName(matchEnv);
709 
710  PParserEnv parser(getParserEnv(p_vecExtraParser, matchEnv));
711 
712  PString inputFileContent(p_parser->getUntilKeyWithoutPatern("```").eraseFirstLastChar(" \n") + "\n");
713 
714  tmp.setNbline(inputFileContent.count('\n'));
715 
716  PString envContent(parser_makeHighlighting(inputFileContent, parser));
717  tmp.setText(envContent);
718  tmp.setSubTitle(inputFileContent);
719  addLatexObj(parent, tmp);
720  return true;
721 }
void setNbline(long unsigned int nbline)
Sets the nbline of the PLatexObj.
Definition: PLatexObj.cpp:191
void setSubTitle(const PString &subTitle)
Sets the subTitle of the PLatexObj.
Definition: PLatexObj.cpp:149
PString eraseFirstLastChar(const PString &vecChar) const
Erase first and last char in a string.
Definition: PString.cpp:623
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;
63  p_parser->setEscapeChar('\0');
65  p_currentSource.setLink("index.html");
69 
70  //To parse the file we need to read char by char until we get something we know
71  while(!p_parser->isEndOfFile() && p_run){ //If we are not at the end of the file
73  else{
75  }
76  }
78  return true;
79 }
void setEscapeChar(char escapeChar)
Sets the escape character of the PFileParser.
Definition: PFileParser.cpp:58
void setLink(const PString &link)
Sets the link of the PLatexObj.
Definition: PLatexObj.cpp:163
void setSourceFile(const PString &sourceFile)
Sets the sourceFile of the PLatexObj.
Definition: PLatexObj.cpp:247
void setSourceLine(size_t sourceLine)
Sets the sourceLine of the PLatexObj.
Definition: PLatexObj.cpp:254
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(), PFileParser::setEscapeChar(), 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 320 of file PMarkdownParser.cpp.

320  {
322  if(!p_parser->isMatch("[")){return false;}
323  playTextLatexObj(parent, textObj);
324  PLatexObj tmp;
326 
327  parseVecLatexObj(tmp, textObj, "", "]"); //We alrday parse the begin patern at the begining of this method
328  if(!p_parser->isMatch("(")){
330  return false;
331  }
333  tmp.setName(link);
334 
335  if(!tmp.getName().isSameBegining("http") && !tmp.getName().isSameBegining("https")){
336  PString buildFileName(copyFile(PPath(LATEX_RESSOURCES_OUTPUT_DIR), link));
337  if(buildFileName == ""){
338  if(PPath(tmp.getName()).getExtension() != "html"){
339  errorAt();
340  std::cerr << "PMarkdownParser::parseHref : cannot copy file '"<<link<<"' in '" LATEX_RESSOURCES_OUTPUT_DIR "'" << std::endl;
341  return true;
342  }
343  buildFileName = link;
344  }
345  tmp.setName(buildFileName);
346  }
347  addLatexObj(parent, tmp);
348  return true;
349 }
#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:324
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:369

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 266 of file PMarkdownParser.cpp.

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

399  {
400  if(p_parser->isMatchRewind("\n\n")){return false;}
401  if(!isItem()){
402  return false;
403  }
404  size_t itemLevel(p_parser->getColumn());
405  PLatexObj itemObj;
406  itemObj.setType(PLatexType::ITEM);
407 
408  PLatexObj tmpText;
409  tmpText.setType(PLatexType::TEXT);
410 
411  //Do some loop to fill the item
412  while(!p_parser->isEndOfFile() && !p_parser->isMatchRewind("\n\n") && !isItem(true) && p_run){
413  if(parseItemLatexObj(itemObj, tmpText)){}
414  else{
415  incrementCurrentChar(tmpText);
416  }
417  }
418  playTextLatexObj(itemObj, tmpText);
419  vecItemLevel.push_back(std::pair<size_t, PLatexObj>(itemLevel, itemObj));
420  return true;
421 }
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 527 of file PMarkdownParser.cpp.

527  {
528  if(!isItem(true)){return false;}
529  playTextLatexObj(parent, textObj);
530  PLatexObj tmp;
532  std::vector<std::pair<size_t, PLatexObj> > vecItemLevel;
533  while(!p_parser->isEndOfFile() && p_run && !p_parser->isMatch("\n\n")){
534  //Let's parse the current item
535  parseItem(vecItemLevel);
536  }
537 
538  insertItemInItemize(tmp, vecItemLevel, PLatexType::ITEMIZE);
539 
540  addLatexObj(parent, tmp);
541  return true;
542 }
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 173 of file PMarkdownParser.cpp.

173  {
174  if(parseComment(parent, textObj)){}
175  else if(parseTextDecoration(parent, textObj, "***", "textbfit", PLatexType::FUNCTION, "span")){}
176  else if(parseTextDecoration(parent, textObj, "**", "textbf", PLatexType::FUNCTION, "span")){}
177  else if(parseTextDecoration(parent, textObj, "*", "textit", PLatexType::FUNCTION, "span")){}
178  else if(parseTextDecoration(parent, textObj, "`", "code", PLatexType::FUNCTION, "span")){}
179 
180  else if(parseHref(parent, textObj)){}
181  else if(parseIncludeGraphic(parent, textObj)){}
182  else if(parseUrl(parent, textObj)){}
183  else if(parsePercent(parent, textObj)){}
184  else{
185  return false;
186  }
187  return true;
188 }
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:233

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:240

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 370 of file PMarkdownParser.cpp.

370  {
371  if(!p_parser->isMatch("\n\n")){return false;}
372  playTextLatexObj(parent, textObj);
373  PLatexObj tmp;
375  addLatexObj(parent, tmp);
376  return true;
377 }
@ 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 356 of file PMarkdownParser.cpp.

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

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 197 of file PMarkdownParser.cpp.

197  {
198  if(!p_parser->isMatch(functionName)){return false;}
199  playTextLatexObj(parent, textObj);
200  PLatexObj tmp;
201  tmp.setType(type);
204 
205  PLatexObj objTitle;
206  parseVecLatexObj(objTitle, textObj, "", "\n");
207  tmp.setComplexTitle(objTitle.getVecContent());
208  addLatexObj(parent, tmp);
209  return true;
210 }
void setComplexTitle(const std::vector< PLatexObj > &complexTitle)
Sets the complexTitle of the PLatexObj.
Definition: PLatexObj.cpp:177
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 221 of file PMarkdownParser.cpp.

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

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 302 of file PMarkdownParser.cpp.

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

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 631 of file PMarkdownParser.cpp.

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

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 728 of file PMarkdownParser.cpp.

728  {
729  if(!p_parser->isMatch("```wip")){return false;}
730 
731  playTextLatexObj(parent, textObj);
732  PLatexObj env;
734 
735  PLatexObj tmpText;
736  tmpText.setType(PLatexType::TEXT);
737 
738  while(!p_parser->isEndOfFile() && !p_parser->isMatch("```") && p_run){
739  if(parseEnvLatexObj(env, tmpText)){}
740  else{
741  incrementCurrentChar(tmpText);
742  }
743  }
744  playTextLatexObj(env, tmpText);
745 
746  addLatexObj(parent, env);
747  return true;
748 }
@ 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 92 of file PMarkdownParser.cpp.

92  {
93 
94 }

◆ preLoadFile()

void PMarkdownParser::preLoadFile ( )
protectedvirtual

Initialisation to be done just before loading a file.

Reimplemented from PMultiFileParser.

Definition at line 82 of file PMarkdownParser.cpp.

82  {
83  //Save the current source
86  p_parser->setEscapeChar('\0');
89 }
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::setEscapeChar(), 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:99
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 812 of file PGenericParser.cpp.

812  {
813  PString fileName(COPIED_RECOVER_FILE);
814  if(!data_save(fileName, p_mapCopiedFile)){return;}
815 }
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: