moewew / biblatex-ext

Extensions for the biblatex standard styles
LaTeX Project Public License v1.3c
24 stars 3 forks source link

Patent date #25

Closed bastien-roucaries closed 3 years ago

bastien-roucaries commented 3 years ago

Hi,

Following https://github.com/plk/biblatex/pull/907 maybe the best place is your bundle.

The portable code to support extra date for patent

\begin{filecontents}{biblatex-dm.cfg} \DeclareDatamodelFields[type=field,datatype=date,nullok=true]{granteddate} \DeclareDatamodelFields[type=field,datatype=date,nullok=true]{publisheddate} \DeclareDatamodelFields[type=field,datatype=date,nullok=true]{fileddate} \DeclareDatamodelFields[type=field,datatype=date,nullok=true]{expireddate} \DeclareDatamodelEntryfields[patent]{granteddate} \DeclareDatamodelEntryfields[patent]{publisheddate} \DeclareDatamodelEntryfields[patent]{fileddate} \DeclareDatamodelEntryfields[patent]{expireddate} \DeclareFieldAlias[patent]{publisheddate}{date} \end{filecontents}

\NewBibliographyString{granted} \DefineBibliographyStrings{english}{% granted = {{granted}{grant\adddot}}, } \DefineBibliographyStrings{french}{% granted = {{délivré}{dél\adddot}}, } \NewBibliographyString{filed} \DefineBibliographyStrings{english}{% filed = {{filed}{filed}}, } \DefineBibliographyStrings{french}{% filed = {{déposé}{dép\adddot}}, } \NewBibliographyString{expired} \DefineBibliographyStrings{english}{% expired = {{expired}{exp\adddot}}, } \DefineBibliographyStrings{french}{% expired = {{échu}{échu}}, }

\DeclareFieldFormat{patentdates}{\mkbibparens{#1}} \newbibmacro{fileddate}{\iffieldundef{filedyear}{}{\ifbibstring{filed}{\bibstring{filed}}{filed}\space\printfileddate}} \newbibmacro{granteddate}{\iffieldundef{grantedyear}{}{\ifbibstring{granted}{\bibstring{granted}}{granted}\space\printgranteddate}} \newbibmacro{expireddate}{\iffieldundef{expiredyear}{}{\ifbibstring{expired}{\bibstring{expired}}{expired}\space\printexpireddate}}

\renewbibmacro{date}{% \printdate% {% \ifboolexpr{% test {\iffieldundef{filedyear}} and test {\iffieldundef{grantedyear}} and test {\iffieldundef{expiredyear}} }% {}% {% \newunit% \printtext[patentdates]{% \usebibmacro{fileddate}% \setunit{\addcomma\space}% \usebibmacro{granteddate}% \setunit*{\addcomma\space}% \usebibmacro{expireddate}% }% }% }%
}

moewew commented 3 years ago

Thank you for the suggestion.

As you know I'm not too convinced that these (nontrivial) additions to the data model are widely applicable. But regardless of that I don't feel that biblatex-ext is the right place for this if it isn't added into the biblatex core. My vision for biblatex-ext is that it should add style customisations to the standard styles. I don't think I want to extend the data model, because that means that the styles depart from core biblatex in something other than style.

If you think these additions are useful (and don't want to wait and see what happens to https://github.com/plk/biblatex/pull/907) you can always release a package to CTAN (like e.g. biblatex-software). I think this patent code could be useful for some people, but I don't feel that biblatex-ext is the right place to make it available to them.

bastien-roucaries commented 3 years ago

Ok feel free to close

moewew commented 3 years ago

Alright. Closing this as I feel that biblatex-ext is not the place for this extension of the biblatex data model.