How to write .txt files for the Railfaneurope.net Picture Gallery

A simple example

Let's assume that the image file to be uploaded has the name "abc123.jpg", then the corresponding text file must be called "abc123.txt", and it could look e.g. like this:
ABC locomotive 123 456 with a local train, leaving station Anyplace 
for Somewhere Else.

Photo by J. Random User (user@host.domain.net)
It is generally not necessary to insert HTML formatting tags, but read on if you are interested in more details.

HTML formatting tags and why you often won't need them

In ordinary HTML text, line breaks and blank lines in the source file are ignored by the browsers. Instead, formatting tags are necessary; the most important ones here are <BR> for a line break and <P> for a new paragraph. (The practical difference between the two is that most browsers insert a blank line between paragraphs.)

However, the script that generates the HTML pages for the European Railways Picture Gallery (the pages "pix.html") automatically inserts <P> and <BR> tags at certain places in the .txt file, e.g. before strings like "Photo by" or "Scan:". This means that for simple text explanations without any particular fomatting, you don't need to bother with HTML tags at all.

For example, this is the result that is generated from the sample .txt file given above:

ABC locomotive 123 456 with a local train, leaving station Anyplace for Somewhere Else.

Photo by J. Random User (user@host.domain.net)

If you want line breaks at arbitrary places in the .txt file, you must insert appropriate formatting tags yourself. See below for an example.

Arbitrary HTML tags and links in .txt files

You can also use any other HTML tags in .txt files (exceptions see below) - please don't abuse this possibility.

This means that you can also put links in the .txt files which will then appear in the respective pix.html page(s). Links must look either like this:

<A HREF=target.document> Some text </A>
or (better) like this:
<A HREF="target.document"> Some text </A>
- but never use just one of the quotation marks (") and leave out the other!

Please also make sure that you have properly paired opening and closing tags, e.g. <EM> ... </EM>.

Never use the following tags:

<HTML> </HTML> <HEAD> </HEAD> <BODY> </BODY>
- this also means that .txt files cannot be valid self-contained HTML documents (which they aren't supposed to be).

Using HTML editors

Because of the above, the output produced by HTML editors or by text processors in HTML mode can't be directly used. If you still prefer to prepare your text files with HTML elements in this way, you have to open the resulting HTML file with a text editor and remove the following: Don't forget to save the result as a plain text file (with the extension .txt).

8-bit characters and HTML entity codes

You can use HTML entity codes like &eacute; or &Auml; in a .txt file to produce those ISO-Latin-1 characters that are not in the ISO-7-bit (US-ASCII, ISO 646) character set (see e.g. here for a complete list). Alternatively, 8-bit characters according to ISO 8859-1 are perfectly acceptable (but if you're not certain whether that is what your computer produces, the HTML entity codes are the safest bet).

See below for an example.

A more complicated example

The .txt file:
Soci&eacute;t&eacute; Nationale des Chemins de Fer Fran&ccedil;ais
(SNCF) <BR>
Electric locomotive class 15000 <BR>
Current system: 25 kV AC, 50 Hz <P>
Unit BB-15036 of the SNCF, hauling a Eurocity train to Z&uuml;rich
near Ribeauvill&eacute;

Photo: J. Random User (user@host.domain.net)
Scan: S. Friendly (friendly@host.domain.net)
This is the result like it appears in the final HTML page:
Société Nationale des Chemins de Fer Français (SNCF)
Electric locomotive class 15000
Current system: 25 kV AC, 50 Hz

Unit BB-15036 of the SNCF, hauling a Eurocity train to Zürich near Ribeauvillé

Photo: J. Random User (user@host.domain.net)
Scan: S. Friendly (friendly@host.domain.net)

I don't understand what you mean with "file name extensions".

If you use a Microsoft Windows system with the default settings, then you may never have encountered file name extensions. But if you check the properties of the file, then you will be shown a dot and up to three letters added to the file name - this is the file name extension. Windows simply translates that to the "file type" (and vice versa), and what you see as the file name is actually just the base name of the file.

So for your purposes our rule about the file names of picture and accompanying text files translates to: include a plain text file with the same file name as the JPEG or GIF file it refers to.

Further reading about character codes


To the home page of the Railfaneurope.net
To the starting page of the Rainfaneurope.net Picture Gallery