Skip to content

Commit

Permalink
Add option show.english.translation
Browse files Browse the repository at this point in the history
  • Loading branch information
zepinglee committed Mar 8, 2020
1 parent 9d1d1a4 commit d4c8adb
Show file tree
Hide file tree
Showing 18 changed files with 1,126 additions and 423 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- 增加选项 `title.in.journal`
- 增加选项 `space.before.pages`
- 增加选项 `abbreviate.journal`
- 增加选项 `show.english.translation`

## [v2.0] - 2020-03-04
### Changed
Expand Down
90 changes: 70 additions & 20 deletions gbt7714-author-year.bst
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ INTEGERS {
show.url
show.doi
show.note
show.english.translation
lang.zh.order
lang.ja.order
lang.en.order
Expand Down Expand Up @@ -68,6 +69,7 @@ FUNCTION {load.config}
#1 'show.url :=
#1 'show.doi :=
#0 'show.note :=
#0 'show.english.translation :=
#1 'lang.zh.order :=
#2 'lang.ja.order :=
#3 'lang.en.order :=
Expand Down Expand Up @@ -99,6 +101,7 @@ ENTRY
series
title
translator
translation
url
urldate
volume
Expand Down Expand Up @@ -280,6 +283,12 @@ FUNCTION {output.check}
FUNCTION {fin.entry}
{ add.period$
write$
show.english.translation entry.lang lang.zh = and
{ ")"
write$
}
'skip$
if$
newline$
}

Expand Down Expand Up @@ -1257,9 +1266,15 @@ FUNCTION {check.url}
}

FUNCTION {format.url}
{ entry.url
}

FUNCTION {output.url}
{ entry.url empty$ not
{ new.block entry.url }
{ "" }
{ new.block
entry.url output
}
'skip$
if$
}

Expand Down Expand Up @@ -1293,7 +1308,7 @@ FUNCTION {is.in.url}

FUNCTION {format.doi}
{ ""
doi empty$ not show.doi and
doi empty$ not
{ "" 's :=
doi 't :=
#0 'numnames :=
Expand Down Expand Up @@ -1321,11 +1336,16 @@ FUNCTION {format.doi}
t #2 global.max$ substring$ 't :=
}
while$
's :=
s empty$ not
{ new.block s }
{ "" }
if$
}
'skip$
if$
}

FUNCTION {output.doi}
{ doi empty$ not show.doi and
show.english.translation entry.lang lang.zh = and not and
{ new.block
format.doi output
}
'skip$
if$
Expand Down Expand Up @@ -1357,6 +1377,30 @@ FUNCTION {format.note}
if$
}

FUNCTION {output.translation}
{ show.english.translation entry.lang lang.zh = and
{ translation empty$ not
{ translation }
{ "[English translation missing!]" }
if$
" (in Chinese)" * output
write$
format.doi duplicate$ empty$ not
{ newline$
write$
}
'pop$
if$
" \\" write$
newline$
"(" write$
""
before.all 'output.state :=
}
'skip$
if$
}

FUNCTION {empty.misc.check}
{ author empty$ title empty$
year empty$
Expand All @@ -1369,6 +1413,7 @@ FUNCTION {empty.misc.check}

FUNCTION {monograph}
{ output.bibitem
output.translation
author empty$ not
{ format.authors }
{ editor empty$ not
Expand Down Expand Up @@ -1397,15 +1442,16 @@ FUNCTION {monograph}
format.address.publisher output
format.pages bbl.colon output.after
format.urldate "" output.after
format.url output
format.doi output
output.url
output.doi
new.block
format.note output
fin.entry
}

FUNCTION {incollection}
{ output.bibitem
output.translation
format.authors output
author format.key output
period.between.author.year
Expand All @@ -1429,15 +1475,16 @@ FUNCTION {incollection}
format.address.publisher output
format.pages bbl.colon output.after
format.urldate "" output.after
format.url output
format.doi output
output.url
output.doi
new.block
format.note output
fin.entry
}

FUNCTION {periodical}
{ output.bibitem
output.translation
format.authors output
author format.key output
period.between.author.year
Expand All @@ -1454,15 +1501,16 @@ FUNCTION {periodical}
new.block
format.address.publisher output
format.urldate "" output.after
format.url output
format.doi output
output.url
output.doi
new.block
format.note output
fin.entry
}

FUNCTION {article}
{ output.bibitem
output.translation
format.authors output
author format.key output
period.between.author.year
Expand All @@ -1484,15 +1532,16 @@ FUNCTION {article}
format.journal.number "" output.after
format.journal.pages "" output.after
format.urldate "" output.after
format.url output
format.doi output
output.url
output.doi
new.block
format.note output
fin.entry
}

FUNCTION {patent}
{ output.bibitem
output.translation
format.authors output
author format.key output
period.between.author.year
Expand All @@ -1507,8 +1556,8 @@ FUNCTION {patent}
new.block
format.date "year" output.check
format.urldate "" output.after
format.url output
format.doi output
output.url
output.doi
new.block
format.note output
fin.entry
Expand All @@ -1518,6 +1567,7 @@ FUNCTION {electronic}
{ #1 #1 check.electronic
#1 'entry.is.electronic :=
output.bibitem
output.translation
format.authors output
author format.key output
period.between.author.year
Expand All @@ -1534,8 +1584,8 @@ FUNCTION {electronic}
format.pages bbl.colon output.after
format.editdate "" output.after
format.urldate "" output.after
format.url output
format.doi output
output.url
output.doi
new.block
format.note output
fin.entry
Expand Down
Loading

0 comments on commit d4c8adb

Please sign in to comment.