blob: 5ea1cc55a6c57bed4988e6aa420483aa6398b4ba (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
Copyright (c) 2010-2011 Martin Scharrer <martin@scharrer-online.de>
This is open source software under the GPL v3 or later.
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 file to .dtx files.
It does not generate a complete .dtx file, just the code section.
Usage:
perl sty2dtx.pl infile [infile ...] outfile
or
perl sty2dtx.pl < file.sty > file.dtx
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 macro definition must either end at the same line or with a '}' on its own
on a line.
|