Преглед изворни кода

Skip static content for toc extraction

bas smit пре 12 година
родитељ
комит
e07dac8799
1 измењених фајлова са 3 додато и 1 уклоњено
  1. 3 1
      extract_toc/extract_toc.py

+ 3 - 1
extract_toc/extract_toc.py

@@ -8,10 +8,12 @@ and place it in its own article.toc variable.
 
 from os import path
 from bs4 import BeautifulSoup
-from pelican import signals, readers
+from pelican import signals, readers, contents
 
 
 def extract_toc(content):
+    if isinstance(content, contents.Static):
+        return
     soup = BeautifulSoup(content._content)
     filename = content.source_path
     extension = path.splitext(filename)[1][1:]