From 481cae7ce356520aa9a38c2dcec214404ea63cc5 Mon Sep 17 00:00:00 2001 From: adin Date: Sun, 9 Sep 2018 21:41:07 -0300 Subject: [PATCH] Allow date on projects. Fix for #3. --- cv.bbx | 53 +++++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 39 insertions(+), 14 deletions(-) diff --git a/cv.bbx b/cv.bbx index 417ab19..d4f5dd0 100644 --- a/cv.bbx +++ b/cv.bbx @@ -179,7 +179,8 @@ } \newbibmacro*{projdate}{% - \mkbibdatelong{year}{month}{}% + % \mkbibdatelong{year}{month}{}% + \usebibmacro{range-date}[long]% } \newbibmacro{level}{% @@ -249,16 +250,21 @@ }% } -\newbibmacro*{range-date}{% +% macro for long and short dates +\newbibmacro*{range-date}[1][short]{% +\begingroup% + \ifstrequal{#1}{short}% + {\let\mkrangedate\mkbibcvdateshort}% + {\let\mkrangedate\mkbibcvdatelong}% \iffieldundef{year}% {}% {\printtext{% % If the item is in the same year, \iffieldsequal{year}{endyear}% % compress - {\mkbibcvdateshort{}{month}{}}% + {\mkrangedate{}{month}{}}% % else, print the date - {\mkbibcvdateshort{year}{month}{}}% + {\mkrangedate{year}{month}{}}% \iffieldundef{endyear}% {}% {% check if we have a single year @@ -278,24 +284,43 @@ \fi% }% % else, print a range - {\mkbibcvdateshort{endyear}{endmonth}{}}% + {\mkrangedate{endyear}{endmonth}{}}% }% }% }% +\endgroup% } \newcommand*{\datesep}{~} -% taken from biblatex/lbx/.lbx +% taken from biblatex/lbx/english.lbx +\protected\def\mkbibcvdatelong#1#2#3{% + \iffieldundef{#2} + {} + {\mkbibmonth{\thefield{#2}}% + \iffieldundef{#3} + {\iffieldundef{#1}{}{\space}} + {\nobreakspace}}% + \iffieldundef{#3} + {} + {\stripzeros{\thefield{#3}}% + \iffieldundef{#1}{}{,\space}}% + \iffieldbibstring{#1} + {\bibstring{\thefield{#1}}} + {\dateeraprintpre{#1}\stripzeros{\thefield{#1}}}}% \protected\def\mkbibcvdateshort#1#2#3{% + \iffieldundef{#2} + {} + {\mkmonthzeros{\thefield{#2}}% + \iffieldundef{#3} + {\iffieldundef{#1}{}{\datesep}} + {/}}% \iffieldundef{#3} - {}% - {\mkyearzeros{\thefield{#3}}% - \iffieldundef{#2}{}{\datesep}}% - \iffieldundef{#2}% - {}% - {\mkmonthzeros{\thefield{#2}}% - \iffieldundef{#1}{}{\datesep}}% - \iffieldbibstring{#1}{\bibstring{\thefield{#1}}}{\mkdayzeros{\thefield{#1}}}}% + {} + {\mkdayzeros{\thefield{#3}}% + \iffieldundef{#1}{}{\datesep}}% + \iffieldbibstring{#1} + {\bibstring{\thefield{#1}}} + {\dateeraprintpre{#1}\mkyearzeros{\thefield{#1}}}}% \newbibmacro{description}{% \printtext[details]{% -- 2.50.1