Skip to content

Commit

Permalink
232: sytle can be blank (#233)
Browse files Browse the repository at this point in the history
* style can be blank
  • Loading branch information
al-niessner authored May 7, 2024
1 parent 7855f59 commit d368c46
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
2 changes: 2 additions & 0 deletions Python/dawgie/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -872,6 +872,8 @@ def features(self)->[Feature]: raise NotImplementedError()
class Visitor:
def add_declaration (self, text:str, **kwds)->None:
raise NotImplementedError()
def add_declaration_inline(self, text:str, **kwds)->None:
raise NotImplementedError()
def add_image (self, alternate:str, label:str, img:bytes)->None:
raise NotImplementedError()
def add_primitive (self, value, label:str=None)->None:
Expand Down
12 changes: 9 additions & 3 deletions Python/dawgie/de/html.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,10 @@ def add_declaration(self, text: str, **kwds) -> None:
return

def add_declaration_inline(self, text: str, **kwds) -> None:
# have to walk through a bunch of possiblities of input meaning that
# this function is basically a horde of branches. Therefore asking
# pylint: disable=too-many-branches
#
# attributes that apply to presentation
# class allows application of predefined css within preloaded
# stylesheets files -- if file isn't preloaded there is no effect
Expand All @@ -192,9 +196,11 @@ def add_declaration_inline(self, text: str, **kwds) -> None:
# escape double-quotes only, allow single-quotations for css
# html.escape() rules out certain advanced constructs but they can
# be inserted via a stylesheet
attrib_value = html.escape(str(kwds['style']),
quote=False).replace("\"", """)
style = f" style=\"{attrib_value}\" " if 'style' in kwds else ""
if 'style' in kwds:
attrib_value = html.escape(str(kwds['style']),
quote=False).replace("\"", """)
style = f" style=\"{attrib_value}\" "
else: style = ""

# tags for configuration settings (e.g. __<custom_name> in class vars)
# -- embed external files before inline scripts --
Expand Down

0 comments on commit d368c46

Please sign in to comment.