跳转到内容

模組:IncrementParams

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

这是本页的一个历史版本,由Dabao qian留言 | 贡献2020年7月20日 (一) 14:46 (这玩意到底能用吗)编辑。这可能和当前版本存在着巨大的差异。

-- 第一步:點擊頁面頂部「編輯」按鈕開始編輯本模組。
-- 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 = [==========[
   |group4 = [[电影频道节目中心]]
   | list4 =
* [[CHC家庭影院频道|家庭影院]]<sup>HD</sup>
* [[CHC高清电影频道|高清电影]]<sup>HD</sup>
* [[CHC动作电影频道|动作电影]]<sup>HD</sup>
   |group5 = [[中广电传媒|中广电传媒有限公司]]
   | list5 =
* [[CBN每日影院频道|每日影院]]<sup>HD</sup>
* [[CBN幸福剧场频道|幸福剧场]]<sup>HD</sup>
* [[CBN幸福娱乐频道|幸福娱乐]]<sup>HD</sup>
* [[CBN风尚生活频道|风尚生活]]<sup>HD</sup>
* [[冰雪体育频道|冰雪体育]]<sup>HD</sup>
* [[马拉松频道|马拉松]]<sup>HD</sup>
* [[每日健身频道|每日健身]]<sup>HD</sup>
* [[体育赛事频道SIZE|体育赛事SIZE]]<sup>HD</sup>
   |group6 = [[中国教育电视台]]
   | list6 =
* [[中国教育电视台早期教育频道|早期教育]]
   |group7 = [[中国气象局]]
   | list7 =
* [[中国天气频道|中国天气]]
   |group8 = [[中华文化促进会]]
   | list8 = 
* [[中央数字电视书画频道|书画]]
* [[音像世界频道|音像世界]]<sup>HD</sup>
   |group9 = [[中国健康教育中心]]
   | list9 =
* [[百姓健康频道|百姓健康]]<sup>HD</sup>
   |group10 = [[北京广播电视台]]
   | list10 =
* [[北广传媒优优宝贝电视频道|优优宝贝]]
* [[北广传媒车迷频道|车迷]]
* [[北广传媒中华特产频道|中华特产]]
* [[北广传媒四海钓鱼频道|四海钓鱼]]<sup>HD</sup>
* [[北广传媒环球旅游频道|环球旅游]]
* [[北广传媒新娱乐频道|新娱乐]]
   |group11 = [[山西广播电视台]]
   | list11 =
* [[山西广播电视台彩民在线频道|彩民在线]]
* [[山西广播电视台老年福频道|老年福]]
* [[优购物频道|优购物]]<sup>HD</sup>
   |group12 = [[呼和浩特广播电视台]]
   | list12 = 
* [[足球频道|足球]]<sup>HD</sup>
   |group13 = [[辽宁广播电视台]]
   | list13 =
* [[游戏竞技频道|游戏竞技]]<sup>HD</sup>
* [[电子体育频道|电子体育]]<sup>HD</sup>
* [[网络棋牌频道|网络棋牌]]<sup>HD</sup>
* [[新动漫频道|新动漫]]<sup>HD</sup>
* [[家庭理财频道|家庭理财]]<sup>HD</sup>
   |group14 = [[吉林广播电视台]]
   | list14 =
* [[吉林广播电视台篮球频道|篮球]]
   |group15 = [[上海广播电视台]]
   | list15 =
* [[第一财经电视|东方财经]]
* [[动漫秀场频道|动漫秀场]]<sup>HD</sup>
* [[游戏风云频道|游戏风云]]<sup>HD</sup>
* [[全纪实频道|全纪实]]<sup>HD</sup>
* [[七彩戏剧频道|七彩戏剧]]
* [[法治天地频道|法治天地]]<sup>HD</sup>
* [[魅力音乐频道|魅力音乐]]<sup>HD</sup>
* [[劲爆体育频道|劲爆体育]]<sup>HD</sup>
* [[都市剧场频道|都市剧场]]<sup>HD</sup>
* [[欢笑剧场频道|欢笑剧场]]<sup>HD</sup>
* [[极速汽车频道|极速汽车]]<sup>HD</sup>
* [[幸福彩频道|幸福彩]]<sup>HD</sup>
* [[金色频道|金色]]<sup>HD</sup>
* [[生活时尚频道|生活时尚]]<sup>HD</sup>
* [[新视觉高清频道|新视觉]]<sup>HD</sup>
   |group16 = [[江苏省广播电视总台]]
   | list16 =
* [[江苏电视台靓妆频道|靓妆]]<sup>HD</sup>
* [[江苏电视台财富天下频道|财富天下]]
   |group17 = [[浙江广播电视集团]]
   | list17 =
* [[浙江电视台留学世界频道|留学世界]]<sup>HD</sup>
   |group18 = [[杭州广播电视台]]
   | list18 =
* [[求索纪录频道|求索纪录]]<sup>HD</sup>
   |group19 = [[安徽广播电视台]]
   | list19 =
* [[安徽广播电视台家家购物频道|家家购物]]
* [[安徽广播电视台人物频道|人物]]
   |group20 = [[江西广播电视台]]
   | list20 =
* [[江西电视台风尚购物频道|风尚购物]]
* [[江西电视台陶瓷频道|陶瓷]]<sup>HD</sup>
   |group21 = [[山东广播电视台]]
   | list21 =
* [[山东广播电视台收藏天下频道|收藏天下]]
   |group22 = [[青岛市广播电视台]]
   | list22 =
* [[中华美食频道|中华美食]]<sup>HD</sup>
   |group23 = [[河南广播电视台]]
   | list23 =
* [[河南广播电视台梨园频道|梨园]]<sup>HD</sup>
* [[河南广播电视台武术世界频道|武术世界]]<sup>HD</sup>
* [[河南广播电视台文物宝库频道|文物宝库]]<sup>HD</sup>
* [[国学频道|国学]]
   |group25 = [[湖北广播电视台]]
   | list25 = 
* [[精彩影视频道|精彩影视]]<sup>HD</sup>
* [[湖北广播电视台休闲指南频道|休闲指南]]
   |group26 = [[湖南广播电视台]]
   | list26 =
* [[湖南广播电视台茶频道|茶频道]]<sup>HD</sup>
* [[湖南广播电视台先锋乒羽频道|先锋乒羽]]<sup>HD</sup>
* [[湖南广播电视台快乐垂钓频道|快乐垂钓]]<sup>HD</sup>
   |group29 = [[广东广播电视台]]
   | list29 =
* [[广东广播电视台高尔夫频道|高尔夫]]<sup>HD</sup>
* [[广东广播电视台英语辅导频道|英语辅导]]
* [[广东广播电视台现代教育频道|现代教育]]
   |group30 = [[深圳广播电影电视集团]]
   | list30 =
* [[深圳广电集团DV生活频道|DV生活]]
   |group31 = [[重庆广播电视总台]]
   | list31 =
* [[重庆电视台汽摩频道|汽摩]]<sup>HD</sup>
   |group32 = [[成都广播电视台]]
   | list32 =
* [[美食天府频道|美食天府]]
   |group33 = [[贵州广播电视台]]
   | list33 =
* [[贵州广播电视台天元围棋频道|天元围棋]]
* [[贵州广播电视台摄影频道|摄影]]
   |group35 = [[甘肃省广播电影电视总台]]
   | list35 =
* [[家政频道|家政]]
]==========]

-- 第四步:保存本模組。
-- 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