Files
@ 1b0060f6b80f
Branch filter:
Location: kallithea/scripts/source_format.py - annotation
1b0060f6b80f
701 B
text/x-python
i18n: fr: consistently use 'NO-BREAK SPACE' before double punctuation instead of 'NARROW NO-BREAK SPACE'
Pretty much like https://docs.weblate.org/en/latest/user/checks.html#punctuation-spacing .
Trust https://wiki.openoffice.org/wiki/Non_Breaking_Spaces_Before_Punctuation_In_French_(espaces_ins%C3%A9cables) and don't use NARROW.
Pretty much like https://docs.weblate.org/en/latest/user/checks.html#punctuation-spacing .
Trust https://wiki.openoffice.org/wiki/Non_Breaking_Spaces_Before_Punctuation_In_French_(espaces_ins%C3%A9cables) and don't use NARROW.
f8971422795e f8971422795e f8971422795e f8971422795e f8971422795e f8971422795e f8971422795e f8971422795e f8971422795e f8971422795e f8971422795e f8971422795e f8971422795e f8971422795e f8971422795e f8971422795e f8971422795e f8971422795e f8971422795e f8971422795e f8971422795e f8971422795e f8971422795e f8971422795e | #!/usr/bin/env python3
# hg files 'set:!binary()&grep("^#!.*python")' 'set:**.py' | xargs scripts/source_format.py
import re
import sys
filenames = sys.argv[1:]
for fn in filenames:
with open(fn) as f:
org_content = f.read()
mod_name = fn[:-3] if fn.endswith('.py') else fn
mod_name = mod_name[:-9] if mod_name.endswith('/__init__') else mod_name
mod_name = mod_name.replace('/', '.')
def f(m):
return '"""\n%s\n%s\n' % (mod_name, '~' * len(mod_name))
new_content = re.sub(r'^"""\n(kallithea\..*\n)(~+\n)?', f, org_content, count=1, flags=re.MULTILINE)
if new_content != org_content:
with open(fn, 'w') as f:
f.write(new_content)
|