summaryrefslogtreecommitdiff
path: root/mammoth/style_reader/html_path_reader.py
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2013-12-13 18:02:12 +0000
committerMichael Williamson <mike@zwobble.org>2013-12-13 18:02:12 +0000
commit4d09c8116dbf01487368c16a66ea13f07b3349a3 (patch)
tree5d842b3aec7ca18a7a7903a82bd0abafc31ab302 /mammoth/style_reader/html_path_reader.py
parent49d046acf05be128d404a419ecde05091efa30c1 (diff)
Parse styles
Diffstat (limited to 'mammoth/style_reader/html_path_reader.py')
-rw-r--r--mammoth/style_reader/html_path_reader.py13
1 files changed, 7 insertions, 6 deletions
diff --git a/mammoth/style_reader/html_path_reader.py b/mammoth/style_reader/html_path_reader.py
index 0de6e8c..0f1331b 100644
--- a/mammoth/style_reader/html_path_reader.py
+++ b/mammoth/style_reader/html_path_reader.py
@@ -5,11 +5,10 @@ from .. import html_paths
def read_html_path(string):
path_node = _grammar.parse(string)
- return _read_path_node(path_node)
-
+ return read_html_path_node(path_node)
-def _read_path_node(path_node):
+def read_html_path_node(path_node):
elements = [
_read_element_node(child)
for child in _repeated_children_with_separator(path_node, has_whitespace=True)
@@ -59,9 +58,9 @@ def _repeated_children_with_separator(node, has_whitespace):
yield child.children[sequence_node_index]
-_grammar = Grammar(r"""
+grammar_text = r"""
-path = element whitespace* (">" whitespace* element)*
+html_path = element whitespace* (">" whitespace* element)*
element = tag_names class_name* fresh?
@@ -75,5 +74,7 @@ identifier = ~"[A-Z0-9]*"i
whitespace = ~"\s"*
-""")
+"""
+
+_grammar = Grammar(grammar_text)