Skip to content
This repository has been archived by the owner on Nov 19, 2020. It is now read-only.

Commit

Permalink
feat: add germanlaw bib entry type
Browse files Browse the repository at this point in the history
  • Loading branch information
skyfrk committed Jun 3, 2020
1 parent c42245c commit b9f123a
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 2 deletions.
4 changes: 4 additions & 0 deletions src/udhbwvst-datamodel.dbx
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
\DeclareDatamodelEntrytypes{germanlaw}
\DeclareDatamodelFields[type=field, datatype=literal]{lawsource,lawsourceyear,lawvolume,lawfirstpage}
\DeclareDatamodelFields[type=field, datatype=date, skipout]{lawdate}
\DeclareDatamodelEntryfields[germanlaw]{lawsource,lawsourceyear,lawvolume,lawfirstpage,lawdate,title,shorttitle,author}
46 changes: 44 additions & 2 deletions src/udhbwvst.cls
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,8 @@
dashed = false,
maxnames = 3,
sorting = nymdt,
sortlocale = de_DE
sortlocale = de_DE,
datamodel = udhbwvst-datamodel
]{biblatex}
\RequirePackage{biblatex-ext-tabular}
\RequirePackage{array}
Expand Down Expand Up @@ -326,11 +327,44 @@
% biblatex package
\addbibresource{\udhbwvst@var@bibfile}

\DeclareLabeldate{%
\field{date}
\field{eventdate}
\field{origdate}
\field{lawdate} % add lawdate
\field{urldate}
\literal{nodate}
}

% \DeclareFieldFormat[germanlaw]{shorttitle}{\normalfont{#1}}
\DeclareFieldFormat[germanlaw]{lawfirstpage}{S.\ \normalfont{#1}}
\DeclareFieldFormat[germanlaw]{lawvolume}{Bd.\ \normalfont{#1}}
\DeclareFieldFormat[germanlaw]{lawdate}{i.d.F.\ vom\ \normalfont{#1}}

\newbibmacro*{germanlawmacro}{
\printfield{title}
\printlawdate
\iffieldundef{lawsource}
{}
{\setunit{\addcomma\addspace}
\printfield{lawsource}}
\iffieldundef{lawsourceyear}
{}
{\setunit{\addspace}
\printfield{lawsourceyear}}
\iffieldundef{lawvolume}
{}
{\setunit{\addspace}
\printfield{lawvolume}}
\setunit{\addcomma\addspace\bibpagespunct}
\printfield{lawfirstpage}
}

\renewcommand{\newunitpunct}{\addcomma\space}
\DeclareDelimFormat{multinamedelim}{\addsemicolon\space}
\DeclareDelimAlias{finalnamedelim}{multinamedelim}
\DeclareNameAlias{sortname}{family-given} % authorlastname, authorfirstname
\DeclareFieldFormat*{shorttitle}{\mkbibparens{#1}}
\DeclareFieldFormat{shorttitle}{\mkbibparens{#1}}
\DeclareFieldFormat{title}{\normalfont{#1}}
\DeclareFieldFormat[article]{title}{\normalfont{#1},}
\DeclareFieldFormat{journaltitle}{\normalfont{#1}}
Expand All @@ -357,6 +391,14 @@
{\end{longtable}}{\anchorlang{\usebibmacro{tabular:sortname}} &
\driver{\usebibmacro{tabular:omitsortname}} \\}

\DeclareBibliographyDriver{germanlaw}{
\usebibmacro{bibindex}
\usebibmacro{begentry}
\usebibmacro{germanlawmacro}
\newunit\newblock
\usebibmacro{finentry}
}

% Sort by Author->Year->Month->Day->Title
\DeclareSortingTemplate{nymdt}{
\sort{
Expand Down

0 comments on commit b9f123a

Please sign in to comment.