From a93a5e037eee9f7e2e45671fb2be9b825ec7d9f0 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Thu, 31 Mar 2011 00:27:41 +0000 Subject: new latex package bibleref-parse (30mar11) git-svn-id: svn://tug.org/texlive/trunk@21895 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/doc/latex/bibleref-parse/README | 15 + .../doc/latex/bibleref-parse/bibleref-parse.pdf | Bin 0 -> 110530 bytes .../doc/latex/bibleref-parse/bibleref-parse.tex | 499 +++++++ .../tex/latex/bibleref-parse/bibleref-parse.sty | 1358 ++++++++++++++++++++ Master/tlpkg/bin/tlpkg-ctan-check | 3 +- Master/tlpkg/tlpsrc/bibleref-parse.tlpsrc | 0 Master/tlpkg/tlpsrc/collection-humanities.tlpsrc | 1 + 7 files changed, 1875 insertions(+), 1 deletion(-) create mode 100644 Master/texmf-dist/doc/latex/bibleref-parse/README create mode 100644 Master/texmf-dist/doc/latex/bibleref-parse/bibleref-parse.pdf create mode 100644 Master/texmf-dist/doc/latex/bibleref-parse/bibleref-parse.tex create mode 100644 Master/texmf-dist/tex/latex/bibleref-parse/bibleref-parse.sty create mode 100644 Master/tlpkg/tlpsrc/bibleref-parse.tlpsrc diff --git a/Master/texmf-dist/doc/latex/bibleref-parse/README b/Master/texmf-dist/doc/latex/bibleref-parse/README new file mode 100644 index 00000000000..839b1fcd265 --- /dev/null +++ b/Master/texmf-dist/doc/latex/bibleref-parse/README @@ -0,0 +1,15 @@ +The bibleref-parse package + +This package parses Bible passages that are given in human readable format. +It accepts a wide variety of formats. This allows for a simpler and more +convenient interface to the functionality of the bibleref package. + +Copyright (c) 2011 Sebastian Kuhnert +Licence: LPPL 1.3c or later +Current Maintainer: Sebastian Kuhnert + +Files belonging to this package: +bibleref-parse.sty The package itself +bibleref-parse.pdf Documentation +bibleref-parse.tex Documentation source +README This file diff --git a/Master/texmf-dist/doc/latex/bibleref-parse/bibleref-parse.pdf b/Master/texmf-dist/doc/latex/bibleref-parse/bibleref-parse.pdf new file mode 100644 index 00000000000..c11797bb17f Binary files /dev/null and b/Master/texmf-dist/doc/latex/bibleref-parse/bibleref-parse.pdf differ diff --git a/Master/texmf-dist/doc/latex/bibleref-parse/bibleref-parse.tex b/Master/texmf-dist/doc/latex/bibleref-parse/bibleref-parse.tex new file mode 100644 index 00000000000..76838279bfb --- /dev/null +++ b/Master/texmf-dist/doc/latex/bibleref-parse/bibleref-parse.tex @@ -0,0 +1,499 @@ +%% bibleref-parse.tex +%% Copyright (c) 2011 Sebastian Kuhnert +% +% This work may be distributed and/or modified under the conditions +% of the LaTeX Project Public License, either version 1.3c of this +% license or (at your option) any later version. The latest version +% of this license is at http://www.latex-project.org/lppl.txt +% and version 1.3c or later is part of all distributions of LaTeX +% version 2008/05/04 or later. +% +% This work has the LPPL maintenance status `maintained'. +% +% The Current Maintainer of this work is Sebastian Kuhnert. +% +% This work consists of the files listed in README +% +\documentclass[DIV12,BCOR0mm]{scrartcl} + +\frenchspacing + +\usepackage[T1]{fontenc} +\usepackage{bera} +\usepackage[bitstream-charter]{mathdesign} + +\usepackage[utf8]{inputenc} +\usepackage[ngerman,british]{babel} + +\addtokomafont{disposition}{\rmfamily} +\addtokomafont{descriptionlabel}{\rmfamily} + +\usepackage{csquotes} +\usepackage{xspace} +\usepackage{xcolor} +\usepackage{calc} +\usepackage{listings} +\lstloadlanguages{TeX} +\lstset{% + language=[LaTeX]TeX, + basicstyle=\ttfamily\color{blue!50!black}, + keywordstyle=,%\bfseries, + morekeywords={subject}, + identifierstyle=, + texcl, + commentstyle=\itshape, + showstringspaces=false, + breaklines, + breakatwhitespace, + %columns=flexible, + escapeinside={(*}{*)}, + mathescape, +} +\usepackage[raggedrightboxes]{ragged2e} +\usepackage{booktabs} +\newcommand{\thead}[1]{\textbf{\small #1}} +% \usepackage{xtab} +\usepackage{longtable} +\usepackage{pgffor} + +\usepackage[pdfusetitle]{hyperref} + +\newcommand{\ger}[1]{\foreignlanguage{ngerman}{#1}} + +\newcommand{\brp}{\texttt{bibleref-parse}\xspace} + +\newcommand{\param}[1]{$\langle${\normalfont\itshape #1\/}$\rangle$} +\newcommand{\opt}[1]{\textcolor{green!50!black}{#1}} +\newcommand{\option}[1]{{\normalfont\texttt{\color{blue!50!black}#1}}} + +\usepackage{bibleref-parse} +\usepackage[english]{isodate} + +\def\bbtGetInfo#1 v#2 #3\relax#4\relax{% + \def\bbtdate{#1}% + \def\bbtversion{#2}} +\letcs\bbtver{ver@bibleref-parse.sty} +\expandafter\bbtGetInfo\bbtver\relax? ? \relax\relax + +\title{The \brp Package} +\author{Sebastian Kuhnert} +\date{Documentation for version \bbtversion{} (\printdateTeX{\bbtdate})} + +\begin{document} +\maketitle + +\section{Introduction} + +The \brp package parses Bible passages that are given in human readable format. +It accepts a wide variety of formats. This allows for a simpler and more +convenient interface to the functionality of the \texttt{bibleref} package, +which provides a variety of different formatting options. + +\begin{center} + \begin{tabular}{@{}lll@{}} + \toprule + \thead{\brp syntax}&\thead{\texttt{bibleref} syntax}&\thead{result (using defaults)}\\ + \midrule + \texttt{\textbackslash pbibleverse\{1Cor 13:4-7\}}& + \texttt{\textbackslash bibleverse\{ICor\}(13:4-7)}& + \pbibleverse{1Cor 13:4-7}\\ + \texttt{\textbackslash pbibleverse\{Matt 9:35-10:1\}}& + \texttt{\textbackslash bibleverse\{Matt\}(9:35)-(10:1)}& + \pbibleverse{Matt 9:35-10:1}\\ + %\texttt{\textbackslash pbibleverse\{Jes53:6;Joh19:30\}}& + %\texttt{\textbackslash bibleverse\{Jes\}(53:6); \textbackslash bibleverse\{Joh\}(19:30)}\\ + \bottomrule + \end{tabular} +\end{center} + +\noindent +Additionally, this package provides an interface for other packages. + + + +\subsection{Licence} +Copyright \textcopyright{} 2011 Sebastian Kuhnert. Permission is granted to +copy, distribute and/or modify this software under the terms of the \LaTeX{} +Project Public Licence, version 1.3c or later. This package is maintained, the +Current Maintainer is Sebastian +Kuhnert\footnote{\href{mailto:mail@sebastian-kuhnert.de}{mail@sebastian-kuhnert.de}}. + +%\subsection{Contributions} + +\subsection{Dependencies and interaction with other packages} + +\begin{itemize} + \item This package enhances and requires the \texttt{bibleref} package. + \item If the \texttt{babel} package is loaded and one of the languages + \texttt{ngerman}, \texttt{german}, \texttt{naustrian}, or \texttt{austrian} is + selected, the book name \enquote{Pr} is taken as a shorthand for + \emph{\ger{Prediger}} (German for \emph{Ecclesiastes}). Otherwise, \enquote{Pr} is a + shorthand for \emph{Proverbs}. + \item The \texttt{etoolbox} package is required. In particular, you need to use + an \eTeX{} engine, but that should be no real restriction nowadays. + \item The \texttt{scrlfile} package is used to ease the interaction with + \texttt{babel} and \texttt{bibleref-german}. +\end{itemize} + +\subsection{Contributions} +Currently only English and German book names are supported. I would welcome +contributions of book name prefixes for other languages. + + +\section{User commands} + +\begin{lstlisting} +\usepackage(*\opt{[\param{options}]}*){bibleref-parse} +\end{lstlisting} +This loads the \brp package. Currently the only option is +\option{comma=\param{value}}. It controls how commas in a Bible passage +specification are handled: +\bigskip +\begin{center} + \begin{tabular}{@{}p{.18\linewidth}p{.78\linewidth}@{}} + \toprule + \thead{\param{\bfseries value}}&\thead{meaning of \option{\bfseries + comma=\param{\bfseries value}}}\\ + \midrule + \option{list}&The comma is used as a list separator. Behind each + comma, + a number specifying a chapter or a verse is expected. + \hfill\emph{Example:~Mt~5,6,7} + \\\addlinespace + \option{chvsep}&The comma is used to separate a chapter number from a + verse number. This is common in German. + \hfill\emph{Example:~Jh~3,16}\\\addlinespace + \option{likeBR}&This takes the current setup of the \texttt{bibleref} + package into account. If \lstinline|\BRchvsep| contains a comma, this + option behaves like \option{chvsep}, otherwise it behaves like + \option{list}.\\\addlinespace + \option{preferchvsep}&This behaves like \option{chvsep} unless the + specified passage contains a colon. In that case, it behaves like + \option{list}.\\\addlinespace + \option{preferlikeBR}\linebreak\emph{(the default)}&If + \lstinline|\BRchvsep| contains a comma, this behaves like + \option{preferchvsep}. Otherwise this behaves like + \option{list}.\\ + \bottomrule + \end{tabular} +\end{center} + +\begin{lstlisting} +\biblerefparseset{(*\param{options}*)} +\end{lstlisting} +This sets the \param{options}, affecting all following passage specifications in +the current group. + +\begin{lstlisting} +\pbibleverse(*\opt{[\param{options}]}\{\param{passage}*)} +\end{lstlisting} +This parses the given \param{passage} and passes the result to the +\lstinline|\bibleverse| macro, formatting it according to the rules of the of +the \texttt{bibleref} package. If any \param{options} are specified, they affect +this single \param{passage} only. + +If a \param{passage} spans more than one book, the different parts are +separated with \lstinline|\BRbksep|, which you can redefine to suit your needs. +The \texttt{bibleref} manual describes how you can otherwise influence the +formatting. + +Examples: +\newcommand{\bverseex}[2][]{% + \ifstrequal{#1}{}{% + \texttt{\textbackslash pbibleverse\{#2\}} & \pbibleverse{#2}% + }{% + \texttt{\textbackslash pbibleverse[#1]\{#2\}} & \pbibleverse[#1]{#2}% + }\\ +} + +\begin{center} + \begin{tabular}{@{}ll@{}} + \toprule + \thead{\TeX{} source}&\thead{Result}\\ + \midrule + \bverseex{Gen1:27} + \bverseex{Exo 20} + \bverseex[comma=chvsep]{Lev.5,3-4} + \bverseex{Jos 7,3-5;12;Jdg 4,2-4} + \bverseex{Ruth 3-4:4+4:6} + \bverseex{1Sam 5:3,5;6:3-7:3;8:3,5} + \bverseex{Obad 1-3,5,8-9} + \bottomrule + \end{tabular} +\end{center} + +\bigskip\noindent +There are variants of \lstinline|\pbibleverse| for the variants of \lstinline|\bibleverse|: +\begin{lstlisting} +\pibibleverse(*\opt{[\param{options}]}\{\param{passage}*)} % uses \textbackslash ibibleverse +\pibiblechvs(*\opt{[\param{options}]}\{\param{passage}*)} % uses \textbackslash ibiblechvs +\pibiblevs(*\opt{[\param{options}]}\{\param{passage}*)} % uses \textbackslash ibiblevs +\end{lstlisting} + +\subsection{Bible passage specification} + +The basic massage is: Just use your intuition. This is what this package was +created for.\\ +If you want more details, here they are. +\begin{itemize} + \item Depending on the current setting of the \option{comma} option (see + above), a single verse can be specified in one of these formats: +\begin{lstlisting} +(*{\normalfont\normalcolor Format 1:} \param{book} \param{chapter}:\param{verse}*) +(*{\normalfont\normalcolor Format 2:} \param{book} \param{chapter},\param{verse}*) +\end{lstlisting} + You can add or remove spaces between the different parts. + + The exact syntax for the book name can be looked up in + Section~\ref{sec:books}; but again the basic message is: Just use your + intuition. + + Examples:\qquad\option{Mark 16:5}\qquad + \option{1 Samuel 13:14}\qquad + \option{2Tim3: 16} + \item You can reference a \textbf{whole chapter or book} by omitting the verse + (and chapter) information. + + Examples:\qquad\option{1 John}\qquad + \option{Ps 51} + \item You can specify \textbf{ranges} using a single dash. This works for + ranges of verses as well as ranges of chapters. The start and the end verse do + not have to be in the same chapter. You even can have a chapter as start and a + verse as end (but not the other way around). + + Examples:\qquad + \option{Mt 28:18-20}\qquad + \option{Matthew 5-7}\qquad + \option{2Cor 6:10-7:4}\qquad + \option{Joshua 4-5:1} + \item You can \textbf{list} several passages in one specification. Several + options are available. They offer flexibility and differ in how the passage on + the right side should be specified: Some allow and some require that a partial + specification is used. + \begin{description} + \item[Semicolon] The next item may be a book or a chapter. + \item[Comma] The next item may be a chapter or a verse. (Format 1 only) + \item[Plus] The next item may be a book, a chapter or a verse. + \item[Dot] The next item must be a verse. + \end{description} + All of these have in common that you can use ranges on their left and on their + right side. Also, you can create lists of more than two single verses or range + specifications. + + Examples:\qquad + \option{Col 1:15,2:9.10}\qquad + \option{Ps 22+23}\qquad + \option{Rev 22:3-4.7;Acts 1:6-8} +\end{itemize} + +\subsection{Book name specification}\label{sec:books} +All names of canonical books given in English or German should be recognised, +including their abbreviations. The following table specifies the available names +for all books. +\clearpage +\def\checkbook#1#2#3{% + \csdef{brp@range}##1##2##3##4##5{\ifstrequal{##1}{#1}{#3 }{\textcolor{red}{#3} }}% + \csuse{brp@parse}{#2}% + \csuse{brp@result}% +} +\def\checkbooksilent#1#2{% + \csdef{brp@range}##1##2##3##4##5{\ifstrequal{##1}{#1}{}{\textcolor{red}{#2} }}% + \csuse{brp@parse}{#2}% + \csuse{brp@result}% +} +%\addrow{OSIS-name}{English names}{German names}{silent names} +\def\addrow#1#2#3#4{% + #1&\checkbooksilent{#1}{#1}% + \foreach \name in {#4} {% + \checkbooksilent{#1}{\name}% + }% + \foreach \name/\n in {#2} {% + \checkbook{#1}{\name}{\n}% + }&\ger{\foreach \name/\n in {#3} {% + \checkbook{#1}{\name}{\n}% + }}\\ +} +\begin{longtable}{@{}p{3.6em}p{.425\linewidth}p{.425\linewidth}@{}} + \toprule\thead{Book}&\thead{English names}&\thead{German names}\\\midrule + \endhead + \bottomrule + \endfoot + \addrow{Gen}{Genesis,Gen,Ge,Gn,Ge*,Gn*}{1Mose,1Mos,1Mo,Genesis,Gen,Ge,Gn,1Mo*,Ge*,Gn*}{IMose,IMos,IMo,IMo*} + \addrow{Exod}{Exodus,Exod,Ex,Ex*}{2Mose,2Mos,2Mo,Exodus,Ex,2Mo*,Ex*}{IIMose,IIMos,IIMo,IIMo*} + \addrow{Lev}{Leviticus,Lev,Lv,Le*,Lv*}{3Mose,3Mos,3Mo,Levitikus,Leviticus,Lev,Lv,3M*,Le*,Lv*}{IIIMose,IIIMos,IIIMo,IIIM*} + \addrow{Num}{Numbers,Num,Nb,Nu*,Nb*}{4Mose,4Mos,4Mo,Numeri,Num,4M*,Nu*}{IVMose,IVMos,IVMo,IV*} + \addrow{Deut}{Deuteronomy,Deut,Deu,Dt,De*,Dt*}{5Mose,5Mos,5Mo,Deuteronomium,Deut,Dtn,Deu,Dt,5M*,De*,Dt*}{VMose,VMos,VMo,V*} + \addrow{Josh}{Joshua,Josh,Jos,Jos*}{Josua,Jos*}{} + \addrow{Judg}{Judges,Judg,Jdg,Jg,Jd,Judg*,Jdg*,Jg*}{Richter,Ri,Ri*}{} + \addrow{Ruth}{Ruth,Rt,Ru*,Rt*}{Rut,Ruth,Rt,Ru,Ru*,Rt*}{} + \addrow{1Sam}{1Samuel,1Sam,1S,1S*}{1Samuel,1Sam,1S,1S*}{ISamuel,ISam,IS,IS*} + \addrow{2Sam}{2Samuel,2Sam,2S,2S*}{2Samuel,2Sam,2S,2S*}{IISamuel,IISam,IIS,IIS*} + \addrow{1Kgs}{1Kings,1K,1Kg,1Kgs,1Ki*,1Kg*}{1Könige,1Kön,1Kö,1Kö*}{IKings,IK,IKg,IKgs,IKi*,IKg*,IKönige,IKön,IKö,IKö*,IK\"onige,IK"on,IKoe,IK\"o*} + \addrow{2Kgs}{2Kings,2K,2Kg,2Kgs,2Ki*,2Kg*}{2Könige,2Kön,2Kö,2Kö*}{IIKings,IIK,IIKg,IIKgs,IIKi*,IIKg*,IIKönige,IIKön,IIKö,IIKö} + \addrow{1Chr}{1Chronicles,1Ch,1Chr,1Ch*}{1Chronik,1Chr,1Ch,1Ch*}{IChronicles,ICh,IChr,ICh*,IChronik} + \addrow{2Chr}{2Chronicles,2Ch,2Chr,2Ch*}{2Chronik,2Chr,2Ch,2Ch*}{IIChronicles,IICh,IIChr,IICh*,IIChronik} + \addrow{Ezra}{Ezra,Ezr,Ezr*}{Esra,Esr,Esr*}{} + \addrow{Neh}{Nehemiah,Neh,Ne,Ne*}{Nehemia,Nehemiah,Neh,Ne,Ne*}{} + \addrow{Esth}{Esther,Esth,Est,Est*}{Ester,Esther,Est,Est*}{} + \addrow{Job}{Job,Jb}{Hiob,Hi,Ijob,Hi*,Ij*}{} + \addrow{Ps}{Psalms,Psalm,Ps,Ps*}{Psalmen,Psalm,Psalter,Ps,Ps*}{} + \addrow{Prov}{Proverbs,Prov,Pro,Pr/Pr\textsuperscript{(see text)},Pro*}{Sprüche,Sprichwörter,Spr,Sp,Sp*}{} + \addrow{Eccl}{Ecclesiastes,Eccl,Ec,Qo,Ecl,Eccl,Eccle,Eccles,Ecclesiaste*,Q*}{Prediger,Pred,Pr/Pr\textsuperscript{(see text)},Kohelet,Koh,Pre*,Koh*}{Ecclesi,Ecclesia,Ecclesias,Ecclesiast} + \addrow{Song}{SongofSolomon,SongofSongs,SofS,Sg,So*,Sg*}{Hohelied,Hoheslied,HohesLied,Hld,Hhld,LiedderLieder,Lied,Hoh*,Hh*,Hl*,Li*}{} + \addrow{Isa}{Isaiah,Isa,Is,Is*}{Jesaja,Jesajah,Jes,Jesa*}{} + \addrow{Jer}{Jeremiah,Jer,Jr,Jer*,Jr*}{Jeremia,Jeremiah,Jer,Jr,Jer*,Jr*}{} + \addrow{Lam}{Lamentations,Lam,Lm,La*,Lm*}{Klagelieder,Klgl,Klg,Kl*}{} + \addrow{Ezek}{Ezekiel,Ezek,Ezk,Eze*,Ezk*}{Hesekiel,Hes,Ezechiel,Ez,Eze,Hes*,Eze*}{} + \addrow{Dan}{Daniel,Dan,Dn,Da*,Dn*}{Daniel,Dan,Dn,Da*,Dn*}{} + \addrow{Hos}{Hosea,Hos,Ho,Hos*}{Hosea,Hos,Ho,Hos*}{} + \addrow{Joel}{Joel,Jl,Joe*,Jl*}{Joel,Joël,Jl,Joe*,Joë*,Jl*}{Jo\"e*,Jo"e*} + \addrow{Amos}{Amos,Am,Am*}{Amos,Am,Am*}{} + \addrow{Obad}{Obadiah,Obad,Obd,Ob,Ob*}{Obadja,Obad,Obd,Ob,Ob*}{} + \addrow{Jonah}{Jonah,Jon,Jon*}{Jona,Jonah,Jon,Jon*}{} + \addrow{Mic}{Micah,Mic,Mi,Mi*}{Micha,Mic,Mi,Mi*}{} + \addrow{Nah}{Nahum,Nah,Na,Na*}{Nahum,Nah,Na,Na*}{} + \addrow{Hab}{Habakkuk,Hab,Hbk,Hak,Hab*,Hb*,Hak*}{Habakuk,Hab,Hbk,Hak,Hab*,Hb*,Hak*}{} + \addrow{Zeph}{Zephaniah,Zeph,Zp,Zep*,Zp*}{Zefanja,Zefanjah,Zef,Zef*}{} + \addrow{Hag}{Haggai,Hag,Hg,Hag*,Hg*}{Haggai,Hag,Hg,Hag*,Hg*}{} + \addrow{Zech}{Zechariah,Zech,Zc,Zec*,Zc*}{Sacharja,Sacharjah,Sach,Sa,Sa*}{} + \addrow{Mal}{Malachi,Mal,Ml,Mal*,Ml*}{Maleachi,Mal,Ml,Mal*,Ml*}{} + %\midrule + \addrow{Matt}{Matthew,Matt,Mt,Mat*,Mt*}{Matthäus,Matt,Mt,Mat*,Mt*}{} + \addrow{Mark}{Mark,Mk,Mar*,Mk*}{Markus,Mk,Mar*,Mk*}{} + \addrow{Luke}{Luke,Lk,Lu*,Lk*}{Lukas,Lk,Lu*,Lk*}{} + \addrow{John}{John,Joh,Jn,Joh*,Jn*}{Johannes,Joh,Jh,Joh*,Jn*}{} + \addrow{Acts}{Acts,Ac,Ac*}{Apostelgeschichte,Apo,Apg,Apos*,Apg*}{} + \addrow{Rom}{Romans,Rom,Ro,Rm,Ro*,Rm*}{Römer,Röm,Rö}{Roemer,R\"omer,R"omer,Roem,R\"om,R"om,Roe,R\"o,R"o,Roe*,R\"o*,R"o*} + \addrow{1Cor}{1Corinthians,1Co,1Cor,1Co*}{1Korinther,1Kor,1Ko,1Kor*}{ICorinthians,ICo,ICor,ICo*,IKorinther,IKor,IKo,IKor*} + \addrow{2Cor}{2Corinthians,2Co,2Cor,2Co*}{2Korinther,2Kor,2Ko,2Kor*}{IICorinthians,IICo,IICor,IICo*,IIKorinther,IIKor,IIKo,IIKor*} + \addrow{Gal}{Galatians,Gal,Ga,Ga*}{Galater,Gal,Ga,Ga*}{} + \addrow{Eph}{Ephesians,Eph,Ep,Eph*}{Epheser,Eph,Eph*}{} + \addrow{Phil}{Philippians,Phil,Phi,Ph,Phili*}{Philipper,Phil,Phi,Ph,Phili*}{} + \addrow{Col}{Colossians,Col,C*}{Kolosser,Kol,Kol*}{} + \addrow{1Thess}{1Thessalonians,1Thess,1Th,1Th*}{1Thessalonicher,1Thessaloniker,1Thess,1Th,1Th*}{IThessalonians,IThess,ITh,ITh*,IThessalonicher,IThessaloniker} + \addrow{2Thess}{2Thessalonians,2Thess,2Th,2Th*}{2Thessaloniker,2Thess,2Th,2Th*}{IIThessalonians,IIThess,IITh,IITh*,IIThessaloniker} + \addrow{1Tim}{1Timothy,1Tim,1Tm,1Ti*,1Tm*}{1Timotheus,1Tim,1Tm,1Ti*,1Tm*}{ITimothy,ITim,ITm,ITi*,ITm*,ITimotheus} + \addrow{2Tim}{2Timothy,2Tim,2Tm,2Ti*,2Tm*}{2Timotheus,2Tim,2Tm,2Ti*,2Tm*}{IITimothy,IITim,IITm,IITi*,IITm*,IITimotheus} + \addrow{Titus}{Titus,Tit,Tt,Tit*,Tt*}{Titus,Tit,Tt,Tit*,Tt*}{} + \addrow{Phlm}{Philemon,Philem,Phlm,Phm,Phile*,Phl*,Phm*}{Philemon,Philem,Phlm,Phm,Phile*,Phl*,Phm*}{} + \addrow{Heb}{Hebrews,Hebr,Heb,He,Heb*}{Hebräer,Hebr,Heb,He,Heb*}{Hebraeer,Hebr\"aer,Hebr"aer} + \addrow{Jas}{James,Jas,Js,Jm,Ja*,Js*,Jm*}{Jakobus,Jak,Jk,Ja,Ja*,Jk*}{} + \addrow{1Pet}{1Peter,1Pet,1Pt,1P,1P*}{1Petrus,1Petr,1Pet,1Pt,1P*}{IPeter,IPet,IPt,IP,IP*} + \addrow{2Pet}{2Peter,2Pet,2Pt,2P,2P*}{2Petrus,2Petr,2Pet,2Pt,2P*}{IIPeter,IIPet,IIPt,IIP,IIP*} + \addrow{1John}{1John,1Joh,1Jo,1Jo*,1Jn*}{1Johannes,1Joh,1Jh,1Jo*,1Jh*}{IJohn,IJoh,IJo,IJo*,IJn*,IJohannes,IJh,IJh*} + \addrow{2John}{2John,2Joh,2Jo,2Jo*,2Jn*}{2Johannes,2Joh,2Jh,2Jo*,2Jh*}{IIJohn,IIJoh,IIJo,IIJo*,IIJn*,IIJohannes,IIJh,IIJh*} + \addrow{3John}{3John,3Joh,3Jo,3Jo*,3Jn*}{3Johannes,3Joh,3Jh,3Jo*,3Jh*}{IIIJohn,IIIJoh,IIIJo,IIIJo*,IIIJn*,IIIJohannes,IIIJh,IIIJh*} + \addrow{Jude}{Jude,Jud,Jude*}{Judas,Jud,Juda*}{} + \addrow{Rev}{Revelation,Rev,Rv,Rev*,Rv*}{Offenbarung,Offb,Ofb,Apokalypse,Apok,Apk,Of*,Apok*,Apk*}{} + \midrule + \addrow{Tob}{Tobit,Tob,To*}{Tobit,Tobias,Tob,To*}{} + \addrow{Jdt}{Judith,Jdt,Judi*,Jdt*}{Judit,Judith,Jdt,Judi*,Jdt*}{} + \addrow{AddEsth}{GreekEsther,GrEst,AddEst,AdditionstoE*,AdditionsE*,AddE*,GreekE*,GrE*}{StückezuEster,StückeEster,StEst,GrEst,StückezuE*,StückeE*,StE*}{StueckezuE*,StueckeE*,St\"uckezuE*,St\"uckeE*,St"uckezuE*,St"uckeE*,AdditionstoEsther} + \addrow{Wis}{Wisdom,WisdomofSolomon,W*}{Weisheit,WeisheitSalomos,Weish,W*}{} + \addrow{Sir}{Sirach,Ecclesiasticus,Si*,Ecclesiasti*,Ecclu*}{Sirach,JesusSirach,Si*,JesusS*}{} + \addrow{Bar}{Baruch,Ba*}{Baruch,Ba*}{} + \addrow{EpJer}{EpistleofJeremiah,EpistleJeremiah,EpJer,EpistleofJer*,EpistleJer*,EpJer*}{BriefdesJeremia,BriefJeremias,BrJer,BriefdesJer*,BriefJer*,BrJer*}{} + \addrow{AddDan}{AddDan,GreekDaniel,GrDan,AdditionstoD*,AdditionsD*,AddD*,GreekD*,GrD*}{StückezuDaniel,StückeDaniel,StDan,GrDan,StückezuD*,StückeD*,StD*}{StueckezuD*,StueckeD*,St\"uckezuD*,St\"uckeD*,St"uckezuD*,St"uckeD*,AdditionstoDaniel} + \addrow{1Macc}{1Maccabees,1Ma*}{1Makkabäer,1Makk,1Ma*}{IMa*} + \addrow{2Macc}{2Maccabees,2Ma*}{2Makkabäer,2Makk,2Ma*}{IIMa*} +\end{longtable} +\clearpage +\noindent Some remarks regarding the book name table: +\begin{itemize} + \item If an entry ends with a *, you can use any continuation of the given + prefix. However, it is recommended that you stick to standard names, as the + package might be extended to further languages in the future. + \item White space and dots are ignored. + \item While the book names are listed by language, they can right now be used + in all contexts. There is only one exception: \enquote{Pr} means + \emph{Proverbs} in English texts and \emph{\ger{Prediger}=Ecclesiastes} + in German texts (the latter requires using the \texttt{babel} package). + \item Some German book names include an umlaut (like \enquote{\ger{Römer}}). + They can be given in any of the following formats: + \begin{description} + \item[\texttt{\color{blue!50!black}Römer}] This is the most convenient, but + also the most fragile variant. It requires that the input encoding is + \texttt{utf8} or \texttt{latin1}. + \item[\texttt{\color{blue!50!black}Roemer}] You can use the ASCII version. + \item[\texttt{\color{blue!50!black}R\textbackslash"omer}] You can use \TeX{} + umlaut notation. + \item[\texttt{\color{blue!50!black}R"omer}] You can use the slightly shorter + notation provided by the \texttt{babel} package and its relatives for German + languages. + \item[\texttt{\color{blue!50!black}Romans}] You can switch to a different + language or an abbreviation that does not require an umlaut. +\end{description} +\end{itemize} + +\subsection{Defining book names} + +If the standard book names listed above are not enough, you can define your own +book names. +\begin{lstlisting} +\brpDefineBookPrefix{(*\param{new book prefix}*)}{(*\param{book name}*)} +\brpDefineBook{(*\param{new book name}*)}{(*\param{book name}*)} +\end{lstlisting} +Preferably, you define an entire prefix (this is slightly more efficient), and +use single definitions only if there are several continuations. The \param{book + name} should be the one given in the first column of the book name table +above. + +Prefixes always take precedence over single book names. For this reason, you +might need to undefine them: +\begin{lstlisting} +\brpUndefBookPrefix{(*\param{new book prefix}*)}{(*\param{book name}*)} +\brpUndefBook{(*\param{new book name}*)}{(*\param{book name}*)} +\end{lstlisting} + +If you want to provide different meanings of a book name depending on the +language, you can append your definitions to \texttt{babel}'s +\texttt{\textbackslash extras\param{lang}} and \texttt{\textbackslash + noextras\param{lang}} hooks. See the package source +\texttt{bibleref-parse.sty} for an example. + +\section{Interface for package authors} + +You can use the parser of book names separately. +\begin{lstlisting} +\brp@bookname{(*\param{book}*)} +\end{lstlisting} +This will set the macro \lstinline|\brp@bk| to the normalised name of the given +book. The normalised names are listed in the first column in the table above. +They were chosen according to OSIS naming conventions\footnote{See + \url{http://www.bibletechnologies.net/20Manual.dsp}, Section~24.}, which in +turn are based on the \emph{SBL handbook of style}. + +To parse a passage specification, use the following macro. +\begin{lstlisting} +\brp@parse{(*\param{passage specification}*)} +\end{lstlisting} +This will set the macro \lstinline|\brp@result| to a sequence of range +specifications. A range specification has the following form: +\begin{lstlisting} +\brp@range{(*\param{book}*)}{(*\param{from chapter}*)}{(*\param{from verse}*)}{(*\param{to chapter}*)}{(*\param{to verse}*)} +\end{lstlisting} +Typically, you will provide a local definition of \lstinline|\brp@range| that +takes these five parameters when evaluating \lstinline|\brp@result|. The +parameters are set according to the following conventions: +\begin{itemize} + \item If a complete book is specified, the numbers are all empty. + \item If a complete from- or to-chapter is specified, the corresponding verse + is empty. + \item For non-ranges, the from- and to- values will be equal. + \item For books consisting of a single chapter, the chapter values will be + empty. This affects Obadiah, Philemon, 2 John and 3 John. +\end{itemize} + +% \appendix +% \section{Revision history} +% \subsection*{Version 0.1, 2011-03-25} +% Initial release. + +\end{document} + +%%% Local Variables: +%%% mode: latex +%%% TeX-master: t +%%% End: + +%%% Local IspellDict: british diff --git a/Master/texmf-dist/tex/latex/bibleref-parse/bibleref-parse.sty b/Master/texmf-dist/tex/latex/bibleref-parse/bibleref-parse.sty new file mode 100644 index 00000000000..ceded4813a5 --- /dev/null +++ b/Master/texmf-dist/tex/latex/bibleref-parse/bibleref-parse.sty @@ -0,0 +1,1358 @@ +%% bibleref-parse.sty +%% Copyright (c) 2011 Sebastian Kuhnert +% +% This work may be distributed and/or modified under the conditions +% of the LaTeX Project Public License, either version 1.3c of this +% license or (at your option) any later version. The latest version +% of this license is at http://www.latex-project.org/lppl.txt +% and version 1.3c or later is part of all distributions of LaTeX +% version 2008/05/04 or later. +% +% This work has the LPPL maintenance status `maintained'. +% +% The Current Maintainer of this work is Sebastian Kuhnert. +% +% This work consists of the files listed in README +% +\ProvidesPackage{bibleref-parse}[2011/03/29 v1.0 Parsing of Bible references] + +% command definitions +\RequirePackage{etoolbox} + +% dependency handling +\RequirePackage{scrlfile} + +% Booknames and passage description formatting +\RequirePackage{bibleref} + +% store the option set, provide default +\def\brp@opt@@comma{preferlikeBR} + +% options +\csdef{brp@opt@comma=list}{% always list + \def\brp@opt@@comma{list}} +\csdef{brp@opt@comma=chvsep}{% always separate chapter and verse + \def\brp@opt@@comma{chvsep}} +\csdef{brp@opt@comma=likeBR}{% select chvsep if \BRchvsep contains a "," and list otherwise + \def\brp@opt@@comma{likeBR}} +%\csdef{brp@opt@comma=preferlist}{% synonym for list +% \def\brp@opt@@comma{preferlist}} +\csdef{brp@opt@comma=preferchvsep}{% select chvsep unless the passage has a ":" + \def\brp@opt@@comma{preferchvsep}} +\csdef{brp@opt@comma=preferlikeBR}{% select preferchvsep if \BRchvsep contains a "," and list otherwise + \def\brp@opt@@comma{preferlikeBR}} + +% process package options package options +\DeclareOption*{% + \ifcsdef{brp@opt@\CurrentOption}{\csuse{brp@opt@\CurrentOption}}{% + \PackageError{bibleref-parse}{unknown option '\CurrentOption'}{}% + }}% +\ProcessOptions\relax + +% setting of options +\newcommand*{\biblerefparseset}[1]{% + \def\do##1{% + \ifcsdef{brp@opt@##1}{\csuse{brp@opt@##1}}{% + \PackageError{bibleref-parse}{unknown option '##1'}{}% + }}% + \docsvlist{#1}% +} + +% is comma used to separate verses from chapters? +\newtoggle{brp@commaischvsep} +\newtoggle{brp@commalikeBR} +\newtoggle{brp@commaauto} +\newtoggle{brp@commapreferchvsep} + +% setting options in effect +\csdef{brp@optset@comma=list}{% always list + \togglefalse{brp@commaauto}% + \togglefalse{brp@commalikeBR}% + \togglefalse{brp@commaischvsep}} +\csdef{brp@optset@comma=chvsep}{% always separate chapter and verse + \togglefalse{brp@commaauto}% + \togglefalse{brp@commalikeBR}% + \toggletrue{brp@commaischvsep}} +\csdef{brp@optset@comma=likeBR}{% select chvsep if \BRchvsep contains a "," and list otherwise + \togglefalse{brp@commaauto}% + \toggletrue{brp@commalikeBR}} +%\csdef{brp@optset@comma=preferlist}{% synonym for list +% \toggletrue{brp@commaauto}% +% \togglefalse{brp@commalikeBR}% +% \togglefalse{brp@commapreferchvsep}} +\csdef{brp@optset@comma=preferchvsep}{% select chvsep unless the passage has a ":" + \toggletrue{brp@commaauto}% + \togglefalse{brp@commalikeBR}% + \toggletrue{brp@commapreferchvsep}} +\csdef{brp@optset@comma=preferlikeBR}{% select preferchvsep if \BRchvsep contains a "," and list otherwise + \toggletrue{brp@commaauto}% + \toggletrue{brp@commalikeBR}} + +% apply saved options +\def\brp@applyoptions{% + \csuse{brp@optset@comma=\brp@opt@@comma}% +} + +% Provide standard OSIS book names as aliases if they are not predefined by bibleref +\newcommand*{\brp@providecs}[2]{% + \ifcsundef{#1}{% + \csdef{#1}{#2}% + }{}% +} +\brp@providecs{br@1Sam}{\br@ISamuel} +\brp@providecs{br@2Sam}{\br@IISamuel} +\brp@providecs{br@1Kgs}{\br@IKings} +\brp@providecs{br@2Kgs}{\br@IIKings} +\brp@providecs{br@1Chr}{\br@IChronicles} +\brp@providecs{br@2Chr}{\br@IIChronicles} +\brp@providecs{br@Song}{\br@SongofSongs} + +\brp@providecs{br@1Cor}{\br@ICorinthians} +\brp@providecs{br@2Cor}{\br@IICorinthians} +\brp@providecs{br@1Thess}{\br@IThessalonians} +\brp@providecs{br@2Thess}{\br@IIThessalonians} +\brp@providecs{br@1Tim}{\br@ITimothy} +\brp@providecs{br@2Tim}{\br@IITimothy} +\brp@providecs{br@Phlm}{\br@Philemon} +\brp@providecs{br@1Pet}{\br@IPeter} +\brp@providecs{br@2Pet}{\br@IIPeter} +\brp@providecs{br@1John}{\br@IJohn} +\brp@providecs{br@2John}{\br@IIJohn} +\brp@providecs{br@3John}{\br@IIIJohn} + +\brp@providecs{br@Tob}{\br@Tobit} +\brp@providecs{br@1Macc}{\br@IMaccabees} +\brp@providecs{br@2Macc}{\br@IIMaccabees} +\brp@providecs{br@Wis}{\br@Wisdom} +\brp@providecs{br@Sir}{\br@Ecclesiasticus}%=Sirach +\brp@providecs{br@Bar}{\br@Baruch} + +% bibleref-german uses \newcommand* to provides \br@ aliases +% To avoid conflicts, undefine this before it is loaded: +\BeforePackage{bibleref-german}{% + \csundef{br@Phlm}% + \csundef{br@Tob}% + \csundef{br@Sir}% + \csundef{br@Bar}% +} + +% these are not in bibleref.sty +\providecommand{\BRadditionsto}{Additionsto} +\brp@providecs{br@AddDan}{\BRadditionsto Daniel} +\brp@providecs{br@AddEsth}{\BRadditionsto Esther} +\brp@providecs{br@EpJer}{Epistle of Jeremiah} +\preto\brfullname{% + \def\BRadditionsto{Additions to }% + \def\br@AddDan{\BRadditionsto Daniel}% + \def\br@AddEsth{\BRadditionsto Esther}% + \def\br@EpJer{Epistle of Jeremiah}} +\preto\brabbrvname{% + \def\BRadditionsto{Add\BRperiod~}% + \def\br@AddDan{\BRadditionsto Dn\BRperiod}% + \def\br@AddEsth{\BRadditionsto Est\BRperiod}% + \def\br@EpJer{Ep\BRperiod Jer\BRperiod}} +\preto\brabbrvname{% + \def\BRadditionsto{Add\BRperiod~}% + \def\br@AddDan{\BRadditionsto Dan\BRperiod}% + \def\br@AddEsth{\BRadditionsto Esther\BRperiod}% + \def\br@EpJer{Ep\BRperiod Jer\BRperiod}} +\AfterPackage*{bibleref-german}{% + \preto\brg@fullname{% + \def\BRadditionsto{St\"ucke zu }% + \def\br@AddDan{\BRadditionsto Daniel}% + \def\br@AddEsth{\BRadditionsto Esther}% + \def\br@EpJer{\BRder Brief des Jeremia}}% + \preto\brg@abbrvname{% + \def\BRadditionsto{St\BRperiod{} }% + \def\br@AddDan{\BRadditionsto Dan\BRperiod}% + \def\br@AddEsth{\BRadditionsto Est\BRperiod}% + \def\br@EpJer{Br\BRperiod Jer\BRperiod}}% +}% + +% define book names and prefixes +\newcommand*{\brpDefineBookPrefix}[2]{% + \csdef{brp@bkp@\detokenize{#1}}{#2}} +\newcommand*{\brpUndefBookPrefix}[1]{% + \csundef{brp@bkp@\detokenize{#1}}} +\newcommand*{\brpDefineBook}[2]{% + \csdef{brp@bk@\detokenize{#1}}{#2}} +\newcommand*{\brpUndefBook}[1]{% + \csundef{brp@bk@\detokenize{#1}}} + +% default book prefixes and names +\brpDefineBookPrefix{Ge}{Gen} +\brpDefineBookPrefix{Gn}{Gen} +\brpDefineBookPrefix{1Mo}{Gen} +\brpDefineBookPrefix{IMo}{Gen} +\brpDefineBook{1M}{Gen} +\brpDefineBook{IM}{Gen} +\brpDefineBookPrefix{Ex}{Exod} +\brpDefineBookPrefix{2Mo}{Exod} +\brpDefineBookPrefix{IIMo}{Exod} +\brpDefineBook{2M}{Exod} +\brpDefineBook{IIM}{Exod} +\brpDefineBookPrefix{Le}{Lev} +\brpDefineBookPrefix{Lv}{Lev} +\brpDefineBookPrefix{3M}{Lev} +\brpDefineBookPrefix{IIIM}{Lev} +\brpDefineBookPrefix{Nu}{Num} +\brpDefineBookPrefix{Nb}{Num} +\brpDefineBookPrefix{4}{Num} +\brpDefineBookPrefix{IV}{Num} +\brpDefineBookPrefix{De}{Deut} +\brpDefineBookPrefix{Dt}{Deut} +\brpDefineBookPrefix{5}{Deut} +\brpDefineBookPrefix{V}{Deut} +\brpDefineBookPrefix{Jos}{Josh} +\brpDefineBookPrefix{Judg}{Judg} +\brpDefineBook{Jd}{Judg} +\brpDefineBookPrefix{Jdg}{Judg} +\brpDefineBookPrefix{Jg}{Judg} +\brpDefineBookPrefix{Ri}{Judg} +\brpDefineBookPrefix{Ru}{Ruth} +\brpDefineBookPrefix{Rt}{Ruth} +\brpDefineBookPrefix{1S}{1Sam} +\brpDefineBookPrefix{IS}{1Sam} +\brpDefineBookPrefix{2S}{2Sam} +\brpDefineBookPrefix{IIS}{2Sam} +\brpDefineBookPrefix{1Ki}{1Kgs} +\brpDefineBookPrefix{1Kg}{1Kgs} +\brpDefineBookPrefix{IKi}{1Kgs} +\brpDefineBookPrefix{IKg}{1Kgs} +\brpDefineBookPrefix{1K\"o}{1Kgs} +\brpDefineBookPrefix{1K"o}{1Kgs} +\brpDefineBookPrefix{1Koe}{1Kgs} +\brpDefineBookPrefix{1K^^c3^^b6}{1Kgs}% utf8 \"o +\brpDefineBookPrefix{1K^^f6}{1Kgs}% latin1 \"o +\brpDefineBookPrefix{IK\"o}{1Kgs} +\brpDefineBookPrefix{IK"o}{1Kgs} +\brpDefineBookPrefix{IKoe}{1Kgs} +\brpDefineBookPrefix{IK^^c3^^b6}{1Kgs}% utf8 \"o +\brpDefineBookPrefix{IK^^f6}{1Kgs}% latin1 \"o +\brpDefineBook{1K}{1Kgs} +\brpDefineBook{IK}{1Kgs} +\brpDefineBookPrefix{2Ki}{2Kgs} +\brpDefineBookPrefix{2Kg}{2Kgs} +\brpDefineBookPrefix{IIKi}{2Kgs} +\brpDefineBookPrefix{IIKg}{2Kgs} +\brpDefineBookPrefix{2K\"o}{2Kgs} +\brpDefineBookPrefix{2K"o}{2Kgs} +\brpDefineBookPrefix{2Koe}{2Kgs} +\brpDefineBookPrefix{2K^^c3^^b6}{2Kgs}% utf8 \"o +\brpDefineBookPrefix{2K^^f6}{2Kgs}% latin1 \"o +\brpDefineBookPrefix{IIK\"o}{2Kgs} +\brpDefineBookPrefix{IIK"o}{2Kgs} +\brpDefineBookPrefix{IIKoe}{2Kgs} +\brpDefineBookPrefix{IIK^^c3^^b6}{2Kgs}% utf8 \"o +\brpDefineBookPrefix{IIK^^f6}{2Kgs}% latin1 \"o +\brpDefineBook{2K}{2Kgs} +\brpDefineBook{IIK}{2Kgs} +\brpDefineBookPrefix{1Ch}{1Chr} +\brpDefineBookPrefix{ICh}{1Chr} +\brpDefineBookPrefix{2Ch}{2Chr} +\brpDefineBookPrefix{IICh}{2Chr} +\brpDefineBookPrefix{Ezr}{Ezra} +\brpDefineBookPrefix{Esr}{Ezra} +\brpDefineBookPrefix{Ne}{Neh} +\brpDefineBookPrefix{Est}{Esth} +\brpDefineBookPrefix{Job}{Job} +\brpDefineBook{Jo}{Job} +\brpDefineBookPrefix{Jb}{Job} +\brpDefineBookPrefix{Hi}{Job} +\brpDefineBookPrefix{Ij}{Job} +\brpDefineBookPrefix{Ps}{Ps} +\brpDefineBookPrefix{Pro}{Prov} +\brpDefineBookPrefix{Prv}{Prov} +\brpDefineBookPrefix{Sp}{Prov} +\brpDefineBook{Pr}{Prov} +\AfterPackage*{babel}{ + \appto\extrasngerman{\brpDefineBook{Pr}{Eccl}} + \appto\extrasgerman{\brpDefineBook{Pr}{Eccl}} + \appto\extrasnaustrian{\brpDefineBook{Pr}{Eccl}} + \appto\extrasaustrian{\brpDefineBook{Pr}{Eccl}} + \appto\noextrasngerman{\brpDefineBook{Pr}{Prov}} + \appto\noextrasgerman{\brpDefineBook{Pr}{Prov}} + \appto\noextrasnaustrian{\brpDefineBook{Pr}{Prov}} + \appto\noextrasaustrian{\brpDefineBook{Pr}{Prov}} +} +\brpDefineBookPrefix{Ecclesiaste}{Eccl} +\brpDefineBook{Ec}{Eccl} +\brpDefineBook{Ecc}{Eccl} +\brpDefineBook{Ecl}{Eccl} +\brpDefineBook{Eccl}{Eccl} +\brpDefineBook{Eccle}{Eccl} +\brpDefineBook{Eccles}{Eccl} +\brpDefineBook{Ecclesi}{Eccl} +\brpDefineBook{Ecclesia}{Eccl} +\brpDefineBook{Ecclesias}{Eccl} +\brpDefineBook{Ecclesiast}{Eccl} +\brpDefineBookPrefix{Q}{Eccl} +\brpDefineBookPrefix{Pre}{Eccl} +\brpDefineBookPrefix{Koh}{Eccl} +\brpDefineBookPrefix{So}{Song} +\brpDefineBookPrefix{Sg}{Song} +\brpDefineBookPrefix{Hoh}{Song} +\brpDefineBookPrefix{Hl}{Song} +\brpDefineBookPrefix{Hh}{Song} +\brpDefineBookPrefix{Li}{Song} +\brpDefineBookPrefix{Is}{Isa} +\brpDefineBookPrefix{Jesa}{Isa} +\brpDefineBook{Jes}{Isa} +\brpDefineBookPrefix{Jer}{Jer} +\brpDefineBookPrefix{Jr}{Jer} +\brpDefineBookPrefix{La}{Lam} +\brpDefineBookPrefix{Lm}{Lam} +\brpDefineBookPrefix{Kl}{Lam} +\brpDefineBook{Ez}{Ezek} +\brpDefineBookPrefix{Eze}{Ezek} +\brpDefineBookPrefix{Ezk}{Ezek} +\brpDefineBookPrefix{Hes}{Ezek} +\brpDefineBookPrefix{Da}{Dan} +\brpDefineBookPrefix{Dn}{Dan} +\brpDefineBookPrefix{Hos}{Hos} +\brpDefineBook{Ho}{Hos} +\brpDefineBookPrefix{Jl}{Joel} +\brpDefineBookPrefix{Joe}{Joel} +\brpDefineBookPrefix{Jo\"e}{Joel} +\brpDefineBookPrefix{Jo"e}{Joel} +\brpDefineBookPrefix{Jo^^c3^^ab}{Joel}% utf \"e +\brpDefineBookPrefix{Jo^^eb}{Joel}% latin1 \"e +\brpDefineBookPrefix{Am}{Amos} +\brpDefineBookPrefix{Ob}{Obad} +\brpDefineBookPrefix{Jon}{Jonah} +\brpDefineBookPrefix{Mi}{Mic} +\brpDefineBookPrefix{Na}{Nah} +\brpDefineBookPrefix{Hab}{Hab} +\brpDefineBookPrefix{Hak}{Hab} +\brpDefineBookPrefix{Hb}{Hab} +\brpDefineBookPrefix{Hk}{Hab} +\brpDefineBookPrefix{Zep}{Zeph} +\brpDefineBookPrefix{Zp}{Zeph} +\brpDefineBookPrefix{Zef}{Zeph} +\brpDefineBookPrefix{Hag}{Hag} +\brpDefineBookPrefix{Hg}{Hag} +\brpDefineBookPrefix{Zec}{Zech} +\brpDefineBookPrefix{Zc}{Zech} +\brpDefineBookPrefix{Sa}{Zech} +\brpDefineBookPrefix{Mal}{Mal} +\brpDefineBookPrefix{Ml}{Mal} + +\brpDefineBookPrefix{Mat}{Matt} +\brpDefineBookPrefix{Mt}{Matt} +\brpDefineBookPrefix{Mar}{Mark} +\brpDefineBookPrefix{Mk}{Mark} +\brpDefineBookPrefix{Lu}{Luke} +\brpDefineBookPrefix{Lk}{Luke} +\brpDefineBookPrefix{Joh}{John} +\brpDefineBookPrefix{Jn}{John} +\brpDefineBookPrefix{Jh}{John} +\brpDefineBookPrefix{Ac}{Acts} +\brpDefineBookPrefix{Apos}{Acts} +\brpDefineBookPrefix{Apg}{Acts} +\brpDefineBook{Apo}{Acts} +\brpDefineBookPrefix{Ro}{Rom} +\brpDefineBookPrefix{Rm}{Rom} +\brpDefineBookPrefix{R\"o}{Rom} +\brpDefineBookPrefix{R"o}{Rom} +\brpDefineBookPrefix{Roe}{Rom} +\brpDefineBookPrefix{R^^c3^^b6}{Rom}% utf8 \"o +\brpDefineBookPrefix{R^^f6}{Rom}% latin1 \"o +\brpDefineBookPrefix{1Co}{1Cor} +\brpDefineBookPrefix{ICo}{1Cor} +\brpDefineBookPrefix{1Kor}{1Cor} +\brpDefineBookPrefix{IKor}{1Cor} +\brpDefineBook{1Ko}{1Cor} +\brpDefineBook{IKo}{1Cor} +\brpDefineBookPrefix{2Co}{2Cor} +\brpDefineBookPrefix{IICo}{2Cor} +\brpDefineBookPrefix{2Kor}{2Cor} +\brpDefineBookPrefix{IIKor}{2Cor} +\brpDefineBook{2Ko}{2Cor} +\brpDefineBook{IIKo}{2Cor} +\brpDefineBookPrefix{Ga}{Gal} +\brpDefineBookPrefix{Eph}{Eph} +\brpDefineBook{Ep}{Eph} +\brpDefineBookPrefix{Phili}{Phil} +\brpDefineBook{Ph}{Phil} +\brpDefineBook{Phi}{Phil} +\brpDefineBook{Phil}{Phil} +\brpDefineBookPrefix{C}{Col} +\brpDefineBookPrefix{Kol}{Col} +\brpDefineBookPrefix{1Th}{1Thess} +\brpDefineBookPrefix{ITh}{1Thess} +\brpDefineBookPrefix{2Th}{2Thess} +\brpDefineBookPrefix{IITh}{2Thess} +\brpDefineBookPrefix{1Ti}{1Tim} +\brpDefineBookPrefix{1Tm}{1Tim} +\brpDefineBookPrefix{ITi}{1Tim} +\brpDefineBookPrefix{ITm}{1Tim} +\brpDefineBookPrefix{2Ti}{2Tim} +\brpDefineBookPrefix{2Tm}{2Tim} +\brpDefineBookPrefix{IITi}{2Tim} +\brpDefineBookPrefix{IITm}{2Tim} +\brpDefineBookPrefix{Ti}{Titus} +\brpDefineBookPrefix{Tt}{Titus} +\brpDefineBookPrefix{Phile}{Phlm} +\brpDefineBookPrefix{Phl}{Phlm} +\brpDefineBookPrefix{Phm}{Phlm} +\brpDefineBookPrefix{Heb}{Heb} +\brpDefineBook{He}{Heb} +\brpDefineBookPrefix{Ja}{Jas} +\brpDefineBookPrefix{Js}{Jas} +\brpDefineBookPrefix{Jm}{Jas} +\brpDefineBookPrefix{Jk}{Jas} +\brpDefineBookPrefix{1P}{1Pet} +\brpDefineBookPrefix{IP}{1Pet} +\brpDefineBookPrefix{2P}{2Pet} +\brpDefineBookPrefix{IIP}{2Pet} +\brpDefineBookPrefix{1J}{1John} +\brpDefineBookPrefix{IJ}{1John} +\brpDefineBookPrefix{2J}{2John} +\brpDefineBookPrefix{IIJ}{2John} +\brpDefineBookPrefix{3J}{3John} +\brpDefineBookPrefix{IIIJ}{3John} +\brpDefineBookPrefix{Jude}{Jude} +\brpDefineBookPrefix{Juda}{Jude} +\brpDefineBook{Jud}{Jude} +\brpDefineBookPrefix{Rev}{Rev} +\brpDefineBookPrefix{Rv}{Rev} +\brpDefineBookPrefix{Of}{Rev} +\brpDefineBookPrefix{Apok}{Rev} +\brpDefineBookPrefix{Apk}{Rev} + +\brpDefineBookPrefix{Judi}{Jdt} +\brpDefineBookPrefix{Jdt}{Jdt} +\brpDefineBookPrefix{To}{Tob} +\brpDefineBookPrefix{1Ma}{1Macc} +\brpDefineBookPrefix{IMa}{1Macc} +\brpDefineBookPrefix{2Ma}{2Macc} +\brpDefineBookPrefix{IIMa}{2Macc} +\brpDefineBookPrefix{W}{Wis} +\brpDefineBookPrefix{Si}{Sir} +\brpDefineBookPrefix{Ecclesiasti}{Sir} +\brpDefineBookPrefix{Ecclu}{Sir} +\brpDefineBookPrefix{JesusS}{Sir} +\brpDefineBookPrefix{Ba}{Bar} +\brpDefineBookPrefix{AddD}{AddDan} +\brpDefineBookPrefix{AdditionsD}{AddDan} +\brpDefineBookPrefix{AdditionstoD}{AddDan} +\brpDefineBookPrefix{GreekD}{AddDan} +\brpDefineBookPrefix{GrD}{AddDan} +\brpDefineBookPrefix{St\"uckezuD}{AddDan} +\brpDefineBookPrefix{St"uckezuD}{AddDan} +\brpDefineBookPrefix{StueckezuD}{AddDan} +\brpDefineBookPrefix{St^^c3^^bcckezuD}{AddDan}% utf8 \"u +\brpDefineBookPrefix{St^^fcckezuD}{AddDan}% latin1 \"u +\brpDefineBookPrefix{St\"uckeD}{AddDan} +\brpDefineBookPrefix{St"uckeD}{AddDan} +\brpDefineBookPrefix{StueckeD}{AddDan} +\brpDefineBookPrefix{St^^c3^^bcckeD}{AddDan}% utf8 \"u +\brpDefineBookPrefix{St^^fcckeD}{AddDan}% latin1 \"u +\brpDefineBookPrefix{StD}{AddDan} +\brpDefineBookPrefix{AddE}{AddEsth} +\brpDefineBookPrefix{AdditionsE}{AddEsth} +\brpDefineBookPrefix{AdditionstoE}{AddEsth} +\brpDefineBookPrefix{GreekE}{AddEsth} +\brpDefineBookPrefix{GrE}{AddEsth} +\brpDefineBookPrefix{St\"uckezuE}{AddEsth} +\brpDefineBookPrefix{St"uckezuE}{AddEsth} +\brpDefineBookPrefix{StueckezuE}{AddEsth} +\brpDefineBookPrefix{St^^c3^^bcckezuE}{AddEsth}% utf8 \"u +\brpDefineBookPrefix{St^^fcckezuE}{AddEsth}% latin1 \"u +\brpDefineBookPrefix{St\"uckeE}{AddEsth} +\brpDefineBookPrefix{St"uckeE}{AddEsth} +\brpDefineBookPrefix{StueckeE}{AddEsth} +\brpDefineBookPrefix{St^^c3^^bcckeE}{AddEsth}% utf8 \"u +\brpDefineBookPrefix{St^^fcckeE}{AddEsth}% latin1 \"u +\brpDefineBookPrefix{StE}{AddEsth} +\brpDefineBookPrefix{EpistleofJer}{EpJer} +\brpDefineBookPrefix{EpistleJer}{EpJer} +\brpDefineBookPrefix{EpJer}{EpJer} +\brpDefineBookPrefix{BriefdesJer}{EpJer} +\brpDefineBookPrefix{BriefJer}{EpJer} +\brpDefineBookPrefix{BrJer}{EpJer} + +% \brp@ifdigit{char}{true}{false} +\newcommand*{\brp@ifdigit}[1]{% + \ifboolexpe{ not ( test{\ifnumcomp{`#1}{<}{`0}} or test{\ifnumcomp{`#1}{>}{`9}} ) }% +} + +% The main macro: +% \brp@parse{passagedesc} +% This will set \brp@result to a sequence of +% \brp@range{bookname}{from-chapter}{from-verse}{to-chapter}{to-verse} +% If a complete book is specified, the numbers are all empty. +% If a complete from-/to-chapter is specified, the corresponding verse is empty. +% For non-ranges, the from- and to- values will be equal. +% For books consisting of a single chapter, the chapter values will be 0. +% When expanding \brp@result, set \brp@range to a suitable handler +\newcommand*{\brp@parse}[2][]{% + % load saved options (not in group ...) + \brp@applyoptions + % process options + \def\do##1{% + \ifcsdef{brp@optset@##1}{\csuse{brp@optset@##1}}{% + \PackageError{bibleref-parse}{unknown option '##1'}{}% + }}% + \docsvlist{#1}% + % determine what to do with a comma + \iftoggle{brp@commaauto}{% + \iftoggle{brp@commalikeBR}{% + \brp@ifsubstring{,}{\BRchvsep}{% + \toggletrue{brp@commapreferchvsep}% + }{% + \togglefalse{brp@commapreferchvsep}% + }% + }{}% + \iftoggle{brp@commapreferchvsep}{% + \brp@ifsubstring{:}{#2}{% + \togglefalse{brp@commaischvsep}% + }{% + \toggletrue{brp@commaischvsep}% + }% + }{% + \togglefalse{brp@commaischvsep}% + }% + }{% + \iftoggle{brp@commalikeBR}{% + \brp@ifsubstring{,}{\BRchvsep}{% + \toggletrue{brp@commaischvsep}% + }{% + \togglefalse{brp@commaischvsep}% + }% + }{}% + }% + % initialisation + \let\brp@result\@empty + \let\brp@data@book\@empty + % the actual parsing + \expandafter\brp@parse@book #2\brp@endlist +} + +% helper macro to determine if a string has a substring +% \brp@ifsubstring{substring}{string}{true}{false} +\def\brp@ifsubstring#1#2{% + \def\brp@@test##1#1##2##3\brp@endlist{% + \ifstrequal{##2}{\brp@marker}{\@secondoftwo}{\@firstoftwo}}% + \expandafter\brp@@test #2#1\brp@marker\brp@endlist +} +% special marker for above detection macro +\def\brp@marker{\noexpand\brp@marker} + +% end-of-passagedesc marker +\def\brp@endlist{\noexpand\brp@endlist} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% The following macros parse a passagedesc step by step +% and store the resulting ranges in \brp@result + +% expect a book name +\def\brp@parse@book#1{% + \ifx#1\brp@endlist + % reference to a complete book + \brp@bookname{\brp@data@book}% + \eappto\brp@result{\noexpand\brp@range{\brp@bk}{}{}{}{}}% + \let\brp@nextcom=\@empty + \else + \ifx\brp@data@book\@empty + % always take the first char as part of the bookname, even if it is a digit + \def\brp@data@book{#1}% + \let\brp@nextcom\brp@parse@book% + \else% + % nonempty: read up to first digit + \brp@ifdigit{#1}{% + \let\brp@data@chapterstart=\@empty + \let\brp@data@versestart=\@empty + % skip to verse parsing for one-chapter books + \brp@bookname{\brp@data@book}% + \def\tempa{Obad}\ifx\tempa\brp@bk + \def\brp@data@chapter{0}\def\brp@nextcom{\brp@parse@verse #1}\else + \def\tempa{Phlm}\ifx\tempa\brp@bk + \def\brp@data@chapter{0}\def\brp@nextcom{\brp@parse@verse #1}\else + \def\tempa{2John}\ifx\tempa\brp@bk + \def\brp@data@chapter{0}\def\brp@nextcom{\brp@parse@verse #1}\else + \def\tempa{3John}\ifx\tempa\brp@bk + \def\brp@data@chapter{0}\def\brp@nextcom{\brp@parse@verse #1}\else + % else switch to chapter mode + \let\brp@data@chapter=\@empty + \def\brp@nextcom{\brp@parse@chapter #1}% + \fi\fi\fi\fi + }{% + \if;#1% + % reference to a complete book + \brp@bookname{\brp@data@book}% + \eappto\brp@result{\noexpand\brp@range{\brp@bk}{}{}{}{}}% + \let\brp@data@book\@empty + \let\brp@nextcom\brp@parse@book + \else\if+#1% + % reference to a complete book + \brp@bookname{\brp@data@book}% + \eappto\brp@result{\noexpand\brp@range{\brp@bk}{}{}{}{}}% + \let\brp@data@book\@empty + \let\brp@nextcom\brp@parse@book + \else + % append char to bookname + \appto\brp@data@book{#1}% + \let\brp@nextcom\brp@parse@book + \fi\fi + }% + \fi + \fi + \brp@nextcom +} + +% expect a chapter number +\def\brp@parse@chapter#1{% + \ifx#1\brp@endlist + \ifx\brp@data@chapterstart\@empty + % reference to a single, complete chapter + \eappto\brp@result{\noexpand\brp@range{\brp@bk}% + {\brp@data@chapter}{}{\brp@data@chapter}{}}% + \else + % reference range which ends with a complete chapter + \eappto\brp@result{\noexpand\brp@range{\brp@bk}% + {\brp@data@chapterstart}{\brp@data@versestart}{\brp@data@chapter}{}}% + \let\brp@data@chapterstart\@empty + \fi + \let\brp@data@verse\@empty + \let\brp@data@versestart\@empty + \let\brp@nextcom=\@empty + \else + \brp@ifdigit{#1}{% + % append char to chapter + \appto\brp@data@chapter{#1}% + \let\brp@nextcom\brp@parse@chapter + }{% + \if,#1% + \iftoggle{brp@commaischvsep}{% + \let\brp@data@verse=\@empty + \let\brp@nextcom\brp@parse@verse + }{% + \ifx\brp@data@chapterstart\@empty + % reference to a single, complete chapter + \eappto\brp@result{\noexpand\brp@range{\brp@bk}% + {\brp@data@chapter}{}{\brp@data@chapter}{}}% + \else + % reference range which ends with a complete chapter + \eappto\brp@result{\noexpand\brp@range{\brp@bk}% + {\brp@data@chapterstart}{\brp@data@versestart}{\brp@data@chapter}{}}% + \let\brp@data@chapterstart\@empty + \fi + \let\brp@data@verse\@empty + \let\brp@data@versestart\@empty + \let\brp@data@chapter\@empty + \let\brp@nextcom\brp@parse@chapter + }% + \else\if:#1% + \let\brp@data@verse=\@empty + \let\brp@nextcom\brp@parse@verse + \else\if;#1% + \ifx\brp@data@chapterstart\@empty + % reference to a single, complete chapter + \eappto\brp@result{\noexpand\brp@range{\brp@bk}% + {\brp@data@chapter}{}{\brp@data@chapter}{}}% + \else + % reference range which ends with a complete chapter + \eappto\brp@result{\noexpand\brp@range{\brp@bk}% + {\brp@data@chapterstart}{\brp@data@versestart}{\brp@data@chapter}{}}% + \let\brp@data@chapterstart\@empty + \fi + \let\brp@data@verse\@empty + \let\brp@data@versestart\@empty + \let\brp@data@chapter\@empty + \let\brp@nextcom\brp@parse@bookorchapter + \else\if+#1% + \ifx\brp@data@chapterstart\@empty + % reference to a single, complete chapter + \eappto\brp@result{\noexpand\brp@range{\brp@bk}% + {\brp@data@chapter}{}{\brp@data@chapter}{}}% + \else + % reference range which ends with a complete chapter + \eappto\brp@result{\noexpand\brp@range{\brp@bk}% + {\brp@data@chapterstart}{\brp@data@versestart}{\brp@data@chapter}{}}% + \let\brp@data@chapterstart\@empty + \fi + \let\brp@data@verse\@empty + \let\brp@data@versestart\@empty + \let\brp@data@chapter\@empty + \let\brp@nextcom\brp@parse@bookorchapter + \else\if-#1% + \let\brp@data@versestart\@empty% + \let\brp@data@chapterstart\brp@data@chapter + \let\brp@data@chapter\@empty + \let\brp@nextcom\brp@parse@chapter + \else + \PackageError{bibleref-parse}% + {unsupported syntax: chapter-number followed by #1}% + {A chapter-number must be followed by one of ',:;+-' or end-of-string}% + \let\brp@nextcom=\@empty + \fi\fi\fi\fi\fi + }% + \fi + \brp@nextcom +} + +% expect a verse number +\def\brp@parse@verse#1{% + \ifx#1\brp@endlist + \ifx\brp@data@versestart\@empty + \ifx\brp@data@chapterstart\@empty + % reference to single verse + \eappto\brp@result{\noexpand\brp@range{\brp@bk}% + {\brp@data@chapter}{\brp@data@verse}{\brp@data@chapter}{\brp@data@verse}}% + \else + % reference starting with a complete different chapter + \eappto\brp@result{\noexpand\brp@range{\brp@bk}% + {\brp@data@chapterstart}{}{\brp@data@chapter}{\brp@data@verse}}% + \fi + \else + % reference starting with another verse + \eappto\brp@result{\noexpand\brp@range{\brp@bk}% + {\brp@data@chapterstart}{\brp@data@versestart}{\brp@data@chapter}{\brp@data@verse}}% + \fi + \let\brp@data@verse\@empty + \let\brp@data@versestart\@empty + \let\brp@data@chapterstart\@empty + \let\brp@nextcom=\@empty + \else + \brp@ifdigit{#1}{% + % append char to verse + \appto\brp@data@verse{#1}% + \let\brp@nextcom\brp@parse@verse + }{% + \if#1.% + \ifx\brp@data@versestart\@empty + \ifx\brp@data@chapterstart\@empty + % reference to single verse + \eappto\brp@result{\noexpand\brp@range{\brp@bk}% + {\brp@data@chapter}{\brp@data@verse}{\brp@data@chapter}{\brp@data@verse}}% + \else + % reference starting with a complete different chapter + \eappto\brp@result{\noexpand\brp@range{\brp@bk}% + {\brp@data@chapterstart}{}{\brp@data@chapter}{\brp@data@verse}}% + \fi + \else + % reference starting with another verse + \eappto\brp@result{\noexpand\brp@range{\brp@bk}% + {\brp@data@chapterstart}{\brp@data@versestart}{\brp@data@chapter}{\brp@data@verse}}% + \fi + \let\brp@data@verse\@empty + \let\brp@data@versestart\@empty + \let\brp@data@chapterstart\@empty + \let\brp@nextcom\brp@parse@verse + \else\if#1+% + \ifx\brp@data@versestart\@empty + \ifx\brp@data@chapterstart\@empty + % reference to single verse + \eappto\brp@result{\noexpand\brp@range{\brp@bk}% + {\brp@data@chapter}{\brp@data@verse}{\brp@data@chapter}{\brp@data@verse}}% + \else + % reference starting with a complete different chapter + \eappto\brp@result{\noexpand\brp@range{\brp@bk}% + {\brp@data@chapterstart}{}{\brp@data@chapter}{\brp@data@verse}}% + \fi + \else + % reference starting with another verse + \eappto\brp@result{\noexpand\brp@range{\brp@bk}% + {\brp@data@chapterstart}{\brp@data@versestart}{\brp@data@chapter}{\brp@data@verse}}% + \fi + \let\brp@data@verse\@empty + \let\brp@data@versestart\@empty + \let\brp@data@chapterstart\@empty + \let\brp@nextcom\brp@parse@bookorchapterorverse + \else\if#1-% + \let\brp@data@versestart=\brp@data@verse + \let\brp@data@verse=\@empty + \let\brp@data@chapterstart=\brp@data@chapter + \let\brp@nextcom\brp@parse@chapterorverse + \else\if#1,% + \iftoggle{brp@commaischvsep}{% + \PackageError{bibleref-parse}% + {unsupported syntax: unexpected use of "," to list verses}% + {See the documentation of the 'comma=' options for details.}% + }{% + \ifx\brp@data@versestart\@empty + \ifx\brp@data@chapterstart\@empty + % reference to single verse + \eappto\brp@result{\noexpand\brp@range{\brp@bk}% + {\brp@data@chapter}{\brp@data@verse}{\brp@data@chapter}{\brp@data@verse}}% + \else + % reference starting with a complete different chapter + \eappto\brp@result{\noexpand\brp@range{\brp@bk}% + {\brp@data@chapterstart}{}{\brp@data@chapter}{\brp@data@verse}}% + \fi + \else + % reference starting with another verse + \eappto\brp@result{\noexpand\brp@range{\brp@bk}% + {\brp@data@chapterstart}{\brp@data@versestart}{\brp@data@chapter}{\brp@data@verse}}% + \fi + \let\brp@data@verse\@empty + \let\brp@data@versestart\@empty + \let\brp@data@chapterstart\@empty + \let\brp@nextcom\brp@parse@chapterorverse + }% + \else\if#1;% + \ifx\brp@data@versestart\@empty + \ifx\brp@data@chapterstart\@empty + % reference to single verse + \eappto\brp@result{\noexpand\brp@range{\brp@bk}% + {\brp@data@chapter}{\brp@data@verse}{\brp@data@chapter}{\brp@data@verse}}% + \else + % reference starting with a complete different chapter + \eappto\brp@result{\noexpand\brp@range{\brp@bk}% + {\brp@data@chapterstart}{}{\brp@data@chapter}{\brp@data@verse}}% + \fi + \else + % reference starting with another verse + \eappto\brp@result{\noexpand\brp@range{\brp@bk}% + {\brp@data@chapterstart}{\brp@data@versestart}{\brp@data@chapter}{\brp@data@verse}}% + \fi + \let\brp@data@verse\@empty + \let\brp@data@chapter\@empty + \let\brp@data@versestart\@empty + \let\brp@data@chapterstart\@empty + \let\brp@nextcom\brp@parse@bookorchapter + \else + \PackageError{bibleref-parse}% + {unsupported syntax: verse-number followed by '#1'}% + {A verse-number must be followed by one of ',.+-;' or end-of-string.}% + \fi\fi\fi\fi\fi + }% + \fi + \brp@nextcom +} + +% expect a verse number which might later turn out to be a chapter number +\def\brp@parse@chapterorverse#1{% + \ifx#1\brp@endlist + % it was a verse. + \ifx\brp@data@versestart\@empty + \ifx\brp@data@chapterstart\@empty + % reference to single verse + \eappto\brp@result{\noexpand\brp@range{\brp@bk}% + {\brp@data@chapter}{\brp@data@verse}{\brp@data@chapter}{\brp@data@verse}}% + \else + % reference starting with a complete different chapter + \eappto\brp@result{\noexpand\brp@range{\brp@bk}% + {\brp@data@chapterstart}{}{\brp@data@chapter}{\brp@data@verse}}% + \fi + \else + % reference starting with another verse + \eappto\brp@result{\noexpand\brp@range{\brp@bk}% + {\brp@data@chapterstart}{\brp@data@versestart}{\brp@data@chapter}{\brp@data@verse}}% + \fi + \let\brp@data@verse\@empty + \let\brp@data@versestart\@empty + \let\brp@data@chapterstart\@empty + \let\brp@nextcom=\@empty + \else + \brp@ifdigit{#1}{% + % append char to verse + \appto\brp@data@verse{#1}% + \let\brp@nextcom\brp@parse@chapterorverse + }{% + \if#1.% + % it was a verse. + \ifx\brp@data@versestart\@empty + \ifx\brp@data@chapterstart\@empty + % reference to single verse + \eappto\brp@result{\noexpand\brp@range{\brp@bk}% + {\brp@data@chapter}{\brp@data@verse}{\brp@data@chapter}{\brp@data@verse}}% + \else + % reference starting with a complete different chapter + \eappto\brp@result{\noexpand\brp@range{\brp@bk}% + {\brp@data@chapterstart}{}{\brp@data@chapter}{\brp@data@verse}}% + \fi + \else + % reference starting with another verse + \eappto\brp@result{\noexpand\brp@range{\brp@bk}% + {\brp@data@chapterstart}{\brp@data@versestart}{\brp@data@chapter}{\brp@data@verse}}% + \fi + \let\brp@data@verse\@empty + \let\brp@data@versestart\@empty + \let\brp@data@chapterstart\@empty + \let\brp@nextcom\brp@parse@verse + \else\if#1+% + % it was a verse. + \ifx\brp@data@versestart\@empty + \ifx\brp@data@chapterstart\@empty + % reference to single verse + \eappto\brp@result{\noexpand\brp@range{\brp@bk}% + {\brp@data@chapter}{\brp@data@verse}{\brp@data@chapter}{\brp@data@verse}}% + \else + % reference starting with a complete different chapter + \eappto\brp@result{\noexpand\brp@range{\brp@bk}% + {\brp@data@chapterstart}{}{\brp@data@chapter}{\brp@data@verse}}% + \fi + \else + % reference starting with another verse + \eappto\brp@result{\noexpand\brp@range{\brp@bk}% + {\brp@data@chapterstart}{\brp@data@versestart}{\brp@data@chapter}{\brp@data@verse}}% + \fi + \let\brp@data@verse\@empty + \let\brp@data@versestart\@empty + \let\brp@data@chapterstart\@empty + \let\brp@nextcom\brp@parse@bookorchapterorverse + \else\if#1-% + % assume it was a verse. + \let\brp@data@versestart=\brp@data@verse + \let\brp@data@verse=\@empty + \let\brp@data@chapterstart=\brp@data@chapter + \let\brp@nextcom\brp@parse@chapterorverse + \else\if,#1% + \iftoggle{brp@commaischvsep}{% + % our hypothesis was wrong - we were actually looking at a chapter + \let\brp@data@chapter\brp@data@verse + \let\brp@data@verse\@empty + \let\brp@nextcom\brp@parse@verse + }{% + % assume it was a verse. + \ifx\brp@data@versestart\@empty + \ifx\brp@data@chapterstart\@empty + % reference to single verse + \eappto\brp@result{\noexpand\brp@range{\brp@bk}% + {\brp@data@chapter}{\brp@data@verse}{\brp@data@chapter}{\brp@data@verse}}% + \else + % reference starting with a complete different chapter + \eappto\brp@result{\noexpand\brp@range{\brp@bk}% + {\brp@data@chapterstart}{}{\brp@data@chapter}{\brp@data@verse}}% + \fi + \else + % reference starting with another verse + \eappto\brp@result{\noexpand\brp@range{\brp@bk}% + {\brp@data@chapterstart}{\brp@data@versestart}{\brp@data@chapter}{\brp@data@verse}}% + \fi + \let\brp@data@verse\@empty + \let\brp@data@versestart\@empty + \let\brp@data@chapterstart\@empty + \let\brp@nextcom\brp@parse@chapterorverse + }% + \else\if:#1% + % our hypothesis was wrong - we were actually looking at a chapter + \let\brp@data@chapter\brp@data@verse + \let\brp@data@verse\@empty + \let\brp@nextcom\brp@parse@verse + \else\if;#1% + % assume it was a verse. + \ifx\brp@data@versestart\@empty + \ifx\brp@data@chapterstart\@empty + % reference to single verse + \eappto\brp@result{\noexpand\brp@range{\brp@bk}% + {\brp@data@chapter}{\brp@data@verse}{\brp@data@chapter}{\brp@data@verse}}% + \else + % reference starting with a complete different chapter + \eappto\brp@result{\noexpand\brp@range{\brp@bk}% + {\brp@data@chapterstart}{}{\brp@data@chapter}{\brp@data@verse}}% + \fi + \else + % reference starting with another verse + \eappto\brp@result{\noexpand\brp@range{\brp@bk}% + {\brp@data@chapterstart}{\brp@data@versestart}{\brp@data@chapter}{\brp@data@verse}}% + \fi + \let\brp@data@verse\@empty + \let\brp@data@chapter\@empty + \let\brp@data@versestart\@empty + \let\brp@data@chapterstart\@empty + \let\brp@nextcom\brp@parse@bookorchapter + \else + \PackageError{bibleref-parse}% + {unsupported syntax: unexpected token '#1'}% + {Expected one of ',.+-;:' or end-of-string.}% + \fi\fi\fi\fi\fi\fi + }% + \fi + \brp@nextcom +} +% expect a verse number which might later turn out to be a chapter number or book name +\def\brp@parse@bookorchapterorverse#1{% + \ifx#1\brp@endlist + % it was a verse. + \def\brp@nextcom{\brp@parse@verse\brp@endlist}% + \else + \brp@ifdigit{#1}{% + \ifx\brp@data@verse\@empty + % this might still be the digit at the start of a bookname. + \def\brp@data@verse{#1}% + \let\brp@nextcom\brp@parse@bookorchapterorverse + \else + % it was a chapter or a verse. + \appto\brp@data@verse{#1}% + \let\brp@nextcom\brp@parse@chapterorverse + \fi + }{% + \if#1.% + % it is a verse or a book - find out with the next char + \let\brp@nextcom\brp@parse@bookorverse + \else\if#1+% + % it was a verse. + \def\brp@nextcom{\brp@parse@verse +}% + \else\if#1-% + % assume it was a verse. + \let\brp@data@versestart=\brp@data@verse + \let\brp@data@verse=\@empty + \let\brp@data@chapterstart=\brp@data@chapter + \let\brp@nextcom\brp@parse@chapterorverse + \else\if,#1% + \iftoggle{brp@commaischvsep}{% + % our hypothesis was wrong - we were actually looking at a chapter + \let\brp@data@chapter\brp@data@verse + \let\brp@data@verse\@empty + \let\brp@nextcom\brp@parse@verse + }{% + % assume it was a verse. + \def\brp@nextcom{\brp@parse@verse ,}% + }% + \else\if:#1% + % our hypothesis was wrong - we were actually looking at a chapter + \let\brp@data@chapter\brp@data@verse + \let\brp@data@verse\@empty + \let\brp@nextcom\brp@parse@verse + \else\if;#1% + % assume it was a verse. + \def\brp@nextcom{\brp@parse@verse ,}% + \else + % our hypothesis was wrong - we are looking at a book name + \edef\brp@data@book{\brp@data@verse #1}% + \let\brp@data@verse\@empty + \let\brp@nextcom\brp@parse@book + \fi\fi\fi\fi\fi\fi + }% + \fi + \brp@nextcom +} +% decide if the current contents of \brp@data@verse is a verse or the start of a +% book name +\def\brp@parse@bookorverse#1{% + \ifx#1\brp@endlist + \PackageError{bibleref-parse}% + {unsupported syntax: unexpected end-of-string.}% + {After a '.' a verse number or the continuation of a bookname is expected.}% + \else + \brp@ifdigit{#1}{% + % it was a verse. + \edef\brp@data@book{\brp@data@verse #1}% + \let\brp@data@verse\@empty + \def\brp@nextcom{\brp@parse@verse .#1}% + }{% + % it was a book. + \edef\brp@data@book{\brp@data@verse #1}% + \let\brp@data@verse\@empty + \let\brp@nextcom\brp@parse@book + }% + \fi + \brp@nextcom +} + +% expect a chapter number which might turn out to be a book name +\def\brp@parse@bookorchapter#1{% + \ifx#1\brp@endlist + \ifx\brp@data@chapter\@empty + \PackageError{bibleref-parse}% + {unsupported syntax: unexpected end-of-string.}% + {After a ';' a chapter-number or bookname is expected.}% + \else + % it was a chapter. reference it completely. + \eappto\brp@result{\noexpand\brp@range{\brp@bk}% + {\brp@data@chapter}{}{\brp@data@chapter}{}}% + \let\brp@data@verse\@empty + \let\brp@data@versestart\@empty + \let\brp@data@chapterstart\@empty + \let\brp@nextcom=\@empty + \fi + \else + \brp@ifdigit{#1}{% + \ifx\brp@data@chapter\@empty + % this might still be the digit at the start of a bookname. + \def\brp@data@chapter{#1}% + \let\brp@nextcom\brp@parse@bookorchapter + \else + % it was a chapter. + \appto\brp@data@chapter{#1}% + \let\brp@nextcom\brp@parse@chapter + \fi + }{% + % catch the remaining cases where we were looking at a chapter + \if#1,% + \def\brp@nextcom{\brp@parse@chapter ,}% + \else\if#1:% + \def\brp@nextcom{\brp@parse@chapter :}% + \else\if#1-% + \def\brp@nextcom{\brp@parse@chapter -}% + \else\if#1;% + \def\brp@nextcom{\brp@parse@chapter ;}% + \else\if#1+% + \def\brp@nextcom{\brp@parse@chapter +}% + \else + % our hypothesis was wrong - we were actually looking at a book + \edef\brp@data@book{\brp@data@chapter #1}% + \let\brp@data@chapter\@empty + \let\brp@nextcom\brp@parse@book + \fi\fi\fi\fi\fi + }% + \fi + \brp@nextcom +} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + + +% \brp@bookname{book} +% This sets \brp@bk to the canonical OSIS name of the given book. +% It should work for all English and German naming variants and their abbreviations. +\def\brp@bookname#1{% + \let\brp@book=\@empty + \edef\brp@temp{#1}% + \expandafter\brp@parsebook\brp@temp\brp@endlist +} + +\def\brp@parsebook#1{% + \ifx#1\brp@endlist + \ifcsdef{brp@bk@\expandafter\detokenize\expandafter{\brp@book}}{% + \letcs\brp@bk{brp@bk@\expandafter\detokenize\expandafter{\brp@book}}% + }{% + \PackageError{bibleref-parse}{unknown bookname '\brp@book'}{}% + % leave it non-canonical and hope for the best ... + \let\brp@bk\brp@book% + }% + \let\brp@next\relax + \else + \if.#1\else + \appto\brp@book{#1}% + \ifcsdef{brp@bkp@\expandafter\detokenize\expandafter{\brp@book}}{% + \edef\brp@bk{\csuse{brp@bkp@\expandafter\detokenize\expandafter{\brp@book}}}% + \let\brp@next\brp@gobblelist + }{% + \let\brp@next\brp@parsebook + }% + \fi + \fi + \brp@next +} + +% helper macro to skip the rest of the bookname once we have identified it +\def\brp@gobblelist#1{% + \ifx#1\brp@endlist + \let\brp@next=\@empty + \else + \let\brp@next=\brp@gobblelist + \fi + \brp@next +} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% Convert \brp@result to a list of bibleref calls with compact arguments. +% The result is stored in \brp@brlist. \brp@do is used as command and should be +% \let to \bibleref or the like before evaluating \brp@brlist. +\def\brp@convert{% + \def\brp@brlist{}% + \let\brp@lastbook\@empty + \let\brp@lastchap\@empty + \def\brp@chaplist{}% + \def\brp@verselist{}% + \let\brp@range\brp@convert@range + \brp@result + \brp@convert@clearcache + \appto\brp@brlist{\relax}% + \undef\brp@lastbook + \undef\brp@lastchap + \undef\brp@chaplist + \undef\brp@verselist + \undef\brp@range + \undef\brp@startchap + \undef\brp@startverse + \undef\brp@endchap + \undef\brp@endverse +} +\def\brp@convert@clearcache{% + \ifdefempty{\brp@chaplist}{% + \ifdefempty{\brp@verselist}{}{% + \eappto\brp@brlist{(\brp@chaplist:\brp@verselist)}}% + }{% + \eappto\brp@brlist{(\brp@chaplist:\brp@verselist)}}% +} +% helper macro for \brp@convert that does the real work +\def\brp@convert@range#1#2#3#4#5{% + \ifdefstring{\brp@lastbook}{#1}{}{% + % different books: start a new command + \ifdefempty{\brp@lastbook}{}{% + \brp@convert@clearcache + \appto\brp@brlist{\BRbksep}% + }% + \appto\brp@brlist{\brp@do{#1}}% + \def\brp@chaplist{}% + \def\brp@verselist{}% + \def\brp@lastbook{#1}% + \def\brp@lastchap{}% + }% + \ifstrequal{#2}{0}{% + % special handling for single-chapter books + \def\brp@startchap{#3}% + \def\brp@startverse{}% + \def\brp@endchap{#5}% + \def\brp@endverse{}% + }{% + \def\brp@startchap{#2}% + \def\brp@startverse{#3}% + \def\brp@endchap{#4}% + \def\brp@endverse{#5}% + }% + \ifdefequal{\brp@lastchap}{\brp@startchap}{% + % we start in the same chapter where we left before + \ifdefequal{\brp@startchap}{\brp@endchap}{% + % ... and we remain there + \ifdefequal{\brp@startverse}{\brp@endverse}{% + % add just one verse + \ifdefempty{\brp@verselist}{% + % strange. better start a new paren ... + \brp@convert@clearcache + \let\brp@chaplist\brp@startchap% + \let\brp@verselist\brp@startverse% + }{% + % add to already begun list + \eappto\brp@verselist{,\brp@startverse}% + }% + }{% + % add a verse range + \ifdefempty{\brp@verselist}{% + % strange. better start a new paren ... + \brp@convert@clearcache + \let\brp@chaplist\brp@startchap% + \edef\brp@verselist{\brp@startverse-\brp@endverse}% + }{% + \eappto\brp@verselist{,\brp@startverse-\brp@endverse}% + }% + }% + }{% + % we have a range over multiple chapters, starting in the current one + \ifdefempty{\brp@verselist}{% + % strange. better start a new paren ... + \brp@convert@clearcache + \let\brp@chaplist\brp@startchap% + \let\brp@verselist\brp@startverse% + }{% + \eappto\brp@verselist{,\brp@startverse}% + }% + % now to our target + \eappto\brp@brlist{(\brp@chaplist:\brp@verselist)-(\brp@endchap:\brp@endverse)}% + \def\brp@chaplist{}% + \def\brp@verselist{}% + \def\brp@lastchap{}% + }% + }{% + % we start in a different chapter + \ifdefempty{\brp@verselist}{% + \ifdefempty{\brp@startverse}{% + \ifdefempty{\brp@chaplist}{}{% + % \appto\brp@chaplist{,} + % due to a bug in bibleref, we need to start a new paren + \brp@convert@clearcache + \let\brp@verselist\@empty + \let\brp@chaplist\@empty + }% + \ifdefempty{\brp@endverse}{% + % no verses known, just append the chapters. + \ifdefequal{\brp@startchap}{\brp@endchap}{% + % single chapter + \eappto\brp@chaplist{\brp@startchap}% + }{% + % chapter range + \eappto\brp@chaplist{\brp@startchap-\brp@endchap}% + }% + \let\brp@lastchap\brp@endchap% + }{% + \eappto\brp@brlist{(\brp@chaplist\brp@startchap:)-(\brp@endchap:\brp@endverse)}% + \def\brp@chaplist{}% + \def\brp@verselist{}% + \def\brp@lastchap{}% + }% + }{% + \ifdefequal{\brp@startchap}{\brp@endchap}{% + \brp@convert@clearcache + \let\brp@chaplist\brp@startchap% + \ifdefequal{\brp@startverse}{\brp@endverse}{% + \let\brp@verselist\brp@startverse% + }{% + \edef\brp@verselist{\brp@startverse-\brp@endverse}% + }% + \let\brp@lastchap\brp@endchap% + }{% + \brp@convert@clearcache + \eappto\brp@brlist{(\brp@startchap:\brp@startverse)-(\brp@endchap:\brp@endverse)}% + \def\brp@chaplist{}% + \def\brp@verselist{}% + \def\brp@lastchap{}% + }% + }% + }{% + \brp@convert@clearcache + \ifdefequal{\brp@startchap}{\brp@endchap}{% + % we stay in one chapter + \let\brp@chaplist\brp@startchap% + \ifdefequal{\brp@startverse}{\brp@endverse}{% + % single verse + \let\brp@verselist\brp@startverse% + }{% + % verse range + \edef\brp@verselist{\brp@startverse-\brp@endverse}% + }% + \let\brp@lastchap\brp@endchap% + }{% + % we span several chapters + \ifdefempty{\brp@startverse}{% + \ifdefempty{\brp@endverse}{% + % no verses given: compact chapter range + \edef\brp@chaplist{\brp@startchap-\brp@endchap}% + \def\brp@verselist{}% + \let\brp@lastchap\brp@endchap% + }{% + % only to-verse given + \eappto\brp@brlist{(\brp@startchap:)-(\brp@endchap:\brp@endverse)}% + \def\brp@chaplist{}% + \def\brp@verselist{}% + \def\brp@lastchap{}% + }% + }{% + \eappto\brp@brlist{(\brp@startchap:\brp@startverse)-(\brp@endchap:\brp@endverse)}% + \def\brp@chaplist{}% + \def\brp@verselist{}% + \def\brp@lastchap{}% + }% + }% + }% + }% +} + +\newcommand{\pbibleverse}[2][]{% + \brp@parse[#1]{#2}% + \brp@convert% + \let\brp@do\bibleverse% + \brp@brlist +} + +\newcommand{\pibibleverse}[2][]{% + \brp@parse[#1]{#2}% + \brp@convert% + \let\brp@do\ibibleverse% + \brp@brlist +} + +\newcommand{\pibiblechvs}[2][]{% + \brp@parse[#1]{#2}% + \brp@convert% + \let\brp@do\ibiblechvs% + \brp@brlist +} + +\newcommand{\pibiblevs}[2][]{% + \brp@parse[#1]{#2}% + \brp@convert% + \let\brp@do\ibiblevs% + \brp@brlist +} + +\providecommand{\BRbksep}{;\space} + +\endinput + diff --git a/Master/tlpkg/bin/tlpkg-ctan-check b/Master/tlpkg/bin/tlpkg-ctan-check index 0db81060c41..dc1e4f30407 100755 --- a/Master/tlpkg/bin/tlpkg-ctan-check +++ b/Master/tlpkg/bin/tlpkg-ctan-check @@ -57,7 +57,8 @@ my @TLP_working = qw( biblatex biblatex-apa biblatex-chem biblatex-chicago biblatex-dw biblatex-historian biblatex-ieee biblatex-mla biblatex-nature biblatex-philosophy biblatex-science - bibleref bibleref-french bibleref-german biblist bibtex bibtopic + bibleref bibleref-french bibleref-german bibleref-parse + biblist bibtex bibtopic bibtopicprefix bibexport bibunits bidi bigfoot bigints binomexp biocon bizcard blacklettert1 blindtext blkarray block blockdraw_mp blowup diff --git a/Master/tlpkg/tlpsrc/bibleref-parse.tlpsrc b/Master/tlpkg/tlpsrc/bibleref-parse.tlpsrc new file mode 100644 index 00000000000..e69de29bb2d diff --git a/Master/tlpkg/tlpsrc/collection-humanities.tlpsrc b/Master/tlpkg/tlpsrc/collection-humanities.tlpsrc index a92149f7c5f..70b17e3f27a 100644 --- a/Master/tlpkg/tlpsrc/collection-humanities.tlpsrc +++ b/Master/tlpkg/tlpsrc/collection-humanities.tlpsrc @@ -5,6 +5,7 @@ longdesc humanities, etc. depend alnumsec depend arydshln depend bibleref +depend bibleref-parse depend covington depend dramatist depend ecltree -- cgit v1.2.3