author | Dan |
Thu, 20 Aug 2009 20:01:55 -0400 | |
changeset 1081 | 745200a9cc2a |
parent 1078 | 67a4c839c7e1 |
child 1096 | 86feb1c7ca3f |
permissions | -rw-r--r-- |
1027
98c052fc3337
First implementation of new parser; Text_Wiki is now gone. VERY BETA! WiP.
Dan
parents:
diff
changeset
|
1 |
<?php |
98c052fc3337
First implementation of new parser; Text_Wiki is now gone. VERY BETA! WiP.
Dan
parents:
diff
changeset
|
2 |
|
98c052fc3337
First implementation of new parser; Text_Wiki is now gone. VERY BETA! WiP.
Dan
parents:
diff
changeset
|
3 |
/* |
98c052fc3337
First implementation of new parser; Text_Wiki is now gone. VERY BETA! WiP.
Dan
parents:
diff
changeset
|
4 |
* Enano - an open-source CMS capable of wiki functions, Drupal-like sidebar blocks, and everything in between |
1081
745200a9cc2a
Fixed some upgrade bugs; added support for choosing one's own date/time formats; rebrand as 1.1.7
Dan
parents:
1078
diff
changeset
|
5 |
* Copyright (C) 2006-2009 Dan Fuhry |
1027
98c052fc3337
First implementation of new parser; Text_Wiki is now gone. VERY BETA! WiP.
Dan
parents:
diff
changeset
|
6 |
* |
98c052fc3337
First implementation of new parser; Text_Wiki is now gone. VERY BETA! WiP.
Dan
parents:
diff
changeset
|
7 |
* This program is Free Software; you can redistribute and/or modify it under the terms of the GNU General Public License |
98c052fc3337
First implementation of new parser; Text_Wiki is now gone. VERY BETA! WiP.
Dan
parents:
diff
changeset
|
8 |
* as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. |
98c052fc3337
First implementation of new parser; Text_Wiki is now gone. VERY BETA! WiP.
Dan
parents:
diff
changeset
|
9 |
* |
98c052fc3337
First implementation of new parser; Text_Wiki is now gone. VERY BETA! WiP.
Dan
parents:
diff
changeset
|
10 |
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied |
98c052fc3337
First implementation of new parser; Text_Wiki is now gone. VERY BETA! WiP.
Dan
parents:
diff
changeset
|
11 |
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. |
98c052fc3337
First implementation of new parser; Text_Wiki is now gone. VERY BETA! WiP.
Dan
parents:
diff
changeset
|
12 |
*/ |
98c052fc3337
First implementation of new parser; Text_Wiki is now gone. VERY BETA! WiP.
Dan
parents:
diff
changeset
|
13 |
|
98c052fc3337
First implementation of new parser; Text_Wiki is now gone. VERY BETA! WiP.
Dan
parents:
diff
changeset
|
14 |
class Carpenter_Render_Xhtml |
98c052fc3337
First implementation of new parser; Text_Wiki is now gone. VERY BETA! WiP.
Dan
parents:
diff
changeset
|
15 |
{ |
98c052fc3337
First implementation of new parser; Text_Wiki is now gone. VERY BETA! WiP.
Dan
parents:
diff
changeset
|
16 |
public $rules = array( |
98c052fc3337
First implementation of new parser; Text_Wiki is now gone. VERY BETA! WiP.
Dan
parents:
diff
changeset
|
17 |
'lang' => '', |
98c052fc3337
First implementation of new parser; Text_Wiki is now gone. VERY BETA! WiP.
Dan
parents:
diff
changeset
|
18 |
'templates' => '', |
98c052fc3337
First implementation of new parser; Text_Wiki is now gone. VERY BETA! WiP.
Dan
parents:
diff
changeset
|
19 |
'bold' => '<strong>\\1</strong>', |
98c052fc3337
First implementation of new parser; Text_Wiki is now gone. VERY BETA! WiP.
Dan
parents:
diff
changeset
|
20 |
'italic' => '<em>\\1</em>', |
98c052fc3337
First implementation of new parser; Text_Wiki is now gone. VERY BETA! WiP.
Dan
parents:
diff
changeset
|
21 |
'underline' => '<span style="text-decoration: underline;">\\1</span>', |
98c052fc3337
First implementation of new parser; Text_Wiki is now gone. VERY BETA! WiP.
Dan
parents:
diff
changeset
|
22 |
'externalwithtext' => '<a href="\\1" onclick="window.open(this.href); return false;">\\2</a>', |
1073
b19a9bcb6a45
More work on rendering engine. Fixed some bugs with paragraph skipping and added (incomplete) support for blockquotes.
Dan
parents:
1044
diff
changeset
|
23 |
'externalnotext' => '<a href="\\1" onclick="window.open(this.href); return false;">\\1</a>' |
1027
98c052fc3337
First implementation of new parser; Text_Wiki is now gone. VERY BETA! WiP.
Dan
parents:
diff
changeset
|
24 |
); |
98c052fc3337
First implementation of new parser; Text_Wiki is now gone. VERY BETA! WiP.
Dan
parents:
diff
changeset
|
25 |
|
98c052fc3337
First implementation of new parser; Text_Wiki is now gone. VERY BETA! WiP.
Dan
parents:
diff
changeset
|
26 |
public function heading($text, $pieces) |
98c052fc3337
First implementation of new parser; Text_Wiki is now gone. VERY BETA! WiP.
Dan
parents:
diff
changeset
|
27 |
{ |
98c052fc3337
First implementation of new parser; Text_Wiki is now gone. VERY BETA! WiP.
Dan
parents:
diff
changeset
|
28 |
static $tocid = -1; |
98c052fc3337
First implementation of new parser; Text_Wiki is now gone. VERY BETA! WiP.
Dan
parents:
diff
changeset
|
29 |
foreach ( $pieces as $i => $piece ) |
98c052fc3337
First implementation of new parser; Text_Wiki is now gone. VERY BETA! WiP.
Dan
parents:
diff
changeset
|
30 |
{ |
98c052fc3337
First implementation of new parser; Text_Wiki is now gone. VERY BETA! WiP.
Dan
parents:
diff
changeset
|
31 |
$tocid++; |
98c052fc3337
First implementation of new parser; Text_Wiki is now gone. VERY BETA! WiP.
Dan
parents:
diff
changeset
|
32 |
$tag = '<h' . $piece['level'] . ' id="toc' . $tocid . '">'; |
98c052fc3337
First implementation of new parser; Text_Wiki is now gone. VERY BETA! WiP.
Dan
parents:
diff
changeset
|
33 |
$tag .= trim($piece['text']); |
98c052fc3337
First implementation of new parser; Text_Wiki is now gone. VERY BETA! WiP.
Dan
parents:
diff
changeset
|
34 |
$tag .= '</h' . $piece['level'] . '>'; |
98c052fc3337
First implementation of new parser; Text_Wiki is now gone. VERY BETA! WiP.
Dan
parents:
diff
changeset
|
35 |
|
98c052fc3337
First implementation of new parser; Text_Wiki is now gone. VERY BETA! WiP.
Dan
parents:
diff
changeset
|
36 |
$text = str_replace(Carpenter::generate_token($i), $tag, $text); |
98c052fc3337
First implementation of new parser; Text_Wiki is now gone. VERY BETA! WiP.
Dan
parents:
diff
changeset
|
37 |
} |
98c052fc3337
First implementation of new parser; Text_Wiki is now gone. VERY BETA! WiP.
Dan
parents:
diff
changeset
|
38 |
|
98c052fc3337
First implementation of new parser; Text_Wiki is now gone. VERY BETA! WiP.
Dan
parents:
diff
changeset
|
39 |
return $text; |
98c052fc3337
First implementation of new parser; Text_Wiki is now gone. VERY BETA! WiP.
Dan
parents:
diff
changeset
|
40 |
} |
98c052fc3337
First implementation of new parser; Text_Wiki is now gone. VERY BETA! WiP.
Dan
parents:
diff
changeset
|
41 |
|
98c052fc3337
First implementation of new parser; Text_Wiki is now gone. VERY BETA! WiP.
Dan
parents:
diff
changeset
|
42 |
public function multilist($text, $pieces) |
98c052fc3337
First implementation of new parser; Text_Wiki is now gone. VERY BETA! WiP.
Dan
parents:
diff
changeset
|
43 |
{ |
98c052fc3337
First implementation of new parser; Text_Wiki is now gone. VERY BETA! WiP.
Dan
parents:
diff
changeset
|
44 |
foreach ( $pieces as $i => $piece ) |
98c052fc3337
First implementation of new parser; Text_Wiki is now gone. VERY BETA! WiP.
Dan
parents:
diff
changeset
|
45 |
{ |
98c052fc3337
First implementation of new parser; Text_Wiki is now gone. VERY BETA! WiP.
Dan
parents:
diff
changeset
|
46 |
switch($piece['type']) |
98c052fc3337
First implementation of new parser; Text_Wiki is now gone. VERY BETA! WiP.
Dan
parents:
diff
changeset
|
47 |
{ |
98c052fc3337
First implementation of new parser; Text_Wiki is now gone. VERY BETA! WiP.
Dan
parents:
diff
changeset
|
48 |
case 'unordered': |
98c052fc3337
First implementation of new parser; Text_Wiki is now gone. VERY BETA! WiP.
Dan
parents:
diff
changeset
|
49 |
default: |
98c052fc3337
First implementation of new parser; Text_Wiki is now gone. VERY BETA! WiP.
Dan
parents:
diff
changeset
|
50 |
$btag = 'ul'; |
98c052fc3337
First implementation of new parser; Text_Wiki is now gone. VERY BETA! WiP.
Dan
parents:
diff
changeset
|
51 |
$itag = 'li'; |
98c052fc3337
First implementation of new parser; Text_Wiki is now gone. VERY BETA! WiP.
Dan
parents:
diff
changeset
|
52 |
break; |
98c052fc3337
First implementation of new parser; Text_Wiki is now gone. VERY BETA! WiP.
Dan
parents:
diff
changeset
|
53 |
case 'ordered': |
98c052fc3337
First implementation of new parser; Text_Wiki is now gone. VERY BETA! WiP.
Dan
parents:
diff
changeset
|
54 |
$btag = 'ol'; |
98c052fc3337
First implementation of new parser; Text_Wiki is now gone. VERY BETA! WiP.
Dan
parents:
diff
changeset
|
55 |
$itag = 'li'; |
98c052fc3337
First implementation of new parser; Text_Wiki is now gone. VERY BETA! WiP.
Dan
parents:
diff
changeset
|
56 |
break; |
98c052fc3337
First implementation of new parser; Text_Wiki is now gone. VERY BETA! WiP.
Dan
parents:
diff
changeset
|
57 |
case 'indent': |
98c052fc3337
First implementation of new parser; Text_Wiki is now gone. VERY BETA! WiP.
Dan
parents:
diff
changeset
|
58 |
$btag = 'dl'; |
98c052fc3337
First implementation of new parser; Text_Wiki is now gone. VERY BETA! WiP.
Dan
parents:
diff
changeset
|
59 |
$itag = 'dd'; |
98c052fc3337
First implementation of new parser; Text_Wiki is now gone. VERY BETA! WiP.
Dan
parents:
diff
changeset
|
60 |
break; |
98c052fc3337
First implementation of new parser; Text_Wiki is now gone. VERY BETA! WiP.
Dan
parents:
diff
changeset
|
61 |
} |
1073
b19a9bcb6a45
More work on rendering engine. Fixed some bugs with paragraph skipping and added (incomplete) support for blockquotes.
Dan
parents:
1044
diff
changeset
|
62 |
$list = "<_paragraph_bypass><$btag>\n"; |
1027
98c052fc3337
First implementation of new parser; Text_Wiki is now gone. VERY BETA! WiP.
Dan
parents:
diff
changeset
|
63 |
$spacing = ''; |
98c052fc3337
First implementation of new parser; Text_Wiki is now gone. VERY BETA! WiP.
Dan
parents:
diff
changeset
|
64 |
$depth = 1; |
98c052fc3337
First implementation of new parser; Text_Wiki is now gone. VERY BETA! WiP.
Dan
parents:
diff
changeset
|
65 |
foreach ( $piece['items'] as $j => $item ) |
98c052fc3337
First implementation of new parser; Text_Wiki is now gone. VERY BETA! WiP.
Dan
parents:
diff
changeset
|
66 |
{ |
98c052fc3337
First implementation of new parser; Text_Wiki is now gone. VERY BETA! WiP.
Dan
parents:
diff
changeset
|
67 |
// most of this just goes into pretty formatting. |
98c052fc3337
First implementation of new parser; Text_Wiki is now gone. VERY BETA! WiP.
Dan
parents:
diff
changeset
|
68 |
// everything else goes into meeting the PITA requirement that if you're going |
98c052fc3337
First implementation of new parser; Text_Wiki is now gone. VERY BETA! WiP.
Dan
parents:
diff
changeset
|
69 |
// another level deep, HTML requires the next level to be INSIDE of the <dd>/<li> tag. |
98c052fc3337
First implementation of new parser; Text_Wiki is now gone. VERY BETA! WiP.
Dan
parents:
diff
changeset
|
70 |
$itemdepth = $item['depth']; |
98c052fc3337
First implementation of new parser; Text_Wiki is now gone. VERY BETA! WiP.
Dan
parents:
diff
changeset
|
71 |
if ( $itemdepth > $depth ) |
98c052fc3337
First implementation of new parser; Text_Wiki is now gone. VERY BETA! WiP.
Dan
parents:
diff
changeset
|
72 |
{ |
98c052fc3337
First implementation of new parser; Text_Wiki is now gone. VERY BETA! WiP.
Dan
parents:
diff
changeset
|
73 |
while ( $depth < $itemdepth ) |
98c052fc3337
First implementation of new parser; Text_Wiki is now gone. VERY BETA! WiP.
Dan
parents:
diff
changeset
|
74 |
{ |
98c052fc3337
First implementation of new parser; Text_Wiki is now gone. VERY BETA! WiP.
Dan
parents:
diff
changeset
|
75 |
$spacing .= ' '; |
98c052fc3337
First implementation of new parser; Text_Wiki is now gone. VERY BETA! WiP.
Dan
parents:
diff
changeset
|
76 |
$list .= "{$spacing}<$btag>\n"; |
98c052fc3337
First implementation of new parser; Text_Wiki is now gone. VERY BETA! WiP.
Dan
parents:
diff
changeset
|
77 |
$depth++; |
98c052fc3337
First implementation of new parser; Text_Wiki is now gone. VERY BETA! WiP.
Dan
parents:
diff
changeset
|
78 |
} |
98c052fc3337
First implementation of new parser; Text_Wiki is now gone. VERY BETA! WiP.
Dan
parents:
diff
changeset
|
79 |
} |
98c052fc3337
First implementation of new parser; Text_Wiki is now gone. VERY BETA! WiP.
Dan
parents:
diff
changeset
|
80 |
else if ( $itemdepth < $depth ) |
98c052fc3337
First implementation of new parser; Text_Wiki is now gone. VERY BETA! WiP.
Dan
parents:
diff
changeset
|
81 |
{ |
98c052fc3337
First implementation of new parser; Text_Wiki is now gone. VERY BETA! WiP.
Dan
parents:
diff
changeset
|
82 |
while ( $depth > $itemdepth ) |
98c052fc3337
First implementation of new parser; Text_Wiki is now gone. VERY BETA! WiP.
Dan
parents:
diff
changeset
|
83 |
{ |
98c052fc3337
First implementation of new parser; Text_Wiki is now gone. VERY BETA! WiP.
Dan
parents:
diff
changeset
|
84 |
$list .= "{$spacing}</$btag>\n"; |
98c052fc3337
First implementation of new parser; Text_Wiki is now gone. VERY BETA! WiP.
Dan
parents:
diff
changeset
|
85 |
$spacing = substr($spacing, 4); |
98c052fc3337
First implementation of new parser; Text_Wiki is now gone. VERY BETA! WiP.
Dan
parents:
diff
changeset
|
86 |
$list .= "{$spacing}</$itag>\n"; |
98c052fc3337
First implementation of new parser; Text_Wiki is now gone. VERY BETA! WiP.
Dan
parents:
diff
changeset
|
87 |
$spacing = substr($spacing, 4); |
98c052fc3337
First implementation of new parser; Text_Wiki is now gone. VERY BETA! WiP.
Dan
parents:
diff
changeset
|
88 |
$depth--; |
98c052fc3337
First implementation of new parser; Text_Wiki is now gone. VERY BETA! WiP.
Dan
parents:
diff
changeset
|
89 |
} |
98c052fc3337
First implementation of new parser; Text_Wiki is now gone. VERY BETA! WiP.
Dan
parents:
diff
changeset
|
90 |
} |
98c052fc3337
First implementation of new parser; Text_Wiki is now gone. VERY BETA! WiP.
Dan
parents:
diff
changeset
|
91 |
$list .= "{$spacing} <$itag>" . nl2br($item['text']); |
98c052fc3337
First implementation of new parser; Text_Wiki is now gone. VERY BETA! WiP.
Dan
parents:
diff
changeset
|
92 |
if ( ( isset($piece['items'][ ++$j ]) && $piece['items'][ $j ]['depth'] <= $itemdepth ) || !isset($piece['items'][ $j ]) ) |
98c052fc3337
First implementation of new parser; Text_Wiki is now gone. VERY BETA! WiP.
Dan
parents:
diff
changeset
|
93 |
{ |
98c052fc3337
First implementation of new parser; Text_Wiki is now gone. VERY BETA! WiP.
Dan
parents:
diff
changeset
|
94 |
$list .= "</$itag>\n"; |
98c052fc3337
First implementation of new parser; Text_Wiki is now gone. VERY BETA! WiP.
Dan
parents:
diff
changeset
|
95 |
} |
98c052fc3337
First implementation of new parser; Text_Wiki is now gone. VERY BETA! WiP.
Dan
parents:
diff
changeset
|
96 |
else |
98c052fc3337
First implementation of new parser; Text_Wiki is now gone. VERY BETA! WiP.
Dan
parents:
diff
changeset
|
97 |
{ |
98c052fc3337
First implementation of new parser; Text_Wiki is now gone. VERY BETA! WiP.
Dan
parents:
diff
changeset
|
98 |
$list .= "\n"; |
98c052fc3337
First implementation of new parser; Text_Wiki is now gone. VERY BETA! WiP.
Dan
parents:
diff
changeset
|
99 |
$spacing .= " "; |
98c052fc3337
First implementation of new parser; Text_Wiki is now gone. VERY BETA! WiP.
Dan
parents:
diff
changeset
|
100 |
} |
98c052fc3337
First implementation of new parser; Text_Wiki is now gone. VERY BETA! WiP.
Dan
parents:
diff
changeset
|
101 |
} |
98c052fc3337
First implementation of new parser; Text_Wiki is now gone. VERY BETA! WiP.
Dan
parents:
diff
changeset
|
102 |
while ( $depth > 1 ) |
98c052fc3337
First implementation of new parser; Text_Wiki is now gone. VERY BETA! WiP.
Dan
parents:
diff
changeset
|
103 |
{ |
98c052fc3337
First implementation of new parser; Text_Wiki is now gone. VERY BETA! WiP.
Dan
parents:
diff
changeset
|
104 |
$list .= "{$spacing}</$btag>\n"; |
98c052fc3337
First implementation of new parser; Text_Wiki is now gone. VERY BETA! WiP.
Dan
parents:
diff
changeset
|
105 |
$spacing = substr($spacing, 4); |
98c052fc3337
First implementation of new parser; Text_Wiki is now gone. VERY BETA! WiP.
Dan
parents:
diff
changeset
|
106 |
$list .= "{$spacing}</$itag>\n"; |
98c052fc3337
First implementation of new parser; Text_Wiki is now gone. VERY BETA! WiP.
Dan
parents:
diff
changeset
|
107 |
$spacing = substr($spacing, 4); |
98c052fc3337
First implementation of new parser; Text_Wiki is now gone. VERY BETA! WiP.
Dan
parents:
diff
changeset
|
108 |
$depth--; |
98c052fc3337
First implementation of new parser; Text_Wiki is now gone. VERY BETA! WiP.
Dan
parents:
diff
changeset
|
109 |
} |
1073
b19a9bcb6a45
More work on rendering engine. Fixed some bugs with paragraph skipping and added (incomplete) support for blockquotes.
Dan
parents:
1044
diff
changeset
|
110 |
$list .= "</$btag></_paragraph_bypass>\n"; |
1027
98c052fc3337
First implementation of new parser; Text_Wiki is now gone. VERY BETA! WiP.
Dan
parents:
diff
changeset
|
111 |
$text = str_replace(Carpenter::generate_token($i), $list, $text); |
98c052fc3337
First implementation of new parser; Text_Wiki is now gone. VERY BETA! WiP.
Dan
parents:
diff
changeset
|
112 |
} |
98c052fc3337
First implementation of new parser; Text_Wiki is now gone. VERY BETA! WiP.
Dan
parents:
diff
changeset
|
113 |
return $text; |
98c052fc3337
First implementation of new parser; Text_Wiki is now gone. VERY BETA! WiP.
Dan
parents:
diff
changeset
|
114 |
} |
98c052fc3337
First implementation of new parser; Text_Wiki is now gone. VERY BETA! WiP.
Dan
parents:
diff
changeset
|
115 |
|
1078
67a4c839c7e1
Blockquote functionality in wikitext parser now allows rendering of other block level elements properly
Dan
parents:
1073
diff
changeset
|
116 |
public function blockquote($text) |
67a4c839c7e1
Blockquote functionality in wikitext parser now allows rendering of other block level elements properly
Dan
parents:
1073
diff
changeset
|
117 |
{ |
67a4c839c7e1
Blockquote functionality in wikitext parser now allows rendering of other block level elements properly
Dan
parents:
1073
diff
changeset
|
118 |
return $text; |
67a4c839c7e1
Blockquote functionality in wikitext parser now allows rendering of other block level elements properly
Dan
parents:
1073
diff
changeset
|
119 |
} |
67a4c839c7e1
Blockquote functionality in wikitext parser now allows rendering of other block level elements properly
Dan
parents:
1073
diff
changeset
|
120 |
|
67a4c839c7e1
Blockquote functionality in wikitext parser now allows rendering of other block level elements properly
Dan
parents:
1073
diff
changeset
|
121 |
public function blockquotepost($text, $rand_id) |
1073
b19a9bcb6a45
More work on rendering engine. Fixed some bugs with paragraph skipping and added (incomplete) support for blockquotes.
Dan
parents:
1044
diff
changeset
|
122 |
{ |
1078
67a4c839c7e1
Blockquote functionality in wikitext parser now allows rendering of other block level elements properly
Dan
parents:
1073
diff
changeset
|
123 |
$text = strtr($text, array( |
67a4c839c7e1
Blockquote functionality in wikitext parser now allows rendering of other block level elements properly
Dan
parents:
1073
diff
changeset
|
124 |
"<p>{blockquote:$rand_id}<br />" => '<blockquote>', |
67a4c839c7e1
Blockquote functionality in wikitext parser now allows rendering of other block level elements properly
Dan
parents:
1073
diff
changeset
|
125 |
"<br />\n{/blockquote:$rand_id}</p>" => '</blockquote>', |
67a4c839c7e1
Blockquote functionality in wikitext parser now allows rendering of other block level elements properly
Dan
parents:
1073
diff
changeset
|
126 |
"{blockquote:$rand_id}" => '<blockquote>', |
67a4c839c7e1
Blockquote functionality in wikitext parser now allows rendering of other block level elements properly
Dan
parents:
1073
diff
changeset
|
127 |
"{/blockquote:$rand_id}" => '</blockquote>' |
67a4c839c7e1
Blockquote functionality in wikitext parser now allows rendering of other block level elements properly
Dan
parents:
1073
diff
changeset
|
128 |
)); |
67a4c839c7e1
Blockquote functionality in wikitext parser now allows rendering of other block level elements properly
Dan
parents:
1073
diff
changeset
|
129 |
$text = strtr($text, array( |
67a4c839c7e1
Blockquote functionality in wikitext parser now allows rendering of other block level elements properly
Dan
parents:
1073
diff
changeset
|
130 |
"<blockquote><br />" => '<blockquote>', |
67a4c839c7e1
Blockquote functionality in wikitext parser now allows rendering of other block level elements properly
Dan
parents:
1073
diff
changeset
|
131 |
"</blockquote><br />" => '</blockquote>' |
67a4c839c7e1
Blockquote functionality in wikitext parser now allows rendering of other block level elements properly
Dan
parents:
1073
diff
changeset
|
132 |
)); |
1073
b19a9bcb6a45
More work on rendering engine. Fixed some bugs with paragraph skipping and added (incomplete) support for blockquotes.
Dan
parents:
1044
diff
changeset
|
133 |
return $text; |
b19a9bcb6a45
More work on rendering engine. Fixed some bugs with paragraph skipping and added (incomplete) support for blockquotes.
Dan
parents:
1044
diff
changeset
|
134 |
} |
b19a9bcb6a45
More work on rendering engine. Fixed some bugs with paragraph skipping and added (incomplete) support for blockquotes.
Dan
parents:
1044
diff
changeset
|
135 |
|
1027
98c052fc3337
First implementation of new parser; Text_Wiki is now gone. VERY BETA! WiP.
Dan
parents:
diff
changeset
|
136 |
public function paragraph($text, $pieces) |
98c052fc3337
First implementation of new parser; Text_Wiki is now gone. VERY BETA! WiP.
Dan
parents:
diff
changeset
|
137 |
{ |
98c052fc3337
First implementation of new parser; Text_Wiki is now gone. VERY BETA! WiP.
Dan
parents:
diff
changeset
|
138 |
foreach ( $pieces as $i => $piece ) |
98c052fc3337
First implementation of new parser; Text_Wiki is now gone. VERY BETA! WiP.
Dan
parents:
diff
changeset
|
139 |
{ |
98c052fc3337
First implementation of new parser; Text_Wiki is now gone. VERY BETA! WiP.
Dan
parents:
diff
changeset
|
140 |
$text = str_replace(Carpenter::generate_token($i), '<p>' . nl2br($piece) . '</p>', $text); |
98c052fc3337
First implementation of new parser; Text_Wiki is now gone. VERY BETA! WiP.
Dan
parents:
diff
changeset
|
141 |
} |
98c052fc3337
First implementation of new parser; Text_Wiki is now gone. VERY BETA! WiP.
Dan
parents:
diff
changeset
|
142 |
|
98c052fc3337
First implementation of new parser; Text_Wiki is now gone. VERY BETA! WiP.
Dan
parents:
diff
changeset
|
143 |
return $text; |
98c052fc3337
First implementation of new parser; Text_Wiki is now gone. VERY BETA! WiP.
Dan
parents:
diff
changeset
|
144 |
} |
98c052fc3337
First implementation of new parser; Text_Wiki is now gone. VERY BETA! WiP.
Dan
parents:
diff
changeset
|
145 |
} |
98c052fc3337
First implementation of new parser; Text_Wiki is now gone. VERY BETA! WiP.
Dan
parents:
diff
changeset
|
146 |
|
98c052fc3337
First implementation of new parser; Text_Wiki is now gone. VERY BETA! WiP.
Dan
parents:
diff
changeset
|
147 |
// Alias internal link parsing to RenderMan's method |
98c052fc3337
First implementation of new parser; Text_Wiki is now gone. VERY BETA! WiP.
Dan
parents:
diff
changeset
|
148 |
function parser_mediawiki_xhtml_internallink($text) |
98c052fc3337
First implementation of new parser; Text_Wiki is now gone. VERY BETA! WiP.
Dan
parents:
diff
changeset
|
149 |
{ |
98c052fc3337
First implementation of new parser; Text_Wiki is now gone. VERY BETA! WiP.
Dan
parents:
diff
changeset
|
150 |
return RenderMan::parse_internal_links($text); |
98c052fc3337
First implementation of new parser; Text_Wiki is now gone. VERY BETA! WiP.
Dan
parents:
diff
changeset
|
151 |
} |
98c052fc3337
First implementation of new parser; Text_Wiki is now gone. VERY BETA! WiP.
Dan
parents:
diff
changeset
|
152 |