texlive[47137] trunk: texdef (26mar18)

commits+karl at tug.org commits+karl at tug.org
Mon Mar 26 23:16:58 CEST 2018


Revision: 47137
          http://tug.org/svn/texlive?view=revision&revision=47137
Author:   karl
Date:     2018-03-26 23:16:58 +0200 (Mon, 26 Mar 2018)
Log Message:
-----------
texdef (26mar18)

Modified Paths:
--------------
    trunk/Build/source/texk/texlive/linked_scripts/texdef/texdef.pl
    trunk/Master/texmf-dist/doc/support/texdef/README
    trunk/Master/texmf-dist/doc/support/texdef/texdef.pdf
    trunk/Master/texmf-dist/scripts/texdef/texdef.pl
    trunk/Master/texmf-dist/source/support/texdef/texdef.tex

Added Paths:
-----------
    trunk/Master/texmf-dist/doc/support/texdef/CHANGELOG

Modified: trunk/Build/source/texk/texlive/linked_scripts/texdef/texdef.pl
===================================================================
--- trunk/Build/source/texk/texlive/linked_scripts/texdef/texdef.pl	2018-03-26 21:16:38 UTC (rev 47136)
+++ trunk/Build/source/texk/texlive/linked_scripts/texdef/texdef.pl	2018-03-26 21:16:58 UTC (rev 47137)
@@ -30,6 +30,7 @@
     $TEX = $1;
 }
 my $TEXOPTIONS = " -interaction nonstopmode ";
+my $USERTEXOPTIONS = "";
 
 ## Variables for options and settings
 my $CLASS      = undef;
@@ -115,14 +116,14 @@
 my $BEGINENVSTR = '%s';
 my $ENDENVSTR   = '%s';
 
-my $VERSION = 'Version 1.7c -- 2017/12/09';
+my $VERSION = 'Version 1.8 -- 2018/03/25';
 sub usage {
     my $option = shift;
     my $ret    = ($option) ? 0 : 1;
 print << 'EOT';
 texdef -- Show definitions of TeX commands
-Version 1.7c -- 2017/12/09
-Copyright (C) 2011-2017  Martin Scharrer <martin at scharrer-online.de>
+Version 1.8 -- 2019/03/25
+Copyright (C) 2011-2018  Martin Scharrer <martin at scharrer-online.de>
 This program comes with ABSOLUTELY NO WARRANTY;
 This is free software, and you are welcome to redistribute it under certain conditions;
 
@@ -136,6 +137,7 @@
   --tex <format>, -t <format>   : Use given format of TeX: 'tex', 'latex', 'context'.
                                   Variations of 'tex' and 'latex', like 'luatex', 'lualatex', 'xetex', 'xelatex' are supported.
                                   The default is given by the used program name: 'texdef' -> 'tex', 'latexdef' -> 'latex', etc.
+  --texoptions <options>        : Call (La)TeX with the given options.
   --source, -s                  : Try to show the original source code of the command definition (L).
   --value, -v                   : Show value of command instead (i.e. \the\command).
   --Environment, -E             : Every command name is taken as an environment name. This will show the definition of
@@ -146,7 +148,7 @@
                                   or 'context' is used. For LaTeX the <pkg> can start with `[<options>]` and end 
                                   with `<pkgname>` or `{<pkgname>}`.
   --class <class>, -c <class>   : (LaTeX only) Load given class instead of default ('article').
-                                  The <class> can start with `[<classs options>]` and end 
+                                  The <class> can start with `[<class options>]` and end 
                                   with `<classname>` or `{<classname>}`.
   --environment <env>, -e <env> : (M) Show definition inside the given environment <env>.
   --othercode <code>, -o <code> : (M) Add other code into the preamble before the definition is shown.
@@ -247,6 +249,7 @@
    'before|b=s' => \&envcode,
    'after|a=s' => \&envcode,
    'tex|t=s' => \$TEX,
+   'texoptions=s' => \$USERTEXOPTIONS,
    'help|h' => \&usage,
    'pgf-keys|k' => \$PGFKEYS,
    'pgf-Keys|K' => \$PGFKEYSPLAIN,
@@ -319,9 +322,14 @@
   $ENDENVSTR   = '\stop%s'  . "\n";
 }
 
