<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://gobblerpedia.org/w/index.php?action=history&amp;feed=atom&amp;title=Module%3AURL</id>
	<title>Module:URL - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://gobblerpedia.org/w/index.php?action=history&amp;feed=atom&amp;title=Module%3AURL"/>
	<link rel="alternate" type="text/html" href="https://gobblerpedia.org/w/index.php?title=Module:URL&amp;action=history"/>
	<updated>2026-04-10T20:27:53Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.31.1</generator>
	<entry>
		<id>https://gobblerpedia.org/w/index.php?title=Module:URL&amp;diff=3255&amp;oldid=prev</id>
		<title>imported&gt;Echarlie: 1 revision imported</title>
		<link rel="alternate" type="text/html" href="https://gobblerpedia.org/w/index.php?title=Module:URL&amp;diff=3255&amp;oldid=prev"/>
		<updated>2017-05-04T18:18:46Z</updated>

		<summary type="html">&lt;p&gt;1 revision imported&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #222; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #222; text-align: center;&quot;&gt;Revision as of 18:18, 4 May 2017&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-notice&quot; lang=&quot;en&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(No difference)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
		<author><name>imported&gt;Echarlie</name></author>
		
	</entry>
	<entry>
		<id>https://gobblerpedia.org/w/index.php?title=Module:URL&amp;diff=3254&amp;oldid=prev</id>
		<title>imported&gt;Codename lisa: Alright, redeploying. I feel this Module is thoroughly tested this time. I even spot-checked it against Portable Document Format right now.</title>
		<link rel="alternate" type="text/html" href="https://gobblerpedia.org/w/index.php?title=Module:URL&amp;diff=3254&amp;oldid=prev"/>
		<updated>2014-12-06T05:27:20Z</updated>

		<summary type="html">&lt;p&gt;Alright, redeploying. I feel this Module is thoroughly tested this time. I even spot-checked it against &lt;a href=&quot;/w/index.php?title=Portable_Document_Format&amp;amp;action=edit&amp;amp;redlink=1&quot; class=&quot;new&quot; title=&quot;Portable Document Format (page does not exist)&quot;&gt;Portable Document Format&lt;/a&gt; right now.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;--&lt;br /&gt;
-- This module implements {{URL}}&lt;br /&gt;
--&lt;br /&gt;
-- See unit tests at [[Module:URL/tests]]&lt;br /&gt;
&lt;br /&gt;
local p = {}&lt;br /&gt;
 &lt;br /&gt;
function trim(s)&lt;br /&gt;
    return (mw.ustring.gsub(s, &amp;quot;^%s*(.-)%s*$&amp;quot;, &amp;quot;%1&amp;quot;))&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function safeUri(s)&lt;br /&gt;
    local success, uri = pcall(function()&lt;br /&gt;
        return mw.uri.new(s)&lt;br /&gt;
    end)&lt;br /&gt;
    if success then&lt;br /&gt;
        return uri&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function p._url(url, text)&lt;br /&gt;
    url = trim(url or '')&lt;br /&gt;
    text = trim(text or '')&lt;br /&gt;
    &lt;br /&gt;
    if url == '' then&lt;br /&gt;
        if text == '' then&lt;br /&gt;
            return mw.getCurrentFrame():expandTemplate{ title = 'tlx', args = { 'URL', &amp;quot;''example.com''&amp;quot;, &amp;quot;''optional display text''&amp;quot; } }&lt;br /&gt;
        else&lt;br /&gt;
            return text&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
    &lt;br /&gt;
    -- If the URL contains any unencoded spaces, encode them, because MediaWiki will otherwise interpret a space as the end of the URL.&lt;br /&gt;
    url = mw.ustring.gsub(url, '%s', function(s) return mw.uri.encode(s, 'PATH') end)&lt;br /&gt;
    &lt;br /&gt;
    -- If there is an empty query string or fragment id, remove it as it will cause mw.uri.new to throw an error&lt;br /&gt;
    url = mw.ustring.gsub(url, '#$', '')&lt;br /&gt;
    url = mw.ustring.gsub(url, '%?$', '')&lt;br /&gt;
    &lt;br /&gt;
    -- If it's an HTTP[S] URL without the double slash, fix it.&lt;br /&gt;
    url = mw.ustring.gsub(url, '^[Hh][Tt][Tt][Pp]([Ss]?):(/?)([^/])', 'http%1://%3')&lt;br /&gt;
