Biber 소스 매핑 문제

Biber 소스 매핑 문제

mwe 이하:

\begin{filecontents}[overwrite]{\jobname.bib}
@customa{a,
  author = {Author},
  eventdate = {1000-01-01},
  title = {Title},
  journaltitle = {Journaltitle},
  date = {3000},
}
@customa{b,
  author = {Author},
  eventdate = {2000-01-01},
  title = {Title},
  journaltitle = {Journaltitle},
  date = {1000},
}
@customa{c,
  author = {Author},
  eventdate = {3000-01-01},
  title = {Title},
  journaltitle = {Journaltitle},
  date = {2000},
}
@article{article,
  author = {Author},
  title = {Title},
  journaltitle = {Journaltitle},
  date = {2000},
}
\end{filecontents}

\documentclass{article}
\usepackage[style=authortitle]{biblatex}
\addbibresource{\jobname.bib}

\DeclareStyleSourcemap{
  \maps{
    \map{
      \pertype{customa}
      \step[fieldsource=eventdate, match=\regexp{\A(\d+)}]
      \step[fieldset=sortyear, fieldvalue={$1}]
    }
  }
}

\DeclareBibliographyDriver{customa}{%
  \usebibmacro{bibindex}%
  \usebibmacro{begentry}%
  \printnames{author}%
  \newunit
  \printeventdate
  \newunit
  \usebibmacro{title}%
  \newunit\newblock
  \bibstring{in}%
  \printunit{\intitlepunct}
  \usebibmacro{journal+issuetitle}%
  \usebibmacro{finentry}}

\begin{document}
\nocite{*}
\printbibliography
\end{document}

mwe는 잘 작동합니다.

내가 이해한 바로는, <datetype>date정의된 경우 biber/biblatex는 자동으로 및 <datetype>year필드 를 생성합니다 .<datetype>month<datetype>day

따라서 소스매핑 코드도 다음과 같은 방법으로 작성할 수 있어야 합니다.

\DeclareStyleSourcemap{
  \maps{
    \map{
      \pertype{customa}
      \step[fieldsource=eventyear]
      \step[fieldset=sortyear, origfieldval]
    }
  }
}

하지만 이 두 번째 해결책은 효과가 없습니다. 왜? 오류는 무엇입니까? 감사해요.

답변1

Biber가 변경 사항을 데이터에 적용하는 소스 매핑 단계는 파일 처리 초기에 발생합니다 .bib. 특히 이는 Biber가 날짜 필드를 구성 요소로 분할하는 단계 이전에 발생합니다.

따라서 \DeclareStyleSourcemap실행될 때 날짜 필드는 여전히 eventdate(파일에 지정된 대로 .bib) 유지되며 eventyear친구는 아직 사용할 수 없습니다.

관련 정보