Difference between revisions of "Barcode"

From Sega Retro

 
(8 intermediate revisions by the same user not shown)
Line 1: Line 1:
<includeonly>
+
<includeonly><div style="display:none;">
{{{1|}}}
+
{{#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|}}}}}
 
{{#switch:{{#len:{{{1|}}}}}
 
|12=
 
|12=
Line 21: Line 25:
 
{{#vardefine:Q2|{{#sub:{{{1|}}}|11|1}}}}
 
{{#vardefine:Q2|{{#sub:{{{1|}}}|11|1}}}}
  
 +
{{#vardefine:LRColumns|35}}
 
|13=
 
|13=
{{#vardefine:Q1|{{#sub:{{{1|}}}|0|1}}
+
{{#vardefine:Q1|{{#sub:{{{1|}}}|0|1}}}}
 +
 
 +
{{#vardefine:L|{{#switch:{{#var:Q1}}
  
{{#vardefine:L|{{Barcode/Digit|{{#sub:{{{1|}}}|1|1}}|left}}
+
|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|}}}|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|}}}|3|1}}|left}}
 
{{Barcode/Digit|{{#sub:{{{1|}}}|4|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|}}}|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}}
 
{{Barcode/Digit|{{#sub:{{{1|}}}|6|1}}|left}}
 +
 +
}}
 
}}
 
}}
  
Line 39: Line 111:
 
{{Barcode/Digit|{{#sub:{{{1|}}}|12|1}}|right}}}}
 
{{Barcode/Digit|{{#sub:{{{1|}}}|12|1}}|right}}}}
 
}}
 
}}
 +
{{#vardefine:LRColumns|42}}
 
}}
 
}}
 
<div style="display:none;">
 
{{#vardefine:linewidth|4}}
 
{{#vardefine:height|100}}
 
{{#vardefine:white|style="width:0px; height:{{#var:height}}px; padding:0px; border-left: {{#var:linewidth}}px solid #FFFFFF;"}}
 
{{#vardefine:black|style="width:0px; height:{{#var:height}}px; padding:0px; border-left: {{#var:linewidth}}px solid #000000;"}}
 
{{#vardefine:yellow|style="width:0px; height:{{#var:height}}px; padding:0px; border-left: {{#var:linewidth}}px solid #FF0000;"}}
 
{{#vardefine:green|style="width:0px; height:{{#var:height}}px; padding:0px; border-left: {{#var:linewidth}}px solid #0000FF;"}}
 
 
 
 
 
</div>
 
</div>
{|style="width:auto;"
+
{|style="width:auto; font-family: monospace;"
|colspan="9" style="padding:0px; background-color:#AAAAAA;"|Q
+
|-style="background-color:#FFFFFF;"
|colspan="3" style="padding:0px;"|S
 
|colspan="35" style="padding:0px; background-color:#AAAAAA; "|L
 
|colspan="5" style="padding:0px;"|M
 
|colspan="35" style="padding:0px; background-color:#AAAAAA;"|R
 
|colspan="3" style="padding:0px;"|E
 
|colspan="9" style="padding:0px; background-color:#AAAAAA;"|Q
 
|-
 
 
|{{#var:white}}|
 
|{{#var:white}}|
 
|{{#var:white}}|
 
|{{#var:white}}|
Line 74: Line 129:
 
|rowspan="2" {{#var:white}}|
 
|rowspan="2" {{#var:white}}|
 
|rowspan="2" {{#var:black}}|
 
|rowspan="2" {{#var:black}}|
 +
 +
{{#ifeq:{{#len:{{{1|}}}}}|12|
 +
{{Barcode/Digit|0|left|rowspan=2}}
 +
}}
  
 
{{#var:L}}
 
{{#var:L}}
  
|rowspan="2" {{#var:white}}|
+
{{!}}rowspan="2" {{#var:white}}{{!}}
|rowspan="2" {{#var:black}}|
+
{{!}}rowspan="2" {{#var:black}}{{!}}
|rowspan="2" {{#var:white}}|
+
{{!}}rowspan="2" {{#var:white}}{{!}}
|rowspan="2" {{#var:black}}|
+
{{!}}rowspan="2" {{#var:black}}{{!}}
|rowspan="2" {{#var:white}}|
+
{{!}}rowspan="2" {{#var:white}}{{!}}
  
 
{{#var:R}}
 
{{#var:R}}
 +
 +
{{#ifeq:{{#len:{{{1|}}}}}|12|
 +
{{Barcode/Digit|{{#sub:{{{1|}}}|11|1}}|right|rowspan=2}}
 +
}}
  
 
|rowspan="2" {{#var:black}}|
 
|rowspan="2" {{#var:black}}|
Line 98: 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="9" style="text-align:center; padding:0px;"|{{#var:Q1}}
+
|colspan="3" style="text-align:center; height:{{#expr:{{#var:linewidth}}*4.5}}px; width:0px; padding:0px;"|
|colspan="7" style="text-align:center; padding:0px;"|0
+
|colspan="5" style="text-align:center; height:{{#expr:{{#var:linewidth}}*4.5}}px; width:0px; padding:0px;"|
|colspan="7" style="text-align:center; padding:0px;"|1
+
|colspan="3" style="text-align:center; height:{{#expr:{{#var:linewidth}}*4.5}}px; width:0px; padding:0px;"|
|colspan="7" style="text-align:center; padding:0px;"|2
+
|}{{clearvar|white|black|height|linewidth|textStyle}}</includeonly><noinclude>
|colspan="7" style="text-align:center; padding:0px;"|3
+
 
|colspan="7" style="text-align:center; padding:0px;"|4
+
Template for generating barcodes. It does UPC-A, it does EAN-13, it was simultaneously less faffy and more faffy than I expected.
|colspan="7" style="text-align:center; padding:0px;"|5
+
 
|colspan="7" style="text-align:center; padding:0px;"|6
+
==Usage==
|colspan="7" style="text-align:center; padding:0px;"|7
+
<pre>{{Barcode|4974365541149}}</pre>
|colspan="7" style="text-align:center; padding:0px;"|8
+
 
|colspan="7" style="text-align:center; padding:0px;"|9
+
{{Barcode|4974365541149}}
|colspan="9" style="text-align:center; padding:0px;"|{{#var:Q2}}
+
 
|}
+
Use <tt>size</tt> and <tt>height</tt> arguments to change dimensions and ting.
</includeonly><noinclude>
+
 
 +
==Examples==
 
[[File:EC MD JP Box.jpg|800px]]
 
[[File:EC MD JP Box.jpg|800px]]
  
Line 120: 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

EC MD JP Box.jpg




}}



4 9 7 4 3 6 5 5 4 1 1 4 9

EC MD US Box.jpg




}}

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