<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-GB">
	<id>https://stockhub.co/index.php?action=history&amp;feed=atom&amp;title=Module%3AAside</id>
	<title>Module:Aside - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://stockhub.co/index.php?action=history&amp;feed=atom&amp;title=Module%3AAside"/>
	<link rel="alternate" type="text/html" href="https://stockhub.co/index.php?title=Module:Aside&amp;action=history"/>
	<updated>2026-05-12T07:36:41Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.5</generator>
	<entry>
		<id>https://stockhub.co/index.php?title=Module:Aside&amp;diff=135286&amp;oldid=prev</id>
		<title>imported&gt;Andrybak: Reverted to revision 742986357 by Wnt (talk): Revert addition of stray spaces</title>
		<link rel="alternate" type="text/html" href="https://stockhub.co/index.php?title=Module:Aside&amp;diff=135286&amp;oldid=prev"/>
		<updated>2021-01-23T09:45:04Z</updated>

		<summary type="html">&lt;p&gt;Reverted to revision 742986357 by &lt;a href=&quot;/research/Special:Contributions/Wnt&quot; title=&quot;Special:Contributions/Wnt&quot;&gt;Wnt&lt;/a&gt; (&lt;a href=&quot;/index.php?title=User_talk:Wnt&amp;amp;action=edit&amp;amp;redlink=1&quot; class=&quot;new&quot; title=&quot;User talk:Wnt (page does not exist)&quot;&gt;talk&lt;/a&gt;): Revert addition of stray spaces&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;-- This module is an experiment in an altered discussion dynamic for Wikipedia forums.&lt;br /&gt;
