diff --git a/Code2pdf/code2pdf.py b/Code2pdf/code2pdf.py index b2db891..c4ac894 100755 --- a/Code2pdf/code2pdf.py +++ b/Code2pdf/code2pdf.py @@ -7,6 +7,7 @@ import os import re import sys +from pathlib import Path try: import pygments @@ -71,7 +72,14 @@ def highlight_file(self, linenos=True, style='default'): logging.error(fmt.format(self.input_file, exread)) sys.exit(2) - return pygments.highlight(content, lexer, formatter) + # use file name as title + doc_html = pygments.highlight(content, lexer, formatter) + file_name = Path(self.input_file).name + title_tag = "