Template:Editcopy: Difference between revisions

From Structorica Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 1: Line 1:
<!-- Define mainpagetitle variable -->
{{#vardefine: mainpagetitle | {{#if: {{#pos: {{PAGENAME}} | /}} | {{#sub: {{PAGENAME}} | 0 | {{#pos: {{PAGENAME}} | /}} }} | {{PAGENAME}} }} }}
{{#if: {{#pos: {{PAGENAME}} | /editcopy}} | <!-- The MessageBox only appears on the /editcopy page, allowing it to be used on the main page to prevent the main page and the editcopy from appearing different
--> {{#if: {{{styles_editcopy|}}} | <templatestyles src="{{{styles_editcopy}}}" /> }}<!-- Load custom styles for editcopy page if specified
--> {{MessageBox
|image = Book and Quill JE2 BE2.png
|text  = This page is for users to propose changes to [[{{#var: mainpagetitle}}|{{#if: {{{firsttitle|}}} | {{{firsttitle|}}} | {{{1|{{#var: mainpagetitle}}}}} }}]]. The {{#if: {{{pagetype|}}} | {{{pagetype|}}} | {{#switch: {{NAMESPACENUMBER}} | 0 = article | 4 = project page | 6 = file | 10 = template | 14 = category | {{#ifexpr: {{NAMESPACENUMBER}} mod 2 = 0 | page | talk page}} }} }} "{{#if: {{{1|}}} | {{{1|}}} | {{BASEPAGENAME}} }}" is protected so that only {{{2|users with certain privileges}}} can edit it, {{#if: {{{reason|}}} | {{{reason|}}} | likely due to being a high traffic page or a target of vandalism }}. <!-- Explains the reason why the editcopy exists
--> <div style="line-height: 100%; text-align: center; font-size: 85%;"><br>
[{{fullurl:Special:ComparePages|page1={{urlencode:{{#var: mainpagetitle}} }}&page2={{urlencode:{{FULLPAGENAME}} }} }} Diff with main page] {{#if: {{{extratext|}}}{{{3|}}} | • {{{extratext|{{{3}}}}}} }}</div> <!-- Compares the editcopy to the main page and adds an extra parameter for users of this template to provide extra information
--> }} <!-- End of MessageBox -->
<!-- We are on the main page -->
{{#if: {{{styles_main|}}} | <templatestyles src="{{{styles_main}}}" /> }}<!-- Load custom styles for main page if specified
--> {{#if: {{{nocat|}}} | | [[Category:Editcopies]]}} <!-- Adds to Category:Editcopies unless the nocat parameter is specified
--> }} <!-- End of #ifeq/template --><noinclude>
=== Documentation ===
Examples:
<syntaxhighlight lang="wikitext">
{{Editcopy
    | Page Name
    | administrators
    | reason = high traffic page
    }}
</syntaxhighlight>
<syntaxhighlight lang="wikitext">
{{Editcopy
    | Main Page
    | firsttitle = the main page
    | administrators
    | reason = because it is a high traffic page and therefore a likely target of vandalism
    | extratext = See also editcopy pages for related templates.
    | styles_main = :Main_Page/styles.css
    | styles_editcopy = :Main_Page/styles.css/editcopy
    }}
</syntaxhighlight>
[[Category:Maintenance templates]]
[[ru:Template:Editcopy]]
</noinclude>
<!-- Simple test template below -->
<!-- Simple test template below -->
{{#if: {{#ifeq: {{PAGENAME}} | {{BASEPAGENAME}}/editcopy | 1 | 0 }} |
{{#if: {{#pos: {{PAGENAME}} | /editcopy}} |
   <div style="border: 2px solid green; padding: 10px; margin: 10px 0; background: lightgreen;">
   <div style="border: 2px solid green; padding: 10px; margin: 10px 0; background: lightgreen;">
     <strong>✓ POSITIVE:</strong> We are on editcopy page!<br>
     <strong>✓ POSITIVE:</strong> We are on editcopy page!<br>
Line 14: Line 63:
     PAGENAME: {{PAGENAME}}<br>
     PAGENAME: {{PAGENAME}}<br>
     BASEPAGENAME: {{BASEPAGENAME}}<br>
     BASEPAGENAME: {{BASEPAGENAME}}<br>
    Expected: {{BASEPAGENAME}}/editcopy<br>
     {{#if: {{#var:mainpagetitle}} | mainpagetitle variable: {{#var:mainpagetitle}} | mainpagetitle variable: NOT SET }}
     {{#if: {{#var:mainpagetitle}} | mainpagetitle variable: {{#var:mainpagetitle}} | mainpagetitle variable: NOT SET }}
   </div>
   </div>
}}
}}

Revision as of 18:25, 14 January 2026



Documentation

Examples:

{{Editcopy
    | Page Name
    | administrators
    | reason = high traffic page
    }}
{{Editcopy
    | Main Page
    | firsttitle = the main page
    | administrators
    | reason = because it is a high traffic page and therefore a likely target of vandalism
    | extratext = See also editcopy pages for related templates.
    | styles_main = :Main_Page/styles.css
    | styles_editcopy = :Main_Page/styles.css/editcopy
    }}


   ✗ NEGATIVE: We are NOT on editcopy page!
PAGENAME: Editcopy
BASEPAGENAME: Editcopy
mainpagetitle variable: Editcopy