<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://mywikibiz.com/index.php?action=history&amp;feed=atom&amp;title=Module%3AApplyLinkAnnotations</id>
	<title>Module:ApplyLinkAnnotations - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://mywikibiz.com/index.php?action=history&amp;feed=atom&amp;title=Module%3AApplyLinkAnnotations"/>
	<link rel="alternate" type="text/html" href="https://mywikibiz.com/index.php?title=Module:ApplyLinkAnnotations&amp;action=history"/>
	<updated>2026-06-13T17:23:42Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.35.3</generator>
	<entry>
		<id>https://mywikibiz.com/index.php?title=Module:ApplyLinkAnnotations&amp;diff=470984&amp;oldid=prev</id>
		<title>Zoran: Moved page from wikipedia:en:Module:ApplyLinkAnnotations</title>
		<link rel="alternate" type="text/html" href="https://mywikibiz.com/index.php?title=Module:ApplyLinkAnnotations&amp;diff=470984&amp;oldid=prev"/>
		<updated>2021-07-08T19:17:58Z</updated>

		<summary type="html">&lt;p&gt;Moved page from &lt;a href=&quot;/index.php?title=Wikipedia:en:Module:ApplyLinkAnnotations&amp;amp;action=edit&amp;amp;redlink=1&quot; class=&quot;new&quot; title=&quot;Wikipedia:en:Module:ApplyLinkAnnotations (page does not exist)&quot;&gt;wikipedia:en:Module:ApplyLinkAnnotations&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;local p = {};&lt;br /&gt;
&lt;br /&gt;
local regex = &amp;quot;(:*)%*%s*%[%[([^%]|:][^%]:]*[^%]|:])%]%]%s*&amp;quot;&lt;br /&gt;
local repl  = &amp;quot;%1* {{Annotated link |%2}}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
function p.replaceLinksInUnorderedList(markup)&lt;br /&gt;
  -- provided for convenience to make console testing easier for development&lt;br /&gt;
  --&lt;br /&gt;
  -- matches any wikilinks that are&lt;br /&gt;
  --    1. at the beginning of a list item &lt;br /&gt;
  --    2. with no existing annotation (or any text) following them&lt;br /&gt;
  --&lt;br /&gt;
  -- must run twice because match utilizes the newlines on *both* sides&lt;br /&gt;
  -- of wikilinks and thus, &amp;quot;consumes&amp;quot; those chars during the first match&lt;br /&gt;
  -- such that every-other line is ineligible for matching until the second &lt;br /&gt;
  -- run. (which does the same thing but for all the other lines)&lt;br /&gt;
&lt;br /&gt;
  -- Test case(s?):&lt;br /&gt;
  -- =p.replaceLinksInUnorderedList(&amp;quot;\n*[[TEst|teST]] \n:* [[name]]\n::*[[link]] - with existing annotation\n::* [[for|a friend]]  \n*[[t]]\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
  local anls, cnt1, cnt2&lt;br /&gt;
&lt;br /&gt;
  -- pattern and replacement updated locally to require newlines &lt;br /&gt;
  -- on both sides&lt;br /&gt;
  local regex_line = '\n' .. regex .. '\n'&lt;br /&gt;
  local repl_line  = '\n' .. repl  .. '\n'&lt;br /&gt;
&lt;br /&gt;
  anls, cnt1 = mw.ustring.gsub(markup, regex_line, repl_line)&lt;br /&gt;
  anls, cnt2 = mw.ustring.gsub(anls,   regex_line, repl_line)&lt;br /&gt;
&lt;br /&gt;
  mw.log(&amp;quot;Replaced &amp;quot; .. cnt1+cnt2 .. &amp;quot; links without existing annotations&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
  return anls&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function p.bySubstitutionInUnorderedList(frame)&lt;br /&gt;
  return p.replaceLinksInUnorderedList(frame.args[1])&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function p._testline(line)&lt;br /&gt;
  -- testing function used to evaluate a single line against the pattern(regex)&lt;br /&gt;
  -- signature designed to accommodate Module:UnitTests:equals&lt;br /&gt;
  -- so frame args are NOT extracted, a raw string is expected&lt;br /&gt;
  local res, cnt = mw.ustring.gsub(line, '^'..regex..'$', repl)&lt;br /&gt;
  return res&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
return p&lt;/div&gt;</summary>
		<author><name>Zoran</name></author>
	</entry>
</feed>