Jump to content

Template talk:Library of Congress Classification code

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Omegatron (talk | contribs) at 04:46, 5 December 2006 («+": Looks like it works. I'll add documentation."»). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

Usage

This template is used for referring to books by their Library of Congress Classification codes. For the external links to be formatted correctly, the LCC code must be presented without any spaces. For example:

{{LCC|Z253.U69}} results in "LCC Z253.U69"

Some LCC codes contain an obligatory space followed by a year designation. In that case, the year must be passed as a second parameter to the template. For example:

{{LCC|Z253.U69|1993}} results in LCC Z253.U69 1993
Thankfully, using two pipes ('|') seems to work when you need to pass two spaces, like so: LCC G635.C66 H86 1997 Great work, Thanks! -- Avi 18:43, 31 May 2006 (UTC)[reply]


LCCN

Someone, please make a template:LCCN for LC Control Number search[1]. I spend an hour and failed. It would be easy for an expredienced template maker. Thanks! --Irpen 19:42, 18 March 2006 (UTC)[reply]

Done. -- Jeandré, 2006-04-08t19:41z

urlencode

Why does it require you to separate spaces with pipes? Why not just use urlencode?


{{LCC|Z253.U69|1993}} results in LCC Z253.U69 1993
{{LCC|{{urlencode:Z253.U69 1993}}}} results in LCC Z253.U69+1993

Same exact URL, so you can just use:

[http://catalog.loc.gov/cgi-bin/Pwebrecon.cgi?Search_Arg={{urlencode:{{{1}}}}}&Search_Code=CALL_&CNT=5 {{{1}}}]

and get the same output:

{{LCC|Z253.U69 1993}} results in LCC Z253.U69 1993

Is this the only reason it uses the pipes? — Omegatron 20:36, 3 December 2006 (UTC)[reply]

That was indeed the only reason when I wrote the original version. I'm not sure urlencode: existed at that time. Now that pipes are already in use, it would require a bot to change all occurrences with pipes, though. --MarkSweep (call me collect) 00:21, 4 December 2006 (UTC)[reply]

I'm sure someone would write a bot for it if asked. In the meantime, the template can be made to support both formats at the same time, and the documentation changed to recommend the non-piped version.

Test cases:

{{LCC|Z253.U69}} results in LCC Z253.U69
{{LCC|QC791.D64}} results in LCC QC791.D64
{{LCC|75-80057}} results in LCC 75-80057
{{LCC|Z253.U69|1993}} results in LCC Z253.U69 1993
{{LCC|Z253.U69 1993}} results in LCC Z253.U69 1993
{{LCC|DD247.E5|P39}} results in LCC DD247.E5 P39
{{LCC|DD247.E5 P39}} results in LCC DD247.E5 P39
{{LCC|G635.C66|H86|1997}} results in LCC G635.C66 H86 1997
{{LCC|G635.C66 H86 1997}} results in LCC G635.C66 H86 1997

Omegatron 04:39, 5 December 2006 (UTC)[reply]

Looks like it works. I'll add documentation. — Omegatron 04:46, 5 December 2006 (UTC)[reply]