diff --git a/novelwriter/core/tohtml.py b/novelwriter/core/tohtml.py index fad2bc3b..8e1a67ca 100644 --- a/novelwriter/core/tohtml.py +++ b/novelwriter/core/tohtml.py @@ -368,13 +368,12 @@ class ToHtml(Tokenizer): def getStyleSheet(self) -> list[str]: """Generate a stylesheet for the current settings.""" - styles = [] if not self._cssStyles: - return styles + return [] mScale = self._lineHeight/1.15 - textAlign = "justify" if self._doJustify else "left" + styles = [] styles.append("body {{font-family: '{0:s}'; font-size: {1:d}pt;}}".format( self._textFont, self._textSize )) @@ -384,7 +383,7 @@ class ToHtml(Tokenizer): "margin-top: {2:.2f}em; margin-bottom: {3:.2f}em;" "}}" ).format( - textAlign, + "justify" if self._doJustify else "left", round(100 * self._lineHeight), mScale * self._marginText[0], mScale * self._marginText[1], @@ -449,6 +448,7 @@ class ToHtml(Tokenizer): )) styles.append("a {color: rgb(66, 113, 174);}") + styles.append("mark {background: rgb(255, 255, 166);}") styles.append(".tags {color: rgb(245, 135, 31); font-weight: bold;}") styles.append(".break {text-align: left;}") styles.append(".synopsis {font-style: italic;}") diff --git a/novelwriter/tools/manuscript.py b/novelwriter/tools/manuscript.py index 8d95da6a..178e39c7 100644 --- a/novelwriter/tools/manuscript.py +++ b/novelwriter/tools/manuscript.py @@ -756,20 +756,13 @@ class _PreviewWidget(QTextBrowser): self.buildProgress.setCentreText(self.tr("Processing ...")) qApp.processEvents() - styles = "\n".join(data.get("styles", [ - "h1, h2 {color: rgb(66, 113, 174);}", - "h3, h4 {color: rgb(50, 50, 50);}", - "a {color: rgb(66, 113, 174);}", - ".tags {color: rgb(245, 135, 31); font-weight: bold;}", - ])) + styles = "\n".join(data.get("styles", [])) self.document().setDefaultStyleSheet(styles) html = "".join(data.get("html", [])) html = html.replace("\t", "!!tab!!") html = html.replace("", "") html = html.replace("", "") - html = html.replace("", "") - html = html.replace("", "") self.setHtml(html) qApp.processEvents() while self.find("!!tab!!"): diff --git a/tests/reference/mBuildDocBuild_HTML5_Lorem_Ipsum.htm b/tests/reference/mBuildDocBuild_HTML5_Lorem_Ipsum.htm index f3463792..f0aa4a92 100644 --- a/tests/reference/mBuildDocBuild_HTML5_Lorem_Ipsum.htm +++ b/tests/reference/mBuildDocBuild_HTML5_Lorem_Ipsum.htm @@ -14,6 +14,7 @@ h4 {color: rgb(50, 50, 50); page-break-after: avoid; margin-top: 0.76em; margin- .title {font-size: 2.5em; margin-top: 1.30em; margin-bottom: 0.65em;} .sep, .skip {text-align: center; margin-top: 1.30em; margin-bottom: 1.30em;} a {color: rgb(66, 113, 174);} +mark {background: rgb(255, 255, 166);} .tags {color: rgb(245, 135, 31); font-weight: bold;} .break {text-align: left;} .synopsis {font-style: italic;} diff --git a/tests/reference/mBuildDocBuild_HTML5_Lorem_Ipsum.json b/tests/reference/mBuildDocBuild_HTML5_Lorem_Ipsum.json index 50ae4237..6ff35e85 100644 --- a/tests/reference/mBuildDocBuild_HTML5_Lorem_Ipsum.json +++ b/tests/reference/mBuildDocBuild_HTML5_Lorem_Ipsum.json @@ -2,8 +2,8 @@ "meta": { "projectName": "Lorem Ipsum", "novelAuthor": "lipsum.com", - "buildTime": 1706648755, - "buildTimeStr": "2024-01-30 22:05:55" + "buildTime": 1709024252, + "buildTimeStr": "2024-02-27 09:57:32" }, "text": { "css": [ @@ -16,6 +16,7 @@ ".title {font-size: 2.5em; margin-top: 1.30em; margin-bottom: 0.65em;}", ".sep, .skip {text-align: center; margin-top: 1.30em; margin-bottom: 1.30em;}", "a {color: rgb(66, 113, 174);}", + "mark {background: rgb(255, 255, 166);}", ".tags {color: rgb(245, 135, 31); font-weight: bold;}", ".break {text-align: left;}", ".synopsis {font-style: italic;}",