[Question]
  [
This is supposed to be a code golf challenge on the simpler end of the spectrum. But I figured it could be nice to bring out some micro-optimisation here.
There are [three basic types of DVI connectors](http://en.wikipedia.org/wiki/Digital_Visual_Interface): DVI-A (analog), DVI-D (digital) and DVI-I (integrated). Furthermore, there are single-link and dual-link versions of the DVI-D and DVI-I connectors. Each of those five different connectors uses a different set of pins.
Given one of `A`, `D1`, `D2`, `I1`, `I2` as an identifier for the type of connector, print the corresponding ASCII representation of the connector's pins:
```
A:
#   #  # # #       # #
=====  # # #          
#   #  # #         # #
D1:
       # # #     # # #
=====  # # #     # # #
       # # #     # # #
D2:
       # # # # # # # #
=====  # # # # # # # #
       # # # # # # # #
I1:
#   #  # # #     # # #
=====  # # #     # # #
#   #  # # #     # # #
I2:
#   #  # # # # # # # #
=====  # # # # # # # #
#   #  # # # # # # # #
```
(The `X:` lines are not part of the output, you should only print 3 lines.)
You may write a program or function, taking input via STDIN, ARGV or function argument. The output must be printed to STDOUT, with an optional trailing line feed.
You may or may not include trailing spaces in the second line of the `A` connector. You must not use additional leading *or* trailing spaces anywhere else.
This is code golf, so the shortest answer (in bytes) wins.
  
[Answer]
# Perl - ~~100~~ 91 (including 1 flag)
Uses nutki's ideas of using `-p` and reducing double-spaces. Also simplified elimination of trailing spaces.
```
#!perl -p
$x=$_|" qb";$_="dbd xxxqqqax#
=====bxxxqqqaaa!dbd xxaqqqax#";s/[$x]/  /g;s/\w/# /g;s/ !/
/
```
Input comes from stdin and must contain only the connector type with no trailing newline.
---
Previous:
```
$x=shift|" q";$_="d  d xxxqqqaxx
=====  xxxqqqaaa
d  d xxaqqqaxx";s/[$x]/  /g;s/\w/# /g;s/ $//mg;say
```
Takes a command-line argument. Ungolfed:
```
# Read argument, transform A->aq, I1->iq, I2->is, D1->dq, D2->ds
$x=shift|" q";
# String compacted
$_ = "d  d xxxqqqaxx
=====  xxxqqqaaa
d  d xxaqqqaxx";
# Clear any pins with matching char in input
s/[$x]/  /g;
# Convert rest to '#'
s/\w/# /g;
# Eliminate trailing spaces
s/ $//mg;
say
```
[Answer]
# Python, 168 characters
```
t=raw_input()*2
Q="G   G  # # # 2 2 H # #\n=====  # # # 2 2 H H H\nG   G  # # H 2 2 H # #"
for A,B,N in('G0A','H0D','212'):Q=Q.replace(A,' #'[t[int(B)]in'I'+N])
print Q
```
Appears to be a new approach. I have the string:
```
G   G  # # # 2 2 H # #
=====  # # # 2 2 H H H
G   G  # # H 2 2 H # #
```
I replace the `G`, `H`, and `2` based on the input.
[Answer]
## J, ~~153 121~~ 119 chars
**Minified**
```
('='(;/1,.i.5)}"_1' #'{~5 3 22$#:128#.32x-~3 u:'dt*`J%Q5"xjuH%Jv2uJ!H5 t*`J%@5Jp*uH%Jv2p*!H dp"')echo@{~I1`I2`D1`D2 i.<
```
A third approach: pack all 's and `#`'s into a huge integer as bits. Add the `=`'s afterwards. Still doesn't make use of the symmetry of many of the connector variants, though.
**Unminified**
```
n =. 128 #. 32x -~ 3 u: 'dt*`J%Q5"xjuH%Jv2uJ!H5 t*`J%@5Jp*uH%Jv2p*!H dp"'
f =. ('=' (;/1,.i.5)}"_1 ' #' {~ 5 3 22 $ #: n) echo@{~ I1`I2`D1`D2 i. <
```
---
**Minified** (153)
```
[:echo@>({&(' #=',LF)&.:>;._2#;._1#:96#.32x-~3 u:' (0%dziqrDwbh5Ds6[gEl)_xkBS6?61m$1ne/v(]!&yW?_{K.S^X#Yn_d%O71KqXEw=I;meH>@eG2|2/gcR0'){~D1`D2`I1`I2 i.<
```
Also as a function. This one uses a variable-length binary coding, by tallying ones in binary and separating by zeroes. 0 ones in a row means , 1 one means `#`, 2 ones means `=`, 3 ones means newline and 4 ones separate the five strings from each other.
**Ungolfed**
```
s =. ' (0%dziqrDwbh5Ds6[gEl)_xkBS6?61m$1ne/v(]!&yW?_{K.S^X#Yn_d%O71KqXEw=I;meH>@eG2|2/gcR0'
f =. [: echo@> ({&(' #=',LF)&.:>;._2 #;._1 #: 96 #. 32x -~ 3 u:s) {~ D1`D2`I1`I2 i. <
```
[Answer]
# Marbelous, 281 bytes/characters
### Minified:
```
00
]]
GG]]
IIJJJJ
:G
}0
++
>>
>X{0
/\{<{>
:H
}0
-Z
>E-2
-C//
{0
:I
23232003002023}023
LLMMMMNNRROOMMRRLL
0003
0300
NNNN
:J
}0}1
HH-2
KKKK
:K
}1}0
}1}0}0
PPPPQQ
:L
}020
}0202020
:M
20}020}020}0
:N
}0
}020
+W20
:O
3D3D3D3D3D}0
:P
}023}1230A
LLMMNNMM
:Q
2023}0230A
OOMMNNMM
:R
}0
\/0A
```
This takes `D1`, `D2`, `I1`, `I2` or `A` from STDIN. Trailing newlines in input is optional. Output is to STDOUT. 
This program calls subboards which print parts of connectors, either filling in `#`s or leaving spaces depending on inputs.
[Try this answer here](https://codegolf.stackexchange.com/a/40808/29611); cylindrical boards are needed.
### with Comments:
```
00 .. ..
]] .. .. # get A/D/I
Gt ]] .. # pass into Gt; call PA if A or PrDI if D/I
PA Pr DI
# If 'A' is passed, a marble is emitted down
# Otherwise, marbles are sent left/right
# The value of the marble outputted is (I+1)/2, which creates a difference of 3
#   between D and I, the difference between a space and a #
:Gt
}0 .. ..
++ .. ..
>> .. ..
>X {0 ..
/\ {< {>
# Returns 0 if '1' is passed, and 3 if '2' is passed
:Ff
}0 ..
-Z ..
>E -2
-C //
{0 ..
# Prints connector A 
# Calls made: P1(23) P2(23) P2(20) P3(03) LF(00) P4(20) P2(23) LF(}0) P1(23)
#   P3(03) P3(00) P3(00) P3(03)
:PA
23 23 20 03 00 20 23 }0 23
P1 P2 P2 P3 LF P4 P2 LF P1
00 03 .. .. .. .. .. .. ..
03 00 .. .. .. .. .. .. ..
P3 P3 .. .. .. .. .. .. ..
# Prints connectors D0/D1/I0/I1
# }0 is either '1' or '2'
# }1 is either 32 or 35 (for D or I)
:PrDI
}0 }1
Ff -2
Li DI
# Helper for PrDI
# Calls made: L1(}1, }0) L2(}0) L1(}1, }0)
:LiDI
}1 }0 ..
}1 }0 }0
L1 L1 L2
# Prints '#   # ' (}0 = 0x23) or '      ' (}0 = 0x20)
:P1
}0 20 .. ..
}0 20 20 20
# Prints ' # # #' (}0 = 0x23) or '      ' (}0 = 0x20)
:P2
20 }0 20 }0 20 }0
# Prints ' # #' (}0 = 0x03) or '    ' (}0 = 0x00)
:P3
}0 ..
}0 20
+W 20
# Prints '===== ', }0 must be 0x20
:P4
3D 3D 3D 3D 3D }0
# Prints the top/bottom line of D/I connectors + newline
# Calls made: P1(}0) P2(23) P3(}1) P2(23) 
:L1
}0 23 }1 23 0A
P1 P2 P3 P2 ..
# Prints the middle line of D/I connectors + newline
# Calls made: P4(20) P2(23) P3(}0) P2(23)
:L2
20 23 }0 23 0A
P4 P2 P3 P2 ..
# Emits a newline (0x0A) regardless of input
:LF
}0 ..
\/ 0A
```
[Answer]
# Perl 5: 105 (including 1 flag)
Yet another Perl solution. Uses stdin for the parameter.
```
#!perl -p
@x=map$_?'#':$",!/D/,-/2/,!/A/,1,0;$_='040 33311233
=====433311222
040 33211233';s/\d/$x[$&] /g;s/ $//mg
```
[Answer]
# GNU sed, 116 bytes
```
s/.*/&:#   #  33322433\n=====  33322444\n#   #  33422433/
/A/s/[42]/  /g
/1/s/2/  /g
/D/s/#/ /g
s/[2-4]/ #/g
s/.*://
```
### Output:
```
$ echo "A
D1
D2
I1
I2"|sed -f dvi.sed
#   #   # # #       # #
=====   # # #          
#   #   # #         # #
        # # #     # # #
=====   # # #     # # #
        # # #     # # #
        # # # # # # # #
=====   # # # # # # # #
        # # # # # # # #
#   #   # # #     # # #
=====   # # #     # # #
#   #   # # #     # # #
#   #   # # # # # # # #
=====   # # # # # # # #
#   #   # # # # # # # #
$ 
```
[Answer]
# CJam, ~~79~~ 70 bytes
Inspired from [nutki's answer](https://codegolf.stackexchange.com/a/41588/31414). This also makes sure that there are no trailing white spaces (except for second line)
```
"VF­wGC}*D"176b6b" DG1A="f=r'1+2<"  "aer{_s" ="&\"# "?}%s23/Wf<N*
```
Use [this link](https://mothereff.in/byte-counter#%22VF%C2%8B%C2%ADwG%C2%95%C2%85C%7D%C2%8F*D%C2%96%22176b6b%22%20DG1A%3D%22f%3Dr%271%2B2%3C%22%20%20%22aer%7B_s%22%20%3D%22%26%5C%22%23%20%22%3F%7D%25s23%2FWf%3CN*) to copy the code as SE strips non-printable characters.
There are 5 characters in non-printable ASCII range but well within a byte (ASCII code 255)
**How it works**:
```
"VF­wGC}*D"176b6b" DG1A="f=              "This effectively results into this string:"
                                        "D  D GGG11AGG=====  GGG11AAAD  D GGA11AGG";
r'1+2<                                  "Read the input, convert A to A1";
      "  "er                            "Replace the occurrences of above two characters"
                                        "with double space '  '";
            {_s" ="&\"# "?}%s           "Convert every non = and space character to '# '";
                             23/        "Divide the string into parts of 23 characters";
                                Wf<     "String last character from above parts";
                                   N*   "Join with new line";
```
[Try it online here](http://cjam.aditsu.net/)
[Answer]
## J, ~~198 194~~ 157 chars
**Minified**
```
3 22 echo@$'x   x  # # # x x x # #=====  # # # x x x x xx   x  # # x x x x # #'('x'I.@:=])}~(5 16$(#' #'$~#)"."0'4123212128262126290901824'){~D1`D2`I1`I2 i.<
```
Implemented as a function. Note that the function is a train, meaning one would have to surround it by parentheses or assign it to a name in order to use it (maybe I should count the parens as part of the function, even though technically they aren't). 
**Ungolfed**
```
S1 =. (#' #'$~#)"."0'4123212128262126290901824'
S2 =. 'x   x  # # # x x x # #=====  # # # x x x x xx   x  # # x x x x # #'
f  =. 3 22 echo@$ S2 ('x'I.@:=])}~ (5 16$S1) {~ D1`D2`I1`I2 i. <
```
The idea is to store the common part of the string separately from the characters that differ between the connector types. `S1` stores the unique characters, and `S2` acts as a pattern with `x`'s acting as placeholders to fill in.
[Answer]
# Python - ~~167 166 164 161~~ 159
```
C=raw_input()
a=["#   # "," "*6]["D"in C]
r=" #"
b="A"in C
i=3-b
d=(r*[i,5][C[1:]>"1"]).rjust(10)
t=r*3
print a+t+d+"\n===== "+t+d*~-len(C)+"\n"+a+r*i+"  "*b+d
```
[Answer]
# JavaScript (ES6) 178 ~~186~~
**Edit** Having 7 base blocks, use base 7  
The straight way, using string building with replace and 7 building blocks.  
Output to stdout using alert as requested by OP.  
Now I'll try some micro-optimizations...
```
F=t=>alert(
  {A:21349062249,D1:538695058296,D2:534740169498,I1:151139015296,I2:147184126498}[t]
  .toString(7).replace(/./g,c=>'\n0#   # 0===== 0 # # #0 # #0      0    '.split(0)[c])
)
```
**Test** In FireFox/FireBug console - removing 'alert' to simplify test
```
;['A','D1','D2','I1','I2'].forEach(i=>console.log(F(i)))
```
*Output*
```
#   #  # # #       # #
=====  # # #
#   #  # #         # #
       # # #     # # #
=====  # # #     # # #
       # # #     # # #
       # # # # # # # #
=====  # # # # # # # #
       # # # # # # # #
#   #  # # #     # # #
=====  # # #     # # #
#   #  # # #     # # #
#   #  # # # # # # # #
=====  # # # # # # # #
#   #  # # # # # # # #
```
[Answer]
## APL (115)
```
V←3 22⍴''⋄V[2;⍳5]←'='⋄V[⍳3;(2=⍴I)/(6+2×⍳8)~14 16/⍨'1'∊I]←V[⍳2;12]←V[⍳3;8 10]←V[R/1 3;1 5 20 22/⍨R←∨/'AI'∊I←⍞]←'#'⋄V
```
Test:
```
      V←3 22⍴''⋄V[2;⍳5]←'='⋄V[⍳3;(2=⍴I)/(6+2×⍳8)~14 16/⍨'1'∊I]←V[⍳2;12]←V[⍳3;8 10]←V[R/1 3;1 5 20 22/⍨R←∨/'AI'∊I←⍞]←'#'⋄V
A
#   #  # # #       # #
=====  # # #          
#   #  # #         # #
      V←3 22⍴''⋄V[2;⍳5]←'='⋄V[⍳3;(2=⍴I)/(6+2×⍳8)~14 16/⍨'1'∊I]←V[⍳2;12]←V[⍳3;8 10]←V[R/1 3;1 5 20 22/⍨R←∨/'AI'∊I←⍞]←'#'⋄V
D1
       # # #     # # #
=====  # # #     # # #
       # # #     # # #
      V←3 22⍴''⋄V[2;⍳5]←'='⋄V[⍳3;(2=⍴I)/(6+2×⍳8)~14 16/⍨'1'∊I]←V[⍳2;12]←V[⍳3;8 10]←V[R/1 3;1 5 20 22/⍨R←∨/'AI'∊I←⍞]←'#'⋄V
D2
       # # # # # # # #
=====  # # # # # # # #
       # # # # # # # #
      V←3 22⍴''⋄V[2;⍳5]←'='⋄V[⍳3;(2=⍴I)/(6+2×⍳8)~14 16/⍨'1'∊I]←V[⍳2;12]←V[⍳3;8 10]←V[R/1 3;1 5 20 22/⍨R←∨/'AI'∊I←⍞]←'#'⋄V
I1
#   #  # # #     # # #
=====  # # #     # # #
#   #  # # #     # # #
      V←3 22⍴''⋄V[2;⍳5]←'='⋄V[⍳3;(2=⍴I)/(6+2×⍳8)~14 16/⍨'1'∊I]←V[⍳2;12]←V[⍳3;8 10]←V[R/1 3;1 5 20 22/⍨R←∨/'AI'∊I←⍞]←'#'⋄V
I2
#   #  # # # # # # # #
=====  # # # # # # # #
#   #  # # # # # # # #
```
[Answer]
# JavScript ES6, 186 bytes
```
f=c=>(b=(c[0]=='D'?'      ':'#   # '))+(e=(g=r=>parseInt(r,36).toString(2).replace(/./g,n=>' '+[' ','#'][n]))((o=c[1])?(o-1?73:'6f'):'6b'))+'\n===== '+(o?e:' # # #')+'\n'+b+(o?e:g('5f'))
```
```
f=c=>(b=(c[0]=='D'?'      ':'#   # '))+(e=(g=r=>parseInt(r,36).toString(2).replace(/./g,n=>' '+[' ','#'][n]))((o=c[1])?(o-1?73:'6f'):'6b'))+'\n===== '+(o?e:' # # #')+'\n'+b+(o?e:g('5f'))
alert(f(prompt()))
```
The code is quick and dirty, but it gets the job done. Mostly, the `#`'s and spaces are put into binary and then base 36. I'm looking into a more elegant and hopefully shorter solution.
[Answer]
# Perl 5 - 150 (149 + 1 for `n`)
### Golfed:
```
@b=split//;$_='0   0 ###112##
===== ###11222
0   0 ##2112##';
@c=(@b[0]eq D,@b[1]ne 2,@b[0]eq A);@d=('#',$");s/([#12])/ \1/g;s/(\d)/$d[$c[$1]]/ge;say
```
Input from STDIN, output to STDOUT. Works by doing filling in certain characters with `#` or  depending on the input.
### Ungolfed:
```
@b=split//; # char array from input
$_='0   0 ###112##
===== ###11222
0   0 ##2112##';
@c=(@b[0] eq 'D',@b[1] ne '2',@b[0] eq 'A');
@d=('#',' ');
s/([#12])/ \1/g; # add spaces
s/(\d)/$d[$c[$1]]/ge; # replace numbers with appropriate character
say $_;
```
]