summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/scripts
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2015-09-08 21:26:15 +0000
committerKarl Berry <karl@freefriends.org>2015-09-08 21:26:15 +0000
commitaf86b79e62d0939454e4969229a28ac4392df64c (patch)
treedd9985646ae9dc750595470d376ed7d6dc1d029e /Master/texmf-dist/scripts
parent34722e1da36fa4241609e892451a3bf9af62db35 (diff)
dtxgen (8sep15)
git-svn-id: svn://tug.org/texlive/trunk@38325 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/scripts')
-rwxr-xr-xMaster/texmf-dist/scripts/dtxgen/dtxgen100
1 files changed, 63 insertions, 37 deletions
diff --git a/Master/texmf-dist/scripts/dtxgen/dtxgen b/Master/texmf-dist/scripts/dtxgen/dtxgen
index 965e81b9cf7..58a46e537b1 100755
--- a/Master/texmf-dist/scripts/dtxgen/dtxgen
+++ b/Master/texmf-dist/scripts/dtxgen/dtxgen
@@ -1,6 +1,6 @@
#!/bin/bash
-version=1.05
+version=1.06
myname=$(basename $0)
<<'DOC'
@@ -9,6 +9,17 @@ myname=$(basename $0)
= Synopsis
dtxgen [options] basename.[sty,cls]
+Options:
+-h,--help print short help and exit
+-H,--Help print full documentation via less and exit
+-V,--version print version and exit
+-s,--short short, one-liner, package description
+-d,--date initial version's date. Default: current date
+-m,--mail your email address. Default: $MAIL
+-n,--name your name. Default: $NAME
+-c,--class (class packs only) class to be preloaded. Default: article
+-q,--quiet run quietly
+
= Description
dtxgen creates a template for a self-extracting .dtx file, based on the model described by
U{www.texdev.net/2009/10/06/a-model-dtx-file/}{Joseph Wright}. It is useful for
@@ -83,11 +94,6 @@ inst install in the user's TeX tree,
install install in the local TeX tree (uses sudo)
zip produce a zip file ready for upload to CTAN
-= Changes
-Changes with respect version 1.04:
-- mktemp now works for Mac/BSD too
-- don't include .cls/.sty file in zip
-
= Author and copyright
Author Wybo Dekker
Email U{Wybo@dekkerdocumenten.nl}{wybo@dekkerdocumenten.nl}
@@ -122,16 +128,25 @@ eval set -- "$options"
while [ $# -gt 0 ]; do
case $1 in
- (-h|--help) help;;
- (-H|--Help) helpall;;
- (-V|--version) version;;
+ (-h|--help) # print short help and exit
+ help;;
+ (-H|--Help) # print full documentation via less and exit
+ helpall;;
+ (-V|--version) # print version and exit
+ version;;
+ (-s|--short) # short, one-liner, package description
+ short=$2; shift 2;;
+ (-d|--date) # initial version's date. Default: current date
+ date=$2; shift 2;;
+ (-m|--mail) # your email address. Default: $MAIL
+ mail=$2; shift 2;;
+ (-n|--name) # your name. Default: $NAME
+ name=$2; shift 2;;
+ (-c|--class) # (class packs only) class to be preloaded. Default: article
+ loadclass=$2; shift 2;;
+ (-q|--quiet) # run quietly
+ quiet=--quiet; shift;;
(-I) install;;
- (-s|--short) short=$2; shift 2;;
- (-d|--date) date=$2; shift 2;;
- (-m|--mail) mail=$2; shift 2;;
- (-n|--name) name=$2; shift 2;;
- (-c|--class) loadclass=$2; shift 2;;
- (-q|--quiet) quiet=--quiet; shift;;
(--) shift; break;;
(*) break;;
esac
@@ -174,15 +189,36 @@ short=$(sed 's/\\/\\\\/g' <<<$short)
test -z "$mail" && die "author's email not set - use option or environment variable EMAIL"
test -z "$name" && die "author's name not set - use option or environment variable NAME"
-# sed script replacing the variables in the templates:
-for i in base year ext mail use typ Typ name date short shrt lcl; do
- eval v=\$$i
- test $quiet || echo "$i $v"|sed 's/\\\\/\\/g'
- script="${script}s/%$i%/$v/g;"
+colw=${#base}
+test $colw -lt 7 && colw=7
+kopl=$(eval "printf '%.0s-' {1..$colw}")
+kopr=$(eval "printf '%.0s-' {1..$((72-$colw))}")
+declare -A rm=(
+ [$kopl]=$kopr
+ [$base]=$shrt
+ [Author]=$name
+ [E-mail]=$mail
+ [License]='Released under the LaTeX Project Public License v1.3c or later'
+ [See]='http://www.latex-project.org/lppl.txt'
+)
+
+readme=()
+
+for i in $kopl $base Author E-mail License See; do
+ readme+="$(printf "%*s:| %s°" $colw "$i" "${rm[$i]}")"
done
-createfile "$script" Makefile
-createfile "$script" DTX $base.dtx
+# make sed script replacing the variables in the templates:
+sedscript=''
+for i in readme base year ext mail use typ Typ name date short shrt lcl; do
+ eval v="\$$i"
+ test $quiet || echo "$i $v"|sed 's/\\\\/\\/g;s=°=\n=g'
+ sedscript="${sedscript}s=%$i%=$v=g;"
+done
+sedscript+='s=°=\n=g'
+
+createfile "$sedscript" Makefile
+createfile "$sedscript" DTX $base.dtx
make $quiet
exit 0
@@ -226,18 +262,15 @@ Makefile
<<'DTX'
% \iffalse meta-comment
+% vim: textwidth=75
%<*internal>
\iffalse
%</internal>
%<*readme>
-----------------------------------------------------------------
-%base% --- %shrt%
-Author: %name%
-E-mail: %mail%
-License: Released under the LaTeX Project Public License v1.3c or later
-See: http://www.latex-project.org/lppl.txt
-----------------------------------------------------------------
+|
+%readme%
+Short description:
Some text about the %typ%: probably the same as the abstract.
%</readme>
%<*internal>
@@ -252,14 +285,7 @@ Some text about the %typ%: probably the same as the abstract.
\keepsilent
\askforoverwritefalse
\preamble
-----------------------------------------------------------------
-%base% --- %shrt%
-Author: %name%
-E-mail: %mail%
-License: Released under the LaTeX Project Public License v1.3c or later
-See: http://www.latex-project.org/lppl.txt
-----------------------------------------------------------------
-
+%readme%
\endpreamble
\postamble