# Path: patacrep/authors.py
# LOGGER = logging.getLogger(__name__)
# RE_AFTER = r"^.*\b{}\b(.*)$"
# RE_SEPARATOR = r"^(.*)\b *{} *(\b.*)?$"
# def compile_authwords(authwords):
# def split_author_names(string):
# def split_sep_author(string, separators):
# def processauthors_removeparen(authors_string):
# def processauthors_split_string(authors_string, separators):
# def processauthors_remove_after(authors_list, after):
# def processauthors_ignore_authors(authors_list, ignore):
# def processauthors_clean_authors(authors_list):
# def processauthors(authors_string, after=None, ignore=None, separators=None):
# def process_listauthors(authors_list, after=None, ignore=None, separators=None):
# 
# Path: patacrep/encoding.py
# LOGGER = logging.getLogger(__name__)
# def open_read(filename, mode='r', encoding=None):
# def detect_encoding(filename):
# 
# Path: patacrep/latex/syntax.py
# def tex2plain(string):
#     """Parse string and return its plain text version."""
#     return detex(
#         latex_yacc().parse(
#             string,
#             lexer=SimpleLexer().lexer,
#             )
#         )
# 
# Path: patacrep/utils.py
# def normalize_string(string):
#     """Return a normalized string.
# 
#     Normalized means:
#     - no surrounding spaces;
#     - lower case;
#     - passed through unidecode.unidecode().
#     """
#     return unidecode.unidecode(string.lower().strip())


import locale
import re
from patacrep import authors
from patacrep import encoding
from patacrep.latex import tex2plain
from patacrep.utils import normalize_string
                    normalize_string(tex2plain(item))
                    for item in key
                    ],
                'entries': [],
                }
        self.data[first][key]['entries'].append({'num': number, 'link': link})

    def add(self, key, number, link):
        """Add a song to the list.

        Process data before adding it.
        """
        if self.indextype == "TITLE":
            # Removing prefixes before titles
            for pattern in self.prefix_patterns:
                match = pattern.match(key)
                if match:
                    self._raw_add(
                        (
                            (match.group(2) + match.group(3)).strip(),
                            match.group(1).strip(),
                        ),
                        number,
                        link
                        )
                    return
            self._raw_add((key, ""), number, link)

        if self.indextype == "AUTHOR":
            # Processing authors

# Path: patacrep/authors.py
# LOGGER = logging.getLogger(__name__)
# RE_AFTER = r"^.*\b{}\b(.*)$"
# RE_SEPARATOR = r"^(.*)\b *{} *(\b.*)?$"
# def compile_authwords(authwords):
# def split_author_names(string):
# def split_sep_author(string, separators):
# def processauthors_removeparen(authors_string):
# def processauthors_split_string(authors_string, separators):
# def processauthors_remove_after(authors_list, after):
# def processauthors_ignore_authors(authors_list, ignore):
# def processauthors_clean_authors(authors_list):
# def processauthors(authors_string, after=None, ignore=None, separators=None):
# def process_listauthors(authors_list, after=None, ignore=None, separators=None):
# 
# Path: patacrep/encoding.py
# LOGGER = logging.getLogger(__name__)
# def open_read(filename, mode='r', encoding=None):
# def detect_encoding(filename):
# 
# Path: patacrep/latex/syntax.py
# def tex2plain(string):
#     """Parse string and return its plain text version."""
#     return detex(
#         latex_yacc().parse(
#             string,
#             lexer=SimpleLexer().lexer,
#             )
#         )
# 
# Path: patacrep/utils.py
# def normalize_string(string):
#     """Return a normalized string.
# 
#     Normalized means:
#     - no surrounding spaces;
#     - lower case;
#     - passed through unidecode.unidecode().
#     """
#     return unidecode.unidecode(string.lower().strip())


# Path: patacrep/index.py
import locale
import re
from patacrep import authors
from patacrep import encoding
from patacrep.latex import tex2plain
from patacrep.utils import normalize_string

                    normalize_string(tex2plain(item))
                    for item in key
                    ],
                'entries': [],
                }
        self.data[first][key]['entries'].append({'num': number, 'link': link})

    def add(self, key, number, link):
        """Add a song to the list.

        Process data before adding it.
        """
        if self.indextype == "TITLE":
            # Removing prefixes before titles
            for pattern in self.prefix_patterns:
                match = pattern.match(key)
                if match:
                    self._raw_add(
                        (
                            (match.group(2) + match.group(3)).strip(),
                            match.group(1).strip(),
                        ),
                        number,
                        link
                        )
                    return
            self._raw_add((key, ""), number, link)

        if self.indextype == "AUTHOR":
            # Processing authors

            for author in authors.processauthors(