summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/dataref
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2015-09-17 23:49:24 +0000
committerKarl Berry <karl@freefriends.org>2015-09-17 23:49:24 +0000
commita7b382b0bdec52e471de64558fd90ab3dd9e2663 (patch)
tree970087e25f5743b75959d9a09f2e3e8e87da217d /Master/texmf-dist/source/latex/dataref
parent9fd7d087755d8f3890acd6ca639d5a725ed3b176 (diff)
dataref (17sep15)
git-svn-id: svn://tug.org/texlive/trunk@38394 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex/dataref')
-rw-r--r--Master/texmf-dist/source/latex/dataref/dataref.dtx76
1 files changed, 45 insertions, 31 deletions
diff --git a/Master/texmf-dist/source/latex/dataref/dataref.dtx b/Master/texmf-dist/source/latex/dataref/dataref.dtx
index ff126d27305..50fcb2dac9c 100644
--- a/Master/texmf-dist/source/latex/dataref/dataref.dtx
+++ b/Master/texmf-dist/source/latex/dataref/dataref.dtx
@@ -1,25 +1,21 @@
% \iffalse meta-comment
%
-% The MIT License (MIT)
-
% Copyright (c) 2013 Christian Dietrich
+%
+% This work may be distributed and/or modified under the
+% conditions of the LaTeX Project Public License, either version 1.3
+% of this license or (at your option) any later version.
+% The latest version of this license is in
+% http://www.latex-project.org/lppl.txt
+% and version 1.3 or later is part of all distributions of LaTeX
+% version 2005/12/01 or later.
+%
+% This work has the LPPL maintenance status `maintained'.
+%
+% The Current Maintainer of this work is Christian Dietrich
%
-% 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.
+% This work consists of the files dataref.dtx and dataref.ins
+% and the derived file dataref.sty.
% \fi
%
% \iffalse
@@ -28,11 +24,11 @@
%</driver>
%<package>\NeedsTeXFormat{LaTeX2e}[1999/12/01]
%<package>\ProvidesPackage{dataref}
-%<package> [2015/04/21 v0.4 dataref]
+%<package> [2015/09/17 v0.5 dataref]
%
%<*driver>
\documentclass{ltxdoc}
-\usepackage[usagereport]{dataref}[2015/04/21]
+\usepackage[usagereport]{dataref}[2015/09/17]
\EnableCrossrefs
\CodelineIndex
\RecordChanges
@@ -189,6 +185,8 @@
%
% The helptext for a key is obtained by using the \cmd{\drefhelp} macro. It checks all defined helps (in linear order, first defined, first matched), and prints the first matching help text.
%
+% For \textbf{LuaTeX}: When using this \TeX{} engine, only Lua (string.find)
+% regular expressions are supported as patterns.
% \begin{quote}
% \verb|\drefhelp{/med A/mice race}|
% \end{quote}
@@ -550,12 +548,10 @@
%
% \begin{macrocode}
\RequirePackage{pgf}
+\RequirePackage{iftex}
\RequirePackage{kvoptions}
\usepgflibrary{fpu}
\usepackage{etoolbox}
-\let\origforlistloop\forlistloop
-\usepackage{etextools}
-\let\forlistloop\origforlistloop
\RequirePackage{xcolor}
% \end{macrocode}
@@ -623,12 +619,6 @@
\immediate\write\@auxout{\noexpand\dref@found{\drefcurrentkey}{\dref@thepage}}%
}{%
\immediate\write\@auxout{\noexpand\dref@notfound{\drefcurrentkey}{\dref@thepage}}%
- \ifdref@ignoremissing%
- \typeout{Dref warning: undefined key `\drefcurrentkey'}%
- \dref@mkannotate{UNDEFINED: \drefcurrentkey}%
- \else%
- \dref@error{Dref error: undefined key `\drefcurrentkey'}%
- \fi%
}%
\immediate\write\@auxout{\noexpand\dref@referenced{\drefcurrentkey}{\dref@thepage}}%
}
@@ -688,8 +678,32 @@
%
% \begin{macro}{\dref@help@match}
% \begin{macrocode}
+%% dref@ifstrmatch is copied from etextools, but etextools is
+%% incompatible with etoolbox
+%% \ifstrmatch{ pattern }{ string }{ true }{ false }
+\ifPDFTeX%
+\let\dref@strmatch\pdfmatch
+\fi
+\ifLuaTeX%
+\newcommand{\dref@strmatch}[2]{%
+ \directlua{%
+ local match = string.find("\luaescapestring{#2}", "\luaescapestring{#1}");%
+ if match then
+ tex.print("1");
+ else
+ tex.print("0");
+ end
+ }%
+}
+\fi
+\long\def\dref@firstoftwo#1#2{\z@#1} %% for romannumeral
+\long\def\dref@secondoftwo#1#2{\z@#2}%% for romannumeral
+\newcommand{\dref@ifstrmatch}[2]{%
+ \romannumeral\csname dref@%
+ \ifnum\dref@strmatch{#1}{#2}=1 first\else second\fi oftwo\endcsname%
+}
\newcommand{\dref@help@match}[2]{%
- \ifstrmatch{#1}{#2}%
+ \dref@ifstrmatch{#1}{#2}%
}
% \end{macrocode}
% \end{macro}
@@ -999,7 +1013,7 @@
\expandafter\def\expandafter\dref@usagereport@strippath@\dref@datapath#1\blanktest{#1}
\newcommand{\dref@usagereport@strippath}[1]{%
- \expandafter\ifstrmatch\expandafter{\expandafter^\dref@datapath.*$}{#1}%
+ \expandafter\dref@ifstrmatch\expandafter{\expandafter^\dref@datapath.*$}{#1}%
{\dref@usagereport@strippath@#1\blanktest}%
{#1}%
}