User:Alexbot/CPLF-process
CPLF=Cross-project link fix is a planning bot script of Alexbot.
「跨計劃連接修復」,是本機器人執行計劃的其中之一。
這個程式是做什麼的? / What is this script do?
檢查,修復或移除頁面內文中的跨計劃連結。
Check the texts in page, and fix or remove cross-project link.
原理
(Sorry I can't use english to explain others)
讀取頁面→抓取所有[[a|b]]中的a→如果符合為跨計劃連結(ex:[[:w:(*)]] or [[:n:(*)]])→連至該計劃中並檢查該頁面→
→如果頁面不存在→移除該連結,只留下b。
→如果存在→不需動作
→如果為重定向→抓取該頁面取得重定向目標→更新本地文字
(English :-P)
Read page source -> Grab all the "a" with in [[a|b]] -> look for interwiki link matches (e.g. [[:w:(*)]] or [[:n:(*)]]) -> move on to the respective wiki -> remove the link if "a" does not exist in that wiki /or/ correct "a" if its a redirection page.