Added a cssStyles flag that is needed to add styles at all to generated HTML
This commit is contained in:
+12
-2
@@ -43,6 +43,7 @@ class ToHtml(Tokenizer):
|
|||||||
def __init__(self, theProject, theParent):
|
def __init__(self, theProject, theParent):
|
||||||
Tokenizer.__init__(self, theProject, theParent)
|
Tokenizer.__init__(self, theProject, theParent)
|
||||||
self.genMode = self.M_EXPORT
|
self.genMode = self.M_EXPORT
|
||||||
|
self.cssStyles = True
|
||||||
|
|
||||||
self.repDict = {
|
self.repDict = {
|
||||||
"<" : "<",
|
"<" : "<",
|
||||||
@@ -78,6 +79,13 @@ class ToHtml(Tokenizer):
|
|||||||
self._buildRegEx()
|
self._buildRegEx()
|
||||||
return
|
return
|
||||||
|
|
||||||
|
def setStyles(self, cssStyles):
|
||||||
|
"""Enable/disable CSS styling. Some elements may still have
|
||||||
|
class tags.
|
||||||
|
"""
|
||||||
|
self.cssStyles = cssStyles
|
||||||
|
return
|
||||||
|
|
||||||
##
|
##
|
||||||
# Class Methods
|
# Class Methods
|
||||||
##
|
##
|
||||||
@@ -147,7 +155,7 @@ class ToHtml(Tokenizer):
|
|||||||
|
|
||||||
# Styles
|
# Styles
|
||||||
aStyle = []
|
aStyle = []
|
||||||
if tStyle is not None:
|
if tStyle is not None and self.cssStyles:
|
||||||
if tStyle & self.A_LEFT:
|
if tStyle & self.A_LEFT:
|
||||||
aStyle.append("text-align: left;")
|
aStyle.append("text-align: left;")
|
||||||
if tStyle & self.A_RIGHT:
|
if tStyle & self.A_RIGHT:
|
||||||
@@ -183,7 +191,7 @@ class ToHtml(Tokenizer):
|
|||||||
if tType == self.T_EMPTY:
|
if tType == self.T_EMPTY:
|
||||||
if parStyle is None:
|
if parStyle is None:
|
||||||
parStyle = ""
|
parStyle = ""
|
||||||
if hasHardBreak:
|
if hasHardBreak and self.cssStyles:
|
||||||
parClass = " class='break'"
|
parClass = " class='break'"
|
||||||
else:
|
else:
|
||||||
parClass = ""
|
parClass = ""
|
||||||
@@ -250,6 +258,8 @@ class ToHtml(Tokenizer):
|
|||||||
"""Generate a stylesheet appropriate for the current settings.
|
"""Generate a stylesheet appropriate for the current settings.
|
||||||
"""
|
"""
|
||||||
theStyles = []
|
theStyles = []
|
||||||
|
if not self.cssStyles:
|
||||||
|
return theStyles
|
||||||
|
|
||||||
if self.doJustify:
|
if self.doJustify:
|
||||||
theStyles.append(r"p {text-align: justify;}")
|
theStyles.append(r"p {text-align: justify;}")
|
||||||
|
|||||||
Reference in New Issue
Block a user