[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[5373] new commands @inlinefmtifelse @inlineifset @inlineifclear
From: |
karl |
Subject: |
[5373] new commands @inlinefmtifelse @inlineifset @inlineifclear |
Date: |
Thu, 12 Sep 2013 15:46:26 +0000 |
Revision: 5373
http://svn.sv.gnu.org/viewvc/?view=rev&root=texinfo&revision=5373
Author: karl
Date: 2013-09-12 15:46:24 +0000 (Thu, 12 Sep 2013)
Log Message:
-----------
new commands @inlinefmtifelse @inlineifset @inlineifclear
Modified Paths:
--------------
trunk/ChangeLog
trunk/NEWS
trunk/doc/refcard/txirefcard-a4.pdf
trunk/doc/refcard/txirefcard.pdf
trunk/doc/refcard/txirefcard.tex
trunk/doc/texinfo.tex
trunk/doc/texinfo.texi
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2013-09-11 18:19:31 UTC (rev 5372)
+++ trunk/ChangeLog 2013-09-12 15:46:24 UTC (rev 5373)
@@ -1,3 +1,13 @@
+2013-09-12 Karl Berry <address@hidden>
+
+ * doc/texinfo.tex (\inlinefmtifelse, \inlineifset, \inlineifclear):
+ new commands.
+ * doc/refcard/txirefcard.tex,
+ * doc/texinfo.texi (Inline Conditionals),
+ (@t{@@set @@clear @@value}),
+ (@t{@@inlineifset @@inlineifclear}),
+ (Command Summary): document them.
+
2013-09-11 Karl Berry <address@hidden>
* doc/texinfo.tex (\onepageout): call new macro
Modified: trunk/NEWS
===================================================================
--- trunk/NEWS 2013-09-11 18:19:31 UTC (rev 5372)
+++ trunk/NEWS 2013-09-12 15:46:24 UTC (rev 5373)
@@ -22,6 +22,10 @@
http://www.gnu.org/software/texinfo/manual/texinfo/html_node/Document-Permissions.html
-------------------------------------------------------------------------------
+* Language:
+ . new commands @inlinefmtifelse, @inlineifset, @inlineifclear, for
+ more brace-delimited alternatives to the conditional environments.
+
* texi2any:
. warns about node names, menu items, and cross-references (but not
index entries) containing problematic characters; can be disabled
Modified: trunk/doc/refcard/txirefcard-a4.pdf
===================================================================
(Binary files differ)
Modified: trunk/doc/refcard/txirefcard.pdf
===================================================================
(Binary files differ)
Modified: trunk/doc/refcard/txirefcard.tex
===================================================================
--- trunk/doc/refcard/txirefcard.tex 2013-09-11 18:19:31 UTC (rev 5372)
+++ trunk/doc/refcard/txirefcard.tex 2013-09-12 15:46:24 UTC (rev 5373)
@@ -835,6 +835,7 @@
address@hidden @ifnothtml @ifnotplaintext @ifnottex @address@hidden
ifnot\var{format}}}{Begin text to be ignored in one output format but no
others: address@hidden text is omitted from \acro{HTML} output, etc.}
address@hidden@end ifnotinfo}}{Like the other address@hidden commands, but
omit from plain text output as well as Info.}
address@hidden, text}}{Include Texinfo \var{text} only in \var{format} output.}
address@hidden, then-text, else-text}}{Include either \var{then-text} or
\var{else-text} according to whether \var{format} is being output.}
\subsection{Raw formatter text}
@@ -847,10 +848,12 @@
\subsection{Document variables}
address@hidden \rmbrack[string]}{Define the Texinfo variable \var{name},
optionally to the value \var{string}.}
address@hidden the Texinfo variable \var{name}.}
address@hidden the value of the Texinfo variable \var{name}.}
address@hidden address@hidden ifset}}{If the Texinfo variable \var{name} is
set, format the enclosed text.}
address@hidden address@hidden ifclear}}{If the Texinfo variable \var{name} is
not set, format the enclosed text.}
address@hidden \var{name}.}
address@hidden the value of \var{name}.}
address@hidden address@hidden ifset}}{If \var{name} is set, format enclosed
text.}
address@hidden address@hidden ifclear}}{If \var{name} is not set, format
enclosed text.}
address@hidden, text}}{If \var{name} is set, format \var{text}.}
address@hidden, text}}{If \var{name} is notset, format \var{text}.}
\subsection{Testing for commands}
Modified: trunk/doc/texinfo.tex
===================================================================
--- trunk/doc/texinfo.tex 2013-09-11 18:19:31 UTC (rev 5372)
+++ trunk/doc/texinfo.tex 2013-09-12 15:46:24 UTC (rev 5373)
@@ -2894,6 +2894,15 @@
\def\inlinefmtname{#1}%
\ifx\inlinefmtname\outfmtnametex \ignorespaces #2\fi
}
+%
+% @inlinefmtifelse{FMTNAME,THEN-TEXT,ELSE-TEXT} expands THEN-TEXT if
+% FMTNAME is tex, else ELSE-TEXT.
+\long\def\inlinefmtifelse#1{\doinlinefmtifelse #1,,,\finish}
+\long\def\doinlinefmtifelse#1,#2,#3,#4,\finish{%
+ \def\inlinefmtname{#1}%
+ \ifx\inlinefmtname\outfmtnametex \ignorespaces #2\else \ignorespaces #3\fi
+}
+%
% For raw, must switch into @tex before parsing the argument, to avoid
% setting catcodes prematurely. Doing it this way means that, for
% example, @inlineraw{html, foo{bar} gets a parse error instead of being
@@ -2910,7 +2919,24 @@
\endgroup % close group opened by \tex.
}
+% @inlineifset{VAR, TEXT} expands TEXT if VAR is @set.
+%
+\long\def\inlineifset#1{\doinlineifset #1,\finish}
+\long\def\doinlineifset#1,#2,\finish{%
+ \def\inlinevarname{#1}%
+ \expandafter\ifx\csname SET\inlinevarname\endcsname\relax
+ \else\ignorespaces#2\fi
+}
+% @inlineifclear{VAR, TEXT} expands TEXT if VAR is not @set.
+%
+\long\def\inlineifclear#1{\doinlineifclear #1,\finish}
+\long\def\doinlineifclear#1,#2,\finish{%
+ \def\inlinevarname{#1}%
+ \expandafter\ifx\csname SET\inlinevarname\endcsname\relax \ignorespaces#2\fi
+}
+
+
\message{glyphs,}
% and logos.
Modified: trunk/doc/texinfo.texi
===================================================================
--- trunk/doc/texinfo.texi 2013-09-11 18:19:31 UTC (rev 5372)
+++ trunk/doc/texinfo.texi 2013-09-12 15:46:24 UTC (rev 5373)
@@ -14194,8 +14194,9 @@
@node Inline Conditionals
address@hidden Inline Conditionals: @code{@@inline}, @code{@@inlineraw}
address@hidden Inline Conditionals: @code{@@inline}, @code{@@inlineifelse},
@code{@@inlineraw}
@findex inlinefmt
address@hidden inlinefmtifelse
@findex inlineraw
@cindex Inline conditionals
@cindex Conditional commands, inline
@@ -14203,14 +14204,18 @@
@cindex Newlines, avoiding in conditionals
@cindex Whitespace, controlling in conditionals
-Texinfo provides two conditional commands with arguments given within
-braces:
+Texinfo provides a set of conditional commands with arguments given
+within braces:
@table @code
@item @@address@hidden@var{format}, @address@hidden
Process the Texinfo @var{text} if @var{format} output is being
generated.
address@hidden @@address@hidden@var{format}, @var{then-text}, @address@hidden
+Process the Texinfo @var{then-text} if @var{format} output is being
+generated; otherwise, process @var{else-text}.
+
@item @@address@hidden@var{format}, @address@hidden
Similar, but for raw @var{text} (@pxref{Raw Formatter Commands}).
@end table
@@ -14239,29 +14244,30 @@
(environment) case.
In these commands, whitespace is ignored after the comma separating
-the two arguments, as usual, but is @emph{not} ignored at the end of
+the arguments, as usual, but is @emph{not} ignored at the end of
@var{text}.
-In the case of @code{@@inlineraw}, to insert a literal at sign, left
-brace, or right brace, you must use the alphabetic commands
address@hidden@@address@hidden@}} (@pxref{Inserting an Atsign}), and
address@hidden@@address@hidden@}} or @code{@@address@hidden@}} (@pxref{Inserting
-Braces}), or the parsing will become confused. (By the way, it is not
-necessary to use @code{@@address@hidden@}}, since these commands always have
-exactly two arguments, so a @samp{,} cannot be mistaken for an
-argument separator.)
+To insert a literal at sign, left brace, or right brace in one of the
+arguments, you must use the alphabetic commands @code{@@address@hidden@}}
+(@pxref{Inserting an Atsign}), and @code{@@address@hidden@}} or
address@hidden@@address@hidden@}} (@pxref{Inserting Braces}), or the parsing
+will become confused.
-For @TeX{} processing (@var{format} is @samp{tex}), the specific
address@hidden cannot contain newline-delimited commands. Such commands
-are properly ignored by @TeX{} when @var{format} is something else,
-though. In addition, literal brace characters (@address@hidden and
address@hidden@}}) must be balanced for @TeX{}, whether the text is ignored or
-not. (You can use @code{@@address@hidden@}} and @code{@@address@hidden@}}
-to produce individual characters.)
+With @code{@@inlinefmtifelse}, it is also necessary to use
address@hidden@@address@hidden@}} to avoid mistaking a @samp{,} in the text for
the
+delimiter. With @code{@@inlinefmt} and @code{@@inlineraw},
address@hidden@@address@hidden@}} is not required (though it's fine to use it),
since
+these commands always have exactly two arguments.
+For @TeX{}, the processed @var{text} cannot contain newline-delimited
+commands. Text to be ignored (i.e., for address@hidden) can, though.
+Two other @code{@@inline...} conditionals complement the
address@hidden@@ifset} and @code{@@ifclear} commands; see the next section.
+
+
@node @t{@@set @@clear @@value}
address@hidden @code{@@set}, @code{@@clear}, and @code{@@value}
address@hidden Flags: @code{@@set}, @code{@@clear}, conditionals, and
@code{@@value}
@anchor{set clear address@hidden old name
You can direct the Texinfo formatting commands to format or ignore parts
@@ -14283,15 +14289,23 @@
is formatted. If @var{flag} is clear, text through the following
@code{@@end ifset} command is ignored.
address@hidden @@address@hidden@var{flag}, @address@hidden
+Brace-delimited version of @code{@@ifset}.
+
@item @@ifclear @var{flag}
If @var{flag} is set, text through the next @code{@@end ifclear} command
is ignored. If @var{flag} is clear, text through the following
@code{@@end ifclear} command is formatted.
+
address@hidden @@address@hidden@var{flag}, @address@hidden
+Brace-delimited version of @code{@@ifclear}.
+
@end table
@menu
* @t{@@set @@value}:: Expand a flag variable to a string.
* @t{@@ifset @@ifclear}:: Format a region if a flag is set.
+* @t{@@inlineifset @@inlineifclear}:: Brace-delimited flag conditionals.
* @t{@@value} Example:: An easy way to update edition information.
@end menu
@@ -14471,6 +14485,33 @@
@end example
address@hidden @t{@@inlineifset @@inlineifclear}
address@hidden @code{@@inlineifset} and @code{@@inlineifclear}
+
address@hidden inlineifset
address@hidden inlineifclear
address@hidden Flag conditionals, brace-delimited
address@hidden Brace-delimited flag conditionals
+
address@hidden@@inlineifset} and @code{@@inlineifclear} provide
+brace-delimited alternatives to the @code{@@ifset} and
address@hidden@@ifclear} forms, similar to the other @code{@@inline...}
+Commands (@pxref{Inline Conditionals}). The same caveats about
+argument parsing given there apply here too.
+
address@hidden @code
address@hidden @@address@hidden@var{var}, @address@hidden
+Process the Texinfo @var{text} if the flag @var{var} is defined.
+
address@hidden @@address@hidden@var{var}, @address@hidden
+Process the Texinfo @var{text} if the flag @var{var} is not defined.
address@hidden table
+
+Except for the syntax, their general behavior and purposes is the same
+as with @code{@@ifset} and @code{@@ifclear}, described in the previous
+section.
+
+
@node @t{@@value} Example
@subsection @code{@@value} Example
@@ -21027,10 +21068,20 @@
manual. @address@hidden@@inforef}}.
@item @@address@hidden@var{fmt}, @address@hidden
address@hidden @@address@hidden@var{fmt}, @address@hidden
-Insert (raw) @var{text} only if the output format is @var{fmt}.
+Insert @var{text} only if the output format is @var{fmt}.
@xref{Inline Conditionals}.
address@hidden @@address@hidden@var{fmt}, @var{text}, @address@hidden
+Insert @var{text} if the output format is @var{fmt}, else @var{else-text}.
+
address@hidden @@address@hidden@var{var}, @address@hidden
address@hidden @@address@hidden@var{var}, @address@hidden
+Insert @var{text} only if the Texinfo variable @var{var} is (not) set.
+
address@hidden @@address@hidden@var{fmt}, @address@hidden
+Insert @var{text} as in a raw conditional, only if the output format
+is @var{fmt}.
+
@item \input @var{macro-definitions-file}
Use the specified macro definitions file. This command is used only
in the first line of a Texinfo file to cause @TeX{} to make use of the
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [5373] new commands @inlinefmtifelse @inlineifset @inlineifclear,
karl <=