Difference between revisions of "Barcode"
From Sega Retro
(9 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
− | <includeonly> | + | <includeonly><div style="display:none;"> |
+ | {{#vardefine:linewidth|{{{size|2}}}}} | ||
+ | {{#vardefine:height|{{{height|{{#expr:{{#var:linewidth}}*65}}}}}}} | ||
+ | {{#vardefine:white|style="width:0px; max-height:{{#var:height}}px; height:{{#var:height}}px; padding:0px; border-left: {{#var:linewidth}}px solid #FFFFFF;"}} | ||
+ | {{#vardefine:black|style="width:0px; max-height:{{#var:height}}px; height:{{#var:height}}px; padding:0px; border-left: {{#var:linewidth}}px solid #000000;"}} | ||
− | + | {{#switch:{{#len:{{{1|}}}}} | |
− | {{#vardefine: | + | |12= |
− | {{#vardefine: | + | {{#vardefine:Q1|{{#sub:{{{1|}}}|0|1}}}} |
− | {{#vardefine: | + | |
− | {{# | + | {{#vardefine:L|{{Barcode/Digit|{{#sub:{{{1|}}}|1|1}}|left}} |
− | {{# | + | {{Barcode/Digit|{{#sub:{{{1|}}}|2|1}}|left}} |
− | {{# | + | {{Barcode/Digit|{{#sub:{{{1|}}}|3|1}}|left}} |
+ | {{Barcode/Digit|{{#sub:{{{1|}}}|4|1}}|left}} | ||
+ | {{Barcode/Digit|{{#sub:{{{1|}}}|5|1}}|left}} | ||
+ | }} | ||
+ | |||
+ | {{#vardefine:R|{{Barcode/Digit|{{#sub:{{{1|}}}|6|1}}|right}} | ||
+ | {{Barcode/Digit|{{#sub:{{{1|}}}|7|1}}|right}} | ||
+ | {{Barcode/Digit|{{#sub:{{{1|}}}|8|1}}|right}} | ||
+ | {{Barcode/Digit|{{#sub:{{{1|}}}|9|1}}|right}} | ||
+ | {{Barcode/Digit|{{#sub:{{{1|}}}|10|1}}|right}} | ||
+ | }} | ||
+ | |||
+ | {{#vardefine:Q2|{{#sub:{{{1|}}}|11|1}}}} | ||
+ | |||
+ | {{#vardefine:LRColumns|35}} | ||
+ | |13= | ||
+ | {{#vardefine:Q1|{{#sub:{{{1|}}}|0|1}}}} | ||
+ | |||
+ | {{#vardefine:L|{{#switch:{{#var:Q1}} | ||
+ | |||
+ | |0={{Barcode/Digit|{{#sub:{{{1|}}}|1|1}}|left}} | ||
+ | {{Barcode/Digit|{{#sub:{{{1|}}}|2|1}}|left}} | ||
+ | {{Barcode/Digit|{{#sub:{{{1|}}}|3|1}}|left}} | ||
+ | {{Barcode/Digit|{{#sub:{{{1|}}}|4|1}}|left}} | ||
+ | {{Barcode/Digit|{{#sub:{{{1|}}}|5|1}}|left}} | ||
+ | {{Barcode/Digit|{{#sub:{{{1|}}}|6|1}}|left}} | ||
+ | |||
+ | |1={{Barcode/Digit|{{#sub:{{{1|}}}|1|1}}|left}} | ||
+ | {{Barcode/Digit|{{#sub:{{{1|}}}|2|1}}|left}} | ||
+ | {{Barcode/Digit|{{#sub:{{{1|}}}|3|1}}|G}} | ||
+ | {{Barcode/Digit|{{#sub:{{{1|}}}|4|1}}|left}} | ||
+ | {{Barcode/Digit|{{#sub:{{{1|}}}|5|1}}|G}} | ||
+ | {{Barcode/Digit|{{#sub:{{{1|}}}|6|1}}|G}} | ||
+ | |||
+ | |2={{Barcode/Digit|{{#sub:{{{1|}}}|1|1}}|left}} | ||
+ | {{Barcode/Digit|{{#sub:{{{1|}}}|2|1}}|left}} | ||
+ | {{Barcode/Digit|{{#sub:{{{1|}}}|3|1}}|G}} | ||
+ | {{Barcode/Digit|{{#sub:{{{1|}}}|4|1}}|G}} | ||
+ | {{Barcode/Digit|{{#sub:{{{1|}}}|5|1}}|left}} | ||
+ | {{Barcode/Digit|{{#sub:{{{1|}}}|6|1}}|G}} | ||
+ | |||
+ | |3={{Barcode/Digit|{{#sub:{{{1|}}}|1|1}}|left}} | ||
+ | {{Barcode/Digit|{{#sub:{{{1|}}}|2|1}}|left}} | ||
+ | {{Barcode/Digit|{{#sub:{{{1|}}}|3|1}}|G}} | ||
+ | {{Barcode/Digit|{{#sub:{{{1|}}}|4|1}}|G}} | ||
+ | {{Barcode/Digit|{{#sub:{{{1|}}}|5|1}}|G}} | ||
+ | {{Barcode/Digit|{{#sub:{{{1|}}}|6|1}}|left}} | ||
+ | |||
+ | |4={{Barcode/Digit|{{#sub:{{{1|}}}|1|1}}|left}} | ||
+ | {{Barcode/Digit|{{#sub:{{{1|}}}|2|1}}|G}} | ||
+ | {{Barcode/Digit|{{#sub:{{{1|}}}|3|1}}|left}} | ||
+ | {{Barcode/Digit|{{#sub:{{{1|}}}|4|1}}|left}} | ||
+ | {{Barcode/Digit|{{#sub:{{{1|}}}|5|1}}|G}} | ||
+ | {{Barcode/Digit|{{#sub:{{{1|}}}|6|1}}|G}} | ||
+ | |||
+ | |5={{Barcode/Digit|{{#sub:{{{1|}}}|1|1}}|left}} | ||
+ | {{Barcode/Digit|{{#sub:{{{1|}}}|2|1}}|G}} | ||
+ | {{Barcode/Digit|{{#sub:{{{1|}}}|3|1}}|G}} | ||
+ | {{Barcode/Digit|{{#sub:{{{1|}}}|4|1}}|left}} | ||
+ | {{Barcode/Digit|{{#sub:{{{1|}}}|5|1}}|left}} | ||
+ | {{Barcode/Digit|{{#sub:{{{1|}}}|6|1}}|G}} | ||
+ | |||
+ | |6={{Barcode/Digit|{{#sub:{{{1|}}}|1|1}}|left}} | ||
+ | {{Barcode/Digit|{{#sub:{{{1|}}}|2|1}}|G}} | ||
+ | {{Barcode/Digit|{{#sub:{{{1|}}}|3|1}}|G}} | ||
+ | {{Barcode/Digit|{{#sub:{{{1|}}}|4|1}}|G}} | ||
+ | {{Barcode/Digit|{{#sub:{{{1|}}}|5|1}}|left}} | ||
+ | {{Barcode/Digit|{{#sub:{{{1|}}}|6|1}}|left}} | ||
+ | |||
+ | |7={{Barcode/Digit|{{#sub:{{{1|}}}|1|1}}|left}} | ||
+ | {{Barcode/Digit|{{#sub:{{{1|}}}|2|1}}|G}} | ||
+ | {{Barcode/Digit|{{#sub:{{{1|}}}|3|1}}|left}} | ||
+ | {{Barcode/Digit|{{#sub:{{{1|}}}|4|1}}|G}} | ||
+ | {{Barcode/Digit|{{#sub:{{{1|}}}|5|1}}|left}} | ||
+ | {{Barcode/Digit|{{#sub:{{{1|}}}|6|1}}|G}} | ||
+ | |||
+ | |8={{Barcode/Digit|{{#sub:{{{1|}}}|1|1}}|left}} | ||
+ | {{Barcode/Digit|{{#sub:{{{1|}}}|2|1}}|G}} | ||
+ | {{Barcode/Digit|{{#sub:{{{1|}}}|3|1}}|left}} | ||
+ | {{Barcode/Digit|{{#sub:{{{1|}}}|4|1}}|G}} | ||
+ | {{Barcode/Digit|{{#sub:{{{1|}}}|5|1}}|G}} | ||
+ | {{Barcode/Digit|{{#sub:{{{1|}}}|6|1}}|left}} | ||
+ | |||
+ | |9={{Barcode/Digit|{{#sub:{{{1|}}}|1|1}}|left}} | ||
+ | {{Barcode/Digit|{{#sub:{{{1|}}}|2|1}}|G}} | ||
+ | {{Barcode/Digit|{{#sub:{{{1|}}}|3|1}}|G}} | ||
+ | {{Barcode/Digit|{{#sub:{{{1|}}}|4|1}}|left}} | ||
+ | {{Barcode/Digit|{{#sub:{{{1|}}}|5|1}}|G}} | ||
+ | {{Barcode/Digit|{{#sub:{{{1|}}}|6|1}}|left}} | ||
+ | |||
+ | }} | ||
+ | }} | ||
+ | |||
+ | {{#vardefine:R|{{Barcode/Digit|{{#sub:{{{1|}}}|7|1}}|right}} | ||
+ | {{Barcode/Digit|{{#sub:{{{1|}}}|8|1}}|right}} | ||
+ | {{Barcode/Digit|{{#sub:{{{1|}}}|9|1}}|right}} | ||
+ | {{Barcode/Digit|{{#sub:{{{1|}}}|10|1}}|right}} | ||
+ | {{Barcode/Digit|{{#sub:{{{1|}}}|11|1}}|right}} | ||
+ | {{Barcode/Digit|{{#sub:{{{1|}}}|12|1}}|right}}}} | ||
+ | }} | ||
+ | {{#vardefine:LRColumns|42}} | ||
+ | }} | ||
</div> | </div> | ||
− | {|style="width:auto; | + | {|style="width:auto; font-family: monospace;" |
− | + | |-style="background-color:#FFFFFF;" | |
− | |||
− | | | ||
− | |||
− | |||
− | |||
− | |||
− | |||
|{{#var:white}}| | |{{#var:white}}| | ||
|{{#var:white}}| | |{{#var:white}}| | ||
Line 32: | Line 130: | ||
|rowspan="2" {{#var:black}}| | |rowspan="2" {{#var:black}}| | ||
− | {{ | + | {{#ifeq:{{#len:{{{1|}}}}}|12| |
− | {{ | + | {{Barcode/Digit|0|left|rowspan=2}} |
− | + | }} | |
− | {{Barcode/Digit| | ||
− | |||
− | + | {{#var:L}} | |
− | + | ||
− | + | {{!}}rowspan="2" {{#var:white}}{{!}} | |
− | + | {{!}}rowspan="2" {{#var:black}}{{!}} | |
− | + | {{!}}rowspan="2" {{#var:white}}{{!}} | |
+ | {{!}}rowspan="2" {{#var:black}}{{!}} | ||
+ | {{!}}rowspan="2" {{#var:white}}{{!}} | ||
+ | |||
+ | {{#var:R}} | ||
− | {{ | + | {{#ifeq:{{#len:{{{1|}}}}}|12| |
− | {{Barcode/Digit| | + | {{Barcode/Digit|{{#sub:{{{1|}}}|11|1}}|right|rowspan=2}} |
− | + | }} | |
− | |||
− | |||
|rowspan="2" {{#var:black}}| | |rowspan="2" {{#var:black}}| | ||
Line 63: | Line 161: | ||
|{{#var:white}}| | |{{#var:white}}| | ||
|{{#var:white}}| | |{{#var:white}}| | ||
+ | |-style="background-color:#FFFFFF; font-size:{{#expr:{{#var:linewidth}}*9}}px;" | ||
+ | {{#vardefine:textStyle|style="text-align:center; padding:0px; max-width:0px; line-height:{{#expr:{{#var:linewidth}}*9}}px;"}}{{#switch:{{#len:{{{1|}}}}} | ||
+ | |12= | ||
+ | {{!}}colspan="9" rowspan="2" {{#var:textStyle}} {{!}}{{#var:Q1}} | ||
+ | {{!}}colspan="7" rowspan="2" {{#var:textStyle}} {{!}}{{#sub:{{{1|}}}|1|1}} | ||
+ | {{!}}colspan="7" rowspan="2" {{#var:textStyle}} {{!}}{{#sub:{{{1|}}}|2|1}} | ||
+ | {{!}}colspan="7" rowspan="2" {{#var:textStyle}} {{!}}{{#sub:{{{1|}}}|3|1}} | ||
+ | {{!}}colspan="7" rowspan="2" {{#var:textStyle}} {{!}}{{#sub:{{{1|}}}|4|1}} | ||
+ | {{!}}colspan="7" rowspan="2" {{#var:textStyle}} {{!}}{{#sub:{{{1|}}}|5|1}} | ||
+ | {{!}}colspan="7" rowspan="2" {{#var:textStyle}} {{!}}{{#sub:{{{1|}}}|6|1}} | ||
+ | {{!}}colspan="7" rowspan="2" {{#var:textStyle}} {{!}}{{#sub:{{{1|}}}|7|1}} | ||
+ | {{!}}colspan="7" rowspan="2" {{#var:textStyle}} {{!}}{{#sub:{{{1|}}}|8|1}} | ||
+ | {{!}}colspan="7" rowspan="2" {{#var:textStyle}} {{!}}{{#sub:{{{1|}}}|9|1}} | ||
+ | {{!}}colspan="7" rowspan="2" {{#var:textStyle}} {{!}}{{#sub:{{{1|}}}|10|1}} | ||
+ | {{!}}colspan="9" rowspan="2" {{#var:textStyle}} {{!}}{{#var:Q2}} | ||
+ | |13= | ||
+ | {{!}}colspan="9" rowspan="2" {{#var:textStyle}} {{!}}{{#var:Q1}} | ||
+ | {{!}}colspan="7" rowspan="2" {{#var:textStyle}} {{!}}{{#sub:{{{1|}}}|1|1}} | ||
+ | {{!}}colspan="7" rowspan="2" {{#var:textStyle}} {{!}}{{#sub:{{{1|}}}|2|1}} | ||
+ | {{!}}colspan="7" rowspan="2" {{#var:textStyle}} {{!}}{{#sub:{{{1|}}}|3|1}} | ||
+ | {{!}}colspan="7" rowspan="2" {{#var:textStyle}} {{!}}{{#sub:{{{1|}}}|4|1}} | ||
+ | {{!}}colspan="7" rowspan="2" {{#var:textStyle}} {{!}}{{#sub:{{{1|}}}|5|1}} | ||
+ | {{!}}colspan="7" rowspan="2" {{#var:textStyle}} {{!}}{{#sub:{{{1|}}}|6|1}} | ||
+ | {{!}}colspan="7" rowspan="2" {{#var:textStyle}} {{!}}{{#sub:{{{1|}}}|7|1}} | ||
+ | {{!}}colspan="7" rowspan="2" {{#var:textStyle}} {{!}}{{#sub:{{{1|}}}|8|1}} | ||
+ | {{!}}colspan="7" rowspan="2" {{#var:textStyle}} {{!}}{{#sub:{{{1|}}}|9|1}} | ||
+ | {{!}}colspan="7" rowspan="2" {{#var:textStyle}} {{!}}{{#sub:{{{1|}}}|10|1}} | ||
+ | {{!}}colspan="7" rowspan="2" {{#var:textStyle}} {{!}}{{#sub:{{{1|}}}|11|1}} | ||
+ | {{!}}colspan="7" rowspan="2" {{#var:textStyle}} {{!}}{{#sub:{{{1|}}}|12|1}} | ||
+ | {{!}}colspan="9" rowspan="2" {{#var:textStyle}} {{!}}{{#var:Q2}} | ||
+ | }} | ||
|- | |- | ||
− | |colspan=" | + | |colspan="3" style="text-align:center; height:{{#expr:{{#var:linewidth}}*4.5}}px; width:0px; padding:0px;"| |
− | + | |colspan="5" style="text-align:center; height:{{#expr:{{#var:linewidth}}*4.5}}px; width:0px; padding:0px;"| | |
− | |colspan=" | + | |colspan="3" style="text-align:center; height:{{#expr:{{#var:linewidth}}*4.5}}px; width:0px; padding:0px;"| |
− | + | |}{{clearvar|white|black|height|linewidth|textStyle}}</includeonly><noinclude> | |
− | |colspan=" | + | |
− | + | Template for generating barcodes. It does UPC-A, it does EAN-13, it was simultaneously less faffy and more faffy than I expected. | |
− | | | + | |
− | | | + | ==Usage== |
− | | | + | <pre>{{Barcode|4974365541149}}</pre> |
− | + | ||
− | + | {{Barcode|4974365541149}} | |
− | + | ||
− | |} | + | Use <tt>size</tt> and <tt>height</tt> arguments to change dimensions and ting. |
− | </ | + | |
+ | ==Examples== | ||
[[File:EC MD JP Box.jpg|800px]] | [[File:EC MD JP Box.jpg|800px]] | ||
Line 85: | Line 215: | ||
{{Barcode|010086011456}} | {{Barcode|010086011456}} | ||
+ | |||
+ | {{Barcode|010086011456|size=1}} | ||
+ | {{Barcode|010086011456|size=1.5}} | ||
+ | {{Barcode|010086011456|size=2}} | ||
+ | {{Barcode|010086011456|size=3}} | ||
+ | |||
+ | |||
+ | {{Barcode|010086011456|height=50}} | ||
[[Category:Templates]]</noinclude> | [[Category:Templates]]</noinclude> |
Latest revision as of 12:50, 27 June 2023
Template for generating barcodes. It does UPC-A, it does EAN-13, it was simultaneously less faffy and more faffy than I expected.
Usage
{{Barcode|4974365541149}}
|
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
4 | 9 | 7 | 4 | 3 | 6 | 5 | 5 | 4 | 1 | 1 | 4 | 9 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Use size and height arguments to change dimensions and ting.
Examples
|
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
4 | 9 | 7 | 4 | 3 | 6 | 5 | 5 | 4 | 1 | 1 | 4 | 9 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
0 | 1 | 0 | 0 | 8 | 6 | 0 | 1 | 1 | 4 | 5 | 6 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
0 | 1 | 0 | 0 | 8 | 6 | 0 | 1 | 1 | 4 | 5 | 6 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
0 | 1 | 0 | 0 | 8 | 6 | 0 | 1 | 1 | 4 | 5 | 6 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
0 | 1 | 0 | 0 | 8 | 6 | 0 | 1 | 1 | 4 | 5 | 6 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
0 | 1 | 0 | 0 | 8 | 6 | 0 | 1 | 1 | 4 | 5 | 6 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
0 | 1 | 0 | 0 | 8 | 6 | 0 | 1 | 1 | 4 | 5 | 6 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||