跳转到内容

模組:IncrementParams

维基百科,自由的百科全书

这是本页的一个历史版本,由BlackShadowG留言 | 贡献2024年1月4日 (四) 10:13 (// Edit via Wikiplus)编辑。这可能和当前版本存在着巨大的差异。

-- 第一步:點擊頁面頂部「編輯」按鈕開始編輯本模組。
-- STEP 1: Click on the "edit" tab at the top of the page to edit this module.

-- 第二步:如果你想加上1以上的數目,請修改等號後的數字。
-- STEP 2: if you want to increment by a number other than 1, put that number below, after the equals sign. 
local increment = 1

-- 第三步:用你想增加數字的模板部分替換下方內容。
-- STEP 3: Replace the example template text with the template text that you wish to increment.
local templatetext = [==========[
| header54    = {{#if:{{{interests|}}}|興趣}}

| data55      = {{#if:{{{interests|}}}|<div style="text-align: left">
{{{interests|}}}
</div>}}

| header56    = {{#if:{{{website|}}}{{{blog|}}}{{{email|}}}{{{icq|}}}{{{aim|}}}{{{gtalk|}}}{{{jabber|}}}{{{skype|}}}{{{yahoo|}}}{{{mac|}}}{{{irc|}}}{{{facebook|}}}{{{google+|}}}{{{instagram|}}}{{{linkedin|}}}{{{myspace|}}}{{{pinterest|}}}{{{twitter|}}}{{{youtube|}}}{{{flickr|}}}|聯繫方式}}

| label57     = 網站
| data57      = {{{website|}}}

| label58     = 網誌
| data58      = {{{blog|}}}

| label59     = 電子郵件
| data59      = {{{email|}}}

| label60     = [[ICQ]]
| data60      = {{#if:{{{icq|}}}|[http://people.icq.com/people/about_me.php?uin={{urlencode:{{{icq}}}}} {{{icq}}}]}}

| label61     = [[腾讯QQ|QQ]]
| data61      = {{#if:{{{QQ|}}}|[https://wpa.qq.com/msgrd?uin={{urlencode:{{{QQ}}}}} {{{QQ}}}]}}

| label62     = [[AIM (應用程式)|AIM]]
| data62      = {{{aim|}}}

| label63     = [[GTalk]]
| data64      = {{{gtalk|}}}

| label65     = [[XMPP]]
| data66      = {{{jabber|}}}

| label67     = [[Skype]]
| data67      = {{{skype|}}}

| label68     = [[雅虎]]
| data68      = {{#if:{{{yahoo|}}}|[http://profiles.yahoo.com/{{urlencode:{{{yahoo}}}}} {{{yahoo}}}]}}

| label69     = .Mac
| data69      = {{{mac|}}}

| label70     = [[IRC]]
| data70      = {{{irc|}}}

| label71     = [[Facebook]]
| data71      = {{#if:{{{facebook|}}}|[https://www.facebook.com/{{urlencode:{{{facebook}}}}} {{{facebook}}}]}}

| label72     = <!-- [[Google+]] -->
| data72      = 

| label73     = [[Instagram]]
| data73      = {{#if:{{{instagram|}}}|[https://www.instagram.com/{{urlencode:{{{instagram}}}}} {{{instagram}}}]}}

| label74     = [[領英]]
| data74     = {{#if:{{{linkedin|}}}|[http://www.linkedin.com/profile/view?&name={{urlencode:{{{linkedin}}}}} {{{linkedin}}}]}}

| label75     = [[Myspace]]
| data75      = {{{myspace|}}}

| label76     = [[Pinterest]]
| data76      = {{{pinterest|}}}

| label77     = [[Twitter]]
| data77      = {{#if:{{{twitter|}}}|[https://twitter.com/{{urlencode:{{{twitter}}}}} {{{twitter}}}]}}

| label78     = [[新浪微博]]
| data78      = {{#if:{{{weibo|}}}|[http://weibo.com/{{urlencode:{{{weibo}}}}} {{{weibo}}}]}}

| label79     = [[腾讯微博]]
| data79      = {{#if:{{{T.QQ|}}}|[http://t.qq.com/{{urlencode:{{{T.QQ}}}}} {{{T.QQ}}}]}}

| label80     = [[YouTube]]
| data80      = {{#if:{{{youtube|}}}|[https://www.youtube.com/user/{{urlencode:{{{youtube}}}}} {{{youtube}}}]}}

| label81     = [[YouTube]]
| data81      = {{#if:{{{channel|}}}|[https://www.youtube.com/channel/{{urlencode:{{{channel}}}}} {{{channelname}}}]}}

| label82     = [[土豆网]]
| data82      = {{#if:{{{tudou|}}}|{{{tudou}}}}}

| label83     = [[Flickr]]
| data83      = {{#if:{{{flickr|}}}|[https://www.flickr.com/photos/{{urlencode:{{{flickr}}}}} {{{flickr}}}]}}

| header84    = {{#if:{{{subpages|}}}|[[Special:Prefixindex/User:{{BASEPAGENAMEE}}|{{BASEPAGENAME}}子页面]]}}

| data85      = {{#if:{{{subpages|}}}|<div style="text-align: left">
{{{subpages|}}}
</div>}}

| header86    = {{#if:{{{joined_date|}}}{{{first_edit|}}}{{{autoconfirmed|}}}{{{confirmed|}}}{{{rollbacker|}}}{{{autopatrolled|}}}{{{mass_message_sender|}}}{{{admin|}}}{{{bureaucrat|}}}{{{check_user|}}}{{{overseer|}}}{{{edit_count|}}}{{{permissions|}}}{{{signature|}}}|帳戶統計}}

| label87     = 加入
| data87      = {{{joined_date|}}}

| label88     = 首次編輯
| data88      = {{{first_edit|}}}

| label89     = {{Nowrap|[[WP:CONFIRM|{{#if:{{{autoconfirmed|}}}|{{#if:{{{confirmed|}}}|確認用戶<br />}}自動確認用戶|{{#if:{{{confirmed|}}}|確認用戶}}}}]]}}
| data89      = {{#if:{{{autoconfirmed|}}}|{{#if:{{{confirmed|}}}|{{{confirmed}}}<br />}}{{{autoconfirmed}}}|{{#if:{{{confirmed|}}}|{{{confirmed}}}}}}}

| label90     = [[WP:RBK|回退員]]
| data90      = {{{rollbacker|}}}

| label91     = [[WP:AUTOPAT|巡查豁免員]]
| data91      = {{{autopatrolled|}}}

| label92     = [[WP:MMS|{{Abbr|MMS|大量訊息發送者}}]]
| data92      = {{{mass_message_sender|}}}

| label93     = [[WP:ADMIN|管理員]]
| data93      = {{{admin|}}}

| label94     = [[WP:CRAT|行政員]]
| data94      = {{{bureaucrat|}}}

| label95     = [[WP:CHK|用戶查核員]]
| data95      = {{{check_user|}}}

| label96     = [[WP:OVERSIGHT|監督員]]
| data96      = {{{overseer|}}}

| label97     = [[xtools:ec/zh.wikipedia.org/{{ROOTPAGENAME}}|{{color|{{{fontcolor|}}}|編輯統計}}]]
| data97      = {{{edit_count|}}}

| label98     = {{#if:{{{permissions|}}}|[[Special:UserRights/{{ROOTPAGENAMEE}}|權限]]}}
| data98      = {{{permissions|}}}

| label99     = 簽名
| data99      = {{{signature|}}}

| data100     = {{{module|}}}
| data101     = {{{module2|}}}
| data102     = {{{module3|}}}

| header103    = {{#if:{{{userboxes|}}}|用戶框}}

| data104      = {{#if:{{{userboxes|}}}|
<div style="margin: 0 auto; color: {{{fontcolor|#000000}}}; vertical-align: middle !important; text-align: center; font-size: 95%;">
{{{userboxes|}}}
</div>
}}

| header105    = {{{custom_header|}}}

| data106      = {{#if:{{{custom_data|}}}|<div style="text-align: left">
{{{custom_data|}}}
</div>}}
| label107     = {{{custom_label1|}}}
| data107      = {{{custom_data1|}}}
| label108     = {{{custom_label2|}}}
| data108      = {{{custom_data2|}}}
| label109     = {{{custom_label3|}}}
| data109      = {{{custom_data3|}}}
| label110     = {{{custom_label4|}}}
| data110      = {{{custom_data4|}}}
| label111     = {{{custom_label5|}}}
| data111      = {{{custom_data5|}}}
| label112     = {{{custom_label6|}}}
| data112      = {{{custom_data6|}}}
| label113     = {{{custom_label7|}}}
| data113      = {{{custom_data7|}}}
| label114     = {{{custom_label8|}}}
| data114      = {{{custom_data8|}}}
| label115     = {{{custom_label9|}}}
| data115      = {{{custom_data9|}}}
}}<noinclude>
{{Documentation}}</noinclude>

]==========]

-- 第四步:保存本模組。
-- STEP 4: Save this module.

-- 第五步:你現在可以通過以下代碼輸出數字增加後的代碼:
--                {{subst:#invoke:IncrementParams|main}}
-- 又或者直接拷貝下方模組文檔中的修改後的代碼。
-- STEP 5: You can now output the incremented text with the following code:
--                {{subst:#invoke:IncrementParams|main}}
-- Or you can simply copy and paste the text from this module's documentation.

-- 第六步:檢查輸出內容!在某些情況下本模組可能會產生部分假陽性結果。
-- 比如它會將「[[Some link|foo3=bar]]」修改為「[[Some link|foo4=bar]]」。
-- 你可以通過模板編輯頁面中「顯示變更」按鈕檢查是否有假陽性結果存在。
-- STEP 6: Check the output! In rare cases this module might produce false positives.
-- For example, it will change the text "[[Some link|foo3=bar]]" to "[[Some link|foo4=bar]]".
-- You can use the "show changes" function in the edit window of the template you are editing
-- to find any false positives.

-- 第七步:當你完成後,撤回你於本模組的編輯,避免下一個使用本模組的人對使用方法感到混淆。
-- 謝謝使用本模組!
-- STEP 7: When you are finished, undo your changes to this page, so that the next person
-- won't be confused by seeing any non-default values. Thanks for using this module!

local p = {}
 
local function replace(prefix, num, suffix)
    return '|' .. prefix .. tostring(tonumber(num) + increment) .. suffix .. '='
end
 
function p.main(frame)
    -- Increment the template text.
    templatetext = mw.ustring.gsub(templatetext, '|(%s*%a?[%a_%-]-%s*)([1-9]%d*)(%s*[%a_%-]-%a?%s*)=', replace)
    -- Add pre tags and escape html etc. if the pre option is set.
    if frame and frame.args and frame.args.pre and frame.args.pre ~= '' then
        templatetext = mw.text.nowiki(templatetext)
        templatetext = '<pre style="white-space:-moz-pre-wrap; white-space:-pre-wrap; '
            .. 'white-space:-o-pre-wrap; white-space:pre-wrap; word-wrap:break-word;">' 
            .. templatetext .. '</pre>'
    end
    return templatetext
end
 
return p