diff options
author | Karl Berry <karl@freefriends.org> | 2022-12-12 21:07:17 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2022-12-12 21:07:17 +0000 |
commit | b1511fb94a322b9edc7c1ca91676cf5275d6bcae (patch) | |
tree | 646aaa75ba5e3739e5b3ecbbc42914d5631b0d97 /Master/texmf-dist/source | |
parent | a2a6f21e711bb27829653d592df98c8d9060a22a (diff) |
bibcop (12dec22)
git-svn-id: svn://tug.org/texlive/trunk@65257 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source')
-rw-r--r-- | Master/texmf-dist/source/latex/bibcop/bibcop.dtx | 346 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/bibcop/bibcop.ins | 55 |
2 files changed, 401 insertions, 0 deletions
diff --git a/Master/texmf-dist/source/latex/bibcop/bibcop.dtx b/Master/texmf-dist/source/latex/bibcop/bibcop.dtx new file mode 100644 index 00000000000..07d513b49fc --- /dev/null +++ b/Master/texmf-dist/source/latex/bibcop/bibcop.dtx @@ -0,0 +1,346 @@ +% \iffalse meta-comment +% (The MIT License) +% +% Copyright (c) 2022 Yegor Bugayenko +% +% Permission is hereby granted, free of charge, to any person obtaining a copy +% of this software and associated documentation files (the 'Software'), to deal +% in the Software without restriction, including without limitation the rights +% to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +% copies of the Software, and to permit persons to whom the Software is +% furnished to do so, subject to the following conditions: +% +% The above copyright notice and this permission notice shall be included in all +% copies or substantial portions of the Software. +% +% THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +% IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +% FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +% AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +% LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +% OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +% SOFTWARE. +% \fi + +% \CheckSum{0} +% +% \CharacterTable +% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z +% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z +% Digits \0\1\2\3\4\5\6\7\8\9 +% Exclamation \! Double quote \" Hash (number) \# +% Dollar \$ Percent \% Ampersand \& +% Acute accent \' Left paren \( Right paren \) +% Asterisk \* Plus \+ Comma \, +% Minus \- Point \. Solidus \/ +% Colon \: Semicolon \; Less than \< +% Equals \= Greater than \> Question mark \? +% Commercial at \@ Left bracket \[ Backslash \\ +% Right bracket \] Circumflex \^ Underscore \_ +% Grave accent \` Left brace \{ Vertical bar \| +% Right brace \} Tilde \~} + +% \GetFileInfo{bibcop.dtx} +% \DoNotIndex{\endgroup,\begingroup,\let,\else,\s,\n,\r,\\,\1,\fi} + +% \iffalse +%<*driver> +\ProvidesFile{bibcop.dtx} +%</driver> +%<package>\NeedsTeXFormat{LaTeX2e} +%<package>\ProvidesPackage{bibcop} +%<*package> +[2022-12-12 0.0.2 Style Checker of Bibliography Files] +%</package> +%<*driver> +\documentclass{ltxdoc} +\usepackage[T1]{fontenc} +\usepackage[maxnames=1,minnames=1,maxbibnames=1,natbib=true,citestyle=authoryear,bibstyle=authoryear,doi=false,url=false,isbn=false,isbn=false]{biblatex} +\addbibresource{bibcop.bib} +\usepackage[tt=false, type1=true]{libertine} +\usepackage{microtype} +\AddToHook{env/verbatim/begin}{\microtypesetup{protrusion=false}} +\usepackage{href-ul} +\usepackage{xcolor} +\usepackage{graphicx} +\PageIndex +\EnableCrossrefs +\CodelineIndex +\RecordChanges +\begin{document} + \DocInput{bibcop.dtx} + \PrintChanges + \PrintIndex +\end{document} +%</driver> +% \fi + +% \title{\includegraphics[height=1in]{bibcop-logo.pdf} \\ |bibcop|: \LaTeX{} Package \\ for Style Checking of |.bib| Files\thanks{The sources are in GitHub at \href{https://github.com/yegor256/bibcop}{yegor256/bibcop}}} +% \author{Yegor Bugayenko \\ \texttt{yegor256@gmail.com}} +% \date{\filedate, \fileversion} +% +% \maketitle +% +% \textbf{\color{red}NB!} +% You must run \TeX{} processor with |--shell-escape| option +% and you must have \href{https://www.perl.org}{Perl} installed. +% This package doesn't work on Windows. + +% \section{Introduction} +% +% This package scans your |.bib| files for style errors and emits +% warning messages if any issues are found (make sure you use it before +% all other bibliography related packages): +%\iffalse +%<*verb> +%\fi +\begin{verbatim} +\documentclass{article} +\usepackage{bibcop} +\begin{document} +\bibliographystyle{plain} +\bibliography{main} +\end{document} +\end{verbatim} +%\iffalse +%</verb> +%\fi +% You may see warnings in the \TeX log. Fix the issues in the |main.bib| file +% and the warnings will disappear. + +% If you use the |.sty| file (without installing it into the \TeX{} tree), don't forget +% to also copy the |bibcop.pl| file --- it is the Perl script that does all the work +% of checking your |.bib| files. The |.sty| is just a simple wrapper around it. + +% Make sure |\usepackage{bibcop}| stays before all other |\usepackage| commands, otherwise +% you won't see any warnings from |bibcop|. + +% \section{The Rules} + +% This is a more or less complete list of rules we enforce on a |.bib| file: + +% \DescribeMacro{types} +% Only |@article|, |@book|, |@inproceedings|, and |@misc| types of bib items are allowed. +% Everything else, like |@manual|, |@phdthesis|, and many others are simply prohibited. +% The mentioned four should be enough for everything. + +% \DescribeMacro{keys} +% There are pretty limited lists of allowed keys for each type of bib item. The keys +% that are not in the list are prohibited to use. + +% \DescribeMacro{doi} +% Every bib item must have the |doi| key, which is a unique +% \href{https://www.doi.org}{Digital Object Identifier} +% of the material that you reference. It seems to be a good practice, in order to avoid ambiguity, +% to always mention the DOI. + +% \DescribeMacro{caps} +% In |title|, |booktitle|, and |journal| keys, all major words must be capitalized, +% as it is \href{https://apastyle.apa.org/style-grammar-guidelines/capitalization/title-case}{recommended by APA}: +%\iffalse +%<*verb> +%\fi +\begin{verbatim} +title = {A Preliminary Architecture for a Basic Data-Flow Processor} +\end{verbatim} +%\iffalse +%</verb> +%\fi +% Here, the leading ``|A|'' is capital because it opens the title. +% The word ``|for|'' and the article ``|a|'' are minor words, that's why they are in lower case. +% Both parts of the composite word ``|Data-Flow|'' are capitalized. + +% \DescribeMacro{author} +% The |author| must contain a list of authors separated by ``|and|''. Each author +% must have two parts separated by a comma. The first part is the last name of the author, +% the second part is a list of their first names separated by a space, for example: +%\iffalse +%<*verb> +%\fi +\begin{verbatim} +author = {Knuth, Donald E. and Duane, Bibby} +\end{verbatim} +%\iffalse +%</verb> +%\fi +% When the list of authors is too long, it's possible to say ``|and others|'': +%\iffalse +%<*verb> +%\fi +\begin{verbatim} +author = {Knuth, Donald E. and others} +\end{verbatim} +%\iffalse +%</verb> +%\fi +% When first names are shortened to a single letter, it has to have a tailing dot. + +% \DescribeMacro{shorts} +% It is not allowed to shorten any words, for example this is illegal: +%\iffalse +%<*verb> +%\fi +\begin{verbatim} +journal = {J. Log. Comput.} +\end{verbatim} +%\iffalse +%</verb> +%\fi +% This must be replaced with the following: +%\iffalse +%<*verb> +%\fi +\begin{verbatim} +journal = {Journal of Logic and Computation} +\end{verbatim} +%\iffalse +%</verb> +%\fi + +% \DescribeMacro{brackets} +% The |title|, |booktitle|, and |journal| must be wrapped with double brackets, for example: +%\iffalse +%<*verb> +%\fi +\begin{verbatim} +title = {{A Survey of Symbolic Execution Techniques}} +\end{verbatim} +%\iffalse +%</verb> +%\fi +% This is necessary in order to prevent down-casing of capitalized words, which is done by some +% bibliography styles. + +% \DescribeMacro{year} +% It is not allowed to mention the year inside the title of a conference or a journal, for example, +% this would be illegal: +%\iffalse +%<*verb> +%\fi +\begin{verbatim} +booktitle = {{1994 IEEE International Conference on Computer Languages}}, +\end{verbatim} +%\iffalse +%</verb> +%\fi +% The year should only be mentioned in the |year| key, nowhere else. +% In the |year| key only numbers are allowed: +%\iffalse +%<*verb> +%\fi +\begin{verbatim} +year = {1994}, +\end{verbatim} +%\iffalse +%</verb> +%\fi + +% \DescribeMacro{month} +% The |month| may contain only a number: +%\iffalse +%<*verb> +%\fi +\begin{verbatim} +month = {12}, +\end{verbatim} +%\iffalse +%</verb> +%\fi + +% \DescribeMacro{volume} +% The |volume| may contain only a number: +%\iffalse +%<*verb> +%\fi +\begin{verbatim} +volume = {32}, +\end{verbatim} +%\iffalse +%</verb> +%\fi + +% \DescribeMacro{pages} +% The |pages| may contain either a number or two numbers separated by a double dash: +%\iffalse +%<*verb> +%\fi +\begin{verbatim} +pages = {145--163}, +\end{verbatim} +%\iffalse +%</verb> +%\fi + +% \DescribeMacro{proceedings} +% The |booktitle| in the |@inproceedings| bib item must always start with ``|Proceedings| |of| |the|'', +% as in this example: +%\iffalse +%<*verb> +%\fi +\begin{verbatim} +booktitle = {{Proceedings of the International + Conference on Computer Languages}}, +\end{verbatim} +%\iffalse +%</verb> +%\fi + +% \StopEventually{} + +% \section{Implementation} +% \changes{0.0.1}{2022/12/11}{First draft.} +% \changes{0.0.2}{2022/12/12}{Documentation extended, more rules added.} + +% First, we include a few packages. +% We need \href{https://ctan.org/pkg/iexec}{iexec} for executing Perl scripts: +% \begin{macrocode} +\RequirePackage{iexec} +% \end{macrocode} + +% \begin{macro}{bibcop.pl} +% Then, we copy the Perl script using |\VerbatimCopy| from +% \href{https://ctan.org/pkg/verbatimcopy}{verbatimcopy}: +% \begin{macrocode} +\RequirePackage{verbatimcopy} +\VerbatimCopy{bibcop.pl}{bibcop.tmp.pl} +\message{bibcop: File with Perl script 'bibcop.pl' copied^^J}% +% \end{macrocode} +% \end{macro} + +% \begin{macro}{\bibliography} +% Then, we re-define the |\bibliography| command: +% \begin{macrocode} +\makeatletter +\ifdefined\bibliography\else\gdef\bibliography#1{}\fi +\let\bibcop@oldbibliography\bibliography +\renewcommand\bibliography[1]{% + \iexec{perl "./bibcop.tmp.pl" --latex '#1.bib'}% + \bibcop@oldbibliography{#1}% +} +\makeatother +% \end{macrocode} +% \end{macro} + +% \begin{macro}{\addbibresource} +% Then, we re-define the |\addbibresource| command: +% \begin{macrocode} +\makeatletter +\ifdefined\addbibresource\else\gdef\addbibresource#1{}\fi +\let\bibcop@oldaddbibresource\addbibresource +\renewcommand\addbibresource[1]{% + \iexec{perl "./bibcop.tmp.pl" --latex '#1'}% + \bibcop@oldaddbibresource{#1}% +} +\makeatother +% \end{macrocode} +% \end{macro} + +% \Finale + +% \clearpage +% \printbibliography +% \clearpage + +% \PrintChanges +% \clearpage +% \PrintIndex diff --git a/Master/texmf-dist/source/latex/bibcop/bibcop.ins b/Master/texmf-dist/source/latex/bibcop/bibcop.ins new file mode 100644 index 00000000000..4c619469dd8 --- /dev/null +++ b/Master/texmf-dist/source/latex/bibcop/bibcop.ins @@ -0,0 +1,55 @@ +%% (The MIT License) +%% +%% Copyright (c) 2022 Yegor Bugayenko +%% +%% Permission is hereby granted, free of charge, to any person obtaining a copy +%% of this software and associated documentation files (the 'Software'), to deal +%% in the Software without restriction, including without limitation the rights +%% to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +%% copies of the Software, and to permit persons to whom the Software is +%% furnished to do so, subject to the following conditions: +%% +%% The above copyright notice and this permission notice shall be included in all +%% copies or substantial portions of the Software. +%% +%% THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +%% IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +%% FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +%% AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +%% LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +%% OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +%% SOFTWARE. + +\input docstrip.tex +\keepsilent +\usedir{macros/latex/contrib/bibcop} +\preamble +(The MIT License) + +Copyright (c) 2022 Yegor Bugayenko + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the 'Software'), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +\endpreamble +\generate{\file{bibcop.sty}{\from{bibcop.dtx}{package}}} +\obeyspaces +\Msg{To finish the installation you have to move the ".sty"} +\Msg{file into a directory searched by TeX. To produce the} +\Msg{documentation run the file ".dtx" through LaTeX. If any} +\Msg{questions, submit a new GitHub issue.} +\endbatchfile |