Skip to content

Commit 9b43dcf

Browse files
committed
wip
1 parent 6a048de commit 9b43dcf

File tree

3 files changed

+22
-28
lines changed

3 files changed

+22
-28
lines changed

TeXmacs/plugins/latex/progs/bibtex/gbt7714-2015.scm

Lines changed: 10 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -208,11 +208,15 @@
208208
;; 日期格式
209209
(tm-define (bib-format-date x)
210210
(:mode bib-gbt7714-2015?)
211-
;; GBT 7714-2015 仅使用年份,不含月份
212-
(let* ((y (bib-field x "year")))
213-
(if (bib-null? y) "" y)))
211+
;; 优先使用 date 字段;若没有则回退到 year;返回空字符串表示没有可用的日期信息
212+
(let* ((d (bib-field x "date"))
213+
(y (bib-field x "year"))
214+
(date-str (if (bib-null? d) y d)))
215+
(if (bib-null? date-str)
216+
""
217+
`(concat "(" ,date-str ")"))))
214218

215-
;; 书名格式
219+
;; 书名格式
216220
(tm-define (bib-format-in-ed-booktitle x)
217221
(:mode bib-gbt7714-2015?)
218222
(let* ((b (bib-default-field x "booktitle"))
@@ -266,13 +270,6 @@
266270
(sep (if (< (bib-text-length v) 3) `(nbsp) " ")))
267271
`(concat ,(bib-translate "volume") ,sep ,v ,series)))))
268272

269-
;; 重写技术报告编号格式
270-
(tm-define (bib-format-tr-number x)
271-
(:mode bib-gbt7714-2015?)
272-
;; GBT 7714-2015 不要求输出 "Technical Report",只输出报告编号
273-
(let* ((n (bib-field x "number")))
274-
(if (bib-null? n) "" n)))
275-
276273
;; URL/DOI 信息格式
277274
(tm-define (bib-format-url-doi x)
278275
(:mode bib-gbt7714-2015?)
@@ -509,11 +506,7 @@
509506
,(bib-document-type-identifier x "techreport")))
510507
,(bib-new-block
511508
(bib-new-sentence
512-
`(,(bib-format-tr-number x)
513-
,(bib-format-address-institution x)
514-
,(let* ((d (bib-field x "date"))
515-
(y (bib-field x "year"))
516-
(date-str (if (bib-null? d) y d)))
517-
(if (bib-null? date-str) "" `(concat "(" ,date-str ")"))))))
509+
`(,(bib-format-address-institution x)
510+
,(bib-format-date x))))
518511
,(bib-new-block (bib-format-field x "note"))
519512
,(bib-new-block (bib-format-url-doi x))))))

TeXmacs/tests/tmu/204_25.bib

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ @phdthesis{马欢2011
9797
address = {北京},
9898
year = {2011},
9999
pages = {27},
100-
url = {http://www.cnki.net/kcms/detail/detail.aspx?dbcode=CDFD&QueryID=0&CurRec=11&dbname=CDFDLAST2013&filename=1012035905.nh&uid=WEEvREcwSlJHSldTTGJhYlJRaEhGUXFQWVB6SGZXeisxdmVhV3ZyZkpoUnozeDE1b0paM0NmMjZiQ3p4TUdmcw=},
100+
url = {http://www.cnki.net/kcms/detail/detail.aspx?},
101101
urldate = {2013-10-14}
102102
}
103103

@@ -114,9 +114,7 @@ @techreport{国务院新闻办公室2013
114114
title = {国防白皮书:中国武装力量的多样化运用},
115115
date = {2013-04-16},
116116
urldate = {2014-06-11},
117-
url = {http://www.mod.gov.cn/affair/2013-04/16/content_4442839.htm},
118-
institution = {中华人民共和国国务院新闻办公室},
119-
address = {北京}
117+
url = {http://www.mod.gov.cn/affair/2013-04/16/content_4442839.htm}
120118
}
121119

122120
@misc{萧钰2001,

TeXmacs/tests/tmu/204_25.tmu

Lines changed: 10 additions & 7 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)