Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion doc/guide/author/topics.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3792,7 +3792,7 @@
<subsection>
<title>Content and Placement of Consoles</title>

<p>A <tag>console</tag> is a transcript of an interactive session in a terminal or console at a command-line. It is a sequence of the following elements, in this order, possibly repeated many times as a group: <tag>input</tag>, and <tag>output</tag>. The <tag>output</tag> is optional. The content of these two elements is treated as verbatim text (see <xref ref="overview-verbatim-literal"/>), subject to all the exceptions for exceptional characters (see <xref ref="overview-exceptional-characters"/>). A <attr>prompt</attr> attribute on the <tag>input</tag> can be supplied to provide a system prompt distinct from the actual commands. The default prompt is a dollar sign followed by a space. If it is more convenient <attr>prompt</attr> may be supplied on the <tag>console</tag>, to be used in each enclosed <tag>input</tag>. If you do not want any prompts at all, just use an empty value for <attr>prompt</attr>. A <attr>continuation</attr> attribute may also be supplied at the <tag>input</tag> or <tag>console</tag>. If present, it will apply to the start of each input line following the first.</p>
<p>A <tag>console</tag> is a transcript of an interactive session in a terminal or console at a command-line. It is a sequence of the following elements, in any order, possibly repeated many times: <tag>input</tag>, and <tag>output</tag>. The content of these two elements is treated as verbatim text (see <xref ref="overview-verbatim-literal"/>), subject to all the exceptions for exceptional characters (see <xref ref="overview-exceptional-characters"/>). A <attr>prompt</attr> attribute on the <tag>input</tag> can be supplied to provide a system prompt distinct from the actual commands. The default prompt is a dollar sign followed by a space. If it is more convenient <attr>prompt</attr> may be supplied on the <tag>console</tag>, to be used in each enclosed <tag>input</tag>. If you do not want any prompts at all, just use an empty value for <attr>prompt</attr>. A <attr>continuation</attr> attribute may also be supplied at the <tag>input</tag> or <tag>console</tag>. If present, it will apply to the start of each input line following the first.</p>

<p>A <tag>console</tag> may be wrapped in a <tag>listing</tag>, see <xref ref="topic-listing"/>. This will behave similar to a <tag>figure</tag>, with the <tag>caption</tag> displayed below, and a number assigned. So, in particular, if your program is important enough to cross-reference, it is an enclosing <tag>listing</tag> that serves as the target.</p>
</subsection>
Expand Down
10 changes: 10 additions & 0 deletions examples/sample-article/sample-article.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11509,6 +11509,16 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
</input>
</console>

<p>A console may start with output. This is useful if you are showing sample use of a program.</p>
<listing>
<title>Console session, starting with program output</title>
<console>
<output>Enter a number:</output>
<input prompt="">42</input>
<output>You entered 42.</output>
</console>
</listing>

<p>Notice in the HTML version of the above example that when you highlight all, or a portion, of the listing for a cut-and-paste that the prompts are not included.</p>

<p>Now a test of some listings (and pre-formatted text) in a block that likely has a background color in an HTML version.</p>
Expand Down
5 changes: 1 addition & 4 deletions schema/pretext.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1317,10 +1317,7 @@
attribute continuation {text}?,
attribute width {text}?,
attribute margins {text}?,
(
ConsoleInput,
ConsoleOutput?
)+
( ConsoleInput | ConsoleOutput )+
}
ProgramPreamble =
element preamble {
Expand Down