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 11 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: for author in authors_list:
first, last = split_author_names(author) first, last = split_author_names(author)
if first: if first:
dest.append("%(last)s, %(first)s" % { dest.append(r"\indexauthor{{{first}}}{{{last}}}".format(
'first': first.lstrip(), first=first.strip(),
'last': last.lstrip(), last=last.strip(),
}) ))
else: else:
dest.append(last.lstrip()) dest.append(last.lstrip())
return dest 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 \endinput

6
patacrep/index.py

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

Loading…
Cancel
Save