Browse Source

Merge branch 'master' into latex_special

pull/213/head
Louis 8 years ago
parent
commit
7ab42df331
  1. 4
      patacrep/authors.py
  2. 7
      patacrep/index.py
  3. 2
      patacrep/songs/__init__.py

4
patacrep/authors.py

@ -16,11 +16,11 @@ def compile_authwords(authwords):
return { return {
'ignore': authwords.get('ignore', []), 'ignore': authwords.get('ignore', []),
'after': [ 'after': [
re.compile(RE_AFTER.format(word), re.LOCALE) re.compile(RE_AFTER.format(word))
for word in authwords.get('after') for word in authwords.get('after')
], ],
'separators': [ 'separators': [
re.compile(RE_SEPARATOR.format(word), re.LOCALE) re.compile(RE_SEPARATOR.format(word))
for word in ([" %s" % word for word in authwords['separators']] + [',', ';']) for word in ([" %s" % word for word in authwords['separators']] + [',', ';'])
], ],
} }

7
patacrep/index.py

@ -16,8 +16,8 @@ from patacrep.latex import tex2plain
EOL = "\n" EOL = "\n"
# Pattern set to ignore latex command in title prefix # Pattern set to ignore latex command in title prefix
KEYWORD_PATTERN = re.compile(r"^%(\w+)\s?(.*)$", re.LOCALE) KEYWORD_PATTERN = re.compile(r"^%(\w+)\s?(.*)$")
FIRST_LETTER_PATTERN = re.compile(r"^(?:\{?\\\w+\}?)*[^\w]*(\w)", re.LOCALE) FIRST_LETTER_PATTERN = re.compile(r"^(?:\{?\\\w+\}?)*[^\w]*(\w)")
def process_sxd(filename): def process_sxd(filename):
"""Parse sxd file. """Parse sxd file.
@ -90,8 +90,7 @@ class Index:
if 'prefix' in self.keywords: if 'prefix' in self.keywords:
for prefix in self.keywords['prefix']: for prefix in self.keywords['prefix']:
self.prefix_patterns.append(re.compile( self.prefix_patterns.append(re.compile(
r"^({prefix})(\b|\\)(\s*.*)$".format(prefix=prefix), r"^({prefix})(\b|\\)(\s*.*)$".format(prefix=prefix)
re.LOCALE
)) ))
if self.indextype == "AUTHOR": if self.indextype == "AUTHOR":

2
patacrep/songs/__init__.py

@ -294,7 +294,7 @@ def unprefixed_title(title, prefixes):
"""Remove the first prefix of the list in the beginning of title (if any). """Remove the first prefix of the list in the beginning of title (if any).
""" """
for prefix in prefixes: for prefix in prefixes:
match = re.compile(r"^(%s)\b\s*(.*)$" % prefix, re.LOCALE).match(title) match = re.compile(r"^(%s)\b\s*(.*)$" % prefix).match(title)
if match: if match:
return match.group(2) return match.group(2)
return title return title

Loading…
Cancel
Save