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&amp;diff=246625750&amp;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 = &quot;Sort&quot;,<br /> sub = &quot;cellText&quot;,<br /> serial = &quot;2020-04-04&quot;,<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( &quot;%s/%s&quot;,<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, &quot;Module:&quot; .. storage )<br /> end<br /> if not lucky then<br /> if not suited and<br /> type( alt ) == &quot;number&quot; and<br /> alt &gt; 0 then<br /> suited = string.format( &quot;Q%d&quot;, alt )<br /> suited = mw.wikibase.getSitelink( suited )<br /> GlobalMod.globalModules[ access ] = suited or true<br /> end<br /> if type( suited ) == &quot;string&quot; then<br /> storage = suited<br /> finer()<br /> lucky, r = pcall( fun, storage )<br /> end<br /> if not lucky and alert then<br /> error( &quot;Missing or invalid page: &quot; .. 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 = &quot;Sorter&quot;<br /> end<br /> end<br /> if type( Sort[ store ] ) == &quot;nil&quot; then<br /> local bib = foreignModule( suite,<br /> true,<br /> sub,<br /> Sort.globals[ store ],<br /> true )<br /> if bib and type( bib[ suite ] ) == &quot;function&quot; 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, &quot;Cell&quot; )<br /> if type( args ) == &quot;table&quot; then<br /> local present = Sort.Cell.first( args, true )<br /> Sort.Cell.fair( args, &quot;source&quot;, present )<br /> if present.source then<br /> local s = mw.text.unstrip( present.source )<br /> if s:find( &quot;&lt;&quot;, 1, true ) then<br /> s = s:gsub( &quot;(&lt;/?%l[^&gt;]*&gt;)&quot;, &quot;&quot; )<br /> end<br /> if s:find( &quot;&#039;&quot;, 1, true ) then<br /> s = s:gsub( &quot;&#039;&#039;&#039;(.+)&#039;&#039;&#039;&quot;, &quot;%1&quot; )<br /> :gsub( &quot;&#039;&#039;(.+)&#039;&#039;&quot;, &quot;%1&quot; )<br /> end<br /> if s:find( &quot;[&quot;, 1, true ) then<br /> fetch( &quot;WLink&quot; )<br /> s = Sort.WLink.getPlain( s )<br /> end<br /> s = mw.text.decode( s )<br /> s = mw.ustring.gsub( s, mw.ustring.char( 160 ), &quot; &quot; )<br /> s = mw.text.trim( s )<br /> s = mw.ustring.gsub( s, &quot;%s+&quot;, &quot; &quot; )<br /> if s ~= &quot;&quot; then<br /> r = present.source<br /> fetch()<br /> s = Sort.Sorter.lex( s, &quot;latin&quot; )<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( &quot;?????&quot;, present )<br /> end<br /> else<br /> error( &quot;&#039;args&#039; is not a table&quot; )<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( &quot;span&quot; )<br /> :addClass( &quot;error&quot; )<br /> :wikitext( &quot;Module:Sort/cell * &quot; .. r )<br /> if type( args.cell ) == &quot;table&quot; and<br /> type( args.cell.wikitext ) == &quot;function&quot; 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 &quot;wikidata&quot; or &quot;~&quot;<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 == &quot;~&quot; )<br /> local since = atleast<br /> local r<br /> if last or since == &quot;wikidata&quot; then<br /> local item = Failsafe.item<br /> since = false<br /> if type( item ) == &quot;number&quot; and item &gt; 0 then<br /> local entity = mw.wikibase.getEntity( string.format( &quot;Q%d&quot;,<br /> item ) )<br /> if type( entity ) == &quot;table&quot; then<br /> local seek = Failsafe.serialProperty or &quot;P348&quot;<br /> local vsn = entity:formatPropertyValues( seek )<br /> if type( vsn ) == &quot;table&quot; and<br /> type( vsn.value ) == &quot;string&quot; and<br /> vsn.value ~= &quot;&quot; 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 ) == &quot;nil&quot; then<br /> if not since or since &lt;= 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 &quot;&quot;<br /> end -- p.f<br /> <br /> p.failsafe = function ( frame )<br /> -- Versioning interface<br /> local s = type( frame )<br /> local since<br /> if s == &quot;table&quot; then<br /> since = frame.args[ 1 ]<br /> elseif s == &quot;string&quot; then<br /> since = frame<br /> end<br /> if since then<br /> since = mw.text.trim( since )<br /> if since == &quot;&quot; then<br /> since = false<br /> end<br /> end<br /> return Failsafe.failsafe( since ) or &quot;&quot;<br /> end -- p.failsafe<br /> <br /> p.Sort = function ()<br /> -- Module interface<br /> return Sort<br /> end<br /> <br /> return p</div> PerfektesChaos