Tutoriels/mumble/preprocess.py

17 lines
440 B
Python
Executable File

#! /usr/bin/env python3
import sys
import re
base_url = "https://gitea.planet-casio.com/Lephenixnoir/Tutoriels/mumble/"
if len(sys.argv) > 1:
print("warning: this script takes no arguments -- ignoring",
file=sys.stderr)
with open("utilisation-mumble.txt", "r") as fp:
t = fp.read()
t = re.sub(r'^#[^\n]*[\n]+', "", t, count=1)
t = re.sub(r'\[img\]([^[:]+)\[/img\]', "[img]"+base_url+"\\1[/img]", t)
print(t)