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