Explorar el Código

Clean div tags from summary

There are some open div tags in the summary if you're using rst and headings. This will remove these tags from the summary.
Geert Braekmans hace 7 años
padre
commit
99f09eb247
Se han modificado 1 ficheros con 4 adiciones y 0 borrados
  1. 4 0
      summary/summary.py

+ 4 - 0
summary/summary.py

@@ -9,6 +9,7 @@ body of your articles.
 from __future__ import unicode_literals
 from pelican import signals
 from pelican.generators import ArticlesGenerator, StaticGenerator, PagesGenerator
+import re
 
 def initialized(pelican):
     from pelican.settings import DEFAULT_CONFIG
@@ -76,6 +77,9 @@ def extract_summary(instance):
         if end_summary:
             content = content.replace(end_marker, '', 1)
 
+    summary = re.sub(r"<div.*>", "", summary)
+    summary = re.sub(r"</div>", "", summary)
+
     instance._content = content
     instance._summary = summary
     instance.has_summary = True