🚧 convert to markdown+mediawiki
This commit is contained in:
parent
729b1dde32
commit
f81b7f1a6a
46 changed files with 1134 additions and 0 deletions
28
3_to_mediawiki.py
Normal file
28
3_to_mediawiki.py
Normal file
|
@ -0,0 +1,28 @@
|
|||
import os
|
||||
import subprocess
|
||||
|
||||
input_dir = "recipes-md"
|
||||
output_dir = "recipes-mediawiki"
|
||||
|
||||
os.makedirs(output_dir, exist_ok=True)
|
||||
|
||||
# Process each markdown file in the input directory
|
||||
for filename in os.listdir(input_dir):
|
||||
if filename.endswith(".md"):
|
||||
input_path = os.path.join(input_dir, filename)
|
||||
output_filename = os.path.splitext(filename)[0] + ".mediawiki"
|
||||
output_path = os.path.join(output_dir, output_filename)
|
||||
|
||||
# Run pandoc command
|
||||
try:
|
||||
subprocess.run([
|
||||
"pandoc",
|
||||
input_path,
|
||||
"-f", "markdown",
|
||||
"-t", "mediawiki",
|
||||
"-o", output_path
|
||||
], check=True)
|
||||
print(f"Converted {filename} to {output_filename}")
|
||||
except subprocess.CalledProcessError as e:
|
||||
print(f"Error converting {filename}: {e}")
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue