PhoenixLecture  2.0.0
Set of tools to make lectures
platexobj_text.cpp
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 
8 #include "platexobj_html.h"
9 
10 #include "platexobj_text.h"
11 
13 
18  PString body("");
19  body += "<a id=\""+valueToString(obj.getId())+"\" href=\"" + obj.getName() + "\">";
20  body += platexobj_text(obj.getVecContent());
21  body += "</a>";
22  return body;
23 }
24 
26 
30  PString body("");
31  body += "<"+obj.getBalise()+" id=\""+valueToString(obj.getId())+"\" class=\"" + obj.getName() + "Style\">";
33  body += "</"+obj.getBalise()+">";
34  return body;
35 }
36 
38 
41 PString platexobj_text(const std::vector<PLatexObj> & vecObj){
42  PString body("");
43  for(std::vector<PLatexObj>::const_iterator it(vecObj.begin()); it != vecObj.end(); ++it){
44  body += platexobj_text(*it);
45  }
46  return body;
47 }
48 
50 
54  PString body("");
55 // option(obj.getText());
56  body += "<img id=\""+valueToString(obj.getId())+"\" src=\"" + obj.getName() + "\"";
57 // if(option != ""){ //Not a good idea for now, because firefox does not like this style property
58 // body += " style=\""+replaceCharInStr(option, '=', ':')+"%\"";
59 // }
60  body += " alt=\"nothing\" />" + platexobj_createLabelSearchLink(obj.getLabelName());
61  return body;
62 }
63 
65 
69  PString body("");
70  const PVecLatexObj & vecObj = obj.getVecContent();
71  for(PVecLatexObj::const_iterator it(vecObj.begin()); it != vecObj.end(); ++it){
72  body += platexobj_text(*it);
73  }
74  return body;
75 }
76 
78 
82  PString body("");
83  PLatexType::PLatexType type(obj.getType());
84  if(type == PLatexType::TEXT){body = platexobj_htmlStrText(obj);}
85  else if(type == PLatexType::URL){body = platexobj_htmlStrUrl(obj);}
86  else if(type == PLatexType::GETENV){body = platexobj_htmlStrGetEnv(obj);}
87  else if(type == PLatexType::PERCENT){body += "%";}
88  else if(type == PLatexType::REF){body = platexobj_htmlStrRef(obj);}
89 
90  else if(type == PLatexType::HREF){body = platexobj_textHref(obj);}
91  else if(type == PLatexType::TEXTBF){body = platexobj_htmlStrTextBf(obj);}
92  else if(type == PLatexType::TEXTIT){body = platexobj_htmlStrTextIt(obj);}
93  else if(type == PLatexType::DEBUG){body = platexobj_htmlStrTextDebug(obj);}
94  else if(type == PLatexType::FUNCTION){body = platexobj_textExtraFunction(obj);}
95  else if(type == PLatexType::IMAGE){body = platexobj_htmlStrImage(obj);}
96  else if(type == PLatexType::FILE){body = platexobj_textFile(obj);}
97  return body;
98 }
99 
100 
Describe a latex object.
Definition: PLatexObj.h:40
const std::vector< PLatexObj > & getVecContent() const
Gets the vecContent of the PLatexObj.
Definition: PLatexObj.cpp:410
const PString & getBalise() const
Gets the balise of the PLatexObj.
Definition: PLatexObj.cpp:382
const PString & getLabelName() const
Gets the labelName of the PLatexObj.
Definition: PLatexObj.cpp:354
const PLatexType::PLatexType & getType() const
Gets the type of the PLatexObj.
Definition: PLatexObj.cpp:298
const PString & getName() const
Gets the name of the PLatexObj.
Definition: PLatexObj.cpp:326
long unsigned int getId() const
Gets the id of the PLatexObj.
Definition: PLatexObj.cpp:284
Extends the std::string.
Definition: PString.h:16
std::string valueToString(const T &val)
Convert a type into a string.
PLatexType
Type of the PLatexObj.
Definition: PLatexType.h:12
PString platexobj_createLabelSearchLink(const PString &labelName)
Create the link to the label of the current PLatexObj if it exist.
PString platexobj_htmlStrUrl(const PLatexObj &obj)
Convert a PLatexObj into a string.
PString platexobj_htmlStrTextDebug(const PLatexObj &obj)
Convert a PLatexObj into a string.
PString platexobj_htmlStrTextBf(const PLatexObj &obj)
Convert a PLatexObj into a string.
PString platexobj_htmlStrText(const PLatexObj &obj)
Convert a PLatexObj into a string.
PString platexobj_htmlStrGetEnv(const PLatexObj &obj)
Convert a PLatexObj into a string.
PString platexobj_htmlStrRef(const PLatexObj &obj)
Convert a PLatexObj into a string.
PString platexobj_htmlStrTextIt(const PLatexObj &obj)
Convert a PLatexObj into a string.
PString platexobj_textFile(const PLatexObj &obj)
Convert a PLatexObj into a string.
PString platexobj_textHref(const PLatexObj &obj)
Convert a PLatexObj into a string.
PString platexobj_text(const std::vector< PLatexObj > &vecObj)
Convert a PLatexObj in text.
PString platexobj_textExtraFunction(const PLatexObj &obj)
Convert a PLatexObj into a string.
PString platexobj_htmlStrImage(const PLatexObj &obj)
Convert a PLatexObj into a string.
std::vector< PLatexObj > PVecLatexObj
Vector of obj.