Template:HexRow: Difference between revisions

m
*really* enjoy now
m (enjoy)
 
m (*really* enjoy now)
Line 1: Line 1:
<noinclude>{|border=1 cellspacing=0 </noinclude>
<includeonly>|-style="font-family:courier"
|-style="font-family:courier"
!{{{0|0x00}}}
!{{{0|0x00}}}
|BGCOLOR="#{{{17|FF}}}{{{33|FF}}}{{{49|FF}}}"|{{{1|00}}}
|BGCOLOR="#{{{17|FF}}}{{{33|FF}}}{{{49|FF}}}"|{{{1|00}}}
Line 18: Line 17:
|BGCOLOR="#{{{31|FF}}}{{{47|FF}}}{{{63|FF}}}"|{{{15|00}}}
|BGCOLOR="#{{{31|FF}}}{{{47|FF}}}{{{63|FF}}}"|{{{15|00}}}
|BGCOLOR="#{{{32|FF}}}{{{48|FF}}}{{{64|FF}}}"|{{{16|00}}}
|BGCOLOR="#{{{32|FF}}}{{{48|FF}}}{{{64|FF}}}"|{{{16|00}}}
!{{{65|°°°°°°°°°°°°°°°°}}}
!{{{65|°°°°°°°°°°°°°°°°}}}</includeonly>
<noinclude>|}
Here's an all-ASCII alternative to GIF/PNG snapshots of hex data.


Editable by anyone, "right there", in parallel with related documentation.


Here's an all-ASCII alternative to GIF/PNG snapshots of hex data.
Either embedded in the article using it, or in a subpage of the article.
:(in that case, transcluded and made directly editable via a header)
::(but if one wants to keep the doc in sync, it's not such a good idea)


;Usage
;Usage
The following input :
The following input :
  <nowiki>{|border=1 cellspacing=0 style="font-family:courier"
  <nowiki>{|border=1 cellspacing=0</nowiki>
<nowiki>{{HexRow</nowiki>
  <nowiki>{{HexRow|0x00</nowiki>
  <nowiki>|0x00</nowiki>
  <nowiki>|01|51|02|00|01|00|00|06|AD|DE|AD|DE|AD|DE|AD|DE</nowiki>
  <nowiki>|01|51|02|00|01|00|00|06|AD|DE|AD|DE|AD|DE|AD|DE</nowiki>
  <nowiki>|FF|FF|FF|FF|FF|FF|FF|FF|00|00|00|00|00|00|00|00</nowiki>
  <nowiki>|FF|FF|FF|FF|FF|FF|FF|FF|00|00|00|00|00|00|00|00</nowiki>
  <nowiki>|00|00|00|00|FF|FF|FF|FF|FF|FF|FF|FF|FF|FF|FF|FF</nowiki>
  <nowiki>|00|00|00|00|FF|FF|FF|FF|FF|FF|FF|FF|FF|FF|FF|FF</nowiki>
  <nowiki>|00|00|00|00|00|00|00|00|00|00|00|00|00|00|00|00</nowiki>
  <nowiki>|00|00|00|00|00|00|00|00|00|00|00|00|00|00|00|00</nowiki>
  <nowiki>|°who°needs°this°</nowiki>
  <nowiki>|Who needs this?°}}</nowiki>
  <nowiki>}}</nowiki>
  <nowiki>{{HexRow|0x10</nowiki>
<nowiki>|AD|DE|AD|DE|AD|DE|AD|DE|AD|DE|AD|DE|AD|DE|AD|DE</nowiki>
<nowiki>|00|00|00|00|00|00|00|00|00|00|00|00|00|00|00|00</nowiki>
<nowiki>|FF|FF|FF|FF|FF|FF|FF|FF|FF|FF|FF|FF|FF|FF|FF|FF</nowiki>
<nowiki>|00|00|00|00|00|00|00|00|00|00|00|00|00|00|00|00</nowiki>
<nowiki>|}}</nowiki>
<nowiki>|}</nowiki>
produces the following output :
produces the following output :
{|border=1 cellspacing=0 style="font-family:courier"</noinclude>
{|border=1 cellspacing=0
|-
|-style="font-family:courier"
!{{{0|0x00}}}
!{{{0|0x00}}}
|BGCOLOR="#FF0000"|01
|BGCOLOR="#FF0000"|01
Line 47: Line 54:
|BGCOLOR="#FFFF00"|00
|BGCOLOR="#FFFF00"|00
|BGCOLOR="#FFFF00"|06
|BGCOLOR="#FFFF00"|06
|BGCOLOR="#FFFF00"|AD
|BGCOLOR="#00FF00"|AD
|BGCOLOR="#00FF00"|DE
|BGCOLOR="#00FF00"|AD
|BGCOLOR="#00FF00"|DE
|BGCOLOR="#00FF00"|DE
|BGCOLOR="#00FF00"|AD
|BGCOLOR="#00FF00"|AD
Line 53: Line 62:
|BGCOLOR="#00FF00"|AD
|BGCOLOR="#00FF00"|AD
|BGCOLOR="#00FF00"|DE
|BGCOLOR="#00FF00"|DE
!Who needs this?°
|-style="font-family:courier"
!{{{0|0x10}}}
|BGCOLOR="#00FF00"|AD
|BGCOLOR="#00FF00"|AD
|BGCOLOR="#00FF00"|DE
|BGCOLOR="#00FF00"|DE
!°who°needs°this°
|BGCOLOR="#00FF00"|AD
|BGCOLOR="#00FF00"|DE
|BGCOLOR="#00FF00"|AD
|BGCOLOR="#00FF00"|DE
|BGCOLOR="#00FF00"|AD
|BGCOLOR="#00FF00"|DE
|BGCOLOR="#00FF00"|AD
|BGCOLOR="#00FF00"|DE
|BGCOLOR="#00FF00"|AD
|BGCOLOR="#00FF00"|DE
|BGCOLOR="#00FF00"|AD
|BGCOLOR="#00FF00"|DE
|BGCOLOR="#00FF00"|AD
|BGCOLOR="#00FF00"|DE
!°°°°°°°°°°°°°°°°
|}
|}
 
There are 65 arguments; they are ''not'' named, but they line up intuitively.
There are 65 arguments; they are ''not'' named, but they line up nicely in a 16x4 lattice.
*The first argument is the data's offset (default is 0x00, maybe it should be blank).
*The first argument is the data's offset (default is 0x00, maybe it should be blank).
*The next 16 arguments are the 16 hex bytes.
*The next 16 arguments are the 16 hex bytes.
Line 68: Line 93:
**Most of the time it's actually irrelevant; I'd systematically show all non-printable chars as '''°'''.
**Most of the time it's actually irrelevant; I'd systematically show all non-printable chars as '''°'''.
**If all 16 chars are non-printable, leave the last argument blank (the default value is '''°°°°°°°°°°°°°°°°''')
**If all 16 chars are non-printable, leave the last argument blank (the default value is '''°°°°°°°°°°°°°°°°''')
Only the fixed-size font is specified in this template, as well as bold for offset for offset and ASCII.
The rest (cell spacing/padding, border, alignment on page, background color, etc) is set at table level.
</noinclude>
</noinclude>