cvs: pear /Text_Wiki/Text/Wiki/Render/Xhtml Wikilink.php
| From: | Justin Patrin | Date: | Tue, 28 Feb 2006 02:06:18 +0000 |
| Subject: | cvs: pear /Text_Wiki/Text/Wiki/Render/Xhtml Wikilink.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-38715@lists.php.net to get a copy of this message | ||
justinpatrin Tue Feb 28 02:06:18 2006 UTC
Modified files:
/pear/Text_Wiki/Text/Wiki/Render/Xhtml Wikilink.php
Log:
Add support for wikilinks which are split into start and end tokens around link text
- This is needed for proper conversion of one syntax into another and allows for formatting within
a link's text
- Note: old style still works and is still used in the Default parser, newer parsers should use
the new type
http://cvs.php.net/viewcvs.cgi/pear/Text_Wiki/Text/Wiki/Render/Xhtml/Wikilink.php?r1=1.14&r2=1.15&diff_format=u
Index: pear/Text_Wiki/Text/Wiki/Render/Xhtml/Wikilink.php
diff -u pear/Text_Wiki/Text/Wiki/Render/Xhtml/Wikilink.php:1.14
pear/Text_Wiki/Text/Wiki/Render/Xhtml/Wikilink.php:1.15
--- pear/Text_Wiki/Text/Wiki/Render/Xhtml/Wikilink.php:1.14 Fri Feb 10 23:07:03 2006
+++ pear/Text_Wiki/Text/Wiki/Render/Xhtml/Wikilink.php Tue Feb 28 02:06:18 2006
@@ -9,7 +9,7 @@
* @package Text_Wiki
* @author Paul M. Jones <pmjones@php.net>
* @license http://www.gnu.org/copyleft/lesser.html LGPL
License 2.1
- * @version CVS: $Id: Wikilink.php,v 1.14 2006/02/10 23:07:03 toggg Exp $
+ * @version CVS: $Id: Wikilink.php,v 1.15 2006/02/28 02:06:18 justinpatrin Exp $
* @link http://pear.php.net/package/Text_Wiki
*/
@@ -107,8 +107,9 @@
// get the CSS class and generate output
$css = $this->formatConf(' class="%s"', 'css');
- $output = "<a$css href=\"$href\">$text</a>";
+ $start = '<a'.$css.' href="'.$href.'">';
+ $end = '</a>';
} else {
// PAGE DOES NOT EXIST.
@@ -145,14 +146,33 @@
$pos = $this->getConf('new_text_pos');
if (! $pos || ! $new) {
// no position (or no new_text), use css only on the page name
- $output = "<a$css href=\"$href\">$page</a>";
+
+ //do we really want this? it breaks the text output of the output
+ // if the page does not exist and the link text != page name
+ $text = $page;
+ $start = '<a'.$css.'
href="'.$href.'">';
+ $end = '</a>';
} elseif ($pos == 'before') {
// use the new_text BEFORE the page name
- $output = "<a$css href=\"$href\">$new</a>$text";
+ $start = '<a'.$css.'
href="'.$href.'">'.$new.'</a>';
+ $end = '';
} else {
// default, use the new_text link AFTER the page name
- $output = "$text<a$css href=\"$href\">$new</a>";
+ $start = '';
+ $end = '<a'.$css.'
href="'.$href.'">'.$new.'</a>';
+ }
+ }
+ if (isset($type)) {
+ switch ($type) {
+ case 'start':
+ $output = $start;
+ break;
+ case 'end':
+ $output = $end;
+ break;
}
+ } else {
+ $output = $start.$text.$end;
}
return $output;
}