Browse Source

Corrected inversion between first and last name, or article and main title

pull/58/head
Louis 10 years ago
parent
commit
616657acef
  1. 18
      patacrep/data/latex/patacrep.sty
  2. 15
      patacrep/index.py

18
patacrep/data/latex/patacrep.sty

@ -407,11 +407,25 @@
% Usage: \indexauthor{First name}{Last name}
% Example: \indexauthor{Edgar Allan}{Poe}
\newcommand{\indexauthor}[2]{#2, #1}
% First name can be empty.
\newcommand{\indexauthor}[2]{%
\IfStrEq{#1}{}{%
#2%
}{%
#2, #1%
}%
}
% Usage: \indextitle{Article}{Main part}
% Example: \indextitle{The}{Raven}
\newcommand{\indextitle}[2]{#2 (#1)}
% Article can be empty
\newcommand{\indextitle}[2]{%
\IfStrEq{#1}{}{%
#2%
}{%
#2 (#1)%
}%
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

15
patacrep/index.py

@ -128,8 +128,8 @@ class Index(object):
if match:
self._raw_add(
(
(match.group(2) + match.group(3)).strip(),
match.group(1).strip(),
(match.group(2) + match.group(3)).strip()
),
number,
link
@ -154,16 +154,13 @@ class Index(object):
"""
if self.indextype == "AUTHOR":
if key[1]:
return ur"\indexauthor{{{first}}}{{{last}}}".format(
first=key[1],
last=key[0],
)
else:
return key[0]
return ur"\indexauthor{{{first}}}{{{last}}}".format(
first=key[1],
last=key[0],
)
if self.indextype == "TITLE":
return ur"\indextitle{{{0[0]}}}{{{0[1]}}}".format(key)
return ur"\indextitle{{{0[1]}}}{{{0[0]}}}".format(key)
def entry_to_str(self, key, entry):
"""Return the LaTeX code corresponding to the entry."""

Loading…
Cancel
Save