From ea9f6a9a696f5eb9b2200899ad51bea33f599599 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Tue, 18 Oct 2022 20:56:06 +0000 Subject: sty2dtx (17oct22) git-svn-id: svn://tug.org/texlive/trunk@64746 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/doc/man/man1/sty2dtx.1 | 54 +++++--- Master/texmf-dist/doc/man/man1/sty2dtx.man1.pdf | Bin 9162 -> 30494 bytes Master/texmf-dist/doc/support/sty2dtx/README | 155 --------------------- Master/texmf-dist/doc/support/sty2dtx/README.txt | 162 ++++++++++++++++++++++ Master/texmf-dist/doc/support/sty2dtx/sty2dtx.pdf | Bin 140340 -> 156538 bytes Master/texmf-dist/scripts/sty2dtx/sty2dtx.pl | 35 +++-- 6 files changed, 219 insertions(+), 187 deletions(-) delete mode 100644 Master/texmf-dist/doc/support/sty2dtx/README create mode 100644 Master/texmf-dist/doc/support/sty2dtx/README.txt (limited to 'Master') diff --git a/Master/texmf-dist/doc/man/man1/sty2dtx.1 b/Master/texmf-dist/doc/man/man1/sty2dtx.1 index 692dad8320e..e63d5e3e41e 100644 --- a/Master/texmf-dist/doc/man/man1/sty2dtx.1 +++ b/Master/texmf-dist/doc/man/man1/sty2dtx.1 @@ -1,4 +1,4 @@ -.\" Automatically generated by Pod::Man 2.25 (Pod::Simple 3.16) +.\" Automatically generated by Pod::Man 4.11 (Pod::Simple 3.35) .\" .\" Standard preamble: .\" ======================================================================== @@ -38,27 +38,36 @@ . ds PI \(*p . ds L" `` . ds R" '' +. ds C` +. ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" -.\" If the F register is turned on, we'll generate index entries on stderr for +.\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. -.ie \nF \{\ -. de IX -. tm Index:\\$1\t\\n%\t"\\$2" +.\" +.\" Avoid warning from groff about undefined register 'F'. +.de IX .. -. nr % 0 -. rr F -.\} -.el \{\ -. de IX +.nr rF 0 +.if \n(.g .if rF .nr rF 1 +.if (\n(rF:(\n(.g==0)) \{\ +. if \nF \{\ +. de IX +. tm Index:\\$1\t\\n%\t"\\$2" .. +. if !\nF==2 \{\ +. nr % 0 +. nr F 2 +. \} +. \} .\} +.rr rF .\" .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). .\" Fear. Run. Save yourself. No user-serviceable parts. @@ -124,7 +133,7 @@ .\" ======================================================================== .\" .IX Title "STY2DTX 1" -.TH STY2DTX 1 "2012-11-07" "perl v5.14.2" "User Contributed Perl Documentation" +.TH STY2DTX 1 "2022-10-18" "perl v5.30.0" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l @@ -133,10 +142,17 @@ sty2dtx \-\- Converts a LaTeX .sty file to a documented .dtx file .SH "VERSION" .IX Header "VERSION" -Version: v2.3 +Version: v2.4 \- 2022/10/18 +.SH "LINKS" +.IX Header "LINKS" +\&\s-1CTAN:\s0 https://ctan.org/pkg/sty2dtx +.PP +Repository: https://github.com/MartinScharrer/sty2dtx +.PP +Issues: https://github.com/MartinScharrer/sty2dtx/issues .SH "COPYRIGHT" .IX Header "COPYRIGHT" -Copyright (c) 2010\-2012 Martin Scharrer +Copyright (c) 2010\-2022 Martin Scharrer .PP This program is free software: you can redistribute it and/or modify it under the terms of the \s-1GNU\s0 General Public License as published by @@ -144,12 +160,12 @@ the Free Software Foundation, either version 3 of the License, or (at your option) any later version. .PP This program is distributed in the hope that it will be useful, -but \s-1WITHOUT\s0 \s-1ANY\s0 \s-1WARRANTY\s0; without even the implied warranty of -\&\s-1MERCHANTABILITY\s0 or \s-1FITNESS\s0 \s-1FOR\s0 A \s-1PARTICULAR\s0 \s-1PURPOSE\s0. See the +but \s-1WITHOUT ANY WARRANTY\s0; without even the implied warranty of +\&\s-1MERCHANTABILITY\s0 or \s-1FITNESS FOR A PARTICULAR PURPOSE.\s0 See the \&\s-1GNU\s0 General Public License for more details. .PP You should have received a copy of the \s-1GNU\s0 General Public License -along with this program. If not, see . +along with this program. If not, see . .SH "DESCRIPTION" .IX Header "DESCRIPTION" Converts a .sty file (LaTeX package) to .dtx format (documented LaTeX source), @@ -204,7 +220,7 @@ a '\f(CW\*(C`}\*(C'\fR' on its own on a line. .SS "Files" .IX Subsection "Files" .IP "\(bu" 2 -can be '\f(CW\*(C`\-\*(C'\fR' for \s-1STDIN\s0 or \s-1STDOUT\s0, which is the default if no files are given +can be '\f(CW\*(C`\-\*(C'\fR' for \s-1STDIN\s0 or \s-1STDOUT,\s0 which is the default if no files are given .IP "\(bu" 2 multiple input files are merged to one output file .SS "Variables" @@ -335,6 +351,6 @@ Produce \s-1DTX\s0 file for a class: .IX Header "AUTHOR" Martin Scharrer .PP -E\-mail: martin@scharrer\-online.de +E\-mail: martin.scharrer@web.de .PP -\&\s-1WWW:\s0 http://www.scharrer\-online.de +\&\s-1WWW:\s0 diff --git a/Master/texmf-dist/doc/man/man1/sty2dtx.man1.pdf b/Master/texmf-dist/doc/man/man1/sty2dtx.man1.pdf index 962b7ebefaf..fe21f3e7206 100644 Binary files a/Master/texmf-dist/doc/man/man1/sty2dtx.man1.pdf and b/Master/texmf-dist/doc/man/man1/sty2dtx.man1.pdf differ diff --git a/Master/texmf-dist/doc/support/sty2dtx/README b/Master/texmf-dist/doc/support/sty2dtx/README deleted file mode 100644 index 96bed0f02c7..00000000000 --- a/Master/texmf-dist/doc/support/sty2dtx/README +++ /dev/null @@ -1,155 +0,0 @@ -NAME - sty2dtx -- Converts a LaTeX .sty file to a documented .dtx file - -VERSION - Version: v2.3 - -COPYRIGHT - Copyright (c) 2010-2012 Martin Scharrer - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by the - Free Software Foundation, either version 3 of the License, or (at your - option) any later version. - - This program is distributed in the hope that it will be useful, but - WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General - Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program. If not, see . - -DESCRIPTION - Converts a .sty file (LaTeX package) to .dtx format (documented LaTeX - source), by surrounding macro definitions with 'macro' and 'macrocode' - environments. The macro name is automatically inserted as an argument to - the 'macro' environemnt. Code lines outside macro definitions are - wrapped only in 'macrocode' environments. Empty lines are removed. The - script is not thought to be fool proof and 100% accurate but rather as a - good start to convert undocumented style files to .dtx files. - - Basic Usage - perl sty2dtx.pl infile [infile ...] outfile - - or - - perl sty2dtx.pl < file.sty > file.dtx - - Supported Definitions - The following macro definitions are detected when they are at the start - of a line (can be prefixed by \global, \long, \protected and/or \outer): - - \def \edef \gdef \xdef - \newcommand{\name} \newcommand*{\name} - \newcommand\name \newcommand*\name - \renewcommand{\name} \renewcommand*{\name} - \renewcommand\name \renewcommand*\name - \providecommand{\name} \providecommand*{\name} - \providecommand\name \providecommand*\name - \@namedef{\name} \@namedef\name - - The following environment definitions are detected when they are at the - start of a line: - - \newenvironment{name} \renewenvironemnt{name} \provideenvironment{name} - - The macro and environment definition must either end at the same line or - with a '"}"' on its own on a line. - -USAGE - sty2dtx [] [--= ...] [--] [] [] - - Files - * can be '"-"' for STDIN or STDOUT, which is the default if no files are - given - - * multiple input files are merged to one output file - - Variables - Variables can be defined using - - --= - - or - - -- - - and will be used for substitutions in the template file. - - Common variables: - author, email, maintainer, year (for copyright), - version, date, description (of package/class), - type (either 'package' default or 'class'), - filebase (automatically set from output or input file name), - - Options - -h Print this help text - -H Print extended help - -V Print version and copyright - -v Be verbose - -o output Use given file as output - -O Overwrite already existing output file(s) - -B Use basename of single input file for output file - -I Also create .ins (install) file - -c Only use code section (like v1.0) - -r Remove existing 'macro', 'macrocode', etc. environments. - -R Do not remove existing 'macro', 'macrocode', etc. - environments. - -i ins-file Create .ins file with given name - -t template Use this file as template instead of the default one - -T template Use this file as template for the .ins file - -e file Export default .dtx template to file and exit - -E file Export default .ins template to file and exit - -D Use current date as file date - -F file Read more options and variables from file. - -N Do not read default config file; must be the first option - - Config files - A default config file either named 'sty2dtx.cfg' or '.sty2dtx.cfg' is - searched in the current directory, the users home directory and the - directory of this script, in this order. The first one found is loaded. - If none is found the 'texmf' tree is searched for a 'sty2dtx.cfg' config - file. As with -F files the config file should contain one option or - variable per line. Lines starting with '"%"' or '"#"' are ignored. - -Examples - Produce 'file.dtx' from 'file.sty': - - sty2dtx.pl < file.sty > file.dtx - - or - - sty2dtx.pl file.sty file.dtx - - or - - sty2dtx.pl -B file.sty - - Produce 'file.dtx' and 'file.ins' from 'file.sty': - - sty2dtx.pl -I file.sty file.dtx - - or - - sty2dtx.pl file.sty -i file.sty file.dtx - - or - - sty2dtx.pl -IB file.sty - - Set custom variable values: - - sty2dtx.pl --author Me --email me@there.com mypkg.sty mypkg.dtx - - Produce DTX file for a class: - - sty2dtx.pl --type class mycls.sty mycls.dtx - -AUTHOR - Martin Scharrer - - E-mail: martin@scharrer-online.de - - WWW: - diff --git a/Master/texmf-dist/doc/support/sty2dtx/README.txt b/Master/texmf-dist/doc/support/sty2dtx/README.txt new file mode 100644 index 00000000000..6b5d1a69225 --- /dev/null +++ b/Master/texmf-dist/doc/support/sty2dtx/README.txt @@ -0,0 +1,162 @@ +NAME + sty2dtx -- Converts a LaTeX .sty file to a documented .dtx file + +VERSION + Version: v2.4 - 2022/10/18 + +LINKS + CTAN: https://ctan.org/pkg/sty2dtx + + Repository: https://github.com/MartinScharrer/sty2dtx + + Issues: https://github.com/MartinScharrer/sty2dtx/issues + +COPYRIGHT + Copyright (c) 2010-2022 Martin Scharrer + + This program is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation, either version 3 of the License, or (at your + option) any later version. + + This program is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General + Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program. If not, see . + +DESCRIPTION + Converts a .sty file (LaTeX package) to .dtx format (documented LaTeX + source), by surrounding macro definitions with 'macro' and 'macrocode' + environments. The macro name is automatically inserted as an argument to + the 'macro' environemnt. Code lines outside macro definitions are + wrapped only in 'macrocode' environments. Empty lines are removed. The + script is not thought to be fool proof and 100% accurate but rather as a + good start to convert undocumented style files to .dtx files. + + Basic Usage + perl sty2dtx.pl infile [infile ...] outfile + + or + + perl sty2dtx.pl < file.sty > file.dtx + + Supported Definitions + The following macro definitions are detected when they are at the start + of a line (can be prefixed by \global, \long, \protected and/or \outer): + + \def \edef \gdef \xdef + \newcommand{\name} \newcommand*{\name} + \newcommand\name \newcommand*\name + \renewcommand{\name} \renewcommand*{\name} + \renewcommand\name \renewcommand*\name + \providecommand{\name} \providecommand*{\name} + \providecommand\name \providecommand*\name + \@namedef{\name} \@namedef\name + + The following environment definitions are detected when they are at the + start of a line: + + \newenvironment{name} \renewenvironemnt{name} \provideenvironment{name} + + The macro and environment definition must either end at the same line or + with a '"}"' on its own on a line. + +USAGE + sty2dtx [] [--= ...] [--] [] [] + + Files + * can be '"-"' for STDIN or STDOUT, which is the default if no files are + given + + * multiple input files are merged to one output file + + Variables + Variables can be defined using + + --= + + or + + -- + + and will be used for substitutions in the template file. + + Common variables: + author, email, maintainer, year (for copyright), + version, date, description (of package/class), + type (either 'package' default or 'class'), + filebase (automatically set from output or input file name), + + Options + -h Print this help text + -H Print extended help + -V Print version and copyright + -v Be verbose + -o output Use given file as output + -O Overwrite already existing output file(s) + -B Use basename of single input file for output file + -I Also create .ins (install) file + -c Only use code section (like v1.0) + -r Remove existing 'macro', 'macrocode', etc. environments. + -R Do not remove existing 'macro', 'macrocode', etc. + environments. + -i ins-file Create .ins file with given name + -t template Use this file as template instead of the default one + -T template Use this file as template for the .ins file + -e file Export default .dtx template to file and exit + -E file Export default .ins template to file and exit + -D Use current date as file date + -F file Read more options and variables from file. + -N Do not read default config file; must be the first option + + Config files + A default config file either named 'sty2dtx.cfg' or '.sty2dtx.cfg' is + searched in the current directory, the users home directory and the + directory of this script, in this order. The first one found is loaded. + If none is found the 'texmf' tree is searched for a 'sty2dtx.cfg' config + file. As with -F files the config file should contain one option or + variable per line. Lines starting with '"%"' or '"#"' are ignored. + +Examples + Produce 'file.dtx' from 'file.sty': + + sty2dtx.pl < file.sty > file.dtx + + or + + sty2dtx.pl file.sty file.dtx + + or + + sty2dtx.pl -B file.sty + + Produce 'file.dtx' and 'file.ins' from 'file.sty': + + sty2dtx.pl -I file.sty file.dtx + + or + + sty2dtx.pl file.sty -i file.sty file.dtx + + or + + sty2dtx.pl -IB file.sty + + Set custom variable values: + + sty2dtx.pl --author Me --email me@there.com mypkg.sty mypkg.dtx + + Produce DTX file for a class: + + sty2dtx.pl --type class mycls.sty mycls.dtx + +AUTHOR + Martin Scharrer + + E-mail: martin.scharrer@web.de + + WWW: + diff --git a/Master/texmf-dist/doc/support/sty2dtx/sty2dtx.pdf b/Master/texmf-dist/doc/support/sty2dtx/sty2dtx.pdf index 57ecc28b3bf..14610279ea0 100644 Binary files a/Master/texmf-dist/doc/support/sty2dtx/sty2dtx.pdf and b/Master/texmf-dist/doc/support/sty2dtx/sty2dtx.pdf differ diff --git a/Master/texmf-dist/scripts/sty2dtx/sty2dtx.pl b/Master/texmf-dist/scripts/sty2dtx/sty2dtx.pl index e68b667141c..7feb7951baf 100755 --- a/Master/texmf-dist/scripts/sty2dtx/sty2dtx.pl +++ b/Master/texmf-dist/scripts/sty2dtx/sty2dtx.pl @@ -9,11 +9,19 @@ sty2dtx -- Converts a LaTeX .sty file to a documented .dtx file =head1 VERSION -Version: v2.3 +Version: v2.4 - 2022/10/18 + +=head1 LINKS + +CTAN: https://ctan.org/pkg/sty2dtx + +Repository: https://github.com/MartinScharrer/sty2dtx + +Issues: https://github.com/MartinScharrer/sty2dtx/issues =head1 COPYRIGHT -Copyright (c) 2010-2012 Martin Scharrer +Copyright (c) 2010-2022 Martin Scharrer This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -26,7 +34,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License -along with this program. If not, see . +along with this program. If not, see . =head1 DESCRIPTION @@ -220,7 +228,7 @@ Produce DTX file for a class: Martin Scharrer -E-mail: L +E-mail: L WWW: L @@ -229,7 +237,7 @@ WWW: L ################################################################################ use Pod::Usage; -my $VERSION = "v2.3"; +my $VERSION = "v2.4"; $VERSION =~ tr/-/\//; my $TITLE = << "EOT"; @@ -329,11 +337,11 @@ my $rmacrodef = qr/ ) \\( [gex]?def \s* \\ # TeX definitions - | (?:new|renew|provide)command\s* \*? \s* {? \s* \\ # LaTeX definitions - | \@namedef{? # Definition by name only + | (?:new|renew|provide)command\s* \*? \s* \{? \s* \\ # LaTeX definitions + | \@namedef\{? # Definition by name only ) ($rmacroname) # Macro name without backslash - \s* }? # Potential closing brace + \s* \}? # Potential closing brace (.*) # Rest of line /xms; @@ -342,19 +350,19 @@ my $rkeydef = qr/ \\ (define\@[a-z]*key) \s* - {([^}]+)} # Key family + \{([^}]+)\} # Key family \s* - {([^}]+)} # Key name + \{([^}]+)\} # Key name (.*) # Rest of line /xms; my $renvdef = qr/ ^ # Begin of line (no whitespaces!) \\( - (?:new|renew|provide)environment\s* { \s* # LaTeX definitions + (?:new|renew|provide)environment\s* \{ \s* # LaTeX definitions ) ($renvname) # Environment names follow same rules as macro names - \s* } # closing brace + \s* \} # closing brace (.*) # Rest of line /xms; @@ -378,6 +386,7 @@ sub close_environment { } my ( $mday, $mon, $year ) = ( localtime(time) )[ 3 .. 5 ]; +$mday = sprintf( "%02d", $mday ); $mon = sprintf( "%02d", $mon + 1 ); $year += 1900; @@ -748,7 +757,7 @@ while (<>) { # Real comments are either: 1) starting with a '%' at SOL or 2) are followed # by at least one whitespace. This exclude (most) commented out code. elsif (/^%|^\s*%\s/) { - if (!$removeenvs || !/^%\s+\\(?:begin|end){(?:macro|environment|macrocode|key)}/) { + if (!$removeenvs || !/^%\s+\\(?:begin|end)\{(?:macro|environment|macrocode|key)\}/) { $_ =~ s/^\s*//; if ($comments || !/^%\s*$/){ $comments .= $_; -- cgit v1.2.3