|
From: Reini U. <ru...@x-...> - 2001-03-04 16:36:45
|
I've experimented a bit with supporting html code.
But I need another feature not supported with this:
...<code> ...
verbatim multiline code, no wikilinks.
..</code>
the problem is the disabling of all further wiki transformations in such a
code block, which is multiline.
I've tried this bad hack, with combining some flags (for the special
do_transform loop),
and setting other global vars for the loop. but it is very dirty, and doesn't
even work yet.
any ideas?
$transform->register(WT_SIMPLE_MARKUP & WT_MODE_MARKUP, 'wtm_code', '<code>');
function wtm_code($line, &$trfrm) {
global $transform;
$line = $trfrm->SetHTMLMode('code', ZERO_LEVEL, 0) . "\n" . $line;
$transform->mode_set = 1; // hack to allow mult. lines
return $line;
}
another unclean idea I tried, was to process all lines in the <code> block
seperately.
something like this:
// protected text within a <code> block. no markups at all.
// not line orientated! (like <nowiki> or <verbatim>)
/*
function wtm_code($line, &$trfrm) {
global $transform;
$i = strpos($line, '<code>');
$prefix = substr($line,0,$i);
$line = substr($line,$i);
// echo "<code>: $line<br>"; // debug
$c = $transform->linenumber;
$count = count($transform->content);
// this might fail on missing closing tag
while (!$i and ($c < $count))
{
$actline = $transform->content[$c];
$i = strpos($actline, '</code>');
$line .= $actline;
$c++;
}
$transform->linenumber = $c;
// echo "</code>: ",substr($actline,$i),"<br>"; // debug
return $prefix . $line . substr($actline,$i);
}
*/
Steve Wainstead schrieb:
>
> On Thu, 22 Feb 2001, Didier Bretin wrote:
>
> > Hello,
> >
> > I'm with the 1.1.9 version, and I can't find where I can allow the use
> > of html. Can you help me ? :o)
>
> To enable HTML, you only have to uncomment one block of code in
> lib/transform.php. It looks like this:
>
> /* If your web server is not accessble to the general public, you may
> allow this code below, which allows embedded HTML. If just anyone can
> reach
> your web server it is highly advised that you do not allow this.
>
> elseif (preg_match("/(^\|)(.*)/", $tmpline, $matches)) {
> // HTML mode
> $html .= SetHTMLOutputMode("", ZERO_DEPTH, 0);
> $html .= $matches[2];
> continue;
> }
> */
>
> Just strip out all the comments and you can then insert HTML this way:
>
> | <table>
> | <tr><td>blah</td></tr>
> | </table>
>
> by putting a bar | at the start of every line.
>
> If you want to go much further than that you can change the rules in
> transform.php (not for the light hearted!) to use HTML instead of Wiki
> markup.
>
> cheers
> ~swain
>
> ...............................ooo0000ooo.................................
> Hear FM quality freeform radio through the Internet: http://wcsb.org/
> home page: www.wcsb.org/~swain
>
> _______________________________________________
> Phpwiki-talk mailing list
> Php...@li...
> http://lists.sourceforge.net/lists/listinfo/phpwiki-talk
--
Reini Urban
http://xarch.tu-graz.ac.at/home/rurban/
|