eric6/UI/CodeDocumentationViewerTemplate.py

changeset 7523
6e26ec343c78
parent 7360
9190402e4505
child 7716
313e09453306
equal deleted inserted replaced
7522:e0e05a1b576f 7523:6e26ec343c78
7 Module implementing functions to prepare an HTML documentation view. 7 Module implementing functions to prepare an HTML documentation view.
8 """ 8 """
9 9
10 10
11 from PyQt5.QtCore import QCoreApplication 11 from PyQt5.QtCore import QCoreApplication
12
13 from E5Gui.E5Application import e5App
12 14
13 import Utilities 15 import Utilities
14 16
15 17
16 def prepareDocumentationViewerHtmlDocument(documentationInfo): 18 def prepareDocumentationViewerHtmlDocument(documentationInfo):
26 mainTemplate = """ 28 mainTemplate = """
27 <!DOCTYPE html> 29 <!DOCTYPE html>
28 <html> 30 <html>
29 <head> 31 <head>
30 <meta http-equiv="content-type" content="text/html; charset=utf-8"> 32 <meta http-equiv="content-type" content="text/html; charset=utf-8">
31 <link rel="stylesheet" href="qrc:documentViewerStyle.css" 33 <link rel="stylesheet" href="qrc:documentViewerStyle-{0}.css"
32 type="text/css" /> 34 type="text/css" />
33 </head> 35 </head>
34 <body> 36 <body>
35 @HEADER@ 37 @HEADER@
36 @DOCSTRING@ 38 @DOCSTRING@
140 "CodeDocumentationViewer", 142 "CodeDocumentationViewer",
141 "No further documentation available")) 143 "No further documentation available"))
142 ) 144 )
143 145
144 return ( 146 return (
145 mainTemplate 147 mainTemplate.format("dark" if e5App().usesDarkPalette() else "light")
146 .replace("@HEADER@", header) 148 .replace("@HEADER@", header)
147 .replace("@DOCSTRING@", docstring) 149 .replace("@DOCSTRING@", docstring)
148 ) 150 )
149 151
150 152
160 mainTemplate = """ 162 mainTemplate = """
161 <!DOCTYPE html> 163 <!DOCTYPE html>
162 <html> 164 <html>
163 <head> 165 <head>
164 <meta http-equiv="content-type" content="text/html; charset=utf-8"> 166 <meta http-equiv="content-type" content="text/html; charset=utf-8">
165 <link rel="stylesheet" href="qrc:documentViewerStyle.css" 167 <link rel="stylesheet" href="qrc:documentViewerStyle-{0}.css"
166 type="text/css" /> 168 type="text/css" />
167 </head> 169 </head>
168 <body> 170 <body>
169 <div id="doc-warning">@TEXT@</div> 171 <div id="doc-warning">@TEXT@</div>
170 </body> 172 </body>
171 </html> 173 </html>
172 """ 174 """
173 175
174 return mainTemplate.replace("@TEXT@", text) 176 return (
177 mainTemplate.format("dark" if e5App().usesDarkPalette() else "light")
178 .replace("@TEXT@", text)
179 )
175 180
176 181
177 def prepareDocumentationViewerHtmlWarningDocument(text): 182 def prepareDocumentationViewerHtmlWarningDocument(text):
178 """ 183 """
179 Public function to prepare a HTML warning document. 184 Public function to prepare a HTML warning document.
186 mainTemplate = """ 191 mainTemplate = """
187 <!DOCTYPE html> 192 <!DOCTYPE html>
188 <html> 193 <html>
189 <head> 194 <head>
190 <meta http-equiv="content-type" content="text/html; charset=utf-8"> 195 <meta http-equiv="content-type" content="text/html; charset=utf-8">
191 <link rel="stylesheet" href="qrc:documentViewerStyle.css" 196 <link rel="stylesheet" href="qrc:documentViewerStyle-{0}.css"
192 type="text/css" /> 197 type="text/css" />
193 </head> 198 </head>
194 <body> 199 <body>
195 <div id="warning">@TEXT@</div> 200 <div id="warning">@TEXT@</div>
196 </body> 201 </body>
197 </html> 202 </html>
198 """ 203 """
199 204
200 return mainTemplate.replace("@TEXT@", text) 205 return (
206 mainTemplate.format("dark" if e5App().usesDarkPalette() else "light")
207 .replace("@TEXT@", text)
208 )

eric ide

mercurial