翻訳と辞書
Words near each other
・ メ=ゾシ
・ メ=ゾシ県
・ メ~テレ
・ メ~テレNEWS
・ メ~テレカフェ
・ メ~テレニュース
・ メ~テレワイドスーパーJチャンネル
・ メ~テレ劇場
・ メ~テレ日曜朝7時枠のアニメ
・ メ~テレ時代劇
・ モ
・ モ'・ベター・ブルース
・ モア
・ モア (たばこ)
・ モア (アルバム)
・ モア (曖昧さ回避)
・ モア (曲)
・ モア☆ゴル
・ モアイ
・ モアイ (グラディウス)


Dictionary Lists
翻訳と辞書 辞書検索 [ 開発暫定版 ]
スポンサード リンク

モジュール:WLink : ミニ英和和英辞書
モジュール:WLink[える]
=====================================
〔語彙分解〕的な部分一致の検索結果は以下の通りです。

ジュール : [じゅーる]
 【名詞】 1. joule 2. (n) joule
: [ちょうおん]
 (n) long vowel mark (usually only used in katakana)

モジュール:WLink : ウィキペディア日本語版
モジュール:WLink[える]
local WLink = ;
--=]

-- local globals
local URLutil = false;

local utilURL = function ()
-- Attach URLutil library module
-- Postcondition:
-- Returns table, with URLutil library
-- Throws error, if not available
if not URLutil then
local lucky, util = pcall( require, "Module:URLutil" );
if lucky then
if type( util ) == "table" then
URLutil = util.URLutil();
end
util = "library URLutil invalid";
end
if type( URLutil ) ~= "table" then
error( util, 0 );
end
end
return URLutil;
end -- utilURL()

local contentExtlink = function ( attempt )
-- Retrieve span of external link between brackets
-- Precondition:
-- attempt -- string, with presumable link
-- the first char is expected to be "", 2, true );
if r3 then
local s = attempt:sub( 2, r3 - 1 );
local i = s:find( "", url, show );
else
r = adjust;
end
end
else
r = false;
end
return r;
end -- WLink.formatURL()

function WLink.getArticleBase( attempt )
-- Retrieve generic article title, no fragment nor brackets
-- Precondition:
-- attempt -- string, with wikilink or page title
-- current page title, if missing
-- Postcondition:
-- Returns string, with identified lemma, or all
-- false on invalid format
local r;
if attempt then
local m;
r, m = target( attempt, true );
if m ~= 2 then
r = false;
end
else
r = mw.title.getCurrentTitle().text;
end
if r then
local sub = r:match( "^(.
*%S)
*%(.+%)$" );
if sub then
r = sub;
end
end
return r;
end -- WLink.getArticleBase()

function WLink.getBaseTitle( attempt )
-- Retrieve last segment in subpage, no fragment
-- Precondition:
-- attempt -- string, with wikilink or page title
-- Postcondition:
-- Returns string, with identified segment, or all
local r;
local s, m = target( attempt, true );
if m == 2 then
local sub = s:match( "/(+)$" );
if sub then
r = sub;
else
r = s;
end
else
r = false;
end
return r;
end -- WLink.getBaseTitle()

function WLink.getExtension( attempt )
-- Retrieve media extension
-- Precondition:
-- attempt -- string, with wikilink (media link) or page title
-- if URL, PDF may be detected
-- Postcondition:
-- Returns string, with detected downcased media type
-- false if no extension found
local r = false;
local s, m = target( attempt );
if m == 2 then
s = s:match( "%.(%a+)$" );
if s then
r = s:lower();
end
elseif s:upper():match( "(PDF)%W?" ) then
r = "pdf";
end
return r;
end -- WLink.getExtension()

