Template:Computer specs full

From 68kMLA Wiki
Revision as of 05:12, 21 August 2007 by ~tl (talk | contribs)
Jump to: navigation, search
Although this template looks blank it isn't!

Usage

Editing

To stop rogue new lines appearing when the template is used, but all the variables aren't filled in, it's important not to have any line breaks in the template itself. To make it easier to edit, I've included a copy with the linebreaks I had originally below. I'd suggest that you make any changes to the copy below, strip out all the new lines in a text editor, and then paste it above.

Each variable uses ParserFunctions so that it only appears if it's filled out on the template. On lines that only have a single variable a simple #if is fine. For example:

{{ #if: {{{fpu|}}} | **FPU: ''{{{fpu|}}}'' }}

On lines that contain more than one variable, the more complicated #ifexpr needs to be used since we either want to show the line if any one of the variables is there (using the "or" operator) or if they're all there (using the "and" operator). Since the #ifexpr only checks mathematical statements, it's also necessary to use an #if statement to check if a variable is set and return 1 or 0 depending on it's status. The complete code for a line with two variables ends up something like this:

{{ #ifexpr: {{ #if: {{{cpu-speed|}}} | 1 | 0 }} or {{ #if: {{{cpu-type|}}} | 1 | 0 }} | **CPU: ''{{{cpu-speed|}}} {{{cpu-type|}}}'' }}

That is also how we check to see if a header should be shown. If you add more variables in, it's important to also add them to the #ifexpr for the header, so that the header gets included if the variable is set.

Anyway here's the complete code! If this all looks a bit daunting to you, feel free to suggest changes on the talk page and I'll make the changes for you!

{{ #ifexpr: {{ #if: {{{cpu-speed|}}} | 1 | 0 }}
 or {{ #if: {{{cpu-type|}}} | 1 | 0 }}
 or {{ #if: {{{fpu|}}} | 1 | 0 }}
 or {{ #if: {{{rom|}}} | 1 | 0 }}
 or {{ #if: {{{bus|}}} | 1 | 0 }}
 or {{ #if: {{{data-path|}}} | 1 | 0 }}
 or {{ #if: {{{ram-speed|}}} | 1 | 0 }}
 or {{ #if: {{{ram-type|}}} | 1 | 0 }}
 or {{ #if: {{{ram-std|}}} | 1 | 0 }}
 or {{ #if: {{{ram-onboard|}}} | 1 | 0 }}
 or {{ #if: {{{ram-slots|}}} | 1 | 0 }}
 or {{ #if: {{{ram-max-apple|}}} | 1 | 0 }}
 or {{ #if: {{{ram-max-actual|}}} | 1 | 0 }}
 or {{ #if: {{{cache|}}} | 1 | 0 }}
| *'''General''' }}

{{ #ifexpr: {{ #if: {{{cpu-speed|}}} | 1 | 0 }} or {{ #if: {{{cpu-type|}}} | 1 | 0 }} | **CPU: ''{{{cpu-speed|}}} {{{cpu-type|}}}'' }}
{{ #if: {{{fpu|}}} | **FPU: ''{{{fpu|}}}'' }}
{{ #if: {{{rom|}}} | **ROM: ''{{{rom|}}}'' }}
{{ #if: {{{bus|}}} | **Bus Speed: ''{{{bus|}}}'' }}
{{ #if: {{{data-path|}}} | **Data Path: ''{{{data-path|}}}'' }}
{{ #ifexpr: {{ #if: {{{ram-speed|}}} | 1 | 0 }} or {{ #if: {{{ram-type|}}} | 1 | 0 }} | **RAM Type: ''{{{ram-type|}}} {{ #if: {{{ram-speed|}}} | ({{{ram-speed|}}}) }}'' }}
{{ #if: {{{ram-std|}}} | **Standard RAM: ''{{{ram-std|}}}'' }}
{{ #if: {{{ram-onboard|}}} | **RAM Onboard: ''{{{ram-onboard|}}}'' }}
{{ #if: {{{ram-slots|}}} | **RAM Slots: ''{{{ram-slots|}}}'' }}
{{ #if: {{{ram-max-apple|}}} | **Maximum RAM {{ #if: {{{ram-max-actual|}}} | (Apple) }}: ''{{{ram-max-apple|}}}'' }}
{{ #if: {{{ram-max-actual|}}} | **Maximum RAM {{ #if: {{{ram-max-apple|}}} | (Actual) }}: ''{{{ram-max-actual|}}}'' }}
{{ #if: {{{cache|}}} | **Cache: ''{{{cache|}}}'' }}


{{ #ifexpr: {{ #if: {{{adb|}}} | 1 | 0 }}
 or {{ #if: {{{serial|}}} | 1 | 0 }}
 or {{ #if: {{{scsi|}}} | 1 | 0 }}
 or {{ #if: {{{floppy-connector|}}} | 1 | 0 }}
 or {{ #if: {{{ethernet|}}} | 1 | 0 }}
 or {{ #if: {{{modem|}}} | 1 | 0 }}
 or {{ #if: {{{audio-in|}}} | 1 | 0 }}
 or {{ #if: {{{audio-out|}}} | 1 | 0 }}
 or {{ #if: {{{speaker|}}} | 1 | 0 }}
 or {{ #if: {{{mic|}}} | 1 | 0 }}
 or {{ #if: {{{pds|}}} | 1 | 0 }}
 or {{ #if: {{{pds-type|}}} | 1 | 0 }}
 or {{ #if: {{{nubus|}}} | 1 | 0 }}
| *'''I/O & Expansion''' }}

{{ #if: {{{adb|}}} | **ADB: ''{{{adb|}}}'' }}
{{ #if: {{{serial|}}} | **Serial: ''{{{serial|}}}'' }}
{{ #if: {{{scsi|}}} | **SCSI: ''{{{scsi|}}}'' }}
{{ #if: {{{floppy-connector|}}} | **Floppy Connector: ''{{{floppy-connector|}}}'' }}
{{ #if: {{{ethernet|}}} | **Ethernet: ''{{{ethernet|}}}'' }}
{{ #if: {{{modem|}}} | **Modem: ''{{{modem|}}}'' }}
{{ #if: {{{audio-in|}}} | **Audio In: ''{{{audio-in|}}}'' }}
{{ #if: {{{audio-out|}}} | **Audio Out: ''{{{audio-out|}}}'' }}
{{ #if: {{{speaker|}}} | **Built-in Speaker: ''{{{speaker|}}}'' }}
{{ #if: {{{mic|}}} | **Built-in Microphone: ''{{{mic|}}}'' }}
{{ #ifexpr: {{ #if: {{{pds|}}} | 1 | 0 }} or {{ #if: {{{pds-type|}}} | 1 | 0 }} | **PDS: ''{{{pds|}}} {{{pds-type|}}}'' }}
{{ #if: {{{nubus|}}} | **Nubus: ''{{{nubus|}}}'' }}


{{ #ifexpr: {{ #if: {{{hd-std|}}} | 1 | 0 }}
 or {{ #if: {{{hd-type|}}} | 1 | 0 }}
 or {{ #if: {{{floppy|}}} | 1 | 0 }}
 or {{ #if: {{{cd-std|}}} | 1 | 0 }}
 or {{ #if: {{{cd-type|}}} | 1 | 0 }}
| *'''Storage''' }}

{{ #if: {{{hd-std|}}} | **Hard Drive: ''{{{hd-std|}}}'' }}
{{ #if: {{{hd-type|}}} | **Hard Drive Type: ''{{{hd-type|}}}'' }}
{{ #if: {{{floppy|}}} | **Floppy Drive: ''{{{floppy|}}}'' }}
{{ #if: {{{cd-std|}}} | **Optical Drive: ''{{{cd-std|}}}'' }}
{{ #if: {{{cd-type|}}} | **Optical Drive Type: ''{{{cd-type|}}}'' }}


{{ #ifexpr: {{ #if: {{{display|}}} | 1 | 0 }}
 or {{ #if: {{{resolution|}}} | 1 | 0 }}
 or {{ #if: {{{vram-std|}}} | 1 | 0 }}
 or {{ #if: {{{vram-onboard|}}} | 1 | 0 }}
 or {{ #if: {{{vram-slots|}}} | 1 | 0 }}
 or {{ #if: {{{vram-max|}}} | 1 | 0 }}
 or {{ #if: {{{video-in|}}} | 1 | 0 }}
 or {{ #if: {{{video-out|}}} | 1 | 0 }}
| *'''Video''' }}

{{ #if: {{{display|}}} | **Built-in Display: ''{{{display|}}}'' }}
{{ #if: {{{resolution|}}} | **Max Resolution: ''{{{resolution|}}}'' }}
{{ #if: {{{vram-std|}}} | **Standard VRAM: ''{{{vram-std|}}}'' }}
{{ #if: {{{vram-onboard|}}} | **VRAM Onboard: ''{{{vram-onboard|}}}'' }}
{{ #if: {{{vram-slots|}}} | **VRAM Slots: ''{{{vram-slots|}}}'' }}
{{ #if: {{{vram-max|}}} | **Maximum VRAM: ''{{{vram-max|}}}'' }}
{{ #if: {{{video-in|}}} | **Video In: ''{{{video-in|}}}'' }}
{{ #if: {{{video-out|}}} | **Video Out: ''{{{video-out|}}}'' }}


{{ #ifexpr: {{ #if: {{{model-no|}}} | 1 | 0 }}
 or {{ #if: {{{codename|}}} | 1 | 0 }}
 or {{ #if: {{{gestalt|}}} | 1 | 0 }}
 or {{ #if: {{{power|}}} | 1 | 0 }}
 or {{ #if: {{{pram|}}} | 1 | 0 }}
 or {{ #if: {{{width|}}} | 1 | 0 }}
 or {{ #if: {{{weight|}}} | 1 | 0 }}
 or {{ #if: {{{os|}}} | 1 | 0 }}
 or {{ #if: {{{enabler|}}} | 1 | 0 }}
 or {{ #if: {{{born|}}} | 1 | 0 }}
 or {{ #if: {{{died|}}} | 1 | 0 }}
 or {{ #if: {{{startup-chime|}}} | 1 | 0 }}
 or {{ #if: {{{death-chime|}}} | 1 | 0 }}
| *'''Miscellaneous''' }}

{{ #if: {{{model-no|}}} | **Apple Model Number: ''{{{model-no|}}}'' }}
{{ #if: {{{codename|}}} | **Codename: ''{{{codename|}}}'' }}
{{ #if: {{{gestalt|}}} | **Gestalt ID: ''{{{gestalt|}}}'' }}
{{ #if: {{{power|}}} | **Power: ''{{{power|}}}'' }}
{{ #if: {{{pram|}}} | **PRAM Battery: ''{{{pram|}}}'' }}
{{ #ifexpr: {{ #if: {{{width|}}} | 1 | 0 }} and {{ #if: {{{height|}}} | 1 | 0 }} and {{ #if: {{{depth|}}} | 1 | 0 }} | **Dimensions: ''{{{width|}}}x{{{height|}}}x{{{depth|}}}'' }}
{{ #if: {{{weight|}}} | **Weight: ''{{{weight|}}}'' }}
{{ #if: {{{os|}}} | **OS Support: ''{{{os|}}}'' }}
{{ #if: {{{enabler|}}} | **System Enabler: ''{{{enabler|}}}'' }}
{{ #if: {{{born|}}} | **Introduced: ''{{{born|}}}'' }}
{{ #if: {{{died|}}} | **Discontinued: ''{{{died|}}}'' }}
{{ #if: {{{startup-chime|}}} | **{{mp3|{{{startup-chime|}}}|Startup Chime}} }}
{{ #if: {{{death-chime|}}} | **{{mp3|{{{death-chime|}}}|Death Chime}} }}