Image pages/Data syntax

From Meta, a Wikimedia project coordination wiki
Jump to navigation Jump to search

Proposals for syntax for the data to be stored on Image pages

Requirements:

  • Image caption, which may include wiki links or formatting (optional)
  • ALT text, which will be plain (required)
  • link to an optional larger image, so that the article page which displays a thumnail can append to the caption "See a Template:Larger image"

Unresolved questions:

  • is it safe to assume that all instances of an image will want the same caption?
  • might some instances want no caption?
    • These can both be resolved by allowing for specification of multiple captions, and allowing some selection of any (or none) of them.

Old proposal[edit]

all text up to the first ------- on the image page becomes the caption.

Old proposal with added ALT[edit]

We can do better than that: make all text up to the first ---- be the caption, and all text between the first ---- and the second ---- be the "alt text" (text when no image downloaded). That way we'll do better with blind or partially sighted readers who are using text-to-speech interfaces and the like. The title (mouseover text) could be something like "click here for a description", I guess - or a repeat of the caption.

For instances with no caption, simply make ---- the first text in the page. I think it's safe to assume that all instances of an image will want the same caption, in practice if not in theory.

Brackets and keywords[edit]

Several blocks delimited by "----" is starting to get messy, but you're right -- we need to provide ALT text. How about:

Caption{ } 
Alt{ }
Larger{ }

on the image page?


Heading markup & #LARGER[edit]

Another option:


#LARGER [[larger-version.lpg]]

== Caption goes here ==
This is alt text

This is not alt text.

I like the idea of using == == to delineate a caption, which seems intuitive to me. No == == - no caption (but first para is still alt text). MyRedDice


Some of my thoughts: --Brion VIBBER 05:50 12 May 2003 (UTC)

Caption[edit]

This is a caption section. It's not alt text, but a caption that will appear below the image if there is a section with a header so named in the desc page.

The caption may even be multiple lines or paragaphs; it is terminated by the end of the page or the next section header.

Alternate caption[edit]

Multiple captions can be provided, and selected among when the image is used. Perhaps something like [[Image:Some image.png|caption:Alternate caption]]?

Image map[edit]

If there's an "Image map" section, the image will be a clickable image map. Lines in a bullet list like this:

Cf HTML client-side image map syntax. The text between the section header and the list will be inserted as alternate text in the map.

Technical notes[edit]

The caption and image map data probably will be parsed on page save and then stored in the image table, so loading a page that uses images doesn't have to load up and parse a gajillion pages.

An image with no caption can go directly in as an inline <img> tag. An image with a caption will be a <div>, necessarily a block-level element. We should extract the size of image files via php's getimagesize() so we can generate appropriate width and height attributes; this is helpful for the browser to set up layout, and necessary to keep long captions from grossly exceeding the width of their images.

Localization[edit]

  • The "Caption" and "Image map" section names should be localizable, as the "image" namespace is.
  • The "rect", "circle", and "poly" for image maps are specific to HTML. It's possible they should be left as-is, but they could be localizable as well.
  • None of the above should be case-sensitive.