-- It presents a brief digest of the referenced discussion on a user&amp;#039;s talk subpage.&lt;br /&gt;
-- The full conversation remains available via V-D-E buttons (V = view the talk subpage, &lt;br /&gt;
-- D = file a comment to the user&amp;#039;s MAIN talk page like if there&amp;#039;s something you want him to &amp;#039;admin&amp;#039; or to request an invite as applicable&lt;br /&gt;
-- E = edit the talk subpage&lt;br /&gt;
-- The digest should present usernames and the first words of each comment, for the past N comments&lt;br /&gt;
-- One intention is to allow off-topic conversations to be less obtrusive on the parent thread.&lt;br /&gt;
-- Another is that, potentially, some of these may be invite-only conversations in some forum where that is deemed appropriate.&lt;br /&gt;
-- Discussions of this type might be indexed in multiple specialized forums.&lt;br /&gt;
-- Part of the experiment is that if users feel *invited* to a discussion, it gives editors a chance to express mutual esteem,&lt;br /&gt;
-- as a counterbalance against the usual where they only really talk personally when in conflict.  Not sure this will really happen...&lt;br /&gt;
&lt;br /&gt;
-- To try to keep things more accessible, I think the Lua module should only do the text processing to create the talk page extract&lt;br /&gt;
-- This then should get wrapped up in V-D-E boxes and cute formatting by an enveloping template.&lt;br /&gt;
-- There are some things I can&amp;#039;t be perfect about - if you reply in the middle of someone&amp;#039;s comment you&amp;#039;ll get their beginning attributed to you.&lt;br /&gt;
&lt;br /&gt;
local p = {}&lt;br /&gt;
&lt;br /&gt;
function p.main(frame,header)&lt;br /&gt;
    local parent=frame.getParent(frame) or {}&lt;br /&gt;
    local currentpage,top&lt;br /&gt;
    ---- args in the #invoke itself trump args in the parent frame - not sure if I should even access these but leaving them for now.&lt;br /&gt;
    user = frame.args.user or parent.args.user -- the location for discussion with whoever admins the aside, usually user talk:(x).  &amp;quot;D&amp;quot; defaults to (user)&lt;br /&gt;
    page = frame.args.page or parent.args.page -- the location of the page for the aside.&lt;br /&gt;
    -- In the template, &amp;quot;V/E&amp;quot; links to (page), usually user talk:(x)/subpage&lt;br /&gt;
    -- Here page is the talk page on which these operations are done&lt;br /&gt;
    -- page can contain a section using the # character.  Per https://en.wikipedia.org/wiki/Wikipedia:Naming_conventions_(technical_restrictions)#Forbidden_characters&lt;br /&gt;
    -- there can be no # in a page name, so this imposes no restrictions.  If a section is indicated then ONLY that section should be processed.&lt;br /&gt;
    local basepage, section = mw.ustring.match(page, &amp;quot;(.-)#(.*)&amp;quot;)&lt;br /&gt;
    if section then page = basepage end&lt;br /&gt;
    comments = frame.args.comments or parent.args.comments -- the last N comments are returned&lt;br /&gt;
    length = frame.args.length or parent.args.length -- return at most N characters of text per comment&lt;br /&gt;
    order = frame.args.order or parent.args.order or &amp;quot;new&amp;quot; -- provides an option to sort the comments various ways&lt;br /&gt;
    -- order = &amp;quot;new&amp;quot; (default) : latest comments shown; order = &amp;quot;page&amp;quot; (or whatever) : just show the lowest ones on the page&lt;br /&gt;
    if (order == &amp;quot;&amp;quot;) then order = &amp;quot;new&amp;quot; end -- I don&amp;#039;t think I need this but I&amp;#039;m suspicious&lt;br /&gt;
    -- &amp;quot;position&amp;quot; (left, right, plain) is a template parameter that can be handled in the template, so will not be used here.&lt;br /&gt;
    ---- args in the parent frame come next&lt;br /&gt;
    ---- default values if parameters aren&amp;#039;t provided&lt;br /&gt;
    comments = comments or 6&lt;br /&gt;
    comments = tonumber(comments)&lt;br /&gt;
    if (comments == 0 or not(comments)) then comments = 6 end&lt;br /&gt;
    length = length or 80 -- In homage to TRS, but probably this will get longer&lt;br /&gt;
    length = tonumber(length)&lt;br /&gt;
    -- get a pointer to the aside&lt;br /&gt;
    local pagepointer=mw.title.new(page)&lt;br /&gt;
    if not(pagepointer) then return &amp;quot;&amp;#039;&amp;#039;[[Module:Aside]]: The page &amp;quot; .. &amp;#039;&amp;quot;&amp;#039; .. page .. &amp;#039;&amp;quot;&amp;#039; .. &amp;quot; could not be accessed.&amp;#039;&amp;#039;&amp;quot; end&lt;br /&gt;
    ---- get the text of the aside&lt;br /&gt;
    local text=pagepointer.getContent(pagepointer)&lt;br /&gt;
    assert (text,&amp;quot;error: failed to get text from &amp;quot;.. page)&lt;br /&gt;
&lt;br /&gt;
    if section then&lt;br /&gt;
    	local textbits = mw.text.split(text, section, true) -- this is one of the few functions that takes a plain text...&lt;br /&gt;
    	if #textbits &amp;gt; 1 then&lt;br /&gt;
    		local i = 2&lt;br /&gt;
    		repeat&lt;br /&gt;
    		    if (mw.ustring.match(textbits[i-1], &amp;quot;==*%s*$&amp;quot;)) and (mw.ustring.match(textbits[i], &amp;quot;^%s*==*&amp;quot;)) then&lt;br /&gt;
    			    text = mw.ustring.gsub(table.concat(textbits, &amp;quot;&amp;quot;, i), &amp;quot;%s*==*&amp;quot;, &amp;quot;&amp;quot;, 1)&lt;br /&gt;
    			    text = mw.ustring.gsub(text, &amp;quot;\n%s*==*.*&amp;quot;, &amp;quot;&amp;quot;, 1) -- this kills everything after ANY section header, even a subsection&lt;br /&gt;
    			    break -- use the first section that matches this section heading, I suppose - omitting this would use the last&lt;br /&gt;
    		    end&lt;br /&gt;
    		    i = i + 1&lt;br /&gt;
	        until (i &amp;gt; #textbits)&lt;br /&gt;
	    else&lt;br /&gt;
	    	return &amp;quot;&amp;#039;&amp;#039;[[Module:Aside]]: The section &amp;quot; .. &amp;#039;&amp;quot;&amp;#039; .. section .. &amp;#039;&amp;quot;&amp;#039; .. &amp;quot; could not be found in &amp;quot; .. &amp;#039;&amp;quot;&amp;#039; .. page .. &amp;#039;&amp;quot;&amp;#039;&lt;br /&gt;
	    end&lt;br /&gt;
    end&lt;br /&gt;
    		&lt;br /&gt;
    -- the first set of &amp;lt;banner&amp;gt; and &amp;lt;banner&amp;gt; puts arbitrary text at the beginning.&lt;br /&gt;
    local output=mw.ustring.match(text, &amp;quot;&amp;lt;!%-%-+banner%-%-+&amp;gt;(.-)&amp;lt;!%-%-+/banner%-%-+&amp;gt;&amp;quot;) or &amp;quot;&amp;quot;&lt;br /&gt;
    output = output .. &amp;quot;&amp;lt;br /&amp;gt;&amp;quot;&lt;br /&gt;
    -- now get rid of the banner so it isn&amp;#039;t tacked on to the first comment&lt;br /&gt;
    text = mw.ustring.gsub(text, &amp;quot;&amp;lt;!%-%-+banner%-%-+&amp;gt;(.-)&amp;lt;!%-%-+/banner%-%-+&amp;gt;%s*&amp;quot;, &amp;quot;&amp;quot;, 1)&lt;br /&gt;
    -- while we&amp;#039;re at it, get rid of all the headers.  Yegods, this looks dicey.&lt;br /&gt;
    text = mw.ustring.gsub(text, &amp;quot;==+([^\n=]*)=+=%s*&amp;quot;, &amp;quot;&amp;quot;)&lt;br /&gt;
    -- and all the other comments... this may indicate trouble...&lt;br /&gt;
    text = mw.ustring.gsub(text, &amp;quot;&amp;lt;!%-%-+.-%-%-+&amp;gt;&amp;quot;, &amp;quot;&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
    local signaturematch = &amp;quot;%[%[(.-)%]%]%s*%(%[%[(.-)%]%]%)%s*(%d+):(%d+)%s*,%s*(%d+)%s*(.-)%s*(%d+)%s*%(%a%a%a%)%s*&amp;quot;&lt;br /&gt;
    local monthlookup = {[&amp;quot;January&amp;quot;] = &amp;quot;01&amp;quot;, [&amp;quot;February&amp;quot;] = &amp;quot;02&amp;quot;, [&amp;quot;March&amp;quot;] = &amp;quot;03&amp;quot;, [&amp;quot;April&amp;quot;] = &amp;quot;04&amp;quot;, [&amp;quot;May&amp;quot;] = &amp;quot;05&amp;quot;, [&amp;quot;June&amp;quot;] = &amp;quot;06&amp;quot;, [&amp;quot;July&amp;quot;] = &amp;quot;07&amp;quot;, [&amp;quot;August&amp;quot;] = &amp;quot;08&amp;quot;, [&amp;quot;September&amp;quot;] = &amp;quot;09&amp;quot;, [&amp;quot;October&amp;quot;] = &amp;quot;10&amp;quot;, [&amp;quot;November&amp;quot;] = &amp;quot;11&amp;quot;, [&amp;quot;December&amp;quot;] = &amp;quot;12&amp;quot;}&lt;br /&gt;
    local prowl = mw.ustring.gmatch(text,&amp;quot;:*%s*(.-)&amp;quot;..signaturematch)&lt;br /&gt;
    local archive = {} -- dictionary that pulls comment from the time&lt;br /&gt;
    local keys = {} -- shove all the times in here, then sort it later, use to pull out most recent comments wherever they are on the page&lt;br /&gt;
    repeat&lt;br /&gt;
        local comment, commentuser, commenttalk, commenthour, commentminute, commentday, commentmonth, commentyear = prowl()&lt;br /&gt;
        if not (comment) then break end&lt;br /&gt;
        -- could put some verification in here - weird days, months, years etc. could disqualify comments from display.&lt;br /&gt;
        -- doubt it&amp;#039;s worth bothering at the moment.&lt;br /&gt;
        comment = mw.ustring.gsub(comment, &amp;quot;$[:%s\n]*&amp;quot;, &amp;quot;&amp;quot;, 1) -- remove initial whitespace and colons from comment&lt;br /&gt;
        comment = mw.ustring.gsub(comment, &amp;quot;\n:*&amp;quot;, &amp;quot;  &amp;quot;) -- remove all newlines from comment and :&amp;#039;s afterward, replace with spaces&lt;br /&gt;
        comment = mw.ustring.gsub(comment, &amp;quot;&amp;lt;br ?\\?&amp;gt;&amp;quot;, &amp;quot;  &amp;quot;) -- remove br&amp;#039;s also&lt;br /&gt;
        local commentmonthno = monthlookup[commentmonth] or &amp;quot;00&amp;quot;&lt;br /&gt;
        if mw.ustring.len(commentday) == 1 then commentday = &amp;quot;0&amp;quot; .. commentday end -- pad days with leading zeroes for sort&lt;br /&gt;
        local key = commentyear .. commentmonthno .. commentday .. commenthour .. commentminute&lt;br /&gt;
        commentuser = mw.ustring.match(commentuser, &amp;quot;(.-)|&amp;quot;) or commentuser -- get rid of the piped summaries of the links&lt;br /&gt;
        commentuser = mw.ustring.match(commentuser, &amp;quot;User:(.*)&amp;quot;) or commentuser -- get rid of the User: before user&lt;br /&gt;
        commenttalk = mw.ustring.match(commenttalk, &amp;quot;(.-)|&amp;quot;) or commenttalk&lt;br /&gt;
        commenttalk = mw.ustring.match(commenttalk, &amp;quot;(.-)#&amp;quot;) or commenttalk -- get rid of the #crap after the link&lt;br /&gt;
        commentdate = commentmonthno .. &amp;quot;/&amp;quot; .. commentday -- just tracking the day of comments for now, seems enough&lt;br /&gt;
        archive[key] = {comment, commentuser, commenttalk, commentdate} -- should check user = talk, only store one&lt;br /&gt;
        table.insert(keys, key)&lt;br /&gt;
    until false&lt;br /&gt;
&lt;br /&gt;
    -- sort keys from earliest to latest; maybe the opposite would be better but I&amp;#039;m not feeling creative.&lt;br /&gt;
    if (order == &amp;quot;new&amp;quot;) then table.sort(keys) end&lt;br /&gt;
    &lt;br /&gt;
    -- pick the last N keys&lt;br /&gt;
    local lastkey = table.maxn(keys)&lt;br /&gt;
    local firstkey = math.max(1, lastkey - comments + 1)&lt;br /&gt;
    for i = firstkey, lastkey do&lt;br /&gt;
    	local key = keys[i]&lt;br /&gt;
    	local comment, commentuser, commenttalk, commentdate = archive[key][1], archive[key][2], archive[key][3], archive[key][4]&lt;br /&gt;
    	local longuser = mw.ustring.len(commentuser)&lt;br /&gt;
    	if (longuser&amp;gt;12) then commentuser = mw.ustring.sub(commentuser, 1, 5) .. &amp;quot;..&amp;quot; .. mw.ustring.sub(commentuser, longuser - 4, longuser) end&lt;br /&gt;
        output=output.. commentdate ..&amp;quot; [[&amp;quot;..commenttalk..&amp;quot;|&amp;quot;..commentuser..&amp;quot;]]: &amp;quot;..(mw.ustring.sub(comment, 1, length) or &amp;quot;&amp;quot;)..&amp;quot;&amp;lt;br /&amp;gt;&amp;quot; -- this isn&amp;#039;t really the output I want yet&lt;br /&gt;
    end&lt;br /&gt;
    return frame.preprocess(frame,output)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
return p&lt;/div&gt;</summary>
		<author><name>imported&gt;Andrybak</name></author>
	</entry>
</feed>