소스 검색

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 7 년 전
부모
커밋
99f09eb247
1개의 변경된 파일4개의 추가작업 그리고 0개의 파일을 삭제
  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