Skip to content
Snippets Groups Projects
Commit 1204fe6e authored by Remi  PLANEL's avatar Remi PLANEL
Browse files

add command to modify markdown

parent 7ca60365
No related branches found
No related tags found
3 merge requests!229Draft: Modify all articles with article struct,!228Uniq molstar plugin per page,!226Resolve "Design of the structure section in a system's page"
Pipeline #127261 waiting for manual action with stages
in 6 minutes and 29 seconds
...@@ -413,6 +413,45 @@ def refseq_type_count( ...@@ -413,6 +413,45 @@ def refseq_type_count(
grouped_per_type.reset_index().to_csv(output, index=False) grouped_per_type.reset_index().to_csv(output, index=False)
@app.command()
def markdown(
dir: Annotated[
Path,
typer.Option(
exists=True,
file_okay=False,
writable=True,
readable=True,
resolve_path=True,
help="Dir where all systems article are",
),
],
# output: Annotated[
# Path,
# typer.Option(
# file_okay=True,
# dir_okay=False,
# writable=True,
# resolve_path=True,
# ),
# ],
):
for file in dir.iterdir():
if file.suffix == ".md":
console.rule(f"[bold blue]{file.name}", style="blue")
with open(file, "r+") as f:
new_f = re.sub(
r"##\s+Structure\n.+##\s+Experimental\s+validation",
"## Structure\n\n::article-structure\n::\n\n## Experimental validation",
f.read(),
flags=re.DOTALL,
)
f.seek(0, 0)
f.write(new_f)
def remove_version(assembly): def remove_version(assembly):
return assembly.split(".")[0] return assembly.split(".")[0]
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment