* texinfo.tex (\value): handle active _ or - in argument (happens

if called from @code).
 	Report from: Dave Love <d.love@dl.ac.uk>.
This commit is contained in:
Karl Berry 1998-08-10 19:17:34 +00:00
parent 5d1d6aa6de
commit fc6cca1c7c

View file

@ -959,9 +959,17 @@ where each line of input produces a line of output.}
% @value{foo} gets the text saved in variable foo. % @value{foo} gets the text saved in variable foo.
% %
\def\value{\begingroup {
\catcode`\-=12 \catcode`\_=12 % Allow - and _ in VAR. \catcode`\_ = \active
\valuexxx} %
% We might end up with active _ or - characters in the argument if
% we're called from @code, as @code{@value{foo-bar_}}. So \let any
% such active characters to their normal equivalents.
\gdef\value{\begingroup
\catcode`\-=12 \catcode`\_=12
\indexbreaks \let_\normalunderscore
\valuexxx}
}
\def\valuexxx#1{\expandablevalue{#1}\endgroup} \def\valuexxx#1{\expandablevalue{#1}\endgroup}
% We have this subroutine so that we can handle at least some @value's % We have this subroutine so that we can handle at least some @value's
@ -1413,20 +1421,18 @@ where each line of input produces a line of output.}
% and arrange explicitly to hyphenate at a dash. % and arrange explicitly to hyphenate at a dash.
% -- rms. % -- rms.
{ {
\catcode`\-=\active \catcode`\-=\active
\catcode`\_=\active \catcode`\_=\active
\catcode`\|=\active %
\global\def\code{\begingroup \catcode`\-=\active \let-\codedash \catcode`\_=\active \let_\codeunder \codex} \global\def\code{\begingroup
% The following is used by \doprintindex to insure that long function names \catcode`\-=\active \let-\codedash
% wrap around. It is necessary for - and _ to be active before the index is \catcode`\_=\active \let_\codeunder
% read from the file, as \entry parses the arguments long before \code is \codex
% ever called. -- mycroft }
% _ is always active; and it shouldn't be \let = to an _ that is a %
% subscript character anyway. Then, @cindex @samp{_} (for example) % If we end up with any active - characters when handling the index,
% fails. --karl % just treat them as a normal -.
\global\def\indexbreaks{% \global\def\indexbreaks{\catcode`\-=\active \let-\realdash}
\catcode`\-=\active \let-\realdash
}
} }
\def\realdash{-} \def\realdash{-}