Benutzer:Dirk Huenniger/wb2pdf/collection
Erscheinungsbild
import re
text=""":[[Blender 3D: Noob to Pro]]
;Unit 1 - Knowing Before Making
:[[Blender 3D: Noob to Pro/Unit 1: Knowing Before Making|Knowing Before Making]]
:[[Blender 3D: Noob to Pro/What Blender Can Do|What Blender Can Do]]
:[[Blender 3D: Noob to Pro/Animation Notes and FAQ|Animation Notes and FAQ]]
:[[Blender 3D: Noob to Pro/Customization|Customization]]
:[[Blender 3D: Noob to Pro/Mist - Make Objects Opaque|Mist - Make Objects Opaque]]"""
def my(x):
x=x.group(0).lstrip(" [:").rstrip("]")
try:
a=("="+x.split("|")[1]+"=\n")
except:
a= "="+x.split("|")[0].strip().strip("[]")+"=\n"
return a +("{{:"+x.split("|")[0].strip().strip("[]")+"}}")
def my3(x):
x=x.group(0).lstrip(";").rstrip("\n")
return "{{PDF-Version Gliederung|"+x+"}}\n"
rr=re.compile(r':\[\[.*?\]\]',re.DOTALL)
text = rr.sub( my,text)
rr=re.compile(r';.*?\n',re.DOTALL)
text = rr.sub( my3,text)
print (text)