summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/gmdoc/gmoldcomm.sty
blob: 641061ed610200db698c9e880979bfc3439eaea7 (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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
%
% \GetFileInfo{gmoldcomm.sty}
% \title{The \pk{gmoldcomm} Package\thfileinfo}
% \author{Natror (Grzegorz Murzynowski)}
% \date{\today}
% \maketitle
%
%
% This is a~package
% for handling the old comments in \LaTeXe\ Source Files when \LaTeX^^B
% ing them with the \pk{gmdoc} package. 
%
% Written by Natror (Grzegorz Murzynowski) 2007/11/10.
%
% It's a~part of the \pk{gmdoc} bundle and as such a~subject to the
% \LaTeX\ Project Public License.
%
% 
% \stanza
% Scan \acro{CS}s and put them in tt. If at beginning of line, precede them
% with |%|. Obey lines in the commentary.
% \FileInfo

\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{gmoldcomm}
         [2007/11/10 v0.99 LaTeX old comments handling (GM)]

\newenvironment{oldcomments}{%
  \catcode`\\=\active
  \let\do\@makeother
  \do\$% Not only \acro{CS}s but also special chars occur in the old
  % comments. 
  \do\|\do\#\do\{\do\}\do\^\do\_\do\&%
  \gmoc@defbslash
  \obeylines
  \StoreMacro\finish@macroscan
  \def\finish@macroscan{%
    \@xa\gmd@ifinmeaning\macro@pname\of\gmoc@notprinted%
    {}{{\tt\ifvmode\%\fi\bslash\macro@pname}}%
    \gmoc@checkenv
  }%
}{}

{\escapechar\m@ne
\xdef\gmoc@notprinted{\string\begin,\string\end}}

\def\gmoc@maccname{macrocode}
\def\gmoc@ocname{oldcomments}


\foone{%
  \catcode`\[=1 \catcode`\]=2
  \catcode`\{=12 \catcode`\}=12 }
[\def\gmoc@checkenv[%
  \@ifnextchar{%^^A}
    [\gmoc@checkenvinn][]]%
%
\def\gmoc@checkenvinn{#1}[%
  \def\gmoc@resa[#1]%
  \ifx\gmoc@resa\gmoc@maccname
    \def\next[%
      \begingroup
      \def\@currenvir[macrocode]%
      \RestoreMacro\finish@macroscan
      \catcode`\\=\z@
      \catcode`\{=1 \catcode`\}=2
      \macrocode]%
  \else
    \ifx\gmoc@resa\gmoc@ocname
      \def\next[\end[oldcomments]]%
    \else
      \def\next[%
        % ^^A        \typeout[**** detected environment [#1]]%
        \{#1\}%
        % ^^A  \show\relax
      ]%
    \fi
  \fi
  \next]%
]

\foone{%
  \catcode`\/=\z@
  \catcode`\\=\active}
% \CodeEscapeChar\/
{/def/gmoc@defbslash{%
    /let\/scan@macro}}
% \CodeEscapeChar\\

\def\task#1#2{}

\endinput

%\NoEOF