-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
realease 0.1.5 to fix doc in pypi.org
- Loading branch information
Showing
5 changed files
with
65 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
from pathlib import Path | ||
import re | ||
|
||
project_root = Path(__file__).resolve().parent.parent | ||
|
||
|
||
files = [ | ||
project_root / "README.md", | ||
project_root / "docs/usage.md", | ||
project_root / "docs/developer.md", | ||
project_root / "docs/CHANGELOG.md" | ||
] | ||
|
||
output_file = project_root / "CONCATENATED_README.md" | ||
|
||
#Function to delete Table of Contents in CONCATENATED_README.md | ||
def remove_table_of_contents(content_text: str) -> str: | ||
lines = content_text.splitlines() | ||
filtered_lines = [] | ||
|
||
in_table_of_contents = False | ||
|
||
for line in lines: | ||
# Remove the Table of Contents title (e.g., **Table of Contents**) | ||
if "**Table of Contents**" in line: | ||
in_table_of_contents = True | ||
continue | ||
|
||
# Remove items in Table of Contents | ||
if line.strip().startswith("- ["): | ||
continue | ||
|
||
if in_table_of_contents and not line.strip().startswith("-"): | ||
in_table_of_contents = False | ||
|
||
if not in_table_of_contents: | ||
filtered_lines.append(line) | ||
|
||
return "\n".join(filtered_lines) | ||
|
||
with open(output_file, "w", encoding="utf-8") as outfile: | ||
for file in files: | ||
with open(file, "r", encoding="utf-8") as infile: | ||
content = infile.read() | ||
if file.name == "README.md": | ||
content = remove_table_of_contents(content) # Remove Table of Contents | ||
outfile.write(content + "\n\n") # Add spacing between files |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters