
<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="ain">
	<id>https://wiki.aynu.org:443/index.php?action=history&amp;feed=atom&amp;title=%E3%83%A2%E3%82%B8%E3%83%A5%E3%83%BC%E3%83%AB%3AURL</id>
	<title>モジュール:URL - werson huskoanpe</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.aynu.org:443/index.php?action=history&amp;feed=atom&amp;title=%E3%83%A2%E3%82%B8%E3%83%A5%E3%83%BC%E3%83%AB%3AURL"/>
	<link rel="alternate" type="text/html" href="https://wiki.aynu.org:443/index.php?title=%E3%83%A2%E3%82%B8%E3%83%A5%E3%83%BC%E3%83%AB:URL&amp;action=history"/>
	<updated>2026-04-10T03:54:55Z</updated>
	<subtitle>Tan wikiの tan sosに関する変更huskoanpe</subtitle>
	<generator>MediaWiki 1.41.0</generator>
	<entry>
		<id>https://wiki.aynu.org:443/index.php?title=%E3%83%A2%E3%82%B8%E3%83%A5%E3%83%BC%E3%83%AB:URL&amp;diff=194&amp;oldid=prev</id>
		<title>Mkpoli: 1版 をインポートしました</title>
		<link rel="alternate" type="text/html" href="https://wiki.aynu.org:443/index.php?title=%E3%83%A2%E3%82%B8%E3%83%A5%E3%83%BC%E3%83%AB:URL&amp;diff=194&amp;oldid=prev"/>
		<updated>2024-03-04T04:39:21Z</updated>

		<summary type="html">&lt;p&gt;1版 をインポートしました&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;ain&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← 古いwerson&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;2024 ppm 3 2024-03-04T13:39:21+00:00up 4 312024 (Kun.) 13:39時点におけるwerson&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;4&quot; class=&quot;diff-notice&quot; lang=&quot;ain&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(相違点なし)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;!-- diff cache key aynuwiki_db:diff:1.41:old-193:rev-194 --&gt;
&lt;/table&gt;</summary>
		<author><name>Mkpoli</name></author>
	</entry>
	<entry>
		<id>https://wiki.aynu.org:443/index.php?title=%E3%83%A2%E3%82%B8%E3%83%A5%E3%83%BC%E3%83%AB:URL&amp;diff=193&amp;oldid=prev</id>
		<title>wpja&gt;ネイ: 例示の変更</title>
		<link rel="alternate" type="text/html" href="https://wiki.aynu.org:443/index.php?title=%E3%83%A2%E3%82%B8%E3%83%A5%E3%83%BC%E3%83%AB:URL&amp;diff=193&amp;oldid=prev"/>
		<updated>2018-04-02T15:43:39Z</updated>

		<summary type="html">&lt;p&gt;例示の変更&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Asir sos&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;
local 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 = mw.text.trim(url or '')&lt;br /&gt;
    text = mw.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;''1=example.com''&amp;quot;, &amp;quot;''2=リンクの表示名（省略可）''&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;
&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;
        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;
    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 parentArgs = frame:getParent().args;&lt;br /&gt;
    local url = templateArgs[1] or parentArgs[1] or ''&lt;br /&gt;
    local text = templateArgs[2] or parentArgs[2]&lt;br /&gt;
    if not text then&lt;br /&gt;
    	url = url or extractUrl(templateArgs) or extractUrl(parentArgs);&lt;br /&gt;
	end&lt;br /&gt;
	text = text or ''&lt;br /&gt;
    return p._url(url, text)&lt;br /&gt;
end&lt;br /&gt;
function extractUrl(args)&lt;br /&gt;
	for name, val in pairs(args) do&lt;br /&gt;
		local url = name .. &amp;quot;=&amp;quot; .. val;&lt;br /&gt;
		url = mw.ustring.gsub(url, '^[Hh][Tt][Tt][Pp]([Ss]?):(/?)([^/])', 'http%1://%3')&lt;br /&gt;
		local uri = safeUri(url);&lt;br /&gt;
		if uri and uri.host then&lt;br /&gt;
			return url&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
return p&lt;/div&gt;</summary>
		<author><name>wpja&gt;ネイ</name></author>
	</entry>
</feed>