Help:Using HTML in Note Fields

From ISFDB

Jump to: navigation, search
This page is a work in progress, and has not yet obtained a solid consensus. It was first created (or significantly revised) on 4 December 2011. Do not take the information on this page as firmly established ISFDB policy or guidelines. Feel free to discuss any issues with the content on this page on its talk page. If in doubt, before accepting the guidelines on this page, feel free to discuss the matter elsewhere, perhaps on the Community Portal.

This notice will be removed when the page obtains a reasonable consensus on its contents.

This page is a help or manual page for the ISFDB database. It describes standards or methods for entering or maintaining data in the ISFDB database, or otherwise working with the database. Other help pages may be found via the category below. To discuss what should go on this page, use the talk page.

If, after exploring the Help system, you still have a question, please visit the Help desk and let us know. We probably know the answer, but we need your help to know what we left out of the help pages.

If you are new to editing the ISFDB, please see Help:Getting Started.

For more on this and other header templates, see Header templates.


The note fields on ISFDB Title and Publication records (and other record types that support note fields) permit HTML (Hyper Text Markup language) markup to be entered as part of their text, and will display that HTML when the record is displayed in response to a database query. In theory a very wide variety of effects could be implemented in this way, but in practice only a few HTML constructs are used, to avoid overly complex pages or security problems. Moderators may question the use of any HTML other than the ones listed here.

This page lists the HTML constructs in common use in ISFDB note fields, and describes how to enter them.

Contents

Conventions

On this page, HTML examples and their results are shown in light shaded background and actual tags are shown in Shaded boldface.

If you edit this page or look at the wiki source you will see code and nowiki tags being used. Those are present to allow the examples to display properly -- they should NOT be part of any HTML you enter in ISFDB note fields. In the link examples, wikicode (square brackets) is used to make the results appear correctly, since a tags do not render correctly in wiki pages. Do not enter this into ISFDB note fields, use the forms displayed using the a tags instead.

Tags and Tag Pairs (An Intro to Basic HTML)

All HTML is entered as one or more Tags. A tag starts with a "<" character, and ends with a ">" character. The opening < is followed by code for the tag, which is one or more letters (or in some cases digits). This may be followed by a space and some parameters or settings, depending on the specific tag involved.

Tag Pairs

Most tags come in pairs, a start tag and a stop tag. The stop tag has a slash ("/") before its code. For example if there were a tag with the code "test" the start tag would be <test>, and the end tag would be </test>.

Tags may be nested, but not interleaved. For example, the following would be a valid case of nested tags:

<i>italics and <b>bold italics</b> </i>

The following is an example of INVALID interleaving of tags:

<i>italics and <b>bold italics </i> Just bold? </b>

To put it another way, if a tag pair starts inside another tag pair, it must be closed before the outer tag pair is closed.

If a tag is part of a tag pair, it is important to enter a matching end tag for each start tag. Otherwise the tag's effect may continue onto the display page beyond the note field, leading to incorrect display of the rest of the ISFDB record.

There are some cases where the closing tag of a tag pair may safely be omitted. The only one commonly used in ISFDB note fields is the <li> tag, whose closing tag is optional.

Unpaired tags

Some tags are not part of a tag pair. They do not have a matching close tag. Such tags may end with a space and a slash (/), to indicate that they are "self-closing". However, this is strictly optional for all tags used in ISFDB note fields. This is true in all current versions of HTML and all current browsers. Moreover, future versions of HTML are expected to continue to support the form without the closing slash, so editors may use either form in ISFDB note fields.

Line breaks

Line breaks are perhaps the most common HTML used in ISFDB note fields, and the only commonly used unpaired tag.

Simply entering a return into a notes field will not cause a line break to display. A line break can be forced by using a "break" tag. This is often entered as <br />. The shortcut form <br> also works, the closing slash is strictly optional.

Italics

To display text in italics, such as for a book title, use the i tag. This is part of a tag pair, and MUST be closed or the rest of the record display may be shown in italics.

for example this HTML:

First published in <i>Megabook of Great SF</i> (1955)

would display like this:

