~ubuntu-branches/ubuntu/natty/moin/natty-updates

« back to all changes in this revision

Viewing changes to wiki/underlay/pages/HelpOnVariables/revisions/00000001

  • Committer: Bazaar Package Importer
  • Author(s): Jonas Smedegaard
  • Date: 2008-06-22 21:17:13 UTC
  • mfrom: (0.9.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20080622211713-fpo2zrq3s5dfecxg
Tags: 1.7.0-3
Simplify /etc/moin/wikilist format: "USER URL" (drop unneeded middle
CONFIG_DIR that was wrongly advertised as DATA_DIR).  Make
moin-mass-migrate handle both formats and warn about deprecation of
the old one.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
## Please edit system and help pages ONLY in the moinmaster wiki! For more
2
 
## information, please see MoinMaster:MoinPagesEditorGroup.
 
1
## Please edit system and help pages ONLY in the master wiki!
 
2
## For more information, please see MoinMoin:MoinDev/Translation.
3
3
##master-page:Unknown-Page
4
4
##master-date:Unknown-Date
5
 
#acl MoinPagesEditorGroup:read,write,delete,revert All:read
 
5
#acl -All:write Default
6
6
#format wiki
7
7
#language en
8
 
== Help on Variables ==
9
 
 
10
 
=== predefined variables ===
11
 
The following variables are substituted when a page is saved. Note that they will appear unreplaced in the preview!
 
8
 
 
9
This page tells you more how you can use variables in wiki pages. This is especially helpful within [[HelpOnTemplates|templates]], but also on "normal" wiki pages (like for signing a contribution).
 
10
 
 
11
<<TableOfContents>>
 
12
 
 
13
== Predefined Variables ==
 
14
The following variables are substituted when a page is saved. '''''Note that they will appear unreplaced in the preview!'''''
12
15
 
13
16
|| Variable         || Description                                  || Example ||
14
17
|| @``PAGE@     || Name of the page (useful for template pages) || HelpOnPageCreation ||
15
 
|| @``DATE@     || Current date in the system's format          || [[Date(2004-08-30T06:38:05Z)]] ||
16
 
|| @``TIME@     || Current date and time in the user's format   || [[DateTime(2004-08-30T06:38:05Z)]] ||
 
18
|| @``DATE@     || Current date in the system's format          || <<Date(2004-08-30T06:38:05Z)>> ||
 
19
|| @``TIME@     || Current date and time in the user's format   || <<DateTime(2004-08-30T06:38:05Z)>> ||
 
20
|| @``ME@       || Just the user's name                         || TheAnarcat ||
17
21
|| @``USERNAME@ || Just the user's name (or his domain/IP)      || TheAnarcat ||
18
22
|| @``USER@     || Signature "-- loginname"                     || -- TheAnarcat ||
19
 
|| @``SIG@      || Dated Signature "-- loginname date time"     || -- TheAnarcat [[DateTime(2004-08-30T06:38:05Z)]] ||
20
 
|| @``MAILTO@   || A fancy mailto: link with the user's data    || None - on public sites, better use the Mail``To macro) ||
21
 
 
22
 
 
23
 
== expanding variables ==
24
 
 
25
 
You can use Home``Page``Name/My``Dict to expand those variables, just put a Wiki``Dict there with your variables and values. For example,
 
23
|| @``SIG@      || Dated Signature "-- loginname date time"     || -- TheAnarcat <<DateTime(2004-08-30T06:38:05Z)>> ||
 
24
|| @``MAILTO@   || A fancy mailto: link with the user's data    || None - on public sites, better use the Mail``To macro ||
 
25
 
 
26
 
 
27
== Expanding Variables ==
 
28
 
 
29
You can use Home``Page``Name/My``Dict to expand those variables, just put a dictionary (see HelpOnDictionaries) there with your variables and values. For example,
26
30
{{{
27
31
 VAR1:: substitution 1
28
32
 VAR2:: substitution 2
29
33
}}}
30
34
 
31
 
If you make a page ending with `.*Dict` (see page_dict_regex), you can set some variables to specific values:
32
 
 var1:: value1
33
 
 var2:: value2
34
 
 var3:: value3
35
 
 
36
 
The actual format of the variable assignment above when editing in the edit window is the following:
37
 
{{{
38
 
 var1:: value1
39
 
 var2:: value2
40
 
 var3:: value3
41
 
}}}
42
 
The leading space and the space after '::' are important.
43
 
 
44
 
== getting variables ==
 
35
 
 
36
== Getting Variables ==
45
37
 
46
38
=== At Every Page Refresh ===
47
39
 
48
40
You can use these values using the `GetVal` macro:
49
41
 
50
42
{{{
51
 
[[GetVal(WikiDict,var1)]] [[GetVal(WikiDict,var2)]] [[GetVal(WikiDict,var3)]]
 
43
<<GetVal(WikiDict,var1)>> <<GetVal(WikiDict,var2)>> <<GetVal(WikiDict,var3)>>
52
44
}}}
53
45
 
54
46
Renders as:
55
47
 
56
 
[[GetVal(WikiDict,var1)]] [[GetVal(WikiDict,var2)]] [[GetVal(WikiDict,var3)]]
 
48
<<GetVal(WikiDict,var1)>> <<GetVal(WikiDict,var2)>> <<GetVal(WikiDict,var3)>>
57
49
 
58
50
=== When Saving the Page ===
59
51
 
63
55
 
64
56
/!\ Note that data in dict pages is cached and does not require opening and parsing the page file for each access to the value. In CGI, the value is fetched from a pickle, in long running process, the pickle is loaded once and then the value is accessed from memory.
65
57
 
66
 
/!\ Note that saving template pages and using preview does ''not'' expand variables. Other than that, variable expansion is very global and happens anywhere on the page, including code displays, comments, processing instructions and other "special" areas of a page you might think are excluded. See HelpOnTemplates for more information about using templates.
 
58
/!\ Note that saving template pages and using preview does ''not'' expand variables. Other than that, variable expansion is very global and happens anywhere on the page, including code displays, comments, processing instructions and other "special" areas of a page you might think are excluded.