Re: Clarification on <samp> element

Daniel W. Connolly (connolly@hal.com)
Mon, 21 Nov 1994 10:27:17 -0600


In message <9411190851.AA03788@netmail2.microsoft.com>, Lydja Williams writes:
>I'm looking for clarification on the <samp> element. The HTML 2.0
>specification describes <samp> as follows:
>
> "The SAMP type indicates a sequence of literal characters."
>
>How is this tag commonly used?

It derives from the GNU TeXinfo system:
(disregard the TeXinfo syntax)

==============
File: texi.info, Node: samp, Next: var, Prev: key, Up: Indicating

`@samp'{TEXT}
-------------

Use the `@samp' command to indicate text that is a literal example
or `sample' of a sequence of characters in a file, string, pattern, etc.
Enclose the text in braces. The argument appears within single
quotation marks in both the Info file and the printed manual; in
addition, it is printed in a fixed-width font.

To match @samp{foo} at the end of the line,
use the regexp @samp{foo$}.

produces

To match `foo' at the end of the line, use the regexp `foo$'.

Any time you are referring to single characters, you should use
`@samp' unless `@kbd' is more appropriate. Use `@samp' for the names
of command-line options. Also, you may use `@samp' for entire
statements in C and for entire shell commands--in this case, `@samp'
often looks better than `@code'. Basically, `@samp' is a catchall for
whatever is not covered by `@code', `@kbd', or `@key'.

Only include punctuation marks within braces if they are part of the
string you are specifying. Write punctuation marks outside the braces
if those punctuation marks are part of the English text that surrounds
the string. In the following sentence, for example, the commas and
period are outside of the braces:

In English, the vowels are @samp{a}, @samp{e},
@samp{i}, @samp{o}, @samp{u}, and sometimes
@samp{y}.

This produces:

In English, the vowels are `a', `e', `i', `o', `u', and sometimes
`y'.
==============

> How should I expect the following
>markup to be displayed in a Web client?
>
> <samp>black &amp; white</samp>
>
>Alternative A:
>
> black & white
>
>Alternative B:
>
> black &amp; white

A.

This is an SGML question. If you are implementing a web browser,
and you don't have sgmls installed to test out questions like this,
you're doing everyone a disservice.

You can use the HTML Validation service to ask questions like this:
http://www.hal.com/%7Econnolly/html-test/service/validation-form.html

HTML Validation Service Response
********************************

$Id: html-check.pl,v 1.6 1994/11/14 20:55:09 markg Exp $

Check Complete
++++++++++++++

No errors found.

Input
+++++

<TITLE>Test</TITLE>

<samp>black &amp; white</samp>

Parsed Output (Element Structure Information Set)
+++++++++++++++++++++++++++++++++++++++++++++++++

AVERSION CDATA -//IETF//DTD HTML//EN//2.0
(HTML
(HEAD
(TITLE
-Test
)TITLE
)HEAD
(BODY
(SAMP
-black & white
)SAMP
)BODY
)HTML
C

You can also use our HTML Check Toolkit as an easy way to
install sgmls at your site:

http://www.hal.com/~markg/HaLSoft/html-check/

We currently have custom-built distributions for:

Sun OS 4.1.3 IRIX-4.0.5 Solaris2.x BSD V1.1
HP-UX 9.03 SCO UNIX 3.2.2 and up & SCO Open Desktop 2.0 and up

Dan

Daniel W. Connolly "We believe in the interconnectedness of all things"
Software Engineer, Hal Software Systems, OLIAS project (512) 834-9962 x5010
<connolly@hal.com> http://www.hal.com/%7Econnolly