User:Skybike/Template:This months newsletter: Difference between revisions

Jump to navigation Jump to search
m
changed parameters for link texts, changed default texts to newletters name, doku
 
m (changed parameters for link texts, changed default texts to newletters name, doku)
Line 1: Line 1:
{{#ifexist:
{{#ifexist:
   <!-- ## Does the page specified by the user already exist? ## -->
   <!-- #### Does the page specified by the user already exist? #### -->
   {{#if: {{{subpage-to|}}}
   {{#if: {{{subpage-to|}}}|{{urlencode:{{{subpage-to|}}}|WIKI}}/}}<!--
  |{{urlencode:{{{subpage-to|}}}|WIKI}}/}}<!--


        # PAGENAME to test#
   -->{{LangSwitch|lang={{{lang|}}}
   -->{{LangSwitch|lang={{{lang|}}}
         | en = FlightGear_Newsletter_{{#time: F Y |{{{date|now}}} | en }}
         | en = FlightGear_Newsletter_{{#time: F Y |{{{date|now}}} | en }}
Line 10: Line 10:




        ##  Yes, there is such a page. Link to it. ##-->
      #####  Yes, there is such a page. Link to it. #####-->
   |{{{alttext1|}}} <!--attext1 empty by default, alternative sth. like "Please help us write" (plain black text)
   |{{#if:{{#titleparts:{{{link|}}}|1|2}}|{{#titleparts:{{{link|}}}|1|1}}&#32;}}<!--text1/linktext/text2: if more than 1 part? print text1 black
  -->[[{{#if: {{{subpage-to|}}}
      |{{urlencode:{{{subpage-to|}}}|WIKI}}/}}<!--


       -->{{LangSwitch|lang={{{lang|}}}
  -->[[{{#if: {{{subpage-to|}}}|{{urlencode:{{{subpage-to|}}}|WIKI}}/}}<!--
 
       # pagename to link to: #
    -->{{LangSwitch|lang={{{lang|}}}
           | en = FlightGear_Newsletter_{{#time: F Y |{{{date|now}}} | en }}
           | en = FlightGear_Newsletter_{{#time: F Y |{{{date|now}}} | en }}
           | de = De/FlightGear_Newsletter_{{#time: F Y |{{{date|now}}} | de }}
           | de = De/FlightGear_Newsletter_{{#time: F Y |{{{date|now}}} | de }}
         }}<!--
         }}<!--


    -->|{{{linktext1<!--linktext1 defaults "This months newsletter" or alternative "the coming edition!"
      ##blue link text:##
      -->|{{LangSwitch|lang={{{lang|}}}
  #linktext defaults to the newsletters name if "link=" not used or called "name" or "/name"#
            | en = This months newsletter
      -->|{{#ifexpr: {{#if:{{{link|}}}|0|1}} or {{#ifeq:{{{link|}}}|name|1|0}} or {{#ifeq:{{#titleparts:{{{link|}}}|1|2}}|name|1|0}}<!--
            | de = Newsletter für diesen Monat
      -->|{{LangSwitch|lang={{{lang|}}}<!--This link text gets shown if the newsletter exists-->
        }}}}}]]<!--  
            | en = FlightGear Newsletter {{#time: F Y |{{{date|now}}} | en }}
            | de = FlightGear Newsletter {{#time: F Y |{{{date|now}}} | de }}
        }}<!--
  #if called "read name" or "/read name"#
      -->|{{#ifexpr:{{#ifeq:{{{link|}}}|read name|1|0}} or {{#ifeq:{{#titleparts:{{{link|}}}|1|2}}|read name|1|0}} |{{LangSwitch|lang={{{lang|}}}
          | en = read the FlightGear Newsletter {{#time: F Y |{{{date|now}}} | en }}
          | de = FlightGear Newsletter {{#time: F Y |{{{date|now}}} | de }} lesen
        }}<!--
    #custom text given as "link=linktext" or "link=text/linktext"#
    -->|{{#if:{{#titleparts:{{{link|}}}|1|2}} | {{#titleparts:{{{link|}}}|1|2}} | {{#titleparts:{{{link|}}}|1|1}} }} }} }}]]<!--
 
  --> {{#titleparts:{{{link|}}}|1|3}}<!-- last "text/link/text" text
 




          ## No, there is no such page. Preload subpage and create it. ##
        ##### No, there is no such page. Preload subpage and create it. #####
-->|{{{alttext2|}}}<!-- alttext2 is empty by default (black text)
      ## if create=a/b/c has more than 1 part, print first part in black ##
    -->|{{#if:{{#titleparts:{{{create|}}}|1|2}}|{{#titleparts:{{{create|}}}|1|1}}&#32;}}<!--
 
     --><span class="plainlinks"><!--No http-link Icon
     --><span class="plainlinks"><!--No http-link Icon
       -->[http://wiki.flightgear.org/index.php?title=<!--
       -->[http://wiki.flightgear.org/index.php?title=<!--
         -->{{#if: {{{subpage-to|}}}
         -->{{#if: {{{subpage-to|}}}|{{urlencode:{{{subpage-to|}}}|WIKI}}/}}<!--
            |{{urlencode:{{{subpage-to|}}}|WIKI}}/}}<!--


              # Name of the created page #
             -->{{LangSwitch|lang={{{lang|}}}
             -->{{LangSwitch|lang={{{lang|}}}
                 | en = FlightGear_Newsletter_{{#time: F_Y |{{{date|now}}} | en }}
                 | en = FlightGear_Newsletter_{{#time: F_Y |{{{date|now}}} | en }}
Line 39: Line 54:
               }}<!--
               }}<!--


          #Draft to preload to the above page#
     -->&action=edit&preload=<!--
     -->&action=edit&preload=<!--
       -->{{LangSwitch|lang={{{lang|}}}
       -->{{LangSwitch|lang={{{lang|}}}
Line 48: Line 64:
     -->&preloadparams%5b%5d={{#time: Y |{{{date|now}}}}}<!--  $2 is Year (like 2019)  
     -->&preloadparams%5b%5d={{#time: Y |{{{date|now}}}}}<!--  $2 is Year (like 2019)  
     -->&preloadparams%5b%5d={{urlencode:{{current release|cr}}}}<!--  $3 is current release
     -->&preloadparams%5b%5d={{urlencode:{{current release|cr}}}}<!--  $3 is current release
     -->&summary=Created_preloaded_page<!-- A short summary
     -->&summary=Created%20preloaded%20page<!-- A short summary (%20 is hex ASCII for space)


       --> {{{linktext2<!--linktext2 is "Create this months newsletter"
        ## blue linktext, shown as default if empty or "create=create name" or "create=/create name" ##
       --> {{#ifexpr: {{#if:{{{create|}}}|0|1}} or {{#ifeq:{{{create|}}}|create name|1|0}} or {{#ifeq:{{#titleparts:{{{create|}}}|1|2}}|create name|1|0}}<!--
           -->|{{LangSwitch|lang={{{lang|}}}
           -->|{{LangSwitch|lang={{{lang|}}}
               | en = Create this months newsletter
               | en = Create FlightGear Newsletter {{#time: F Y |{{{date|now}}} | en }}
               | de = Den Newsletter für diesen Monat erstellen
               | de = Den FlightGear Newsletter {{#time: F Y |{{{date|now}}} | de }} erstellen
  }}}}}]</span class>}}<noinclude>
              }}<!--
      # shown as newsletter name if create=name or create=/name" #
          -->|{{#ifexpr:{{#ifeq:{{{create|}}}|name|1|0}} or {{#ifeq:{{#titleparts:{{{create|}}}|1|2}}|name|1|0}}|{{LangSwitch|lang={{{lang|}}}
              | en = FlightGear Newsletter {{#time: F Y |{{{date|now}}} | en }}
              | de = FlightGear Newsletter {{#time: F Y |{{{date|now}}} | de }}
              }}<!--
      # custom blue link text as "create=abc" or "create=/abc" #
          -->|{{#if:{{#titleparts:{{{create|}}}|1|2}} | {{#titleparts:{{{create|}}}|1|2}} | {{#titleparts:{{{create|}}}|1|1}} }} }} }}]</span class><!--
     
      ## last black "text/link/text" text ##
      --> {{#titleparts:{{{create|}}}|1|3}}<!--
-->}}<noinclude>
{{Informative template|1=
{{Informative template|1=
This sandbox experiment is based on [[User:Johan G/Template:This months newsletter]].
This sandbox experiment is based on [[User:Johan G/Template:This months newsletter]].
If we decide to publish it I would suggest a more general name like "Template:Newsletter link" instead of "This months newsletter" as you can change the date here.


== Goal ==
== Goal ==
This template will link to the current [[FlightGear Newsletter]]. If it does not yet exist this template will show a red link that when clicked will load a FlightGear Newsletter example with common headings, templates and categories already there, as well as some helpful comments for the editor.
This template will link to the [[FlightGear Newsletter]]. If it does not yet exist this template will show a red link that when clicked will load a FlightGear Newsletter example with common headings, templates and categories already there, as well as some helpful comments for the editor. It is multilingual and supports custom


== Usage ==
== Usage ==
  {{obr}}<small>:User:Skybike/Template:</small>'''This months newsletter''' {{!}}''date='' {{!}}''alttext1='' {{!}}''linktext1='' {{!}} ''alttext2='' {{!}}''linktext2='' {{!}}''subpage-to='' {{!}}''lang='' {{cbr}}
  {{obr}}<small>:User:Skybike/Template:</small>'''This months newsletter''' {{!}}''date='' {{!}}''link='' {{!}}''create='' {{!}}''subpage-to='' {{!}}''lang='' {{cbr}}


'''All parameters are optional'''
'''All parameters are optional'''
Line 68: Line 98:
; date: Default is ''current date''. But you can choose a different date in the form '''YYYY-MM''' (like {{CURRENTYEAR}}-{{CURRENTMONTH}}).
; date: Default is ''current date''. But you can choose a different date in the form '''YYYY-MM''' (like {{CURRENTYEAR}}-{{CURRENTMONTH}}).


;linktext1, linktext2: Alternative name for the blue link to an existing Newsletter ("linktext1", by default "[[Next newsletter|This months newsletter]]") and to not existing Newsletter ("linktext2", defaults to "[[Next newsletter|Create this months newsletter]]")
;link, create: Alternative name for the printed link to an existing Newsletter and to not existing Newsletter (by default "FlightGear Newsletter {{#time:F Y|now}}" and "Create FlightGear Newsletter {{#time:F Y|now}}")


<br>
<br>
===Advanced Usage===
===Advanced Usage===
----
----
;alttext1, alttext2: Explanatory black text followed by the blue link. It shows up as "alttext1 [[Next newsletter|linktext1]]" and both of them are empty by default. You will find <code>alttext1 = Help us write the {{!}} linktext1 = [[Next newsletter]]</code> at quite some places around this wiki
'''All parameters are optional'''
 
; date=
*Default is <tt>now</tt>. More expressions are <tt>2019-6, January 2020, next month, last month, +1 month, +8 month, +8 months, -8 days,</tt>,...
*Only english therms are accepted, <tt>März 2018</tt> or <tt>nächster Monat</tt> do NOT work, nowhere.
<br>
;link= / create=
* Shown as blue link text linking to an existing newsletter (link=) and creating a new one (create=):
** "<tt>link=abc{{!}}create=def</tt>" shows "[[Main Page|Abc]]" or "[[Main Page|Def]]"
<br>
* There are optional explanatory black texts around the blue link. Both are empty by default. You can define them by a "/" slash in the way "<tt>link=black/blue/black</tt>" "Black [[Main Page|blue]] black"
** Only the first one: "<tt>Write/me</tt>" shows "Write [[Main Page|me]]"
** Both texts:        "<tt>Write/me/now</tt>" shows "Write [[Main Page|me]] now"
** Only the last text: "<tt>/me/now</tt>" shows "[[Main Page|Me]] now"
** No text: "<tt>Me</tt>" shows "[[Main Page|Me]]"
<br>
* There are magical words supported (only) by the blue link:
** "<tt>name</tt>" as well as "<tt>/name/</tt>": [[Main Page|FlightGear Newsletter {{#time:F Y|now}}]] (which is the default for "link")
** "<tt>read name</tt>": "[[Main Page|Read FlightGear Newsletter {{#time:F Y|now}}]]" (only for "link=")
** "<tt>create name</tt>": "[[Main Page|Create FlightGear Newsletter {{#time:F Y|now}}]]" (only for "create=". Is the default there as well)
** type the newsletters name manually for more combinations: <code><nowiki>FlightGear Newsletter {{#time:F Y|now}}</nowiki></code>.
<br>
; subpage-to: Create the next newsletter as a subpage to ''subpage-to'' instead of as a separate page.  Can be used for sandbox experiments as a subpage to your user page.
; subpage-to: Create the next newsletter as a subpage to ''subpage-to'' instead of as a separate page.  Can be used for sandbox experiments as a subpage to your user page.
<!--: Using this option  no categories will be included.-->
<!--: Using this option  no categories will be included.-->
Line 87: Line 136:


----
----
In {{tl|newsletter-header}} we would use <code>alttext= and linktext=</code> to replace the default text:
In {{tl|newsletter-header}} we would use <tt>link=</tt> and <tt>create=</tt> to replace the default text:
  {{obr}}'''This months newsletter'''{{!}}alttext1=''Please help us write''{{!}}linktext1=''the coming edition!''{{!}}linktext2=''Create the coming Newsletter edition''{{cbr}}
  {{obr}}'''This months newsletter'''{{!}}link=''Please help us write/the coming edition!''{{!}}create=''Create the coming Newsletter edition''{{cbr}}
{{:User:Skybike/Template:This months newsletter|alttext1=Please help us write|linktext1=the coming edition!|linktext2=Create the coming Newsletter edition}}
{{:User:Skybike/Template:This months newsletter|link=Please help us write/the coming edition!|create=Create the coming Newsletter edition}}


----
----
On translated pages (like De/Newsletter) you can link to last months english newsletter via:
On translated pages (like De/Newsletter) you can link to last months english newsletter via:
  {{obr}}'''This months newsletter''' {{!}}''date=last month'' {{!}}''lang= en'' {{!}}''alttext1=Add your article to the'' {{!}}''linktext2=English newsletter'' {{!}}''linktext2=Create English  newsletter''{{cbr}}
  {{obr}}'''This months newsletter''' {{!}}''date=last month'' {{!}}''lang= en'' {{!}}''link=Add your article to the english/name'' {{!}}''ceate=Create English  newsletter''{{cbr}}


{{:User:Skybike/Template:This months newsletter|date=last month|lang=en|alttext1=Add your article to the|linktext1=English newsletter|linktext2=Create English  newsletter}}
{{:User:Skybike/Template:This months newsletter|date=last month|lang=en|link=Add your article to the english/name|create=Create English  newsletter}}


<!--== Known issues ==
== Known issues ==
While it is stated that "Using this option the normal categories will not be included." they currently in fact are.
*The first letter of "create=" and "link=" is always a capital letter
*<tt>text//text</tt> and <tt>text/</tt> does not work as you need a link text. Use <tt>text/name/text</tt> instead (or don't use link= and create= at all).
*You can't combine the magical word "name" with other words than "create" and "read" within the blue link ("create=ab/cd name ef/gh" or "link=ab name" does not work). Type the newsletters name manually or define these words as black text using "/" slash
*time= only works with english language, try to use international "YYYY-MM" (2018-12) whenever possible to help translators.
*"name" and "read name" and "create name" are english codewords but have translated output. <tt>{{!}}create=bitte/''create name''/, um ihn zu füllen{{!}}lang=de</tt>
*The internal wiki server may need some time (up to minutes) to index new pages. This template still shows the "create" link during that time.
<!--While it is stated that "Using this option the normal categories will not be included." they currently in fact are.
:If there should be a need for this, just add a Preloadparam $4 that ships ":Category:" or "Category:" (without first colon) in it, based on if subpage-to= is used or not. But this would make the draft template harder to understand.-->
:If there should be a need for this, just add a Preloadparam $4 that ships ":Category:" or "Category:" (without first colon) in it, based on if subpage-to= is used or not. But this would make the draft template harder to understand.-->


454

edits

Navigation menu