[Zodb-checkins] CVS: Packages/ZConfig/doc - xmlmarkup.sty:1.1 xmlmarkup.perl:1.1

Fred L. Drake, Jr. fred@zope.com
Mon, 13 Jan 2003 15:13:49 -0500


Update of /cvs-repository/Packages/ZConfig/doc
In directory cvs.zope.org:/tmp/cvs-serv26619

Added Files:
	xmlmarkup.sty xmlmarkup.perl 
Log Message:
Markup support for XML-related elements, to be used in describing the schema
language.


=== Added File Packages/ZConfig/doc/xmlmarkup.sty ===
% Created by Fred L. Drake, Jr. <fdrake@acm.org>, as part of the
% Python Documentation Project.
%
% Define some simple markup for the LaTeX command documentation:

\ProvidesPackage{xmlmarkup}
\RequirePackage{python}      % fulllineitems environment

\newcommand{\element}[1]{\code{#1}}
\newcommand{\attribute}[1]{\code{#1}}

% \begin{elementdesc}{type}{content-model}
\newenvironment{elementdesc}[2]{
  \begin{fulllineitems}
    \item[\code{\textless{\bfseries #1}\textgreater}]
    \code{#2}
    \item[\code{\textless/{\bfseries #1}\textgreater}]
    \index{#1 element@\py@idxcode{#1} element}
    \index{elements!#1@\py@idxcode{#1}}
}{\end{fulllineitems}}

% \begin{attributedesc}{name}{content-type}
\newenvironment{attributedesc}[2]{
  \begin{fulllineitems}
    \item[\code{\bfseries#1}{\quad(\code{#2})}]
    \index{#1@\py@idxcode{#1}}
}{\end{fulllineitems}}


=== Added File Packages/ZConfig/doc/xmlmarkup.perl ===
# LaTeX2HTML support for the xmlmarkup package.  Doesn't do indexing.

package main;


# sub ltx_next_argument{
#     my $param;
#     $param = missing_braces()
#       unless ((s/$next_pair_pr_rx/$param=$2;''/eo)
# 	      ||(s/$next_pair_rx/$param=$2;''/eo));
#     return $param;
# }


sub do_cmd_element{
    local($_) = @_;
    my $name = next_argument();
    return "<tt class='element'>$name</tt>" . $_;
}

sub do_cmd_attribute{
    local($_) = @_;
    my $name = next_argument();
    return "<tt class='attribute'>$name</tt>" . $_;
}

sub do_env_attributedesc{
    local($_) = @_;
    my $name = next_argument();
    my $valuetype = next_argument();
    return ("\n<dl class='macrodesc'>"
            . "\n<dt><b><tt class='macro'>$name</tt></b>"
            . "&nbsp;&nbsp;&nbsp;(<tt>$valuetype</tt>)"
            . "\n<dd>"
            . $_
            . "</dl>");
}

sub do_env_elementdesc{
    local($_) = @_;
    my $name = next_argument();
    my $contentmodel = next_argument();
    return ("\n<dl class='elementdesc'>"
            . "\n<dt class='start-tag'><tt>&lt;"
            . "<b class='element'>$name</b>&gt;</tt>"
            . "\n<dd class='content-model'>$contentmodel"
            . "\n<dt class='endtag'><tt>&lt;/"
            . "<b class='element'>$name</b>&gt;</tt>"
            . "\n<dd class='descrition'>"
            . $_
            . "</dl>");
}

1;				# Must end with this, because Perl is bogus.