+if ($TEX =~ /^dvi((la)?tex)$/) {
+  $TEX = $1;
+  $TEXOPTIONS .= ' -output-format=dvi '
+}
+
 $USERCLASS = $CLASS;
 $CLASS = 'article' if not $CLASS;
-$CLASS =~ /^(?:\[(.*)\])?{?(.*?)}?$/;
+$CLASS =~ /^(?:\[(.*)\])?\{?(.*?)\}?$/;
 $CLASS = $2;
 my $CLASSOPTIONS = $1 || '';
 
@@ -503,7 +511,7 @@
         }
 
         foreach my $pkg (@PACKAGES) {
-            $pkg =~ /^(?:\[(.*)\])?{?(.*?)}?$/;
+            $pkg =~ /^(?:\[(.*)\])?\{?(.*?)\}?$/;
             my ($pkgname,$pkgoptions) = ($2, $1 || '');
             print "\\usepackage[$pkgoptions]{$pkgname}\n";
         }
@@ -623,7 +631,7 @@
 sub remove_invalid_braces {
     $_[0] =~ s/\\[\\%]//g; # remove \\ and \%
     $_[0] =~ s/%.*$//;     # remove line comments
-    $_[0] =~ s/\\[{}]//g;  # remove \{ and \}
+    $_[0] =~ s/\\[\{\}]//g;  # remove \{ and \}
 }
 
 sub env_braces {
@@ -766,7 +774,7 @@
     return $found;
 }
 
-open (my $texpipe, '-|', "$TEX $TEXOPTIONS \"$TMPFILE\" ");
+open (my $texpipe, '-|', "$TEX $TEXOPTIONS $USERTEXOPTIONS \"$TMPFILE\" ");
 
 my $name = '';
 my $definition = '';

Added: trunk/Master/texmf-dist/doc/support/texdef/CHANGELOG
===================================================================
--- trunk/Master/texmf-dist/doc/support/texdef/CHANGELOG	                        (rev 0)
+++ trunk/Master/texmf-dist/doc/support/texdef/CHANGELOG	2018-03-26 21:16:58 UTC (rev 47137)
@@ -0,0 +1,49 @@
+= Changelog =
+
+
+== v1.8 from 2018/03/25 ==
+ * Added "dvitex" and "dvilatex" as formats. These will set DVI mode on "tex" or "latex".
+ * Escaped further braces in regexs to avoid "Unescaped left brace in regex is deprecated" warnings or errors.
+ * Added option '--texoptions' to allow the passing of compiler options for special cases.
+
+== v1.7c from 2017/12/09 ==
+ * Fixed 'Unescaped left brace in regex is deprecated' warning.
+   Thanks goes to Paulo Cereda <cereda.paulo at gmail.com> for providing the patch.
+
+== v1.7b from 2012/05/15 ==
+ * Added support for \chardef, \countdef, \dimendef, \mathchardef, \myskip, \skipdef and \toksdef.
+ * Added support for \newbox, \newcount, \newdimen, \newif, \newinsert, \newread, \newskip, \newtoks, \newwrite.
+ * Added support for "\newif" and "\newcount".
+ * Changed internal processing order to put more frequently used elements first.
+
+== v1.7a from 2012/05/08 ==
+ * Fix for currfile v0.6.
+
+== v1.7 from 2012/05/07 ==
+ * Changed "--help" to return status code 0.
+ * Changed Windows default editor to texworks. Fixed If-statement.
+ * Fixed bug which reported name of included subpackages.
+ * Added option "--edit".
+ * Added "--editor" option and better editor handling.
+ * Added variable substitution for editor.
+ * Added support for "TEXDEF_EDITOR" variable. Added Mac "open" command.
+ * Fixed for behaviour when -s is used (correct name in message; do not follow protected macros etc.)
+
+== v1.6 from 2012/05/02 ==
+ * Changed implementation of -E option to work better with new environment source code.
+ * Added code to detect environment source definitions.
+ * Added -E option.
+ * Changed "flavour" to "format".
+ * Added support for \let.
+ * Added fallback for when the source code can not be found. Added support for -F with "latex.ltx".
+
+== v1.5 from 2012/04/29 ==
+ * Added experimental --source option to show source code of the definitions.
+ * Script now works correctly under MS Windows.
+
+== v1.4 from 2011/07/28 ==
+ * Added -F option to display file path.
+ * Added basic support for pdfkeys using -k and -K options.
+ * Added -V option to print version numbers of LaTeX packages or classes.
+ * Added '--tempdir' option to specify the location of the temporary files. Useful for debugging.
+

