doc: extract: further cleanups

feature/tap-sh
William Pitcock 2016-12-10 18:09:30 -06:00
parent 9075102431
commit 9640592a1d
1 changed files with 12 additions and 1 deletions

View File

@ -21,8 +21,17 @@ class Comment:
for line in lines: for line in lines:
if line[0:3] == ' * ': if line[0:3] == ' * ':
cleanlines.append(line[3:]) cleanlines.append(line[3:])
elif len(line) == 2:
cleanlines.append('')
return '\n'.join(cleanlines) return '\n'.join(cleanlines)
@property
def doc_text(self):
text = self.clean_text
if '!doc' in text[0:4]:
return text[5:]
return None
class FileError(Exception): class FileError(Exception):
pass pass
@ -135,4 +144,6 @@ if __name__ == '__main__':
import sys import sys
from pprint import pprint from pprint import pprint
pprint([c.clean_text for c in extract_comments(sys.argv[1])]) comments = [comment for comment in extract_comments(sys.argv[1]) if comment.doc_text]
for comment in comments:
print(comment.doc_text)