Skip to content

Commit

Permalink
Add option only.start.page
Browse files Browse the repository at this point in the history
  • Loading branch information
zepinglee committed Mar 7, 2020
1 parent 5ad7a2f commit ae46fd5
Show file tree
Hide file tree
Showing 20 changed files with 1,020 additions and 193 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

## [Unreleased]
### Added
- 新增选项 `only.start.page`

## [v2.0] - 2020-03-04
### Changed
Expand Down
11 changes: 9 additions & 2 deletions gbt7714-author-year.bst
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ INTEGERS {
italic.jounal
bold.journal.volume
show.missing.address.publisher
only.start.page
show.url
show.doi
show.note
Expand All @@ -57,6 +58,7 @@ FUNCTION {load.config}
#0 'italic.jounal :=
#0 'bold.journal.volume :=
#1 'show.missing.address.publisher :=
#0 'only.start.page :=
#1 'show.url :=
#1 'show.doi :=
#0 'show.note :=
Expand Down Expand Up @@ -1107,7 +1109,12 @@ FUNCTION {hyphenate}
FUNCTION {format.pages}
{ pages empty$
{ "" }
{ pages hyphenate }
{ pages
only.start.page
'extract.before.dash
'hyphenate
if$
}
if$
}

Expand All @@ -1132,7 +1139,7 @@ FUNCTION {format.journal.number}
FUNCTION {format.journal.pages}
{ pages empty$
{ "" }
{ ":\penalty0 " pages hyphenate * }
{ ":\penalty0 " format.pages * }
if$
}

Expand Down
11 changes: 9 additions & 2 deletions gbt7714-numerical.bst
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ INTEGERS {
italic.jounal
bold.journal.volume
show.missing.address.publisher
only.start.page
show.url
show.doi
show.note
Expand All @@ -51,6 +52,7 @@ FUNCTION {load.config}
#0 'italic.jounal :=
#0 'bold.journal.volume :=
#1 'show.missing.address.publisher :=
#0 'only.start.page :=
#1 'show.url :=
#1 'show.doi :=
#0 'show.note :=
Expand Down Expand Up @@ -1096,7 +1098,12 @@ FUNCTION {hyphenate}
FUNCTION {format.pages}
{ pages empty$
{ "" }
{ pages hyphenate }
{ pages
only.start.page
'extract.before.dash
'hyphenate
if$
}
if$
}

Expand All @@ -1121,7 +1128,7 @@ FUNCTION {format.journal.number}
FUNCTION {format.journal.pages}
{ pages empty$
{ "" }
{ ":\penalty0 " pages hyphenate * }
{ ":\penalty0 " format.pages * }
if$
}

Expand Down
21 changes: 19 additions & 2 deletions gbt7714.dtx
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,7 @@
% show.medium.type & |#1| & 显示载体类型标识 \\
% italic.jounal & |#0| & 西文期刊名使用斜体 \\
% show.missing.address.publisher & |#1| & 出版项缺失时显示“出版者不详” \\
% only.start.page & |#0| & 只显示起始页码 \\
% show.url & |#1| & 显示 url \\
% show.doi & |#1| & 显示 doi \\
% show.note & |#0| & 显示 note 域的信息 \\
Expand Down Expand Up @@ -785,6 +786,7 @@ INTEGERS {
italic.jounal
bold.journal.volume
show.missing.address.publisher
only.start.page
show.url
show.doi
show.note
Expand Down Expand Up @@ -901,6 +903,16 @@ FUNCTION {load.config}
%</noslsn|thu|ustc>
% \end{macrocode}
%
% 页码是否只含起始页:
% \begin{macrocode}
%<*!only-start-page&!npr>
#0 'only.start.page :=
%</!only-start-page&!npr>
%<*only-start-page|npr>
#1 'only.start.page :=
%</only-start-page|npr>
% \end{macrocode}
%
% 是否著录 URL:
% \begin{macrocode}
#1 'show.url :=
Expand Down Expand Up @@ -2508,7 +2520,12 @@ FUNCTION {hyphenate}
FUNCTION {format.pages}
{ pages empty$
{ "" }
{ pages hyphenate }
{ pages
only.start.page
'extract.before.dash
'hyphenate
if$
}
if$
}
Expand Down Expand Up @@ -2541,7 +2558,7 @@ FUNCTION {format.journal.number}
FUNCTION {format.journal.pages}
{ pages empty$
{ "" }
{ ":\penalty0 " pages hyphenate * }
{ ":\penalty0 " format.pages * }
if$
}
Expand Down
2 changes: 1 addition & 1 deletion test/save.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ for file in $testfiledir/*.dtx; do

bblfile="$testdir/test.bbl";
stdfile="$testfiledir/$testname.bbl";
if ! diff -q "$bblfile" "$stdfile" 2> /dev/null; then
if ! diff -q "$bblfile" "$stdfile" > /dev/null; then
cp -f "$bblfile" "$stdfile";
fi
done
11 changes: 6 additions & 5 deletions test/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,13 @@ if [ -z "$1" ]; then
cp -f "$unpackdir/test.bst" "$testdir"
cp -f "$unpackdir/test.bib" "$testdir"

( cd $testdir; $bibtexexe test > /dev/null; )
( cd $testdir; if ! $bibtexexe test > /dev/null; then $bibtexexe test; fi )

bblfile="$testdir/test.bbl";
stdfile="$testfiledir/$testname.bbl";
if ! diff -q "$bblfile" "$stdfile" 2> /dev/null; then
echo "fails";
if ! diff -q "$bblfile" "$stdfile" > /dev/null 2> /dev/null; then
echo " fails";
cp -f "$bblfile" "$stdfile";
succuss=false;
fi
done
Expand All @@ -63,11 +64,11 @@ else

cp -f "$file" "$unpackdir"; # test bib file

( cd "$unpackdir"; $unpackexe $filename > /dev/null; )
( cd "$unpackdir"; $unpackexe $filename; )
cp -f "$unpackdir/test.bst" "$testdir";
cp -f "$unpackdir/test.bib" "$testdir";

( cd "$testdir"; latexmk -xelatex test > /dev/null; )
( cd "$testdir"; latexmk -xelatex test; )

bblfile="$testdir/test.bbl";
stdfile="$testfiledir/$testname.bbl";
Expand Down
Loading

0 comments on commit ae46fd5

Please sign in to comment.