diff options
author | Norbert Preining <norbert@preining.info> | 2024-03-28 03:01:34 +0000 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2024-03-28 03:01:34 +0000 |
commit | 79e9e48f9496fe82b7e76b2b318d24e9aab1ca8a (patch) | |
tree | 5c7e66ed056f7855cb4caee718c5406c947e3af8 /macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/gb7714-2015ay.bbx | |
parent | 31fa8cd73bab8480d38dae3a89ca578f337d6bbd (diff) |
CTAN sync 202403280301
Diffstat (limited to 'macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/gb7714-2015ay.bbx')
-rw-r--r-- | macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/gb7714-2015ay.bbx | 81 |
1 files changed, 50 insertions, 31 deletions
diff --git a/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/gb7714-2015ay.bbx b/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/gb7714-2015ay.bbx index 73316ea3cb..01a0f05a6b 100644 --- a/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/gb7714-2015ay.bbx +++ b/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/gb7714-2015ay.bbx @@ -10,7 +10,7 @@ % % 版本和时间信息 % -\def\versionofgbtstyle{2024/02/10 v1.1p} +\def\versionofgbtstyle{2024/03/27 v1.1q} \def\versionofbiblatex{\abx@version} \ProvidesFile{gb7714-2015ay.bbx}[\versionofgbtstyle biblatex bibliography style] %\RequireBiber[3]%显式指定用biber后端,当用bibtex时会报错,但其实不会影响编译,只是采用bibtex后无法达成格式需求 @@ -233,6 +233,14 @@ % 设置宏包选项 %===================================================================== % + % 增加一个控制是否输出and others信息的选项 + % 20240315,v1.1p,hzz + \newtoggle{bbx:gbnoothers} + \DeclareBibliographyOption{gbnoothers}[false]{%biblatex低版本 + \settoggle{bbx:gbnoothers}{#1}} + \ExecuteBibliographyOptions{gbnoothers} + + % % 增加一个控制是否输出文献载体的选项 % 20191125,v1,0s,hzz \newtoggle{bbx:gbmedium} @@ -913,6 +921,7 @@ bibliography = {\str@bibliography}, references = {\str@references}, bytranslatorcn= {\str@bytranslator\adddot}, %将trans. by 改成 译 + byeditor={\iffieldequalstr{userd}{chinese}{\str@editorcn}{ed\adddotspace by}}, and = {\addcomma},%将第2和3人名见的and符号改成 逗号,用\finalnamedelim命令也可以定义,参见3.9.1节 andcn = {\addcomma},%\str@andcn\ and本地化字符串的中文对应词 andincitecn = {\str@andcn},%将标注中的分开,便于与文献表中的区分 @@ -1675,37 +1684,31 @@ } %用于人工的为条目或条目集添加域 \newcommand{\addEntryField}[3]{% - \edef\entrykeya{#1} - \edef\entrykeyb{#2} - \edef\entrykeyc{#3} + \edef\entrykeya{#1}% + \edef\entrykeyb{#2}% + \edef\entrykeyc{#3}% \DeclareStyleSourcemap{ \maps[datatype=bibtex]{ \map[foreach={#1}]{ \step[fieldsource=entrykey, match=\regexp{$MAPLOOP}, final] \step[fieldset=\entrykeyb, fieldvalue=\entrykeyc] } - \map{%处理在bib文件中直接给出文献的姓名格式为lowercase的情况 - \step[fieldsource=nameformat,match=lowercase,final] - \step[fieldset=namefmtid,fieldvalue={1}] - } - \map{%处理在bib文件中直接给出文献的姓名格式为givenahead的情况 - \step[fieldsource=nameformat,match=givenahead,final] - \step[fieldset=namefmtid,fieldvalue={2}] - } - \map{%处理在bib文件中直接给出文献的姓名格式为familyahead的情况 - \step[fieldsource=nameformat,match=familyahead,final] - \step[fieldset=namefmtid,fieldvalue={3}] - } - \map{%处理在bib文件中直接给出文献的姓名格式为pinyin的情况 - \step[fieldsource=nameformat,match=pinyin,final] - \step[fieldset=namefmtid,fieldvalue={4}] - } - \map{%处理在bib文件中直接给出文献的姓名格式为全拼的情况 - \step[fieldsource=nameformat,match=quanpin,final] - \step[fieldset=namefmtid,fieldvalue={6}] - } } - } + }% + } + +%用于人工的为条目或条目集删除域 +\newcommand{\delEntryField}[2]{% + \edef\entrykeya{#1}% + \edef\entrykeyb{#2}% + \DeclareStyleSourcemap{ + \maps[datatype=bibtex,overwrite]{ + \map[foreach={#1}]{ + \step[fieldsource=entrykey, match=\regexp{$MAPLOOP}, final] + \step[fieldset=\entrykeyb, fieldvalue={}] + } + } + }% } % @@ -2213,7 +2216,7 @@ test {\iftoggle{iftlseven}}%biblatex<=3.7 \DeclareFieldFormat{gbtypeflag}{% \iftoggle{bbx:gbmedium}% {\iftoggle{bbx:url}% - {\iffieldundef{url}%当存在url时,增加一个OL标识符 + {\ifboolexpr{ test {\iffieldundef{url}} and test {\iffieldundef{doi}} and test {\iffieldundef{eprint}} }%\iffieldundef{url}%当存在url时,增加一个OL标识符->改为当存在doi或eprint或url时增加OL标识符 {\printdelim{titletypedelim}\printtext{\gbleftbracket}\nobreak#1\nobreak\printtext{\iffieldundef{medium}{}{{\SlashFont/}\thefield{medium}}\gbrightbracket}}% {\printdelim{titletypedelim}\printtext{\gbleftbracket}\nobreak#1\nobreak\printtext{{\SlashFont/}OL\gbrightbracket}}% }% @@ -2334,6 +2337,19 @@ test {\iftoggle{iftlseven}}%biblatex<=3.7 } +\renewbibmacro*{byeditor+others}{% + \ifnameundef{editor} + {} + {\iffieldequalstr{userd}{chinese}{}{\usebibmacro{byeditor+othersstrg}% + \setunit{\addspace}}% + \printnames[byeditor]{editor}% + \iffieldequalstr{userd}{chinese}{\usebibmacro{byeditor+othersstrg}}{}% + \clearname{editor}% + \newunit}% + \usebibmacro{byeditorx}% + \usebibmacro{bytranslator+others}} + + % % 修改译者位置格式 % v1.0w,20210401,hzz,增加对英文等其它语言译者的处理 @@ -2342,8 +2358,7 @@ test {\iftoggle{iftlseven}}%biblatex<=3.7 \renewbibmacro*{bytranslator+others}{\bibauthorfont% \ifnameundef{translator} {} - {\iffieldequalstr{usere}{chinese}{}{\usebibmacro{bytranslator+othersstrg}}% - %\setunit{\addspace}% + {\iffieldequalstr{usere}{chinese}{}{\usebibmacro{bytranslator+othersstrg}\setunit{\addspace}}% \printnames[bytranslator]{translator}% \clearname{translator}% %从macro*{bytranslator+othersstrg}%中可以看到当地化字符串格式的引用前的代码处理 @@ -2648,7 +2663,9 @@ test {\iftoggle{iftlseven}}%biblatex<=3.7 {\namepartprefix} {\namepartsuffix}% \fi - \usebibmacro{name:andothers}} +\iftoggle{bbx:gbnoothers}{}% + {\usebibmacro{name:andothers}}% +} \DeclareNameAlias{default}{namefmtselected}%姓名的默认格式采用可选的模式 \DeclareNameAlias{sortname}{default}% Used in the bibliography %family-given/given-family @@ -2948,8 +2965,10 @@ test {\iftoggle{iftlseven}}%biblatex<=3.7 {\usebibmacro{name:first-last}{#1}{#3}{#5}{#7}}}% \or \usebibmacro{name:gbquanpin}{#1}{#3}{#5}{#7}% - \fi - \usebibmacro{name:andothers}} + \fi% +\iftoggle{bbx:gbnoothers}{}% + {\usebibmacro{name:andothers}}% + }% } % |