Test: Difference between revisions

1,778 bytes added ,  4 August 2006
m
no edit summary
mNo edit summary
mNo edit summary
Line 1: Line 1:
==Sick markup==
==Sick markup==
"And now for a lesson in ttttttttttttemplate mmmmmmmmmanagement... [wikiwikiwiki] llllllllllllet's begin..."
"And now for a lesson in [ttttttttttttemplate] mmmmmmmmmanagement... [wikiwikiwiki] llllllllllllet's begin..."
:Linkin Park, Cure for the Itch
:Linkin Park, Cure for the Itch
;Foreach
;Foreach
Line 24: Line 24:
|-
|-
|
|
{{CANIDmult|29|120|22|Port|yellow}}
{{ProtoBits|29|120|22|Port|yellow}}
|
|
{{CANIDsing|21|<nowiki>=</nowiki>0|fuchsia}}
{{ProtoBits|21|0|0|<nowiki>=</nowiki>0|fuchsia}}
|
|
{{CANIDmult|20|160|11|Ziel-Adresse|lime}}
{{ProtoBits|20|160|11|Ziel-Adresse|lime}}
|
|
{{CANIDmult|10|160|1|Absender-Adresse|aqua}}
{{ProtoBits|10|160|1|Absender-Adresse|aqua}}
|}
|}
 
:Note how 1-bit, 2-bit and 3-plus-bit chunks are all handled by the same (small) template ^^
 
:TightTable takes "optional" arguments called '''align''' and '''color'''. They're not really specified as optional, but when not provided, the relevant syntax gets screwed up "the smart way".
;Or this? (will only show fine if #expr parsing works OK...)
:The "skipped bits" span of every chunk is specified in pixels, which can be handy in case one wants a tighter layout. The non-breaking space can be replaced with a "..." to avoid confusion.
:I think the skipped widths are best let custom, as well as the "header". Apart from arbitrarily shrinking the skip fields, one may want to rephrase the header, or omit it, or make it a caption :
{|{{TightTable}}
{|{{TightTable}}
|colspan=4|29 Bit CAN-ID
|+'''29-Bit CAN-ID
|-
|
|
{{CANIDmult2|29|22|Port|yellow}}
{{ProtoBits|29|40|22|Port|yellow}}
|
|
{{CANIDsing|21|<nowiki>=</nowiki>0|fuchsia}}
{{ProtoBits|21|0|0|<nowiki>=</nowiki>0|fuchsia}}
|
|
{{CANIDmult2|20|11|Ziel-Adresse|lime}}
{{ProtoBits|20|40|11|Ziel-Adresse|lime}}
|
|
{{CANIDmult2|10|1|Absender-Adresse|aqua}}
{{ProtoBits|10|40|1|Absender-Adresse|aqua}}
|}
|}
:(again, maybe a "..." in the skip fields would look nicer)
;Arithmetics (will only show fine if ''#expr'' parsing works OK...)
:One can calculate the width of the "skipped bits" internally, only feeding two bit IDs to the template.
:The template would then evaluate the difference, and decide upon a 1-bit, or on a 2-plus-bit layout with an adequate skip.
:However, the markup is a bit heavier, and makes a few assumptions about e.g. the order in which the bits are listed (unless one wants to fool around with '''abs''').
:Right now, it produces a fatal error (then again, so does <nowiki>{{#expr:2+2}}</nowiki>, so there ''is'' a problem), but it would look something like this :
<nowiki>{|{{</nowiki>TightTable|color={{{4}}}}}
|-align=center
|width=18|{{{1}}}
|-
<nowiki>|width={{#ifexpr:{{{1}}}>{{{2}}}|{{#expr:18*({{{1}}}-{{{2}}}-1)}}|0}}|{{#ifexpr:{{{1}}}>{{{2}}}+1|...|}}</nowiki>
<nowiki>|width={{#ifexpr:{{{1}}}>{{{2}}}|18|0}}|{{#ifexpr:{{{1}}}>{{{2}}}|{{{2}}}|}}</nowiki>
|colspan=3|{{{3}}}
|}




;Other, even lighter solutions possible.
;CAN-ID table
:It ''could'' be possible to embed the chunk tables into a big template table specific to the "29-Bit CAN-ID" usage, but most components would have to be in HTML. Bad idea.