Commits

Anonymous committed 0651e96

Added basic support for e-* parsing, simple test.

Comments (0)

Files changed (3)

                         prop_name = prop[2:]
                         prop_value = props.get(prop_name, [])
                         
-                        
+                        prop_value.append({
+                            'html': ''.join([e.toxml() for e in el.childNodes]),
+                            'value': el.getText()
+                        })
                         
                         props[prop_name] = prop_value
             

test/examples/embedded.html

+<!DOCTYPE html>
+<html>
+<head>
+  <meta http-equiv="content-type" content="text/html; charset=utf-8">
+  <title>Hello World</title>
+</head>
+<body>
+ <div class="h-entry">
+  <h1 class="p-name">A post with embedded markup in</h1>
+  
+  <div class="e-content">
+   <p>Blah blah blah blah blah.</p>
+   <p>Blah.</p>
+   <p>Blah blah blah.</p>
+  </div>
+ </div>
+</body>
+</html>

test/test_parser.py

     assert result["items"][0]["properties"]["updated"][0] == "2011-08-26T00:01:21+00:00"
     assert result["items"][0]["properties"]["updated"][1] == "2011-08-26T00:01:21+00:00"
 
+def test_embedded_parsing():
+    result = parse_fixture("embedded.html")
+    pprint(result)
+    assert result["items"][0]["properties"]["content"][0]["html"] == '\n   <p>Blah blah blah blah blah.</p>\n   <p>Blah.</p>\n   <p>Blah blah blah.</p>\n  '
+    assert result["items"][0]["properties"]["content"][0]["value"] == '\n   Blah blah blah blah blah.\n   Blah.\n   Blah blah blah.\n  '
+
 def test_backcompat():
     result = parse_fixture("backcompat.html")
     assert set(result["items"][0]["type"]) == set(["h-card"])