2
% $Id: fakehtml.sty,v 1.3 2001/09/22 00:40:30 carl Exp $
3
% This file is part of the FPC documentation.
4
% Copyright (C) 1997, by Michael Van Canneyt
6
% The FPC documentation is free text; you can redistribute it and/or
7
% modify it under the terms of the GNU Library General Public License as
8
% published by the Free Software Foundation; either version 2 of the
9
% License, or (at your option) any later version.
11
% The FPC Documentation is distributed in the hope that it will be useful,
12
% but WITHOUT ANY WARRANTY; without even the implied warranty of
13
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
% Library General Public License for more details.
16
% You should have received a copy of the GNU Library General Public
17
% License along with the FPC documentation; see the file COPYING.LIB. If not,
18
% write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19
% Boston, MA 02111-1307, USA.
21
\ProvidesPackage{fakehtml}[2001/07/01]
22
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
23
% based upon Eijkhout's comment.sty v2.0
24
% with modifications to avoid conflicts with later versions
25
% of this package, should a user be requiring it.
26
% Ross Moore, 10 March 1999
27
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
28
% Comment.sty version 2.0, 19 June 1992
29
% selectively in/exclude pieces of text: the user can define new
30
% comment versions, and each is controlled separately.
31
% This style can be used with plain TeX or LaTeX, and probably
32
% most other packages too.
34
% Examples of use in LaTeX and TeX follow \endinput
38
% Department of Computer Science
39
% University Tennessee at Knoxville
46
% Usage: all text included in between
47
% \comment ... \endcomment
48
% or \begin{comment} ... \end{comment}
49
% is discarded. The closing command should appear on a line
50
% of its own. No starting spaces, nothing after it.
51
% This environment should work with arbitrary amounts
54
% Other 'comment' environments are defined by
55
% and are selected/deselected with
56
% \includecomment{versiona}
57
% \excludecoment{versionb}
59
% These environments are used as
60
% \versiona ... \endversiona
61
% or \begin{versiona} ... \end{versiona}
62
% with the closing command again on a line of its own.
65
% to comment something out, scoop up every line in verbatim mode
66
% as macro argument, then throw it away.
67
% For inclusions, both the opening and closing comands
70
% Changed \next to \html@next to prevent clashes with other sty files
72
% Changed \html@next to \htmlnext so the \makeatletter and
73
% \makeatother commands could be removed (they were causing other
74
% style files - changebar.sty - to crash) (nikos@cbl.leeds.ac.uk)
75
% Changed \htmlnext back to \html@next...
77
\def\makeinnocent#1{\catcode`#1=12 }
78
\def\csarg#1#2{\expandafter#1\csname#2\endcsname}
80
\def\ThrowAwayComment#1{\begingroup
81
\def\CurrentComment{#1}%
82
\let\do\makeinnocent \dospecials
83
\makeinnocent\^^L% and whatever other special cases
85
%% use \xhtmlComment for \xComment
86
%% use \html@next for \next
87
\endlinechar`\^^M \catcode`\^^M=12 \xhtmlComment}
88
{\catcode`\^^M=12 \endlinechar=-1 %
89
\gdef\xhtmlComment#1^^M{\def\test{#1}\edef\test{\meaning\test}
90
\csarg\ifx{PlainEnd\CurrentComment Test}\test
91
\let\html@next\endgroup
92
\else \csarg\ifx{LaLaEnd\CurrentComment Test}\test
93
\edef\html@next{\endgroup\noexpand\end{\CurrentComment}}
94
\else \csarg\ifx{LaInnEnd\CurrentComment Test}\test
95
\edef\html@next{\endgroup\noexpand\end{\CurrentComment}}
96
\else \let\html@next\xhtmlComment
97
\fi \fi \fi \html@next}
100
%%\def\includecomment %%RRM
101
\def\htmlincludecomment
102
#1{\expandafter\def\csname#1\endcsname{}%
103
\expandafter\def\csname end#1\endcsname{}}
104
%%\def\excludecomment %%RRM
105
\def\htmlexcludecomment
106
#1{\expandafter\def\csname#1\endcsname{\ThrowAwayComment{#1}}%
107
{\escapechar=-1\relax
108
\edef\tmp{\string\\end#1}%
109
\csarg\xdef{PlainEnd#1Test}{\meaning\tmp}%
110
\edef\tmp{\string\\end\string\{#1\string\}}%
111
\csarg\xdef{LaLaEnd#1Test}{\meaning\tmp}%
112
\edef\tmp{\string\\end \string\{#1\string\}}%
113
\csarg\xdef{LaInnEnd#1Test}{\meaning\tmp}%
116
%%\excludecomment{comment} %%RRM
117
\htmlexcludecomment{comment}
118
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
120
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
121
\let\includecomment=\htmlincludecomment
122
\let\excludecomment=\htmlexcludecomment
124
\newcommand{\latex}[1]{#1}
125
\newcommand{\html}[1]{}
126
\htmlexcludecomment{htmlonly}
127
\newenvironment{latexonly}{}{}