Auto Cite Link

About

Takes the CITE attribute of <q> and creates a superscript link to the referenced page, and takes the CITE attribute of <blockquote> and creates a normal link at the end of the block.

The superscript link's text is a number that increases for each CITE (i.e. the first <q> with a CITE is "1", the second is "2", etc.). The script does not keep the same number for the same source; if a later CITE has the same URL as an earlier CITE it will not be given the same number as the first CITE.

Example

The first inline quote will gain a superscript 1, an inline quote without a CITE will have no link, the second inline quote will get a superscript 2, and so on.

A <blockquote> with a CITE will gain a link at the end of it that links to the given URL, with the URL also being used for the text of the link. The different methods for outputting the value of the CITE attribute are because <q> is an inline element, and as such the superscript is less disruptive to the flow of the text.

Bizarrely, despite being presented as quotations, the only place the quotations in this Example section appear is in the quotations in the Example section...

As with the inline quotes, a <blockquote> without a CITE will not gain a link.

Using

All you need to do put the following at the end of the <head> section:

<script src="citelink.js" type="text/javascript"></script>

Then any <q> and <blockquote> tags with a CITE attribute will automatically gain appropriate links.

For reference, the CITE attribute is optional and must be a URL (that's not because of the script; that's because of how The Powers That Be decided CITE should work). The URL given can be either relative or absolute. For example:

<q cite="/example.html">An inline quote with a relative URL.</q>

<blockquote cite="http://www.example.com/">A block quote with an absolue URL.</blockquote>

Styling

The link inside <q> is just inside a <sup> with no CLASS on either, but the link inside <blockquote> is inside a <p> with the CLASS of "cite".

So the generated code will be:

<q cite="http://www.example.com/">Quoted text<sup><a href="http://www.example.com/">1</a></sup></q>

<blockquote cite="http://www.example.com/"><p>Quoted text</p><p class="cite"><a href="http://www.example.com/">http://www.example.com/</a></p> </blockquote>

For the <blockquote> link, I like font-size: small; text-align: right;, but you can do whatever you prefer.

Download

To download the Auto Cite Link just right-click and choose "Save As" (or the equivalent for your Operating System/Web Browser).

It is also available for Greasemonkey (Greasemonkey is an add-on for Firefox).

The current version is Alpha (2008-02-09) - No changelog.

There's now an RSS feed for easy notification of the infrequent updates to all 6 times 9 projects.

Feedback

I'd like to hear what you have to say about this script; I've only been able to test it in IE, Firefox, and Opera in Windows - I have no idea if it'll work on a Mac, for example...

If you have any comments, compliments, or suggestions feel free to email me and let me know.