편집 요약 없음
잔글 인터위키 기호를 링크에 추가
 
(같은 사용자의 중간 판 19개는 보이지 않습니다)
12번째 줄: 12번째 줄:


         local baseText = wikiData[frame.args[1]]
         local baseText = wikiData[frame.args[1]]
         baseText = p._replace(baseText, '$1', frame.args[2])
         local addLang = ''
         baseText = p._replace(baseText, '$2', frame.args[3])
        if frame.args[2] ~=nil then
              addLang = frame.args[2]..':'
              baseText = ustring.gsub(baseText, '$1', frame.args[2])
         else
              baseText = ustring.gsub(baseText, '$1', 'en')
        end
 
 
      local replacedDoc = ustring.gsub(frame.args[3], ' ', '%%%%20')
 
 
        baseText = ustring.gsub(baseText, '$2', replacedDoc )


         local exText = ''
         local exText = ''
23번째 줄: 34번째 줄:
         end
         end


         return '<span class="plainlinks">['..baseText..' '..exText..']</span>'
         return '<span class="plainlinks">['..baseText..' '..frame.args[1]..':'..addLang..exText..']</span>'
     end
     end


end
function p._replace(text, to_be_replaced, replace_with)
    local strFindStart, strFindEnd = ustring.find(text, to_be_replaced)
    local retText
    if strFindStart ~= nil then
        local nStringCnt = string.len(text)
        local retText = ustring.sub(text, 1, strFindStart-1) .. replace_with .. ustring.sub(text, strFindEnd+1, nStringCnt)
    else
        retText = text
    end
    return retText
end
end


return p
return p