From 3dc57b87f5d88bdb9c5b86e12739454f6e62cf01 Mon Sep 17 00:00:00 2001
From: Dnomd343
Date: Sat, 18 Mar 2023 00:11:56 +0800
Subject: [PATCH] feat: standard html format
---
src/release/release.py | 4 ++--
src/release/utils/sequence.py | 27 +++++++++++++--------------
2 files changed, 15 insertions(+), 16 deletions(-)
diff --git a/src/release/release.py b/src/release/release.py
index 93962a2..94cd6ed 100755
--- a/src/release/release.py
+++ b/src/release/release.py
@@ -13,6 +13,6 @@ metadata, content = loadBook('rc-5')
# txtRelease(metadata, content)
# jsonRelease(metadata, content)
-# htmlRelease(metadata, content)
-staticRelease(metadata, content)
+htmlRelease(metadata, content)
+# staticRelease(metadata, content)
# gitbookRelease(metadata, content)
diff --git a/src/release/utils/sequence.py b/src/release/utils/sequence.py
index 0b7094b..688f787 100644
--- a/src/release/utils/sequence.py
+++ b/src/release/utils/sequence.py
@@ -40,21 +40,20 @@ def txtSerialize(metadata: dict, content: dict) -> str:
return '\n\n\n'.join(result) + '\n'
-def htmlMetadata(metadata: dict) -> str: # html metadata
- return '%s
\n' % metadata['name'] + '\n'.join(
- ['
%s
' % x for x in metadata['desc']] - ) - - def htmlSerialize(metadata: dict, content: dict) -> str: - result = [htmlMetadata(metadata)] - for (title, chapter) in content.items(): - result.append( - '%s
' % x for x in chapter] - ) - ) - return '\n\n'.join(result) + '\n' + htmlContent = [ + '', + '', + '', '%s
' % x for x in metadata['desc']] + for (caption, chapter) in content.items(): + htmlContent.append('%s
' % x for x in chapter])) + htmlContent += ['', ''] + return '\n'.join(htmlContent) + '\n' def gitbookMetadata(metadata: dict) -> str: