Jump to content

Template:Copyright: Difference between revisions

From Continuum Universes Wiki
Line 14: Line 14:
<!-- If name is missing, error out -->
<!-- If name is missing, error out -->
{{#switch: {{#if:{{{name|{{{2|}}}}}}|1|0}}
{{#switch: {{#if:{{{name|{{{2|}}}}}}|1|0}}
  | 0 = <span class="errpr">Copyright error: missing name.</span>
  | 0 = <span class="error">Copyright error: missing name.</span>
  | 1 =
  | 1 =
   <!-- If year is omitted, use current year -->
   <!-- If year is omitted, use current year -->
Line 25: Line 25:
         <!-- Year is valid and <= current year -->
         <!-- Year is valid and <= current year -->
         {{#ifexpr: {{{year|{{{1|}}}}}} = {{#time:Y}} |
         {{#ifexpr: {{{year|{{{1|}}}}}} = {{#time:Y}} |
           &copy; {{#time:Y}} {{{name|{{{2|}}}}}} |
           <div class="copyright">&copy; {{#time:Y}} {{{name|{{{2|}}}}}}</div> |
           &copy; {{{year|{{{1|}}}}}}&ndash;{{#time:Y}} {{{name|{{{2|}}}}}}
           <div class="copyright">&copy; {{{year|{{{1|}}}}}}&ndash;{{#time:Y}} {{{name|{{{2|}}}}}}</div>
         }}
         }}
       }}
       }}
Line 32: Line 32:
   |
   |
     <!-- No year given -->
     <!-- No year given -->
     &copy; {{#time:Y}} {{{name|{{{2|}}}}}}
     <div class="copyright">&copy; {{#time:Y}} {{{name|{{{2|}}}}}}</div>
   }}
   }}
}}
}}

Revision as of 17:54, 3 October 2025

This template prints a copyright notice with sane year logic.

Usage:

{{Copyright|year=2021|name=Jensen Saga Studio}}
{{Copyright|2021|Jensen Saga Studio}}         <!-- positional works too -->
{{Copyright|name=Jensen Saga Studio}}         <!-- year omitted -> current year -->
{{Copyright|2026|name=Jensen Saga Studio}}    <!-- will give error if year is ahead of current -->

Examples