diff options
author | Karl Berry <karl@freefriends.org> | 2011-04-11 23:18:01 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2011-04-11 23:18:01 +0000 |
commit | c06f58e02f17703aacc018b8e48c4aa75f3e4a58 (patch) | |
tree | 74261f1538bb1ea445b4c5ddfe53e2eaddb30305 /Master/texmf-dist/tex/latex/bibleref-parse | |
parent | 8440a3ec7fc7010d4c08fe26cca97573da388780 (diff) |
bibleref-parse (11apr11)
git-svn-id: svn://tug.org/texlive/trunk@22054 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/bibleref-parse')
-rw-r--r-- | Master/texmf-dist/tex/latex/bibleref-parse/bibleref-parse.sty | 76 |
1 files changed, 54 insertions, 22 deletions
diff --git a/Master/texmf-dist/tex/latex/bibleref-parse/bibleref-parse.sty b/Master/texmf-dist/tex/latex/bibleref-parse/bibleref-parse.sty index ceded4813a5..fbd71127a4c 100644 --- a/Master/texmf-dist/tex/latex/bibleref-parse/bibleref-parse.sty +++ b/Master/texmf-dist/tex/latex/bibleref-parse/bibleref-parse.sty @@ -14,7 +14,7 @@ % % This work consists of the files listed in README % -\ProvidesPackage{bibleref-parse}[2011/03/29 v1.0 Parsing of Bible references] +\ProvidesPackage{bibleref-parse}[2011/04/10 v1.1 Parsing of Bible references] % command definitions \RequirePackage{etoolbox} @@ -129,12 +129,12 @@ % 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}% -} +%\BeforePackage{bibleref-german}{% +% \csundef{br@Phlm}% +% \csundef{br@Tob}% +% \csundef{br@Sir}% +% \csundef{br@Bar}% +%} % these are not in bibleref.sty \providecommand{\BRadditionsto}{Additionsto} @@ -477,6 +477,36 @@ \ifboolexpe{ not ( test{\ifnumcomp{`#1}{<}{`0}} or test{\ifnumcomp{`#1}{>}{`9}} ) }% } +% \brp@ifcs{token}{true}{false} +\newcommand*{\brp@ifcs}[1]{% + \expandafter\brp@@ifcs\detokenize{#1}aa\brp@endlist +} +\def\brp@@ifcs #1#2\brp@endlist{% + \ifnumcomp{`#1}{=}{92}%test for backslash +} + +% \brp@expandcs{tokens} +% Expand all control sequences, but leave active characters as is +% The result is stored in \brp@expanded +\newcommand*{\brp@expandcs}[1]{% + \let\brp@expanded\@empty + \brp@@expandcs #1\brp@endlist +} +\newcommand*{\brp@@expandcs}[1]{% + \ifx#1\brp@endlist + \let\brp@next\@empty + \else + \brp@ifcs{#1}{% + \def\brp@next{\expandafter\brp@@expandcs #1}% + }{% + \appto\brp@expanded{#1}% + \let\brp@next\brp@@expandcs + }% + \fi + \brp@next +} + + % The main macro: % \brp@parse{passagedesc} % This will set \brp@result to a sequence of @@ -495,6 +525,8 @@ \PackageError{bibleref-parse}{unknown option '##1'}{}% }}% \docsvlist{#1}% + % expand all control sequences in #2, result in \brp@expanded + \brp@expandcs{#2}% % determine what to do with a comma \iftoggle{brp@commaauto}{% \iftoggle{brp@commalikeBR}{% @@ -505,7 +537,7 @@ }% }{}% \iftoggle{brp@commapreferchvsep}{% - \brp@ifsubstring{:}{#2}{% + \brp@ifsubstring{:}{\brp@expanded}{% \togglefalse{brp@commaischvsep}% }{% \toggletrue{brp@commaischvsep}% @@ -526,7 +558,7 @@ \let\brp@result\@empty \let\brp@data@book\@empty % the actual parsing - \expandafter\brp@parse@book #2\brp@endlist + \expandafter\brp@parse@book\brp@expanded\brp@endlist } % helper macro to determine if a string has a substring @@ -551,7 +583,7 @@ \def\brp@parse@book#1{% \ifx#1\brp@endlist % reference to a complete book - \brp@bookname{\brp@data@book}% + \expandafter\brp@bookname\expandafter{\brp@data@book}% \eappto\brp@result{\noexpand\brp@range{\brp@bk}{}{}{}{}}% \let\brp@nextcom=\@empty \else @@ -565,7 +597,7 @@ \let\brp@data@chapterstart=\@empty \let\brp@data@versestart=\@empty % skip to verse parsing for one-chapter books - \brp@bookname{\brp@data@book}% + \expandafter\brp@bookname\expandafter{\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 @@ -581,13 +613,13 @@ }{% \if;#1% % reference to a complete book - \brp@bookname{\brp@data@book}% + \expandafter\brp@bookname\expandafter{\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}% + \expandafter\brp@bookname\expandafter{\brp@data@book}% \eappto\brp@result{\noexpand\brp@range{\brp@bk}{}{}{}{}}% \let\brp@data@book\@empty \let\brp@nextcom\brp@parse@book @@ -1102,8 +1134,7 @@ % 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 + \brp@parsebook #1\brp@endlist } \def\brp@parsebook#1{% @@ -1117,7 +1148,7 @@ }% \let\brp@next\relax \else - \if.#1\else + \if.#1\relax\else \appto\brp@book{#1}% \ifcsdef{brp@bkp@\expandafter\detokenize\expandafter{\brp@book}}{% \edef\brp@bk{\csuse{brp@bkp@\expandafter\detokenize\expandafter{\brp@book}}}% @@ -1168,7 +1199,8 @@ \def\brp@convert@clearcache{% \ifdefempty{\brp@chaplist}{% \ifdefempty{\brp@verselist}{}{% - \eappto\brp@brlist{(\brp@chaplist:\brp@verselist)}}% + % special handling of one-chapter books + \eappto\brp@brlist{(\brp@verselist:)}}% }{% \eappto\brp@brlist{(\brp@chaplist:\brp@verselist)}}% } @@ -1188,10 +1220,10 @@ }% \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{}% + \def\brp@startverse{#3}% + \def\brp@endchap{}% + \def\brp@endverse{#5}% }{% \def\brp@startchap{#2}% \def\brp@startverse{#3}% @@ -1246,7 +1278,7 @@ \ifdefempty{\brp@startverse}{% \ifdefempty{\brp@chaplist}{}{% % \appto\brp@chaplist{,} - % due to a bug in bibleref, we need to start a new paren + % bibleref syntax requires us to start a new paren \brp@convert@clearcache \let\brp@verselist\@empty \let\brp@chaplist\@empty |