Difference between revisions of "FormatISBN10"

From Sega Retro

(duplicate code because divs get in the way and argh)
Line 1: Line 1:
<includeonly><div style="display:none;">{{#vardefine:isbn10raw|{{#replace:{{{1|}}}|-||}}}}{{#vardefine:isbn10raw|{{#replace:{{#var:isbn10raw}}| ||}}}}
+
<includeonly>{{#if:{{{1|}}}|<div style="display:none;">{{#vardefine:isbn10raw|{{#replace:{{{1|}}}|-||}}}}{{#vardefine:isbn10raw|{{#replace:{{#var:isbn10raw}}| ||}}}}
 
{{#ifexpr:{{#len:{{#var:isbn10raw}}}} != 10|{{#ifeq:{{{link|}}}|yes|[[Category:Incorrect ISBN-10]]}}|}}
 
{{#ifexpr:{{#len:{{#var:isbn10raw}}}} != 10|{{#ifeq:{{{link|}}}|yes|[[Category:Incorrect ISBN-10]]}}|}}
  
Line 10: Line 10:
 
{{#vardefine:isbn10|{{#var:isbn10region}}-{{#var:everythingelse}}-{{#var:checkdigit}}}}
 
{{#vardefine:isbn10|{{#var:isbn10region}}-{{#var:everythingelse}}-{{#var:checkdigit}}}}
  
</div>{{#ifeq:{{{link|}}}|yes|[http://www.worldcat.org/isbn/{{#var:isbn10}} {{#var:isbn10}}]|{{#var:isbn10}}}}</includeonly><noinclude>
+
</div>{{#ifeq:{{{link|}}}|yes|[http://www.worldcat.org/isbn/{{#var:isbn10}} {{#var:isbn10}}]|{{#var:isbn10}}}}|}}</includeonly><noinclude>
  
 
Template for formatting ISBN-10 numbers. Hypens and spaces are stripped out at the start.
 
Template for formatting ISBN-10 numbers. Hypens and spaces are stripped out at the start.

Revision as of 16:23, 1 May 2019


Template for formatting ISBN-10 numbers. Hypens and spaces are stripped out at the start.


The format for ISBN-10 is

[region]-[publisher]-[title]-[checkdigit]

the region is a fixed length (depending on where it came from), but the publisher and title fields can be any length, so they're currently grouped together.

Examples

{{FormatISBN10|4073055501|link=yes}}




4-07305550-1


{{FormatISBN10|5073 055501}}


50-73 0555-01