跳转到内容

Module:IncrementParams

轻之舟百科,让知识轻装启航
闲敲棋子落灯花​(留言 | 贡献)2026年8月9日 (日) 15:44的版本 (来源:求闻编者,https://www.qiuwenbaike.cn/wiki/Module:IncrementParams,许可证:CC BY-SA 4.0(https://creativecommons.org/licenses/by-sa/4.0/))
(差异) ←上一版本 | 最后版本 (差异) | 下一版本→ (差异)

此模块的文档可以在Module:IncrementParams/doc创建

-- 第一步:點擊頁面頂部「編輯」按鈕開始編輯本模組。
-- 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 = [==========[
| label187 = 校风
| data187 = {{{校风|}}}

| label188 = 教风
| data188 = {{{教风|{{{jiaofeng|}}}}}}

| label189 = 学风
| data189 = {{{学风|{{{xuefeng|}}}}}}

| label190 = 標語
| data190 = {{{slogan|{{{标语|}}} }}}

| label191 = 口号
| data191 = {{if empty|{{{fight_song|}}}|{{{fightsong|}}}|{{{口号|}}} }}

| label200 = 校庆日
| data200 = {{{anniversary|{{{校庆日|{{{校慶日|}}}}}}}}}{{{紀念日|{{{Celebration|}}}}}}

| label201 = 校歌
| data201 = {{{song|{{{校歌|}}}}}}

| label202 = 吉祥物
| data202 = {{#if: {{{mascot|}}} | {{{mascot}}} {{{mascot_image|}}}{{{mascot image|}}} }}{{{吉祥物|{{{吉祥物|}}}}}}{{{Mascot|}}}

| label203 = 校树
| data203 = {{{tree|}}}

| label204 = 校色
| data204 = {{if empty|{{{colors|}}}|{{{colours|}}}|{{{校色|}}}|{{{顏色|}}}|{{{Colors|}}}|{{{school_colors|}}}|{{{schoolcolors|}}}|{{{school_colours|}}}|{{{schoolcolours|}}}}}

| label206 = 校刊
| data206 = {{if empty|{{{publication|}}}|{{{magazine|}}} }}|{{{magazine|{{{刊物|{{{刊物|}}}}}}}}}

| label207 = 校报
| data207 = {{{newspaper|}}}

| label208 = 年度校刊
| data208 = {{{yearbook|}}}

| label209 = 产品
| data209 = {{{products|}}}

| label210 = 资金
| data210 = {{{endowment|}}}

| label211 = 預算
| data211 = {{{budget|}}}

| label212 = 学费
| data212 = {{if empty|{{{fees|}}}|{{{tuition|}}}}}

| label213 = 年度学费
| data213 = {{if empty|{{{annual_tuition|}}} | {{{annual tuition|}}} }}

| label214 = 盈利
| data214 = {{{revenue|}}}

| label215 = 服务社群
| data215 = {{{communities|}}}

| label216 = {{#if:{{{成员校|}}}|成员校|附属学校}}
| data216 = {{if empty|{{{成员校|}}} | {{{feeder_schools|}}} | {{{main feeder schools|}}} | {{{feeders|}}} }}

| label217 = 姐妹学校
| data217 = {{{sister_school|}}}

| label218 = 毕业生主要目的地
| data218 = {{if empty|{{{feeder_to|}}} | {{{main feeder school for|}}} }}

| label219 = 毕业生{{#if: {{{graduates_year|{{{year|}}}}}} | {{nobold|({{{graduates_year|{{{year}}}}}})}} }} 
| data219 = {{if empty|{{{graduates|}}} | {{{Graduates|}}} }}

| label220 = 著名校友
| data220 = {{{alumni|}}}{{{alumni_name|}}}

| label221 = [[诺贝尔奖]]得主
| data221 = {{{nobel_laureates|}}}

| label222 = -{zh-hans:信息; zh-hant:資訊}-
| data222 = {{{information|}}}

| label223 = {{#if: {{{student_union_label|}}} | {{{student_union_label}}} | 学生会 }}
| data223 = {{{student_union|}}}

| label235 = -{zh-hans:学生会; zh-hant:學生會}-
| data235 = {{{su|}}}

| label236 = -{zh-hans:学生会主席; zh-hant:學生會長; zh-hk:學生會主席; zh-mo:學生會主席; zh-sg:学生会干事会主席;}-
| data236 = {{{sc|}}}

| label237 = -{zh-hans:学生会代表会主席; zh-hant:學生代表;}-
| data237 = {{{cs|}}}

| label238 = -{zh-hans:社团联合会主席; zh-hant:社聯會; zh-sg:社团联席会主席;}-
| data238 = {{{cc|}}}

| label239 = -{zh-hans:社团; zh-hant:社團; zh-hk:社; zh-mo:社}-
| data239 = {{{houses|}}}{{{house|}}}

| label240 = -{zh-hans:体育; zh-hant:體育}-
| data240 = {{{athletics|}}}

| label241 = -{zh-hans:体育协会; zh-hant:體育協會}-
| data241 =  {{if empty|{{{athletics_conference|}}}|{{{athletics conference|}}}|{{{athletic_conference|}}}|{{{athletic conference|}}}|{{{conference|}}}}}

| label242 = -{zh-hans:运动项目强项; zh-hant:運動強項}-
| data242 = {{{sports|}}}{{{体育项目|{{{體育項目|}}}}}}{{{niche|}}}

| label243 = {{#if: {{{teams_label|}}} | {{{teams_label}}} | 校队 }}
| data243 = {{if empty|{{{teams|}}}|{{{team_name|}}} | {{{team name|}}} | {{{teamname|}}} }}

| label245 = {{#if: {{{rival|}}} | 对手 }}
| data245 = {{if empty|{{{rival|}}} | {{{rivals|}}} }}

| label254 = {{#if: {{{free_label|}}} | {{{free_label|}}}}}
| data254 = {{#if: {{{free_label|}}} | {{{free|{{{free_text|}}}}}} }}

| label255 = {{if empty|{{{free_label1|}}}|{{{free_label_1|}}}}}
| data255 = {{#if: {{{free_label1|{{{free_label_1|}}}}}} | {{{free_1|{{{free_text1|}}}}}} }}

| label256 = {{if empty|{{{free_label2|}}}|{{{free_label_2|}}}}}
| data256 = {{#if: {{{free_label2|{{{free_label_2|}}}}}} | {{{free_2|{{{free_text2|}}}}}} }}

| label257 = {{if empty|{{{free_label3|}}}|{{{free_label_3|}}}}}
| data257 = {{#if: {{{free_label3|{{{free_label_3|}}}}}} | {{{free_3|{{{free_text3|}}}}}} }}

| label258 = {{if empty|{{{free_label4|}}}|{{{free_label_4|}}}}}
| data258 = {{#if: {{{free_label4|{{{free_label_4|}}}}}} | {{{free_4|{{{free_text4|}}}}}} }}

| label259 = {{if empty|{{{free_label5|}}}|{{{free_label_5|}}}}}
| data259 = {{#if: {{{free_label5|{{{free_label_5|}}}}}} | {{{free_5|{{{free_text5|}}}}}} }}

| label306 = 電話號碼
| data306 = {{if empty|{{{telephone|}}}|{{{tel|}}}{{{电话|{{{電話|{{{電話號碼|{{{电话号码|}}} }}} }}}}}}}}

| label307 = 传真號碼
| data307 = {{{fax|}}}

| label308 = {{nowrap|学校网址}}
| data308 = {{#if:{{{website|}}}{{{網站|{{{网站|}}}}}}{{{homepage|}}}{{{url|}}}{{{Website|}}}
               |{{#ifeq:{{if empty|{{{website|}}}{{{網站|{{{网站|{{{Website|}}}}}}}}}|{{{homepage|}}}|{{{url|}}}}}|hide<!--
              -->|<!--
              -->|{{if empty|{{{website|}}}{{{網站|{{{网站|{{{Website|}}}}}}}}}|{{{homepage|}}}|{{{url|}}}}}
                }}
               |{{official url}}
             }}

| rowstyle314 = font-size:small
| data314 = {{{footnotes|}}}{{{脚注|{{{腳註|}}}}}}

| data315   = {{#if:{{{picture|}}}
  |{{#invoke:InfoboxImage|InfoboxImage|image={{{picture}}} }}
  }}
| data316   = {{{picture_caption|}}}

| data317   = {{#if:{{{picture2|}}}
  |{{#invoke:InfoboxImage|InfoboxImage|image={{{picture2}}} }}
  }}
| data318   = {{{picture_caption2|}}}

| header324 = {{#if: {{{uniform|}}} | 校服樣式}}
| data325   =  {{#if:{{{uniform|}}}
  |{{#invoke:InfoboxImage|InfoboxImage|image={{{uniform}}} }}
  }}
| data326   = {{{uniform_caption|}}}

| header334 = {{{module|}}}
| data335  = {{{module2|}}}
]==========]

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