From: Ed Ward Date: Thu, 2 Feb 2017 14:06:22 +0000 (+0100) Subject: Changing the filename cleaning regex X-Git-Url: http://shamusworld.gotdns.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fce973004966516334539c70b139d2683c3f4ba7;p=ardour-manual-diverged Changing the filename cleaning regex --- diff --git a/build.py b/build.py index ec09ad6..437ccf4 100755 --- a/build.py +++ b/build.py @@ -23,8 +23,8 @@ import argparse # replaced with dashes. # def MakeFilename(s): - # This RE is shitty, but I can't think of a better one right now - fn = re.sub("[?!'&#:;_*()/\\,.]+", "", 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(' ', '-') return fn @@ -469,4 +469,3 @@ tocFile.close() if not quiet: print('Processed ' + str(fileCount) + ' files.') -