Difference between revisions of "User:Renegade"

From LGPedia
Jump to: navigation, search
(Episode Page Framework: Adding latest production title)
(Added some common tag groups and code snippets so I don't have to reconstruct them on each new template.)
Line 10: Line 10:
 
*[[LGPedia:Templates|Templates page]]
 
*[[LGPedia:Templates|Templates page]]
 
*[[:Category:Templates|Template category]]
 
*[[:Category:Templates|Template category]]
*[[Aphidpedia|Aphidpedia]]
+
*[[AphidPedia/Redesign|AphidPedia (redesign)]]
 
*[[LGPedia:Lucy's Balcony|Balcony]]
 
*[[LGPedia:Lucy's Balcony|Balcony]]
 
*[[LGPedia:Color Palette|Color Palette]]
 
*[[LGPedia:Color Palette|Color Palette]]
Line 89: Line 89:
 
|new          = yes
 
|new          = yes
 
}}</pre>
 
}}</pre>
 +
 +
==Snippets==
 +
===Common sets of tags===
 +
*'''Primary group:''' <code><nowiki>{{tags|lonelygirl15|lg15|danielbeast|daniel|jonas|jonastko|soccerstar|hymnofone|order}}</nowiki></code>
 +
*<code><nowiki>{{tags|lonelygirl15|LG15|daniel|danielbeast|jonas|jonastko|emma|bree|train|serum|trait|positive|negative}}</nowiki></code>
 +
*<code><nowiki>{{tags|lonelygirl15|bree|danielbeast|daniel|jonastko|jonas|lg15|hymn|of|one|order}}</nowiki></code>
 +
:''Variant:'' <code><nowiki>{{tags|lonelygirl15|lg15|bree|daniel|danielbeast|jonas|jonastko|hymn|of|one|order}}</nowiki></code>
 +
*<code><nowiki>{{tags|lonelygirl15|lg15|danielbeast|daniel|jonastko|jonas|soccerstar|hymnofone|theorder|bree}}</nowiki></code>
 +
:''Subset:'' <code><nowiki>{{tags|daniel|danielbeast|jonas|jonastko|lg15|lonelygirl15|soccerstar}}</nowiki></code>
 +
*<code><nowiki>{{tags|lonelygirl15|lg15|bree|danielbeast|daniel|jonastko|jonas|soccerstar4ever}}</nowiki></code>
 +
:''Variant:'' <code><nowiki>{{tags|lonelygirl15|LG15|daniel|danielbeast|jonas|jonastko|soccerstar4ever|bree}}</nowiki></code>
 +
*''With Sonia:'' <code><nowiki>{{tags|lonelygirl15|lg15|daniel|beast|jonastko|sonia|order|hymn|of|one}}</nowiki></code>
 +
 +
===Generic way to safeguard an expression===
 +
This code can be used to protect parameters in mathematical templates, to make sure the input is either numerical or a valid expression.
 +
<pre>{{#ifeq: {{#ifexpr: {{{1}}} |true}} | true | Is expression | Is not an expression}}</pre>
 +
If <nowiki>{{{1}}}</nowiki> is not an expression, ifexpr returns an error, the error unequals "true", and thus the false part of ifeq is executed; otherwise, ifexpr returns true, ifeq determines that "true" == "true", and executes its true part. Only caveat is that the false part is also triggered when the expression itself is false, because no error is generated (as the expression is valid), but "" (non-existent false of ifexpr) unequals "true".
 +
 +
===Logical AND, OR, XOR===
 +
For the moment, the only way to create logical ANDs, ORs or XORs seems to be nested ifs and ifeqs inside an ifexpr. In this technique, we are outputting 1s and 0s depending on the state of our parameters, and thereby create a normal expression solvable by ifexpr. All examples can be combined, subgroups can be created through parenthesis, and parameter names and control values can be replaced, as long as it happens consistently throughout the entire expression.
 +
 +
====Pieces====
 +
*<code><nowiki>{{ #ifeq: {{{1}}} | CONTROL VALUE | 1 | 0 }}</nowiki></code>
 +
*<code><nowiki>{{ #if: {{{1|}}} | 1 | 0 }}</nowiki></code>
 +
*<code><nowiki>{{ #ifexpr: EXPRESSION | TRUE | FALSE }}</nowiki></code>
 +
 +
====Test on state====
 +
*'''Logical AND:''' <code><nowiki>{{ #ifexpr: {{ #if: {{{1|}}} | 1 | 0 }} and {{ #if: {{{2|}}} | 1 | 0 }} | TRUE | FALSE }}</nowiki></code>
 +
:Returns TRUE if both <nowiki>{{{1}}}</nowiki> and <nowiki>{{{2}}}</nowiki> are defined.
 +
*'''Logical OR:''' <code><nowiki>{{ #ifexpr: {{ #if: {{{1|}}} | 1 | 0 }} or {{ #if: {{{2|}}} | 1 | 0 }} | TRUE | FALSE }}</nowiki></code>
 +
:Returns TRUE if either <nowiki>{{{1}}}</nowiki> or <nowiki>{{{2}}}</nowiki> or both are defined.
 +
*'''Logical XOR:''' <code><nowiki>{{ #ifexpr: {{ #if: {{{1|}}} | 1 | 0 }} != {{ #if: {{{2|}}} | 1 | 0 }} | TRUE | FALSE }}</nowiki></code>
 +
:Returns TRUE if either <nowiki>{{{1}}}</nowiki> or <nowiki>{{{2}}}</nowiki> but not both are defined.
 +
 +
====Test on control value====
 +
In this example, the control value is "yes".
 +
*'''Logical AND:''' <code><nowiki>{{ #ifexpr: {{ #ifeq: {{{1}}} | yes | 1 | 0 }} and {{ #ifeq: {{{2}}} | yes | 1 | 0 }} | TRUE | FALSE }}</nowiki></code>
 +
:Returns TRUE if both <nowiki>{{{1}}}</nowiki> and <nowiki>{{{2}}}</nowiki> are set to "yes".
 +
*'''Logical OR:''' <code><nowiki>{{ #ifexpr: {{ #ifeq: {{{1}}} | yes | 1 | 0 }} or {{ #ifeq: {{{2}}} | yes | 1 | 0 }} | TRUE | FALSE }}</nowiki></code>
 +
:Returns TRUE if either <nowiki>{{{1}}}</nowiki> or <nowiki>{{{2}}}</nowiki> or both are set to "yes".
 +
*'''Logical XOR:''' <code><nowiki>{{ #ifexpr: {{ #ifeq: {{{1}}} | yes | 1 | 0 }} != {{ #ifeq: {{{2}}} | yes | 1 | 0 }} | TRUE | FALSE }}</nowiki></code>
 +
:Returns TRUE if either <nowiki>{{{1}}}</nowiki> or <nowiki>{{{2}}}</nowiki> but not both are set to "yes".
  
 
<div style="position: absolute; right: 10px;">[[Special:Allmessages|<span style="color: #DDDDDD; font-size: 150%; font-family: serif;">&pi;</span>]] [[MediaWiki:Monobook.css|<span style="color: #DDDDDD;">θέλημα</span>]]</div>
 
<div style="position: absolute; right: 10px;">[[Special:Allmessages|<span style="color: #DDDDDD; font-size: 150%; font-family: serif;">&pi;</span>]] [[MediaWiki:Monobook.css|<span style="color: #DDDDDD;">θέλημα</span>]]</div>

Revision as of 23:09, 24 November 2007

Linklist

Just for my personal convenience.

Fonts

Lonelygirl15: Giza ThreeFive
Hymn Of One: Bickham Script

Episode Page Framework

{{Blog
| name        = {{PAGENAME}}
| number      = 
| image       = 
| caption     = 
| blogger     = 
| date        = {{subst:CURRENTMONTHNAME}} {{subst:CURRENTDAY}}, {{subst:CURRENTYEAR}}
| url         = {{lg15|}}
| forumid     = 
| length      = 
| description = 
| location    = 
| tags        = {{tags|}}

<!-- Production Credits leave blank after "=" if data is not available -->


| execprod    =
| coexecprod  =
| assocprod   =
| serprod     =
| producers   =
| lineprod    =
| supprod     =
| directors   = 
| camera      =
| vidplay     =
| headwriter  =
| story       =
| editor      =
| pm          =
| ps          =
| pa          =
| pr          =
| ipa         =
| animation   =
| prodserv    =
| music supervisor =

| song = 
| cast = {{VidChar|}}

| Previous = 
| Next = 

| PreviousB = 
| NextB = 
| PreviousC = 
| NextC = 
}}
{{EpHeader|}}

==Transcript==
{{transcript incomplete}}

==Notes==

Portal New Vid Template

{{Vid
|name         = 
|number       = 
|image        = 
|description  = 
|blogger      = 
|date         = {{subst:CURRENTMONTHNAME}} {{subst:CURRENTDAY}}, {{subst:CURRENTYEAR}}
|url          = {{lg15|}}
|forumurl     = 
|new          = yes
}}

Snippets

Common sets of tags

  • Primary group: {{tags|lonelygirl15|lg15|danielbeast|daniel|jonas|jonastko|soccerstar|hymnofone|order}}
  • {{tags|lonelygirl15|LG15|daniel|danielbeast|jonas|jonastko|emma|bree|train|serum|trait|positive|negative}}
  • {{tags|lonelygirl15|bree|danielbeast|daniel|jonastko|jonas|lg15|hymn|of|one|order}}
Variant: {{tags|lonelygirl15|lg15|bree|daniel|danielbeast|jonas|jonastko|hymn|of|one|order}}
  • {{tags|lonelygirl15|lg15|danielbeast|daniel|jonastko|jonas|soccerstar|hymnofone|theorder|bree}}
Subset: {{tags|daniel|danielbeast|jonas|jonastko|lg15|lonelygirl15|soccerstar}}
  • {{tags|lonelygirl15|lg15|bree|danielbeast|daniel|jonastko|jonas|soccerstar4ever}}
Variant: {{tags|lonelygirl15|LG15|daniel|danielbeast|jonas|jonastko|soccerstar4ever|bree}}
  • With Sonia: {{tags|lonelygirl15|lg15|daniel|beast|jonastko|sonia|order|hymn|of|one}}

Generic way to safeguard an expression

This code can be used to protect parameters in mathematical templates, to make sure the input is either numerical or a valid expression.

{{#ifeq: {{#ifexpr: {{{1}}} |true}} | true | Is expression | Is not an expression}}

If {{{1}}} is not an expression, ifexpr returns an error, the error unequals "true", and thus the false part of ifeq is executed; otherwise, ifexpr returns true, ifeq determines that "true" == "true", and executes its true part. Only caveat is that the false part is also triggered when the expression itself is false, because no error is generated (as the expression is valid), but "" (non-existent false of ifexpr) unequals "true".

Logical AND, OR, XOR

For the moment, the only way to create logical ANDs, ORs or XORs seems to be nested ifs and ifeqs inside an ifexpr. In this technique, we are outputting 1s and 0s depending on the state of our parameters, and thereby create a normal expression solvable by ifexpr. All examples can be combined, subgroups can be created through parenthesis, and parameter names and control values can be replaced, as long as it happens consistently throughout the entire expression.

Pieces

  • {{ #ifeq: {{{1}}} | CONTROL VALUE | 1 | 0 }}
  • {{ #if: {{{1|}}} | 1 | 0 }}
  • {{ #ifexpr: EXPRESSION | TRUE | FALSE }}

Test on state

  • Logical AND: {{ #ifexpr: {{ #if: {{{1|}}} | 1 | 0 }} and {{ #if: {{{2|}}} | 1 | 0 }} | TRUE | FALSE }}
Returns TRUE if both {{{1}}} and {{{2}}} are defined.
  • Logical OR: {{ #ifexpr: {{ #if: {{{1|}}} | 1 | 0 }} or {{ #if: {{{2|}}} | 1 | 0 }} | TRUE | FALSE }}
Returns TRUE if either {{{1}}} or {{{2}}} or both are defined.
  • Logical XOR: {{ #ifexpr: {{ #if: {{{1|}}} | 1 | 0 }} != {{ #if: {{{2|}}} | 1 | 0 }} | TRUE | FALSE }}
Returns TRUE if either {{{1}}} or {{{2}}} but not both are defined.

Test on control value

In this example, the control value is "yes".

  • Logical AND: {{ #ifexpr: {{ #ifeq: {{{1}}} | yes | 1 | 0 }} and {{ #ifeq: {{{2}}} | yes | 1 | 0 }} | TRUE | FALSE }}
Returns TRUE if both {{{1}}} and {{{2}}} are set to "yes".
  • Logical OR: {{ #ifexpr: {{ #ifeq: {{{1}}} | yes | 1 | 0 }} or {{ #ifeq: {{{2}}} | yes | 1 | 0 }} | TRUE | FALSE }}
Returns TRUE if either {{{1}}} or {{{2}}} or both are set to "yes".
  • Logical XOR: {{ #ifexpr: {{ #ifeq: {{{1}}} | yes | 1 | 0 }} != {{ #ifeq: {{{2}}} | yes | 1 | 0 }} | TRUE | FALSE }}
Returns TRUE if either {{{1}}} or {{{2}}} but not both are set to "yes".