Modified: trunk/Master/texmf-dist/doc/support/texdef/README
===================================================================
--- trunk/Master/texmf-dist/doc/support/texdef/README	2018-03-26 21:16:38 UTC (rev 47136)
+++ trunk/Master/texmf-dist/doc/support/texdef/README	2018-03-26 21:16:58 UTC (rev 47137)
@@ -1,6 +1,6 @@
 texdef -- Show definitions of TeX commands
-Version 1.7c -- 2017/12/09
-Copyright (C) 2011-2017  Martin Scharrer <martin at scharrer-online.de>
+Version 1.8 -- 2019/03/25
+Copyright (C) 2011-2018  Martin Scharrer <martin at scharrer-online.de>
 This program comes with ABSOLUTELY NO WARRANTY;
 This is free software, and you are welcome to redistribute it under certain conditions;
 
@@ -14,6 +14,7 @@
   --tex <format>, -t <format>   : Use given format of TeX: 'tex', 'latex', 'context'.
                                   Variations of 'tex' and 'latex', like 'luatex', 'lualatex', 'xetex', 'xelatex' are supported.
                                   The default is given by the used program name: 'texdef' -> 'tex', 'latexdef' -> 'latex', etc.
+  --texoptions <options>        : Call (La)TeX with the given options.
   --source, -s                  : Try to show the original source code of the command definition (L).
   --value, -v                   : Show value of command instead (i.e. \the\command).
   --Environment, -E             : Every command name is taken as an environment name. This will show the definition of
@@ -24,7 +25,7 @@
                                   or 'context' is used. For LaTeX the <pkg> can start with `[<options>]` and end 
                                   with `<pkgname>` or `{<pkgname>}`.
   --class <class>, -c <class>   : (LaTeX only) Load given class instead of default ('article').
-                                  The <class> can start with `[<classs options>]` and end 
+                                  The <class> can start with `[<class options>]` and end 
                                   with `<classname>` or `{<classname>}`.
   --environment <env>, -e <env> : (M) Show definition inside the given environment <env>.
   --othercode <code>, -o <code> : (M) Add other code into the preamble before the definition is shown.

Modified: trunk/Master/texmf-dist/doc/support/texdef/texdef.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/scripts/texdef/texdef.pl
===================================================================
--- trunk/Master/texmf-dist/scripts/texdef/texdef.pl	2018-03-26 21:16:38 UTC (rev 47136)
+++ trunk/Master/texmf-dist/scripts/texdef/texdef.pl	2018-03-26 21:16:58 UTC (rev 47137)
@@ -30,6 +30,7 @@
     $TEX = $1;
 }
 my $TEXOPTIONS = " -interaction nonstopmode ";
+my $USERTEXOPTIONS = "";
 
 ## Variables for options and settings
 my $CLASS      = undef;
@@ -115,14 +116,14 @@
 my $BEGINENVSTR = '%s';
 my $ENDENVSTR   = '%s';
 