&lt;br /&gt;
    -- Handle URLs from Wikidata of the format http&amp;amp;#58;//&lt;br /&gt;
    url = mw.ustring.gsub(url, '^[Hh][Tt][Tt][Pp]([Ss]?)&amp;amp;#58;//', 'http%1://')&lt;br /&gt;
    &lt;br /&gt;
    local uri = safeUri(url)&lt;br /&gt;
    &lt;br /&gt;
    -- Handle URL's without a protocol and URL's that are protocol-relative, &lt;br /&gt;
    -- e.g. www.example.com/foo or www.example.com:8080/foo, and //www.example.com/foo&lt;br /&gt;
    if uri and (not uri.protocol or (uri.protocol and not uri.host)) and url:sub(1, 2) ~= '//' then&lt;br /&gt;
        url = 'http://' .. url&lt;br /&gt;
        uri = safeUri(url)&lt;br /&gt;
    end&lt;br /&gt;
    &lt;br /&gt;
    if text == '' then&lt;br /&gt;
        if uri then&lt;br /&gt;
            if uri.path == '/' then uri.path = '' end&lt;br /&gt;
            &lt;br /&gt;
            local port = ''&lt;br /&gt;
            if uri.port then port = ':' .. uri.port end&lt;br /&gt;
            &lt;br /&gt;
            text = mw.ustring.lower(uri.host or '') .. port .. (uri.relativePath or '')&lt;br /&gt;
        else -- URL is badly-formed, so just display whatever was passed in&lt;br /&gt;
            text = url&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
	-- Add &amp;lt;wbr&amp;gt; before _/.-# sequences&lt;br /&gt;
	text = mw.ustring.gsub(text,&amp;quot;(/+)&amp;quot;,&amp;quot;&amp;lt;wbr/&amp;gt;%1&amp;quot;)      -- This entry MUST be the first. &amp;quot;&amp;lt;wbr/&amp;gt;&amp;quot; has a &amp;quot;/&amp;quot; in it, you know.&lt;br /&gt;
	text = mw.ustring.gsub(text,&amp;quot;(%.+)&amp;quot;,&amp;quot;&amp;lt;wbr/&amp;gt;%1&amp;quot;)&lt;br /&gt;
	-- text = mw.ustring.gsub(text,&amp;quot;(%-+)&amp;quot;,&amp;quot;&amp;lt;wbr/&amp;gt;%1&amp;quot;) 	-- DISABLED for now&lt;br /&gt;
	text = mw.ustring.gsub(text,&amp;quot;(%#+)&amp;quot;,&amp;quot;&amp;lt;wbr/&amp;gt;%1&amp;quot;)&lt;br /&gt;
	text = mw.ustring.gsub(text,&amp;quot;(_+)&amp;quot;,&amp;quot;&amp;lt;wbr/&amp;gt;%1&amp;quot;)&lt;br /&gt;
	&lt;br /&gt;
    return mw.ustring.format('&amp;lt;span class=&amp;quot;url&amp;quot;&amp;gt;[%s %s]&amp;lt;/span&amp;gt;', url, text)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function p.url(frame)&lt;br /&gt;
    local templateArgs = frame.args&lt;br /&gt;
    local url = templateArgs[1] or ''&lt;br /&gt;
    local text = templateArgs[2] or ''&lt;br /&gt;
    return p._url(url, text)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
return p&lt;/div&gt;</summary>
		<author><name>imported&gt;Codename lisa</name></author>
		
	</entry>
</feed>