Skip to content
This repository has been archived by the owner on Apr 6, 2023. It is now read-only.

<body>tags bleed into main content #105

Open
tjol opened this issue Oct 20, 2018 · 0 comments
Open

<body>tags bleed into main content #105

tjol opened this issue Oct 20, 2018 · 0 comments

Comments

@tjol
Copy link

tjol commented Oct 20, 2018

The <body> tag wrapped around the content when generating a summary (I assume for good reason) also turn up in the content of the post itself, where they don't belong.

This is the change I propose to fix it:

diff --git a/markup.py b/markup.py
index 56aba92..0651f4c 100644
--- a/markup.py
+++ b/markup.py
@@ -117,11 +117,11 @@ class IPythonNB(BaseReader):
             parser = MyHTMLParser(self.settings, filename)
             if isinstance(content, six.binary_type):
                 # unicode_literals makes format() try to decode as ASCII. Enforce decoding as UTF-8.
-                content = '<body>{0}</body>'.format(content.decode("utf-8"))
+                wrapped_content = '<body>{0}</body>'.format(content.decode("utf-8"))
             else:
                 # Content already decoded
-                content = '<body>{0}</body>'.format(content)
-            parser.feed(content)
+                wrapped_content = '<body>{0}</body>'.format(content)
+            parser.feed(wrapped_content)
             parser.close()
             # content = parser.body
             metadata['summary'] = parser.summary
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant