Difference between revisions of "Template:Rename"

From Yugipedia
Jump to: navigation, search
(Restoring revision 5136426 by User:SMbot on 2022-12-26 06:47:47. "top: replaced: Yu-Gi-Oh!: → Yugipedia: (5)")
(support "reason" as an alternate name for the second parameter since people are used to that from other templates and keep making that mistake with this one)
 
(3 intermediate revisions by the same user not shown)
Line 1: Line 1:
{{ #ifeq: {{NAMESPACE}} | {{ns:6}}
+
{{ #vardefine: $rename-target | {{PAGENAME:{{{1<includeonly>|</includeonly>}}}}}
   | {{ #ifeq: {{PAGENAME:{{{1}}}}} | {{PAGENAME}}
+
}}{{ #vardefine: $rename-reason | {{ #if: {{{reason|}}} | {{{reason}}} | {{{2<includeonly>|</includeonly>}}} }}
     || {{ #ifexist: File:{{PAGENAME:{{{1}}}}}
+
}}{{ #if: {{{1|}}}
 +
| {{ #ifeq: {{NAMESPACE}} | {{ns:6}}
 +
   | {{ #vardefine: $rename-extension | {{ lc: {{ #explode: {{PAGENAME}} | . | -1 }} }}
 +
    }}{{ #if: {{ #pos: {{ #var: $rename-target }} | .{{ #var: $rename-extension }}
 +
    || {{ #switch: {{ lc: {{ #explode: {{ #var: $rename-target }} | . | -1 }} }}
 +
      | png | gif | jpg | jpeg | webp | svg | pdf | flac | mkv | mov | mp3 | mp4 | oga | ogg | ogv | wav | webm<!-- recognized extension: replace with the current extension -->
 +
        = {{ #vardefine: $rename-target | {{ #sub: {{ #var: $rename-target }} || {{ #rpos: {{ #var: $rename-target }} | {{ #explode: {{ #var: $rename-target }} | . | -1 }} }} }}{{ #var: $rename-extension }} }}
 +
      | #default = <!-- no/unrecognized extension: append the current extension -->{{ #vardefine: $rename-target | {{ #var: $rename-target }}.{{ #var: $rename-extension }} }}
 +
      }}
 +
    }}
 +
  }}{{ #ifeq: {{ #var: $rename-target }} | {{PAGENAME}}
 +
  | {{mbox
 +
    | type = style
 +
     | text = Please [{{fullurl:{{FULLPAGENAMEE}}|action=edit}} edit this page] and remove the "Rename" template from its source.<br />This notice was probably forgotten after a [[Yugipedia:Mover|mover]] or [[Yugipedia:Administrators|administrator]] renamed this {{ #switch: {{NAMESPACE}} | {{ns:0}} = article | {{ns:6}} | {{ns:10}} | {{ns:14}} = {{ lc: {{NAMESPACE}} }} | #default = page }}.[[Category:Renamed pages with the rename tag]]
 +
    }}
 +
  | {{ #ifeq: {{NAMESPACE}} | {{ns:6}}
 +
    | {{ #ifexist: File:{{ #var: $rename-target }}
 
       | {{imbox
 
       | {{imbox
 
         | type = delete
 
         | type = delete
         | text = '''The file [[:File:{{PAGENAME:{{{1}}}}}]] already exists!''' Please either review that file to determine if it or this file should be deleted (and if so, mark the appropriate file for deletion) or history merged, or choose a different name.
+
         | text = '''The file [[:File:{{ #var: $rename-target }}]] already exists!''' Please either check whether one of these files should be deleted or if they should be history merged, or choose a different name.
 +
        }}
 
       }}
 
       }}
 
     }}
 
     }}
 
   }}
 
   }}
}}{{ #ifeq: {{PAGENAME:{{{1}}}}} | {{PAGENAME}}
+
}} }}{{mbox
  | {{mbox
 
    | type = style
 
    | text = Please [{{fullurl:{{FULLPAGENAMEE}}|action=edit}} edit this page] and remove the "Rename" template from its source.<br />This notice was probably left when a [[Yugipedia:Mover|mover]] or [[Yugipedia:Administrators|administrator]] renamed this {{ #switch: {{NAMESPACE}}
 
      | {{ns:0}}  = article
 
      | {{ns:6}}  = file
 
      | {{ns:10}} = template
 
      | {{ns:14}} = category
 
      | #default  = page
 
    }}, and simply forgot to remove it.[[Category:Renamed pages with the rename tag]]
 
  }}
 
}}{{mbox
 
 
| type      = move
 
| type      = move
 
| text      = {{ #ifeq: {{NAMESPACE}} | {{ns:6}}
 
| text      = {{ #ifeq: {{NAMESPACE}} | {{ns:6}}
Line 32: Line 38:
 
     | Media
 
     | Media
 
     | Candidates
 
     | Candidates
   }} for renaming|renamed]]{{ #if: {{{1<includeonly>|</includeonly>}}}
+
   }} for renaming|renamed]]{{ #if: {{ #var: $rename-target }}
 
     | &nbsp;to '''{{ #if: {{NAMESPACE}}
 
     | &nbsp;to '''{{ #if: {{NAMESPACE}}
 
       | {{NAMESPACE}}:
 
       | {{NAMESPACE}}:
     }}{{PAGENAME:{{{1}}}}}'''
+
     }}{{ #var: $rename-target }}'''
   }}. ([[{{ #if: {{{discuss|}}} | {{{discuss}}} | {{TALKPAGENAME}} }}|discuss]]){{ #if: {{{2<includeonly>|</includeonly>}}}
+
   }}. ([[{{ #if: {{{discuss|}}} | {{{discuss}}} | {{TALKPAGENAME}} }}|discuss]]){{ #if: {{ #var: $rename-reason }}
     | <br />The reason given was: ''{{{2}}}''
+
     | <br />The reason given was: ''{{ #var: $rename-reason }}''
 
   }}{{ #ifeq: {{NAMESPACE}} | {{ns:6}}
 
   }}{{ #ifeq: {{NAMESPACE}} | {{ns:6}}
 
     | <br />
 
     | <br />
 
Please '''do not''' reupload this file; a [[Yugipedia:Mover|mover]] or [[Yugipedia:Administrators|administrator]] will be along shortly to move it to the correct name.<br /><!--
 
Please '''do not''' reupload this file; a [[Yugipedia:Mover|mover]] or [[Yugipedia:Administrators|administrator]] will be along shortly to move it to the correct name.<br /><!--
--><small>Administrators: [[Special:WhatLinksHere/{{FULLPAGENAME}}|What links here]]{{•}} [{{fullurl:{{FULLPAGENAMEE}}|action=history}} File history]{{•}} [{{fullurl:Special:MovePage/{{FULLPAGENAMEE}}|wpLeaveRedirect=0{{#if:{{{1|}}}|&wpNewTitle=File:{{PAGENAMEE:{{{1}}}}}}}&wpReason={{urlencode:renaming file {{#if: {{{1|}}}|to "File:{{PAGENAME:{{{1}}}}}"}} {{#if:{{{2|}}}|because "{{{2|}}}"}}}}}} Rename file]</small>
+
--><small>Administrators: [[Special:WhatLinksHere/{{FULLPAGENAME}}|What links here]]{{•}} [{{fullurl:{{FULLPAGENAMEE}}|action=history}} File history]{{•}} [{{fullurl:Special:MovePage/{{FULLPAGENAMEE}}|wpLeaveRedirect=0{{ #if: {{ #var: $rename-target }} | &wpNewTitle={{urlencode:File:{{ #var: $rename-target }} }} }}&wpReason={{urlencode:renaming file {{ #if: {{ #var: $rename-target }} |to "File:{{ #var: $rename-target }}"}} {{ #if: {{ #var: $rename-reason }} | because "{{ #var: $rename-reason }}" }} }} }} Rename file]</small>
 
   }}
 
   }}
 
}}<includeonly>{{ #ifeq: {{NAMESPACE}}:{{ #titleparts: {{PAGENAME}} | 1 | 1 }} | {{ns:10}}:Rename
 
}}<includeonly>{{ #ifeq: {{NAMESPACE}}:{{ #titleparts: {{PAGENAME}} | 1 | 1 }} | {{ns:10}}:Rename

Latest revision as of 18:48, 5 February 2024