Browse Source

It is now possible to decide how authors and titles are rendered in the indexes

J'avais proposé cela il y a longtemps
http://www.patacrep.com/forum/viewtopic.php?pid=669#p669
Mais cela a dû être perdu au cours des merge, branches, etc.
pull/54/head
Louis 10 years ago
parent
commit
38b3b2a06d
  1. 8
      patacrep/authors.py
  2. 13
      patacrep/data/latex/patacrep.sty
  3. 6
      patacrep/index.py

8
patacrep/authors.py

@ -168,10 +168,10 @@ def processauthors_invert_names(authors_list):
for author in authors_list:
first, last = split_author_names(author)
if first:
dest.append("%(last)s, %(first)s" % {
'first': first.lstrip(),
'last': last.lstrip(),
})
dest.append(r"\indexauthor{{{first}}}{{{last}}}".format(
first=first.strip(),
last=last.strip(),
))
else:
dest.append(last.lstrip())
return dest

13
patacrep/data/latex/patacrep.sty

@ -402,4 +402,17 @@
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Title and author rendering in the index
% Usage: \indexauthor{First name}{Last name}
% Example: \indexauthor{Edgar Allan}{Poe}
\newcommand{\indexauthor}[2]{#2, #1}
% Usage: \indextitle{Article}{Main part}
% Example: \indextitle{The}{Raven}
\newcommand{\indextitle}[2]{#2 (#1)}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\endinput

6
patacrep/index.py

@ -128,9 +128,9 @@ class Index(object):
match = pattern.match(key.encode('utf-8'))
if match:
self._raw_add(
"{} ({})".format(
match.group(2) + match.group(3),
match.group(1)
r"\indextitle{{{}}}{{{}}}".format(
match.group(1).strip(),
(match.group(2) + match.group(3)).strip(),
),
number,
link

Loading…
Cancel
Save