https://de.wikipedia.org/w/index.php?action=history&feed=atom&title=Modul%3ASort%2FcellText
Modul:Sort/cellText - Versionsgeschichte
2025-04-19T07:22:57Z
Versionsgeschichte dieser Seite in Wikipedia
MediaWiki 1.44.0-wmf.25
https://de.wikipedia.org/w/index.php?title=Modul:Sort/cellText&diff=246625750&oldid=prev
PerfektesChaos: 2024-07-02
2024-07-10T11:57:46Z
<p>2024-07-02</p>
<a href="//de.wikipedia.org/w/index.php?title=Modul:Sort/cellText&diff=246625750&oldid=198749964">Änderungen zeigen</a>
PerfektesChaos
https://de.wikipedia.org/w/index.php?title=Modul:Sort/cellText&diff=198749964&oldid=prev
PerfektesChaos: 2020-04-10
2020-04-11T16:23:35Z
<p>2020-04-10</p>
<table style="background-color: #fff; color: #202122;" data-mw="interface">
<col class="diff-marker" />
<col class="diff-content" />
<col class="diff-marker" />
<col class="diff-content" />
<tr class="diff-title" lang="de">
<td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">← Nächstältere Version</td>
<td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">Version vom 11. April 2020, 18:23 Uhr</td>
</tr><tr>
<td colspan="2" class="diff-lineno">Zeile 1:</td>
<td colspan="2" class="diff-lineno">Zeile 1:</td>
</tr>
<tr>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>local Sort = { suite = "Sort",</div></td>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>local Sort = { suite = "Sort",</div></td>
</tr>
<tr>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> sub = "cellText",</div></td>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> sub = "cellText",</div></td>
</tr>
<tr>
<td class="diff-marker" data-marker="−"></td>
<td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div> serial = "2020-04-<del style="font-weight: bold; text-decoration: none;">04</del>",</div></td>
<td class="diff-marker" data-marker="+"></td>
<td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div> serial = "2020-04-<ins style="font-weight: bold; text-decoration: none;">10</ins>",</div></td>
</tr>
<tr>
<td class="diff-marker" data-marker="−"></td>
<td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div> item = <del style="font-weight: bold; text-decoration: none;">0</del>,</div></td>
<td class="diff-marker" data-marker="+"></td>
<td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div> item = <ins style="font-weight: bold; text-decoration: none;">90147626</ins>,</div></td>
</tr>
<tr>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> globals = { Sorter = 24205172,</div></td>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> globals = { Sorter = 24205172,</div></td>
</tr>
<tr>
<td class="diff-marker" data-marker="−"></td>
<td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div> Cell = <del style="font-weight: bold; text-decoration: none;">0</del>,</div></td>
<td class="diff-marker" data-marker="+"></td>
<td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div> Cell = <ins style="font-weight: bold; text-decoration: none;">90144855</ins>,</div></td>
</tr>
<tr>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> WLink = 19363224 } }</div></td>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> WLink = 19363224 } }</div></td>
</tr>
<tr>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>--[=[</div></td>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>--[=[</div></td>
</tr>
</table>
PerfektesChaos
https://de.wikipedia.org/w/index.php?title=Modul:Sort/cellText&diff=198723652&oldid=prev
PerfektesChaos: 2020-04-04
2020-04-10T19:42:59Z
<p>2020-04-04</p>
<p><b>Neue Seite</b></p><div>local Sort = { suite = "Sort",<br />
sub = "cellText",<br />
serial = "2020-04-04",<br />
item = 0,<br />
globals = { Sorter = 24205172,<br />
Cell = 0,<br />
WLink = 19363224 } }<br />
--[=[<br />
Sort/cellText -- support table cells with lexically sortable wikitext<br />
]=]<br />
local Failsafe = Sort<br />
local GlobalMod = Sort<br />
<br />
<br />
<br />
local foreignModule = function ( access, advanced, append, alt, alert )<br />
-- Fetch global module<br />
-- Precondition:<br />
-- access -- string, with name of base module<br />
-- advanced -- true, for require(); else mw.loadData()<br />
-- append -- string, with subpage part, if any; or false<br />
-- alt -- number, of wikidata item of root; or false<br />
-- alert -- true, for throwing error on data problem<br />
-- Postcondition:<br />
-- Returns whatever, probably table<br />
-- 2020-01-01<br />
local storage = access<br />
local finer = function ()<br />
if append then<br />
storage = string.format( "%s/%s",<br />
storage,<br />
append )<br />
end<br />
end<br />
local fun, lucky, r, suited<br />
if advanced then<br />
fun = require<br />
else<br />
fun = mw.loadData<br />
end<br />
GlobalMod.globalModules = GlobalMod.globalModules or { }<br />
suited = GlobalMod.globalModules[ access ]<br />
if not suited then<br />
finer()<br />
lucky, r = pcall( fun, "Module:" .. storage )<br />
end<br />
if not lucky then<br />
if not suited and<br />
type( alt ) == "number" and<br />
alt > 0 then<br />
suited = string.format( "Q%d", alt )<br />
suited = mw.wikibase.getSitelink( suited )<br />
GlobalMod.globalModules[ access ] = suited or true<br />
end<br />
if type( suited ) == "string" then<br />
storage = suited<br />
finer()<br />
lucky, r = pcall( fun, storage )<br />
end<br />
if not lucky and alert then<br />
error( "Missing or invalid page: " .. storage )<br />
end<br />
end<br />
return r<br />
end -- foreignModule()<br />
<br />
<br />
<br />
local fetch = function ( access, append )<br />
-- Fetch global library<br />
-- Precondition:<br />
-- access -- string|false, with name of base module<br />
-- append -- string, with subpage part, if any; or false<br />
local store, sub, suite<br />
if access then<br />
suite = access<br />
store = access<br />
else<br />
suite = Sort.suite<br />
if append then<br />
sub = append:lower()<br />
store = append<br />
else<br />
store = "Sorter"<br />
end<br />
end<br />
if type( Sort[ store ] ) == "nil" then<br />
local bib = foreignModule( suite,<br />
true,<br />
sub,<br />
Sort.globals[ store ],<br />
true )<br />
if bib and type( bib[ suite ] ) == "function" then<br />
Sort[ store ] = bib[ suite ]()<br />
else<br />
error( tostring( bib ) )<br />
end<br />
end<br />
end -- fetch()<br />
<br />
<br />
<br />
local fiat = function ( args )<br />
-- Execute task<br />
-- Parameter:<br />
-- args -- table, parameters<br />
-- Postcondition:<br />
-- Returns string, or expands .cell<br />
-- Throws error on failure<br />
local r<br />
fetch( false, "Cell" )<br />
if type( args ) == "table" then<br />
local present = Sort.Cell.first( args, true )<br />
Sort.Cell.fair( args, "source", present )<br />
if present.source then<br />
local s = mw.text.unstrip( present.source )<br />
if s:find( "<", 1, true ) then<br />
s = s:gsub( "(</?%l[^>]*>)", "" )<br />
end<br />
if s:find( "'", 1, true ) then<br />
s = s:gsub( "'''(.+)'''", "%1" )<br />
:gsub( "''(.+)''", "%1" )<br />
end<br />
if s:find( "[", 1, true ) then<br />
fetch( "WLink" )<br />
s = Sort.WLink.getPlain( s )<br />
end<br />
s = mw.text.decode( s )<br />
s = mw.ustring.gsub( s, mw.ustring.char( 160 ), " " )<br />
s = mw.text.trim( s )<br />
s = mw.ustring.gsub( s, "%s+", " " )<br />
if s ~= "" then<br />
r = present.source<br />
fetch()<br />
s = Sort.Sorter.lex( s, "latin" )<br />
if s ~= r then<br />
Sort.Cell.faced( present, s )<br />
end<br />
r = Sort.Cell.finalize( present, r )<br />
end<br />
end<br />
if not r then<br />
r = Sort.Cell.fault( "?????", present )<br />
end<br />
else<br />
error( "'args' is not a table" )<br />
end<br />
return r<br />
end -- fiat()<br />
<br />
<br />
<br />
Sort.f = function ( args )<br />
-- Create table cell start or equip table cell object<br />
-- Parameter:<br />
-- Parameter:<br />
-- args -- table, parameters<br />
-- .source -- string, with wikitext<br />
-- .cell -- table|nil, sort environment<br />
-- .rowspan -- number|string, for cell attribute<br />
-- .colspan -- number|string, for cell attribute<br />
-- .class -- string, for cell attribute<br />
-- .style -- string|table, for cell attribute<br />
-- .id -- string, for cell attribute<br />
-- .lang -- string, for cell attribute<br />
-- .dir -- string, for cell attribute<br />
-- .cat -- string|nil, for error category<br />
-- Postcondition:<br />
-- Returns string, or expands .cell<br />
local lucky, r = pcall( fiat, args )<br />
if not lucky then<br />
local e = mw.html.create( "span" )<br />
:addClass( "error" )<br />
:wikitext( "Module:Sort/cell * " .. r )<br />
if type( args.cell ) == "table" and<br />
type( args.cell.wikitext ) == "function" then<br />
args.elem:node( e )<br />
else<br />
r = tostring( e )<br />
end<br />
end<br />
return r<br />
end -- Sort.f()<br />
<br />
<br />
<br />
Failsafe.failsafe = function ( atleast )<br />
-- Retrieve versioning and check for compliance<br />
-- Precondition:<br />
-- atleast -- string, with required version or "wikidata" or "~"<br />
-- or false<br />
-- Postcondition:<br />
-- Returns string -- with queried version, also if problem<br />
-- false -- if appropriate<br />
-- 2019-10-15<br />
local last = ( atleast == "~" )<br />
local since = atleast<br />
local r<br />
if last or since == "wikidata" then<br />
local item = Failsafe.item<br />
since = false<br />
if type( item ) == "number" and item > 0 then<br />
local entity = mw.wikibase.getEntity( string.format( "Q%d",<br />
item ) )<br />
if type( entity ) == "table" then<br />
local seek = Failsafe.serialProperty or "P348"<br />
local vsn = entity:formatPropertyValues( seek )<br />
if type( vsn ) == "table" and<br />
type( vsn.value ) == "string" and<br />
vsn.value ~= "" then<br />
if last and vsn.value == Failsafe.serial then<br />
r = false<br />
else<br />
r = vsn.value<br />
end<br />
end<br />
end<br />
end<br />
end<br />
if type( r ) == "nil" then<br />
if not since or since <= Failsafe.serial then<br />
r = Failsafe.serial<br />
else<br />
r = false<br />
end<br />
end<br />
return r<br />
end -- Failsafe.failsafe()<br />
<br />
<br />
<br />
-- Export<br />
local p = { }<br />
<br />
p.f = function ( frame )<br />
-- Template call<br />
Sort.frame = frame<br />
return Sort.f( frame.args ) or ""<br />
end -- p.f<br />
<br />
p.failsafe = function ( frame )<br />
-- Versioning interface<br />
local s = type( frame )<br />
local since<br />
if s == "table" then<br />
since = frame.args[ 1 ]<br />
elseif s == "string" then<br />
since = frame<br />
end<br />
if since then<br />
since = mw.text.trim( since )<br />
if since == "" then<br />
since = false<br />
end<br />
end<br />
return Failsafe.failsafe( since ) or ""<br />
end -- p.failsafe<br />
<br />
p.Sort = function ()<br />
-- Module interface<br />
return Sort<br />
end<br />
<br />
return p</div>
PerfektesChaos