import shutil
lineCount = 0
+cleanString = re.compile(r'[^a-zA-Z0-9 \._-]+')
#
# replaced with dashes.
#
def MakeFilename(s):
- # Cleans up the file name, removing all non ASCII or .-_ chars
- fn = re.sub(r'[^.\-_a-zA-Z0-9 ]', '', s)
- fn = fn.lower()
- fn = fn.replace(' ', '-')
+ global cleanString
+ # Clean up the file name, removing all non letter/number or " .-_" chars.
+ # Also, convert to lower case and replace all spaces with dashes.
+ fn = cleanString.sub('', s).lower().replace(' ', '-')
+ # Double dashes can creep in from the above replacement, so we check for
+ # that here.
+ fn = fn.replace('--', '-')
+
return fn
if 'menu_title' in header:
explode.write('menu_title: ' + header['menu_title'] + '\n')
- if 'link' in header:
- explode.write('link: ' + header['link'] + '\n')
-
if 'style' in header:
explode.write('style: ' + header['style'] + '\n')
explode.write('include: ' + inclFile + '\n')
filenames.append(inclFile)
+ if 'link' in header:
+ explode.write('link: ' + header['link'] + '\n')
+
+ if 'uri' in header:
+ explode.write('uri: ' + header['uri'] + '\n')
+
explode.write('part: ' + header['part'] + '\n' + '---\n')
# Only parts have no content...