function WLink.getFile( attempt )
-- Retrieve media page identifier
-- Precondition:
-- attempt -- string, with wikilink (media link) or page title
-- Postcondition:
-- Returns string, with detected file title
-- no namespace nor project
-- false if no file found
local r = false;
local s, m = target( attempt );
if m == 2 then
local slow = ":" .. s:lower();
local find = function ( a )
local seek = string.format( ":%s:().+%%.%%a+$",
a:lower() );
local join = slow:find( seek );
local ret;
if join then
ret = s:sub( join + #a + 1 );
end
return ret;
end;
r = find( "file" );
if not r then
local trsl = mw.site.namespaces;
r = find( trsl.name );
if not r then
trsl = trsl.aliases;
for k, v in pairs( trsl ) do
r = find( v );
if r then
break; -- for k, v
end
end -- for k, v
end
end
end
return r;
end -- WLink.getFile()

function WLink.getFragment( attempt )
-- Retrieve fragment
-- Precondition:
-- attempt -- string, with presumable fragment
-- Postcondition:
-- Returns string, with detected fragment
-- false if no address found
local r = false;
local s, m = target( attempt );
if s then
local i = s:find( "#", 1, true );
if i then
if i > 1 then
s = s:sub( i - 1 );
i = 2;
end
if s:find( "&#", 1, true ) then
s = mw.text.decode( s );
i = s:find( "#", 1, true );
if not i then
s = "";
i = 0;
end
end
s = s:sub( i + 1 );
r = mw.text.trim( s );
if r == "" then
r = false;
elseif m == 2 then
r = r:gsub( "%.(%x%x)", "%%%1" )
:gsub( "_", " " );
r = mw.uri.decode( r, "PATH" );
end
end
end
return r;
end -- WLink.getFragment()

function WLink.getLanguage( attempt )
-- Retrieve language project identifier
-- Precondition:
-- attempt -- string, with wikilink or page title
-- Postcondition:
-- Returns string, with detected downcased language identifier
-- false if no project language found
local r = false;
local s, m = WLink.getTarget( attempt );
if m == 2 then
local w = WLink.wikilink( s );
if w and w.lang then
r = w.lang;
end
end
return r;
end -- WLink.getLanguage()

function WLink.getNamespace( attempt )
-- Retrieve namespace number
-- Precondition:
-- attempt -- string, with wikilink or page title
-- Postcondition:
-- Returns number, of detected namespace
-- false if no namespace found
local r = false;
local s, m = WLink.getTarget( attempt );
if m == 2 then
local w = WLink.wikilink( s );
if w and not w.lang and not w.project and w.ns then
r = w.ns;
end
end
return r;
end -- WLink.getNamespace()

function WLink.getPlain( attempt )
-- Retrieve text with all links replaced by link titles
-- Precondition:
-- attempt -- string, with wikitext
-- Postcondition:
-- Returns string, with modified wikitext without links
local r = attempt;
local i = 1;
local j, k, n, lean, s, shift, space, suffix;
while ( true ) do
j = r:find( ";
if space then
space = space.id;
end
end
if space == 6 or space == 14 then
shift = "";
elseif not shift then
shift = s;
end
else
s, shift = extractExtlink( suffix );
if not shift then
shift = "";
end
i = i - 1;
end
if j > 1 then
s = r:sub( 1, j - 1 );
else
s = "";
end
r = string.format( "%s%s%s",
s, shift, r:sub( n + i ) );
i = i + #shift;
else
break; -- while true
end
else
break; -- while true
end
end -- while true
return r;
end -- WLink.getPlain()

function WLink.getProject( attempt )
-- Retrieve wikifarm project identifier
-- Precondition:
-- attempt -- string, with wikilink or page title
-- Postcondition:
-- Returns string, with detected downcased project identifier
-- false if no project identifier found
local r = false;
local s, m = WLink.getTarget( attempt );
if m == 2 then
local w = WLink.wikilink( s );
if w and w.project then
r = w.project;
end
end
return r;
end -- WLink.getProject()

function WLink.getTarget( attempt )
-- Retrieve first target (wikilink or URL)
-- Precondition:
-- attempt -- string, with presumable link somewhere
-- Postcondition:
-- Returns string, number
-- string, with first detected link target
-- number, with number of brackets, if found
-- false if nothing found
local r1 = false;
local r2 = false;
local i = attempt:find( "(%a+)(%.%l%l%.)(%a+)$";
local show = URLutil.getTop3domain( attempt );
if show then
local search = "." .. show;
local s1, s2, s3 = search:match( scan );
if s2 then
if not second:find( s2, 1, true ) then
show = string.format( "%s.%s", s2, s3 );
end
else
show = false;
end
end
if not show then
show = URLutil.getTop2domain( attempt );
end
r = string.format( "%s ", attempt, show );
else
r = attempt;
end
return r;
end -- WLink.getWeblink()

function WLink.isBracketedLink( attempt )
-- Does attempt match a bracketed link?
-- Precondition:
-- attempt -- string, with presumable link somewhere
-- Postcondition:
-- Returns boolean
local r = false;
local i = attempt:find( "", 5 );
c = "|";
else
n = s:find( "%]", 8 );
c = "%s%S";
end
if n then
local m = s:find( c, 2 );
if m and m + 1 < n and WLink.getTarget( attempt ) then
r = true;
end
end
end
return r;
end -- WLink.isTitledLink()

function WLink.isValidLink( attempt )
-- Does attempt match a link?
-- Precondition:
-- attempt -- string, with presumable link somewhere
-- Postcondition:
-- Returns boolean
local s, r = WLink.getTarget( attempt );
if r then
r = true;
end
return r;
end -- WLink.isValidLink()

function WLink.isWikilink( attempt )
-- Does attempt match a wikilink?
-- Precondition:
-- attempt -- string, with presumable link somewhere
-- Postcondition:
-- Returns boolean
local s, m = WLink.getTarget( attempt );
return ( m == 2 );
end -- WLink.isWikilink()

function WLink.wikilink( attempt )
-- Retrieve wikilink components
-- Precondition:
-- attempt -- string, with presumable link
-- expected to be enclosed in "" ]"
-- else wikilink
-- Postcondition:
-- Returns table or false
-- table of assignments with
-- type is one of "lead",
-- "project", "lang", "ns", "space", "title"
-- false if nothing found
local s = contentWikilink( attempt );
local got, n, r;
if not s then
s = attempt;
end
i = s:find( "|", 1, true );
if i then
s = s:sub( 1, i - 1 );
end
got = mw.text.split( s, ":" );
n = table.maxn( got );
if n == 1 then
r = ;
else
local j, k, o, v;
r = ;
if n > 4 then
k = 4;
else
k = n - 1;
end
j = k;
for i = 1, j do
s = mw.text.trim( goti );
if s ~= "" then
o = mw.site.namespaces;
if o then
r.ns = o.id;
r.space = o.name;
k = i + 1;
j = i - 1;
break; -- for i
end
end
end -- for i
for i = 1, j do
o, v = prefix( goti , ( i == 1 ) );
if o then
if ro then
k = i;
break; -- for i
else
ro = v;
end
else
k = i;
break; -- for i
end
end -- for i
for i = k, n do
r.title = r.title .. goti ;
if i < n then
r.title = r.title .. ":";
end
end -- for i
end
if r.lead and
( r.project or not r.title or
( not r.lang and r.ns ~= 6 and r.ns ~= 14 ) ) then
r.lead = false;
end
return r;
end -- WLink.wikilink()

local function Template( frame, action, leave, lone )
-- Run actual code from template transclusion
-- Precondition:
-- frame -- object
-- action -- string, with function name
-- leave -- true: keep whitespace around
-- lone -- true: permit call without parameters
-- Postcondition:
-- Return string; might be error message
local k, v;
local lucky = true;
local s = false;
local r = false;
for k, v in pairs( frame.args ) do
if k == 1 then
if leave then
s = v;
else
s = mw.text.trim( v );
end
elseif k ~= "template" then
lucky = false;
if r then
r = r .. "|";
else
r = "Unknown parameter: ";
end
r = string.format( "%s%s=", r, k );
end
end -- for k, v
if lucky then
if s or lone then
lucky, r = pcall( WLinkaction , s );
else
r = "Parameter missing";
lucky = false;
end
end
if lucky then
if type( r ) == "boolean" then
if r then
r = "1";
else
r = "";
end
end
else
r = string.format( "%s", r );
end
return r;
end -- Template()

-- Export
local p = ;
p.ansiPercent = function ( frame )
return Template( frame, "ansiPercent" );
end
p.formatURL = function ( frame )
return Template( frame, "formatURL" );
end
p.getArticleBase = function ( frame )
return Template( frame, "getArticleBase", false, true );
end
p.getBaseTitle = function ( frame )
return Template( frame, "getBaseTitle" );
end
p.getExtension = function ( frame )
return Template( frame, "getExtension" );
end
p.getFile = function ( frame )
return Template( frame, "getFile" );
end
p.getFragment = function ( frame )
return Template( frame, "getFragment" );
end
p.getInterwiki = function ( frame )
return Template( frame, "getInterwiki" );
end
p.getLanguage = function ( frame )
return Template( frame, "getLanguage" );
end
p.getNamespace = function ( frame )
return tostring( Template( frame, "getNamespace" ) );
end
p.getPlain = function ( frame )
return Template( frame, "getPlain" );
end
p.getProject = function ( frame )
return Template( frame, "getProject" );
end
p.getTarget = function ( frame )
return Template( frame, "getTarget" );
end
p.getTargetPage = function ( frame )
return Template( frame, "getTargetPage" );
end
p.getTitle = function ( frame )
return Template( frame, "getTitle" );
end
p.getWeblink = function ( frame )
return Template( frame, "getWeblink" );
end
p.isBracketedLink = function ( frame )
return Template( frame, "isBracketedLink" );
end
p.isBracketedURL = function ( frame )
return Template( frame, "isBracketedURL" );
end
p.isCategorization = function ( frame )
return Template( frame, "isCategorization" );
end
p.isExternalLink = function ( frame )
return Template( frame, "isExternalLink" );
end
p.isInterlanguage = function ( frame )
return Template( frame, "isInterlanguage" );
end
p.isInterwiki = function ( frame )
return Template( frame, "isInterwiki" );
end
p.isMedia = function ( frame )
return Template( frame, "isMedia" );
end
p.isTitledLink = function ( frame )
return Template( frame, "isTitledLink" );
end
p.isValidLink = function ( frame )
return Template( frame, "isValidLink" );
end
p.isWeblink = function ( frame )
return Template( frame, "isWeblink" );
end
p.isWikilink = function ( frame )
return Template( frame, "isWikilink" );
end
p.WLink = function ()
return WLink;
end
return p;


抄文引用元・出典: フリー百科事典『 ウィキペディア(Wikipedia)
ウィキペディアで「モジュール:WLink」の詳細全文を読む




スポンサード リンク
翻訳と辞書 : 翻訳のためのインターネットリソース

Copyright(C) kotoba.ne.jp 1997-2016. All Rights Reserved.