Browse Source

update: online directory structure

master
Dnomd343 2 years ago
parent
commit
139c7b1db3
  1. 10
      src/release/release.py
  2. 4
      src/release/utils/release.py
  3. 2
      src/release/utils/sequence.py

10
src/release/release.py

@ -11,8 +11,8 @@ from utils import gitbookRelease
metadata, content = loadBook('rc-5')
# txtRelease(metadata, content)
# jsonRelease(metadata, content)
# htmlRelease(metadata, content)
staticRelease(metadata, content)
# gitbookRelease(metadata, content)
txtRelease(metadata, content)
jsonRelease(metadata, content)
htmlRelease(metadata, content)
# staticRelease(metadata, content)
gitbookRelease(metadata, content)

4
src/release/utils/release.py

@ -38,7 +38,7 @@ def htmlRelease(metadata: dict, content: dict) -> None:
def gitbookRelease(metadata: dict, content: dict) -> None:
createFolder(releaseInfo['gitbook'])
createFolder(os.path.join(releaseInfo['gitbook'], './assets/'))
createFolder(os.path.join(releaseInfo['gitbook'], './content/'))
createFolder(os.path.join(releaseInfo['gitbook'], './chapter/'))
cover = gitbookMetadata(metadata)
for (resName, resUrls) in resourceInfo.items():
@ -59,7 +59,7 @@ def gitbookRelease(metadata: dict, content: dict) -> None:
def staticDepends(workDir: str, metadata: dict, content: dict) -> None:
createFolder(os.path.join(workDir, './assets/'))
createFolder(os.path.join(workDir, './content/'))
createFolder(os.path.join(workDir, './chapter/'))
cover = gitbookMetadata(metadata) + '<hr/>\n'
for (resName, resUrls) in resourceInfo.items():

2
src/release/utils/sequence.py

@ -68,7 +68,7 @@ def gitbookMetadata(metadata: dict) -> str:
def gitbookChapterPath(caption: str) -> str:
chapterNum = re.search(r'^第(\d+)章', caption)[1] # match chapter number
chapterNum = '0' * (3 - len(chapterNum)) + chapterNum # add `0` prefix
return os.path.join('content', 'chapter-%s.md' % chapterNum)
return os.path.join('chapter', '%s.md' % chapterNum)
def gitbookSummary(chapters: dict) -> str:

Loading…
Cancel
Save