<grammar xmlns="http://relaxng.org/ns/structure/1.0" xmlns:z="http://www.daisy.org/ns/z3998/annotations/#" xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0" xmlns:sch="http://purl.oclc.org/dsdl/schematron" xmlns:db="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" ns="http://www.daisy.org/ns/z3998/authoring/">
<info xmlns="http://docbook.org/ns/docbook" xml:lang="en">
<title>The code module </title>
<annotation annotates="/">
<para>This module defines the code.block element for marking instances of computer code, commands and coded alphabets and systems. </para>
<para>Two variants of the code element are available: one for use in a Block context and a second for use in a Phrase context. </para>
<para>More information about this module is available at http://www.daisy.org/z3998/2012/auth/cm/#z3998.code.module</para>
</annotation>
<author>
<personname>Markus Gylling</personname>
<email>mgylling@daisy.org</email>
</author>
<copyright>
<year>2009</year>
<year>2010</year>
<year>2011</year>
<year>2012</year>
<holder>DAISY Consortium</holder>
</copyright>
<legalnotice>
<para>This module is licensed under a Creative Commons Attribution 3.0 license, a copy of which is available at
<link xlink:href="http://creativecommons.org/licenses/by/3.0/">http://creativecommons.org/licenses/by/3.0/</link>
</para>
<para>For complete licensing information, please refer to the LICENSE file that came with this distribution, a copy of which is also available from the DAISY web site at
<link xlink:href="http://www.daisy.org">www.daisy.org</link>
</para>
</legalnotice>
<revhistory>
<revision>
<date>2012-12-19</date>
<authorinitials>MGy</authorinitials>
<revdescription>
<para>Initial version</para>
</revdescription>
</revision>
</revhistory>
</info>
<div>
<define name="z3998.code.block">
<element name="code">
<a:documentation>The code element is intended for general instances of code as found in works of fiction and similar non-technical documents, which includes computer programming code, commands and command input/output as well as representations of numeric and text coding systems, such as Morse code. For computer programming books, manuals and specifications, specializing the code element or using a computer markup feature is recommended. </a:documentation>
<ref name="z3998.code.block.attlist"/>
<ref name="z3998.code.block.content"/>
<sch:rule context="default:code">
<sch:assert test="normalize-space(.) or *">The code element must neither be empty nor contain only whitespace. </sch:assert>
</sch:rule>
</element>
</define>
<define name="z3998.code.block.attlist">
<ref name="z3998.Block.attrib"/>
</define>
<define name="z3998.code.block.content">
<choice>
<group>
<oneOrMore>
<choice>
<ref name="z3998.code.lngroup"/>
<ref name="z3998.code.ln"/>
<ref name="z3998.Global.extra.class"/>
</choice>
</oneOrMore>
</group>
<group>
<oneOrMore>
<choice>
<ref name="z3998.Block.basic.model"/>
<ref name="z3998.Global.extra.class"/>
</choice>
</oneOrMore>
</group>
</choice>
</define>
<define name="z3998.code.lngroup">
<element name="lngroup">
<a:documentation>The lngroup element for code represents a grouping of ln code elements. Lines of code may be grouped to show a section of a coded message, a computer program, methods within a program, to separate programs from sample input/output, etc. </a:documentation>
<ref name="z3998.code.lngroup.attlist"/>
<ref name="z3998.code.lngroup.content"/>
</element>
</define>
<define name="z3998.code.lngroup.attlist">
<ref name="z3998.Block.attrib"/>
</define>
<define name="z3998.code.lngroup.content">
<interleave>
<oneOrMore>
<ref name="z3998.code.ln"/>
</oneOrMore>
<zeroOrMore>
<ref name="z3998.Global.extra.class"/>
</zeroOrMore>
</interleave>
</define>
<define name="z3998.code.ln">
<element name="ln">
<a:documentation>The ln element for the code element represents a single line of code. The lnum element can be added at the start of the ln for code examples that include line numbers. </a:documentation>
<ref name="z3998.code.ln.attlist"/>
<ref name="z3998.code.ln.content"/>
</element>
</define>
<define name="z3998.code.ln.attlist">
<ref name="z3998.Phrase.attrib"/>
</define>
<define name="z3998.code.ln.content">
<interleave>
<optional>
<ref name="z3998.lnum"/>
</optional>
<ref name="z3998.Text.model"/>
</interleave>
</define>
</div>
<div>
<define name="z3998.code.phrase">
<element name="code">
<a:documentation>The code element is intended for general instances of code as found in works of fiction and similar non-technical documents, which includes computer programming code, commands and command input/output as well as representations of numeric and text coding systems, such as Morse code. For computer programming books, manuals and specifications, specializing the code element or using a computer markup feature is recommended. </a:documentation>
<ref name="z3998.code.phrase.attlist"/>
<ref name="z3998.code.phrase.content"/>
</element>
</define>
<define name="z3998.code.phrase.attlist">
<ref name="z3998.Phrase.attrib"/>
</define>
<define name="z3998.code.phrase.content">
<ref name="z3998.Text.model"/>
</define>
</div>
<div>
<a:documentation>code - default content model contribution </a:documentation>
<define name="z3998.Block.core.class" combine="choice">
<ref name="z3998.code.block"/>
</define>
<define name="z3998.Phrase.core.class" combine="choice">
<ref name="z3998.code.phrase"/>
</define>
</div>
</grammar>