def before_process_document(self, document):
"""Initialize ANSI colors if color is True or 'auto'.
If color=='auto', detect if sys.stdout is interactive
(terminal, not redirected to a file).
"""
super().before_process_document(document)
if self.color == 'auto':
self.color = sys.stdout.isatty()
if self.color:
colorama.init()
if self.print_doc_meta:
for key, value in sorted(document.meta.items()):
print('%s = %s' % (key, value))
评论列表
文章目录