X-Git-Url: http://shamusworld.gotdns.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=explode.py;h=60eb198c0a0407cc6a622f73c24249b5777d7035;hb=fee0fcbbbd36df8b64deac6c6f277f3e2243f622;hp=5506e90bab67178b4ab8aeb13d44966438347e4f;hpb=0e127ce41d7120d505f3aa9ae18dce679f403a3f;p=ardour-manual diff --git a/explode.py b/explode.py index 5506e90..60eb198 100755 --- a/explode.py +++ b/explode.py @@ -12,6 +12,7 @@ import re import shutil lineCount = 0 +cleanString = re.compile(r'[^a-zA-Z0-9 \._-]+') # @@ -19,10 +20,14 @@ lineCount = 0 # 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 @@ -111,9 +116,6 @@ for line in master: 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') @@ -126,6 +128,9 @@ for line in master: 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')