diff options
author | Shaun McCance <shaunm@gnome.org> | 2011-06-23 17:51:40 -0400 |
---|---|---|
committer | Shaun McCance <shaunm@gnome.org> | 2011-06-24 10:21:08 -0400 |
commit | 56cd8382ae979fab1a4a4a25f052d93d1070fc6d (patch) | |
tree | 7cfb353d2d03d032bf34e0e5b55fe733ba626d04 | |
parent | 333218d4978a7b203252d35e7979f64cfb3b0c1c (diff) | |
download | itstool-56cd8382ae979fab1a4a4a25f052d93d1070fc6d.tar.gz |
Made dropRule take a drop attribute, like other rules
-rwxr-xr-x | itstool.in | 6 | ||||
-rw-r--r-- | tests/Droprule.ll.xml | 2 | ||||
-rw-r--r-- | tests/Droprule.xml | 2 |
3 files changed, 5 insertions, 5 deletions
@@ -318,7 +318,7 @@ class Document (object): self._its_within_text_nodes = {} self._its_loc_notes = {} self._itst_preserve_space_nodes = {} - self._itst_drop_nodes = [] + self._itst_drop_nodes = {} self._its_lang = {} self._itst_lang_attr = {} self._itst_credits = None @@ -342,7 +342,7 @@ class Document (object): elif xml_is_ns_name(rule, NS_ITST, 'dropRule'): if rule.prop('selector') is not None: for node in self._try_xpath_eval(xpath, rule.prop('selector')): - self._itst_drop_nodes.append(node) + self._itst_drop_nodes[node] = rule.prop('drop') elif xml_is_ns_name(rule, NS_ITS, 'locNoteRule'): locnote = None for child in xml_child_iter(rule): @@ -694,7 +694,7 @@ class Document (object): if node.type in ('text', 'cdata') and msg is not None: msg.add_text(node.content) return - if node.type != 'element' or node in self._itst_drop_nodes: + if node.type != 'element' or self._itst_drop_nodes.get(node, 'no') == 'yes': return translate = self.get_its_translate(node) if translate is None: diff --git a/tests/Droprule.ll.xml b/tests/Droprule.ll.xml index 9eef088..49d3ac4 100644 --- a/tests/Droprule.ll.xml +++ b/tests/Droprule.ll.xml @@ -2,7 +2,7 @@ <doc xmlns:its="http://www.w3.org/2005/11/its" xmlns:itst="http://itstool.org/extensions/" its:version="1.0"> <head> <its:rules version="1.0"> - <itst:dropRule selector="//blanktag"/> + <itst:dropRule selector="//blanktag" drop="yes"/> </its:rules> </head> <content> diff --git a/tests/Droprule.xml b/tests/Droprule.xml index 39a05ea..7c910b4 100644 --- a/tests/Droprule.xml +++ b/tests/Droprule.xml @@ -1,7 +1,7 @@ <doc xmlns:its="http://www.w3.org/2005/11/its" xmlns:itst="http://itstool.org/extensions/" its:version="1.0"> <head> <its:rules version="1.0"> - <itst:dropRule selector="//blanktag"/> + <itst:dropRule selector="//blanktag" drop="yes"/> </its:rules> </head> <content> |