Jump to content

Module:IncrementParams

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by DannyS712 (talk | contribs) at 02:11, 12 March 2019 (incrementing). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

-- STEP 1: Click on the "edit" tab at the top of the page to edit this module.

-- STEP 2: if you want to increment by a number other than 1, put that number below, after the equals sign. 
local increment = 3

-- STEP 3: Replace the example template text with the template text that you wish to increment.
local templatetext = [==========[
| header16     = <includeonly>{{#if:{{{DecideDate|}}}|{{#if:{{{DecideYear|}}}|Court membership}}
                                   | {{#if:{{{ArgueDate|}}}|{{#if:{{{ArgueYear|}}}|Court membership}} }} }}</includeonly>
| data17       = <includeonly>
{{if either|{{{DecideDate|}}}|{{{DecideYear|}}}|{{Infobox SCOTUS case/courts|{{{DecideDate|}}}|{{{DecideYear|}}}}}
    <!--else if-->|{{if either|{{{ArgueDate}}}|{{{ArgueYear}}}|{{Infobox SCOTUS case/courts|{{{ArgueDate}}}|{{{ArgueYear}}}}}
    <!--else-->        |<!--Don't show court-->}}
}}</includeonly>

| header18     = <includeonly>{{#if:{{{Majority|}}}{{{Plurality|}}}{{{PerCuriam|}}}{{{Dissent|}}}|Case opinions}}</includeonly>
| data19       = <includeonly>{{#if:{{{QuestionsPresented|}}}||{{#if:{{{PerCuriam|}}}|''{{lang|la|Per curiam}}.''}} }}
</includeonly>
| label20      = Majority
| data20       = {{{Majority|}}}{{#if:{{{JoinMajority|}}}|, joined {{#ifeq:{{{JoinMajority}}}|unanimously||by }} {{{JoinMajority}}} }}
| label21      = Majority
| data21       = {{{Majority2|}}}{{#if:{{{JoinMajority2|}}}|, joined by {{{JoinMajority2}}} }}
| label22      = Majority
| data22       = {{{Majority3|}}}{{#if:{{{JoinMajority3|}}}|, joined by {{{JoinMajority3}}} }}

| label23      = Plurality
| data23       = {{{Plurality|}}}{{#if:{{{JoinPlurality|}}}|, joined by {{{JoinPlurality}}} }}
| label24      = Plurality
| data24       = {{{Plurality2|}}}{{#if:{{{JoinPlurality2|}}}|, joined by {{{JoinPlurality2}}} }}
| label25      = Plurality
| data25       = {{{Plurality3|}}}{{#if:{{{JoinPlurality3|}}}|, joined by {{{JoinPlurality3}}} }}
| label26      = Plurality
| data26       = {{{Plurality4|}}}{{#if:{{{JoinPlurality4|}}}|, joined by {{{JoinPlurality4}}} }}

| label27      = Seriatim opinion
| data27       = {{{Seriatim|}}}
| label28      = Seriatim opinion
| data28       = {{{Seriatim2|}}}
| label29      = Seriatim opinion
| data29       = {{{Seriatim3|}}}
| label30      = Seriatim opinion
| data30       = {{{Seriatim4|}}}
| label31      = Seriatim opinion
| data31       = {{{Seriatim5|}}}

| label32      = Concurrence
| data32       = {{{Concurrence|}}}{{#if:{{{JoinConcurrence|}}}|, joined by {{{JoinConcurrence}}} }}
| label33      = Concurrence
| data33       = {{{Concurrence2|}}}{{#if:{{{JoinConcurrence2|}}}|, joined by {{{JoinConcurrence2}}} }}
| label34      = Concurrence
| data34       = {{{Concurrence3|}}}{{#if:{{{JoinConcurrence3|}}}|, joined by {{{JoinConcurrence3}}} }}
| label35      = Concurrence
| data35       = {{{Concurrence4|}}}{{#if:{{{JoinConcurrence4|}}}|, joined by {{{JoinConcurrence4}}} }}
| label36      = Concurrence
| data36       = {{{Concurrence5|}}}{{#if:{{{JoinConcurrence5|}}}|, joined by {{{JoinConcurrence5}}} }}
| label37      = Concurrence
| data37       = {{{Concurrence6|}}}{{#if:{{{JoinConcurrence6|}}}|, joined by {{{JoinConcurrence6}}} }}
| label38      = Concurrence
| data38       = {{{Concurrence7|}}}{{#if:{{{JoinConcurrence7|}}}|, joined by {{{JoinConcurrence7}}} }}
| label39      = Concurrence
| data39       = {{{Concurrence8|}}}{{#if:{{{JoinConcurrence8|}}}|, joined by {{{JoinConcurrence8}}} }}

| label40      = Concur/dissent
| data40       = {{{Concurrence/Dissent|}}}{{#if:{{{JoinConcurrence/Dissent|}}}|, joined by {{{JoinConcurrence/Dissent}}} }}
| label41      = Concur/dissent
| data41       = {{{Concurrence/Dissent2|}}}{{#if:{{{JoinConcurrence/Dissent2|}}}|, joined by {{{JoinConcurrence/Dissent2}}} }}
| label42      = Concur/dissent
| data42       = {{{Concurrence/Dissent3|}}}{{#if:{{{JoinConcurrence/Dissent3|}}}|, joined by {{{JoinConcurrence/Dissent3}}} }}
| label43      = Concur/dissent
| data43       = {{{Concurrence/Dissent4|}}}{{#if:{{{JoinConcurrence/Dissent4|}}}|, joined by {{{JoinConcurrence/Dissent4}}} }}
| label44      = Concur/dissent
| data44       = {{{Concurrence/Dissent5|}}}{{#if:{{{JoinConcurrence/Dissent5|}}}|, joined by {{{JoinConcurrence/Dissent5}}} }}
| label45      = Concur/dissent
| data45       = {{{Concurrence/Dissent6|}}}{{#if:{{{JoinConcurrence/Dissent6|}}}|, joined by {{{JoinConcurrence/Dissent6}}} }}
| label46      = Concur/dissent
| data46       = {{{Concurrence/Dissent7|}}}{{#if:{{{JoinConcurrence/Dissent7|}}}|, joined by {{{JoinConcurrence/Dissent7}}} }}
| label47      = Concur/dissent
| data47       = {{{Concurrence/Dissent8|}}}{{#if:{{{JoinConcurrence/Dissent8|}}}|, joined by {{{JoinConcurrence/Dissent8}}} }}

| label48      = Dissent
| data48       = {{{Dissent|}}}{{#if:{{{JoinDissent|}}}|, joined by {{{JoinDissent}}} }}

| label49      = Concurrence
| data49       = {{{ConcurrenceDissent|}}}
| label50      = Dissent
| data50       = {{{Dissent2|}}}{{#if:{{{JoinDissent2|}}}|, joined by {{{JoinDissent2}}} }}
| label51      = Concurrence
| data51       = {{{ConcurrenceDissent2|}}}
| label52      = Dissent
| data52       = {{{Dissent3|}}}{{#if:{{{JoinDissent3|}}}|, joined by {{{JoinDissent3}}} }}
| label53      = Concurrence
| data53       = {{{ConcurrenceDissent3|}}}
| label54      = Dissent
| data54       = {{{Dissent4|}}}{{#if:{{{JoinDissent4|}}}|, joined by {{{JoinDissent4}}} }}
| label55      = Concurrence
| data55       = {{{ConcurrenceDissent4|}}}
| label56      = Dissent
| data56       = {{{Dissent5|}}}{{#if:{{{JoinDissent5|}}}|, joined by {{{JoinDissent5}}} }}

| data57       = {{#if:{{{NotParticipating|}}}|{{{NotParticipating}}} took no part in the consideration or decision of the case.}}

| header58     = {{#if:{{{LawsApplied|}}}|Laws applied}}
| data59       = {{{LawsApplied|}}}

| data60       = {{#if:{{{Superseded|}}}|<div style="background-color: red; color: white; font-weight: bold">Superseded by</div>}}
| data61       = {{{Superseded|}}}

| data62       = {{#if:{{{Overruled|}}}|<div style="background-color: red; color: white; font-weight: bold">Overruled by</div>}}
| data63       = {{{Overruled|}}}

| data64       = {{#if:{{{Overturned previous case|}}}|<div style="background-color: green; color: white; font-weight: bold">This case overturned a previous ruling or rulings</div>}}
| data65       = {{{Overturned previous case|}}}

| data66       = {{#if:{{{Abrogated|}}}|<div style="background-color: red; color: white; font-weight: bold">Abrogated by</div>}}
| data67       = {{{Abrogated|}}}
]==========]

-- STEP 4: Save this module.

-- 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.

-- 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