PhoenixLecture  2.0.0
Set of tools to make lectures
PMarkdownParser.h
Go to the documentation of this file.
1 /***************************************
2  Auteur : Pierre Aubert
3  Mail : pierre.aubert@lapp.in2p3.fr
4  Licence : CeCILL-C
5 ****************************************/
6 
7 #ifndef __PMARKDOWNPARSER_H__
8 #define __PMARKDOWNPARSER_H__
9 
10 #include "PGenericParser.h"
11 
14  public:
15  PMarkdownParser(const PString & installPrefix = "");
16  PMarkdownParser(const PGenericParser & other);
17  PMarkdownParser(const PMarkdownParser & other);
18  virtual ~PMarkdownParser();
20 
21  protected:
22  void copyPMarkdownParser(const PMarkdownParser & other);
23 
24  virtual bool parseFile();
25  virtual void preLoadFile();
26  virtual void postLoadFile();
27 
28  private:
30 
31  bool parseComplexMonoParam(PLatexObj & parent, PLatexObj & textObj, const PString & functionName, PLatexType::PLatexType type);
32 
33  bool parseAllLatexObj(PLatexObj & parent, PLatexObj & textObj);
34  bool parseEnvLatexObj(PLatexObj & parent, PLatexObj & textObj);
35  bool parseItemLatexObj(PLatexObj & parent, PLatexObj & textObj);
36 
37  bool parseSectionTitle(PLatexObj & parent, PLatexObj & textObj, const PString & functionName, PLatexType::PLatexType type);
38  bool parseTextDecoration(PLatexObj & parent, PLatexObj & textObj, const PString & patern, const PString & cssStyle,
39  PLatexType::PLatexType type, const PString & balise);
40  bool parseEnvDecoration(PLatexObj & parent, PLatexObj & textObj, const PString & patern, const PString & cssStyle,
41  PLatexType::PLatexType type, const PString & balise);
42 
43  bool parseIncludeGraphic(PLatexObj & parent, PLatexObj & textObj);
44  bool parseUrl(PLatexObj & parent, PLatexObj & textObj);
45  bool parseHref(PLatexObj & parent, PLatexObj & textObj);
46  bool parsePercent(PLatexObj & parent, PLatexObj & textObj);
47  bool parseNewLine(PLatexObj & parent, PLatexObj & textObj);
48  bool parseComment(PLatexObj & parent, PLatexObj & textObj);
49 
50  bool parseItem(std::vector<std::pair<size_t, PLatexObj> > & vecItemLevel);
51  bool isItem(bool rewind = false);
52  PLatexObj * getProperParent(PLatexObj & parent, std::vector<size_t> & vecLevel, size_t itemLevel, PLatexType::PLatexType listItemType);
53  void insertItemInItemize(PLatexObj & parent, const std::vector<std::pair<size_t, PLatexObj> > & vecItemLevel, PLatexType::PLatexType listItemType);
54  bool parseItemize(PLatexObj & parent, PLatexObj & textObj);
55 
56 
57  bool parseEnumerateItem(std::vector<std::pair<size_t, PLatexObj> > & vecItemLevel);
58  bool isEnumerateItem(bool rewind = false);
59  bool parseEnumerate(PLatexObj & parent, PLatexObj & textObj);
60 
61  void parseVecLatexObj(PLatexObj & parent, PLatexObj & textObj, const PString & beginPatern, const PString & endPatern);
62 
63  bool parseExtraEnvironement(PLatexObj & parent, PLatexObj & textObj);
64  bool parseExtraParser(PLatexObj & parent, PLatexObj & textObj);
65  bool parseWip(PLatexObj & parent, PLatexObj & textObj);
66 };
67 
68 
69 
70 #endif
71 
Generic parser.
Describe a latex object.
Definition: PLatexObj.h:40
Class which parses Markdown as into for web site generator.
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 parseItemize(PLatexObj &parent, PLatexObj &textObj)
Parse some itemize.
bool parseSectionTitle(PLatexObj &parent, PLatexObj &textObj, const PString &functionName, PLatexType::PLatexType type)
Parse all the functions which have complex mono parameter in braces.
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.
void copyPMarkdownParser(const PMarkdownParser &other)
Copy function of PMarkdownParser.
bool parseItem(std::vector< std::pair< size_t, PLatexObj > > &vecItemLevel)
Parse an item in the markdown itemize.
virtual void preLoadFile()
Initialisation to be done just before loading a file.
bool parseHref(PLatexObj &parent, PLatexObj &textObj)
Parse latex Href.
bool parseUrl(PLatexObj &parent, PLatexObj &textObj)
Parse latex url.
virtual ~PMarkdownParser()
Destructor of PMarkdownParser.
bool parseExtraEnvironement(PLatexObj &parent, PLatexObj &textObj)
Parse extra environement (terminal, cplusplus, cmake, conseil, attention, ...)
bool parseEnumerateItem(std::vector< std::pair< size_t, PLatexObj > > &vecItemLevel)
Parse an item in the markdown enumerate.
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 parseItemLatexObj(PLatexObj &parent, PLatexObj &textObj)
Parse all the latex obj in item, but in markdown style.
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 parsePercent(PLatexObj &parent, PLatexObj &textObj)
Parse latex percent.
bool isItem(bool rewind=false)
Say if there is no space between the last return and the current char.
bool parseComment(PLatexObj &parent, PLatexObj &textObj)
Parse a new line.
bool parseIncludeGraphic(PLatexObj &parent, PLatexObj &textObj)
Parse the includegraphic command.
bool parseNewLine(PLatexObj &parent, PLatexObj &textObj)
Parse a new line.
bool parseComplexMonoParam(PLatexObj &parent, PLatexObj &textObj, const PString &functionName, PLatexType::PLatexType type)
Parse all the functions which have complex mono parameter in braces {...}.
virtual bool parseFile()
Parse the input file.
virtual void postLoadFile()
Initialisation to be done just after loading a file.
PMarkdownParser(const PString &installPrefix="")
Default constructor of PMarkdownParser.
bool isEnumerateItem(bool rewind=false)
Say if there is no space between the last return and the current char.
PMarkdownParser & operator=(const PMarkdownParser &other)
Definition of equal operator of PMarkdownParser.
bool parseEnumerate(PLatexObj &parent, PLatexObj &textObj)
Parse some enumerate.
void parseVecLatexObj(PLatexObj &parent, PLatexObj &textObj, const PString &beginPatern, const PString &endPatern)
Parse a vector of latex object.
bool parseAllLatexObj(PLatexObj &parent, PLatexObj &textObj)
Parse all the latex obj, but in markdown style.
void initialisationPMarkdownParser()
Initialisation function of the class PMarkdownParser.
bool parseExtraParser(PLatexObj &parent, PLatexObj &textObj)
Parse extra environement (terminal, cplusplus, cmake, conseil, attention, ...)
void insertItemInItemize(PLatexObj &parent, const std::vector< std::pair< size_t, PLatexObj > > &vecItemLevel, PLatexType::PLatexType listItemType)
Insert the item in the proper itemize.
Extends the std::string.
Definition: PString.h:16
PLatexType
Type of the PLatexObj.
Definition: PLatexType.h:12