% uni-wtal-ger.bbx, v 0.2 2013-08-30, Carsten A. Dahlmann (Ace@Dahlmann.net)
% based on authortitle-dw by Dominik Waßenhoven

\ProvidesFile{uni-wtal-ger.bbx}

%% requires authortitle-dw
\RequireBibliographyStyle{authortitle-dw}

%% last name always first
\DeclareNameAlias{sortname}{last-first}

%% titles in italics
\DeclareFieldFormat{title}{\mkbibemph{#1\isdot}}
\DeclareFieldFormat{booktitle}{\mkbibemph{#1\isdot}}
\DeclareFieldFormat{maintitle}{\mkbibemph{#1\isdot}}
\DeclareFieldFormat{journaltitle}{\mkbibemph{#1}}

%% some punctation changes
\renewcommand*{\newunitpunct}{\addperiod\space}
\renewcommand*{\bibpagespunct}{\addperiod\space}
\renewcommand*{\finentrypunct}{\addperiod}

%% set delimiter between names
\renewcommand*{\bibmultinamedelim}{\addspace\slash\space}
\renewcommand*{\bibfinalnamedelim}{\addspace\slash\space}

%% vertical spacing between entrys
\setlength{\bibitemsep}{0.8\baselineskip}

%% change of abbreviations
\DefineBibliographyStrings{german}{%
  and={u\adddot},
  editor={Hg\adddot},
  editors={Hg\adddot},
  byeditor={hg\adddot\thinspace v\adddotspace},
  thiscite={hier\addcolon\thinspace},
  number={H\adddot},
  }

%% quotation marks for article, inbook, ...
\DeclareFieldFormat
  [article,inbook,incollection,inproceedings,patent,thesis,unpublished]
  {title}{\mkbibquote{#1}}

%% idem for inbook, if author the same -- no \midsentence
\renewbibmacro*{bybookauthor}{%
  \ifnamesequal{author}{bookauthor}
    {\ifbool{bbx:edbyidem}
      {\bibstring[\mkidem]{idem\thefield{gender}}\addcolon}
      {\printnames{bookauthor}%
       \newunit\newblock}}
    {\printnames{bookauthor}%
     \newunit\newblock}}

%% magazines: date in brackets, also if volume empty
\renewbibmacro*{journal+issuetitle+afteryear}{%
  \setunit{\addcomma\space}%
  \printfield{eid}%
  \setunit{\addspace}%
  \iffieldundef{volume}
    {\iffieldundef{month}
      {}
      {\setunit{\addspace}}%
     \printtext[parens]{\usebibmacro{issue+date}}%
     \iffieldundef{number}
      {}
      {\setunit*{\addcomma\space\journumstring}%
       \printfield{number}}}%
    {\printtext[parens]{\usebibmacro{issue+date}}%
     \iffieldundef{number}
       {}
       {\setunit*{\journumstring}%
        \printfield{number}}}%
  \newunit\newblock
  \usebibmacro{issue}%
  \newunit
  \usebibmacro{ifuse:byeditor+others}%
  \newunit}

%% load style defaults
\ExecuteBibliographyOptions{
  journalnumber=afteryear,
  idembibformat=dash,
  maxnames=2,
  xref=true,
  bibwarn=false,
}

%\endinput
