|
1 <!DOCTYPE html> |
|
2 <html><head> |
|
3 <title>eric5.UI.Previewers.PreviewerHTML</title> |
|
4 <meta charset="UTF-8"> |
|
5 <style> |
|
6 body { |
|
7 background: #EDECE6; |
|
8 margin: 0em 1em 10em 1em; |
|
9 color: black; |
|
10 } |
|
11 |
|
12 h1 { color: white; background: #85774A; } |
|
13 h2 { color: white; background: #85774A; } |
|
14 h3 { color: white; background: #9D936E; } |
|
15 h4 { color: white; background: #9D936E; } |
|
16 |
|
17 a { color: #BA6D36; } |
|
18 |
|
19 </style> |
|
20 </head> |
|
21 <body><a NAME="top" ID="top"></a> |
|
22 <h1>eric5.UI.Previewers.PreviewerHTML</h1> |
|
23 |
|
24 <h3>Global Attributes</h3> |
|
25 <table> |
|
26 <tr><td>None</td></tr> |
|
27 </table> |
|
28 <h3>Classes</h3> |
|
29 <table> |
|
30 <tr> |
|
31 <td><a href="#PreviewProcessingThread">PreviewProcessingThread</a></td> |
|
32 <td>Class implementing a thread to process some text into HTML usable by the previewer view.</td> |
|
33 </tr><tr> |
|
34 <td><a href="#PreviewerHTML">PreviewerHTML</a></td> |
|
35 <td>Class implementing a previewer widget for HTML, Markdown and ReST files.</td> |
|
36 </tr><tr> |
|
37 <td><a href="#_StrikeThroughExtension">_StrikeThroughExtension</a></td> |
|
38 <td>Class is placed here, because it depends on imported markdown, and markdown import is lazy.</td> |
|
39 </tr> |
|
40 </table> |
|
41 <h3>Functions</h3> |
|
42 <table> |
|
43 <tr><td>None</td></tr> |
|
44 </table> |
|
45 <hr /><hr /> |
|
46 <a NAME="PreviewProcessingThread" ID="PreviewProcessingThread"></a> |
|
47 <h2>PreviewProcessingThread</h2> |
|
48 <p> |
|
49 Class implementing a thread to process some text into HTML usable by the |
|
50 previewer view. |
|
51 </p><h3>Signals</h3> |
|
52 <dl> |
|
53 <dt>htmlReady(str,str)</dt> |
|
54 <dd> |
|
55 emitted with the file name and processed HTML |
|
56 to signal the availability of the processed HTML |
|
57 </dd> |
|
58 </dl> |
|
59 <h3>Derived from</h3> |
|
60 QThread |
|
61 <h3>Class Attributes</h3> |
|
62 <table> |
|
63 <tr><td>None</td></tr> |
|
64 </table> |
|
65 <h3>Class Methods</h3> |
|
66 <table> |
|
67 <tr><td>None</td></tr> |
|
68 </table> |
|
69 <h3>Methods</h3> |
|
70 <table> |
|
71 <tr> |
|
72 <td><a href="#PreviewProcessingThread.__init__">PreviewProcessingThread</a></td> |
|
73 <td>Constructor</td> |
|
74 </tr><tr> |
|
75 <td><a href="#PreviewProcessingThread.__convertMarkdown">__convertMarkdown</a></td> |
|
76 <td>Private method to convert Markdown text into HTML.</td> |
|
77 </tr><tr> |
|
78 <td><a href="#PreviewProcessingThread.__convertReST">__convertReST</a></td> |
|
79 <td>Private method to convert ReST text into HTML.</td> |
|
80 </tr><tr> |
|
81 <td><a href="#PreviewProcessingThread.__getHtml">__getHtml</a></td> |
|
82 <td>Private method to process the given text depending upon the given language.</td> |
|
83 </tr><tr> |
|
84 <td><a href="#PreviewProcessingThread.__processSSI">__processSSI</a></td> |
|
85 <td>Private method to process the given text for SSI statements.</td> |
|
86 </tr><tr> |
|
87 <td><a href="#PreviewProcessingThread.process">process</a></td> |
|
88 <td>Convert the given text to HTML.</td> |
|
89 </tr><tr> |
|
90 <td><a href="#PreviewProcessingThread.run">run</a></td> |
|
91 <td>Thread function to convert the stored data.</td> |
|
92 </tr> |
|
93 </table> |
|
94 <h3>Static Methods</h3> |
|
95 <table> |
|
96 <tr><td>None</td></tr> |
|
97 </table> |
|
98 <a NAME="PreviewProcessingThread.__init__" ID="PreviewProcessingThread.__init__"></a> |
|
99 <h4>PreviewProcessingThread (Constructor)</h4> |
|
100 <b>PreviewProcessingThread</b>(<i>parent=None</i>) |
|
101 <p> |
|
102 Constructor |
|
103 </p><dl> |
|
104 <dt><i>parent</i></dt> |
|
105 <dd> |
|
106 reference to the parent object (QObject) |
|
107 </dd> |
|
108 </dl><a NAME="PreviewProcessingThread.__convertMarkdown" ID="PreviewProcessingThread.__convertMarkdown"></a> |
|
109 <h4>PreviewProcessingThread.__convertMarkdown</h4> |
|
110 <b>__convertMarkdown</b>(<i>text</i>) |
|
111 <p> |
|
112 Private method to convert Markdown text into HTML. |
|
113 </p><dl> |
|
114 <dt><i>text</i></dt> |
|
115 <dd> |
|
116 text to be processed (string) |
|
117 </dd> |
|
118 </dl><dl> |
|
119 <dt>Returns:</dt> |
|
120 <dd> |
|
121 processed HTML (string) |
|
122 </dd> |
|
123 </dl><a NAME="PreviewProcessingThread.__convertReST" ID="PreviewProcessingThread.__convertReST"></a> |
|
124 <h4>PreviewProcessingThread.__convertReST</h4> |
|
125 <b>__convertReST</b>(<i>text</i>) |
|
126 <p> |
|
127 Private method to convert ReST text into HTML. |
|
128 </p><dl> |
|
129 <dt><i>text</i></dt> |
|
130 <dd> |
|
131 text to be processed (string) |
|
132 </dd> |
|
133 </dl><dl> |
|
134 <dt>Returns:</dt> |
|
135 <dd> |
|
136 processed HTML (string) |
|
137 </dd> |
|
138 </dl><a NAME="PreviewProcessingThread.__getHtml" ID="PreviewProcessingThread.__getHtml"></a> |
|
139 <h4>PreviewProcessingThread.__getHtml</h4> |
|
140 <b>__getHtml</b>(<i>language, text, ssiEnabled, filePath, rootPath</i>) |
|
141 <p> |
|
142 Private method to process the given text depending upon the given |
|
143 language. |
|
144 </p><dl> |
|
145 <dt><i>language</i></dt> |
|
146 <dd> |
|
147 language of the text (string) |
|
148 </dd><dt><i>text</i></dt> |
|
149 <dd> |
|
150 to be processed (string) |
|
151 </dd><dt><i>ssiEnabled</i></dt> |
|
152 <dd> |
|
153 flag indicating to do some (limited) SSI processing |
|
154 (boolean) |
|
155 </dd><dt><i>filePath</i></dt> |
|
156 <dd> |
|
157 file path of the text (string) |
|
158 </dd><dt><i>rootPath</i></dt> |
|
159 <dd> |
|
160 root path to be used for SSI processing (str) |
|
161 </dd> |
|
162 </dl><dl> |
|
163 <dt>Returns:</dt> |
|
164 <dd> |
|
165 processed HTML text (string) |
|
166 </dd> |
|
167 </dl><a NAME="PreviewProcessingThread.__processSSI" ID="PreviewProcessingThread.__processSSI"></a> |
|
168 <h4>PreviewProcessingThread.__processSSI</h4> |
|
169 <b>__processSSI</b>(<i>txt, filename, root</i>) |
|
170 <p> |
|
171 Private method to process the given text for SSI statements. |
|
172 </p><p> |
|
173 Note: Only a limited subset of SSI statements are supported. |
|
174 </p><dl> |
|
175 <dt><i>txt</i></dt> |
|
176 <dd> |
|
177 text to be processed (string) |
|
178 </dd><dt><i>filename</i></dt> |
|
179 <dd> |
|
180 name of the file associated with the given text |
|
181 (string) |
|
182 </dd><dt><i>root</i></dt> |
|
183 <dd> |
|
184 directory of the document root (string) |
|
185 </dd> |
|
186 </dl><dl> |
|
187 <dt>Returns:</dt> |
|
188 <dd> |
|
189 processed HTML (string) |
|
190 </dd> |
|
191 </dl><a NAME="PreviewProcessingThread.process" ID="PreviewProcessingThread.process"></a> |
|
192 <h4>PreviewProcessingThread.process</h4> |
|
193 <b>process</b>(<i>filePath, language, text, ssiEnabled, rootPath</i>) |
|
194 <p> |
|
195 Convert the given text to HTML. |
|
196 </p><dl> |
|
197 <dt><i>filePath</i></dt> |
|
198 <dd> |
|
199 file path of the text (string) |
|
200 </dd><dt><i>language</i></dt> |
|
201 <dd> |
|
202 language of the text (string) |
|
203 </dd><dt><i>text</i></dt> |
|
204 <dd> |
|
205 text to be processed (string) |
|
206 </dd><dt><i>ssiEnabled</i></dt> |
|
207 <dd> |
|
208 flag indicating to do some (limited) SSI processing |
|
209 (boolean) |
|
210 </dd><dt><i>rootPath</i></dt> |
|
211 <dd> |
|
212 root path to be used for SSI processing (str) |
|
213 </dd> |
|
214 </dl><a NAME="PreviewProcessingThread.run" ID="PreviewProcessingThread.run"></a> |
|
215 <h4>PreviewProcessingThread.run</h4> |
|
216 <b>run</b>(<i></i>) |
|
217 <p> |
|
218 Thread function to convert the stored data. |
|
219 </p> |
|
220 <div align="right"><a href="#top">Up</a></div> |
|
221 <hr /><hr /> |
|
222 <a NAME="PreviewerHTML" ID="PreviewerHTML"></a> |
|
223 <h2>PreviewerHTML</h2> |
|
224 <p> |
|
225 Class implementing a previewer widget for HTML, Markdown and ReST files. |
|
226 </p> |
|
227 <h3>Derived from</h3> |
|
228 QWidget, Ui_PreviewerHTML |
|
229 <h3>Class Attributes</h3> |
|
230 <table> |
|
231 <tr><td>None</td></tr> |
|
232 </table> |
|
233 <h3>Class Methods</h3> |
|
234 <table> |
|
235 <tr><td>None</td></tr> |
|
236 </table> |
|
237 <h3>Methods</h3> |
|
238 <table> |
|
239 <tr> |
|
240 <td><a href="#PreviewerHTML.__init__">PreviewerHTML</a></td> |
|
241 <td>Constructor</td> |
|
242 </tr><tr> |
|
243 <td><a href="#PreviewerHTML.__restoreScrollBarPositions">__restoreScrollBarPositions</a></td> |
|
244 <td>Private method to restore scroll bar positions for a previewed editor.</td> |
|
245 </tr><tr> |
|
246 <td><a href="#PreviewerHTML.__saveScrollBarPositions">__saveScrollBarPositions</a></td> |
|
247 <td>Private method to save scroll bar positions for a previewed editor.</td> |
|
248 </tr><tr> |
|
249 <td><a href="#PreviewerHTML.__setHtml">__setHtml</a></td> |
|
250 <td>Private method to set the HTML to the view and restore the scroll bars positions.</td> |
|
251 </tr><tr> |
|
252 <td><a href="#PreviewerHTML.__setJavaScriptEnabled">__setJavaScriptEnabled</a></td> |
|
253 <td>Private method to enable/disable JavaScript.</td> |
|
254 </tr><tr> |
|
255 <td><a href="#PreviewerHTML.on_jsCheckBox_clicked">on_jsCheckBox_clicked</a></td> |
|
256 <td>Private slot to enable/disable JavaScript.</td> |
|
257 </tr><tr> |
|
258 <td><a href="#PreviewerHTML.on_previewView_linkClicked">on_previewView_linkClicked</a></td> |
|
259 <td>Private slot handling the clicking of a link.</td> |
|
260 </tr><tr> |
|
261 <td><a href="#PreviewerHTML.on_previewView_titleChanged">on_previewView_titleChanged</a></td> |
|
262 <td>Private slot to handle a change of the title.</td> |
|
263 </tr><tr> |
|
264 <td><a href="#PreviewerHTML.on_ssiCheckBox_clicked">on_ssiCheckBox_clicked</a></td> |
|
265 <td>Private slot to enable/disable SSI.</td> |
|
266 </tr><tr> |
|
267 <td><a href="#PreviewerHTML.processEditor">processEditor</a></td> |
|
268 <td>Private slot to process an editor's text.</td> |
|
269 </tr><tr> |
|
270 <td><a href="#PreviewerHTML.shutdown">shutdown</a></td> |
|
271 <td>Public method to perform shutdown actions.</td> |
|
272 </tr> |
|
273 </table> |
|
274 <h3>Static Methods</h3> |
|
275 <table> |
|
276 <tr><td>None</td></tr> |
|
277 </table> |
|
278 <a NAME="PreviewerHTML.__init__" ID="PreviewerHTML.__init__"></a> |
|
279 <h4>PreviewerHTML (Constructor)</h4> |
|
280 <b>PreviewerHTML</b>(<i>parent=None</i>) |
|
281 <p> |
|
282 Constructor |
|
283 </p><dl> |
|
284 <dt><i>parent</i></dt> |
|
285 <dd> |
|
286 reference to the parent widget (QWidget) |
|
287 </dd> |
|
288 </dl><a NAME="PreviewerHTML.__restoreScrollBarPositions" ID="PreviewerHTML.__restoreScrollBarPositions"></a> |
|
289 <h4>PreviewerHTML.__restoreScrollBarPositions</h4> |
|
290 <b>__restoreScrollBarPositions</b>(<i></i>) |
|
291 <p> |
|
292 Private method to restore scroll bar positions for a previewed editor. |
|
293 </p><a NAME="PreviewerHTML.__saveScrollBarPositions" ID="PreviewerHTML.__saveScrollBarPositions"></a> |
|
294 <h4>PreviewerHTML.__saveScrollBarPositions</h4> |
|
295 <b>__saveScrollBarPositions</b>(<i></i>) |
|
296 <p> |
|
297 Private method to save scroll bar positions for a previewed editor. |
|
298 </p><a NAME="PreviewerHTML.__setHtml" ID="PreviewerHTML.__setHtml"></a> |
|
299 <h4>PreviewerHTML.__setHtml</h4> |
|
300 <b>__setHtml</b>(<i>filePath, html</i>) |
|
301 <p> |
|
302 Private method to set the HTML to the view and restore the scroll bars |
|
303 positions. |
|
304 </p><dl> |
|
305 <dt><i>filePath</i></dt> |
|
306 <dd> |
|
307 file path of the previewed editor (string) |
|
308 </dd><dt><i>html</i></dt> |
|
309 <dd> |
|
310 processed HTML text ready to be shown (string) |
|
311 </dd> |
|
312 </dl><a NAME="PreviewerHTML.__setJavaScriptEnabled" ID="PreviewerHTML.__setJavaScriptEnabled"></a> |
|
313 <h4>PreviewerHTML.__setJavaScriptEnabled</h4> |
|
314 <b>__setJavaScriptEnabled</b>(<i>enable</i>) |
|
315 <p> |
|
316 Private method to enable/disable JavaScript. |
|
317 </p><dl> |
|
318 <dt><i>enable</i></dt> |
|
319 <dd> |
|
320 flag indicating the enable state (boolean) |
|
321 </dd> |
|
322 </dl><a NAME="PreviewerHTML.on_jsCheckBox_clicked" ID="PreviewerHTML.on_jsCheckBox_clicked"></a> |
|
323 <h4>PreviewerHTML.on_jsCheckBox_clicked</h4> |
|
324 <b>on_jsCheckBox_clicked</b>(<i>checked</i>) |
|
325 <p> |
|
326 Private slot to enable/disable JavaScript. |
|
327 </p><dl> |
|
328 <dt><i>checked</i></dt> |
|
329 <dd> |
|
330 state of the checkbox (boolean) |
|
331 </dd> |
|
332 </dl><a NAME="PreviewerHTML.on_previewView_linkClicked" ID="PreviewerHTML.on_previewView_linkClicked"></a> |
|
333 <h4>PreviewerHTML.on_previewView_linkClicked</h4> |
|
334 <b>on_previewView_linkClicked</b>(<i>url</i>) |
|
335 <p> |
|
336 Private slot handling the clicking of a link. |
|
337 </p><dl> |
|
338 <dt><i>url</i></dt> |
|
339 <dd> |
|
340 url of the clicked link (QUrl) |
|
341 </dd> |
|
342 </dl><a NAME="PreviewerHTML.on_previewView_titleChanged" ID="PreviewerHTML.on_previewView_titleChanged"></a> |
|
343 <h4>PreviewerHTML.on_previewView_titleChanged</h4> |
|
344 <b>on_previewView_titleChanged</b>(<i>title</i>) |
|
345 <p> |
|
346 Private slot to handle a change of the title. |
|
347 </p><dl> |
|
348 <dt><i>title</i></dt> |
|
349 <dd> |
|
350 new title (string) |
|
351 </dd> |
|
352 </dl><a NAME="PreviewerHTML.on_ssiCheckBox_clicked" ID="PreviewerHTML.on_ssiCheckBox_clicked"></a> |
|
353 <h4>PreviewerHTML.on_ssiCheckBox_clicked</h4> |
|
354 <b>on_ssiCheckBox_clicked</b>(<i>checked</i>) |
|
355 <p> |
|
356 Private slot to enable/disable SSI. |
|
357 </p><dl> |
|
358 <dt><i>checked</i></dt> |
|
359 <dd> |
|
360 state of the checkbox (boolean) |
|
361 </dd> |
|
362 </dl><a NAME="PreviewerHTML.processEditor" ID="PreviewerHTML.processEditor"></a> |
|
363 <h4>PreviewerHTML.processEditor</h4> |
|
364 <b>processEditor</b>(<i>editor=None</i>) |
|
365 <p> |
|
366 Private slot to process an editor's text. |
|
367 </p><dl> |
|
368 <dt><i>editor</i></dt> |
|
369 <dd> |
|
370 editor to be processed (Editor) |
|
371 </dd> |
|
372 </dl><a NAME="PreviewerHTML.shutdown" ID="PreviewerHTML.shutdown"></a> |
|
373 <h4>PreviewerHTML.shutdown</h4> |
|
374 <b>shutdown</b>(<i></i>) |
|
375 <p> |
|
376 Public method to perform shutdown actions. |
|
377 </p> |
|
378 <div align="right"><a href="#top">Up</a></div> |
|
379 <hr /><hr /> |
|
380 <a NAME="_StrikeThroughExtension" ID="_StrikeThroughExtension"></a> |
|
381 <h2>_StrikeThroughExtension</h2> |
|
382 <p> |
|
383 Class is placed here, because it depends on imported markdown, |
|
384 and markdown import is lazy. |
|
385 </p><p> |
|
386 (see http://achinghead.com/ |
|
387 python-markdown-adding-insert-delete.html this page for |
|
388 details) |
|
389 </p> |
|
390 <h3>Derived from</h3> |
|
391 markdown.Extension |
|
392 <h3>Class Attributes</h3> |
|
393 <table> |
|
394 <tr><td>DEL_RE</td></tr> |
|
395 </table> |
|
396 <h3>Class Methods</h3> |
|
397 <table> |
|
398 <tr><td>None</td></tr> |
|
399 </table> |
|
400 <h3>Methods</h3> |
|
401 <table> |
|
402 <tr> |
|
403 <td><a href="#_StrikeThroughExtension.extendMarkdown">extendMarkdown</a></td> |
|
404 <td></td> |
|
405 </tr> |
|
406 </table> |
|
407 <h3>Static Methods</h3> |
|
408 <table> |
|
409 <tr><td>None</td></tr> |
|
410 </table> |
|
411 <a NAME="_StrikeThroughExtension.extendMarkdown" ID="_StrikeThroughExtension.extendMarkdown"></a> |
|
412 <h4>_StrikeThroughExtension.extendMarkdown</h4> |
|
413 <b>extendMarkdown</b>(<i>md, md_globals</i>) |
|
414 |
|
415 <div align="right"><a href="#top">Up</a></div> |
|
416 <hr /> |
|
417 </body></html> |