eric6/UI/Previewers/PreviewerHTML.py

changeset 8260
2161475d9639
parent 8243
cc717c2ae956
child 8273
698ae46f40a4
--- a/eric6/UI/Previewers/PreviewerHTML.py	Wed Apr 21 19:40:50 2021 +0200
+++ b/eric6/UI/Previewers/PreviewerHTML.py	Thu Apr 22 18:02:47 2021 +0200
@@ -238,10 +238,11 @@
             self.__restoreScrollBarPositions)
         if not filePath:
             filePath = "/"
-        if rootPath:
-            baseUrl = QUrl.fromLocalFile(rootPath + "/index.html")
-        else:
-            baseUrl = QUrl.fromLocalFile(filePath)
+        baseUrl = (
+            QUrl.fromLocalFile(rootPath + "/index.html")
+            if rootPath else
+            QUrl.fromLocalFile(filePath)
+        )
         self.previewView.setHtml(html, baseUrl=baseUrl)
         if self.__previewedEditor:
             self.__previewedEditor.setFocus()
@@ -766,16 +767,13 @@
         htmlFormat = Preferences.getEditor("PreviewMarkdownHTMLFormat").lower()
         body = markdown.markdown(text, extensions=extensions,
                                  output_format=htmlFormat.lower())
-        if e5App().usesDarkPalette():
-            style = (
-                PreviewerHTMLStyles.css_markdown_dark +
-                PreviewerHTMLStyles.css_pygments_dark
-            )
-        else:
-            style = (
-                PreviewerHTMLStyles.css_markdown_light +
-                PreviewerHTMLStyles.css_pygments_light
-            )
+        style = (
+            (PreviewerHTMLStyles.css_markdown_dark +
+             PreviewerHTMLStyles.css_pygments_dark)
+            if e5App().usesDarkPalette() else
+            (PreviewerHTMLStyles.css_markdown_light +
+             PreviewerHTMLStyles.css_pygments_light)
+        )
         
         if htmlFormat == "xhtml1":
             head = (

eric ide

mercurial