Fixed terrain2wiki script not working with certain comments

The script errored if a comment not starting at the start of the line was found in the cfg file.
This commit is contained in:
Elvish_Hunter 2016-06-21 22:23:10 +02:00
parent d80c80a50f
commit fccd419429

View file

@ -38,8 +38,8 @@ def parse_terrain(data):
"""
# Remove all comments.
data = "\n".join([i for i in data.split("\n") if not i.startswith("#")])
terrains = re.compile("\[terrain_type\](.*?)\[\/terrain_type\]", re.DOTALL).findall(data)
data = "\n".join([i for i in data.split("\n") if not re.match("^\s*#", i)])
terrains = re.compile(r"\[terrain_type\](.*?)\[\/terrain_type\]", re.DOTALL).findall(data)
data = """{{AutogeneratedWML}}{| border="1"
!terrain