figure: Difference between revisions

From Microformats Wiki
Jump to navigation Jump to search
(→‎Key: Explanation of "legend" rather than "caption".)
(Note on usage within HTML 5)
Line 145: Line 145:
<pre>
<pre>
<img class="figure legend" src="foo.jpeg" alt="" title="Foo">
<img class="figure legend" src="foo.jpeg" alt="" title="Foo">
</pre>
== HTML 5 ==
When used in [http://www.w3.org/html/wg/html5/ HTML 5], any &lt;figure> element has an implied class "figure"; any &lt;legend> element has an implied class "legend". For example, the following HTML 5:
<pre>
<figure>
  <img src="foo.jpeg" alt="">
  <legend>Foo</legend>
</figure>
</pre>
is interpreted as if it were:
<pre>
<figure class="figure">
  <img src="foo.jpeg" alt="">
  <legend class="legend">Foo</legend>
</figure>
</pre>
</pre>



Revision as of 10:00, 3 March 2008

figure 0.1

Specification

This is a DRAFT specification.

Author
Toby Inkster (affiliations above)
Acknowledgements
See acknowledgements.

Copyright and patents statements apply.

Introduction

Many HTML documents include supporting images, such as photographs, flow charts, graphs, blueprints or screen captures. These are usually incorporated using the HTML <img> element, however this offers no way of differentiating between such supplementary content and mere decorative images.

Authors often wish to annotate these images with captions or attributions. Currently there is no markup to explicitly associate such text with an image and readers must rely on the proximity of the image and text on the finished rendered page.

This specification aims to allow authors to mark up captions and credits, explicitly associating them with an image.

The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in RFC 2119.

Format

Properties

Key

Based on Perl's standard quantifiers:

bold {1} MUST be present exactly once
italic* OPTIONAL, and MAY occur more than once
+ MUST be present, and MAY occur more than once
? OPTIONAL, but MUST NOT occur more than once
[square brackets] list of common values
(parentheses) data format
# comment
! awaiting documentation


Additionally, an figure MAY contain zero or more links marked up with rel-tag and MAY contain zero or more links marked up with rel-license.

If an element with class "credit" also has class "vcard" then the element SHOULD be considered to be the hcard for a credited person or organisation. Otherwise it MUST be considered as a plain text credit.

If an element with class "subject" also has a class "vcard" then the element SHOULD be considered to be the hcard for the subject of the image - for example a person in a photograph or sketch. If an element with class "subject" also has a class "adr" or "geo" then the element should be considered to be the address or geographic location of the subject of the picture - for example the location of a landscape in a photo or the address of a the building shown in blueprints. If an element with class "subject" also has a class "vevent" then the element should be considered to be the vevent for the subject of a figure - for example a photograph of a sporting event, or a diagram of a military operation.

Please note that the "legend" element should contain what would normally be called a "caption". The term "legend" is used in this specification instead of "caption" in order to maintain parity with the element names used in HTML5. The subject, credit, tags and licence may be children of the legend, in which case the text within them forms part of the legend as well as part of the child elements.

Examples

<div class="figure">
  <img class="image" src="photo.jpeg" alt="">
  <p class="legend">
    <a rel="tag" href="http://en.wikipedia.org/wiki/Photography">Photo</a>
    of <span class="subject">Albert Einstein</span> by
    <span class="vcard credit">
      <span class="fn">Paul Ehrenfest</span>
      (<span class="role">photographer</span>)
    </span>
  </p>
</div>

Parsed as:

  • Image: photo.jpeg
  • Legend: Photo of Albert Einstein by Paul Ehrenfest
  • Credit: Paul Ehrenfest (hCard)
  • Subject: Albert Einstein
  • Categories: Photography
  • License: (unspecified)
<p class="figure">
  <label style="display:block" class="legend">January sales data</label>
  <img class="image" src="salesdata.png"
  alt="Widget sales have fallen slightly, but widget repair kits have sold well.">
</p>

Parsed as:

  • Image: salesdata.png
  • Legend: January sales data

Include Pattern

The include pattern MAY be used within figures.

ABBR Pattern

As the figure microformat does not specify any properties that are not human-readable, the abbr design pattern SHOULD NOT be used directly within a figure, though it MAY be used within children formatted in accordance to another microformat - e.g. as vevents often use the abbr design pattern to specify their start time, a figure subject formatted as a vevent MAY use the abbr design pattern in accordance with the hcalendar specification.

Minimisation

To simplify markup, a number of shortcuts are explicitly allowed by this specification.

  1. When no "image" class is found within the figure, the first <img> element MUST be taken to be the image.
  2. If the "legend" class is found on the same element as the "image" class (or the image inferred by the previous rule), then the contents of the title attribute MUST be used as the legend.
  3. The "image" and/or "legend" classes may be attached to the same element as the element with the "figure" class.

Examples

The following examples MUST all be considered equivalent:

<div class="figure">
  <img class="image" src="foo.jpeg" alt="">
  <span class="legend">Foo</span>
</div>
<div class="figure">
  <img src="foo.jpeg" alt="">
  <span class="legend">Foo</span>
</div>
<div class="figure">
  <img class="legend" src="foo.jpeg" alt="" title="Foo">
</div>
<img class="figure legend" src="foo.jpeg" alt="" title="Foo">

HTML 5

When used in HTML 5, any <figure> element has an implied class "figure"; any <legend> element has an implied class "legend". For example, the following HTML 5:

<figure>
  <img src="foo.jpeg" alt="">
  <legend>Foo</legend>
</figure>

is interpreted as if it were:

<figure class="figure">
  <img src="foo.jpeg" alt="">
  <legend class="legend">Foo</legend>
</figure>

Inspiration and Acknowledgments

Copyright

This specification is released into the public domain.

Public Domain Contribution Requirement. Since the author(s) released this work into the public domain, in order to maintain this work's public domain status, all contributors to this page agree to release their contributions to this page to the public domain as well. Contributors may indicate their agreement by adding the public domain release template to their user page per the Voluntary Public Domain Declarations instructions. Unreleased contributions may be reverted/removed.

Patents

This specification is subject to a royalty free patent policy, e.g. per the W3C Patent Policy, and IETF RFC3667 & RFC3668.

See also