diff options
-rwxr-xr-x | licenses/03-cleanup-cc-html-files.py | 8 | ||||
-rw-r--r-- | licenses/license_utils.py | 10 |
2 files changed, 12 insertions, 6 deletions
diff --git a/licenses/03-cleanup-cc-html-files.py b/licenses/03-cleanup-cc-html-files.py index 80f93cd..c81ca7d 100755 --- a/licenses/03-cleanup-cc-html-files.py +++ b/licenses/03-cleanup-cc-html-files.py @@ -5,6 +5,8 @@ import os import re import sys +from license_utils import rewrite_attr + def main(argv): langs = ['C', 'ar', 'es', 'fr', 'pt_BR'] @@ -118,12 +120,6 @@ def cleanup_deed_file(src_dir, license, lang): f.write(html) f.close() -def rewrite_attr(html, elem, attr, source, target): - for element in html.findAll(elem): - if element.has_key(attr): - attr_val = re.sub(source, target, element[attr]) - element[attr] = attr_val - def cleanup_conditional_comments(html): comments = html.findAll(text=lambda text:isinstance(text, Comment) and '[if' in text) for comment in comments: diff --git a/licenses/license_utils.py b/licenses/license_utils.py new file mode 100644 index 0000000..bb4479d --- /dev/null +++ b/licenses/license_utils.py @@ -0,0 +1,10 @@ +#!/usr/bin/env python + +import re + +def rewrite_attr(html, elem, attr, source, target): + for element in html.findAll(elem): + if element.has_key(attr): + attr_val = re.sub(source, target, element[attr]) + element[attr] = attr_val + |