]> hydra-www.ietfng.org Git - mcv-academic/commitdiff
Fix date lists printing. Add support for semesters as YYYY-SX.
authoradin <adin@ic.unicamp.br>
Tue, 2 Apr 2019 14:37:03 +0000 (11:37 -0300)
committeradin <adin@ic.unicamp.br>
Tue, 2 Apr 2019 14:37:03 +0000 (11:37 -0300)
academic.sty
cv.bbx

index 637ca33cb06d5c24cfffefe04bb76b40f230c428..745433f94ac4b3ad5b0160efa5e4e8b2de7779de 100644 (file)
 }
 
 
-\RequirePackage[backend=biber, citestyle=numeric-comp, bibstyle=\@load@bibstyle, datamodel=\@load@datamodel, sorting=ymdtn, maxbibnames=99, defernumbers=true, giveninits=true, sortcites]{biblatex}
+\RequirePackage[backend=biber, citestyle=numeric-comp, bibstyle=\@load@bibstyle, datamodel=\@load@datamodel, sorting=ymdtn, maxbibnames=99, maxitems=3, defernumbers=true, giveninits=true, sortcites]{biblatex}
 
 
 % Execute mappings (these must be after biblatex loaded, since we will use the \DeclareLangaugeMapping macro)
diff --git a/cv.bbx b/cv.bbx
index ef0fdc5a47b8e14a0cee95cf0f90214cac2625c9..8efa93ab60e902e395a0425fb666ffa154340eda 100644 (file)
--- a/cv.bbx
+++ b/cv.bbx
@@ -5,6 +5,7 @@
 {\RequireBibliographyStyle{\biblatexmultipledm@bibstyle}}
 {\RequireBibliographyStyle{numeric-comp}}
 
+
 % Create short names for languages
 \RequirePackage{pgfkeys}
 
   \usebibmacro{begentry}%
   \usebibmacro{cvitem}%
   {% print the date or the list-of-dates
-    \iffieldundef{year}{%
-      \printlist{dates}%
-    }{%
-      \usebibmacro{range-date}%
-    }%
-  }
+    \usebibmacro{dates}%
+  }%
   {%
     \ifnameundef{author}{}{\usebibmacro{author}\newunit}%
     \printmlfield{title}%
 
 \DeclareListFormat{dates}{%
   \usebibmacro{string-to-date}{#1}%
-  \ifthenelse{\value{listcount}<\value{liststop}}
-    {\addcomma\space}
-    {}
+  \ifthenelse{\value{listcount}<\value{liststop}}%
+    {\addcomma\space}%
+    {}%
+  \usebibmacro{list:andothers}%
 }
 
 % Specific
 \newbibmacro*{cvfinentry}{}
 
 % Common formats
+\newbibmacro*{dates}[1][-\value{listtotal}]{%
+  \iffieldundef{year}{%
+    \printlist[dates][#1]{dates}%
+  }{%
+    \usebibmacro{range-date}%
+  }%
+}
+
 % Does the same thing as range-date but with a string instead
 \newbibmacro*{string-to-date}[1]{%
   % localize the year macrso to avoid problems
   }%
   {% Is single date
     \usebibmacro{string-to-single-date}{#1}%
+%    \usebibmacro{string-to-single-date}[end]{#1}%
   }%
   \usebibmacro{range-date}%
   \endgroup%
 
 \newbibmacro*{string-to-single-date}[2][]{%
   % if string (#2) is emtpy do nothing
-  \ifdefempty{#2}{}{%
+  \ifstrempty{#2}{}{%
     % else
     \IfSubStr{#2}{-}%
     {%
       \StrCut{\rest}{-}\month\day%
       \csedef{abx@field@#1year}{\year}%
       \csedef{abx@field@#1month}{\month}%
-      \csedef{abx@field@#1day}{\day}%
+      \ifdefempty{\day}{}{\csedef{abx@field@#1day}{\day}}%
     }%
     {% Just a year in the date
       \csedef{abx@field@#1year}{#2}%
 
 \newcommand*{\datesep}{.}
 % taken from biblatex/lbx/english.lbx
+% [opts]{year}{month}{day}
 \protect\newcommand{\mkbibcvdatelong}[4][]{%
-  \iffieldundef{#3}
-    {}
-    {\mkbibmonth{\thefield{#3}}%
-     \iffieldundef{#4}
-       {\iffieldundef{#2}{}{\space}}
-       {\nobreakspace}}%
-  \iffieldundef{#4}
-    {}
-    {\stripzeros{\thefield{#4}}%
-     \iffieldundef{#2}{}{,\space}}%
-   \iffieldbibstring{#2}
-     {\bibstring{\thefield{#2}}}
-     {\dateeraprintpre{#2}\stripzeros{\thefield{#2}}}%
+  \iffieldundef{#3}%
+    {}%
+    {%
+      \ifboolexpr{%
+        test {\IfBeginWith{\thefield{#3}}{S}}% if starts with S
+        or
+        test {\IfBeginWith{\thefield{#3}}{s}}% if starts with S
+      }
+        {\bibsstring{semester}\nobreakspace\StrGobbleLeft{\thefield{#3}}{1}}%
+        {%
+           \mkbibmonth{\thefield{#3}}%
+           \iffieldundef{#4}% is there a day?
+             {\iffieldundef{#2}{}{\space}}% there is a day, so lets check the year
+             {\nobreakspace}% there is no day
+        }%
+    }%
+  \iffieldundef{#4}%
+    {}%
+    {%
+       \stripzeros{\thefield{#4}}%
+       \iffieldundef{#2}{}{,\space}%
+    }%
+  \iffieldbibstring{#2}%
+    {\bibstring{\thefield{#2}}}%
+    {\dateeraprintpre{#2}\stripzeros{\thefield{#2}}}%
 }%
    
 \pgfkeys{
@@ -377,6 +397,7 @@ year month sep/.default={\datesep},
 month day sep/.store in=\@mdsep,
 month day sep/.default={\datesep},
 }
+% [opts]{year}{month}{day}
 \protect\newcommand{\mkbibcvdateshort}[4][]{%
   \pgfkeys{/dateshort/.cd, year month sep, month day sep,#1}%
   % print format DD MM YYYY, instead
@@ -386,8 +407,16 @@ month day sep/.default={\datesep},
      \iffieldundef{#3}{}{\@mdsep}}%
   \iffieldundef{#3}%
     {}%
-    {\mkmonthzeros{\thefield{#3}}%
-     \iffieldundef{#2}{}{\@ymsep}}%
+    {%
+      \ifboolexpr{%
+        test {\IfBeginWith{\thefield{#3}}{S}}% if starts with S
+        or
+        test {\IfBeginWith{\thefield{#3}}{s}}% if starts with S
+      }
+        {\bibsstring{semester}\StrGobbleLeft{\thefield{#3}}{1}}%
+        {\mkmonthzeros{\thefield{#3}}}%
+      \iffieldundef{#2}{}{\@ymsep}%
+    }%
   \iffieldundef{#2}%
     {}%
     {\iffieldbibstring{#2}%