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

update markdown function to modify articles

parent 36321986
No related branches found
No related tags found
No related merge requests found
Pipeline #127626 waiting for manual action with stages
in 6 minutes and 34 seconds
......@@ -506,16 +506,46 @@ def markdown(
# with open(dst, "w") as tmp_f:
dst = Path(tmp_path)
dst.write_bytes(file.read_bytes())
# check if article has ## Structure, ## Experimental Validation, ## Distribution of the system among prokaryotes
with open(dst, "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,
)
with open(file, "w") as f_out:
f_out.write(new_f)
all_file = f.read()
if (
re.search(
r"#{2}\s+Structure",
all_file,
flags=re.IGNORECASE | re.MULTILINE,
)
and re.search(
r"#{2}\s+Experimental\s+validation",
all_file,
flags=re.IGNORECASE | re.MULTILINE,
)
and re.search(
r"#{2}\s+Distribution\s+of\s+the\s+system\s+among\s+prokaryotes",
all_file,
flags=re.IGNORECASE | re.MULTILINE,
)
):
new_f_str = re.sub(
r"#{2}\s+Structure.*?#{2}\s+Experimental\s+validation",
"## Structure\n\n### pDockQ matrix\n\n::pdockq-matrix\n::\n\n### List predicted structures\n\n::article-structure\n::\n\n## Experimental validation",
all_file,
flags=re.DOTALL | re.IGNORECASE,
)
new_f = re.sub(
r"#{2}\s+Distribution\s+of\s+the\s+system\s+among\s+prokaryotes.*?#{2}\s+Structure",
"## Distribution of the system among prokaryotes\n\n::article-system-distribution-plot\n::\n\n## Structure",
new_f_str,
flags=re.DOTALL | re.IGNORECASE,
)
with open(file, "w") as f_out:
f_out.write(new_f)
else:
console.log(f"[bold red]check it manually")
def remove_version(assembly):
......
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