Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Make CSS parser less agressively crap

  • Loading branch information...
commit 6aacbdbd2ff219cea59f622584598e1bb9061165 1 parent efaa4e2
@batterseapower batterseapower authored
Showing with 3 additions and 6 deletions.
  1. +3 −6 pinyin/model.py
View
9 pinyin/model.py
@@ -375,11 +375,8 @@ def parse_style(style):
return (intelligible, unintelligible)
- return dict([(pair.split(":")[0].strip(), pair.split(":")[1].strip()) for pair in style.split(";")])
-
- def unparse_style(parsed_style):
- intelligible, unintelligible = parsed_style
- return "; ".join([k + " : " + v for k, v in intelligible] + unintelligible)
+ def unparse_style(intelligible, unintelligible):
+ return "; ".join([k + " : " + v for k, v in intelligible.items()] + unintelligible)
# For now, we only worry about the color attribute in the span tag's style
def take_style_val(key):
@@ -392,7 +389,7 @@ def go(style):
else:
value = None
- return (value, unparse_style((intelligible, unintelligible)))
+ return (value, unparse_style(intelligible, unintelligible))
return go
Please sign in to comment.
Something went wrong with that request. Please try again.