Jump to content

Module:AutosortTable/sandbox/testcases

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by JohnFromPinckney (talk | contribs) at 23:38, 20 February 2021 (6|6). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
local p = {}

function p:example()
    return self:preprocess([[
{{#invoke: AutosortTable/sandbox|create

|class=wikitable
| style = width:48%; float:right;
| separator =--
| order = 2,1
|numeric=2
| header =  --Name--Age
| caption = This is a table caption for p:example
|rowheader=1

|--Bob--20
|--Peter--35
|--John--35
|--James--50
|--Henry--45

}}
]])
end

function p:example_desc()
    return self:preprocess([[
{{#invoke: AutosortTable/sandbox|create

| class = wikitable
|style=width:48%; 
| separator = --
|order =2,1
| descending = 1,2
| numeric = 2
| caption = This is a table caption for example_desc with some "quotation marks"
|header=--Name--Age

|--Bob--20
|--Peter--35
|--John--35
|--James--50
|--Henry--45

}}
]])
end

function p:example_4cols()
    return self:preprocess([[
{{#invoke: AutosortTable/sandbox|create

| class = wikitable sortable
| style = width: 50%;
| separator = 6|6
| rowheader = 1
| order = 2, 3, 4, 5, 1
| numeric = 2, 3, 4, 5
| header =  6|6 Name 6|6 A 6|6 B 6|6 C 6|6 D
|  6|6 Bob 6|6 20 6|6 3 6|6 394 6|6 0.38
|  6|6 Peter 6|6 35 6|6 4 6|6 472 6|6 1.48
|  6|6 John 6|6 35 6|6 4 6|6 472 6|6 -1.38
|  6|6 James 6|6 35 6|6 6 6|6 465 6|6 10.384
|  6|6 Henry 6|6 35 6|6 4 6|6 472 6|6 2.49
|  6|6 Smith 6|6 35 6|6 -2 6|6 411 6|6 9.27
|  6|6 Doe 6|6 35 6|6 4 6|6 876 6|6 -3.52
|  6|6 Joseph 6|6 35 6|6 6 6|6 183 6|6 3.29482
|  6|6 Frank 6|6 20 6|6 -3 6|6 454 6|6 4.102
|  6|6 Martin  6|6  35  6|6  4  6|6  472  6|6  0.00013

}}
]])
end

function p:example_4colsdesc()
    return self:preprocess([[
{{#invoke: AutosortTable/sandbox|create

| class = wikitable sortable
| style = width: 50%;
| separator = ::
| order = 2, 3, 4, 5, 1
| numeric = 2, 3, 4, 5
| descending = 4, 5
| header = ::Name::A::B::C::D

|::Bob::20::3::394::0.38
|::Peter::35::4::472::1.48
|::John::35::4::472::-1.38
|::James::35::6::465::10.384
|::Henry::35::4::472::2.49
|::Smith::35::-2::411::9.27
|::Doe::35::4::876::-3.52
|::Joseph::35::6::183::3.29482
|::Frank::20::-3::454::4.102
|::Martin::35::4::472::0.00013

}}
]])
end

function p:example_css()
    return self:preprocess([[
{{#invoke: AutosortTable/sandbox|create

| caption = This is a table caption for example_css
| class = wikitable sortable
| style = width: 50%;
| separator = ::
| order = 2, 3, 4, 5, 1
| numeric = 2, 3, 4, 5
| rowheader = 1, 4,2
| header = ::Name::A::B::C::D
| colstyle = :: :: :: :: font-family:monospace :: color:#DD9900

|background-color:#FFDDDD::Bob::20::3::394::0.38
|background-color:#DDDDFF::Peter::35::4::472::1.48
|background-color:#FFDDDD::John::35::4::472::-1.38
|background-color:#DDDDFF::James::35::6::465::10.384
|::''Henry''::35::4::472::2.49
|border:2px solid #FF0000::Smith::35::-2::411::9.27
|background-color:#FFDDDD::Doe::35::4::876::-3.52
|text-align:center; color:#008800::Joseph::35::6::183::3.29482
|text-decoration:underline::Frank::20::-3::454::4.102
|::Martin::35::4::472::0.00013

}}
]])
end

function p:example_hiddencols()
    return self:preprocess([[
{{#invoke: AutosortTable/sandbox|create

| class = wikitable sortable
| style = width: 50%;
| separator = ::
| order = 2, 3, 4, 5, 1
| numeric = 2, 3, 4, 5
| hidden = 2, 3
| header = ::Name::C::D

|::Bob::20::3::394::0.38
|::Peter::35::4::472::1.48
|::John::35::4::472::-1.38
|::James::35::6::465::10.384
|::Henry::35::4::472::2.49
|::Smith::35::-2::411::9.27
|::Doe::35::4::876::-3.52
|::Joseph::35::6::183::3.29482
|::Frank::20::-3::454::4.102
|::Martin::35::4::472::0.00013

}}
]])
end

return p