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