Skip to content

Commit

Permalink
Fix year suffix overflow (Fix #90)
Browse files Browse the repository at this point in the history
  • Loading branch information
zepinglee committed Dec 8, 2021
1 parent ffe75b5 commit 12d79cd
Show file tree
Hide file tree
Showing 15 changed files with 1,682 additions and 72 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
## [Unreleased]
### Fixed
- 修正了只有 `howpublished` 时的 URL 显示问题(stone-zeng/fduthesis#218)。
- 修正了出版年后缀超出“z”的问题(#90)。

## [v2.1.2] - 2021-06-20
### Added
Expand Down
28 changes: 22 additions & 6 deletions gbt7714-author-year.bst
Original file line number Diff line number Diff line change
Expand Up @@ -2431,25 +2431,41 @@ FUNCTION {presort}
'sort.key$ :=
}

STRINGS { longest.label last.label next.extra }
STRINGS { longest.label last.label next.extra last.extra.label }

INTEGERS { longest.label.width last.extra.num number.label }
INTEGERS { longest.label.width number.label }

FUNCTION {initialize.longest.label}
{ "" 'longest.label :=
#0 int.to.chr$ 'last.label :=
"" 'next.extra :=
#0 'longest.label.width :=
#0 'last.extra.num :=
#0 'number.label :=
"" 'last.extra.label :=
}

FUNCTION {forward.pass}
{ last.label short.label =
{ last.extra.num #1 + 'last.extra.num :=
last.extra.num int.to.chr$ 'extra.label :=
{ "" 'extra.label :=
last.extra.label text.length$ 'charptr :=
{ last.extra.label charptr #1 substring$ "z" =
charptr #0 > and
}
{ "a" extra.label * 'extra.label :=
charptr #1 - 'charptr :=
}
while$
charptr #0 >
{ last.extra.label charptr #1 substring$ chr.to.int$ #1 + int.to.chr$
extra.label * 'extra.label :=
last.extra.label #1 charptr #1 - substring$
extra.label * 'extra.label :=
}
{ "a" extra.label * 'extra.label := }
if$
extra.label 'last.extra.label :=
}
{ "a" chr.to.int$ 'last.extra.num :=
{ "a" 'last.extra.label :=
"" 'extra.label :=
short.label 'last.label :=
}
Expand Down
28 changes: 22 additions & 6 deletions gbt7714-numerical.bst
Original file line number Diff line number Diff line change
Expand Up @@ -2272,25 +2272,41 @@ FUNCTION {presort}
'sort.key$ :=
}

STRINGS { longest.label last.label next.extra }
STRINGS { longest.label last.label next.extra last.extra.label }

INTEGERS { longest.label.width last.extra.num number.label }
INTEGERS { longest.label.width number.label }

FUNCTION {initialize.longest.label}
{ "" 'longest.label :=
#0 int.to.chr$ 'last.label :=
"" 'next.extra :=
#0 'longest.label.width :=
#0 'last.extra.num :=
#0 'number.label :=
"" 'last.extra.label :=
}

FUNCTION {forward.pass}
{ last.label short.label =
{ last.extra.num #1 + 'last.extra.num :=
last.extra.num int.to.chr$ 'extra.label :=
{ "" 'extra.label :=
last.extra.label text.length$ 'charptr :=
{ last.extra.label charptr #1 substring$ "z" =
charptr #0 > and
}
{ "a" extra.label * 'extra.label :=
charptr #1 - 'charptr :=
}
while$
charptr #0 >
{ last.extra.label charptr #1 substring$ chr.to.int$ #1 + int.to.chr$
extra.label * 'extra.label :=
last.extra.label #1 charptr #1 - substring$
extra.label * 'extra.label :=
}
{ "a" extra.label * 'extra.label := }
if$
extra.label 'last.extra.label :=
}
{ "a" chr.to.int$ 'last.extra.num :=
{ "a" 'last.extra.label :=
"" 'extra.label :=
short.label 'last.label :=
}
Expand Down
28 changes: 22 additions & 6 deletions gbt7714.dtx
Original file line number Diff line number Diff line change
Expand Up @@ -4510,25 +4510,41 @@ FUNCTION {presort}
% END
% \end{pseudocode}
% \begin{macrocode}
STRINGS { longest.label last.label next.extra }
STRINGS { longest.label last.label next.extra last.extra.label }

INTEGERS { longest.label.width last.extra.num number.label }
INTEGERS { longest.label.width number.label }

FUNCTION {initialize.longest.label}
{ "" 'longest.label :=
#0 int.to.chr$ 'last.label :=
"" 'next.extra :=
#0 'longest.label.width :=
#0 'last.extra.num :=
#0 'number.label :=
"" 'last.extra.label :=
}

FUNCTION {forward.pass}
{ last.label short.label =
{ last.extra.num #1 + 'last.extra.num :=
last.extra.num int.to.chr$ 'extra.label :=
{ "" 'extra.label :=
last.extra.label text.length$ 'charptr :=
{ last.extra.label charptr #1 substring$ "z" =
charptr #0 > and
}
{ "a" extra.label * 'extra.label :=
charptr #1 - 'charptr :=
}
while$
charptr #0 >
{ last.extra.label charptr #1 substring$ chr.to.int$ #1 + int.to.chr$
extra.label * 'extra.label :=
last.extra.label #1 charptr #1 - substring$
extra.label * 'extra.label :=
}
{ "a" extra.label * 'extra.label := }
if$
extra.label 'last.extra.label :=
}
{ "a" chr.to.int$ 'last.extra.num :=
{ "a" 'last.extra.label :=
"" 'extra.label :=
short.label 'last.label :=
}
Expand Down
Loading

0 comments on commit 12d79cd

Please sign in to comment.