הקוד ביחידה זו משמש לתבניות הבאות:


local p = {}

require "mw.ustring"

function p.remove_parents_internal( str )
    gsub = mw.ustring.gsub
    
    str=gsub(str, " *[(].*[)]","")
    return str
end

function p.remove_parents( frame )
    str = frame.args.string
    return p.remove_parents_internal(str)
end

function p.remove_sq_parents_internal( str )
    gsub = mw.ustring.gsub
    
    str=gsub(str, "^%[%[(.*)%|.*%]%]$","%1") -- [[x|y]] ==> x
    str=gsub(str, "^%[%[(.*)%]%]$","%1") -- [[x]] ==> x
    return str
end

function p.remove_sq_parents( frame )
    str = frame.args.string
    return p.remove_sq_parents_internal(str)
end

function p.only_parents_contents_internal( str )
    match = mw.ustring.match
    gsub = mw.ustring.gsub
    
    str=p.remove_sq_parents_internal(str)
    str=match(str, "%b()$") -- a(b) ==> (b) or nil
    if (str == nil) then return "" end

    str=gsub(str,"^%((.*)%)$", "%1") -- (b) ==> b
    return str
end

function p.only_parents_contents( frame )
    str = frame.args.string
    return p.only_parents_contents_internal(str)
end

function p.remove_linker_internal( str )
    gsub = mw.ustring.gsub

    local y = gsub(str, "^%[%[.*|(.*)%]%]$", "%1") -- [[x|y]] ==> y
    if y ~= str then
    	return y
    end

    local x = gsub(str, "^%[%[(.*)%]%]$", "%1") -- [[x]] ==> x
    return x
end

function p.remove_linker( frame )
    str = frame.args.string
    return p.remove_linker_internal(str)
end

return p
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy