Skip to content

Commit

Permalink
remove hardcode release process
Browse files Browse the repository at this point in the history
  • Loading branch information
zhimin-z committed Oct 30, 2024
1 parent fec6d05 commit 10a07f1
Show file tree
Hide file tree
Showing 7 changed files with 73 additions and 9,899 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
*.bkp
*.venv
.DS_Store
preview.*
3 changes: 2 additions & 1 deletion docs/_sidebar.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@
- 第6章 [一致性](chapter6.md)
- 第7章 [收敛率](chapter7.md)
- 第8章 [遗憾界](chapter8.md)
- [参考文献](reference.md)
- [附录](appendix.md)
- [参考文献](reference.md)
70 changes: 70 additions & 0 deletions release.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
"import os\n",
"import re\n",
"\n",
"# Define the directory where the Markdown files and \"_sidebar.md\" are located\n",
"path_docs = \"docs\" # Replace with the actual directory path\n",
"SIDEBAR_FILE = os.path.join(path_docs, \"_sidebar.md\")\n",
"\n",
"# Extract the file order from \"_sidebar.md\"\n",
"FILES = []\n",
"if os.path.isfile(SIDEBAR_FILE):\n",
" with open(SIDEBAR_FILE, \"r\", encoding=\"utf-8\") as sidebar:\n",
" for line in sidebar:\n",
" # Match the Markdown file path in each line, e.g., \"catalog.md\", \"chapter1.md\"\n",
" match = re.search(r'\\(([^)]+\\.md)\\)', line)\n",
" if match:\n",
" FILES.append(match.group(1))\n",
"else:\n",
" print(f\"Warning: Sidebar file {SIDEBAR_FILE} does not exist.\")\n",
"\n",
"# Merge Markdown file content\n",
"merged_content = \"\"\n",
"for file in FILES:\n",
" file_path = os.path.join(path_docs, file)\n",
" if os.path.isfile(file_path):\n",
" with open(file_path, \"r\", encoding=\"utf-8\") as f:\n",
" merged_content += f.read() + \"\\n\\n\" # Add an empty line as a separator\n",
" else:\n",
" print(f\"Warning: File {file_path} does not exist and will be skipped.\")\n",
"\n",
"path_releases = \"releases\" # Replace with the actual directory path\n",
"if not os.path.exists(path_releases):\n",
" os.makedirs(path_releases)\n",
"\n",
"# Write the merged content to a temporary file\n",
"merged_file = f\"{path_releases}/preview.md\"\n",
"with open(merged_file, \"w\", encoding=\"utf-8\") as f:\n",
" f.write(merged_content)\n"
]
}
],
"metadata": {
"kernelspec": {
"display_name": ".venv",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.12.6"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
4,959 changes: 0 additions & 4,959 deletions releases/preview.html

This file was deleted.

4,871 changes: 0 additions & 4,871 deletions releases/preview.md

This file was deleted.

Binary file removed releases/preview.pdf
Binary file not shown.
68 changes: 0 additions & 68 deletions releases/release.ipynb

This file was deleted.

0 comments on commit 10a07f1

Please sign in to comment.