summaryrefslogtreecommitdiff
path: root/texmf-dist/source/latex/acrotex/insdljs.dtx
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2018-09-13 10:28:30 +0900
committerNorbert Preining <norbert@preining.info>2018-09-13 10:28:30 +0900
commit26f4947f509c2440ce28e625133a15f6a2446920 (patch)
tree8789ff207ced3a161133a246fca03446b24b3edc /texmf-dist/source/latex/acrotex/insdljs.dtx
parent6ec0713f46508d1e4aa5741e30152add5e10776f (diff)
update acrotex
Diffstat (limited to 'texmf-dist/source/latex/acrotex/insdljs.dtx')
-rw-r--r--texmf-dist/source/latex/acrotex/insdljs.dtx296
1 files changed, 149 insertions, 147 deletions
diff --git a/texmf-dist/source/latex/acrotex/insdljs.dtx b/texmf-dist/source/latex/acrotex/insdljs.dtx
index 5181c985..10f62df0 100644
--- a/texmf-dist/source/latex/acrotex/insdljs.dtx
+++ b/texmf-dist/source/latex/acrotex/insdljs.dtx
@@ -16,7 +16,7 @@
%</copyright>
%<package>\NeedsTeXFormat{LaTeX2e}
%<package>\ProvidesPackage{insdljs}
-%<package> [2017/09/03 v2.3g Insert Document Level JavaScripts (dps)]
+%<package> [2018/07/21 v2.4 Insert Document Level JavaScripts (dps)]
%<*driver>
\documentclass{ltxdoc}
\usepackage[colorlinks,hyperindex=false]{hyperref}
@@ -37,7 +37,6 @@
\def\ameta#1{\ensuremath{\langle\textit{\texttt{#1}}\rangle}}
\def\meta#1{\textsl{\texttt{#1}}}
\def\SUB#1{\ensuremath{{}_{\mbox{\scriptsize\ttfamily#1}}}}
-
\InputIfFileExists{aebdocfmt.def}{\PackageInfo{insdljs}{Inputting aebdocfmt.def}}
{\def\IndexOpt{\DescribeMacro}\def\IndexKey{\DescribeMacro}\let\setupFullwidth\relax
\PackageInfo{insdljs}{aebdocfmt.def cannot be found}}
@@ -398,7 +397,7 @@
%
% The options are \texttt{dvipsone}, \texttt{dvips}, \texttt{pdftex} and
% \texttt{dvipdfm}. The default is \texttt{dvipsone}/\texttt{dvips}.
-% \chages{v2.3g}{2017/09/03}{Added ifluatex package}
+% \changes{v2.3g}{2017/09/03}{Added ifluatex package}
% \begin{macrocode}
%<*package>
\usepackage{xkeyval}
@@ -426,7 +425,7 @@
% \IndexOpt{dvipdfm}
% \IndexOpt{dvipdfmx}
% \IndexOpt{xetex}
-% \chages{v2.3g}{2017/09/03}{Added luatex option}
+% \changes{v2.3g}{2017/09/03}{Added luatex option}
% \begin{macrocode}
\DeclareOptionX{pdftex}{\def\dljs@drivernum{1}}
\DeclareOptionX{luatex}{\def\dljs@drivernum{1}}
@@ -638,6 +637,14 @@
\literalps@out{\AEB@psMrk{Catalog} <<\dl@@reqJS>> /PUT pdfmark}\fi\fi
\fi
% \end{macrocode}
+% Added switch to mark whether djs is inserted
+% \changes{v2.4}{2018/07/21}{Added switch}{Added \cs{ifthereisdjs}}
+% \begin{macrocode}
+\newif\ifthereisdjs \thereisdjsfalse
+\def\applydljs#1{\ifthereisdjs\else#1
+ \global\thereisdjstrue\fi}
+% \end{macrocode}
+%
% \section{Main Code}
%
% Before we begin, we need to document the problems that need to be addressed by this package.
@@ -1664,16 +1671,18 @@
\iwvo{endobj}
\iwvo{2 0 obj}
% \end{macrocode}
-% When a non-Distiller workflow, insure execJSs are listed first.
-% \changes{v2.2h}{2016/06/09}{When a non-Distiller workflow, insure execJSs are listed first}
-% \begin{macrocode}
-\ifpdfmarkup
- \iwvo{[ (ExecJS \dljsBase) (var _\dljsBase\space = true;) ] }\else
- \iwvo{[ (00 ExecJS \dljsBase) (var _\dljsBase\space = true;) ] }\fi
- \iwvo{endobj}
- \iwvo{3 0 obj}
- \iwvo{<<>>}
- \iwvo{stream}
+% When a non-Distiller workflow, ensure execJSs are listed first.
+% \changes{v2.2h}{2016/06/09}{When a non-Distiller workflow, ensure execJSs are listed first}
+% \begin{macrocode}
+ \let\x\@empty
+ \applydljs{\def\x{^^Jvar _thereisdjs=true;}}%
+ \ifpdfmarkup
+ \iwvo{[ (ExecJS \dljsBase) (var _\dljsBase\space = true;\x) ] }\else
+ \iwvo{[ (00 ExecJS \dljsBase) (var _\dljsBase\space = true;\x)] }\fi
+ \iwvo{endobj}
+ \iwvo{3 0 obj}
+ \iwvo{<<>>}
+ \iwvo{stream}
}
% \end{macrocode}
% \begin{environment}{execJS}
@@ -1871,26 +1880,27 @@
\endgroup
\def\fdfheader
{%
- \iwvo{\string\begingroup\string\efdlspecials}
- \iwvo{\string\isdljstrue}
- \iwvo{\string\makeatletter}
- \iwvo{\string\immediate\string\openout\string
- \js@verbatim@out=\string\js@Path\space\dljsBase.fdf}%
- \iwvo{\string\begin{jsexpverbatimwrite}}
- \iwvo{\string\firstFDFline}
- \iwvo{1 0 obj}
- \iwvo{<< /FDF << /JavaScript << /Doc 2 0 R >> >> >>}
- \iwvo{endobj}
- \iwvo{2 0 obj}
- \iwvo{[ \string\csname\string\@gobble\space\dljsBase%
- OBJ\string\endcsname]}
- \iwvo{endobj}
+ \iwvo{\string\begingroup\string\efdlspecials}
+ \iwvo{\string\isdljstrue}
+ \iwvo{\string\makeatletter}
+ \iwvo{\string\immediate\string\openout\string
+ \js@verbatim@out=\string\js@Path\space\dljsBase.fdf}%
+ \iwvo{\string\begin{jsexpverbatimwrite}}
+ \iwvo{\string\firstFDFline}
+ \iwvo{1 0 obj}
+ \iwvo{<< /FDF << /JavaScript << /Doc 2 0 R >> >> >>}
+ \iwvo{endobj}
+ \iwvo{2 0 obj}
+ \iwvo{[ \string\csname\string\@gobble\space\dljsBase%
+ OBJ\string\endcsname]}
+ \iwvo{endobj}
}
\def\fdfbeginstreamobj
{%
- \iwvo{\thedljssegs\space 0 obj}
- \iwvo{<<>>}
- \iwvo{stream}
+ \iwvo{\thedljssegs\space 0 obj}
+ \iwvo{<<>>}
+ \iwvo{stream}
+ \applydljs{\iwvo{var _thereisdjs=true;}}
% \end{macrocode}
% If the user has not passed the optional
% name, we generated one for him, now we insert it into the \texttt{stream}.
@@ -1903,19 +1913,19 @@
\fi
}
\def\fdfendstreamobj{%
- \iwvo{endstream}
- \iwvo{endobj}
+ \iwvo{endstream}
+ \iwvo{endobj}
}
- \def\fdftrailer{%
- \iwvo{trailer}
- \iwvo{<< /Root 1 0 R >>}
- \iwvo{\string\lastFDFline}
+\def\fdftrailer{%
+ \iwvo{trailer}
+ \iwvo{<< /Root 1 0 R >>}
+ \iwvo{\string\lastFDFline}
% \end{macrocode}
% Here we write \texttt{*end{jsexpverbatimwrite}} as a signal for our modified verbatim write
% code to stop.
% \begin{macrocode}
- \iwvo{*end{jsexpverbatimwrite}}
- \iwvo{\string\endgroup}
+ \iwvo{*end{jsexpverbatimwrite}}
+ \iwvo{\string\endgroup}
}
% \end{macrocode}
% There may be more than one use of the \texttt{insDLJS}
@@ -2021,84 +2031,77 @@ if(typeof \detectdljs\space == "undefined")\jsR\jsT
@endgroup
\def\begindljs
{%
- \iwvo{\string\begingroup\string\efdlspecials}
- \iwvo{\string\isdljstrue}
+ \iwvo{\string\begingroup\string\efdlspecials}
+ \iwvo{\string\isdljstrue}
% \end{macrocode}
%\changes{v2.2f}{2016/05/07}{Include \string\cs{makeletter} in verbatim write}
% \begin{macrocode}
- \iwvo{\string\makeatletter}
- {\uccode`c=`\%\uppercase{%
- \iwvo{\string\obeyspaces\string\obeylines
- \string\let\string^\string^M=\string\jsR c}}}
+ \iwvo{\string\makeatletter}
+ {\uccode`c=`\%\uppercase{%
+ \iwvo{\string\obeyspaces\string\obeylines
+ \string\let\string^\string^M=\string\jsR c}}}
% \end{macrocode}
% (2014/08/09) For pdftex and xetex, this global let messages up
% the \texttt{Verbatim} environment. Not sure why this is global anyway
%\begin{verbatim}
-% \iwvo{\string\obeyspaces\string\obeylines\string
-% \global\string\let\string^\string^M=\string\jsR c}}}
+% \iwvo{\string\obeyspaces\string\obeylines\string
+% \global\string\let\string^\string^M=\string\jsR c}}}
%\end{verbatim}
% \begin{macrocode}
- {\escapechar=-1 \lccode`C=`\%\lowercase{%
- \iwvo{\string\\catcode`\string\\"=12C}}}
+ {\escapechar=-1 \lccode`C=`\%\lowercase{%
+ \iwvo{\string\\catcode`\string\\"=12C}}}
}
-\def\beginseg
-{%
- {\lccode`P=`\{\lccode`C=`\%\lowercase{%
- \iwvo{\string\gdef\string\dljs\dljsBase\roman{dljssegs}PC}}}%
+\def\beginseg{%
+ {\lccode`P=`\{\lccode`C=`\%\lowercase{%
+ \iwvo{\string\gdef\string\dljs\dljsBase\roman{dljssegs}PC}}}%
+ \applydljs{\iwvo{var _thereisdjs=true;}}%
}
% \end{macrocode}
% With \cs{enddsljs}, we now finish the macro definition with a closing right brace, followed by a
% comment, `\texttt\%, and an end of group.
% \begin{macrocode}
-\def\endseg
-{%
- {\uccode`c=`\%\uccode`p=`\}\uppercase{\iwvo{pc}}}%
-}
-\def\enddljs
-{%
- \iwvo{\string\endgroup}%
-}
+\def\endseg{{\uccode`c=`\%\uccode`p=`\}\uppercase{\iwvo{pc}}}}
+\def\enddljs{\iwvo{\string\endgroup}}
% \end{macrocode}
%\changes{v2.0j}{2011/06/27}{made some changes as suggested by Christian Feuersaenger, who reported some
% problem clashes between \textsf{babel} (spanish) and \textsf{insdljs}.}
% \begin{macrocode}
\def\@roman#1{\romannumeral#1}
-\def\write@objs
-{%
- \iwvo{\begingroup}
- \iwvo{\string\catcode`\string\<=12 }
- \iwvo{\string\catcode`\string\>=12 }
- {\lccode`C=`\%\lowercase{\iwvo{\string\ccpdftex C}}}
- {\lccode`C=`\%\lowercase{\iwvo{%
- \string\input{dljscc.def}C\the\dljsobjtoks}}}
- \iwvo{\endgroup}
+\def\write@objs{%
+ \iwvo{\begingroup}
+ \iwvo{\string\catcode`\string\<=12 }
+ \iwvo{\string\catcode`\string\>=12 }
+ {\lccode`C=`\%\lowercase{\iwvo{\string\ccpdftex C}}}
+ {\lccode`C=`\%\lowercase{\iwvo{%
+ \string\input{dljscc.def}C\the\dljsobjtoks}}}
+ \iwvo{\endgroup}
}
% \end{macrocode}
% \subsubsection{\texttt{pdftex} Specific Code}
% \begin{macrocode}
\newenvironment{newsegment@pdftex}[1]{%
- \addtocounter{dljssegs}{1}%
- \addtocounter{dljs@cnt}{1}%
- \edef\tmp{^^J\string\immediate\string\pdfobj{ << /S/JavaScript/JS%
- (\string\dljs\dljsBase\roman{dljssegs}) >> }}%
- \edef\@dljstmp{\the\dljsobjtoks\tmp}%
- \global\dljsobjtoks=\expandafter{\@dljstmp}%
- \edef\tmp{^^J\string\xdef\string\obj\dljsBase\roman{dljssegs}%
- {\string\the\string\pdflastobj\string\space 0 R}}%
- \edef\@dljstmp{\the\dljsobjtoks\tmp}%
- \global\dljsobjtoks=\expandafter{\@dljstmp}%
- \edef\curr@Cnt{\ifnum\arabic{dljs@cnt}<10 0\fi\arabic{dljs@cnt}}%
- \Hy@unicodefalse\pdfstringdef{\dljsName}{#1}%
- \edef\dljspdftextmp
- {\the\importfdftoks (\curr@Cnt\space\dljsName)
- \noexpand\csname obj\dljsBase\roman{dljssegs}%
- \noexpand\endcsname\space}%
- \global\importfdftoks=\expandafter{\dljspdftextmp}%
- \beginseg
- \js@verbatimwrite
+ \addtocounter{dljssegs}{1}%
+ \addtocounter{dljs@cnt}{1}%
+ \edef\tmp{^^J\string\immediate\string\pdfobj{ << /S/JavaScript/JS%
+ (\string\dljs\dljsBase\roman{dljssegs}) >> }}%
+ \edef\@dljstmp{\the\dljsobjtoks\tmp}%
+ \global\dljsobjtoks=\expandafter{\@dljstmp}%
+ \edef\tmp{^^J\string\xdef\string\obj\dljsBase\roman{dljssegs}%
+ {\string\the\string\pdflastobj\string\space 0 R}}%
+ \edef\@dljstmp{\the\dljsobjtoks\tmp}%
+ \global\dljsobjtoks=\expandafter{\@dljstmp}%
+ \edef\curr@Cnt{\ifnum\arabic{dljs@cnt}<10 0\fi\arabic{dljs@cnt}}%
+ \Hy@unicodefalse\pdfstringdef{\dljsName}{#1}%
+ \edef\dljspdftextmp
+ {\the\importfdftoks (\curr@Cnt\space\dljsName)
+ \noexpand\csname obj\dljsBase\roman{dljssegs}%
+ \noexpand\endcsname\space}%
+ \global\importfdftoks=\expandafter{\dljspdftextmp}%
+ \beginseg
+ \js@verbatimwrite
}{%
- \endjs@verbatimwrite
- \endseg
+ \endjs@verbatimwrite
+ \endseg
}
% \end{macrocode}
% The main branch of the \texttt{insDLJS} for \texttt{pdftex}. This
@@ -2106,26 +2109,26 @@ if(typeof \detectdljs\space == "undefined")\jsR\jsT
% is input back into the file using \cmd{\AtBeginDocument}.
% \begin{macrocode}
\newenvironment{insert@DLJS@pdftex}{%
- \expandafter\gdef\csname dljs\dljsBase\endcsname{}%
- \immediate\openout \js@verbatim@out \js@Path\dljsBase.djs
- \begindljs
- \ifx\multisegments\dl@NO\expandafter
- \newsegment\expandafter{\expandafter\dljsName\expandafter}\fi
+ \expandafter\gdef\csname dljs\dljsBase\endcsname{}%
+ \immediate\openout \js@verbatim@out \js@Path\dljsBase.djs
+ \begindljs
+ \ifx\multisegments\dl@NO\expandafter
+ \newsegment\expandafter{\expandafter\dljsName\expandafter}\fi
}{%
- \ifx\multisegments\dl@NO\expandafter\endnewsegment\fi
- \enddljs
- \write@objs
- \endjs@verbatimwrite
- \closejs@verbatim@out
- \edef\@dljstmp{\noexpand\AtBeginDocument{%
- \noexpand\input{\js@Path\dljsBase.djs}}}%
- \@dljstmp
- \ifx\importdljs\dl@YES
- \ifx\firstdljs\dl@YES
- \AtEndDocument{\edef\@dljstmp{\setDLJSRef@pdftex}\@dljstmp}
- \global\let\firstdljs\dl@NO
- \fi
+ \ifx\multisegments\dl@NO\expandafter\endnewsegment\fi
+ \enddljs
+ \write@objs
+ \endjs@verbatimwrite
+ \closejs@verbatim@out
+ \edef\@dljstmp{\noexpand\AtBeginDocument{%
+ \noexpand\input{\js@Path\dljsBase.djs}}}%
+ \@dljstmp
+ \ifx\importdljs\dl@YES
+ \ifx\firstdljs\dl@YES
+ \AtEndDocument{\edef\@dljstmp{\setDLJSRef@pdftex}\@dljstmp}
+ \global\let\firstdljs\dl@NO
\fi
+ \fi
}
% \end{macrocode}
% This code places the \texttt{/JavaScript} key-value in the \texttt{/Names} dictionary
@@ -2145,26 +2148,26 @@ if(typeof \detectdljs\space == "undefined")\jsR\jsT
% \begin{macrocode}
\newenvironment{newsegment@dvipdfm}[1]
{%
- \addtocounter{dljssegs}{1}%
- \addtocounter{dljs@cnt}{1}%
- \edef\tmp{^^J\string\immediate\string
- \csname\space @pdfm@mark\string\endcsname
- {obj @obj\dljsBase\roman{dljssegs}\space << /S/JavaScript%
- /JS(\string\dljs\dljsBase\roman{dljssegs}) >> }}%
- \edef\@dljstmp{\the\dljsobjtoks\space\tmp}%
- \global\dljsobjtoks=\expandafter{\@dljstmp}%
- \edef\curr@Cnt{\ifnum\arabic{dljs@cnt}<10 0\fi\arabic{dljs@cnt}}%
- {\def\1{\string\1}\def\2{\string2}%
- \def\3{\string\3}\xdef\dljsName{#1}}%
- \edef\dljspdftextmp
- {\the\importfdftoks (\curr@Cnt\space \dljsName) %
- @obj\dljsBase\roman{dljssegs}\space}%
- \global\importfdftoks=\expandafter{\dljspdftextmp}%
- \beginseg
- \js@verbatimwrite
+ \addtocounter{dljssegs}{1}%
+ \addtocounter{dljs@cnt}{1}%
+ \edef\tmp{^^J\string\immediate\string
+ \csname\space @pdfm@mark\string\endcsname
+ {obj @obj\dljsBase\roman{dljssegs}\space << /S/JavaScript%
+ /JS(\string\dljs\dljsBase\roman{dljssegs}) >> }}%
+ \edef\@dljstmp{\the\dljsobjtoks\space\tmp}%
+ \global\dljsobjtoks=\expandafter{\@dljstmp}%
+ \edef\curr@Cnt{\ifnum\arabic{dljs@cnt}<10 0\fi\arabic{dljs@cnt}}%
+ {\def\1{\string\1}\def\2{\string2}%
+ \def\3{\string\3}\xdef\dljsName{#1}}%
+ \edef\dljspdftextmp
+ {\the\importfdftoks (\curr@Cnt\space \dljsName) %
+ @obj\dljsBase\roman{dljssegs}\space}%
+ \global\importfdftoks=\expandafter{\dljspdftextmp}%
+ \beginseg
+ \js@verbatimwrite
}{%
- \endjs@verbatimwrite
- \endseg
+ \endjs@verbatimwrite
+ \endseg
}
% \end{macrocode}
% This code places the \texttt{/JavaScript} key-value in the \texttt{/Names} dictionary
@@ -2185,30 +2188,29 @@ if(typeof \detectdljs\space == "undefined")\jsR\jsT
% \begin{macrocode}
\newenvironment{insert@DLJS@dvipdfm}
{%
- \expandafter\gdef\csname dljs\dljsBase\endcsname{}%
- \immediate\openout \js@verbatim@out \js@Path\dljsBase.djs
- \begindljs
- \ifx\multisegments\dl@NO\expandafter\newsegment\expandafter{%
- \expandafter\dljsName\expandafter}\fi
+ \expandafter\gdef\csname dljs\dljsBase\endcsname{}%
+ \immediate\openout \js@verbatim@out \js@Path\dljsBase.djs
+ \begindljs
+ \ifx\multisegments\dl@NO\expandafter\newsegment\expandafter{%
+ \expandafter\dljsName\expandafter}\fi
}{%
- \ifx\multisegments\dl@NO\expandafter\endnewsegment\fi
- \enddljs
- \write@objs
- \endjs@verbatimwrite
- \closejs@verbatim@out
- \edef\@dljstmp{\noexpand\AtBeginDocument{%
- \noexpand\input{\js@Path\dljsBase.djs}}}%
- \@dljstmp
- \ifx\importdljs\dl@YES
- \ifx\firstdljs\dl@YES
+ \ifx\multisegments\dl@NO\expandafter\endnewsegment\fi
+ \enddljs
+ \write@objs
+ \endjs@verbatimwrite
+ \closejs@verbatim@out
+ \edef\@dljstmp{\noexpand\AtBeginDocument{%
+ \noexpand\input{\js@Path\dljsBase.djs}}}%
+ \@dljstmp
+ \ifx\importdljs\dl@YES
+ \ifx\firstdljs\dl@YES
% \end{macrocode}
% 2012/06/09 Changed positioning of \cmd{\setDLJSRef@dvipdfm}.
% \begin{macrocode}
- \AtBeginDocument{\setDLJSRef@dvipdfm}%
-% \AtEndDocument{\setDLJSRef@dvipdfm}
- \global\let\firstdljs\dl@NO
- \fi
+ \AtBeginDocument{\setDLJSRef@dvipdfm}%
+ \global\let\firstdljs\dl@NO
\fi
+ \fi
}
\catcode`\"=\dl@dquoteCat
%</package>