-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* compile readme * fix #345 compile readme with script * use direct path
- Loading branch information
Showing
7 changed files
with
628 additions
and
5 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,43 @@ | ||
import os | ||
import shutil | ||
|
||
import typer | ||
|
||
|
||
def post_process(markdown_file: str, original_folder: str, new_folder: str) -> None: | ||
rel_path = "https://raw.githubusercontent.com/livingbio/typed-ffmpeg/main/" + new_folder | ||
|
||
# Move the folder | ||
if os.path.exists(original_folder): | ||
for filepath in os.listdir(original_folder): | ||
# Move the file, replace if it already exists | ||
old_path = os.path.join(original_folder, filepath) | ||
new_path = os.path.join(new_folder, filepath) | ||
if os.path.exists(new_path): | ||
os.remove(new_path) | ||
|
||
shutil.move(old_path, new_path) | ||
print(f"Moved {filepath} to {new_folder}") | ||
|
||
# Update paths in the Markdown file | ||
with open(markdown_file, "r") as file: | ||
content = file.read() | ||
|
||
content = content.replace(original_folder, rel_path) | ||
|
||
with open(markdown_file, "w") as file: | ||
file.write(content) | ||
|
||
print("Image paths updated and folder moved.") | ||
|
||
|
||
def main() -> None: | ||
os.remove("README.md") | ||
os.system("jupyter nbconvert --to markdown README.ipynb") | ||
assert os.path.exists("README.md") | ||
|
||
post_process("README.md", "README_files", "docs/media/README_files") | ||
|
||
|
||
if __name__ == "__main__": | ||
typer.run(main) |