Browse Source

Merge branch 'master' into latex_special

pull/213/head
Louis 9 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 {
'ignore': authwords.get('ignore', []),
'after': [
re.compile(RE_AFTER.format(word), re.LOCALE)
re.compile(RE_AFTER.format(word))
for word in authwords.get('after')
],
'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']] + [',', ';'])
],
}

7
patacrep/index.py

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

Loading…
Cancel
Save