Auto Cite Link

This is a project I created many years ago, and haven't touched in about 14 to 17 years. It's mainly here for posterity, but if you still find it useful (and if it still works) then by all means feel free to make use of it. Any references to "6 times 9" are because that is the retired website where I was previously hosting things like this.

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"></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 resulting 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 Auto Cite Link just right-click and choose "Save As" (or the equivalent for your device/web browser).

Last updated: (version "Alpha")