Skip to content
Snippets Groups Projects
Commit 6d4d87f1 authored by Lukáš Krupčík's avatar Lukáš Krupčík
Browse files

modified: scripts/maketitle.py

parent 0e31f6bc
No related branches found
No related tags found
1 merge request!486new file: content/docs/anselm/compute-nodes.mdx
...@@ -41,7 +41,7 @@ def process_md_file(md_path): ...@@ -41,7 +41,7 @@ def process_md_file(md_path):
if match: if match:
title = match.group(1).strip() title = match.group(1).strip()
frontmatter = f'---\ntitle: "{title}"\n---\n' frontmatter = f'---\ntitle: "{title}"\n---\n'
# Construct new content with frontmatter at beginning # Construct new content with frontmatter at beginning
before_h1 = content[:match.start()].lstrip('\n') before_h1 = content[:match.start()].lstrip('\n')
after_h1 = content[match.end():].lstrip('\n') after_h1 = content[match.end():].lstrip('\n')
...@@ -63,7 +63,7 @@ def process_md_file(md_path): ...@@ -63,7 +63,7 @@ def process_md_file(md_path):
mdx_path = md_path.with_suffix('.mdx') mdx_path = md_path.with_suffix('.mdx')
with open(mdx_path, 'w', encoding='utf-8') as file_handle: with open(mdx_path, 'w', encoding='utf-8') as file_handle:
file_handle.write(new_content) file_handle.write(new_content)
# Remove original MD file # Remove original MD file
md_path.unlink() md_path.unlink()
print(f"Converted {md_path} to {mdx_path}") print(f"Converted {md_path} to {mdx_path}")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment