User:Renegade

From LGPedia
Revision as of 23:09, 24 November 2007 by Renegade (Talk | contribs) (Added some common tag groups and code snippets so I don't have to reconstruct them on each new template.)

Jump to: navigation, search

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".