Use TeX quotes -- ``foo'' -- as appropriate.

Remove whitespace around em-dashes.
This commit is contained in:
Greg Ward 2003-05-03 19:41:45 +00:00
parent b4e3319302
commit bf8f1b55a8

View file

@ -33,7 +33,7 @@ parser.add_option("-q", "--quiet",
\end{verbatim}
With these few lines of code, users of your script can now do the
"usual thing" on the command-line:
``usual thing'' on the command-line:
\begin{verbatim}
$ <yourscript> -f outfile --quiet
@ -281,7 +281,7 @@ strings. In this document, we'll only cover four of the things you
can put there: \var{action}, \var{type}, \var{dest} (destination), and
\var{help}.
\subsubsection{The "store" action\label{optparse-store-action}}
\subsubsection{The \var{store} action\label{optparse-store-action}}
The action tells \module{optparse} what to do when it sees one of the
option strings for this option on the command-line. For example, the
@ -289,7 +289,7 @@ action \var{store} means: take the next argument (or the remainder of
the current argument), ensure that it is of the correct type, and
store it to your chosen destination.
For example, let's fill in the "..." of that last option:
For example, let's fill in the ``...'' of that last option:
\begin{verbatim}
parser.add_option("-f", "--file",
@ -308,7 +308,7 @@ args = ["-f", "foo.txt"]
\function{parse_args()}, it automatically uses \var{sys.argv[1:]}.)
When \module{optparse} sees the \programopt{-f}, it sucks in the next
argument --- ``foo.txt'' --- and stores it in the \var{filename}
argument---\code{foo.txt}---and stores it in the \var{filename}
attribute of a special object. That object is the first return value
from \function{parse_args()}, so:
@ -316,10 +316,10 @@ from \function{parse_args()}, so:
print options.filename
\end{verbatim}
will print ``foo.txt''.
will print \code{foo.txt}.
Other option types supported by \module{optparse} are ``int'' and
``float''. Here's an option that expects an integer argument:
Other option types supported by \module{optparse} are \code{int} and
\code{float}. Here's an option that expects an integer argument:
\begin{verbatim}
parser.add_option("-n", type="int", dest="num")
@ -359,7 +359,7 @@ destination for \programopt{-f} is \var{f}.
Adding types is fairly easy; please refer to
section~\ref{optparse-adding-types}, ``Adding new types.''
\subsubsection{Other "store_*" actions\label{optparse-other-store-actions}}
\subsubsection{Other \var{store_*} actions\label{optparse-other-store-actions}}
Flag options---set a variable to true or false when a particular
option is seen---are quite common. \module{optparse} supports them
@ -474,12 +474,12 @@ best possible help message:
usage = "usage: %prog [options] arg1 arg2"
\end{verbatim}
\module{optparse} expands "\%prog" in the usage string to the name of the
\module{optparse} expands \samp{\%prog} in the usage string to the name of the
current script, ie. \code{os.path.basename(sys.argv[0])}. The
expanded string is then printed before the detailed option help.
If you don't supply a usage string, \module{optparse} uses a bland but
sensible default: ``usage: \%prog [options]'', which is fine if your
sensible default: \code{"usage: \%prog [options]"}, which is fine if your
script doesn't take any positional arguments.
\item every option defines a help string, and doesn't worry about
@ -1363,7 +1363,7 @@ parser.add_option("--foo",
action="callback", callback=check_moon, dest="foo")
\end{verbatim}
(The definition of is_full_moon() is left as an exercise for the
(The definition of \code{is_full_moon()} is left as an exercise for the
reader.)
\strong{Fixed arguments}
@ -1567,20 +1567,20 @@ Adding new actions is a bit trickier, because you have to understand
that \module{optparse} has a couple of classifications for actions:
\begin{definitions}
\term{"store" actions}
\term{``store'' actions}
actions that result in \module{optparse} storing a value to an attribute
of the OptionValues instance; these options require a 'dest'
of the OptionValues instance; these options require a \var{dest}
attribute to be supplied to the Option constructor
\term{"typed" actions}
\term{``typed'' actions}
actions that take a value from the command line and expect it to be
of a certain type; or rather, a string that can be converted to a
certain type. These options require a 'type' attribute to the
certain type. These options require a \var{type} attribute to the
Option constructor.
\end{definitions}
Some default ``store'' actions are ``store'', ``store_const'',
``append'', and ``count''. The default ``typed'' actions are
``store'', ``append'', and ``callback''.
Some default ``store'' actions are \var{store}, \var{store_const},
\var{append}, and \var{count}. The default ``typed'' actions are
\var{store}, \var{append}, and \var{callback}.
When you add an action, you need to decide if it's a ``store'' action,
a ``typed'', neither, or both. Three class attributes of
@ -1590,10 +1590,10 @@ a ``typed'', neither, or both. Three class attributes of
All actions must be listed as strings in ACTIONS.
\end{memberdesc}
\begin{memberdesc}{STORE_ACTIONS}
"store" actions are additionally listed here.
``store'' actions are additionally listed here.
\end{memberdesc}
\begin{memberdesc}{TYPED_ACTIONS}
"typed" actions are additionally listed here.
``typed'' actions are additionally listed here.
\end{memberdesc}
In order to actually implement your new action, you must override
@ -1689,7 +1689,7 @@ You'll have to
\begin{enumerate}
\item subclass OptionParser and override the error() method
\item subclass Option and override the take_action() method---you'll
need to provide your own handling of the "help" action that
need to provide your own handling of the ``help'' action that
doesn't call sys.exit()
\end{enumerate}