Directory: | ./ |
---|---|
File: | tmp_project/PhoenixTex2Html/src/PLatexObj/platexobj_html.cpp |
Date: | 2025-07-04 20:24:11 |
Exec | Total | Coverage | |
---|---|---|---|
Lines: | 509 | 549 | 92.7% |
Branches: | 1061 | 1299 | 81.7% |
Line | Branch | Exec | Source |
---|---|---|---|
1 | /*************************************** | ||
2 | Auteur : Pierre Aubert | ||
3 | Mail : pierre.aubert@lapp.in2p3.fr | ||
4 | Licence : CeCILL-C | ||
5 | ****************************************/ | ||
6 | |||
7 | #include <sys/stat.h> | ||
8 | #include <sys/types.h> | ||
9 | |||
10 | #include "phoenix_env.h" | ||
11 | #include "phoenix_system.h" | ||
12 | #include "convertToString.h" | ||
13 | #include "parser_utils.h" | ||
14 | #include "platexobj_text.h" | ||
15 | #include "platexobj_rawtext.h" | ||
16 | |||
17 | #include "platexobj_html_book.h" | ||
18 | |||
19 | #include "platexobj_html.h" | ||
20 | |||
21 | ///Create the link to the label of the current PLatexObj if it exist | ||
22 | /** @param labelName : name of the label to be used | ||
23 | * @return html link to search the label or empty string if there is no label | ||
24 | */ | ||
25 | 2898 | PString platexobj_createLabelSearchLink(const PString & labelName){ | |
26 |
3/3✓ Branch 1 taken 2512 times.
✓ Branch 2 taken 386 times.
✓ Branch 4 taken 2512 times.
|
2898 | if(labelName == ""){return "";} |
27 |
3/3✓ Branch 1 taken 386 times.
✓ Branch 4 taken 386 times.
✓ Branch 7 taken 386 times.
|
772 | PString body("<span class=\"redirectIcon\"><a href=\"redirect.html?label="+labelName+"\"><img src=\"images/iconlink_32.png\"></a></span>"); |
28 | |||
29 |
1/1✓ Branch 1 taken 386 times.
|
386 | return body; |
30 | 386 | } | |
31 | |||
32 | ///Create a title | ||
33 | /** @param obj : PLatexObj to be saved | ||
34 | * @param baliseName : name of the title balise | ||
35 | * @param cssClassName : css class to be used | ||
36 | * @param objTitle : title to be printed | ||
37 | * @param prefixTitle : prefix of the title (Part or Chapter) | ||
38 | * @param addLinkLabel : true to add the label link in the title | ||
39 | */ | ||
40 | 431 | PString platexobj_createTitle(const PLatexObj & obj, const PString & baliseName, const PString & cssClassName, | |
41 | const PString objTitle, const PString & prefixTitle, bool addLinkLabel) | ||
42 | { | ||
43 | 431 | PString body(""); | |
44 |
9/9✓ Branch 1 taken 431 times.
✓ Branch 4 taken 431 times.
✓ Branch 7 taken 431 times.
✓ Branch 10 taken 431 times.
✓ Branch 13 taken 431 times.
✓ Branch 16 taken 431 times.
✓ Branch 19 taken 431 times.
✓ Branch 22 taken 431 times.
✓ Branch 25 taken 431 times.
|
431 | body += "\t\t<"+baliseName+" id=\""+valueToString(obj.getId())+"\" class=\""+cssClassName+"\">"; |
45 |
2/2✓ Branch 1 taken 156 times.
✓ Branch 2 taken 275 times.
|
431 | if(prefixTitle != ""){ |
46 |
2/2✓ Branch 1 taken 156 times.
✓ Branch 4 taken 156 times.
|
156 | body += prefixTitle + " "; |
47 | } | ||
48 |
3/3✓ Branch 1 taken 431 times.
✓ Branch 4 taken 431 times.
✓ Branch 7 taken 431 times.
|
431 | body += vecNumberToString(obj.getVecSecNumber()); |
49 | |||
50 |
2/2✓ Branch 1 taken 431 times.
✓ Branch 4 taken 431 times.
|
431 | body += " : "+objTitle; |
51 |
1/2✓ Branch 0 taken 431 times.
✗ Branch 1 not taken.
|
431 | if(addLinkLabel){ |
52 |
3/3✓ Branch 1 taken 431 times.
✓ Branch 4 taken 431 times.
✓ Branch 7 taken 431 times.
|
431 | body += platexobj_createLabelSearchLink(obj.getLabelName()); |
53 | } | ||
54 |
3/3✓ Branch 1 taken 431 times.
✓ Branch 4 taken 431 times.
✓ Branch 7 taken 431 times.
|
431 | body += "</"+baliseName+">\n"; |
55 | 431 | return body; | |
56 | } | ||
57 | |||
58 | ///Convert a PLatexObj into a string | ||
59 | /** @param obj : PLatexObj to be converted into a string | ||
60 | * @return output string which contains the PLatexObj | ||
61 | */ | ||
62 | 13513 | PString platexobj_htmlStrText(const PLatexObj & obj){ | |
63 | 13513 | return convertStrToHtml(obj.getText()); | |
64 | } | ||
65 | |||
66 | ///Convert a PLatexObj into a string | ||
67 | /** @param obj : PLatexObj to be converted into a string | ||
68 | * @return output string which contains the PLatexObj | ||
69 | */ | ||
70 | ✗ | PString platexobj_htmlStrHtml(const PLatexObj & obj){ | |
71 | ✗ | return obj.getText(); | |
72 | } | ||
73 | |||
74 | ///Convert a PLatexObj into a string | ||
75 | /** @param obj : PLatexObj to be converted into a string | ||
76 | * @return output string which contains the PLatexObj | ||
77 | */ | ||
78 | 107 | PString platexobj_htmlStrUrl(const PLatexObj & obj){ | |
79 | 107 | PString body(""); | |
80 |
11/11✓ Branch 1 taken 107 times.
✓ Branch 4 taken 107 times.
✓ Branch 7 taken 107 times.
✓ Branch 10 taken 107 times.
✓ Branch 13 taken 107 times.
✓ Branch 16 taken 107 times.
✓ Branch 19 taken 107 times.
✓ Branch 22 taken 107 times.
✓ Branch 25 taken 107 times.
✓ Branch 28 taken 107 times.
✓ Branch 31 taken 107 times.
|
107 | body += "<a id=\""+valueToString(obj.getId())+"\" href=\"" + obj.getName() + "\">" + obj.getName() + "</a>"; |
81 | 107 | return body; | |
82 | } | ||
83 | |||
84 | ///Convert a PLatexObj into a string | ||
85 | /** @param obj : PLatexObj to be converted into a string | ||
86 | * @return output string which contains the PLatexObj | ||
87 | */ | ||
88 | 7 | PString platexobj_htmlStrGetEnv(const PLatexObj & obj){ | |
89 | 7 | PString body(""); | |
90 |
3/3✓ Branch 1 taken 7 times.
✓ Branch 4 taken 7 times.
✓ Branch 7 taken 7 times.
|
7 | body += phoenix_getenv(obj.getName()); |
91 | 7 | return body; | |
92 | } | ||
93 | |||
94 | ///Convert a PLatexObj into a string | ||
95 | /** @param[out] outputMode : output mode of the html backend | ||
96 | * @param obj : PLatexObj to be converted into a string | ||
97 | * @return output string which contains the PLatexObj | ||
98 | */ | ||
99 | 23 | PString platexobj_htmlStrUpdateStyle(POutoutMode & outputMode, const PLatexObj & obj){ | |
100 | 23 | outputMode.currentStyle = obj.getName(); | |
101 | 23 | return ""; | |
102 | } | ||
103 | |||
104 | ///Convert a PLatexObj into a string | ||
105 | /** @param obj : PLatexObj to be converted into a string | ||
106 | * @return output string which contains the PLatexObj | ||
107 | */ | ||
108 | 1018 | PString platexobj_htmlStrRef(const PLatexObj & obj){ | |
109 | 1018 | PString body(""); | |
110 | // const PString & linkObj = obj.getLink(); | ||
111 | // replaceCharInStr(getSecNumberFromFileName(linkObj), '-', '.') | ||
112 |
4/4✓ Branch 1 taken 1018 times.
✓ Branch 4 taken 1018 times.
✓ Branch 7 taken 1018 times.
✓ Branch 10 taken 1018 times.
|
1018 | body += "<a href=\"" + obj.getLink() + "\">"; |
113 |
3/3✓ Branch 1 taken 1018 times.
✓ Branch 4 taken 1011 times.
✓ Branch 5 taken 7 times.
|
1018 | if(obj.getVecContent().size() != 0lu){ |
114 |
3/3✓ Branch 1 taken 1011 times.
✓ Branch 4 taken 1011 times.
✓ Branch 7 taken 1011 times.
|
1011 | body += platexobj_text(obj.getVecContent()); |
115 | }else{ | ||
116 |
2/2✓ Branch 1 taken 7 times.
✓ Branch 4 taken 7 times.
|
7 | PString textLink = obj.getName(); |
117 |
1/1✓ Branch 1 taken 7 times.
|
7 | body += textLink; |
118 | 7 | } | |
119 |
1/1✓ Branch 1 taken 1018 times.
|
1018 | body += "</a>"; |
120 | 1018 | return body; | |
121 | } | ||
122 | |||
123 | ///Convert a PLatexObj into a string | ||
124 | /** @param obj : PLatexObj to be converted into a string | ||
125 | * @return output string which contains the PLatexObj | ||
126 | */ | ||
127 | 588 | PString platexobj_htmlStrNewLine(const PLatexObj & obj){ | |
128 | 588 | PString body(""); | |
129 |
1/1✓ Branch 1 taken 588 times.
|
588 | body += "<br />\n"; |
130 | 588 | return body; | |
131 | } | ||
132 | |||
133 | ///Convert a PLatexObj into a string | ||
134 | /** @param obj : PLatexObj to be converted into a string | ||
135 | * @return output string which contains the PLatexObj | ||
136 | */ | ||
137 | 2543 | PString platexobj_htmlStrSpaceParagraph(const PLatexObj & obj){ | |
138 | 2543 | PString body(""); | |
139 |
1/1✓ Branch 1 taken 2543 times.
|
2543 | body += "<br /><br />\n"; |
140 | 2543 | return body; | |
141 | } | ||
142 | |||
143 | ///Convert a PLatexObj into a string | ||
144 | /** @param obj : PLatexObj to be converted into a string | ||
145 | * @return output string which contains the PLatexObj | ||
146 | */ | ||
147 | 6 | PString platexobj_htmlStrCitation(const PLatexObj & obj){ | |
148 | 6 | PString body(""); | |
149 | // body += "<b>Citation of "+obj.getName()+"</b>"; | ||
150 |
4/4✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
✓ Branch 7 taken 6 times.
✓ Branch 10 taken 6 times.
|
6 | body += "<a class=\"biblio\" href=\"" + obj.getLink() + "\">"; |
151 |
4/4✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
✓ Branch 7 taken 6 times.
✓ Branch 10 taken 6 times.
|
6 | body += "[" + obj.getText() + "]"; //Put the Id of the citation in the bibliography |
152 |
1/1✓ Branch 1 taken 6 times.
|
6 | body += "<span class=\"bibliospan\">"; //The hidden content which is revealed on hover |
153 |
2/2✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
|
6 | body += obj.getName(); //Title of the reference |
154 |
3/3✓ Branch 1 taken 6 times.
✓ Branch 4 taken 2 times.
✓ Branch 5 taken 4 times.
|
6 | if(obj.getDate() != ""){ |
155 |
3/3✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 7 taken 2 times.
|
2 | body += ", "+ obj.getDate(); //Year of the reference |
156 | } | ||
157 |
2/3✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
✗ Branch 5 not taken.
|
6 | if(obj.getAuthor() != ""){ |
158 |
3/3✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
✓ Branch 7 taken 6 times.
|
6 | body += ", "+ obj.getAuthor(); //Author of the reference |
159 | } | ||
160 |
1/1✓ Branch 1 taken 6 times.
|
6 | body += "</span>"; |
161 |
1/1✓ Branch 1 taken 6 times.
|
6 | body += "</a>"; |
162 | |||
163 | // body += "<a href=\"" + obj.getLink() + "\">" + replaceCharInStr(getSecNumberFromFileName(obj.getLink()), '-', '.') + "</a>"; | ||
164 | 6 | return body; | |
165 | } | ||
166 | |||
167 | ///Convert a PLatexObj into a string | ||
168 | /** @param[out] outputMode : output mode of the html backend | ||
169 | * @param obj : PLatexObj to be converted into a string | ||
170 | * @return output string which contains the PLatexObj | ||
171 | */ | ||
172 | 297 | PString platexobj_htmlStrHref(POutoutMode & outputMode, const PLatexObj & obj){ | |
173 | 297 | PString body(""); | |
174 |
8/8✓ Branch 1 taken 297 times.
✓ Branch 4 taken 297 times.
✓ Branch 7 taken 297 times.
✓ Branch 10 taken 297 times.
✓ Branch 13 taken 297 times.
✓ Branch 16 taken 297 times.
✓ Branch 19 taken 297 times.
✓ Branch 22 taken 297 times.
|
297 | body += "<a id=\""+valueToString(obj.getId())+"\" href=\"" + obj.getName() + "\">"; |
175 |
3/3✓ Branch 1 taken 297 times.
✓ Branch 4 taken 297 times.
✓ Branch 7 taken 297 times.
|
297 | body += platexobj_htmlStr(outputMode, obj.getVecContent()); |
176 |
1/1✓ Branch 1 taken 297 times.
|
297 | body += "</a>"; |
177 | 297 | return body; | |
178 | } | ||
179 | |||
180 | ///Convert a PLatexObj into a string | ||
181 | /** @param obj : PLatexObj to be converted into a string | ||
182 | * @return output string which contains the PLatexObj | ||
183 | */ | ||
184 | 865 | PString platexobj_htmlStrTextBf(const PLatexObj & obj){ | |
185 | 865 | PString body(""); | |
186 |
4/4✓ Branch 1 taken 865 times.
✓ Branch 4 taken 865 times.
✓ Branch 7 taken 865 times.
✓ Branch 10 taken 865 times.
|
865 | body += "<b>" + obj.getName() + "</b>"; |
187 | 865 | return body; | |
188 | } | ||
189 | |||
190 | ///Convert a PLatexObj into a string | ||
191 | /** @param obj : PLatexObj to be converted into a string | ||
192 | * @return output string which contains the PLatexObj | ||
193 | */ | ||
194 | ✗ | PString platexobj_htmlStrTextIt(const PLatexObj & obj){ | |
195 | ✗ | PString body(""); | |
196 | ✗ | body += "<em id=\""+valueToString(obj.getId())+"\">" + obj.getName() + "</em>"; | |
197 | ✗ | return body; | |
198 | } | ||
199 | |||
200 | ///Convert a PLatexObj into a string | ||
201 | /** @param obj : PLatexObj to be converted into a string | ||
202 | * @return output string which contains the PLatexObj | ||
203 | */ | ||
204 | 52 | PString platexobj_htmlStrTextDebug(const PLatexObj & obj){ | |
205 | 52 | PString body(""); | |
206 |
8/8✓ Branch 1 taken 52 times.
✓ Branch 4 taken 52 times.
✓ Branch 7 taken 52 times.
✓ Branch 10 taken 52 times.
✓ Branch 13 taken 52 times.
✓ Branch 16 taken 52 times.
✓ Branch 19 taken 52 times.
✓ Branch 22 taken 52 times.
|
52 | body += "<span class=\"debug\" id=\""+valueToString(obj.getId())+"\">" + obj.getName() + "</span>"; |
207 | 52 | return body; | |
208 | } | ||
209 | |||
210 | ///Convert a PLatexObj into a string | ||
211 | /** @param[out] outputMode : output mode of the html backend | ||
212 | * @param obj : PLatexObj to be converted into a string | ||
213 | * @return output string which contains the PLatexObj | ||
214 | */ | ||
215 | 53 | PString platexobj_htmlStrTextFootnote(POutoutMode & outputMode, const PLatexObj & obj){ | |
216 | 53 | PString body(""); | |
217 | // body += "<sup class=\"footnote\" id=\""+valueToString(obj.getId())+"\">" + obj.getName() + "</sup>"; | ||
218 | |||
219 |
5/5✓ Branch 1 taken 53 times.
✓ Branch 4 taken 53 times.
✓ Branch 7 taken 53 times.
✓ Branch 10 taken 53 times.
✓ Branch 13 taken 53 times.
|
53 | body += "<sup class=\"footnote\" id=\""+valueToString(obj.getId())+"\">"; |
220 | |||
221 |
1/1✓ Branch 1 taken 53 times.
|
53 | body += "<a href=\"#\">"; |
222 |
1/1✓ Branch 1 taken 53 times.
|
53 | body += "note"; |
223 |
1/1✓ Branch 1 taken 53 times.
|
53 | body += "<span class=\"footnotespan\">"; |
224 | // body += obj.getName(); //Content of the footnote | ||
225 |
3/3✓ Branch 1 taken 53 times.
✓ Branch 4 taken 53 times.
✓ Branch 7 taken 53 times.
|
53 | body += platexobj_htmlStr(outputMode, obj.getVecContent()); //Content of the footnote |
226 |
1/1✓ Branch 1 taken 53 times.
|
53 | body += "</span>"; |
227 |
1/1✓ Branch 1 taken 53 times.
|
53 | body += "</a>"; |
228 |
1/1✓ Branch 1 taken 53 times.
|
53 | body += "</sup>"; |
229 | 53 | return body; | |
230 | } | ||
231 | |||
232 | ///Convert a PLatexObj into a string | ||
233 | /** @param[out] outputMode : output mode of the html backend | ||
234 | * @param obj : PLatexObj to be converted into a string | ||
235 | * @return output string which contains the PLatexObj | ||
236 | */ | ||
237 | 73 | PString platexobj_htmlStrCaption(POutoutMode & outputMode, const PLatexObj & obj){ | |
238 | 73 | PString body(""); | |
239 |
12/12✓ Branch 1 taken 73 times.
✓ Branch 4 taken 73 times.
✓ Branch 7 taken 73 times.
✓ Branch 10 taken 73 times.
✓ Branch 13 taken 73 times.
✓ Branch 16 taken 73 times.
✓ Branch 19 taken 73 times.
✓ Branch 22 taken 73 times.
✓ Branch 25 taken 73 times.
✓ Branch 28 taken 73 times.
✓ Branch 31 taken 73 times.
✓ Branch 34 taken 73 times.
|
73 | body += "\n<p id=\""+valueToString(obj.getId())+"\">" + platexobj_createLabelSearchLink(obj.getLabelName()) + platexobj_htmlStr(outputMode, obj.getVecContent()) + "</p>\n"; |
240 | 73 | return body; | |
241 | } | ||
242 | |||
243 | ///Convert a PLatexObj into a string | ||
244 | /** @param[out] outputMode : output mode of the html backend | ||
245 | * @param obj : PLatexObj to be converted into a string | ||
246 | * @return output string which contains the PLatexObj | ||
247 | */ | ||
248 | 17 | PString platexobj_htmlStrWip(POutoutMode & outputMode, const PLatexObj & obj){ | |
249 |
3/3✓ Branch 0 taken 8 times.
✓ Branch 1 taken 9 times.
✓ Branch 3 taken 8 times.
|
17 | if(!outputMode.isWorkInProgress){return "";} |
250 |
1/1✓ Branch 1 taken 9 times.
|
9 | PString body(""); |
251 |
5/5✓ Branch 1 taken 9 times.
✓ Branch 4 taken 9 times.
✓ Branch 7 taken 9 times.
✓ Branch 10 taken 9 times.
✓ Branch 13 taken 9 times.
|
9 | body += "\n<table id=\""+valueToString(obj.getId())+"\" class=\"workinprogress\">\n"; |
252 |
1/1✓ Branch 1 taken 9 times.
|
9 | body += "\t<tr><td class=\"workinprogressimage\"><img src=\"images/wip.png\" alt=\"wip\" /></td></tr>\n"; |
253 | |||
254 |
5/5✓ Branch 1 taken 9 times.
✓ Branch 4 taken 9 times.
✓ Branch 7 taken 9 times.
✓ Branch 10 taken 9 times.
✓ Branch 13 taken 9 times.
|
9 | body += "\t<tr><td class=\"workinprogresscontent\">" + platexobj_htmlStr(outputMode, obj.getVecContent()) + "</td></tr>\n"; |
255 |
1/1✓ Branch 1 taken 9 times.
|
9 | body += "</table>\n"; |
256 |
1/1✓ Branch 1 taken 9 times.
|
9 | return body; |
257 | 9 | } | |
258 | |||
259 | ///Convert a PLatexObj into a string | ||
260 | /** @param[out] outputMode : output mode of the html backend | ||
261 | * @param obj : PLatexObj to be converted into a string | ||
262 | * @return output string which contains the PLatexObj | ||
263 | */ | ||
264 | 3 | PString platexobj_htmlStrSummary(POutoutMode & outputMode, const PLatexObj & obj){ | |
265 | 3 | PString body(""); | |
266 |
5/5✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
✓ Branch 7 taken 3 times.
✓ Branch 10 taken 3 times.
✓ Branch 13 taken 3 times.
|
3 | body += "\n<summary id=\""+valueToString(obj.getId())+"\" class=\"summary\">\n"; |
267 |
3/3✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
✓ Branch 7 taken 3 times.
|
3 | body += platexobj_htmlStr(outputMode, obj.getVecContent()); |
268 |
1/1✓ Branch 1 taken 3 times.
|
3 | body += "</summary>\n"; |
269 | 3 | return body; | |
270 | } | ||
271 | |||
272 | ///Convert a PLatexObj into a string | ||
273 | /** @param[out] outputMode : output mode of the html backend | ||
274 | * @param obj : PLatexObj to be converted into a string | ||
275 | * @return output string which contains the PLatexObj | ||
276 | */ | ||
277 | 3 | PString platexobj_htmlStrDetail(POutoutMode & outputMode, const PLatexObj & obj){ | |
278 | 3 | PString body(""); | |
279 |
5/5✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
✓ Branch 7 taken 3 times.
✓ Branch 10 taken 3 times.
✓ Branch 13 taken 3 times.
|
3 | body += "\n<details id=\""+valueToString(obj.getId())+"\" class=\"details\"><br />\n"; |
280 |
3/3✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
✓ Branch 7 taken 3 times.
|
3 | body += platexobj_htmlStr(outputMode, obj.getVecContent()); |
281 |
1/1✓ Branch 1 taken 3 times.
|
3 | body += "</details>\n"; |
282 | 3 | return body; | |
283 | } | ||
284 | |||
285 | |||
286 | ///Convert a PLatexObj into a string | ||
287 | /** @param[out] outputMode : output mode of the html backend | ||
288 | * @param obj : PLatexObj to be converted into a string | ||
289 | * @return output string which contains the PLatexObj | ||
290 | */ | ||
291 | 4 | PString platexobj_htmlStrQuote(POutoutMode & outputMode, const PLatexObj & obj){ | |
292 | 4 | PString body(""); | |
293 |
5/5✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
✓ Branch 7 taken 4 times.
✓ Branch 10 taken 4 times.
✓ Branch 13 taken 4 times.
|
4 | body += "\n<div id=\""+valueToString(obj.getId())+"\" class=\"quote\"><br />\n"; |
294 |
3/3✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
✓ Branch 7 taken 4 times.
|
4 | body += platexobj_htmlStr(outputMode, obj.getVecContent()); |
295 |
1/1✓ Branch 1 taken 4 times.
|
4 | body += "</div>\n"; |
296 | 4 | return body; | |
297 | } | ||
298 | |||
299 | ///Convert a PLatexObj into a string | ||
300 | /** @param[out] outputMode : output mode of the html backend | ||
301 | * @param obj : PLatexObj to be converted into a string | ||
302 | * @return output string which contains the PLatexObj | ||
303 | */ | ||
304 | 3 | PString platexobj_htmlStrCallDot(POutoutMode & outputMode, const PLatexObj & obj){ | |
305 |
1/1✓ Branch 1 taken 3 times.
|
3 | PString body(""); |
306 |
2/2✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
|
3 | PString baseContent(obj.getName()); |
307 |
1/1✓ Branch 1 taken 3 times.
|
3 | PPath fileName(baseContent); |
308 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 2 taken 1 times.
|
3 | if(fileName != ""){ |
309 |
2/3✓ Branch 1 taken 2 times.
✓ Branch 3 taken 2 times.
✗ Branch 4 not taken.
|
2 | if(fileName[0] != '/'){ |
310 |
5/5✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 7 taken 2 times.
✓ Branch 10 taken 2 times.
✓ Branch 13 taken 2 times.
|
2 | fileName = PPath(obj.getText()).getParentDirectory() / fileName; |
311 | } | ||
312 |
3/3✓ Branch 1 taken 2 times.
✓ Branch 3 taken 1 times.
✓ Branch 4 taken 1 times.
|
2 | if(!fileName.isFileExist()){ |
313 |
7/7✓ Branch 1 taken 1 times.
✓ Branch 4 taken 1 times.
✓ Branch 7 taken 1 times.
✓ Branch 10 taken 1 times.
✓ Branch 13 taken 1 times.
✓ Branch 16 taken 1 times.
✓ Branch 19 taken 1 times.
|
1 | fileName = PPath(LATEX_IMAGE_OUTPUT_DIR "/call_" + valueToString(obj.getId()) + ".dot"); |
314 |
5/5✓ Branch 1 taken 1 times.
✓ Branch 4 taken 1 times.
✓ Branch 7 taken 1 times.
✓ Branch 10 taken 1 times.
✓ Branch 13 taken 1 times.
|
1 | fileName.saveFileContent(baseContent.eraseFirstLastChar("\n") + "\n"); |
315 | } | ||
316 |
5/5✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 7 taken 2 times.
✓ Branch 10 taken 2 times.
✓ Branch 13 taken 2 times.
|
4 | PString outputFileName(LATEX_IMAGE_OUTPUT_DIR "/call_" + valueToString(obj.getId()) + ".png"); |
317 |
5/5✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 7 taken 2 times.
✓ Branch 10 taken 2 times.
✓ Branch 13 taken 2 times.
|
2 | phoenix_popen("dot -T png -o " + outputFileName + " " + fileName); |
318 | |||
319 |
7/7✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 7 taken 2 times.
✓ Branch 10 taken 2 times.
✓ Branch 13 taken 2 times.
✓ Branch 16 taken 2 times.
✓ Branch 19 taken 2 times.
|
2 | body += "<img id=\""+valueToString(obj.getId())+"\" src=\"" + outputFileName + "\""; |
320 |
4/4✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 7 taken 2 times.
✓ Branch 10 taken 2 times.
|
2 | body += " alt=\"nothing\" />" + platexobj_createLabelSearchLink(obj.getLabelName()); |
321 | 2 | } | |
322 | 6 | return body; | |
323 | 3 | } | |
324 | |||
325 | ///Convert a PLatexObj into a string | ||
326 | /** @param[out] outputMode : output mode of the html backend | ||
327 | * @param obj : PLatexObj to be converted into a string | ||
328 | * @return output string which contains the PLatexObj | ||
329 | */ | ||
330 | 2 | PString platexobj_htmlStrSvgToPng(POutoutMode & outputMode, const PLatexObj & obj){ | |
331 |
1/1✓ Branch 1 taken 2 times.
|
2 | PString body(""); |
332 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
2 | PPath fileName(obj.getName()); |
333 |
2/2✓ Branch 1 taken 1 times.
✓ Branch 2 taken 1 times.
|
2 | if(fileName != ""){ |
334 |
2/3✓ Branch 1 taken 1 times.
✓ Branch 3 taken 1 times.
✗ Branch 4 not taken.
|
1 | if(fileName[0] != '/'){ |
335 |
5/5✓ Branch 1 taken 1 times.
✓ Branch 4 taken 1 times.
✓ Branch 7 taken 1 times.
✓ Branch 10 taken 1 times.
✓ Branch 13 taken 1 times.
|
1 | fileName = PPath(obj.getText()).getParentDirectory() / fileName; |
336 | } | ||
337 |
14/14✓ Branch 1 taken 1 times.
✓ Branch 4 taken 1 times.
✓ Branch 7 taken 1 times.
✓ Branch 10 taken 1 times.
✓ Branch 13 taken 1 times.
✓ Branch 16 taken 1 times.
✓ Branch 19 taken 1 times.
✓ Branch 22 taken 1 times.
✓ Branch 25 taken 1 times.
✓ Branch 28 taken 1 times.
✓ Branch 31 taken 1 times.
✓ Branch 34 taken 1 times.
✓ Branch 37 taken 1 times.
✓ Branch 40 taken 1 times.
|
2 | PString outputFileName(PPath(LATEX_IMAGE_OUTPUT_DIR "/") + fileName.getFileName() + PPath("_") + valueToString(obj.getId()) + PPath(".png")); |
338 |
6/6✓ Branch 1 taken 1 times.
✓ Branch 4 taken 1 times.
✓ Branch 7 taken 1 times.
✓ Branch 10 taken 1 times.
✓ Branch 13 taken 1 times.
✓ Branch 16 taken 1 times.
|
1 | phoenix_popen("convert " + PString(fileName) + " " + outputFileName); |
339 | |||
340 |
7/7✓ Branch 1 taken 1 times.
✓ Branch 4 taken 1 times.
✓ Branch 7 taken 1 times.
✓ Branch 10 taken 1 times.
✓ Branch 13 taken 1 times.
✓ Branch 16 taken 1 times.
✓ Branch 19 taken 1 times.
|
1 | body += "<img id=\""+valueToString(obj.getId())+"\" src=\"" + outputFileName + "\""; |
341 |
4/4✓ Branch 1 taken 1 times.
✓ Branch 4 taken 1 times.
✓ Branch 7 taken 1 times.
✓ Branch 10 taken 1 times.
|
1 | body += " alt=\"nothing\" />" + platexobj_createLabelSearchLink(obj.getLabelName()); |
342 | 1 | } | |
343 | 4 | return body; | |
344 | 2 | } | |
345 | |||
346 | ///Convert a PLatexObj into a string | ||
347 | /** @param[out] outputMode : output mode of the html backend | ||
348 | * @param obj : PLatexObj to be converted into a string | ||
349 | * @param hLevel : h balise | ||
350 | * @param cssClassName : name of the css class to be used | ||
351 | * @return output string which contains the PLatexObj | ||
352 | */ | ||
353 | 635 | PString platexobj_htmlStrAllPart(POutoutMode & outputMode, const PLatexObj & obj, const PString & hLevel, const PString & cssClassName){ | |
354 | 635 | PString body(""); | |
355 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 635 times.
|
635 | if(cssClassName != ""){ |
356 | ✗ | body += "\t<"+hLevel+" id=\""+valueToString(obj.getId())+"\" class=\""+cssClassName+"\">" + getSectionTitle(outputMode, obj) + platexobj_createLabelSearchLink(obj.getLabelName())+"</"+hLevel+">\n"; | |
357 | }else{ | ||
358 |
15/15✓ Branch 1 taken 635 times.
✓ Branch 4 taken 635 times.
✓ Branch 7 taken 635 times.
✓ Branch 10 taken 635 times.
✓ Branch 13 taken 635 times.
✓ Branch 16 taken 635 times.
✓ Branch 19 taken 635 times.
✓ Branch 22 taken 635 times.
✓ Branch 25 taken 635 times.
✓ Branch 28 taken 635 times.
✓ Branch 31 taken 635 times.
✓ Branch 34 taken 635 times.
✓ Branch 37 taken 635 times.
✓ Branch 40 taken 635 times.
✓ Branch 43 taken 635 times.
|
635 | body += "\t<"+hLevel+" id=\""+valueToString(obj.getId())+"\">" + getSectionTitle(outputMode, obj) + platexobj_createLabelSearchLink(obj.getLabelName())+"</"+hLevel+">\n"; |
359 | } | ||
360 | 635 | return body; | |
361 | } | ||
362 | |||
363 | ///Convert a PLatexObj into a string | ||
364 | /** @param[out] outputMode : output mode of the html backend | ||
365 | * @param obj : PLatexObj to be converted into a string | ||
366 | * @return output string which contains the PLatexObj | ||
367 | */ | ||
368 | 316 | PString platexobj_htmlStrExtraEnvironement(POutoutMode & outputMode, const PLatexObj & obj){ | |
369 | 316 | PString body(""); | |
370 |
11/11✓ Branch 1 taken 316 times.
✓ Branch 4 taken 316 times.
✓ Branch 7 taken 316 times.
✓ Branch 10 taken 316 times.
✓ Branch 13 taken 316 times.
✓ Branch 16 taken 316 times.
✓ Branch 19 taken 316 times.
✓ Branch 22 taken 316 times.
✓ Branch 25 taken 316 times.
✓ Branch 28 taken 316 times.
✓ Branch 31 taken 316 times.
|
316 | body += "<"+obj.getBalise()+" id=\""+valueToString(obj.getId())+"\" class=\"" + obj.getName() + "Style\">"; |
371 | |||
372 |
6/6✓ Branch 1 taken 316 times.
✓ Branch 4 taken 316 times.
✓ Branch 7 taken 316 times.
✓ Branch 10 taken 316 times.
✓ Branch 13 taken 316 times.
✓ Branch 16 taken 316 times.
|
316 | body += platexobj_htmlStr(outputMode, obj.getVecContent()) + platexobj_createLabelSearchLink(obj.getLabelName()); |
373 | |||
374 |
4/4✓ Branch 1 taken 316 times.
✓ Branch 4 taken 316 times.
✓ Branch 7 taken 316 times.
✓ Branch 10 taken 316 times.
|
316 | body += "</"+obj.getBalise()+">\n"; |
375 | 316 | return body; | |
376 | } | ||
377 | |||
378 | ///Convert a PLatexObj into a string | ||
379 | /** @param[out] outputMode : output mode of the html backend | ||
380 | * @param obj : PLatexObj to be converted into a string | ||
381 | * @return output string which contains the PLatexObj | ||
382 | */ | ||
383 | 660 | PString platexobj_htmlStrExtraFunction(POutoutMode & outputMode, const PLatexObj & obj){ | |
384 | 660 | PString body(""); | |
385 |
11/11✓ Branch 1 taken 660 times.
✓ Branch 4 taken 660 times.
✓ Branch 7 taken 660 times.
✓ Branch 10 taken 660 times.
✓ Branch 13 taken 660 times.
✓ Branch 16 taken 660 times.
✓ Branch 19 taken 660 times.
✓ Branch 22 taken 660 times.
✓ Branch 25 taken 660 times.
✓ Branch 28 taken 660 times.
✓ Branch 31 taken 660 times.
|
660 | body += "<"+obj.getBalise()+" id=\""+valueToString(obj.getId())+"\" class=\"" + obj.getName() + "Style\">"; |
386 | |||
387 |
6/6✓ Branch 1 taken 660 times.
✓ Branch 4 taken 660 times.
✓ Branch 7 taken 660 times.
✓ Branch 10 taken 660 times.
✓ Branch 13 taken 660 times.
✓ Branch 16 taken 660 times.
|
660 | body += platexobj_htmlStr(outputMode, obj.getVecContent()) + platexobj_createLabelSearchLink(obj.getLabelName()); |
388 | |||
389 |
4/4✓ Branch 1 taken 660 times.
✓ Branch 4 taken 660 times.
✓ Branch 7 taken 660 times.
✓ Branch 10 taken 660 times.
|
660 | body += "</"+obj.getBalise()+">"; |
390 | 660 | return body; | |
391 | } | ||
392 | |||
393 | ///Convert a PLatexObj into a string | ||
394 | /** @param obj : PLatexObj to be converted into a string | ||
395 | * @return output string which contains the PLatexObj | ||
396 | */ | ||
397 | 288 | PString platexobj_htmlStrExtraParser(const PLatexObj & obj){ | |
398 | 288 | PString body(""); | |
399 |
3/3✓ Branch 1 taken 288 times.
✓ Branch 3 taken 230 times.
✓ Branch 4 taken 58 times.
|
288 | if(obj.getNbline() != 0lu){ |
400 |
5/5✓ Branch 1 taken 230 times.
✓ Branch 4 taken 230 times.
✓ Branch 7 taken 230 times.
✓ Branch 10 taken 230 times.
✓ Branch 13 taken 230 times.
|
230 | body += "<table id=\""+valueToString(obj.getId())+"\" class=\"code\">\n\t<tbody>\n\t\t<tr>\n\t\t\t<td class=\"colLineNumbers\">\n\t\t\t\t<pre class=\"lineNumbers\">"; |
401 |
3/3✓ Branch 1 taken 2340 times.
✓ Branch 3 taken 2110 times.
✓ Branch 4 taken 230 times.
|
2340 | for(long unsigned int i(0lu); i < obj.getNbline(); ++i){ |
402 |
3/3✓ Branch 1 taken 2110 times.
✓ Branch 4 taken 2110 times.
✓ Branch 7 taken 2110 times.
|
2110 | body += valueToString(i + 1lu) + "\n"; |
403 | } | ||
404 |
1/1✓ Branch 1 taken 230 times.
|
230 | body += "</pre>\n\t\t\t</td>\n\t\t\t<td>\n\t\t\t\t<pre class=\"source\">\n"; |
405 |
4/4✓ Branch 1 taken 230 times.
✓ Branch 4 taken 230 times.
✓ Branch 7 taken 230 times.
✓ Branch 10 taken 230 times.
|
230 | body += obj.getText().eraseLastChar("\n"); |
406 |
5/5✓ Branch 1 taken 230 times.
✓ Branch 4 taken 230 times.
✓ Branch 7 taken 230 times.
✓ Branch 10 taken 230 times.
✓ Branch 13 taken 230 times.
|
230 | body += "</pre>\n\t\t\t</td>\n\t\t</tr>\n\t</tbody>\n</table>"+platexobj_createLabelSearchLink(obj.getLabelName())+"\n"; |
407 | }else{ | ||
408 |
5/5✓ Branch 1 taken 58 times.
✓ Branch 4 taken 58 times.
✓ Branch 7 taken 58 times.
✓ Branch 10 taken 58 times.
✓ Branch 13 taken 58 times.
|
58 | body += "<span id=\""+valueToString(obj.getId())+"\">"; |
409 |
4/4✓ Branch 1 taken 58 times.
✓ Branch 4 taken 58 times.
✓ Branch 7 taken 58 times.
✓ Branch 10 taken 58 times.
|
58 | body += obj.getText().eraseLastChar("\n"); |
410 |
1/1✓ Branch 1 taken 58 times.
|
58 | body += "</span>"; |
411 | } | ||
412 | 288 | return body; | |
413 | } | ||
414 | |||
415 | ///Convert a timetable into a html string | ||
416 | /** @param[out] outputMode : output mode of the html backend | ||
417 | * @param obj : PLatexObj to be converted in html | ||
418 | * @return html string | ||
419 | */ | ||
420 | 61 | PString platexobj_htmlStrTimetable(POutoutMode & outputMode, const PLatexObj & obj){ | |
421 | 61 | PString body(""); | |
422 |
5/5✓ Branch 1 taken 61 times.
✓ Branch 4 taken 61 times.
✓ Branch 7 taken 61 times.
✓ Branch 10 taken 61 times.
✓ Branch 13 taken 61 times.
|
61 | body += "<table id=\""+valueToString(obj.getId())+"\" class=\"timetableStyle\">\n"; |
423 |
3/3✓ Branch 1 taken 61 times.
✓ Branch 4 taken 61 times.
✓ Branch 7 taken 61 times.
|
61 | body += platexobj_htmlStr(outputMode, obj.getVecContent()); |
424 |
5/5✓ Branch 1 taken 61 times.
✓ Branch 4 taken 61 times.
✓ Branch 7 taken 61 times.
✓ Branch 10 taken 61 times.
✓ Branch 13 taken 61 times.
|
61 | body += "</table>"+platexobj_createLabelSearchLink(obj.getLabelName())+"\n"; |
425 | 61 | return body; | |
426 | } | ||
427 | |||
428 | ///Convert a timetable week into a html string | ||
429 | /** @param[out] outputMode : output mode of the html backend | ||
430 | * @param obj : PLatexObj to be converted in html | ||
431 | * @return html string | ||
432 | */ | ||
433 | 64 | PString platexobj_htmlStrTimetableWeek(POutoutMode & outputMode, const PLatexObj & obj){ | |
434 | 64 | PString body(""); | |
435 | //We add a row in the timetable table | ||
436 |
5/5✓ Branch 1 taken 64 times.
✓ Branch 4 taken 64 times.
✓ Branch 7 taken 64 times.
✓ Branch 10 taken 64 times.
✓ Branch 13 taken 64 times.
|
64 | body += "\t<tr id=\""+valueToString(obj.getId())+"\" ><td class=\"timetableWeekRowStyle\">"; |
437 |
3/3✓ Branch 1 taken 64 times.
✓ Branch 4 taken 64 times.
✓ Branch 7 taken 64 times.
|
64 | body += platexobj_rawtext(obj.getComplexTitle()); |
438 |
1/1✓ Branch 1 taken 64 times.
|
64 | body += "</td></tr>\n"; |
439 |
1/1✓ Branch 1 taken 64 times.
|
64 | body += "\t<tr class=\"timetableMainWeekRowStyle\"><td class=\"timetableMainWeekRowStyle\">\n"; |
440 | //We we put the timetable of the current week | ||
441 |
5/5✓ Branch 1 taken 64 times.
✓ Branch 4 taken 64 times.
✓ Branch 7 taken 64 times.
✓ Branch 10 taken 64 times.
✓ Branch 13 taken 64 times.
|
64 | body += "\t\t<table id=\""+valueToString(obj.getId())+"\" class=\"timetableWeekStyle\">\n"; |
442 |
3/3✓ Branch 1 taken 64 times.
✓ Branch 4 taken 64 times.
✓ Branch 7 taken 64 times.
|
64 | body += platexobj_htmlStr(outputMode, obj.getVecContent()); |
443 |
5/5✓ Branch 1 taken 64 times.
✓ Branch 4 taken 64 times.
✓ Branch 7 taken 64 times.
✓ Branch 10 taken 64 times.
✓ Branch 13 taken 64 times.
|
64 | body += "\t\t</table>"+platexobj_createLabelSearchLink(obj.getLabelName())+"\n"; |
444 |
1/1✓ Branch 1 taken 64 times.
|
64 | body += "\t</td></tr>\n"; |
445 | 64 | return body; | |
446 | } | ||
447 | |||
448 | ///Convert a timetable time row into a html string | ||
449 | /** @param[out] outputMode : output mode of the html backend | ||
450 | * @param obj : PLatexObj to be converted in html | ||
451 | * @return html string | ||
452 | */ | ||
453 | 558 | PString platexobj_htmlStrTimetableTimeRow(POutoutMode & outputMode, const PLatexObj & obj){ | |
454 | 558 | PString body(""); | |
455 |
5/5✓ Branch 1 taken 558 times.
✓ Branch 4 taken 558 times.
✓ Branch 7 taken 558 times.
✓ Branch 10 taken 558 times.
✓ Branch 13 taken 558 times.
|
558 | body += "\t\t\t<tr id=\""+valueToString(obj.getId())+"\" class=\"timetableTimeRow\">\n"; |
456 |
3/3✓ Branch 1 taken 558 times.
✓ Branch 4 taken 558 times.
✓ Branch 7 taken 558 times.
|
558 | body += platexobj_htmlStr(outputMode, obj.getVecContent()); |
457 |
1/1✓ Branch 1 taken 558 times.
|
558 | body += "\t\t\t</tr>\n"; |
458 | 558 | return body; | |
459 | } | ||
460 | |||
461 | ///Convert a timetable day into a html string | ||
462 | /** @param[out] outputMode : output mode of the html backend | ||
463 | * @param obj : PLatexObj to be converted in html | ||
464 | * @return html string | ||
465 | */ | ||
466 | ✗ | PString platexobj_htmlStrTimetableDay(POutoutMode & outputMode, const PLatexObj & obj){ | |
467 | ✗ | PString body(""); | |
468 | //We add a day header in the timetable table | ||
469 | ✗ | body += "\t\t\t\t<td id=\""+valueToString(obj.getId()); | |
470 | ✗ | if(obj.getRowSpan() != 0lu){ | |
471 | ✗ | body += " rowspan=\""+valueToString(obj.getRowSpan())+"\""; | |
472 | } | ||
473 | ✗ | if(obj.getColSpan() != 0lu){ | |
474 | ✗ | body += " colspan=\""+valueToString(obj.getColSpan())+"\""; | |
475 | } | ||
476 | ✗ | body += "\" class=\"timetableDayStyle\">"; | |
477 | ✗ | body += platexobj_rawtext(obj.getVecContent()); | |
478 | ✗ | body += "</td>\n"; | |
479 | ✗ | return body; | |
480 | } | ||
481 | |||
482 | ///Convert a timetable block into a html string | ||
483 | /** @param[out] outputMode : output mode of the html backend | ||
484 | * @param obj : PLatexObj to be converted in html | ||
485 | * @return html string | ||
486 | */ | ||
487 | 991 | PString platexobj_htmlStrTimetableBlock(POutoutMode & outputMode, const PLatexObj & obj){ | |
488 |
1/1✓ Branch 1 taken 991 times.
|
991 | PString body(""); |
489 | //We add a block in the timetable table | ||
490 |
5/5✓ Branch 1 taken 991 times.
✓ Branch 4 taken 991 times.
✓ Branch 7 taken 991 times.
✓ Branch 10 taken 991 times.
✓ Branch 13 taken 991 times.
|
991 | body += "\t\t\t\t<td id=\""+valueToString(obj.getId()) + "\""; |
491 |
3/3✓ Branch 1 taken 991 times.
✓ Branch 3 taken 792 times.
✓ Branch 4 taken 199 times.
|
991 | if(obj.getRowSpan() != 0lu){ |
492 |
5/5✓ Branch 1 taken 792 times.
✓ Branch 4 taken 792 times.
✓ Branch 7 taken 792 times.
✓ Branch 10 taken 792 times.
✓ Branch 13 taken 792 times.
|
792 | body += " rowspan=\""+valueToString(obj.getRowSpan())+"\""; |
493 | } | ||
494 |
2/3✓ Branch 1 taken 991 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 991 times.
|
991 | if(obj.getColSpan() != 0lu){ |
495 | ✗ | body += " colspan=\""+valueToString(obj.getColSpan())+"\""; | |
496 | } | ||
497 |
1/1✓ Branch 1 taken 991 times.
|
991 | PString blockStyle("timetableBlockStyle"); |
498 |
3/3✓ Branch 1 taken 991 times.
✓ Branch 4 taken 595 times.
✓ Branch 5 taken 396 times.
|
991 | if(obj.getText() != ""){ |
499 |
2/2✓ Branch 1 taken 595 times.
✓ Branch 4 taken 595 times.
|
595 | blockStyle = obj.getText(); |
500 | } | ||
501 |
3/3✓ Branch 1 taken 991 times.
✓ Branch 4 taken 991 times.
✓ Branch 7 taken 991 times.
|
991 | body += " class=\""+blockStyle+"\">"; |
502 |
3/3✓ Branch 1 taken 991 times.
✓ Branch 4 taken 991 times.
✓ Branch 7 taken 991 times.
|
991 | body += platexobj_htmlStr(outputMode, obj.getVecContent()); |
503 |
1/1✓ Branch 1 taken 991 times.
|
991 | body += "</td>\n"; |
504 | 1982 | return body; | |
505 | 991 | } | |
506 | |||
507 | ///Convert a timetable block into a html string | ||
508 | /** @param[out] outputMode : output mode of the html backend | ||
509 | * @param obj : PLatexObj to be converted in html | ||
510 | * @return html string | ||
511 | */ | ||
512 | 234 | PString platexobj_htmlStrTimetableEmptyBlock(POutoutMode & outputMode, const PLatexObj & obj){ | |
513 | 234 | PString body(""); | |
514 | //We add a block in the timetable table | ||
515 |
5/5✓ Branch 1 taken 234 times.
✓ Branch 4 taken 234 times.
✓ Branch 7 taken 234 times.
✓ Branch 10 taken 234 times.
✓ Branch 13 taken 234 times.
|
234 | body += "\t\t\t\t<td id=\""+valueToString(obj.getId()) + "\""; |
516 |
2/3✓ Branch 1 taken 234 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 234 times.
|
234 | if(obj.getRowSpan() != 0lu){ |
517 | ✗ | body += " rowspan=\""+valueToString(obj.getRowSpan())+"\""; | |
518 | } | ||
519 |
2/3✓ Branch 1 taken 234 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 234 times.
|
234 | if(obj.getColSpan() != 0lu){ |
520 | ✗ | body += " colspan=\""+valueToString(obj.getColSpan())+"\""; | |
521 | } | ||
522 |
1/1✓ Branch 1 taken 234 times.
|
234 | body += " class=\"timetableEmptyBlockStyle\"></td>\n"; |
523 | 234 | return body; | |
524 | } | ||
525 | ///Convert a timetable time into a html string | ||
526 | /** @param[out] outputMode : output mode of the html backend | ||
527 | * @param obj : PLatexObj to be converted in html | ||
528 | * @return html string | ||
529 | */ | ||
530 | 494 | PString platexobj_htmlStrTimetableTime(POutoutMode & outputMode, const PLatexObj & obj){ | |
531 | 494 | PString body(""); | |
532 | //We add a block in the timetable table | ||
533 |
5/5✓ Branch 1 taken 494 times.
✓ Branch 4 taken 494 times.
✓ Branch 7 taken 494 times.
✓ Branch 10 taken 494 times.
✓ Branch 13 taken 494 times.
|
494 | body += "\t\t\t\t<td id=\""+valueToString(obj.getId())+"\" class=\"timetableTimeStyle\"><span class=\"timetableTimeTextStyle\">"; |
534 |
2/2✓ Branch 1 taken 494 times.
✓ Branch 4 taken 494 times.
|
494 | body += obj.getText(); |
535 |
1/1✓ Branch 1 taken 494 times.
|
494 | body += "</span></td>\n"; |
536 | 494 | return body; | |
537 | } | ||
538 | |||
539 | ///Convert a rendez-vous into a html string | ||
540 | /** @param obj : PLatexObj to be converted in html | ||
541 | * @return html string | ||
542 | */ | ||
543 | 895 | PString platexobj_htmlStrRendezVous(const PLatexObj & obj){ | |
544 | 895 | PString body(""); | |
545 | //We add a block in the timetable table | ||
546 |
8/8✓ Branch 1 taken 895 times.
✓ Branch 4 taken 895 times.
✓ Branch 7 taken 895 times.
✓ Branch 10 taken 895 times.
✓ Branch 13 taken 895 times.
✓ Branch 16 taken 895 times.
✓ Branch 19 taken 895 times.
✓ Branch 22 taken 895 times.
|
895 | body += "<a id=\""+valueToString(obj.getId())+"\" href=\""+obj.getText()+"\"><div class=\"rendezvousStyle\"></div></a>"; |
547 | 895 | return body; | |
548 | } | ||
549 | |||
550 | ///Convert a basic environement into a string | ||
551 | /** @param[out] outputMode : output mode of the html backend | ||
552 | * @param obj : PLatexObj to be converted in html | ||
553 | * @param baliseName : name of the balise environement | ||
554 | * @param cssClassName : name of the css class to be used | ||
555 | * @param allowText : true if the TEXT PLatexObj are allowed, false if not | ||
556 | * @return html string | ||
557 | */ | ||
558 | 363 | PString platexobj_htmlStrBasicEnv(POutoutMode & outputMode, const PLatexObj & obj, const PString & baliseName, const PString & cssClassName, bool allowText){ | |
559 | 363 | PString body(""); | |
560 |
7/7✓ Branch 1 taken 363 times.
✓ Branch 4 taken 363 times.
✓ Branch 7 taken 363 times.
✓ Branch 10 taken 363 times.
✓ Branch 13 taken 363 times.
✓ Branch 16 taken 363 times.
✓ Branch 19 taken 363 times.
|
363 | body += "<"+baliseName + " id=\""+valueToString(obj.getId())+"\""; |
561 |
1/2✓ Branch 1 taken 363 times.
✗ Branch 2 not taken.
|
363 | if(cssClassName != ""){ |
562 |
3/3✓ Branch 1 taken 363 times.
✓ Branch 4 taken 363 times.
✓ Branch 7 taken 363 times.
|
363 | body += " class=\""+cssClassName+"\""; |
563 | } | ||
564 |
1/1✓ Branch 1 taken 363 times.
|
363 | body += ">\n"; |
565 |
3/3✓ Branch 1 taken 363 times.
✓ Branch 4 taken 363 times.
✓ Branch 7 taken 363 times.
|
363 | body += platexobj_htmlStr(outputMode, obj.getVecContent(), false, allowText); |
566 |
7/7✓ Branch 1 taken 363 times.
✓ Branch 4 taken 363 times.
✓ Branch 7 taken 363 times.
✓ Branch 10 taken 363 times.
✓ Branch 13 taken 363 times.
✓ Branch 16 taken 363 times.
✓ Branch 19 taken 363 times.
|
363 | body += "</"+baliseName+">"+platexobj_createLabelSearchLink(obj.getLabelName())+"\n"; |
567 | 363 | return body; | |
568 | } | ||
569 | |||
570 | ///Convert a tabular into a html string | ||
571 | /** @param[out] outputMode : output mode of the html backend | ||
572 | * @param obj : PLatexObj to be converted in html | ||
573 | * @return html string | ||
574 | */ | ||
575 | 1 | PString platexobj_htmlStrTabular(POutoutMode & outputMode, const PLatexObj & obj){ | |
576 | 1 | PString body(""); | |
577 |
5/5✓ Branch 1 taken 1 times.
✓ Branch 4 taken 1 times.
✓ Branch 7 taken 1 times.
✓ Branch 10 taken 1 times.
✓ Branch 13 taken 1 times.
|
1 | body += "<table id=\""+valueToString(obj.getId())+"\" class=\"tabularStyle\">\n"; |
578 |
3/3✓ Branch 1 taken 1 times.
✓ Branch 4 taken 1 times.
✓ Branch 7 taken 1 times.
|
1 | body += platexobj_htmlStr(outputMode, obj.getVecContent()); |
579 |
5/5✓ Branch 1 taken 1 times.
✓ Branch 4 taken 1 times.
✓ Branch 7 taken 1 times.
✓ Branch 10 taken 1 times.
✓ Branch 13 taken 1 times.
|
1 | body += "</table>"+platexobj_createLabelSearchLink(obj.getLabelName())+"\n"; |
580 | 1 | return body; | |
581 | } | ||
582 | |||
583 | ///Convert a tabular into a html string | ||
584 | /** @param[out] outputMode : output mode of the html backend | ||
585 | * @param obj : PLatexObj to be converted in html | ||
586 | * @return html string | ||
587 | */ | ||
588 | 10 | PString platexobj_htmlStrTabRow(POutoutMode & outputMode, const PLatexObj & obj){ | |
589 | 10 | PString body(""); | |
590 |
1/1✓ Branch 1 taken 10 times.
|
10 | body += "\t<tr>\n"; |
591 |
3/3✓ Branch 1 taken 10 times.
✓ Branch 4 taken 10 times.
✓ Branch 7 taken 10 times.
|
10 | body += platexobj_htmlStr(outputMode, obj.getVecContent()); |
592 |
1/1✓ Branch 1 taken 10 times.
|
10 | body += "\t</tr>\n"; |
593 | 10 | return body; | |
594 | } | ||
595 | |||
596 | ///Convert a tabular into a html string | ||
597 | /** @param[out] outputMode : output mode of the html backend | ||
598 | * @param obj : PLatexObj to be converted in html | ||
599 | * @return html string | ||
600 | */ | ||
601 | 50 | PString platexobj_htmlStrTabCell(POutoutMode & outputMode, const PLatexObj & obj){ | |
602 | 50 | PString body(""); | |
603 |
1/1✓ Branch 1 taken 50 times.
|
50 | body += "\t\t<td>\n"; |
604 |
3/3✓ Branch 1 taken 50 times.
✓ Branch 4 taken 50 times.
✓ Branch 7 taken 50 times.
|
50 | body += platexobj_htmlStr(outputMode, obj.getVecContent()); |
605 |
1/1✓ Branch 1 taken 50 times.
|
50 | body += "\t\t</td>\n"; |
606 | 50 | return body; | |
607 | } | ||
608 | |||
609 | ///Convert a PLatexObj into a string | ||
610 | /** @param[out] outputMode : output mode of the html backend | ||
611 | * @param obj : PLatexObj to be converted into a string | ||
612 | * @return output string which contains the PLatexObj | ||
613 | */ | ||
614 | 1 | PString platexobj_htmlStrColumns(POutoutMode & outputMode, const PLatexObj & obj){ | |
615 | 1 | PString body(""); | |
616 |
5/5✓ Branch 1 taken 1 times.
✓ Branch 4 taken 1 times.
✓ Branch 7 taken 1 times.
✓ Branch 10 taken 1 times.
✓ Branch 13 taken 1 times.
|
1 | body += "<table id=\""+valueToString(obj.getId())+"\" class=\"columnsStyle\">\n"; |
617 |
1/1✓ Branch 1 taken 1 times.
|
1 | body += "\t<tr>\n"; |
618 |
1/1✓ Branch 1 taken 1 times.
|
1 | const PVecLatexObj & vecObj = obj.getVecContent(); |
619 |
2/2✓ Branch 3 taken 5 times.
✓ Branch 4 taken 1 times.
|
6 | for(PVecLatexObj::const_iterator it(vecObj.begin()); it != vecObj.end(); ++it){ |
620 | // body += "\t\t<td>\n\t\t\t"; | ||
621 |
2/2✓ Branch 2 taken 5 times.
✓ Branch 5 taken 5 times.
|
5 | body += platexobj_htmlStr(outputMode, *it); |
622 | // body += "\n\t\t</td>\n"; | ||
623 | } | ||
624 |
1/1✓ Branch 1 taken 1 times.
|
1 | body += "\t</tr>\n</table>\n"; |
625 | 1 | return body; | |
626 | } | ||
627 | |||
628 | ///Convert a vector of numbers into a string | ||
629 | /** @param vecNb : vector of numbers to be converted | ||
630 | * @return output string | ||
631 | */ | ||
632 | 1157 | PString vecNumberToString(const std::vector<long unsigned int> & vecNb){ | |
633 |
3/3✓ Branch 1 taken 13 times.
✓ Branch 2 taken 1144 times.
✓ Branch 4 taken 13 times.
|
1157 | if(vecNb.size() == 0lu){return "";} |
634 |
1/1✓ Branch 1 taken 1144 times.
|
1144 | PString body(""); |
635 | 1144 | std::vector<long unsigned int>::const_iterator it(vecNb.begin()); | |
636 |
2/2✓ Branch 2 taken 1144 times.
✓ Branch 5 taken 1144 times.
|
1144 | body += valueToString(*it); |
637 | 1144 | ++it; | |
638 |
2/2✓ Branch 2 taken 2333 times.
✓ Branch 3 taken 1144 times.
|
3477 | while(it != vecNb.end()){ |
639 |
3/3✓ Branch 2 taken 2333 times.
✓ Branch 5 taken 2333 times.
✓ Branch 8 taken 2333 times.
|
2333 | body += "." + valueToString(*it); |
640 | 2333 | ++it; | |
641 | } | ||
642 |
1/1✓ Branch 1 taken 1144 times.
|
1144 | return body; |
643 | 1144 | } | |
644 | |||
645 | ///Convert the vector of menu into a html string | ||
646 | /** @param vecMenu : vector to be converted | ||
647 | * @return output string | ||
648 | */ | ||
649 | 300 | PString vecMenuToHtml(const PVecMenu & vecMenu){ | |
650 |
3/3✓ Branch 1 taken 241 times.
✓ Branch 2 taken 59 times.
✓ Branch 4 taken 241 times.
|
300 | if(vecMenu.size() == 0lu){return "";} |
651 |
1/1✓ Branch 1 taken 59 times.
|
59 | PString body(""); |
652 |
1/1✓ Branch 1 taken 59 times.
|
59 | body += "\t\t<ul class=\"sommaire\">\n"; |
653 |
2/2✓ Branch 4 taken 193 times.
✓ Branch 5 taken 59 times.
|
252 | for(PVecMenu::const_iterator it(vecMenu.begin()); it != vecMenu.end(); ++it){ |
654 |
12/12✓ Branch 2 taken 193 times.
✓ Branch 5 taken 193 times.
✓ Branch 8 taken 193 times.
✓ Branch 11 taken 193 times.
✓ Branch 14 taken 193 times.
✓ Branch 17 taken 193 times.
✓ Branch 21 taken 193 times.
✓ Branch 24 taken 193 times.
✓ Branch 27 taken 193 times.
✓ Branch 30 taken 193 times.
✓ Branch 33 taken 193 times.
✓ Branch 36 taken 193 times.
|
193 | body += "\t\t\t<li><a href=\""+it->getLink()+"\">"+getSecNumberFromFileName(it->getLink()).replace("-", ".")+") "; |
655 | |||
656 | // body += convertStrToHtml(it->getText()); | ||
657 |
2/2✓ Branch 2 taken 193 times.
✓ Branch 5 taken 193 times.
|
193 | body += it->getText(); |
658 | |||
659 |
1/1✓ Branch 1 taken 193 times.
|
193 | body += "</a></li>\n"; |
660 | } | ||
661 |
1/1✓ Branch 1 taken 59 times.
|
59 | body += "\t\t</ul>\n"; |
662 |
1/1✓ Branch 1 taken 59 times.
|
59 | return body; |
663 | 59 | } | |
664 | |||
665 | ///Get the html header | ||
666 | /** @param title : page title | ||
667 | * @param useMathJax : true to use MathJax, false otherwise | ||
668 | * @param useRemoteMathjax : true if we use remote mathjax | ||
669 | * @param currentStyle : current style to be used | ||
670 | * @return output string | ||
671 | */ | ||
672 | 619 | PString getHtmlHeader(const PString & title, bool useMathJax, bool useRemoteMathjax, const PString & currentStyle){ | |
673 | 619 | PString body(""); | |
674 |
1/1✓ Branch 1 taken 619 times.
|
619 | body += "<!DOCTYPE html>\n"; |
675 |
1/1✓ Branch 1 taken 619 times.
|
619 | body += "<html lang=\"fr\">\n"; |
676 |
1/1✓ Branch 1 taken 619 times.
|
619 | body += "\t<head>\n"; |
677 |
1/1✓ Branch 1 taken 619 times.
|
619 | body += "\t\t<meta charset=\"utf-8\" />\n"; |
678 |
3/3✓ Branch 1 taken 619 times.
✓ Branch 4 taken 619 times.
✓ Branch 7 taken 619 times.
|
619 | body += "\t\t<title>"+title+"</title>\n"; |
679 |
3/3✓ Branch 1 taken 619 times.
✓ Branch 4 taken 619 times.
✓ Branch 7 taken 619 times.
|
619 | body += "\t\t<link rel=\"stylesheet\" href=\""+currentStyle+"_style.css\" />\n"; |
680 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 619 times.
|
619 | if(useMathJax){ |
681 | ✗ | if(useRemoteMathjax){ | |
682 | ✗ | body += "\t\t<script src=\"load-mathjax.js\" async></script>\n"; | |
683 | }else{ | ||
684 | ✗ | body += "\t\t<script type=\"text/x-mathjax-config\">\n"; | |
685 | ✗ | body += "\t\t\tMathJax.Hub.Config({\n"; | |
686 | ✗ | body += "\t\t\t\textensions: [\"tex2jax.js\"],\n"; | |
687 | ✗ | body += "\t\t\t\tjax: [\"input/TeX\",\"output/HTML-CSS\"],\n"; | |
688 | ✗ | body += "\t\t\t\ttex2jax: {inlineMath: [[\"$\",\"$\"],[\"\\\\(\",\"\\\\)\"]]}\n"; | |
689 | ✗ | body += "\t\t\t});\n"; | |
690 | ✗ | body += "\t\t</script>\n"; | |
691 | ✗ | body += "\t\t<script type=\"text/javascript\" src=\"MathJax.js\"></script>\n"; | |
692 | } | ||
693 | } | ||
694 |
1/1✓ Branch 1 taken 619 times.
|
619 | body += "\t</head>\n"; |
695 |
1/1✓ Branch 1 taken 619 times.
|
619 | body += "\t<body>\n"; |
696 | 619 | return body; | |
697 | } | ||
698 | |||
699 | ///Get html footer | ||
700 | /** @return html footer | ||
701 | */ | ||
702 | 619 | PString getHtmlFooter(){ | |
703 | 619 | PString body(""); | |
704 |
1/1✓ Branch 1 taken 619 times.
|
619 | body += "\t</body>\n"; |
705 |
1/1✓ Branch 1 taken 619 times.
|
619 | body += "</html>\n\n"; |
706 | 619 | return body; | |
707 | |||
708 | } | ||
709 | |||
710 | ///Save a section in html | ||
711 | /** @param[out] outputMode : output mode of the html backend | ||
712 | * @param obj : PLatexObj to be saved | ||
713 | * @param baliseName : name of the title balise | ||
714 | * @param cssClassName : css class to be used | ||
715 | * @param prefixTitle : prefix of the title (Part or Chapter) | ||
716 | * @param isBibliography : true if there is a bibliography, false otherwise | ||
717 | */ | ||
718 | 193 | void platexobj_sectionHtml(POutoutMode & outputMode, const PLatexObj & obj, const PString & baliseName, const PString & cssClassName, | |
719 | const PString & prefixTitle, bool isBibliography) | ||
720 | { | ||
721 |
1/1✓ Branch 1 taken 193 times.
|
193 | PString body(""); |
722 |
1/1✓ Branch 1 taken 193 times.
|
193 | const PVecLatexObj & vecObj = obj.getVecContent(); |
723 |
2/2✓ Branch 3 taken 2051 times.
✓ Branch 4 taken 193 times.
|
2244 | for(PVecLatexObj::const_iterator it(vecObj.begin()); it != vecObj.end(); ++it){ |
724 |
2/2✓ Branch 2 taken 2051 times.
✓ Branch 5 taken 2051 times.
|
2051 | body += platexobj_htmlStr(outputMode, *it, isBibliography); |
725 | } | ||
726 |
1/1✓ Branch 1 taken 193 times.
|
193 | PString objTitle(getSectionTitle(outputMode, obj)); //Content of the section title |
727 |
7/7✓ Branch 1 taken 193 times.
✓ Branch 4 taken 193 times.
✓ Branch 7 taken 193 times.
✓ Branch 10 taken 193 times.
✓ Branch 13 taken 193 times.
✓ Branch 16 taken 193 times.
✓ Branch 19 taken 193 times.
|
386 | platexobj_theme_update_var(outputMode, obj.getLink(), platexobj_rawtext(obj.getComplexTitle()), |
728 |
4/4✓ Branch 1 taken 193 times.
✓ Branch 4 taken 193 times.
✓ Branch 7 taken 193 times.
✓ Branch 10 taken 193 times.
|
193 | obj.getPrevSec().getLink(), obj.getPrevSec().getText(), |
729 |
4/4✓ Branch 1 taken 193 times.
✓ Branch 4 taken 193 times.
✓ Branch 7 taken 193 times.
✓ Branch 10 taken 193 times.
|
193 | obj.getNextSec().getLink(), obj.getNextSec().getText(), |
730 |
4/4✓ Branch 1 taken 193 times.
✓ Branch 4 taken 193 times.
✓ Branch 7 taken 193 times.
✓ Branch 10 taken 193 times.
|
193 | obj.getParentSec().getLink(), obj.getParentSec().getText(), |
731 | obj.getSourceFile(), obj.getSourceLine()); | ||
732 | |||
733 |
6/6✓ Branch 1 taken 193 times.
✓ Branch 4 taken 193 times.
✓ Branch 7 taken 193 times.
✓ Branch 10 taken 193 times.
✓ Branch 13 taken 193 times.
✓ Branch 16 taken 193 times.
|
193 | outputMode.mapVar["${MAIN_TITLE}"] = "\t\t" + platexobj_createTitle(obj, baliseName, cssClassName, objTitle, prefixTitle, true); |
734 |
5/5✓ Branch 1 taken 193 times.
✓ Branch 4 taken 193 times.
✓ Branch 7 taken 193 times.
✓ Branch 10 taken 193 times.
✓ Branch 13 taken 193 times.
|
193 | outputMode.mapVar["${SUB_MENU}"] = vecMenuToHtml(obj.getVecMenu()); |
735 |
3/3✓ Branch 1 taken 193 times.
✓ Branch 4 taken 193 times.
✓ Branch 7 taken 193 times.
|
193 | outputMode.mapVar["${PAGE_CONTENT}"] = body; |
736 | |||
737 |
2/2✓ Branch 1 taken 193 times.
✓ Branch 4 taken 193 times.
|
193 | PPath fileName(obj.getLink()); |
738 |
3/4✓ Branch 1 taken 193 times.
✓ Branch 4 taken 193 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 193 times.
|
193 | if(!fileName.saveFileContent(platexobj_theme_createPage(outputMode))){ |
739 | ✗ | std::cerr << "platexobj_sectionHtml : can't save file '"<<fileName<<"' for object '" << obj.getName() << "'" << std::endl; | |
740 | } | ||
741 | // else{ | ||
742 | // std::cout << "platexobj_sectionHtml : save file '"<<fileName<<"'" << std::endl; | ||
743 | // } | ||
744 | 193 | } | |
745 | |||
746 | ///Convert a PLatexObj into a string | ||
747 | /** @param title : title name | ||
748 | * @param hLevel : h balise | ||
749 | * @param cssClassName : name of the css class to be used | ||
750 | * @return output string which contains the PLatexObj | ||
751 | */ | ||
752 | 472 | PString platexobj_htmlMainTitle(const PString & title, const PString & hLevel, const PString & cssClassName){ | |
753 |
3/3✓ Branch 1 taken 164 times.
✓ Branch 2 taken 308 times.
✓ Branch 4 taken 164 times.
|
472 | if(title == ""){return "";} |
754 |
1/1✓ Branch 1 taken 308 times.
|
308 | PString body(""); |
755 |
9/9✓ Branch 1 taken 308 times.
✓ Branch 4 taken 308 times.
✓ Branch 7 taken 308 times.
✓ Branch 10 taken 308 times.
✓ Branch 13 taken 308 times.
✓ Branch 16 taken 308 times.
✓ Branch 19 taken 308 times.
✓ Branch 22 taken 308 times.
✓ Branch 25 taken 308 times.
|
308 | body += "\t<"+hLevel+" class=\""+cssClassName+"\">" + title + "</"+hLevel+">\n"; |
756 |
1/1✓ Branch 1 taken 308 times.
|
308 | return body; |
757 | 308 | } | |
758 | |||
759 | ///Save the index.html file | ||
760 | /** @param[out] outputMode : output mode of the html backend | ||
761 | * @param obj : PLatexObj to be used | ||
762 | * @param isBibliography : true if there is a bibliography, false otherwise | ||
763 | */ | ||
764 | 107 | PString platexobj_indexHtml(POutoutMode & outputMode, const PLatexObj & obj, bool isBibliography){ | |
765 |
1/1✓ Branch 1 taken 107 times.
|
107 | PString body(""); |
766 |
1/1✓ Branch 1 taken 107 times.
|
107 | const PVecLatexObj & vecObj = obj.getVecContent(); |
767 |
2/2✓ Branch 3 taken 6276 times.
✓ Branch 4 taken 107 times.
|
6383 | for(PVecLatexObj::const_iterator it(vecObj.begin()); it != vecObj.end(); ++it){ |
768 |
2/2✓ Branch 2 taken 6276 times.
✓ Branch 5 taken 6276 times.
|
6276 | body += platexobj_htmlStr(outputMode, *it, isBibliography); |
769 | } | ||
770 |
6/6✓ Branch 1 taken 107 times.
✓ Branch 4 taken 107 times.
✓ Branch 7 taken 107 times.
✓ Branch 10 taken 107 times.
✓ Branch 13 taken 107 times.
✓ Branch 16 taken 107 times.
|
214 | platexobj_theme_update_var(outputMode, obj.getLink(), obj.getName(), |
771 |
4/4✓ Branch 1 taken 107 times.
✓ Branch 4 taken 107 times.
✓ Branch 7 taken 107 times.
✓ Branch 10 taken 107 times.
|
107 | obj.getPrevSec().getLink(), obj.getPrevSec().getText(), |
772 |
4/4✓ Branch 1 taken 107 times.
✓ Branch 4 taken 107 times.
✓ Branch 7 taken 107 times.
✓ Branch 10 taken 107 times.
|
107 | obj.getNextSec().getLink(), obj.getNextSec().getText(), |
773 |
4/4✓ Branch 1 taken 107 times.
✓ Branch 4 taken 107 times.
✓ Branch 7 taken 107 times.
✓ Branch 10 taken 107 times.
|
107 | obj.getParentSec().getLink(), obj.getParentSec().getText(), |
774 | obj.getSourceFile(), obj.getSourceLine()); | ||
775 |
1/1✓ Branch 1 taken 107 times.
|
107 | PString bodyTitle(""); |
776 |
5/5✓ Branch 1 taken 107 times.
✓ Branch 4 taken 107 times.
✓ Branch 7 taken 107 times.
✓ Branch 10 taken 107 times.
✓ Branch 13 taken 107 times.
|
107 | bodyTitle += platexobj_htmlMainTitle(obj.getName(), "h1", "mainTitle"); |
777 |
5/5✓ Branch 1 taken 107 times.
✓ Branch 4 taken 107 times.
✓ Branch 7 taken 107 times.
✓ Branch 10 taken 107 times.
✓ Branch 13 taken 107 times.
|
107 | bodyTitle += platexobj_htmlMainTitle(obj.getSubTitle(), "h2", "mainSubTitle"); |
778 |
5/5✓ Branch 1 taken 107 times.
✓ Branch 4 taken 107 times.
✓ Branch 7 taken 107 times.
✓ Branch 10 taken 107 times.
✓ Branch 13 taken 107 times.
|
107 | bodyTitle += platexobj_htmlMainTitle(obj.getAuthor(), "h5", "author"); |
779 |
5/5✓ Branch 1 taken 107 times.
✓ Branch 4 taken 107 times.
✓ Branch 7 taken 107 times.
✓ Branch 10 taken 107 times.
✓ Branch 13 taken 107 times.
|
107 | bodyTitle += platexobj_htmlMainTitle(obj.getDate(), "h6", "date"); |
780 |
3/3✓ Branch 1 taken 107 times.
✓ Branch 4 taken 107 times.
✓ Branch 7 taken 107 times.
|
107 | outputMode.mapVar["${MAIN_TITLE}"] = bodyTitle; |
781 |
5/5✓ Branch 1 taken 107 times.
✓ Branch 4 taken 107 times.
✓ Branch 7 taken 107 times.
✓ Branch 10 taken 107 times.
✓ Branch 13 taken 107 times.
|
107 | outputMode.mapVar["${SUB_MENU}"] = vecMenuToHtml(obj.getVecMenu()); |
782 |
3/3✓ Branch 1 taken 107 times.
✓ Branch 4 taken 107 times.
✓ Branch 7 taken 107 times.
|
107 | outputMode.mapVar["${PAGE_CONTENT}"] = body; |
783 |
1/1✓ Branch 1 taken 107 times.
|
214 | return platexobj_theme_createPage(outputMode); |
784 | 107 | } | |
785 | |||
786 | ///Convert an itemize environement in html | ||
787 | /** @param[out] outputMode : output mode of the html backend | ||
788 | * @param obj : PLatexObj to be converted | ||
789 | * @return html string | ||
790 | */ | ||
791 | 186 | PString platexobj_htmlStrItemize(POutoutMode & outputMode, const PLatexObj & obj){ | |
792 | 186 | PString body(""); | |
793 |
1/1✓ Branch 1 taken 186 times.
|
186 | body += "\t\t<ul>\n"; |
794 |
3/3✓ Branch 1 taken 186 times.
✓ Branch 4 taken 186 times.
✓ Branch 7 taken 186 times.
|
186 | body += platexobj_htmlStr(outputMode, obj.getVecContent()); |
795 |
1/1✓ Branch 1 taken 186 times.
|
186 | body += "\t\t</ul>\n"; |
796 | 186 | return body; | |
797 | } | ||
798 | |||
799 | ///Convert an itemize environement in html | ||
800 | /** @param[out] outputMode : output mode of the html backend | ||
801 | * @param obj : PLatexObj to be converted | ||
802 | * @return html string | ||
803 | */ | ||
804 | 4 | PString platexobj_htmlStrEnumerate(POutoutMode & outputMode, const PLatexObj & obj){ | |
805 | 4 | PString body(""); | |
806 |
1/1✓ Branch 1 taken 4 times.
|
4 | body += "\t\t<ol>\n"; |
807 |
3/3✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
✓ Branch 7 taken 4 times.
|
4 | body += platexobj_htmlStr(outputMode, obj.getVecContent()); |
808 |
1/1✓ Branch 1 taken 4 times.
|
4 | body += "\t\t</ol>\n"; |
809 | 4 | return body; | |
810 | } | ||
811 | |||
812 | ///Convert an itemize environement in html | ||
813 | /** @param[out] outputMode : output mode of the html backend | ||
814 | * @param obj : PLatexObj to be converted | ||
815 | * @return html string | ||
816 | */ | ||
817 | 396 | PString platexobj_htmlStrItem(POutoutMode & outputMode, const PLatexObj & obj){ | |
818 | 396 | PString body(""); | |
819 |
1/1✓ Branch 1 taken 396 times.
|
396 | body += "\t\t<li>"; |
820 |
3/3✓ Branch 1 taken 396 times.
✓ Branch 4 taken 396 times.
✓ Branch 7 taken 396 times.
|
396 | body += platexobj_htmlStr(outputMode, obj.getVecContent()); |
821 |
1/1✓ Branch 1 taken 396 times.
|
396 | body += "</li>\n"; |
822 | 396 | return body; | |
823 | } | ||
824 | |||
825 | ///Convert a video call in html | ||
826 | /** @param obj : PLatexObj to be converted | ||
827 | * @return html string | ||
828 | */ | ||
829 | 6 | PString platexobj_htmlStrVideo(const PLatexObj & obj){ | |
830 |
1/1✓ Branch 1 taken 6 times.
|
6 | PString body(""); |
831 |
2/2✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
|
6 | PPath fileName(obj.getName()); |
832 |
4/4✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
✓ Branch 7 taken 6 times.
✓ Branch 10 taken 6 times.
|
6 | body += "\t<video width=\""+obj.getText()+"\" controls>\n"; |
833 |
1/1✓ Branch 1 taken 6 times.
|
6 | body += "\t\t<!-- Be careful, if you do not have sound, check if the video has MP3 sound and not AC3 -->\n"; |
834 |
6/6✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
✓ Branch 7 taken 6 times.
✓ Branch 10 taken 6 times.
✓ Branch 13 taken 6 times.
✓ Branch 16 taken 6 times.
|
6 | body += "\t\t<source src=\""+fileName+"\" type=\"video/"+fileName.getExtension()+"\">\n"; |
835 |
5/5✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
✓ Branch 7 taken 6 times.
✓ Branch 10 taken 6 times.
✓ Branch 13 taken 6 times.
|
6 | body += "\t</video>"+platexobj_createLabelSearchLink(obj.getLabelName())+"\n"; |
836 | 12 | return body; | |
837 | 6 | } | |
838 | |||
839 | ///Convert a PLatexObj into a string (only base function) | ||
840 | /** @param[out] body : output string which contains the PLatexObj | ||
841 | * @param[out] outputMode : output mode of the html backend | ||
842 | * @param obj : PLatexObj to be converted into a string | ||
843 | * @param isBibliography : true if there is a bibliography, false otherwise | ||
844 | * @param allowText : true if the TEXT PLatexObj are allowed, false if not | ||
845 | * @return true on sucess, false otherwise | ||
846 | */ | ||
847 | 21880 | bool platexobj_htmlStrBase(PString & body, POutoutMode & outputMode, const PLatexObj & obj, bool isBibliography, bool allowText){ | |
848 | 21880 | PLatexType::PLatexType type(obj.getType()); | |
849 |
5/5✓ Branch 0 taken 9668 times.
✓ Branch 1 taken 12212 times.
✓ Branch 2 taken 9445 times.
✓ Branch 3 taken 223 times.
✓ Branch 6 taken 9445 times.
|
21880 | if(type == PLatexType::TEXT && allowText){body = platexobj_htmlStrText(obj);} |
850 |
3/3✓ Branch 0 taken 107 times.
✓ Branch 1 taken 12328 times.
✓ Branch 4 taken 107 times.
|
12435 | else if(type == PLatexType::URL){body = platexobj_htmlStrUrl(obj);} |
851 |
3/3✓ Branch 0 taken 6 times.
✓ Branch 1 taken 12322 times.
✓ Branch 4 taken 6 times.
|
12328 | else if(type == PLatexType::GETENV){body = platexobj_htmlStrGetEnv(obj);} |
852 |
3/3✓ Branch 0 taken 23 times.
✓ Branch 1 taken 12299 times.
✓ Branch 4 taken 23 times.
|
12322 | else if(type == PLatexType::UPDATESTYLE){body = platexobj_htmlStrUpdateStyle(outputMode, obj);} |
853 |
2/2✓ Branch 0 taken 58 times.
✓ Branch 1 taken 12241 times.
|
12299 | else if(type == PLatexType::PERCENT){body += "%";} |
854 |
3/3✓ Branch 0 taken 973 times.
✓ Branch 1 taken 11268 times.
✓ Branch 4 taken 973 times.
|
12241 | else if(type == PLatexType::REF){body = platexobj_htmlStrRef(obj);} |
855 |
3/3✓ Branch 0 taken 588 times.
✓ Branch 1 taken 10680 times.
✓ Branch 4 taken 588 times.
|
11268 | else if(type == PLatexType::NEWLINE){body = platexobj_htmlStrNewLine(obj);} |
856 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 10680 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
10680 | else if(type == PLatexType::SPACEPARAGRAPH){body = platexobj_htmlStrSpaceParagraph(obj);} |
857 |
3/3✓ Branch 0 taken 2543 times.
✓ Branch 1 taken 8137 times.
✓ Branch 4 taken 2543 times.
|
10680 | else if(type == PLatexType::AUTOSPACEPARAGRAPH){body = platexobj_htmlStrSpaceParagraph(obj);} |
858 |
3/3✓ Branch 0 taken 6 times.
✓ Branch 1 taken 8131 times.
✓ Branch 4 taken 6 times.
|
8137 | else if(type == PLatexType::CITATION){body = platexobj_htmlStrCitation(obj);} |
859 | |||
860 |
3/3✓ Branch 0 taken 297 times.
✓ Branch 1 taken 7834 times.
✓ Branch 4 taken 297 times.
|
8131 | else if(type == PLatexType::HREF){body = platexobj_htmlStrHref(outputMode, obj);} |
861 |
3/3✓ Branch 0 taken 865 times.
✓ Branch 1 taken 6969 times.
✓ Branch 4 taken 865 times.
|
7834 | else if(type == PLatexType::TEXTBF){body = platexobj_htmlStrTextBf(obj);} |
862 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 6969 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
6969 | else if(type == PLatexType::TEXTIT){body = platexobj_htmlStrTextIt(obj);} |
863 |
3/3✓ Branch 0 taken 52 times.
✓ Branch 1 taken 6917 times.
✓ Branch 4 taken 52 times.
|
6969 | else if(type == PLatexType::DEBUG){body = platexobj_htmlStrTextDebug(obj);} |
864 |
3/3✓ Branch 0 taken 53 times.
✓ Branch 1 taken 6864 times.
✓ Branch 4 taken 53 times.
|
6917 | else if(type == PLatexType::FOOTNOTE){body = platexobj_htmlStrTextFootnote(outputMode, obj);} |
865 |
3/3✓ Branch 0 taken 73 times.
✓ Branch 1 taken 6791 times.
✓ Branch 4 taken 73 times.
|
6864 | else if(type == PLatexType::CAPTION){body = platexobj_htmlStrCaption(outputMode, obj);} |
866 |
3/3✓ Branch 0 taken 17 times.
✓ Branch 1 taken 6774 times.
✓ Branch 4 taken 17 times.
|
6791 | else if(type == PLatexType::WORK_IN_PROGRESS){body = platexobj_htmlStrWip(outputMode, obj);} |
867 |
3/3✓ Branch 0 taken 3 times.
✓ Branch 1 taken 6771 times.
✓ Branch 4 taken 3 times.
|
6774 | else if(type == PLatexType::DETAILS){body = platexobj_htmlStrDetail(outputMode, obj);} |
868 |
3/3✓ Branch 0 taken 3 times.
✓ Branch 1 taken 6768 times.
✓ Branch 4 taken 3 times.
|
6771 | else if(type == PLatexType::SUMMARY){body = platexobj_htmlStrSummary(outputMode, obj);} |
869 |
3/3✓ Branch 0 taken 4 times.
✓ Branch 1 taken 6764 times.
✓ Branch 4 taken 4 times.
|
6768 | else if(type == PLatexType::QUOTE){body = platexobj_htmlStrQuote(outputMode, obj);} |
870 | |||
871 |
3/3✓ Branch 0 taken 45 times.
✓ Branch 1 taken 6719 times.
✓ Branch 4 taken 45 times.
|
6764 | else if(type == PLatexType::IMAGE){body = platexobj_htmlStrImage(obj);} |
872 |
3/3✓ Branch 0 taken 3 times.
✓ Branch 1 taken 6716 times.
✓ Branch 4 taken 3 times.
|
6719 | else if(type == PLatexType::CALLDOT){body = platexobj_htmlStrCallDot(outputMode, obj);} |
873 |
3/3✓ Branch 0 taken 2 times.
✓ Branch 1 taken 6714 times.
✓ Branch 4 taken 2 times.
|
6716 | else if(type == PLatexType::SVGTOPNG){body = platexobj_htmlStrSvgToPng(outputMode, obj);} |
874 | |||
875 |
5/5✓ Branch 0 taken 83 times.
✓ Branch 1 taken 6631 times.
✓ Branch 4 taken 83 times.
✓ Branch 7 taken 83 times.
✓ Branch 10 taken 83 times.
|
6714 | else if(type == PLatexType::PARTSTAR){body = platexobj_htmlStrAllPart(outputMode, obj, "h1", "");} |
876 |
5/5✓ Branch 0 taken 83 times.
✓ Branch 1 taken 6548 times.
✓ Branch 4 taken 83 times.
✓ Branch 7 taken 83 times.
✓ Branch 10 taken 83 times.
|
6631 | else if(type == PLatexType::CHAPTERSTAR){body = platexobj_htmlStrAllPart(outputMode, obj, "h2", "");} |
877 |
5/5✓ Branch 0 taken 82 times.
✓ Branch 1 taken 6466 times.
✓ Branch 4 taken 82 times.
✓ Branch 7 taken 82 times.
✓ Branch 10 taken 82 times.
|
6548 | else if(type == PLatexType::SECTIONSTAR){body = platexobj_htmlStrAllPart(outputMode, obj, "h3", "");} |
878 |
5/5✓ Branch 0 taken 81 times.
✓ Branch 1 taken 6385 times.
✓ Branch 4 taken 81 times.
✓ Branch 7 taken 81 times.
✓ Branch 10 taken 81 times.
|
6466 | else if(type == PLatexType::SUBSECTIONSTAR){body = platexobj_htmlStrAllPart(outputMode, obj, "h3", "");} |
879 |
5/5✓ Branch 0 taken 306 times.
✓ Branch 1 taken 6079 times.
✓ Branch 4 taken 306 times.
✓ Branch 7 taken 306 times.
✓ Branch 10 taken 306 times.
|
6385 | else if(type == PLatexType::SUBSUBSECTIONSTAR){body = platexobj_htmlStrAllPart(outputMode, obj, "h3", "");} |
880 | |||
881 |
5/5✓ Branch 0 taken 60 times.
✓ Branch 1 taken 6019 times.
✓ Branch 4 taken 60 times.
✓ Branch 7 taken 60 times.
✓ Branch 10 taken 60 times.
|
6079 | else if(type == PLatexType::PARAGRAPHE){body = platexobj_htmlStrBasicEnv(outputMode, obj, "p", "paragraphStyle", true);} |
882 |
5/5✓ Branch 0 taken 152 times.
✓ Branch 1 taken 5867 times.
✓ Branch 4 taken 152 times.
✓ Branch 7 taken 152 times.
✓ Branch 10 taken 152 times.
|
6019 | else if(type == PLatexType::CENTER){body = platexobj_htmlStrBasicEnv(outputMode, obj, "div", "centerStyle", true);} |
883 |
5/5✓ Branch 0 taken 2 times.
✓ Branch 1 taken 5865 times.
✓ Branch 4 taken 2 times.
✓ Branch 7 taken 2 times.
✓ Branch 10 taken 2 times.
|
5867 | else if(type == PLatexType::COLUMN){body = platexobj_htmlStrBasicEnv(outputMode, obj, "td", "columnStyle", true);} |
884 | |||
885 |
3/3✓ Branch 0 taken 1 times.
✓ Branch 1 taken 5864 times.
✓ Branch 4 taken 1 times.
|
5865 | else if(type == PLatexType::COLUMNS){body = platexobj_htmlStrColumns(outputMode, obj);} |
886 | |||
887 |
1/8✗ Branch 0 not taken.
✓ Branch 1 taken 5864 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
|
5864 | else if(type == PLatexType::TABLE){body = platexobj_htmlStrBasicEnv(outputMode, obj, "div", "tableStyle", true);} |
888 |
3/3✓ Branch 0 taken 1 times.
✓ Branch 1 taken 5863 times.
✓ Branch 4 taken 1 times.
|
5864 | else if(type == PLatexType::TABULAR){body = platexobj_htmlStrTabular(outputMode, obj);} |
889 |
3/3✓ Branch 0 taken 10 times.
✓ Branch 1 taken 5853 times.
✓ Branch 4 taken 10 times.
|
5863 | else if(type == PLatexType::TABROW){body = platexobj_htmlStrTabRow(outputMode, obj);} |
890 |
3/3✓ Branch 0 taken 50 times.
✓ Branch 1 taken 5803 times.
✓ Branch 4 taken 50 times.
|
5853 | else if(type == PLatexType::TABCELL){body = platexobj_htmlStrTabCell(outputMode, obj);} |
891 |
5/5✓ Branch 0 taken 149 times.
✓ Branch 1 taken 5654 times.
✓ Branch 4 taken 149 times.
✓ Branch 7 taken 149 times.
✓ Branch 10 taken 149 times.
|
5803 | else if(type == PLatexType::FIGURE){body = platexobj_htmlStrBasicEnv(outputMode, obj, "div", "figureStyle", false);} |
892 | |||
893 |
1/6✗ Branch 0 not taken.
✓ Branch 1 taken 5654 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
|
5654 | else if(type == PLatexType::DISPLAYMATH){body = platexobj_htmlStrLatex(outputMode, obj, "displaymath");} |
894 |
4/4✓ Branch 0 taken 20 times.
✓ Branch 1 taken 5634 times.
✓ Branch 4 taken 20 times.
✓ Branch 7 taken 20 times.
|
5654 | else if(type == PLatexType::EQNARRAY){body = platexobj_htmlStrLatex(outputMode, obj, "eqnarray*");} |
895 |
3/3✓ Branch 0 taken 58 times.
✓ Branch 1 taken 5576 times.
✓ Branch 4 taken 58 times.
|
5634 | else if(type == PLatexType::INLINEMATH){body = platexobj_htmlStrInlineMath(outputMode, obj);} |
896 | |||
897 |
3/3✓ Branch 0 taken 186 times.
✓ Branch 1 taken 5390 times.
✓ Branch 4 taken 186 times.
|
5576 | else if(type == PLatexType::ITEMIZE){body = platexobj_htmlStrItemize(outputMode, obj);} |
898 |
3/3✓ Branch 0 taken 4 times.
✓ Branch 1 taken 5386 times.
✓ Branch 4 taken 4 times.
|
5390 | else if(type == PLatexType::ENUMERATE){body = platexobj_htmlStrEnumerate(outputMode, obj);} |
899 |
3/3✓ Branch 0 taken 396 times.
✓ Branch 1 taken 4990 times.
✓ Branch 4 taken 396 times.
|
5386 | else if(type == PLatexType::ITEM){body = platexobj_htmlStrItem(outputMode, obj);} |
900 |
3/3✓ Branch 0 taken 6 times.
✓ Branch 1 taken 4984 times.
✓ Branch 4 taken 6 times.
|
4990 | else if(type == PLatexType::VIDEO){body = platexobj_htmlStrVideo(obj);} |
901 | |||
902 |
3/3✓ Branch 0 taken 316 times.
✓ Branch 1 taken 4668 times.
✓ Branch 4 taken 316 times.
|
4984 | else if(type == PLatexType::ENVIRONEMENT){body = platexobj_htmlStrExtraEnvironement(outputMode, obj);} |
903 |
3/3✓ Branch 0 taken 660 times.
✓ Branch 1 taken 4008 times.
✓ Branch 4 taken 660 times.
|
4668 | else if(type == PLatexType::FUNCTION){body = platexobj_htmlStrExtraFunction(outputMode, obj);} |
904 |
3/3✓ Branch 0 taken 288 times.
✓ Branch 1 taken 3720 times.
✓ Branch 4 taken 288 times.
|
4008 | else if(type == PLatexType::PARSER){body = platexobj_htmlStrExtraParser(obj);} |
905 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 3720 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
3720 | else if(type == PLatexType::HTML){body = platexobj_htmlStrHtml(obj);} |
906 |
3/3✓ Branch 0 taken 61 times.
✓ Branch 1 taken 3659 times.
✓ Branch 4 taken 61 times.
|
3720 | else if(type == PLatexType::TIMETABLE){body = platexobj_htmlStrTimetable(outputMode, obj);} |
907 |
3/3✓ Branch 0 taken 64 times.
✓ Branch 1 taken 3595 times.
✓ Branch 4 taken 64 times.
|
3659 | else if(type == PLatexType::TIMETABLE_WEEK){body = platexobj_htmlStrTimetableWeek(outputMode, obj);} |
908 |
3/3✓ Branch 0 taken 558 times.
✓ Branch 1 taken 3037 times.
✓ Branch 4 taken 558 times.
|
3595 | else if(type == PLatexType::TIMETABLE_TIMEROW){body = platexobj_htmlStrTimetableTimeRow(outputMode, obj);} |
909 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 3037 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
3037 | else if(type == PLatexType::TIMETABLE_DAY){body = platexobj_htmlStrTimetableDay(outputMode, obj);} |
910 |
3/3✓ Branch 0 taken 991 times.
✓ Branch 1 taken 2046 times.
✓ Branch 4 taken 991 times.
|
3037 | else if(type == PLatexType::TIMETABLE_BLOCK){body = platexobj_htmlStrTimetableBlock(outputMode, obj);} |
911 |
3/3✓ Branch 0 taken 234 times.
✓ Branch 1 taken 1812 times.
✓ Branch 4 taken 234 times.
|
2046 | else if(type == PLatexType::TIMETABLE_EMPTYBLOCK){body = platexobj_htmlStrTimetableEmptyBlock(outputMode, obj);} |
912 |
3/3✓ Branch 0 taken 494 times.
✓ Branch 1 taken 1318 times.
✓ Branch 4 taken 494 times.
|
1812 | else if(type == PLatexType::TIMETABLE_TIME){body = platexobj_htmlStrTimetableTime(outputMode, obj);} |
913 |
3/3✓ Branch 0 taken 850 times.
✓ Branch 1 taken 468 times.
✓ Branch 4 taken 850 times.
|
1318 | else if(type == PLatexType::RENDEZVOUS){body = platexobj_htmlStrRendezVous(obj);} |
914 | else{ | ||
915 | 468 | return false; | |
916 | } | ||
917 | 21412 | return true; | |
918 | } | ||
919 | |||
920 | ///Convert a PLatexObj into a string | ||
921 | /** @param[out] outputMode : output mode of the html backend | ||
922 | * @param obj : PLatexObj to be converted into a string | ||
923 | * @param isBibliography : true if there is a bibliography, false otherwise | ||
924 | * @param allowText : true if the TEXT PLatexObj are allowed, false if not | ||
925 | * @return output string which contains the PLatexObj | ||
926 | */ | ||
927 | 19129 | PString platexobj_htmlStr(POutoutMode & outputMode, const PLatexObj & obj, bool isBibliography, bool allowText){ | |
928 | 19129 | PString body(""); | |
929 |
1/1✓ Branch 1 taken 19129 times.
|
19129 | PLatexType::PLatexType type(obj.getType()); |
930 |
6/6✓ Branch 0 taken 44 times.
✓ Branch 1 taken 19085 times.
✓ Branch 3 taken 44 times.
✓ Branch 6 taken 44 times.
✓ Branch 9 taken 44 times.
✓ Branch 12 taken 44 times.
|
19129 | if(type == PLatexType::PART){platexobj_sectionHtml(outputMode, obj, "h1", "ptexpart", "Part", isBibliography);} |
931 |
6/6✓ Branch 0 taken 58 times.
✓ Branch 1 taken 19027 times.
✓ Branch 3 taken 58 times.
✓ Branch 6 taken 58 times.
✓ Branch 9 taken 58 times.
✓ Branch 12 taken 58 times.
|
19085 | else if(type == PLatexType::CHAPTER){platexobj_sectionHtml(outputMode, obj, "h2", "ptexchapter", "Chapter", isBibliography);} |
932 |
6/6✓ Branch 0 taken 35 times.
✓ Branch 1 taken 18992 times.
✓ Branch 3 taken 35 times.
✓ Branch 6 taken 35 times.
✓ Branch 9 taken 35 times.
✓ Branch 12 taken 35 times.
|
19027 | else if(type == PLatexType::SECTION){platexobj_sectionHtml(outputMode, obj, "h3", "ptexsection", "", isBibliography);} |
933 |
6/6✓ Branch 0 taken 54 times.
✓ Branch 1 taken 18938 times.
✓ Branch 3 taken 54 times.
✓ Branch 6 taken 54 times.
✓ Branch 9 taken 54 times.
✓ Branch 12 taken 54 times.
|
18992 | else if(type == PLatexType::SUBSECTION){platexobj_sectionHtml(outputMode, obj, "h4", "ptexsubsection", "", isBibliography);} |
934 |
6/6✓ Branch 0 taken 2 times.
✓ Branch 1 taken 18936 times.
✓ Branch 3 taken 2 times.
✓ Branch 6 taken 2 times.
✓ Branch 9 taken 2 times.
✓ Branch 12 taken 2 times.
|
18938 | else if(type == PLatexType::SUBSUBSECTION){platexobj_sectionHtml(outputMode, obj, "h5", "ptexsubsubsection", "", isBibliography);} |
935 |
4/4✓ Branch 0 taken 107 times.
✓ Branch 1 taken 18829 times.
✓ Branch 3 taken 107 times.
✓ Branch 6 taken 107 times.
|
18936 | else if(type == PLatexType::FILE){body = platexobj_indexHtml(outputMode, obj, isBibliography);} |
936 |
3/3✓ Branch 1 taken 18829 times.
✓ Branch 3 taken 343 times.
✓ Branch 4 taken 18486 times.
|
18829 | else if(!platexobj_htmlStrBase(body, outputMode, obj, isBibliography, allowText)){ |
937 |
3/3✓ Branch 1 taken 343 times.
✓ Branch 4 taken 343 times.
✓ Branch 7 taken 343 times.
|
343 | body = platexobj_htmlStr(outputMode, obj.getVecContent(), isBibliography, allowText); |
938 | } | ||
939 | 19129 | return body; | |
940 | } | ||
941 | |||
942 | ///Save a vector of PLatexObj in html | ||
943 | /** @param[out] outputMode : output mode of the html backend | ||
944 | * @param vecObj : vector of PLatexObj to be saved in html | ||
945 | * @param isBibliography : true if there is a bibliography, false otherwise | ||
946 | * @param allowText : true if the TEXT PLatexObj are allowed, false if not | ||
947 | * @return html string | ||
948 | */ | ||
949 | 7552 | PString platexobj_htmlStr(POutoutMode & outputMode, const PVecLatexObj & vecObj, bool isBibliography, bool allowText){ | |
950 | 7552 | PString body(""); | |
951 |
2/2✓ Branch 3 taken 10690 times.
✓ Branch 4 taken 7552 times.
|
18242 | for(PVecLatexObj::const_iterator it(vecObj.begin()); it != vecObj.end(); ++it){ |
952 |
2/2✓ Branch 2 taken 10690 times.
✓ Branch 5 taken 10690 times.
|
10690 | body += platexobj_htmlStr(outputMode, *it, isBibliography, allowText); |
953 | } | ||
954 | 7552 | return body; | |
955 | } | ||
956 | |||
957 | ///Copy a file in an output directory | ||
958 | /** @param inputFile : input file to be copied | ||
959 | * @param outputDir : directory where to copy the file | ||
960 | * @return true on success, false otherwise | ||
961 | */ | ||
962 | 788 | bool platexobj_copyFile(const PString & inputFile, const PString & outputDir){ | |
963 |
5/5✓ Branch 1 taken 788 times.
✓ Branch 4 taken 788 times.
✓ Branch 7 taken 788 times.
✓ Branch 10 taken 788 times.
✓ Branch 13 taken 788 times.
|
1576 | PString command("cp " + inputFile + " " + outputDir + "/"); |
964 |
2/3✓ Branch 2 taken 788 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 788 times.
|
788 | if(system(command.c_str()) != 0){ |
965 | ✗ | std::cerr << "platexobj_copyFile : can't copy file '"<<inputFile<<"' into '"<<outputDir<<"' directory" << std::endl; | |
966 | ✗ | return false; | |
967 | } | ||
968 | 788 | return true; | |
969 | 788 | } | |
970 | |||
971 | ///Edit the given file an create a copy at outputDir | ||
972 | /** @param inputFile : input file to be copied | ||
973 | * @param outputDir : directory where to copy the file | ||
974 | * @param outputMode : mode to get variable values | ||
975 | * @return true on success, false otherwise | ||
976 | */ | ||
977 | 11 | bool platexobj_editVaraibleFile(const PPath & inputFile, const PPath & outputDir, const POutoutMode & outputMode){ | |
978 |
1/1✓ Branch 1 taken 11 times.
|
11 | PString fileContent(inputFile.loadFileContent()); |
979 |
5/5✓ Branch 1 taken 11 times.
✓ Branch 4 taken 11 times.
✓ Branch 7 taken 11 times.
✓ Branch 10 taken 11 times.
✓ Branch 13 taken 11 times.
|
22 | PString updateContent = fileContent.replace("--sidebar-width: 300px;", "--sidebar-width: "+outputMode.bookSideBarWidth+";"); |
980 |
2/2✓ Branch 1 taken 11 times.
✓ Branch 4 taken 11 times.
|
11 | PPath outputFile(outputDir / inputFile.getFileName()); |
981 |
1/1✓ Branch 1 taken 11 times.
|
22 | return outputFile.saveFileContent(updateContent); |
982 | 11 | } | |
983 | |||
984 | ///Save the main PLatexObj | ||
985 | /** @param[out] outputMode : output mode of the html backend | ||
986 | * @param obj : main PLatexObj to be saved | ||
987 | * @param isBibliography : true if there is a bibliography, false otherwise | ||
988 | * @param baseInstallPrefix : installation prefix to be used | ||
989 | * @return true on success, false otherwise | ||
990 | */ | ||
991 | 118 | bool platexobj_html(POutoutMode & outputMode, const PLatexObj & obj, bool isBibliography, const PString & baseInstallPrefix){ | |
992 |
1/1✓ Branch 1 taken 118 times.
|
118 | PString fileContent(""); |
993 |
2/2✓ Branch 1 taken 118 times.
✓ Branch 4 taken 118 times.
|
118 | PPath indexHtml(obj.getLink()); |
994 | |||
995 |
2/2✓ Branch 0 taken 11 times.
✓ Branch 1 taken 107 times.
|
118 | if(outputMode.isBookTheme){ |
996 |
2/2✓ Branch 1 taken 11 times.
✓ Branch 4 taken 11 times.
|
11 | fileContent = platexobj_bookHtml(outputMode, obj, isBibliography, true); |
997 | }else{ | ||
998 |
2/2✓ Branch 1 taken 107 times.
✓ Branch 4 taken 107 times.
|
107 | fileContent = platexobj_htmlStr(outputMode, obj, isBibliography); |
999 | } | ||
1000 | |||
1001 |
2/3✓ Branch 1 taken 118 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 118 times.
|
118 | if(!indexHtml.saveFileContent(fileContent)){ |
1002 | ✗ | std::cerr << "platexobj_html : can't save file '"<<indexHtml<<"'" << std::endl; | |
1003 | ✗ | return false; | |
1004 | } | ||
1005 | // else{ | ||
1006 | // std::cerr << "platexobj_html : save file '"<<indexHtml<<"'" << std::endl; | ||
1007 | // } | ||
1008 | //Copy the background image | ||
1009 |
2/2✓ Branch 1 taken 118 times.
✓ Branch 4 taken 118 times.
|
118 | PPath outputImageDir(LATEX_IMAGE_OUTPUT_DIR); |
1010 |
2/3✓ Branch 1 taken 118 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 118 times.
|
118 | if(!outputImageDir.createDirectory()){ |
1011 | ✗ | std::cerr << "platexobj_htmlStrLatex : can't create directory '" << outputImageDir << "'" << std::endl; | |
1012 | ✗ | return ""; | |
1013 | } | ||
1014 | |||
1015 |
1/1✓ Branch 1 taken 118 times.
|
118 | PString installPrefix(CMAKE_INSTALL_PREFIX); |
1016 |
1/2✓ Branch 1 taken 118 times.
✗ Branch 2 not taken.
|
118 | if(baseInstallPrefix != ""){ |
1017 |
1/1✓ Branch 1 taken 118 times.
|
118 | installPrefix = baseInstallPrefix; |
1018 | } | ||
1019 | 118 | bool b(true); | |
1020 | // PString fileToBeCopied(installPrefix + "/share/PhoenixTex2Html/Images/trennen.jpg"); | ||
1021 |
3/3✓ Branch 1 taken 118 times.
✓ Branch 4 taken 118 times.
✓ Branch 7 taken 118 times.
|
236 | PPath fileToBeCopied(installPrefix + "/share/PhoenixTex2Html/Images/Mv83H.png"); |
1022 |
1/1✓ Branch 1 taken 118 times.
|
118 | b &= platexobj_copyFile(fileToBeCopied, outputImageDir); |
1023 |
3/3✓ Branch 1 taken 118 times.
✓ Branch 4 taken 118 times.
✓ Branch 7 taken 118 times.
|
236 | PPath fileWipToBeCopied(installPrefix + "/share/PhoenixTex2Html/Images/wip.png"); |
1024 |
1/1✓ Branch 1 taken 118 times.
|
118 | b &= platexobj_copyFile(fileWipToBeCopied, outputImageDir); |
1025 |
3/3✓ Branch 1 taken 118 times.
✓ Branch 4 taken 118 times.
✓ Branch 7 taken 118 times.
|
236 | PPath fileLinkToBeCopied(installPrefix + "/share/PhoenixTex2Html/Images/iconlink_32.png"); |
1026 |
1/1✓ Branch 1 taken 118 times.
|
118 | b &= platexobj_copyFile(fileLinkToBeCopied, outputImageDir); |
1027 |
3/3✓ Branch 1 taken 118 times.
✓ Branch 4 taken 118 times.
✓ Branch 7 taken 118 times.
|
236 | PPath fileCalendarWhiteToBeCopied(installPrefix + "/share/PhoenixTex2Html/Images/caldendar-icon-white-24x24.png"); |
1028 |
1/1✓ Branch 1 taken 118 times.
|
118 | b &= platexobj_copyFile(fileCalendarWhiteToBeCopied, outputImageDir); |
1029 |
3/3✓ Branch 1 taken 118 times.
✓ Branch 4 taken 118 times.
✓ Branch 7 taken 118 times.
|
236 | PPath fileCalendarBlackToBeCopied(installPrefix + "/share/PhoenixTex2Html/Images/caldendar-icon-black-24x24.png"); |
1030 |
1/1✓ Branch 1 taken 118 times.
|
118 | b &= platexobj_copyFile(fileCalendarBlackToBeCopied, outputImageDir); |
1031 | |||
1032 |
2/2✓ Branch 0 taken 11 times.
✓ Branch 1 taken 107 times.
|
118 | if(outputMode.isBookTheme){ |
1033 |
2/2✓ Branch 1 taken 11 times.
✓ Branch 4 taken 11 times.
|
11 | PPath currentOutputDir("./"); |
1034 |
4/4✓ Branch 1 taken 11 times.
✓ Branch 4 taken 11 times.
✓ Branch 7 taken 11 times.
✓ Branch 10 taken 11 times.
|
11 | b &= platexobj_editVaraibleFile(PPath(installPrefix + "/share/PhoenixTex2Html/STYLE/BookTheme/variables.css"), currentOutputDir, outputMode); |
1035 |
3/3✓ Branch 1 taken 11 times.
✓ Branch 4 taken 11 times.
✓ Branch 7 taken 11 times.
|
11 | b &= platexobj_copyFile(installPrefix + "/share/PhoenixTex2Html/STYLE/BookTheme/general.css", currentOutputDir); |
1036 |
3/3✓ Branch 1 taken 11 times.
✓ Branch 4 taken 11 times.
✓ Branch 7 taken 11 times.
|
11 | b &= platexobj_copyFile(installPrefix + "/share/PhoenixTex2Html/STYLE/BookTheme/chrome.css", currentOutputDir); |
1037 |
3/3✓ Branch 1 taken 11 times.
✓ Branch 4 taken 11 times.
✓ Branch 7 taken 11 times.
|
11 | b &= platexobj_copyFile(installPrefix + "/share/PhoenixTex2Html/STYLE/BookTheme/ayu-highlight.css", currentOutputDir); |
1038 |
3/3✓ Branch 1 taken 11 times.
✓ Branch 4 taken 11 times.
✓ Branch 7 taken 11 times.
|
11 | b &= platexobj_copyFile(installPrefix + "/share/PhoenixTex2Html/STYLE/BookTheme/highlight.css", currentOutputDir); |
1039 |
3/3✓ Branch 1 taken 11 times.
✓ Branch 4 taken 11 times.
✓ Branch 7 taken 11 times.
|
11 | b &= platexobj_copyFile(installPrefix + "/share/PhoenixTex2Html/STYLE/BookTheme/tomorrow-night.css", currentOutputDir); |
1040 |
3/3✓ Branch 1 taken 11 times.
✓ Branch 4 taken 11 times.
✓ Branch 7 taken 11 times.
|
11 | b &= platexobj_copyFile(installPrefix + "/share/PhoenixTex2Html/STYLE/BookTheme/font-awesome.css", currentOutputDir); |
1041 |
3/3✓ Branch 1 taken 11 times.
✓ Branch 4 taken 11 times.
✓ Branch 7 taken 11 times.
|
11 | b &= platexobj_copyFile(installPrefix + "/share/PhoenixTex2Html/STYLE/BookTheme/fonts.css", currentOutputDir); |
1042 | |||
1043 |
3/3✓ Branch 1 taken 11 times.
✓ Branch 4 taken 11 times.
✓ Branch 7 taken 11 times.
|
11 | b &= platexobj_copyFile(installPrefix + "/share/PhoenixTex2Html/javascript/BookTheme/clipboard.js", currentOutputDir); |
1044 |
3/3✓ Branch 1 taken 11 times.
✓ Branch 4 taken 11 times.
✓ Branch 7 taken 11 times.
|
11 | b &= platexobj_copyFile(installPrefix + "/share/PhoenixTex2Html/javascript/BookTheme/highlight.js", currentOutputDir); |
1045 |
3/3✓ Branch 1 taken 11 times.
✓ Branch 4 taken 11 times.
✓ Branch 7 taken 11 times.
|
11 | b &= platexobj_copyFile(installPrefix + "/share/PhoenixTex2Html/javascript/BookTheme/book.js", currentOutputDir); |
1046 | |||
1047 |
3/3✓ Branch 1 taken 11 times.
✓ Branch 4 taken 11 times.
✓ Branch 7 taken 11 times.
|
11 | b &= platexobj_copyFile(installPrefix + "/share/PhoenixTex2Html/Images/book_edit_icon.png", outputImageDir); |
1048 |
3/3✓ Branch 1 taken 11 times.
✓ Branch 4 taken 11 times.
✓ Branch 7 taken 11 times.
|
11 | b &= platexobj_copyFile(installPrefix + "/share/PhoenixTex2Html/Images/book_gitlab_icon.png", outputImageDir); |
1049 |
3/3✓ Branch 1 taken 11 times.
✓ Branch 4 taken 11 times.
✓ Branch 7 taken 11 times.
|
11 | b &= platexobj_copyFile(installPrefix + "/share/PhoenixTex2Html/Images/book_home_icon.png", outputImageDir); |
1050 |
3/3✓ Branch 1 taken 11 times.
✓ Branch 4 taken 11 times.
✓ Branch 7 taken 11 times.
|
11 | b &= platexobj_copyFile(installPrefix + "/share/PhoenixTex2Html/Images/book_mail_icon.png", outputImageDir); |
1051 |
3/3✓ Branch 1 taken 11 times.
✓ Branch 4 taken 11 times.
✓ Branch 7 taken 11 times.
|
11 | b &= platexobj_copyFile(installPrefix + "/share/PhoenixTex2Html/Images/book_next_icon.png", outputImageDir); |
1052 |
3/3✓ Branch 1 taken 11 times.
✓ Branch 4 taken 11 times.
✓ Branch 7 taken 11 times.
|
11 | b &= platexobj_copyFile(installPrefix + "/share/PhoenixTex2Html/Images/book_prev_icon.png", outputImageDir); |
1053 |
3/3✓ Branch 1 taken 11 times.
✓ Branch 4 taken 11 times.
✓ Branch 7 taken 11 times.
|
11 | b &= platexobj_copyFile(installPrefix + "/share/PhoenixTex2Html/Images/book_theme_icon.png", outputImageDir); |
1054 |
3/3✓ Branch 1 taken 11 times.
✓ Branch 4 taken 11 times.
✓ Branch 7 taken 11 times.
|
11 | b &= platexobj_copyFile(installPrefix + "/share/PhoenixTex2Html/Images/book_toggle_sidebar_icon.png", outputImageDir); |
1055 | 11 | } | |
1056 | |||
1057 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 118 times.
|
118 | if(outputMode.isRemoteMathjax){ |
1058 | ✗ | PPath fileJavascriptConfigToBeCopied(installPrefix + "/share/PhoenixTex2Html/javascript/load-mathjax.js"); | |
1059 | ✗ | b &= platexobj_copyFile(fileJavascriptConfigToBeCopied, "."); | |
1060 | } | ||
1061 | 118 | return b; | |
1062 | 118 | } | |
1063 | |||
1064 |