Template:Rbcal

From OpenWetWare
Jump to: navigation, search

<html><style type='text/css'> table.calendar {

 border-collapse:collapse;
 border: 1px solid grey;
 background-color: #FFF;

} table.calendar tr{ padding: 3px; } table.calendar td{ padding: 2px 3px;} td.calendarToday { background-color: #CCF; } td.calendarHeader {

 font-weight: bold;
 padding:0px 5px;
 background-color: #EEE;

}</style></html>{{#vardefine:RBnb|Special:Redir/Braun:Notebook}}{{#vardefine:RBproj|calendar}}{{#vardefine:RBbase|{{#var:RBnb}}/{{#var:RBproj}}}}{{#vardefine:RBtoday|2017/09/26}}{{#vardefine:RBtomorrow|2017/09/27}}{{#vardefine:RBmocal|<calendar> view=month date="today" weekstart=7 format="{{#var:RBnb}}/{{#var:RBproj}}/%Y/%m/%d"</calendar>}}

Usage

{{Rbcal|ProjectName}}
(if not supplied, ProjectName defaults to "calendar")

Effect

This template defines the following variables:

  • {{#var:RBnb}}
⇒ {{#var:RBnb}}
  • {{#var:RBproj}}
⇒ {{#var:RBproj}}
(NB: If this template is called with {{Rbcal|ProjectName}}, {{#var:RBproj}} will give ProjectName; otherwise, it defaults to "calendar.")
  • {{#var:RBbase}}
⇒ {{#var:RBbase}}
  • {{#var:RBtoday}}
⇒ {{#var:RBtoday}}
  • {{#var:RBtomorrow}}
⇒ {{#var:RBtomorrow}}
  • {{#var:RBmocal}}

{{#var:RBmocal}}

Creating Links

The vars can be composed into links & manipulated to give pretty time strings:

  • [[{{#var:RBbase}}|{{#var:RBproj}} home]]
⇒ [[{{#var:RBbase}}|{{#var:RBproj}} home]]
  • [[{{#var:RBbase}}/{{#var:RBtoday}}|Today, {{#time: D j M Y|{{#var:RBtoday}} }}]]
⇒ [[{{#var:RBbase}}/{{#var:RBtoday}}|Today, Error: Invalid time.]]
  • [[{{#var:RBbase}}/{{#var:RBtomorrow}}|Tomorrow, {{#time: D j M Y|{{#var:RBtomorrow}} }}]]
⇒ [[{{#var:RBbase}}/{{#var:RBtomorrow}}|Tomorrow, Error: Invalid time.]]

Vars can also be combined with the Lab Notebook variables, eg:

  • {{#lnvar:thisdate}}, date of current entry
  • {{#lnvar:prevday}}, day before entry
  • {{#lnvar:nextday}}, day after entry
  • {{#lnpreventry:{{FULLPAGENAME}}}}, previous entry IF it exists (empty string otherwise)
  • {{#lnnextentry:{{FULLPAGENAME}}}}, next entry IF it exists (empty string otherwise)