Difference between revisions of "FormatISBN10"

From Sega Retro

(duplicate code because divs get in the way and argh)
Line 4: Line 4:
 
{{#vardefine:isbn10region|{{#sub:{{#var:isbn10raw}}|0|1}}}}
 
{{#vardefine:isbn10region|{{#sub:{{#var:isbn10raw}}|0|1}}}}
 
{{#ifexpr:{{#var:isbn10region}} > 4 and {{#var:isbn10region}} != 7
 
{{#ifexpr:{{#var:isbn10region}} > 4 and {{#var:isbn10region}} != 7
|{{#vardefine:isbn10region|{{#sub:{{#var:isbn10raw}}|0|2}}}}{{#vardefine:everythingelse|{{#sub:{{#var:isbn10raw}}|2|7}}}}[[Category:ISBN is probably wrong]]
+
|{{#vardefine:isbn10region|{{#sub:{{#var:isbn10raw}}|0|2}}}}{{#vardefine:everythingelse|{{#sub:{{#var:isbn10raw}}|2|7}}}}[[Category:ISBN-10 is probably wrong]]
 
|{{#vardefine:everythingelse|{{#sub:{{#var:isbn10raw}}|1|8}}}}
 
|{{#vardefine:everythingelse|{{#sub:{{#var:isbn10raw}}|1|8}}}}
 
}}
 
}}

Revision as of 16:06, 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