Skip to content

etree_to_pipes fails when encountering a comment node #21

Description

@thwarted

pipe 11278a7cb21e7964282dfe9a46f38837

Not sure how this should be handled. The generated python code seems to at least parse and recognize HTML comments as comments, but it doesn't seem to be possible to get the yahoo pipe to do that.

repr(child) is "", and child.tag is , which doesn't have a split function. A simple change to see if child starts with the HTML comment tag opener works around this, but I'm not sure if this is a change that is compatible with the spirit of the rest of the code (should it look for the Comment function here, is there a better way to detect comments? Should they be skipped? Can the Comment function be monkeypatched to provide a split function? Is the .split call actually the best way to do whatever it's trying to do (split on "}" confuses me)?)

diff --git a/util.py b/util.py
index 6696dfd..79bdb3e 100644
--- a/util.py
+++ b/util.py
@@ -57,6 +57,8 @@ def etree_to_pipes(element):
             i['content'] = element.text

         for child in element:
+            if str(child)[0:4] == '<!--':
+                continue
             tag = child.tag.split('}', 1)[-1]

             # process child recursively and append it to parent dict

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions