◇◆
<code> Code Text
A container element for technical content
such as programming language code, pseudo-code,
schemas and DTDs, or a markup fragment.
Usage/Remarks
The <code> element may contain preformatted text,
which may contain emphasis elements for syntax coloring,
or it may contain an external link to a binary
executable file.
Best Attribute Practice
The various semantic
attributes should be used to name the
type of code, the language, the intended platform(s), etc. Executable code should
always be
marked as such using the @executable attribute. The @specific-use attribute may also be used to describe the
rationale or uses for a code sample.
Alternatives
When code is present in more than one form, the <code> element
can be used inside an <alternatives> element. The various versions
of the code can be syntax colored using the face markup from this
Tag Set, syntax colored using processing instructions or other
mechanisms from a syntax coloring program, plain ASCII for cut and
paste, an executable version, etc.
MathML
The MathML elements to describe equations are not
permitted within <code>. If equations are encountered
within computer code, they can be tagged using the element <named-content> to preserve the fact
that they were equations or the element <styled-content> to preserve
the fact that they were set in a math font.
Attributes
orientation (default = portrait)
position (default = float)
Miscellaneous non-JATS-specific Attributes
xml:space (fixed value = preserve)
Models and Context
May be contained in
<ack>, <alternatives>, <app>, <app-group>, <bio>, <body>, <boxed-text>, <chem-struct>, <chem-struct-wrap>, <disp-formula>, <disp-quote>, <fig>, <glossary>, <index>, <index-div>, <index-group>, <license-p>, <named-content>, <non-normative-example>, <non-normative-note>, <normative-example>, <normative-note>, <notes>, <p>, <ref-list>, <sec>, <see>, <see-also>, <see-also-entry>, <see-entry>, <styled-content>, <supplementary-material>, <table-wrap>, <tbx:crossReference>, <tbx:definition>, <tbx:entailedTerm>, <tbx:example>, <tbx:externalCrossReference>, <tbx:note>, <tbx:pronunciation>, <tbx:see>, <tbx:source>, <tbx:term>, <tbx:usageNote>, <td>, <term>, <term-display>, <term-sec>, <th>
Description
Any combination of:
- Text, numbers, or special characters
- Accessibility Elements
- External Linking Elements
- Citation Elements
- Ownership Elements
- Emphasis Elements
- Inline Display Elements
- Other Inline Elements
- <fn> Footnote
- <target> Target of an Internal Link
- <tbx:entailedTerm> Entailed Term (TBX)
- <xref> X(cross) Reference
- Baseline Change Elements
Content Model
<!ELEMENT code (#PCDATA %code-elements;)* >
Expanded Content Model
(#PCDATA | alt-text | long-desc | email | ext-link | uri | citation-alternatives | element-citation | mixed-citation | std | attrib | permissions | bold | fixed-case | italic | monospace | num | overline | roman | sans-serif | sc | strike | underline | ruby | inline-graphic | private-char | abbrev | index-term | index-term-range-end | milestone-end | milestone-start | named-content | styled-content | fn | target | tbx:entailedTerm | xref | sub | sup)*
Tagged Samples
Binary code
...
<p>... If code position 01 is assigned to “a”,
code position 02 assigned to “A”, code position
03 to “b”, code position 04 to “B”
and so on, a list sorted directly according to these
rearranged values will yield the following:
<code>
Sorted Internal
List Values
aaaa 01010101
abbb 01030303
Aaaa 02010101
Abbb 02030303
</code>
</p>
...
Coding for line types
...
<p>Define the line types:</p>
<code>
simple_line = (symbol_definition | collating_element |
weight_assignment | order_end)? line_completion ;
table_line = simple_line | tailoring_line ;
tailoring_line = (reorder_after | order_start | reorder_end |
section_definition | reorder_section_after)
line_completion ;
</code>
...