소스 검색

Merge pull request #350 from jedbrown/jed/fix-extract-toc-markdown

extract_toc: fix markdown case when toc not found
Justin Mayer 10 년 전
부모
커밋
c4c424ee7f
1개의 변경된 파일1개의 추가작업 그리고 1개의 파일을 삭제
  1. 1 1
      extract_toc/extract_toc.py

+ 1 - 1
extract_toc/extract_toc.py

@@ -23,7 +23,7 @@ def extract_toc(content):
     # if it is a Markdown file
     if extension in readers.MarkdownReader.file_extensions:
         toc = soup.find('div', class_='toc')
-        toc.extract()
+        if toc: toc.extract()
     # else if it is a reST file
     elif extension in readers.RstReader.file_extensions:
         toc = soup.find('div', class_='contents topic')