First published in Megabook of Great SF (1955)

Boldface

To display text in boldface, such as for emphasis, use the b tag. This is part of a tag pair, and MUST be closed or the rest of the record display may be shown in bold.

for example this HTML:

It is <b>very important</b> to close all tag pairs.

would display like this:

It is very important to close all tag pairs.

Unlike italics, boldface is rather rarely used in ISFDB note fields.

Links

To create and display a hypertext link, use the a (anchor) tag. This is part of a tag pair, and MUST be closed or the rest of the record may not display at all.

The a tag has a single parameter, HREF. This gives the URL (web address) of the site to link to. The URL follows an equals sign and MUST be enclosed in double quotes to work correctly. That is, the full parameter is HREF="URL_Here". The text between the start tag and the end tag will be shown as the name of the link, the text on which a user may click to follow the link. The link name need not be the same as the URL.

A link is often used in the ISFDB to link to a source site from which data has been used or verified.

Be careful to enter only links which are relevant and useful to the record. Links other than to source sites are very unusual.

Only links very likely to stay stable should be entered. If the link target changes it may lead a user to an invalid page, and the information it was supposed to link to will be lost to a user of the ISFDB record, often with no easy way to recover it. If the source is described without a link, it will be as good as ever.

  • Library of Congress LCCN "permalinks" are stable.
  • Links to OCLC/Worldcat records by record number are stable.
  • Links to Project Gutenberg etexts by text number are stable.
  • Links to pages in the Locus online listings are NOT stable. Locus periodically reindexes, changing the page division points and thus the page id for any particular reference, so links to Locus should not be used in ISFDB note fields, as there is no way to automatically update them.

If you are unsure whether a particular link or sort of link is stable, ask at the Help Desk before using it.

Examples

This HTML (for a link to the Library of Congress page for a given Library of Congress Catalog Number):

LCCN: <a HREF="http://lccn.loc.gov/77076221">77-76221</a>

would display like this:

LCCN: 77-76221


This HTML (for a link to a Project Gutenberg version of an ebook):

This ebook edition is available in HTML, ASCII, and iso-8859-1 formats as <a HREF="http://www.gutenberg.org/etext/24135">Ebook #24135</a>. Other formats may be made available in future.

would display like this:

This ebook edition is available in HTML, ASCII, and iso-8859-1 formats as Ebook #24135. Other formats may be made available in future.

Unnumbered lists

To display an unnumbered or "bulleted" list, you use two types of tags. The ul (unnumbered list) tag starts and stops the entire list, and the li (list item) tag marks off individual items in the list.

Many editors use this construct to display a series of separate notations in the note field.

The ul tag MUST be closed properly with a </ul> tag, or the rest of the record will display incorrectly as part of the list. You may see cases where the li tags do not have matching </li> tags. This will work correctly in all current web browsers and HTML versions, and the next version of the HTML standard (HTML5) explicitly permits it. Future versions of HTML are expected to support this also. Therefore closing </li> tags may be used or omitted in ISFDB note fields as each editor prefers, there should be no difference in the resulting display.

It is possible to place one unnumbered list inside a single list item for another (outer) list. This is rarely done in ISFDB note fields, however, as it is usually not needed, and makes editing more complex. It has been done in a few cases. Do not use this technique unless there is a clear need for it, and you are confident that you are closing both inner and outer lists correctly.

Example

Here is an example of a complete unordered list.

This HTML:

<ul>
<li>Copyright 1984 by Jane Jones.</li>
<li>Cover artist credited on back cover.</li>
<li>Third printing by number line.</li>
<li>No date stated for this printing, but Locus shows it as May 1987.</li>
</ul>

would display like this:

  • Copyright 1984 by Jane Jones.
  • Cover artist credited on back cover.
  • Third printing by number line.
  • No date stated for this printing, but Locus shows it as May 1987.

It is not required that each list item starts on a new line, as shown above. The HTML will display a new line for each list item in any case. But it is easier to edit a note field when each list item tag starts a new line, and clearer what the HTML means. Most unnumbered lists in the ISFDB have been entered in this way.

Personal tools