Directory: | ./ |
---|---|
File: | tmp_project/PhoenixTex2Html/src/PLatexObj/platexobj_html.cpp |
Date: | 2025-03-24 18:12:43 |
Exec | Total | Coverage | |
---|---|---|---|
Lines: | 507 | 547 | 92.7% |
Branches: | 1056 | 1294 | 81.6% |
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 | 13525 | PString platexobj_htmlStrText(const PLatexObj & obj){ | |
63 | 13525 | 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 | 2545 | PString platexobj_htmlStrSpaceParagraph(const PLatexObj & obj){ | |
138 | 2545 | PString body(""); | |
139 |
1/1✓ Branch 1 taken 2545 times.
|
2545 | body += "<br /><br />\n"; |
140 | 2545 | 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 | 17 | PString body(""); | |
250 |
5/5✓ Branch 1 taken 17 times.
✓ Branch 4 taken 17 times.
✓ Branch 7 taken 17 times.
✓ Branch 10 taken 17 times.
✓ Branch 13 taken 17 times.
|
17 | body += "\n<table id=\""+valueToString(obj.getId())+"\" class=\"workinprogress\">\n"; |
251 |
1/1✓ Branch 1 taken 17 times.
|
17 | body += "\t<tr><td class=\"workinprogressimage\"><img src=\"images/wip.png\" alt=\"wip\" /></td></tr>\n"; |
252 | |||
253 |
5/5✓ Branch 1 taken 17 times.
✓ Branch 4 taken 17 times.
✓ Branch 7 taken 17 times.
✓ Branch 10 taken 17 times.
✓ Branch 13 taken 17 times.
|
17 | body += "\t<tr><td class=\"workinprogresscontent\">" + platexobj_htmlStr(outputMode, obj.getVecContent()) + "</td></tr>\n"; |
254 |
1/1✓ Branch 1 taken 17 times.
|
17 | body += "</table>\n"; |
255 | 17 | return body; | |
256 | } | ||
257 | |||
258 | ///Convert a PLatexObj into a string | ||
259 | /** @param[out] outputMode : output mode of the html backend | ||
260 | * @param obj : PLatexObj to be converted into a string | ||
261 | * @return output string which contains the PLatexObj | ||
262 | */ | ||
263 | 3 | PString platexobj_htmlStrSummary(POutoutMode & outputMode, const PLatexObj & obj){ | |
264 | 3 | PString body(""); | |
265 |
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"; |
266 |
3/3✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
✓ Branch 7 taken 3 times.
|
3 | body += platexobj_htmlStr(outputMode, obj.getVecContent()); |
267 |
1/1✓ Branch 1 taken 3 times.
|
3 | body += "</summary>\n"; |
268 | 3 | return body; | |
269 | } | ||
270 | |||
271 | ///Convert a PLatexObj into a string | ||
272 | /** @param[out] outputMode : output mode of the html backend | ||
273 | * @param obj : PLatexObj to be converted into a string | ||
274 | * @return output string which contains the PLatexObj | ||
275 | */ | ||
276 | 3 | PString platexobj_htmlStrDetail(POutoutMode & outputMode, const PLatexObj & obj){ | |
277 | 3 | PString body(""); | |
278 |
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"; |
279 |
3/3✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
✓ Branch 7 taken 3 times.
|
3 | body += platexobj_htmlStr(outputMode, obj.getVecContent()); |
280 |
1/1✓ Branch 1 taken 3 times.
|
3 | body += "</details>\n"; |
281 | 3 | return body; | |
282 | } | ||
283 | |||
284 | |||
285 | ///Convert a PLatexObj into a string | ||
286 | /** @param[out] outputMode : output mode of the html backend | ||
287 | * @param obj : PLatexObj to be converted into a string | ||
288 | * @return output string which contains the PLatexObj | ||
289 | */ | ||
290 | 4 | PString platexobj_htmlStrQuote(POutoutMode & outputMode, const PLatexObj & obj){ | |
291 | 4 | PString body(""); | |
292 |
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"; |
293 |
3/3✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
✓ Branch 7 taken 4 times.
|
4 | body += platexobj_htmlStr(outputMode, obj.getVecContent()); |
294 |
1/1✓ Branch 1 taken 4 times.
|
4 | body += "</div>\n"; |
295 | 4 | return body; | |
296 | } | ||
297 | |||
298 | ///Convert a PLatexObj into a string | ||
299 | /** @param[out] outputMode : output mode of the html backend | ||
300 | * @param obj : PLatexObj to be converted into a string | ||
301 | * @return output string which contains the PLatexObj | ||
302 | */ | ||
303 | 3 | PString platexobj_htmlStrCallDot(POutoutMode & outputMode, const PLatexObj & obj){ | |
304 |
1/1✓ Branch 1 taken 3 times.
|
3 | PString body(""); |
305 |
2/2✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
|
3 | PString baseContent(obj.getName()); |
306 |
1/1✓ Branch 1 taken 3 times.
|
3 | PPath fileName(baseContent); |
307 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 2 taken 1 times.
|
3 | if(fileName != ""){ |
308 |
2/3✓ Branch 1 taken 2 times.
✓ Branch 3 taken 2 times.
✗ Branch 4 not taken.
|
2 | if(fileName[0] != '/'){ |
309 |
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; |
310 | } | ||
311 |
3/3✓ Branch 1 taken 2 times.
✓ Branch 3 taken 1 times.
✓ Branch 4 taken 1 times.
|
2 | if(!fileName.isFileExist()){ |
312 |
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"); |
313 |
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"); |
314 | } | ||
315 |
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"); |
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.
|
2 | phoenix_popen("dot -T png -o " + outputFileName + " " + fileName); |
317 | |||
318 |
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 + "\""; |
319 |
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()); |
320 | 2 | } | |
321 | 6 | return body; | |
322 | 3 | } | |
323 | |||
324 | ///Convert a PLatexObj into a string | ||
325 | /** @param[out] outputMode : output mode of the html backend | ||
326 | * @param obj : PLatexObj to be converted into a string | ||
327 | * @return output string which contains the PLatexObj | ||
328 | */ | ||
329 | 2 | PString platexobj_htmlStrSvgToPng(POutoutMode & outputMode, const PLatexObj & obj){ | |
330 |
1/1✓ Branch 1 taken 2 times.
|
2 | PString body(""); |
331 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
2 | PPath fileName(obj.getName()); |
332 |
2/2✓ Branch 1 taken 1 times.
✓ Branch 2 taken 1 times.
|
2 | if(fileName != ""){ |
333 |
2/3✓ Branch 1 taken 1 times.
✓ Branch 3 taken 1 times.
✗ Branch 4 not taken.
|
1 | if(fileName[0] != '/'){ |
334 |
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; |
335 | } | ||
336 |
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")); |
337 |
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); |
338 | |||
339 |
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 + "\""; |
340 |
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()); |
341 | 1 | } | |
342 | 4 | return body; | |
343 | 2 | } | |
344 | |||
345 | ///Convert a PLatexObj into a string | ||
346 | /** @param[out] outputMode : output mode of the html backend | ||
347 | * @param obj : PLatexObj to be converted into a string | ||
348 | * @param hLevel : h balise | ||
349 | * @param cssClassName : name of the css class to be used | ||
350 | * @return output string which contains the PLatexObj | ||
351 | */ | ||
352 | 635 | PString platexobj_htmlStrAllPart(POutoutMode & outputMode, const PLatexObj & obj, const PString & hLevel, const PString & cssClassName){ | |
353 | 635 | PString body(""); | |
354 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 635 times.
|
635 | if(cssClassName != ""){ |
355 | ✗ | body += "\t<"+hLevel+" id=\""+valueToString(obj.getId())+"\" class=\""+cssClassName+"\">" + getSectionTitle(outputMode, obj) + platexobj_createLabelSearchLink(obj.getLabelName())+"</"+hLevel+">\n"; | |
356 | }else{ | ||
357 |
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"; |
358 | } | ||
359 | 635 | return body; | |
360 | } | ||
361 | |||
362 | ///Convert a PLatexObj into a string | ||
363 | /** @param[out] outputMode : output mode of the html backend | ||
364 | * @param obj : PLatexObj to be converted into a string | ||
365 | * @return output string which contains the PLatexObj | ||
366 | */ | ||
367 | 316 | PString platexobj_htmlStrExtraEnvironement(POutoutMode & outputMode, const PLatexObj & obj){ | |
368 | 316 | PString body(""); | |
369 |
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\">"; |
370 | |||
371 |
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()); |
372 | |||
373 |
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"; |
374 | 316 | return body; | |
375 | } | ||
376 | |||
377 | ///Convert a PLatexObj into a string | ||
378 | /** @param[out] outputMode : output mode of the html backend | ||
379 | * @param obj : PLatexObj to be converted into a string | ||
380 | * @return output string which contains the PLatexObj | ||
381 | */ | ||
382 | 660 | PString platexobj_htmlStrExtraFunction(POutoutMode & outputMode, const PLatexObj & obj){ | |
383 | 660 | PString body(""); | |
384 |
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\">"; |
385 | |||
386 |
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()); |
387 | |||
388 |
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()+">"; |
389 | 660 | return body; | |
390 | } | ||
391 | |||
392 | ///Convert a PLatexObj into a string | ||
393 | /** @param obj : PLatexObj to be converted into a string | ||
394 | * @return output string which contains the PLatexObj | ||
395 | */ | ||
396 | 288 | PString platexobj_htmlStrExtraParser(const PLatexObj & obj){ | |
397 | 288 | PString body(""); | |
398 |
3/3✓ Branch 1 taken 288 times.
✓ Branch 3 taken 230 times.
✓ Branch 4 taken 58 times.
|
288 | if(obj.getNbline() != 0lu){ |
399 |
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\">"; |
400 |
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){ |
401 |
3/3✓ Branch 1 taken 2110 times.
✓ Branch 4 taken 2110 times.
✓ Branch 7 taken 2110 times.
|
2110 | body += valueToString(i + 1lu) + "\n"; |
402 | } | ||
403 |
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"; |
404 |
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"); |
405 |
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"; |
406 | }else{ | ||
407 |
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())+"\">"; |
408 |
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"); |
409 |
1/1✓ Branch 1 taken 58 times.
|
58 | body += "</span>"; |
410 | } | ||
411 | 288 | return body; | |
412 | } | ||
413 | |||
414 | ///Convert a timetable into a html string | ||
415 | /** @param[out] outputMode : output mode of the html backend | ||
416 | * @param obj : PLatexObj to be converted in html | ||
417 | * @return html string | ||
418 | */ | ||
419 | 61 | PString platexobj_htmlStrTimetable(POutoutMode & outputMode, const PLatexObj & obj){ | |
420 | 61 | PString body(""); | |
421 |
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"; |
422 |
3/3✓ Branch 1 taken 61 times.
✓ Branch 4 taken 61 times.
✓ Branch 7 taken 61 times.
|
61 | body += platexobj_htmlStr(outputMode, obj.getVecContent()); |
423 |
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"; |
424 | 61 | return body; | |
425 | } | ||
426 | |||
427 | ///Convert a timetable week into a html string | ||
428 | /** @param[out] outputMode : output mode of the html backend | ||
429 | * @param obj : PLatexObj to be converted in html | ||
430 | * @return html string | ||
431 | */ | ||
432 | 64 | PString platexobj_htmlStrTimetableWeek(POutoutMode & outputMode, const PLatexObj & obj){ | |
433 | 64 | PString body(""); | |
434 | //We add a row in the timetable table | ||
435 |
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\">"; |
436 |
3/3✓ Branch 1 taken 64 times.
✓ Branch 4 taken 64 times.
✓ Branch 7 taken 64 times.
|
64 | body += platexobj_rawtext(obj.getComplexTitle()); |
437 |
1/1✓ Branch 1 taken 64 times.
|
64 | body += "</td></tr>\n"; |
438 |
1/1✓ Branch 1 taken 64 times.
|
64 | body += "\t<tr class=\"timetableMainWeekRowStyle\"><td class=\"timetableMainWeekRowStyle\">\n"; |
439 | //We we put the timetable of the current week | ||
440 |
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"; |
441 |
3/3✓ Branch 1 taken 64 times.
✓ Branch 4 taken 64 times.
✓ Branch 7 taken 64 times.
|
64 | body += platexobj_htmlStr(outputMode, obj.getVecContent()); |
442 |
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"; |
443 |
1/1✓ Branch 1 taken 64 times.
|
64 | body += "\t</td></tr>\n"; |
444 | 64 | return body; | |
445 | } | ||
446 | |||
447 | ///Convert a timetable time row into a html string | ||
448 | /** @param[out] outputMode : output mode of the html backend | ||
449 | * @param obj : PLatexObj to be converted in html | ||
450 | * @return html string | ||
451 | */ | ||
452 | 558 | PString platexobj_htmlStrTimetableTimeRow(POutoutMode & outputMode, const PLatexObj & obj){ | |
453 | 558 | PString body(""); | |
454 |
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"; |
455 |
3/3✓ Branch 1 taken 558 times.
✓ Branch 4 taken 558 times.
✓ Branch 7 taken 558 times.
|
558 | body += platexobj_htmlStr(outputMode, obj.getVecContent()); |
456 |
1/1✓ Branch 1 taken 558 times.
|
558 | body += "\t\t\t</tr>\n"; |
457 | 558 | return body; | |
458 | } | ||
459 | |||
460 | ///Convert a timetable day into a html string | ||
461 | /** @param[out] outputMode : output mode of the html backend | ||
462 | * @param obj : PLatexObj to be converted in html | ||
463 | * @return html string | ||
464 | */ | ||
465 | ✗ | PString platexobj_htmlStrTimetableDay(POutoutMode & outputMode, const PLatexObj & obj){ | |
466 | ✗ | PString body(""); | |
467 | //We add a day header in the timetable table | ||
468 | ✗ | body += "\t\t\t\t<td id=\""+valueToString(obj.getId()); | |
469 | ✗ | if(obj.getRowSpan() != 0lu){ | |
470 | ✗ | body += " rowspan=\""+valueToString(obj.getRowSpan())+"\""; | |
471 | } | ||
472 | ✗ | if(obj.getColSpan() != 0lu){ | |
473 | ✗ | body += " colspan=\""+valueToString(obj.getColSpan())+"\""; | |
474 | } | ||
475 | ✗ | body += "\" class=\"timetableDayStyle\">"; | |
476 | ✗ | body += platexobj_rawtext(obj.getVecContent()); | |
477 | ✗ | body += "</td>\n"; | |
478 | ✗ | return body; | |
479 | } | ||
480 | |||
481 | ///Convert a timetable block into a html string | ||
482 | /** @param[out] outputMode : output mode of the html backend | ||
483 | * @param obj : PLatexObj to be converted in html | ||
484 | * @return html string | ||
485 | */ | ||
486 | 991 | PString platexobj_htmlStrTimetableBlock(POutoutMode & outputMode, const PLatexObj & obj){ | |
487 |
1/1✓ Branch 1 taken 991 times.
|
991 | PString body(""); |
488 | //We add a block in the timetable table | ||
489 |
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()) + "\""; |
490 |
3/3✓ Branch 1 taken 991 times.
✓ Branch 3 taken 792 times.
✓ Branch 4 taken 199 times.
|
991 | if(obj.getRowSpan() != 0lu){ |
491 |
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())+"\""; |
492 | } | ||
493 |
2/3✓ Branch 1 taken 991 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 991 times.
|
991 | if(obj.getColSpan() != 0lu){ |
494 | ✗ | body += " colspan=\""+valueToString(obj.getColSpan())+"\""; | |
495 | } | ||
496 |
1/1✓ Branch 1 taken 991 times.
|
991 | PString blockStyle("timetableBlockStyle"); |
497 |
3/3✓ Branch 1 taken 991 times.
✓ Branch 4 taken 595 times.
✓ Branch 5 taken 396 times.
|
991 | if(obj.getText() != ""){ |
498 |
2/2✓ Branch 1 taken 595 times.
✓ Branch 4 taken 595 times.
|
595 | blockStyle = obj.getText(); |
499 | } | ||
500 |
3/3✓ Branch 1 taken 991 times.
✓ Branch 4 taken 991 times.
✓ Branch 7 taken 991 times.
|
991 | body += " class=\""+blockStyle+"\">"; |
501 |
3/3✓ Branch 1 taken 991 times.
✓ Branch 4 taken 991 times.
✓ Branch 7 taken 991 times.
|
991 | body += platexobj_htmlStr(outputMode, obj.getVecContent()); |
502 |
1/1✓ Branch 1 taken 991 times.
|
991 | body += "</td>\n"; |
503 | 1982 | return body; | |
504 | 991 | } | |
505 | |||
506 | ///Convert a timetable block into a html string | ||
507 | /** @param[out] outputMode : output mode of the html backend | ||
508 | * @param obj : PLatexObj to be converted in html | ||
509 | * @return html string | ||
510 | */ | ||
511 | 234 | PString platexobj_htmlStrTimetableEmptyBlock(POutoutMode & outputMode, const PLatexObj & obj){ | |
512 | 234 | PString body(""); | |
513 | //We add a block in the timetable table | ||
514 |
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()) + "\""; |
515 |
2/3✓ Branch 1 taken 234 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 234 times.
|
234 | if(obj.getRowSpan() != 0lu){ |
516 | ✗ | body += " rowspan=\""+valueToString(obj.getRowSpan())+"\""; | |
517 | } | ||
518 |
2/3✓ Branch 1 taken 234 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 234 times.
|
234 | if(obj.getColSpan() != 0lu){ |
519 | ✗ | body += " colspan=\""+valueToString(obj.getColSpan())+"\""; | |
520 | } | ||
521 |
1/1✓ Branch 1 taken 234 times.
|
234 | body += " class=\"timetableEmptyBlockStyle\"></td>\n"; |
522 | 234 | return body; | |
523 | } | ||
524 | ///Convert a timetable time into a html string | ||
525 | /** @param[out] outputMode : output mode of the html backend | ||
526 | * @param obj : PLatexObj to be converted in html | ||
527 | * @return html string | ||
528 | */ | ||
529 | 494 | PString platexobj_htmlStrTimetableTime(POutoutMode & outputMode, const PLatexObj & obj){ | |
530 | 494 | PString body(""); | |
531 | //We add a block in the timetable table | ||
532 |
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\">"; |
533 |
2/2✓ Branch 1 taken 494 times.
✓ Branch 4 taken 494 times.
|
494 | body += obj.getText(); |
534 |
1/1✓ Branch 1 taken 494 times.
|
494 | body += "</span></td>\n"; |
535 | 494 | return body; | |
536 | } | ||
537 | |||
538 | ///Convert a rendez-vous into a html string | ||
539 | /** @param obj : PLatexObj to be converted in html | ||
540 | * @return html string | ||
541 | */ | ||
542 | 895 | PString platexobj_htmlStrRendezVous(const PLatexObj & obj){ | |
543 | 895 | PString body(""); | |
544 | //We add a block in the timetable table | ||
545 |
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>"; |
546 | 895 | return body; | |
547 | } | ||
548 | |||
549 | ///Convert a basic environement into a string | ||
550 | /** @param[out] outputMode : output mode of the html backend | ||
551 | * @param obj : PLatexObj to be converted in html | ||
552 | * @param baliseName : name of the balise environement | ||
553 | * @param cssClassName : name of the css class to be used | ||
554 | * @param allowText : true if the TEXT PLatexObj are allowed, false if not | ||
555 | * @return html string | ||
556 | */ | ||
557 | 363 | PString platexobj_htmlStrBasicEnv(POutoutMode & outputMode, const PLatexObj & obj, const PString & baliseName, const PString & cssClassName, bool allowText){ | |
558 | 363 | PString body(""); | |
559 |
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())+"\""; |
560 |
1/2✓ Branch 1 taken 363 times.
✗ Branch 2 not taken.
|
363 | if(cssClassName != ""){ |
561 |
3/3✓ Branch 1 taken 363 times.
✓ Branch 4 taken 363 times.
✓ Branch 7 taken 363 times.
|
363 | body += " class=\""+cssClassName+"\""; |
562 | } | ||
563 |
1/1✓ Branch 1 taken 363 times.
|
363 | body += ">\n"; |
564 |
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); |
565 |
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"; |
566 | 363 | return body; | |
567 | } | ||
568 | |||
569 | ///Convert a tabular into a html string | ||
570 | /** @param[out] outputMode : output mode of the html backend | ||
571 | * @param obj : PLatexObj to be converted in html | ||
572 | * @return html string | ||
573 | */ | ||
574 | 1 | PString platexobj_htmlStrTabular(POutoutMode & outputMode, const PLatexObj & obj){ | |
575 | 1 | PString body(""); | |
576 |
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"; |
577 |
3/3✓ Branch 1 taken 1 times.
✓ Branch 4 taken 1 times.
✓ Branch 7 taken 1 times.
|
1 | body += platexobj_htmlStr(outputMode, obj.getVecContent()); |
578 |
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"; |
579 | 1 | return body; | |
580 | } | ||
581 | |||
582 | ///Convert a tabular into a html string | ||
583 | /** @param[out] outputMode : output mode of the html backend | ||
584 | * @param obj : PLatexObj to be converted in html | ||
585 | * @return html string | ||
586 | */ | ||
587 | 10 | PString platexobj_htmlStrTabRow(POutoutMode & outputMode, const PLatexObj & obj){ | |
588 | 10 | PString body(""); | |
589 |
1/1✓ Branch 1 taken 10 times.
|
10 | body += "\t<tr>\n"; |
590 |
3/3✓ Branch 1 taken 10 times.
✓ Branch 4 taken 10 times.
✓ Branch 7 taken 10 times.
|
10 | body += platexobj_htmlStr(outputMode, obj.getVecContent()); |
591 |
1/1✓ Branch 1 taken 10 times.
|
10 | body += "\t</tr>\n"; |
592 | 10 | return body; | |
593 | } | ||
594 | |||
595 | ///Convert a tabular into a html string | ||
596 | /** @param[out] outputMode : output mode of the html backend | ||
597 | * @param obj : PLatexObj to be converted in html | ||
598 | * @return html string | ||
599 | */ | ||
600 | 50 | PString platexobj_htmlStrTabCell(POutoutMode & outputMode, const PLatexObj & obj){ | |
601 | 50 | PString body(""); | |
602 |
1/1✓ Branch 1 taken 50 times.
|
50 | body += "\t\t<td>\n"; |
603 |
3/3✓ Branch 1 taken 50 times.
✓ Branch 4 taken 50 times.
✓ Branch 7 taken 50 times.
|
50 | body += platexobj_htmlStr(outputMode, obj.getVecContent()); |
604 |
1/1✓ Branch 1 taken 50 times.
|
50 | body += "\t\t</td>\n"; |
605 | 50 | return body; | |
606 | } | ||
607 | |||
608 | ///Convert a PLatexObj into a string | ||
609 | /** @param[out] outputMode : output mode of the html backend | ||
610 | * @param obj : PLatexObj to be converted into a string | ||
611 | * @return output string which contains the PLatexObj | ||
612 | */ | ||
613 | 1 | PString platexobj_htmlStrColumns(POutoutMode & outputMode, const PLatexObj & obj){ | |
614 | 1 | PString body(""); | |
615 |
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"; |
616 |
1/1✓ Branch 1 taken 1 times.
|
1 | body += "\t<tr>\n"; |
617 |
1/1✓ Branch 1 taken 1 times.
|
1 | const PVecLatexObj & vecObj = obj.getVecContent(); |
618 |
2/2✓ Branch 3 taken 5 times.
✓ Branch 4 taken 1 times.
|
6 | for(PVecLatexObj::const_iterator it(vecObj.begin()); it != vecObj.end(); ++it){ |
619 | // body += "\t\t<td>\n\t\t\t"; | ||
620 |
2/2✓ Branch 2 taken 5 times.
✓ Branch 5 taken 5 times.
|
5 | body += platexobj_htmlStr(outputMode, *it); |
621 | // body += "\n\t\t</td>\n"; | ||
622 | } | ||
623 |
1/1✓ Branch 1 taken 1 times.
|
1 | body += "\t</tr>\n</table>\n"; |
624 | 1 | return body; | |
625 | } | ||
626 | |||
627 | ///Convert a vector of numbers into a string | ||
628 | /** @param vecNb : vector of numbers to be converted | ||
629 | * @return output string | ||
630 | */ | ||
631 | 1157 | PString vecNumberToString(const std::vector<long unsigned int> & vecNb){ | |
632 |
3/3✓ Branch 1 taken 13 times.
✓ Branch 2 taken 1144 times.
✓ Branch 4 taken 13 times.
|
1157 | if(vecNb.size() == 0lu){return "";} |
633 |
1/1✓ Branch 1 taken 1144 times.
|
1144 | PString body(""); |
634 | 1144 | std::vector<long unsigned int>::const_iterator it(vecNb.begin()); | |
635 |
2/2✓ Branch 2 taken 1144 times.
✓ Branch 5 taken 1144 times.
|
1144 | body += valueToString(*it); |
636 | 1144 | ++it; | |
637 |
2/2✓ Branch 2 taken 2333 times.
✓ Branch 3 taken 1144 times.
|
3477 | while(it != vecNb.end()){ |
638 |
3/3✓ Branch 2 taken 2333 times.
✓ Branch 5 taken 2333 times.
✓ Branch 8 taken 2333 times.
|
2333 | body += "." + valueToString(*it); |
639 | 2333 | ++it; | |
640 | } | ||
641 |
1/1✓ Branch 1 taken 1144 times.
|
1144 | return body; |
642 | 1144 | } | |
643 | |||
644 | ///Convert the vector of menu into a html string | ||
645 | /** @param vecMenu : vector to be converted | ||
646 | * @return output string | ||
647 | */ | ||
648 | 300 | PString vecMenuToHtml(const PVecMenu & vecMenu){ | |
649 |
3/3✓ Branch 1 taken 241 times.
✓ Branch 2 taken 59 times.
✓ Branch 4 taken 241 times.
|
300 | if(vecMenu.size() == 0lu){return "";} |
650 |
1/1✓ Branch 1 taken 59 times.
|
59 | PString body(""); |
651 |
1/1✓ Branch 1 taken 59 times.
|
59 | body += "\t\t<ul class=\"sommaire\">\n"; |
652 |
2/2✓ Branch 4 taken 193 times.
✓ Branch 5 taken 59 times.
|
252 | for(PVecMenu::const_iterator it(vecMenu.begin()); it != vecMenu.end(); ++it){ |
653 |
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("-", ".")+") "; |
654 | |||
655 | // body += convertStrToHtml(it->getText()); | ||
656 |
2/2✓ Branch 2 taken 193 times.
✓ Branch 5 taken 193 times.
|
193 | body += it->getText(); |
657 | |||
658 |
1/1✓ Branch 1 taken 193 times.
|
193 | body += "</a></li>\n"; |
659 | } | ||
660 |
1/1✓ Branch 1 taken 59 times.
|
59 | body += "\t\t</ul>\n"; |
661 |
1/1✓ Branch 1 taken 59 times.
|
59 | return body; |
662 | 59 | } | |
663 | |||
664 | ///Get the html header | ||
665 | /** @param title : page title | ||
666 | * @param useMathJax : true to use MathJax, false otherwise | ||
667 | * @param useRemoteMathjax : true if we use remote mathjax | ||
668 | * @param currentStyle : current style to be used | ||
669 | * @return output string | ||
670 | */ | ||
671 | 619 | PString getHtmlHeader(const PString & title, bool useMathJax, bool useRemoteMathjax, const PString & currentStyle){ | |
672 | 619 | PString body(""); | |
673 |
1/1✓ Branch 1 taken 619 times.
|
619 | body += "<!DOCTYPE html>\n"; |
674 |
1/1✓ Branch 1 taken 619 times.
|
619 | body += "<html lang=\"fr\">\n"; |
675 |
1/1✓ Branch 1 taken 619 times.
|
619 | body += "\t<head>\n"; |
676 |
1/1✓ Branch 1 taken 619 times.
|
619 | body += "\t\t<meta charset=\"utf-8\" />\n"; |
677 |
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"; |
678 |
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"; |
679 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 619 times.
|
619 | if(useMathJax){ |
680 | ✗ | if(useRemoteMathjax){ | |
681 | ✗ | body += "\t\t<script src=\"load-mathjax.js\" async></script>\n"; | |
682 | }else{ | ||
683 | ✗ | body += "\t\t<script type=\"text/x-mathjax-config\">\n"; | |
684 | ✗ | body += "\t\t\tMathJax.Hub.Config({\n"; | |
685 | ✗ | body += "\t\t\t\textensions: [\"tex2jax.js\"],\n"; | |
686 | ✗ | body += "\t\t\t\tjax: [\"input/TeX\",\"output/HTML-CSS\"],\n"; | |
687 | ✗ | body += "\t\t\t\ttex2jax: {inlineMath: [[\"$\",\"$\"],[\"\\\\(\",\"\\\\)\"]]}\n"; | |
688 | ✗ | body += "\t\t\t});\n"; | |
689 | ✗ | body += "\t\t</script>\n"; | |
690 | ✗ | body += "\t\t<script type=\"text/javascript\" src=\"MathJax.js\"></script>\n"; | |
691 | } | ||
692 | } | ||
693 |
1/1✓ Branch 1 taken 619 times.
|
619 | body += "\t</head>\n"; |
694 |
1/1✓ Branch 1 taken 619 times.
|
619 | body += "\t<body>\n"; |
695 | 619 | return body; | |
696 | } | ||
697 | |||
698 | ///Get html footer | ||
699 | /** @return html footer | ||
700 | */ | ||
701 | 619 | PString getHtmlFooter(){ | |
702 | 619 | PString body(""); | |
703 |
1/1✓ Branch 1 taken 619 times.
|
619 | body += "\t</body>\n"; |
704 |
1/1✓ Branch 1 taken 619 times.
|
619 | body += "</html>\n\n"; |
705 | 619 | return body; | |
706 | |||
707 | } | ||
708 | |||
709 | ///Save a section in html | ||
710 | /** @param[out] outputMode : output mode of the html backend | ||
711 | * @param obj : PLatexObj to be saved | ||
712 | * @param baliseName : name of the title balise | ||
713 | * @param cssClassName : css class to be used | ||
714 | * @param prefixTitle : prefix of the title (Part or Chapter) | ||
715 | * @param isBibliography : true if there is a bibliography, false otherwise | ||
716 | */ | ||
717 | 193 | void platexobj_sectionHtml(POutoutMode & outputMode, const PLatexObj & obj, const PString & baliseName, const PString & cssClassName, | |
718 | const PString & prefixTitle, bool isBibliography) | ||
719 | { | ||
720 |
1/1✓ Branch 1 taken 193 times.
|
193 | PString body(""); |
721 |
1/1✓ Branch 1 taken 193 times.
|
193 | const PVecLatexObj & vecObj = obj.getVecContent(); |
722 |
2/2✓ Branch 3 taken 2051 times.
✓ Branch 4 taken 193 times.
|
2244 | for(PVecLatexObj::const_iterator it(vecObj.begin()); it != vecObj.end(); ++it){ |
723 |
2/2✓ Branch 2 taken 2051 times.
✓ Branch 5 taken 2051 times.
|
2051 | body += platexobj_htmlStr(outputMode, *it, isBibliography); |
724 | } | ||
725 |
1/1✓ Branch 1 taken 193 times.
|
193 | PString objTitle(getSectionTitle(outputMode, obj)); //Content of the section title |
726 |
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()), |
727 |
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(), |
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.getNextSec().getLink(), obj.getNextSec().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.getParentSec().getLink(), obj.getParentSec().getText(), |
730 | obj.getSourceFile(), obj.getSourceLine()); | ||
731 | |||
732 |
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); |
733 |
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()); |
734 |
3/3✓ Branch 1 taken 193 times.
✓ Branch 4 taken 193 times.
✓ Branch 7 taken 193 times.
|
193 | outputMode.mapVar["${PAGE_CONTENT}"] = body; |
735 | |||
736 |
2/2✓ Branch 1 taken 193 times.
✓ Branch 4 taken 193 times.
|
193 | PPath fileName(obj.getLink()); |
737 |
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))){ |
738 | ✗ | std::cerr << "platexobj_sectionHtml : can't save file '"<<fileName<<"' for object '" << obj.getName() << "'" << std::endl; | |
739 | } | ||
740 | // else{ | ||
741 | // std::cout << "platexobj_sectionHtml : save file '"<<fileName<<"'" << std::endl; | ||
742 | // } | ||
743 | 193 | } | |
744 | |||
745 | ///Convert a PLatexObj into a string | ||
746 | /** @param title : title name | ||
747 | * @param hLevel : h balise | ||
748 | * @param cssClassName : name of the css class to be used | ||
749 | * @return output string which contains the PLatexObj | ||
750 | */ | ||
751 | 472 | PString platexobj_htmlMainTitle(const PString & title, const PString & hLevel, const PString & cssClassName){ | |
752 |
3/3✓ Branch 1 taken 164 times.
✓ Branch 2 taken 308 times.
✓ Branch 4 taken 164 times.
|
472 | if(title == ""){return "";} |
753 |
1/1✓ Branch 1 taken 308 times.
|
308 | PString body(""); |
754 |
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"; |
755 |
1/1✓ Branch 1 taken 308 times.
|
308 | return body; |
756 | 308 | } | |
757 | |||
758 | ///Save the index.html file | ||
759 | /** @param[out] outputMode : output mode of the html backend | ||
760 | * @param obj : PLatexObj to be used | ||
761 | * @param isBibliography : true if there is a bibliography, false otherwise | ||
762 | */ | ||
763 | 107 | PString platexobj_indexHtml(POutoutMode & outputMode, const PLatexObj & obj, bool isBibliography){ | |
764 |
1/1✓ Branch 1 taken 107 times.
|
107 | PString body(""); |
765 |
1/1✓ Branch 1 taken 107 times.
|
107 | const PVecLatexObj & vecObj = obj.getVecContent(); |
766 |
2/2✓ Branch 3 taken 6276 times.
✓ Branch 4 taken 107 times.
|
6383 | for(PVecLatexObj::const_iterator it(vecObj.begin()); it != vecObj.end(); ++it){ |
767 |
2/2✓ Branch 2 taken 6276 times.
✓ Branch 5 taken 6276 times.
|
6276 | body += platexobj_htmlStr(outputMode, *it, isBibliography); |
768 | } | ||
769 |
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(), |
770 |
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(), |
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.getNextSec().getLink(), obj.getNextSec().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.getParentSec().getLink(), obj.getParentSec().getText(), |
773 | obj.getSourceFile(), obj.getSourceLine()); | ||
774 |
1/1✓ Branch 1 taken 107 times.
|
107 | PString bodyTitle(""); |
775 |
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"); |
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.getSubTitle(), "h2", "mainSubTitle"); |
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.getAuthor(), "h5", "author"); |
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.getDate(), "h6", "date"); |
779 |
3/3✓ Branch 1 taken 107 times.
✓ Branch 4 taken 107 times.
✓ Branch 7 taken 107 times.
|
107 | outputMode.mapVar["${MAIN_TITLE}"] = bodyTitle; |
780 |
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()); |
781 |
3/3✓ Branch 1 taken 107 times.
✓ Branch 4 taken 107 times.
✓ Branch 7 taken 107 times.
|
107 | outputMode.mapVar["${PAGE_CONTENT}"] = body; |
782 |
1/1✓ Branch 1 taken 107 times.
|
214 | return platexobj_theme_createPage(outputMode); |
783 | 107 | } | |
784 | |||
785 | ///Convert an itemize environement in html | ||
786 | /** @param[out] outputMode : output mode of the html backend | ||
787 | * @param obj : PLatexObj to be converted | ||
788 | * @return html string | ||
789 | */ | ||
790 | 188 | PString platexobj_htmlStrItemize(POutoutMode & outputMode, const PLatexObj & obj){ | |
791 | 188 | PString body(""); | |
792 |
1/1✓ Branch 1 taken 188 times.
|
188 | body += "\t\t<ul>\n"; |
793 |
3/3✓ Branch 1 taken 188 times.
✓ Branch 4 taken 188 times.
✓ Branch 7 taken 188 times.
|
188 | body += platexobj_htmlStr(outputMode, obj.getVecContent()); |
794 |
1/1✓ Branch 1 taken 188 times.
|
188 | body += "\t\t</ul>\n"; |
795 | 188 | return body; | |
796 | } | ||
797 | |||
798 | ///Convert an itemize environement in html | ||
799 | /** @param[out] outputMode : output mode of the html backend | ||
800 | * @param obj : PLatexObj to be converted | ||
801 | * @return html string | ||
802 | */ | ||
803 | 4 | PString platexobj_htmlStrEnumerate(POutoutMode & outputMode, const PLatexObj & obj){ | |
804 | 4 | PString body(""); | |
805 |
1/1✓ Branch 1 taken 4 times.
|
4 | body += "\t\t<ol>\n"; |
806 |
3/3✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
✓ Branch 7 taken 4 times.
|
4 | body += platexobj_htmlStr(outputMode, obj.getVecContent()); |
807 |
1/1✓ Branch 1 taken 4 times.
|
4 | body += "\t\t</ol>\n"; |
808 | 4 | return body; | |
809 | } | ||
810 | |||
811 | ///Convert an itemize environement in html | ||
812 | /** @param[out] outputMode : output mode of the html backend | ||
813 | * @param obj : PLatexObj to be converted | ||
814 | * @return html string | ||
815 | */ | ||
816 | 400 | PString platexobj_htmlStrItem(POutoutMode & outputMode, const PLatexObj & obj){ | |
817 | 400 | PString body(""); | |
818 |
1/1✓ Branch 1 taken 400 times.
|
400 | body += "\t\t<li>"; |
819 |
3/3✓ Branch 1 taken 400 times.
✓ Branch 4 taken 400 times.
✓ Branch 7 taken 400 times.
|
400 | body += platexobj_htmlStr(outputMode, obj.getVecContent()); |
820 |
1/1✓ Branch 1 taken 400 times.
|
400 | body += "</li>\n"; |
821 | 400 | return body; | |
822 | } | ||
823 | |||
824 | ///Convert a video call in html | ||
825 | /** @param obj : PLatexObj to be converted | ||
826 | * @return html string | ||
827 | */ | ||
828 | 6 | PString platexobj_htmlStrVideo(const PLatexObj & obj){ | |
829 |
1/1✓ Branch 1 taken 6 times.
|
6 | PString body(""); |
830 |
2/2✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
|
6 | PPath fileName(obj.getName()); |
831 |
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"; |
832 |
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"; |
833 |
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"; |
834 |
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"; |
835 | 12 | return body; | |
836 | 6 | } | |
837 | |||
838 | ///Convert a PLatexObj into a string (only base function) | ||
839 | /** @param[out] body : output string which contains the PLatexObj | ||
840 | * @param[out] outputMode : output mode of the html backend | ||
841 | * @param obj : PLatexObj to be converted into a string | ||
842 | * @param isBibliography : true if there is a bibliography, false otherwise | ||
843 | * @param allowText : true if the TEXT PLatexObj are allowed, false if not | ||
844 | * @return true on sucess, false otherwise | ||
845 | */ | ||
846 | 21900 | bool platexobj_htmlStrBase(PString & body, POutoutMode & outputMode, const PLatexObj & obj, bool isBibliography, bool allowText){ | |
847 | 21900 | PLatexType::PLatexType type(obj.getType()); | |
848 |
5/5✓ Branch 0 taken 9680 times.
✓ Branch 1 taken 12220 times.
✓ Branch 2 taken 9457 times.
✓ Branch 3 taken 223 times.
✓ Branch 6 taken 9457 times.
|
21900 | if(type == PLatexType::TEXT && allowText){body = platexobj_htmlStrText(obj);} |
849 |
3/3✓ Branch 0 taken 107 times.
✓ Branch 1 taken 12336 times.
✓ Branch 4 taken 107 times.
|
12443 | else if(type == PLatexType::URL){body = platexobj_htmlStrUrl(obj);} |
850 |
3/3✓ Branch 0 taken 6 times.
✓ Branch 1 taken 12330 times.
✓ Branch 4 taken 6 times.
|
12336 | else if(type == PLatexType::GETENV){body = platexobj_htmlStrGetEnv(obj);} |
851 |
3/3✓ Branch 0 taken 23 times.
✓ Branch 1 taken 12307 times.
✓ Branch 4 taken 23 times.
|
12330 | else if(type == PLatexType::UPDATESTYLE){body = platexobj_htmlStrUpdateStyle(outputMode, obj);} |
852 |
2/2✓ Branch 0 taken 58 times.
✓ Branch 1 taken 12249 times.
|
12307 | else if(type == PLatexType::PERCENT){body += "%";} |
853 |
3/3✓ Branch 0 taken 973 times.
✓ Branch 1 taken 11276 times.
✓ Branch 4 taken 973 times.
|
12249 | else if(type == PLatexType::REF){body = platexobj_htmlStrRef(obj);} |
854 |
3/3✓ Branch 0 taken 588 times.
✓ Branch 1 taken 10688 times.
✓ Branch 4 taken 588 times.
|
11276 | else if(type == PLatexType::NEWLINE){body = platexobj_htmlStrNewLine(obj);} |
855 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 10688 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
10688 | else if(type == PLatexType::SPACEPARAGRAPH){body = platexobj_htmlStrSpaceParagraph(obj);} |
856 |
3/3✓ Branch 0 taken 2545 times.
✓ Branch 1 taken 8143 times.
✓ Branch 4 taken 2545 times.
|
10688 | else if(type == PLatexType::AUTOSPACEPARAGRAPH){body = platexobj_htmlStrSpaceParagraph(obj);} |
857 |
3/3✓ Branch 0 taken 6 times.
✓ Branch 1 taken 8137 times.
✓ Branch 4 taken 6 times.
|
8143 | else if(type == PLatexType::CITATION){body = platexobj_htmlStrCitation(obj);} |
858 | |||
859 |
3/3✓ Branch 0 taken 297 times.
✓ Branch 1 taken 7840 times.
✓ Branch 4 taken 297 times.
|
8137 | else if(type == PLatexType::HREF){body = platexobj_htmlStrHref(outputMode, obj);} |
860 |
3/3✓ Branch 0 taken 865 times.
✓ Branch 1 taken 6975 times.
✓ Branch 4 taken 865 times.
|
7840 | else if(type == PLatexType::TEXTBF){body = platexobj_htmlStrTextBf(obj);} |
861 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 6975 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
6975 | else if(type == PLatexType::TEXTIT){body = platexobj_htmlStrTextIt(obj);} |
862 |
3/3✓ Branch 0 taken 52 times.
✓ Branch 1 taken 6923 times.
✓ Branch 4 taken 52 times.
|
6975 | else if(type == PLatexType::DEBUG){body = platexobj_htmlStrTextDebug(obj);} |
863 |
3/3✓ Branch 0 taken 53 times.
✓ Branch 1 taken 6870 times.
✓ Branch 4 taken 53 times.
|
6923 | else if(type == PLatexType::FOOTNOTE){body = platexobj_htmlStrTextFootnote(outputMode, obj);} |
864 |
3/3✓ Branch 0 taken 73 times.
✓ Branch 1 taken 6797 times.
✓ Branch 4 taken 73 times.
|
6870 | else if(type == PLatexType::CAPTION){body = platexobj_htmlStrCaption(outputMode, obj);} |
865 |
3/3✓ Branch 0 taken 17 times.
✓ Branch 1 taken 6780 times.
✓ Branch 4 taken 17 times.
|
6797 | else if(type == PLatexType::WORK_IN_PROGRESS){body = platexobj_htmlStrWip(outputMode, obj);} |
866 |
3/3✓ Branch 0 taken 3 times.
✓ Branch 1 taken 6777 times.
✓ Branch 4 taken 3 times.
|
6780 | else if(type == PLatexType::DETAILS){body = platexobj_htmlStrDetail(outputMode, obj);} |
867 |
3/3✓ Branch 0 taken 3 times.
✓ Branch 1 taken 6774 times.
✓ Branch 4 taken 3 times.
|
6777 | else if(type == PLatexType::SUMMARY){body = platexobj_htmlStrSummary(outputMode, obj);} |
868 |
3/3✓ Branch 0 taken 4 times.
✓ Branch 1 taken 6770 times.
✓ Branch 4 taken 4 times.
|
6774 | else if(type == PLatexType::QUOTE){body = platexobj_htmlStrQuote(outputMode, obj);} |
869 | |||
870 |
3/3✓ Branch 0 taken 45 times.
✓ Branch 1 taken 6725 times.
✓ Branch 4 taken 45 times.
|
6770 | else if(type == PLatexType::IMAGE){body = platexobj_htmlStrImage(obj);} |
871 |
3/3✓ Branch 0 taken 3 times.
✓ Branch 1 taken 6722 times.
✓ Branch 4 taken 3 times.
|
6725 | else if(type == PLatexType::CALLDOT){body = platexobj_htmlStrCallDot(outputMode, obj);} |
872 |
3/3✓ Branch 0 taken 2 times.
✓ Branch 1 taken 6720 times.
✓ Branch 4 taken 2 times.
|
6722 | else if(type == PLatexType::SVGTOPNG){body = platexobj_htmlStrSvgToPng(outputMode, obj);} |
873 | |||
874 |
5/5✓ Branch 0 taken 83 times.
✓ Branch 1 taken 6637 times.
✓ Branch 4 taken 83 times.
✓ Branch 7 taken 83 times.
✓ Branch 10 taken 83 times.
|
6720 | else if(type == PLatexType::PARTSTAR){body = platexobj_htmlStrAllPart(outputMode, obj, "h1", "");} |
875 |
5/5✓ Branch 0 taken 83 times.
✓ Branch 1 taken 6554 times.
✓ Branch 4 taken 83 times.
✓ Branch 7 taken 83 times.
✓ Branch 10 taken 83 times.
|
6637 | else if(type == PLatexType::CHAPTERSTAR){body = platexobj_htmlStrAllPart(outputMode, obj, "h2", "");} |
876 |
5/5✓ Branch 0 taken 82 times.
✓ Branch 1 taken 6472 times.
✓ Branch 4 taken 82 times.
✓ Branch 7 taken 82 times.
✓ Branch 10 taken 82 times.
|
6554 | else if(type == PLatexType::SECTIONSTAR){body = platexobj_htmlStrAllPart(outputMode, obj, "h3", "");} |
877 |
5/5✓ Branch 0 taken 81 times.
✓ Branch 1 taken 6391 times.
✓ Branch 4 taken 81 times.
✓ Branch 7 taken 81 times.
✓ Branch 10 taken 81 times.
|
6472 | else if(type == PLatexType::SUBSECTIONSTAR){body = platexobj_htmlStrAllPart(outputMode, obj, "h3", "");} |
878 |
5/5✓ Branch 0 taken 306 times.
✓ Branch 1 taken 6085 times.
✓ Branch 4 taken 306 times.
✓ Branch 7 taken 306 times.
✓ Branch 10 taken 306 times.
|
6391 | else if(type == PLatexType::SUBSUBSECTIONSTAR){body = platexobj_htmlStrAllPart(outputMode, obj, "h3", "");} |
879 | |||
880 |
5/5✓ Branch 0 taken 60 times.
✓ Branch 1 taken 6025 times.
✓ Branch 4 taken 60 times.
✓ Branch 7 taken 60 times.
✓ Branch 10 taken 60 times.
|
6085 | else if(type == PLatexType::PARAGRAPHE){body = platexobj_htmlStrBasicEnv(outputMode, obj, "p", "paragraphStyle", true);} |
881 |
5/5✓ Branch 0 taken 152 times.
✓ Branch 1 taken 5873 times.
✓ Branch 4 taken 152 times.
✓ Branch 7 taken 152 times.
✓ Branch 10 taken 152 times.
|
6025 | else if(type == PLatexType::CENTER){body = platexobj_htmlStrBasicEnv(outputMode, obj, "div", "centerStyle", true);} |
882 |
5/5✓ Branch 0 taken 2 times.
✓ Branch 1 taken 5871 times.
✓ Branch 4 taken 2 times.
✓ Branch 7 taken 2 times.
✓ Branch 10 taken 2 times.
|
5873 | else if(type == PLatexType::COLUMN){body = platexobj_htmlStrBasicEnv(outputMode, obj, "td", "columnStyle", true);} |
883 | |||
884 |
3/3✓ Branch 0 taken 1 times.
✓ Branch 1 taken 5870 times.
✓ Branch 4 taken 1 times.
|
5871 | else if(type == PLatexType::COLUMNS){body = platexobj_htmlStrColumns(outputMode, obj);} |
885 | |||
886 |
1/8✗ Branch 0 not taken.
✓ Branch 1 taken 5870 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.
|
5870 | else if(type == PLatexType::TABLE){body = platexobj_htmlStrBasicEnv(outputMode, obj, "div", "tableStyle", true);} |
887 |
3/3✓ Branch 0 taken 1 times.
✓ Branch 1 taken 5869 times.
✓ Branch 4 taken 1 times.
|
5870 | else if(type == PLatexType::TABULAR){body = platexobj_htmlStrTabular(outputMode, obj);} |
888 |
3/3✓ Branch 0 taken 10 times.
✓ Branch 1 taken 5859 times.
✓ Branch 4 taken 10 times.
|
5869 | else if(type == PLatexType::TABROW){body = platexobj_htmlStrTabRow(outputMode, obj);} |
889 |
3/3✓ Branch 0 taken 50 times.
✓ Branch 1 taken 5809 times.
✓ Branch 4 taken 50 times.
|
5859 | else if(type == PLatexType::TABCELL){body = platexobj_htmlStrTabCell(outputMode, obj);} |
890 |
5/5✓ Branch 0 taken 149 times.
✓ Branch 1 taken 5660 times.
✓ Branch 4 taken 149 times.
✓ Branch 7 taken 149 times.
✓ Branch 10 taken 149 times.
|
5809 | else if(type == PLatexType::FIGURE){body = platexobj_htmlStrBasicEnv(outputMode, obj, "div", "figureStyle", false);} |
891 | |||
892 |
1/6✗ Branch 0 not taken.
✓ Branch 1 taken 5660 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
|
5660 | else if(type == PLatexType::DISPLAYMATH){body = platexobj_htmlStrLatex(outputMode, obj, "displaymath");} |
893 |
4/4✓ Branch 0 taken 20 times.
✓ Branch 1 taken 5640 times.
✓ Branch 4 taken 20 times.
✓ Branch 7 taken 20 times.
|
5660 | else if(type == PLatexType::EQNARRAY){body = platexobj_htmlStrLatex(outputMode, obj, "eqnarray*");} |
894 |
3/3✓ Branch 0 taken 58 times.
✓ Branch 1 taken 5582 times.
✓ Branch 4 taken 58 times.
|
5640 | else if(type == PLatexType::INLINEMATH){body = platexobj_htmlStrInlineMath(outputMode, obj);} |
895 | |||
896 |
3/3✓ Branch 0 taken 188 times.
✓ Branch 1 taken 5394 times.
✓ Branch 4 taken 188 times.
|
5582 | else if(type == PLatexType::ITEMIZE){body = platexobj_htmlStrItemize(outputMode, obj);} |
897 |
3/3✓ Branch 0 taken 4 times.
✓ Branch 1 taken 5390 times.
✓ Branch 4 taken 4 times.
|
5394 | else if(type == PLatexType::ENUMERATE){body = platexobj_htmlStrEnumerate(outputMode, obj);} |
898 |
3/3✓ Branch 0 taken 400 times.
✓ Branch 1 taken 4990 times.
✓ Branch 4 taken 400 times.
|
5390 | else if(type == PLatexType::ITEM){body = platexobj_htmlStrItem(outputMode, obj);} |
899 |
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);} |
900 | |||
901 |
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);} |
902 |
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);} |
903 |
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);} |
904 |
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);} |
905 |
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);} |
906 |
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);} |
907 |
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);} |
908 |
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);} |
909 |
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);} |
910 |
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);} |
911 |
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);} |
912 |
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);} |
913 | else{ | ||
914 | 468 | return false; | |
915 | } | ||
916 | 21432 | return true; | |
917 | } | ||
918 | |||
919 | ///Convert a PLatexObj into a string | ||
920 | /** @param[out] outputMode : output mode of the html backend | ||
921 | * @param obj : PLatexObj to be converted into a string | ||
922 | * @param isBibliography : true if there is a bibliography, false otherwise | ||
923 | * @param allowText : true if the TEXT PLatexObj are allowed, false if not | ||
924 | * @return output string which contains the PLatexObj | ||
925 | */ | ||
926 | 19149 | PString platexobj_htmlStr(POutoutMode & outputMode, const PLatexObj & obj, bool isBibliography, bool allowText){ | |
927 | 19149 | PString body(""); | |
928 |
1/1✓ Branch 1 taken 19149 times.
|
19149 | PLatexType::PLatexType type(obj.getType()); |
929 |
6/6✓ Branch 0 taken 44 times.
✓ Branch 1 taken 19105 times.
✓ Branch 3 taken 44 times.
✓ Branch 6 taken 44 times.
✓ Branch 9 taken 44 times.
✓ Branch 12 taken 44 times.
|
19149 | if(type == PLatexType::PART){platexobj_sectionHtml(outputMode, obj, "h1", "ptexpart", "Part", isBibliography);} |
930 |
6/6✓ Branch 0 taken 58 times.
✓ Branch 1 taken 19047 times.
✓ Branch 3 taken 58 times.
✓ Branch 6 taken 58 times.
✓ Branch 9 taken 58 times.
✓ Branch 12 taken 58 times.
|
19105 | else if(type == PLatexType::CHAPTER){platexobj_sectionHtml(outputMode, obj, "h2", "ptexchapter", "Chapter", isBibliography);} |
931 |
6/6✓ Branch 0 taken 35 times.
✓ Branch 1 taken 19012 times.
✓ Branch 3 taken 35 times.
✓ Branch 6 taken 35 times.
✓ Branch 9 taken 35 times.
✓ Branch 12 taken 35 times.
|
19047 | else if(type == PLatexType::SECTION){platexobj_sectionHtml(outputMode, obj, "h3", "ptexsection", "", isBibliography);} |
932 |
6/6✓ Branch 0 taken 54 times.
✓ Branch 1 taken 18958 times.
✓ Branch 3 taken 54 times.
✓ Branch 6 taken 54 times.
✓ Branch 9 taken 54 times.
✓ Branch 12 taken 54 times.
|
19012 | else if(type == PLatexType::SUBSECTION){platexobj_sectionHtml(outputMode, obj, "h4", "ptexsubsection", "", isBibliography);} |
933 |
6/6✓ Branch 0 taken 2 times.
✓ Branch 1 taken 18956 times.
✓ Branch 3 taken 2 times.
✓ Branch 6 taken 2 times.
✓ Branch 9 taken 2 times.
✓ Branch 12 taken 2 times.
|
18958 | else if(type == PLatexType::SUBSUBSECTION){platexobj_sectionHtml(outputMode, obj, "h5", "ptexsubsubsection", "", isBibliography);} |
934 |
4/4✓ Branch 0 taken 107 times.
✓ Branch 1 taken 18849 times.
✓ Branch 3 taken 107 times.
✓ Branch 6 taken 107 times.
|
18956 | else if(type == PLatexType::FILE){body = platexobj_indexHtml(outputMode, obj, isBibliography);} |
935 |
3/3✓ Branch 1 taken 18849 times.
✓ Branch 3 taken 343 times.
✓ Branch 4 taken 18506 times.
|
18849 | else if(!platexobj_htmlStrBase(body, outputMode, obj, isBibliography, allowText)){ |
936 |
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); |
937 | } | ||
938 | 19149 | return body; | |
939 | } | ||
940 | |||
941 | ///Save a vector of PLatexObj in html | ||
942 | /** @param[out] outputMode : output mode of the html backend | ||
943 | * @param vecObj : vector of PLatexObj to be saved in html | ||
944 | * @param isBibliography : true if there is a bibliography, false otherwise | ||
945 | * @param allowText : true if the TEXT PLatexObj are allowed, false if not | ||
946 | * @return html string | ||
947 | */ | ||
948 | 7566 | PString platexobj_htmlStr(POutoutMode & outputMode, const PVecLatexObj & vecObj, bool isBibliography, bool allowText){ | |
949 | 7566 | PString body(""); | |
950 |
2/2✓ Branch 3 taken 10710 times.
✓ Branch 4 taken 7566 times.
|
18276 | for(PVecLatexObj::const_iterator it(vecObj.begin()); it != vecObj.end(); ++it){ |
951 |
2/2✓ Branch 2 taken 10710 times.
✓ Branch 5 taken 10710 times.
|
10710 | body += platexobj_htmlStr(outputMode, *it, isBibliography, allowText); |
952 | } | ||
953 | 7566 | return body; | |
954 | } | ||
955 | |||
956 | ///Copy a file in an output directory | ||
957 | /** @param inputFile : input file to be copied | ||
958 | * @param outputDir : directory where to copy the file | ||
959 | * @return true on success, false otherwise | ||
960 | */ | ||
961 | 788 | bool platexobj_copyFile(const PString & inputFile, const PString & outputDir){ | |
962 |
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 + "/"); |
963 |
2/3✓ Branch 2 taken 788 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 788 times.
|
788 | if(system(command.c_str()) != 0){ |
964 | ✗ | std::cerr << "platexobj_copyFile : can't copy file '"<<inputFile<<"' into '"<<outputDir<<"' directory" << std::endl; | |
965 | ✗ | return false; | |
966 | } | ||
967 | 788 | return true; | |
968 | 788 | } | |
969 | |||
970 | ///Edit the given file an create a copy at outputDir | ||
971 | /** @param inputFile : input file to be copied | ||
972 | * @param outputDir : directory where to copy the file | ||
973 | * @param outputMode : mode to get variable values | ||
974 | * @return true on success, false otherwise | ||
975 | */ | ||
976 | 11 | bool platexobj_editVaraibleFile(const PPath & inputFile, const PPath & outputDir, const POutoutMode & outputMode){ | |
977 |
1/1✓ Branch 1 taken 11 times.
|
11 | PString fileContent(inputFile.loadFileContent()); |
978 |
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+";"); |
979 |
2/2✓ Branch 1 taken 11 times.
✓ Branch 4 taken 11 times.
|
11 | PPath outputFile(outputDir / inputFile.getFileName()); |
980 |
1/1✓ Branch 1 taken 11 times.
|
22 | return outputFile.saveFileContent(updateContent); |
981 | 11 | } | |
982 | |||
983 | ///Save the main PLatexObj | ||
984 | /** @param[out] outputMode : output mode of the html backend | ||
985 | * @param obj : main PLatexObj to be saved | ||
986 | * @param isBibliography : true if there is a bibliography, false otherwise | ||
987 | * @param baseInstallPrefix : installation prefix to be used | ||
988 | * @return true on success, false otherwise | ||
989 | */ | ||
990 | 118 | bool platexobj_html(POutoutMode & outputMode, const PLatexObj & obj, bool isBibliography, const PString & baseInstallPrefix){ | |
991 |
1/1✓ Branch 1 taken 118 times.
|
118 | PString fileContent(""); |
992 |
2/2✓ Branch 1 taken 118 times.
✓ Branch 4 taken 118 times.
|
118 | PPath indexHtml(obj.getLink()); |
993 | |||
994 |
2/2✓ Branch 0 taken 11 times.
✓ Branch 1 taken 107 times.
|
118 | if(outputMode.isBookTheme){ |
995 |
2/2✓ Branch 1 taken 11 times.
✓ Branch 4 taken 11 times.
|
11 | fileContent = platexobj_bookHtml(outputMode, obj, isBibliography, true); |
996 | }else{ | ||
997 |
2/2✓ Branch 1 taken 107 times.
✓ Branch 4 taken 107 times.
|
107 | fileContent = platexobj_htmlStr(outputMode, obj, isBibliography); |
998 | } | ||
999 | |||
1000 |
2/3✓ Branch 1 taken 118 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 118 times.
|
118 | if(!indexHtml.saveFileContent(fileContent)){ |
1001 | ✗ | std::cerr << "platexobj_html : can't save file '"<<indexHtml<<"'" << std::endl; | |
1002 | ✗ | return false; | |
1003 | } | ||
1004 | // else{ | ||
1005 | // std::cerr << "platexobj_html : save file '"<<indexHtml<<"'" << std::endl; | ||
1006 | // } | ||
1007 | //Copy the background image | ||
1008 |
2/2✓ Branch 1 taken 118 times.
✓ Branch 4 taken 118 times.
|
118 | PPath outputImageDir(LATEX_IMAGE_OUTPUT_DIR); |
1009 |
2/3✓ Branch 1 taken 118 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 118 times.
|
118 | if(!outputImageDir.createDirectory()){ |
1010 | ✗ | std::cerr << "platexobj_htmlStrLatex : can't create directory '" << outputImageDir << "'" << std::endl; | |
1011 | ✗ | return ""; | |
1012 | } | ||
1013 | |||
1014 |
1/1✓ Branch 1 taken 118 times.
|
118 | PString installPrefix(CMAKE_INSTALL_PREFIX); |
1015 |
1/2✓ Branch 1 taken 118 times.
✗ Branch 2 not taken.
|
118 | if(baseInstallPrefix != ""){ |
1016 |
1/1✓ Branch 1 taken 118 times.
|
118 | installPrefix = baseInstallPrefix; |
1017 | } | ||
1018 | 118 | bool b(true); | |
1019 | // PString fileToBeCopied(installPrefix + "/share/PhoenixTex2Html/Images/trennen.jpg"); | ||
1020 |
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"); |
1021 |
1/1✓ Branch 1 taken 118 times.
|
118 | b &= platexobj_copyFile(fileToBeCopied, outputImageDir); |
1022 |
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"); |
1023 |
1/1✓ Branch 1 taken 118 times.
|
118 | b &= platexobj_copyFile(fileWipToBeCopied, outputImageDir); |
1024 |
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"); |
1025 |
1/1✓ Branch 1 taken 118 times.
|
118 | b &= platexobj_copyFile(fileLinkToBeCopied, outputImageDir); |
1026 |
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"); |
1027 |
1/1✓ Branch 1 taken 118 times.
|
118 | b &= platexobj_copyFile(fileCalendarWhiteToBeCopied, outputImageDir); |
1028 |
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"); |
1029 |
1/1✓ Branch 1 taken 118 times.
|
118 | b &= platexobj_copyFile(fileCalendarBlackToBeCopied, outputImageDir); |
1030 | |||
1031 |
2/2✓ Branch 0 taken 11 times.
✓ Branch 1 taken 107 times.
|
118 | if(outputMode.isBookTheme){ |
1032 |
2/2✓ Branch 1 taken 11 times.
✓ Branch 4 taken 11 times.
|
11 | PPath currentOutputDir("./"); |
1033 |
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); |
1034 |
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); |
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/chrome.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/ayu-highlight.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/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/tomorrow-night.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/font-awesome.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/fonts.css", currentOutputDir); |
1041 | |||
1042 |
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); |
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/highlight.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/book.js", currentOutputDir); |
1045 | |||
1046 |
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); |
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_gitlab_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_home_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_mail_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_next_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_prev_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_theme_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_toggle_sidebar_icon.png", outputImageDir); |
1054 | 11 | } | |
1055 | |||
1056 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 118 times.
|
118 | if(outputMode.isRemoteMathjax){ |
1057 | ✗ | PPath fileJavascriptConfigToBeCopied(installPrefix + "/share/PhoenixTex2Html/javascript/load-mathjax.js"); | |
1058 | ✗ | b &= platexobj_copyFile(fileJavascriptConfigToBeCopied, "."); | |
1059 | } | ||
1060 | 118 | return b; | |
1061 | 118 | } | |
1062 | |||
1063 |