-my $VERSION = 'Version 1.7c -- 2017/12/09';
+my $VERSION = 'Version 1.8 -- 2018/03/25';
 sub usage {
     my $option = shift;
     my $ret    = ($option) ? 0 : 1;
 print << 'EOT';
 texdef -- Show definitions of TeX commands
-Version 1.7c -- 2017/12/09
-Copyright (C) 2011-2017  Martin Scharrer <martin at scharrer-online.de>
+Version 1.8 -- 2019/03/25
+Copyright (C) 2011-2018  Martin Scharrer <martin at scharrer-online.de>
 This program comes with ABSOLUTELY NO WARRANTY;
 This is free software, and you are welcome to redistribute it under certain conditions;
 
@@ -136,6 +137,7 @@
   --tex <format>, -t <format>   : Use given format of TeX: 'tex', 'latex', 'context'.
                                   Variations of 'tex' and 'latex', like 'luatex', 'lualatex', 'xetex', 'xelatex' are supported.
                                   The default is given by the used program name: 'texdef' -> 'tex', 'latexdef' -> 'latex', etc.
+  --texoptions <options>        : Call (La)TeX with the given options.
   --source, -s                  : Try to show the original source code of the command definition (L).
   --value, -v                   : Show value of command instead (i.e. \the\command).
   --Environment, -E             : Every command name is taken as an environment name. This will show the definition of
@@ -146,7 +148,7 @@
                                   or 'context' is used. For LaTeX the <pkg> can start with `[<options>]` and end 
                                   with `<pkgname>` or `{<pkgname>}`.
   --class <class>, -c <class>   : (LaTeX only) Load given class instead of default ('article').
-                                  The <class> can start with `[<classs options>]` and end 
+                                  The <class> can start with `[<class options>]` and end 
                                   with `<classname>` or `{<classname>}`.
   --environment <env>, -e <env> : (M) Show definition inside the given environment <env>.
   --othercode <code>, -o <code> : (M) Add other code into the preamble before the definition is shown.
@@ -247,6 +249,7 @@
    'before|b=s' => \&envcode,
    'after|a=s' => \&envcode,
    'tex|t=s' => \$TEX,
+   'texoptions=s' => \$USERTEXOPTIONS,
    'help|h' => \&usage,
    'pgf-keys|k' => \$PGFKEYS,
    'pgf-Keys|K' => \$PGFKEYSPLAIN,
@@ -319,9 +322,14 @@
   $ENDENVSTR   = '\stop%s'  . "\n";
 }
 
+if ($TEX =~ /^dvi((la)?tex)$/) {
+  $TEX = $1;
+  $TEXOPTIONS .= ' -output-format=dvi '
+}
+
 $USERCLASS = $CLASS;
 $CLASS = 'article' if not $CLASS;
-$CLASS =~ /^(?:\[(.*)\])?{?(.*?)}?$/;
+$CLASS =~ /^(?:\[(.*)\])?\{?(.*?)\}?$/;
 $CLASS = $2;
 my $CLASSOPTIONS = $1 || '';
 
@@ -503,7 +511,7 @@
         }
 
         foreach my $pkg (@PACKAGES) {
-            $pkg =~ /^(?:\[(.*)\])?{?(.*?)}?$/;
+            $pkg =~ /^(?:\[(.*)\])?\{?(.*?)\}?$/;
             my ($pkgname,$pkgoptions) = ($2, $1 || '');
             print "\\usepackage[$pkgoptions]{$pkgname}\n";
         }
@@ -623,7 +631,7 @@
 sub remove_invalid_braces {
     $_[0] =~ s/\\[\\%]//g; # remove \\ and \%
     $_[0] =~ s/%.*$//;     # remove line comments
-    $_[0] =~ s/\\[{}]//g;  # remove \{ and \}
+    $_[0] =~ s/\\[\{\}]//g;  # remove \{ and \}
 }
 
 sub env_braces {
@@ -766,7 +774,7 @@
     return $found;
 }
 
-open (my $texpipe, '-|', "$TEX $TEXOPTIONS \"$TMPFILE\" ");
+open (my $texpipe, '-|', "$TEX $TEXOPTIONS $USERTEXOPTIONS \"$TMPFILE\" ");
 
 my $name = '';
 my $definition = '';

