1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
|
<?php
/**
* help_format_tikiwiki_inc
*
* @author Christian Fowler>
* @version $Revision: 1.15 $
* @package liberty
* @subpackage functions
*/
/**
* required setup
*/
global $gBitSystem, $gBitSmarty;
require_once( KERNEL_PKG_PATH.'BitCache.php' );
$cache = new BitCache( 'liberty/help' );
// only regenerate this thing if it's not cached yet
$cacheFile = 'tikiwiki';
if( $cache->isCached( $cacheFile, filemtime( __FILE__ ))) {
$examples = unserialize( $cache->readCacheFile( $cacheFile ));
} else {
// help for generic options
$tikiwiki = array(
'Emphasis' => array(
'Headings' => array(
'data' => "! heading 1\n!! heading 2\n!!! heading 3",
'note' => "Number of ! correponds to heading level.",
),
'Italics' => array(
'data' => "''text''",
'note' => "Two single quotes not one double quote",
),
'Underline' => array(
'data' => "===text===",
),
'Coloured Background' => array(
'data' => "++yellow:text++",
),
'Coloured Text' => array(
'data' => "~~red:text~~",
),
'Bold' => array(
'data' => "__text__",
),
'Centered Text' => array(
'data' => "::text::",
),
'Combined' => array(
'data' => "::__~~red:++yellow:text++~~__::",
'note' => "When you combine options make sure you open and close in the opposite order analogous to: {[(text)]}",
),
),
'Lists' => array(
'Unordered Lists' => array(
'data' => "* First item\n** First subitem\n** Second subitem\n* Second item",
),
'Ordered Lists' => array(
'data' => "# First item\n## First subitem\n## Second subitem\n# Second item",
),
'Definition Lists' => array(
'data' => ";Term: Definition",
),
),
'Links' => array(
'Wiki Links' => array(
'data' => "((Wiki Page))",
'result' => '<a href="#">Wiki Page</a>',
),
'Wiki Links + Description' => array(
'data' => "((Wiki Page|Page Description))",
'result' => '<a href="#">Page Description</a>',
),
'Wiki Links + Anchor + Description' => array(
'data' => "((Wiki Page#Anchor|Page Description))",
'result' => '<a href="#">Page Description</a>',
),
'External Link' => array(
'data' => "[http://www.example.com]",
),
'External Link + Description' => array(
'data' => "[http://www.example.com|Description]",
),
'External Link + Anchor + Description' => array(
'data' => "[http://www.example.com/Page#Anchor|Description]",
),
),
'Miscellaneous' => array(
'Horizontal Rule' => array(
'data' => '---',
),
'Highlighted Bar' => array(
'data' => '-=text=-',
),
'Highlighted Box' => array(
'data' => "^text\nmore text^",
),
'As is Text' => array(
'data' => "~np~~~yellow:yellow~~\nand\n__bold__ text~/np~",
'note' => "This text will not be parsed",
),
'Pre Parsed' => array(
'data' => "~pp~~~yellow:yellow~~\nand\n__bold__ text~/pp~",
'note' => "This text will be treated like code and will not be altered and will be displayed using a monospace font. The same can be achieved by using <pre>text</pre>.",
),
'Monospaced Text' => array(
'data' => "-+text+-",
),
'Right to Left' => array(
'data' => "{r2l}this text is from\nright to left\n{l2r}and back to\nleft to right.",
),
),
'Simple Tables' => array(
'Simple Table' => array(
'data' => "|| Row1-Col1 | Row1-Col2\nRow2-Col1 | Row2-Col2 ||",
),
'With Headers' => array(
'data' => "||~ Header1 | Header2\nRow1-Col1 | Row1-Col2\nRow2-Col1 | Row2-Col2 ||",
),
),
);
if( $gBitSystem->getConfig( 'wiki_tables' ) == 'old' ) {
$tikiwiki['Simple Tables'] = array(
'Tables' => array(
'data' => "|| Row1-Col1 | Row1-Col2 || Row2-Col1 | Row2-Col2 ||",
),
);
}
foreach( array_keys( $tikiwiki ) as $section ) {
foreach( $tikiwiki[$section] as $title => $example ) {
if( empty( $example['result'] )) {
$example['format_guid'] = 'tikiwiki';
$tikiwiki[$section][$title]['result'] = LibertyContent::parseData( $example );
}
}
}
// mediawiki type tables
$mediawiki = array(
'Example 1' => array(
'data' =>
'{| border=3
|+A Simple Table
|-
! Col 1 !! Col 2 !! Col 3
|-
| Row1-Col1 || Row1-Col2 || Row1-Col3
|-
| Row2-Col1
| Row2-Col2
| Row2-Col3
|-
| Row3-Col1 || Row3-Col2 || Row3-Col3
|}'
),
'Example 2' => array(
'data' =>
'{| border="2" cellpadding="5"
|+Multiplication table
|-
! X !! 1 !! 2 !! 3
|-
! 1
| 1 || 2 || 3
|-
! 2
| 2 || 4 || 6
|-
! 3
| 3 || 6 || 9
|-
! 4
| 4 || 8 || 12
|-
! 5
| 5 || 10 || 15
|}'
),
'Example 3' => array(
'data' =>
'{|
|+ Table with alternating rows
|- class=odd
| one
| two
|- class=even
| class=highlight | three
| four
|- class=odd
| five
| six
|- class=even
| seven
| eight
|}'
),
'Example 4' => array(
'data' =>
'{| style="background:yellow;color:green"
|+ Table with many colours
|-
| abc
| colspan="2" style="text-align:center;background:lightblue;" | defghi
|- style="background:red;color:white"
| jkl
| mno
| pqr
|-
| style="font-weight:bold" | stu
| style="background:silver" | vwx
| yz
|}'
),
);
// parse tables
foreach( $mediawiki as $title => $example ) {
if( empty( $example['result'] )) {
$example['format_guid'] = 'tikiwiki';
$mediawiki[$title]['result'] = LibertyContent::parseData( $example );
}
}
$examples['tikiwiki'] = $tikiwiki;
$examples['mediawiki'] = $mediawiki;
$cache->writeCacheFile( $cacheFile, serialize( $examples ));
}
$gBitSmarty->assign( 'examples', $examples );
?>
|