diff --git a/src/release/to_html.py b/src/release/calibre_html.py old mode 100644 new mode 100755 similarity index 63% rename from src/release/to_html.py rename to src/release/calibre_html.py index 89f5fbc..6fea4a1 --- a/src/release/to_html.py +++ b/src/release/calibre_html.py @@ -3,6 +3,9 @@ import sys from common import loadData +from common import saveFile + +htmlFile = 'xxrs.html' def formatMetadata(metadata: dict) -> str: @@ -11,19 +14,15 @@ def formatMetadata(metadata: dict) -> str: ) -def formatChapter(caption: str, content: list) -> str: - return '
%s
' % x for x in content]) - - def htmlRelease(metadata: dict, content: dict) -> str: result = [formatMetadata(metadata)] for (title, chapter) in content.items(): result.append( - formatChapter(title, chapter) + '%s
' % x for x in chapter]) ) - return '\n\n'.join(result) + return '\n\n'.join(result) + '\n' if __name__ == '__main__': data = loadData(sys.argv[1]) - print(htmlRelease(data['metadata'], data['content'])) + saveFile(htmlFile, htmlRelease(data['metadata'], data['content']))