Modified: trunk/Master/texmf-dist/source/support/texdef/texdef.tex
===================================================================
--- trunk/Master/texmf-dist/source/support/texdef/texdef.tex	2018-03-26 21:16:38 UTC (rev 47136)
+++ trunk/Master/texmf-dist/source/support/texdef/texdef.tex	2018-03-26 21:16:58 UTC (rev 47137)
@@ -5,7 +5,7 @@
 \author{Martin Scharrer}
 \email{martin at scharrer-online.de}
 \repository{https://bitbucket.org/martin_scharrer/texdef}
-\date{Version 1.7c -- 2017/12/09}
+\date{Version 1.8 -- 2018/03/25}
 
 \makeatletter
 \DeclareRobustCommand{\LATeX}{%
@@ -54,6 +54,7 @@
   --tex \MacroArgs<format>, -t \MacroArgs<format>    \csep Use given format of TeX: 'tex', 'latex', 'context'.
                                                        Variations of 'tex' and 'latex', like 'luatex', 'lualatex', 'xetex', 'xelatex' are supported.
                                                        The default is given by the used program name: 'texdef' -> 'tex', 'latexdef' -> 'latex', etc.\cend
+  --texoptions \MacroArgs<options>                   \csep Call \LaTeX/\TeX{} with the given options.\cend
   --source, -s                                       \csep Try to show the original source code of the command definition (L).\cend
   --value, -v                                        \csep Show value of command instead (i.e. \Macro\the\AlsoMacro\command).\cend
   --preamble, -P                                     \csep Show definition of the command inside the preamble.\cend
@@ -198,5 +199,72 @@
 \end{verbatim}
 
 
+\section{Changelog}
+
+
+\subsection*{v1.8 from 2018/03/25}
+\begin{itemize}
+ \item Added "dvitex" and "dvilatex" as formats. These will set DVI mode on "tex" or "latex".
+ \item Escaped further braces in regexs to avoid warnings or errors.
+ \item Added option "--texoptions" to allow the passing of compiler options for special cases.
+\end{itemize}
+
+\subsection*{v1.7c from 2017/12/09}
+\begin{itemize}
+ \item Fixed 'Unescaped left brace in regex is deprecated' warning.
+   Thanks goes to Paulo Cereda <cereda.paulo at gmail.com> for providing the patch.
+\end{itemize}
+
+\subsection*{v1.7b from 2012/05/15}
+\begin{itemize}
+ \item Added support for \Macro\chardef, \Macro\countdef, \Macro\dimendef, \Macro\mathchardef, \Macro\myskip, \Macro\skipdef and \Macro\toksdef.
+ \item Added support for \Macro\newbox, \Macro\newcount, \Macro\newdimen, \Macro\newif, \Macro\newinsert, \Macro\newread, \Macro\newskip, \Macro\newtoks, \Macro\newwrite.
+ \item Added support for \Macro\newif and \Macro\newcount.
+ \item Changed internal processing order to put more frequently used elements first.
+\end{itemize}
+
+\subsection*{v1.7a from 2012/05/08}
+\begin{itemize}
+ \item Fix for currfile v0.6.
+\end{itemize}
+
+\subsection*{v1.7 from 2012/05/07}
+\begin{itemize}
+ \item Changed "--help" to return status code 0.
+ \item Changed Windows default editor to texworks. Fixed If-statement.
+ \item Fixed bug which reported name of included subpackages.
+ \item Added option "--edit".
+ \item Added "--editor" option and better editor handling.
+ \item Added variable substitution for editor.
+ \item Added support for "TEXDEF_EDITOR" variable. Added Mac "open" command.
+ \item Fixed for behaviour when -s is used (correct name in message; do not follow protected macros etc.)
+\end{itemize}
+
+\subsection*{v1.6 from 2012/05/02}
+\begin{itemize}
+ \item Changed implementation of -E option to work better with new environment source code.
+ \item Added code to detect environment source definitions.
+ \item Added -E option.
+ \item Changed "flavour" to "format".
+ \item Added support for \Macro\let.
+ \item Added fallback for when the source code can not be found. Added support for -F with "latex.ltx".
+\end{itemize}
+
+\subsection*{v1.5 from 2012/04/29}
+\begin{itemize}
+ \item Added experimental --source option to show source code of the definitions.
+ \item Script now works correctly under MS Windows.
+\end{itemize}
+
+\subsection*{v1.4 from 2011/07/28}
+\begin{itemize}
+ \item Added -F option to display file path.
+ \item Added basic support for pdfkeys using -k and -K options.
+ \item Added -V option to print version numbers of LaTeX packages or classes.
+ \item Added '--tempdir' option to specify the location of the temporary files. Useful for debugging.
+\end{itemize}
+
+
+
 \end{document}
 



More information about the tex-live-commits mailing list