summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/biblatex-gb7714-2015/gb7714-2015ms.bbx
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/latex/biblatex-gb7714-2015/gb7714-2015ms.bbx')
-rw-r--r--Master/texmf-dist/tex/latex/biblatex-gb7714-2015/gb7714-2015ms.bbx377
1 files changed, 216 insertions, 161 deletions
diff --git a/Master/texmf-dist/tex/latex/biblatex-gb7714-2015/gb7714-2015ms.bbx b/Master/texmf-dist/tex/latex/biblatex-gb7714-2015/gb7714-2015ms.bbx
index 6a83013c810..4db440f8671 100644
--- a/Master/texmf-dist/tex/latex/biblatex-gb7714-2015/gb7714-2015ms.bbx
+++ b/Master/texmf-dist/tex/latex/biblatex-gb7714-2015/gb7714-2015ms.bbx
@@ -11,7 +11,7 @@
%
% 版本和时间信息
%
-\def\versionofgbtstyle{2019/01/19 v1.0p}
+\def\versionofgbtstyle{2019/02/07 v1.0q}
\def\versionofbiblatex{\abx@version}
\ProvidesFile{gb7714-2015ms.bbx}[\versionofgbtstyle biblatex bibliography style]
\RequireBiber[3]%显式指定用biber后端
@@ -90,6 +90,73 @@
% 设置宏包选项
%=====================================================================
%
+ % 增加一个选项,用于控制是否实现GB/T 7714-2015标准的脚注文献表
+ % 20190203,v1.0p,hzz
+ % 原理方法:默认做patch,文献引用带圈上标数字表示,脚注中的文献用带圈非上标数字做标签
+ % 当前面的脚注中已经存在当前文献,那么当前文献内容不再输出而用同(4)这样的方式
+ % 需要注意的是由于小页环境和表格中的脚注本身的问题,可能会有一些问题
+ \DeclareBibliographyOption{gbfootbib}[false]{%
+ \ifstrequal{#1}{false}{}{\execgbfootbib}}
+ \ExecuteBibliographyOptions{gbfootbib}
+
+ %%
+ \def\execgbfootbib%
+ {%
+ %开启引用跟踪计数器,为使用\ifciteseen等测试命令
+ \ExecuteBibliographyOptions{citetracker=true}
+ %
+ %利用footmisc宏包来实现脚注文献的悬挂对齐
+ \AtEndPreamble{
+ \@ifclassloaded{beamer}{}{
+ %beamer类因为其特殊性,为避免冲突不调footmisc。
+ %同时footmisc与hyperref宏包也不兼容,所以使用footmisc时会破坏脚注的超链接
+ %如果要实现超链接可以将下句注释掉,这里留着主要是实现悬挂对齐。
+ \PassOptionsToPackage{perpage,hang}{footmisc}
+ \RequirePackage{footmisc}}
+
+ %
+ %使脚注标记加圈并设置数字的字体为tiny,不使用修改thefootnote的方式
+ \def\@makefnmark{\hbox{\@textsuperscript{\textcircled{\tiny\@thefnmark}}}}
+ %做patch使得脚注内容中的脚注数字标签不上标
+ \pretocmd{\@makefntext}{%
+ \def\@makefnmark{%
+ \hbox{\textcircled{\tiny\@thefnmark}}%
+ }%
+ }{}{}
+ }
+
+ %
+ %判断当前文献是否已经引用过且是做的footfullcite(即已经作为脚注输出文献内容)
+ %记录首次输出时的脚注号码,用于后面再次引用该文献时的输出,比如同(4)。
+ \newbibmacro*{citesavefn}{%
+ \ifciteseen%当被引用过为true
+ {\ifcsdef{sec\arabic{refsection}et\thefield{entrykey}}%当已经定义过脚注序号信息
+ {\csgdef{labelsec\arabic{refsection}et\thefield{entrykey}}{%
+ \str@sameentry\gdef\@thefnmark{\csuse{sec\arabic{refsection}et\thefield{entrykey}}}%
+ \@makefnmark%
+ }}%
+ {\csxdef{sec\arabic{refsection}et\thefield{entrykey}}{\arabic{footnote}}}%
+ }%
+ {\csxdef{sec\arabic{refsection}et\thefield{entrykey}}{\arabic{footnote}}}%
+ }
+
+ %
+ %重定义\footfullcite使完成gb7714-2015的脚注文献要求
+ \DeclareCiteCommand{\footfullcite}[\mkbibfootnote]%
+ {\defcounter{maxnames}{\blx@maxbibnames}%局部定义maxnames和minnames计数器
+ \defcounter{minnames}{\blx@minbibnames}%使footfullcite内的作者输出与正文文献表中的一致。
+ \usebibmacro{prenote}}%
+ {\usebibmacro{citesavefn}%
+ \ifcsdef{labelsec\arabic{refsection}et\thefield{entrykey}}%
+ {\csuse{labelsec\arabic{refsection}et\thefield{entrykey}}\nopunct}%
+ {\usedriver{\DeclareNameAlias{sortname}{default}}{\thefield{entrytype}}}%
+ }%
+ {\multicitedelim}%
+ {\addcolon\usebibmacro{postnote}}
+
+ }
+
+ %
% 增加一个选项,用于控制gb7714的使用范围,即英文文献和中文文献使用不同的样式
% 20180814,v1.0m,hzz
% 原理方法:
@@ -137,6 +204,7 @@
\def\str@volumecn{卷}
\def\str@numbercn{册}
\def\str@serialcn{第}
+ \def\str@sameentry{同}
\AtEndOfPackage{%
\iftoggle{bbx:codegbk}{%
@@ -380,7 +448,7 @@
\DefineBibliographyStrings{english}{
bibliography = {\str@bibliography},
references = {\str@references},
- bytranslator= {\addcomma\ \str@bytranslator},%\addperiod,%将trans. by 改成 译
+ bytranslator= {\str@bytranslator},%\addperiod,%将trans. by 改成 译
and = {\addcomma},%将第2和3人名间的and符号改成逗号,用\finalnamedelim命令也可以定义,参见3.9.1节
andcn = {\addcomma},%and本地化字符串的中文对应词
andincitecn = {\addcomma},%将标注中的分开,便于与文献表中的区分
@@ -448,6 +516,19 @@
% 同时有version和edition的区别,因此考虑用一种类型来输出,使用manual类型
% 7. 包括报告,学位论文在内的其它所有的类型,都做一个判断,当没有出版项时,
% 且存在网址信息时,将其转换为online类型输出,否则都做为manual类型输出。
+% 8. 备选类型misc当存在网址时直接转换为online,由于howpublished域可用于描述
+% 更多的信息,因此不存在网址时,独立做一个备选格式
+% 9. 出版项主要以如下方式处理:
+% (a) location+institution+date 仅用于连续出版物
+% (b)publisher+location+date 用于需要完整输出出版项的类型,比如book,collection,proceedings,in*,report
+% (c)institution+location+date 用于出版项缺失时不输出的类型,包括manual,thesis,archive等其他类型
+% (d)printlist{insitution} 用于电子资源,仅输出出版者或组织,为数据映射方便,本来默认的organization域转换为用insitution输出。
+% (e) 不输出,主要用于连续出版物析出的文献
+% 10. 日期以如下方式处理:
+% date 由于存在biblatex选项,因此通过选项控制,数据源为date解析数据或year
+% urldate 由于存在biblatex选项,因此通过选项控制,输出到日,且用[]包围,数据源为urldate
+% newsdate 用于公告日期,公开日期或新闻日期,输出到日,但无包围符号,数据源为date
+% modifydate 用于更新或修改日期,输出到日,且用()包围,数据源为date或enddate或eventdate
\DeclareSourcemap{
\maps[datatype=bibtex]{%
@@ -455,23 +536,24 @@
\pernottype{inbook}
\pernottype{inproceedings}
\pernottype{incollection}
- \step[notfield=author]%当author不存在,将editor复制给author
+ %\step[notfield=author,final]%当author不存在,将editor复制给author
\step[fieldsource=editor,fieldtarget=author]%并删除editor
}
\map{
\pernottype{inbook}
\pernottype{inproceedings}
\pernottype{incollection}
- \step[notfield=author]%当author不存在,将translator复制给author
+ %\step[notfield=author,final]%当author不存在,将translator复制给author
\step[fieldsource=translator,fieldtarget=author]%并删除translator
}
- \map{
- \step[notfield=address]%当address和location同步
+ \map{%让address和location同步,biblatex中address是location的别名
+ %因此输出的时候只有location信息,但处理过程中是可以存在address的。
+ \step[notfield=address,final]%
\step[fieldsource=location,final]
\step[fieldset=address,origfieldval]
}
\map{
- \step[notfield=location]%当address和location同步
+ \step[notfield=location,final]%
\step[fieldsource=address,final]
\step[fieldset=location,origfieldval]
}
@@ -732,8 +814,10 @@
\step[fieldset=language,fieldvalue={english}]
\step[fieldset=langid,fieldvalue={english}]
}
- \map{%将非中文的语言放入userd中,以便进行多语言处理
- \step[fieldsource=language,fieldtarget=userd,final]
+ \map{%将一条文献的主体语言放入userd中,以便进行多语言处理
+ %之所以这么说,是因为一条文献可能是混合语言的,比如作者用的是英文
+ \step[fieldsource=language]
+ \step[fieldset=userd,origfieldval]
}
}
}
@@ -1101,7 +1185,7 @@
\ifprefchar{}{\bibnamedelimc}}%
\ifdefvoid{#2}{\mkbibnamefamily{\MakeCapital{#1}}}{\mkbibnamefamily{\MakeUppercase{#1}}}\isdot%
\ifdefvoid{#2}{}{\revsdnamepunct\bibnamedelimd\mkbibnamegiven{\MakeUppercase{#2}}\isdot}%\MakeCapital
- \ifdefvoid{#4}{}{\bibnamedelimd\mkbibnamesuffix{#4}\isdot}}%
+ \ifdefvoid{#4}{}{\addcomma\bibnamedelimd\mkbibnamesuffix{#4}\isdot}}%后缀前加逗号
{\usebibmacro{name:delim}{#1}%
\usebibmacro{name:hook}{#1}%
\ifdefvoid{#2}{\mkbibnamefamily{\MakeCapital{#1}}}{\mkbibnamefamily{\MakeUppercase{#1}}}\isdot%
@@ -1112,7 +1196,7 @@
{}{\revsdnamepunct}%
\ifdefvoid{#2}{}{\bibnamedelimd\mkbibnamegiven{\MakeUppercase{#2}}\isdot}%\MakeCapital
\ifdefvoid{#3}{}{\bibnamedelimd\mkbibnameprefix{#3}\isdot}%
- \ifdefvoid{#4}{}{\bibnamedelimd\mkbibnamesuffix{#4}\isdot}}%
+ \ifdefvoid{#4}{}{\addcomma\bibnamedelimd\mkbibnamesuffix{#4}\isdot}}%%后缀前加逗号
}
%GB/T 7714-2015 风格,大小写不变,根据bib文件内输入原样输出
@@ -1129,7 +1213,7 @@
\ifprefchar{}{\bibnamedelimc}}%
\ifdefvoid{#2}{\mkbibnamefamily{\MakeCapital{#1}}}{\mkbibnamefamily{{#1}}}\isdot%
\ifdefvoid{#2}{}{\revsdnamepunct\bibnamedelimd\mkbibnamegiven{{#2}}\isdot}%\MakeCapital
- \ifdefvoid{#4}{}{\bibnamedelimd\mkbibnamesuffix{#4}\isdot}}
+ \ifdefvoid{#4}{}{\addcomma\bibnamedelimd\mkbibnamesuffix{#4}\isdot}}%后缀前加逗号
{\usebibmacro{name:delim}{#1}%
\usebibmacro{name:hook}{#1}%
\ifdefvoid{#2}{\mkbibnamefamily{\MakeCapital{#1}}}{\mkbibnamefamily{{#1}}}\isdot%
@@ -1140,7 +1224,7 @@
{}{\revsdnamepunct}%
\ifdefvoid{#2}{}{\bibnamedelimd\mkbibnamegiven{{#2}}\isdot}%\MakeCapital
\ifdefvoid{#3}{}{\bibnamedelimd\mkbibnameprefix{#3}\isdot}
- \ifdefvoid{#4}{}{\bibnamedelimd\mkbibnamesuffix{#4}\isdot}}%
+ \ifdefvoid{#4}{}{\addcomma\bibnamedelimd\mkbibnamesuffix{#4}\isdot}}%%后缀前加逗号
}
%中文常见风格,汉语拼音全拼模式
@@ -1216,13 +1300,17 @@
}
\newbibmacro*{modifydate}{%新增加一个带括号的日期,用于表示电子资源的更新和修改日期,而公告日期则按日期格式
- \iffieldundef{year}{%
+ \ifboolexpr{%
+ test{\iffieldundef{day}} and test{\iffieldundef{endday}} and test{\iffieldundef{eventday}}%
+ }%
+ {}%更新或修改日期通常有day信息
+ {\iffieldundef{year}{%
\iffieldundef{endyear}{\iffieldundef{eventyear}{}{\printtext{(}\printeventdate\printtext{)}}}%
{\printtext{(}\printenddate\printtext{)}}%
}{\iffieldequalstr{year}{}{%因为year存在,但为空
}{\printtext{(}\blx@gbdate{}{}\printtext{)}}%
}%
- }%
+ }}%
%
@@ -1303,53 +1391,53 @@
%设置驱动格式
%=====================================================================
-\AtEveryBibitem{%
-\ifboolexpr{
-togl{bbx:gbstyle} or test {\iffieldequalstr{userd}{chinese}}
-}
-{
-
-\iftoggle{bbx:gbfieldstd}{}{
-\DeclareFieldFormat{title}{#1\adddot\addthinspace}
-\DeclareFieldFormat{journaltitle}{#1\isdot}%添加\isdot用于缩写名带点情况,将其转换为缩写点,便于标点的追踪
-\DeclareFieldFormat{issuetitle}{#1}
-\DeclareFieldFormat{maintitle}{#1}
-\DeclareFieldFormat{booktitle}{#1}
+%中文环境的局部化代码
+\def\localsetchinesecode{%
+\ifboolexpr{%
+togl{bbx:gbstyle} or test {\iffieldequalstr{userd}{chinese}}%
+}%
+{%
+\iftoggle{bbx:gbfieldstd}{}{%
+\DeclareFieldFormat{title}{##1\adddot\addthinspace}%
+\DeclareFieldFormat{journaltitle}{##1\isdot}%添加\isdot用于缩写名带点情况,将其转换为缩写点,便于标点的追踪
+\DeclareFieldFormat{issuetitle}{##1}%
+\DeclareFieldFormat{maintitle}{##1}%
+\DeclareFieldFormat{booktitle}{##1}%
\DeclareFieldFormat%将期刊等文献的标题中原来带的引号去掉
- [article,patent,thesis,unpublished]
- {title}{#1\adddot\addthinspace}%\mkbibquote{#1\isdot}
+ [article,patent,thesis,unpublished]%
+ {title}{##1\adddot\addthinspace}%\mkbibquote{##1\isdot}
\DeclareFieldFormat%将期刊等文献的标题中原来带的引号去掉
- [inbook,incollection,inproceedings]
- {title}{#1}%\nopunct\unspace
-\DeclareFieldFormat{url}{\url{#1}} %%url相关输出,url域修改如本行,源来自biblatex.def
+ [inbook,incollection,inproceedings]%
+ {title}{##1}%\nopunct\unspace
+\DeclareFieldFormat{url}{\url{##1}}%%url相关输出,url域修改如本行,源来自biblatex.def
%
% 标题的字母大小写格式修改
%
% 注意:修改标题的字母大小写,不能用前面的title的格式而要用titlecase
% 因为titlecase is applied to the contents of the field directly,title is not
-%\DeclareFieldFormat{titlecase}{\MakeCapital#1}%重设标题格式,将其修改为首字母大写
+%\DeclareFieldFormat{titlecase}{\MakeCapital##1}%重设标题格式,将其修改为首字母大写
\DeclareFieldFormat{titlecase}{\iftoggle{bbx:titlelink}{%
-\iffieldundef{url}{\MakeCapital#1}{%
-\href{\thefield{url}}{#1}}}{\MakeCapital#1}}%重设标题格式,将其修改为首字母大写
-\DeclareFieldFormat{pages}{#1}%去掉前面引导页码的pp.等字符,\mkpageprefix[bookpagination]{#1}
-}
-
+\iffieldundef{url}{\MakeCapital##1}{%
+\href{\thefield{url}}{##1}}}{\MakeCapital##1}}%重设标题格式,将其修改为首字母大写
+\DeclareFieldFormat{pages}{##1}%去掉前面引导页码的pp.等字符,\mkpageprefix[bookpagination]{##1}
+}%
%
% 修改译者位置格式
%
% 原理方法:修改来自biblatex.def文件的bytranslator+others宏的格式
\renewbibmacro*{bytranslator+others}{%
- \ifnameundef{translator}
- {}
+ \ifnameundef{translator}%
+ {}%
{%\usebibmacro{bytranslator+othersstrg}
%\setunit{\addspace}%
\printnames[bytranslator]{translator}%
\clearname{translator}%
+ %从macro*{bytranslator+othersstrg}%中可以看到当地化字符串格式的引用前的代码处理
+ %比如生成cotranslator等用于调用cotranslator所代表的当地化字符串
\usebibmacro{bytranslator+othersstrg}%“译”的位置换到下面来,即放到译者后面。
- \setunit*{\addspace}%
+ %\setunit{\addspace}%
\newunit}%
- \usebibmacro{withothers}}
-
+ \usebibmacro{withothers}}%
%
% 修改作者数量超过限定值,做省略时的处理格式
% v1.0,20160701,hzz
@@ -1357,16 +1445,20 @@ togl{bbx:gbstyle} or test {\iffieldequalstr{userd}{chinese}}
%
% 原理方法:判断作者或译者是否中文,若中文用字符等,否则用et al. 。
\renewbibmacro*{name:andothers}{%
- \ifboolexpr{
- test {\ifnumequal{\value{listcount}}{\value{liststop}}}
+ \ifboolexpr{%
+ test {\ifnumequal{\value{listcount}}{\value{liststop}}}%
and
test \ifmorenames
- }{\ifnumgreater{\value{liststop}}{1}
+ }{\ifnumgreater{\value{liststop}}{1}%
{\finalandcomma}%
{}%biblatex作者要区别单作者加等的情况,这里为符合gbt7714-2015第7.2节的要求加上了逗号。
\printdelim{andothersdelim}\printdelim{strandothersdelim}%
-}{}}
-
+}{%当是译者的时候需要特殊处理:从7.2节看等,译前面加逗号,但从示例看等和译同时出现时,译前的逗号没有,比如:
+%袁训来, 陈哲, 肖书海, 等.
+%胡泳, 范海燕, 译.
+%潘惠霞, 魏婧, 杨艳, 等译.
+\ifcurrentname{translator}{\addcomma}{}%
+}}%
%
% 修改省略作者后的本地化字符串,比如et al.
% v1.0o,20190103,hzz
@@ -1387,13 +1479,12 @@ togl{bbx:gbstyle} or test {\iffieldequalstr{userd}{chinese}}
\iffieldequalstr{userd}{english}{\bibstring{andothers}}{}%
\iffieldequalstr{userd}{french}{\bibstring{andothers}}{}%
\iffieldequalstr{userd}{russian}{\bibstring{andothers}}{}%
- }\space%
+ }%
\or%
- \bibstring{andotherscn}\space%
+ \bibstring{andotherscn}%
\or%
- \bibstring{andothers}\space%
- \fi}
-
+ \bibstring{andothers}%
+ \fi}%
%
% 修改最后一个作者前的字符串,比如 and
% v1.0o,20190103,hzz
@@ -1419,8 +1510,7 @@ togl{bbx:gbstyle} or test {\iffieldequalstr{userd}{chinese}}
\bibstring{andcn}\space%
\or%
\bibstring{and}\space%
- \fi}
-
+ \fi}%
%
% url和url日期格式
%
@@ -1430,9 +1520,8 @@ togl{bbx:gbstyle} or test {\iffieldequalstr{userd}{chinese}}
{}{%\setunit*{\addspace}%
\usebibmacro{urldate}}%
\setunit{\addperiod\addspace}%
- \usebibmacro{url}}
- \renewbibmacro*{url}{\printfield{url}}
-
+ \usebibmacro{url}}%
+ \renewbibmacro*{url}{\printfield{url}}%
%
% 重设title的输出
%
@@ -1462,16 +1551,13 @@ togl{bbx:gbstyle} or test {\iffieldequalstr{userd}{chinese}}
%\iffieldundef{booktitle}{\newunit}{}%当title是析出时,不要标点
%\newunit
}%
-}}
-
+}}%
%
% 日期信息的输出格式,针对biblatex<3.7版本
%
-\DeclareFieldFormat{urldate}{#1}
+\DeclareFieldFormat{urldate}{##1}%
\renewbibmacro*{urldate}{%
\addthinspace\printtext{[}\printurldate\printtext{]}}%能用高层命令+选项尽量用命令(比如这里的\printurldate),而不用\blx@edtfdate这种更底层的命令
-
-
%
% 调整doi+eprint+url格式
%
@@ -1491,28 +1577,26 @@ togl{bbx:gbstyle} or test {\iffieldequalstr{userd}{chinese}}
\newunit\newblock
\iftoggle{bbx:doi}
{\printfield{doi}}
- {}}
-
+ {}}%
%
% 调整页码的格式,即chapter+pages格式
%
\renewbibmacro*{chapter+pages}{%
- \printfield{chapter}%
+\iftoggle{bbx:gbstrict}{}{%
+ \printfield{chapter}}%
\iffieldundef{pages}{}{%这里增加一个判断,当没有页码时就不输出
\setunit{\bibpagespunct}%
\printfield{pages}}%
%\newunit %这里的标点去掉
-}
-
+}%
%
% 当location等出版项超过maxitem缩减后不再输出etal
%
\DeclareListFormat{location}{%
- \usebibmacro{list:delim}{#1}%
- #1\isdot}
-\DeclareListAlias{institution}{location}
-\DeclareListAlias{publisher}{location}
-
+ \usebibmacro{list:delim}{##1}%
+ ##1\isdot}%
+\DeclareListAlias{institution}{location}%
+\DeclareListAlias{publisher}{location}%
% 新增一个样式用于输出连续出版物的地址,单位,时间,
% 用于periodical连续出版物的出版社和地址的处理
%
@@ -1546,7 +1630,7 @@ test {\iflistundef{location}} and test {\iflistundef{institution}}%
\setunit*{\addcomma\space}%
\usebibmacro{date}%
\newunit}%
-}
+}%
%
% 通用的出版社和地址的处理
%
@@ -1578,10 +1662,7 @@ test {\iflistundef{location}} and test {\iflistundef{institution}}%
\setunit*{\addcomma\space}%
\usebibmacro{date}%%\newunit
}%
-}
-
-
-
+}%
%
% 修改了一个institution+location+date用于manual、report、thesis等类型
%
@@ -1596,8 +1677,7 @@ test {\iflistundef{location}} and test {\iflistundef{institution}}%
\setunit*{\addcomma\space}%
\usebibmacro{date}%
%\newunit
- }}
-
+ }}%
%
% 对volume卷信息格式做出修改
% v1.0o,20190105,hzz
@@ -1605,65 +1685,60 @@ test {\iflistundef{location}} and test {\iflistundef{institution}}%
\DeclareFieldFormat{volume}{%
\testCJKfirst{userd}%
\iftoggle{ifCJKforgbt}%
-{\bibstring{serialcn}#1\bibstring{volumecn}}%
-{\bibstring{volume}~#1}%
+{\bibstring{serialcn}##1\bibstring{volumecn}}%
+{\bibstring{volume}~##1}%
}% volume of a book
-\DeclareFieldFormat[article,periodical]{volume}{#1}% volume of a journal
-
+\DeclareFieldFormat[article,periodical]{volume}{##1}% volume of a journal
%
% 对number册信息格式做出修改
% v1.0o,20190105,hzz
%
-\DeclareFieldFormat{number}{#1}%
+\DeclareFieldFormat{number}{##1}%
\DeclareFieldFormat[book,collection,inbook,%
incollection,proceedings,inproceedings]{number}{%
\testCJKfirst{userd}%
\iftoggle{ifCJKforgbt}%
-{\bibstring{serialcn}#1\bibstring{numbercn}}%
-{#1}%
+{\bibstring{serialcn}##1\bibstring{numbercn}}%
+{##1}%
}%
-
%
% 对edition版本信息格式做出修改
%
\DeclareFieldFormat{edition}{%源来自biblatex.DEF
\testCJKfirst{userd}%
\iftoggle{ifCJKforgbt}%
-{\ifinteger{#1}%
-{\printtext{#1\str@edition}}%
-{#1\isdot}}%
-{\ifinteger{#1}%
-{\mkbibordedition{#1}~\bibstring{edition}}%
-{#1\isdot}}}
-
+{\ifinteger{##1}%
+{\printtext{##1\str@edition}}%
+{##1\isdot}}%
+{\ifinteger{##1}%
+{\mkbibordedition{##1}~\bibstring{edition}}%
+{##1\isdot}}}%
%
% 对version的版本信息做出修改
%
\DeclareFieldFormat{version}{%源来自biblatex.DEF
\testCJKfirst{userd}%
-\ifinteger{#1}%
-{\iftoggle{ifCJKforgbt}{\printtext{#1\str@edition}}%
-{\mkbibordedition{#1}~\bibstring{version}}}%
-{#1\isdot}}
-
+\ifinteger{##1}%
+{\iftoggle{ifCJKforgbt}{\printtext{##1\str@edition}}%
+{\mkbibordedition{##1}~\bibstring{version}}}%
+{##1\isdot}}%
%
% 修改析出文献的文集的标题与附加标题间的符号
%
\renewbibmacro*{booktitle}{%
- \ifboolexpr{
+ \ifboolexpr{%
test {\iffieldundef{booktitle}}
and
test {\iffieldundef{booksubtitle}}
- }
- {}
+ }%
+ {}%
{\printtext[booktitle]{\bibtitlefont%
\printfield[titlecase]{booktitle}%
\setunit{\subtitlepunct}%
\printfield[titlecase]{booksubtitle}}%
\newunit%标点换成下一句
\setunit{\subtitlepunct}}%
- \printfield{booktitleaddon}}
-
+ \printfield{booktitleaddon}}%
%
% 调整期刊名的格式
%
@@ -1686,8 +1761,7 @@ incollection,proceedings,inproceedings]{number}{%
\usebibmacro{issue}%
\usebibmacro{volume+number+eid}%把卷期放到年份后面
%\newunit
- }
-
+ }%
%
% 调整期刊卷和期的格式
%
@@ -1704,8 +1778,7 @@ incollection,proceedings,inproceedings]{number}{%
\iffieldundef{number}{}{\printtext{\mkbibparens{\printfield{number}}}}%增加一个圆括号
\iffieldundef{eid}{}{%
\setunit{\addcomma\space}%
- \printfield{eid}}}}
-
+ \printfield{eid}}}}%
%
% 调整期刊年份的格式
%
@@ -1725,8 +1798,7 @@ incollection,proceedings,inproceedings]{number}{%
{\usebibmacro{date}}%
}}}%
%\newunit
- }
-
+ }%
%
% 调整页码前的标点和去掉期刊文章等页码后面的标点
%
@@ -1736,9 +1808,7 @@ incollection,proceedings,inproceedings]{number}{%
\setunit{\bibpagespunct}%
\printfield{pages}}%
%\newunit
- }
-
-
+ }%
%
% 编者的符号修改一下
%
@@ -1754,8 +1824,7 @@ incollection,proceedings,inproceedings]{number}{%
{\setunit{\addcomma\space}%
\usebibmacro{editorstrg}}%
\clearname{editor}}
- {}}
-
+ {}}%
%
% 编者类型做一修改
%
@@ -1780,14 +1849,13 @@ incollection,proceedings,inproceedings]{number}{%
{\bibstring{\thefield{editortype}s}}
{\bibstring{\thefield{editortype}}}}
{\thefield{editortype}}}%
- }}
-
+ }}%
%
% 修改期刊的标题
%
\renewbibmacro*{periodical}{%源来自biblatex.DEF
\iffieldundef{title}
- {}
+ {}%
{\printtext[title]{\bibtitlefont%
\printfield[titlecase]{title}%
%\setunit{\subtitlepunct}%
@@ -1797,10 +1865,9 @@ incollection,proceedings,inproceedings]{number}{%
%}%把编组结束移到后面去
\iftoggle{bbx:gbtype}{%
\iffieldundef{usera}{}{%在标题后直接给出文献标识字母
- \printfield[gbtypeflag]{usera}}}{}
- }}
- }
-
+ \printfield[gbtypeflag]{usera}}}{}%
+ }}%
+ }%
%
% 期刊的标题做修改
%
@@ -1809,7 +1876,7 @@ incollection,proceedings,inproceedings]{number}{%
%\setunit*{\addspace}%
\setunit*{\adddot\addspace}%标点修改为句点
\iffieldundef{series}
- {}
+ {}%
{\newunit
\printfield{series}%
\setunit{\addspace}}%
@@ -1840,9 +1907,7 @@ incollection,proceedings,inproceedings]{number}{%
%\usebibmacro{issue+date}%
%\setunit{\addcolon\space}%
\usebibmacro{issue}%
- \newunit}
-
-
+ \newunit}%
%
% 修改in:用于inbook、incollection、inproceedings等类型
% 2018.04.20,v1.0k,renewed marco,by hzz
@@ -1851,7 +1916,6 @@ incollection,proceedings,inproceedings]{number}{%
\renewbibmacro*{in:}{%
\iftoggle{bbx:gbpunctin}{\printtext{\texttt{//}\allowbreak}}%\addthinspace
{\setunit{\adddot\addspace}\printtext{\bibstring{in}}}}%\newunit\newblock\intitlepunct
-
%
% book条目类的驱动
%
@@ -1886,6 +1950,8 @@ incollection,proceedings,inproceedings]{number}{%
\usebibmacro{publisher+location+date}%
%\newunit\newblock %这里标点去掉
\usebibmacro{chapter+pages}%
+ \iffieldundef{url}{}{%当没有网址时也不输出
+ \usebibmacro{modifydate}}%带括号的修改或更新日期,
\usebibmacro{doi+eprint+url}%从下面移动到上面来,因为gbt2015的url需直接放在页码后面。
\newunit\newblock%
\printfield{pagetotal}%
@@ -1904,9 +1970,7 @@ incollection,proceedings,inproceedings]{number}{%
{\usebibmacro{related:init}%
\usebibmacro{related}}
{}%
- \usebibmacro{finentry}}
-
-
+ \usebibmacro{finentry}}%
%
% 期刊文章,连续出版物中的析出文献的格式
%
@@ -1932,7 +1996,9 @@ incollection,proceedings,inproceedings]{number}{%
% \usebibmacro{byeditor+others}%
% \newunit
\usebibmacro{note+pages}%
- \iffieldequalstr{note}{news}{}{\usebibmacro{modifydate}}%带括号的修改或更新日期,当是新闻时不输出
+ \iffieldequalstr{note}{news}{}{%当是新闻时不输出修改或更新日期
+ \iffieldundef{url}{}{%当没有网址时也不输出
+ \usebibmacro{modifydate}}}%带括号的修改或更新日期,
\usebibmacro{doi+eprint+url}%从后面移上来,调整url和页码之间的位置
\newunit\newblock
\iftoggle{bbx:isbn}
@@ -1949,10 +2015,7 @@ incollection,proceedings,inproceedings]{number}{%
{\usebibmacro{related:init}%
\usebibmacro{related}}
{}%
- \usebibmacro{finentry}}
-
-
-
+ \usebibmacro{finentry}}%
%
% 连续出版物的驱动
%
@@ -1987,8 +2050,7 @@ incollection,proceedings,inproceedings]{number}{%
{\usebibmacro{related:init}%
\usebibmacro{related}}
{}%
- \usebibmacro{finentry}}
-
+ \usebibmacro{finentry}}%
%
% 专利文献驱动
%
@@ -2030,9 +2092,7 @@ incollection,proceedings,inproceedings]{number}{%
{\usebibmacro{related:init}%
\usebibmacro{related}}
{}%
- \usebibmacro{finentry}}
-
-
+ \usebibmacro{finentry}}%
%
% 在线文献驱动
%
@@ -2057,8 +2117,10 @@ incollection,proceedings,inproceedings]{number}{%
%\printlist{organization}%
\printlist{institution}%
\newunit\newblock
- %\usebibmacro{date}%
- \usebibmacro{modifydate}%修改或更新日期,为带括号的时间
+\ifboolexpr{%
+test{\iffieldundef{day}} and test{\iffieldundef{endday}} and test{\iffieldundef{eventday}}%
+}{\usebibmacro{date}}%
+{\usebibmacro{modifydate}}%修改或更新日期,为带括号的时间
\usebibmacro{url+urldate}%从下面移上来
\newunit\newblock
\iftoggle{bbx:eprint}
@@ -2075,10 +2137,7 @@ incollection,proceedings,inproceedings]{number}{%
{\usebibmacro{related:init}%
\usebibmacro{related}}
{}%
- \usebibmacro{finentry}}
-
-
-
+ \usebibmacro{finentry}}%
%
% 报告类型驱动
% 2016-11-11,增加了译者信息
@@ -2126,8 +2185,7 @@ incollection,proceedings,inproceedings]{number}{%
{\usebibmacro{related:init}%
\usebibmacro{related}}
{}%
- \usebibmacro{finentry}}
-
+ \usebibmacro{finentry}}%
%
% 手册类型驱动
% 2016-11-11,增加了译者信息
@@ -2158,7 +2216,8 @@ incollection,proceedings,inproceedings]{number}{%
\usebibmacro{institution+location+date}%
%\newunit\newblock
\usebibmacro{chapter+pages}%
- \usebibmacro{modifydate}%修改或更新日期,为带括号的时间
+ \iffieldundef{url}{}{%当没有网址时也不输出修改或更新日期
+ \usebibmacro{modifydate}}%修改或更新日期为带括号的时间
\usebibmacro{doi+eprint+url}%
\newunit
\printfield{pagetotal}%
@@ -2177,8 +2236,7 @@ incollection,proceedings,inproceedings]{number}{%
{\usebibmacro{related:init}%
\usebibmacro{related}}
{}%
- \usebibmacro{finentry}}
-
+ \usebibmacro{finentry}}%
%
% 备选类型驱动
%
@@ -2218,9 +2276,7 @@ incollection,proceedings,inproceedings]{number}{%
{\usebibmacro{related:init}%
\usebibmacro{related}}
{}%
- \usebibmacro{finentry}}
-
-
+ \usebibmacro{finentry}}%
%
% 专著中的析出文献的格式修改
%
@@ -2274,10 +2330,9 @@ incollection,proceedings,inproceedings]{number}{%
{\usebibmacro{related:init}%
\usebibmacro{related}}
{}%
- \usebibmacro{finentry}}
-
-
-
-
-}{}
+ \usebibmacro{finentry}}%
+}{}%
}
+
+\AtEveryBibitem{\localsetchinesecode}%
+\AtEveryCite{\localsetchinesecode}%