Updated rendering of preview text to include synopsis
This commit is contained in:
+8
-7
@@ -66,7 +66,7 @@ class ToHtml(Tokenizer):
|
|||||||
# Setters
|
# Setters
|
||||||
##
|
##
|
||||||
|
|
||||||
def setPreview(self, forPreview, doComments):
|
def setPreview(self, forPreview, doComments, doSynopsis):
|
||||||
"""If we're using this class to generate markdown preview, we
|
"""If we're using this class to generate markdown preview, we
|
||||||
need to make a few changes to formatting, which is managed by
|
need to make a few changes to formatting, which is managed by
|
||||||
these flags.
|
these flags.
|
||||||
@@ -75,6 +75,7 @@ class ToHtml(Tokenizer):
|
|||||||
self.genMode = self.M_PREVIEW
|
self.genMode = self.M_PREVIEW
|
||||||
self.doKeywords = True
|
self.doKeywords = True
|
||||||
self.doComments = doComments
|
self.doComments = doComments
|
||||||
|
self.doSynopsis = doSynopsis
|
||||||
self.repDict["\t"] = " "*8
|
self.repDict["\t"] = " "*8
|
||||||
self._buildRegEx()
|
self._buildRegEx()
|
||||||
return
|
return
|
||||||
@@ -287,18 +288,18 @@ class ToHtml(Tokenizer):
|
|||||||
def _formatSynopsis(self, tText):
|
def _formatSynopsis(self, tText):
|
||||||
"""Apply HTML formatting to synopsis.
|
"""Apply HTML formatting to synopsis.
|
||||||
"""
|
"""
|
||||||
if self.genMode == self.M_EXPORT:
|
if self.genMode == self.M_PREVIEW:
|
||||||
return "<p class='synopsis'><strong>Synopsis: </strong>%s</p>\n" % tText
|
return "<p class='comment'><span class='synopsis'>Synopsis: </span>%s</p>\n" % tText
|
||||||
else:
|
else:
|
||||||
return "<p class='comment'>%s</p>\n" % tText
|
return "<p class='synopsis'><strong>Synopsis: </strong>%s</p>\n" % tText
|
||||||
|
|
||||||
def _formatComments(self, tText):
|
def _formatComments(self, tText):
|
||||||
"""Apply HTML formatting to comments.
|
"""Apply HTML formatting to comments.
|
||||||
"""
|
"""
|
||||||
if self.genMode == self.M_EXPORT:
|
if self.genMode == self.M_PREVIEW:
|
||||||
return "<p class='comment'><strong>Comment: </strong>%s</p>\n" % tText
|
|
||||||
else:
|
|
||||||
return "<p class='comment'>%s</p>\n" % tText
|
return "<p class='comment'>%s</p>\n" % tText
|
||||||
|
else:
|
||||||
|
return "<p class='comment'><strong>Comment: </strong>%s</p>\n" % tText
|
||||||
|
|
||||||
def _formatKeywords(self, tText):
|
def _formatKeywords(self, tText):
|
||||||
"""Apply HTML formatting to keywords.
|
"""Apply HTML formatting to keywords.
|
||||||
|
|||||||
+8
-1
@@ -136,7 +136,7 @@ class GuiDocViewer(QTextBrowser):
|
|||||||
logger.debug("Generating preview for item %s" % tHandle)
|
logger.debug("Generating preview for item %s" % tHandle)
|
||||||
sPos = self.verticalScrollBar().value()
|
sPos = self.verticalScrollBar().value()
|
||||||
aDoc = ToHtml(self.theProject, self.theParent)
|
aDoc = ToHtml(self.theProject, self.theParent)
|
||||||
aDoc.setPreview(True, self.mainConf.viewComments)
|
aDoc.setPreview(True, self.mainConf.viewComments, self.mainConf.viewSynopsis)
|
||||||
aDoc.setLinkHeaders(True)
|
aDoc.setLinkHeaders(True)
|
||||||
|
|
||||||
# Be extra careful here to prevent crashes when first opening a
|
# Be extra careful here to prevent crashes when first opening a
|
||||||
@@ -366,6 +366,10 @@ class GuiDocViewer(QTextBrowser):
|
|||||||
" margin-left: 1em;"
|
" margin-left: 1em;"
|
||||||
" margin-right: 1em;"
|
" margin-right: 1em;"
|
||||||
"}}\n"
|
"}}\n"
|
||||||
|
".synopsis {{"
|
||||||
|
" color: rgb({mColR},{mColG},{mColB});"
|
||||||
|
" font-wright: bold;"
|
||||||
|
"}}\n"
|
||||||
).format(
|
).format(
|
||||||
textSize = self.mainConf.textSize,
|
textSize = self.mainConf.textSize,
|
||||||
preSize = self.mainConf.textSize*0.9,
|
preSize = self.mainConf.textSize*0.9,
|
||||||
@@ -387,6 +391,9 @@ class GuiDocViewer(QTextBrowser):
|
|||||||
kColR = self.theTheme.colKey[0],
|
kColR = self.theTheme.colKey[0],
|
||||||
kColG = self.theTheme.colKey[1],
|
kColG = self.theTheme.colKey[1],
|
||||||
kColB = self.theTheme.colKey[2],
|
kColB = self.theTheme.colKey[2],
|
||||||
|
mColR = self.theTheme.colMod[0],
|
||||||
|
mColG = self.theTheme.colMod[1],
|
||||||
|
mColB = self.theTheme.colMod[2],
|
||||||
)
|
)
|
||||||
self.qDocument.setDefaultStyleSheet(styleSheet)
|
self.qDocument.setDefaultStyleSheet(styleSheet)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user