From: Didier B. <db...@in...> - 2001-02-22 14:54:18
|
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) Thanks -- .------------------------------------------------. .^. | Didier Bretin, France | db...@in... | /V\ |-----------------------| www.informactis.com | // \\ | `------------------------| /( )\ | Visit: http://www.multimania.com/cieexcalibur/ | ^^-^^ `------------------------------------------------' |
From: Steve W. <sw...@wc...> - 2001-02-28 14:40:52
|
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 |
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/ |
From: Steve W. <sw...@pa...> - 2001-03-05 18:28:57
|
Hi Reini, sorry for the delay... After thinking for a bit about the problem, I always come back to the idea of "token substitution." We use the $FieldSeparator variable to pull things out of the text of the page when parsing, which you've probably seen in the code. We do this for links: see this great site: http://www.foo.com/ is transformed into: see this great site: tokenNumbertoken Actually the token in 1.2 and earlier is the "power of three" symbol (i.e. 10^3 == 1000). But you should see what I mean. To avoid the changing of any HTML in the page source, you could just use the same technique to pull out all HTML tags before processing and then put them back when it's done. You could even do this on a line-by-line basis; you wouldn't need to work on the page as a whole. So for each line you would use a regexp matching whatever HTML you want to allow, replace all matches with tokens, and after all the Wiki transformations are done you would just put the HTML back in. If that doesn't make sense let me know and I'll try to explain further. However you should be able to just copy the code that pulls out links and later puts them back, but instead of matching for links you can match for HTML tags. cheers ~swain > 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/ > > _______________________________________________ > Phpwiki-talk mailing list > Php...@li... > http://lists.sourceforge.net/lists/listinfo/phpwiki-talk > --- http://wcsb.org/~swain/ "Without music to decorate it, time is just a bunch of boring production deadlines or dates by which bills must be paid." -- Frank Zappa |
From: Steve W. <sw...@pa...> - 2001-03-05 18:43:21
|
On Mon, 5 Mar 2001, Steve Wainstead wrote: > > > Hi Reini, sorry for the delay... > > After thinking for a bit about the problem, I always come back to the idea > of "token substitution." > > We use the $FieldSeparator variable to pull things out of the text of the > page when parsing, which you've probably seen in the code. We do this for > links: What I should have written is "We use the $FieldSeparator variable to *replace* things in the text..." ~swain --- http://wcsb.org/~swain/ "Without music to decorate it, time is just a bunch of boring production deadlines or dates by which bills must be paid." -- Frank Zappa |
From: Reini U. <ru...@x-...> - 2001-03-06 03:16:35
|
Steve Wainstead schrieb: > Hi Reini, sorry for the delay... I've already implemented it now in my AcadWiki. To support some multiline blocks (verbatim, code and nowiki) I've made a seperate loop to avoid looping all other transformer funcs. This block is completely protected from further wiki transformations, only htmlchars are enforced to avoid HTML inline code. code is asis, verbatim and nowiki converts "<" to "<" ... But to overcome <code><html><script><!-- do something bad --></script></html></code> A special regex checks for </?[a-z]{1,6}> strings inside the code block and transforms < to < then. I want <code> to support arbitrary pasted code in every language. (lisp, c, perl, php, java, ...) There the comparison characters "<" and ">" should not appear too close. if (a < 2 || a > 4) is no html tag. but if (2<a>4) is one. is this valid code in some exotic language? when pasting from the wiki you'll otherwise get the ugly < and > chars. > After thinking for a bit about the problem, I always come back to the idea > of "token substitution." ... thanks for your description. this can be used to disable <script> and other malicious tags then. (as in meatball) -- Reini Urban http://xarch.tu-graz.ac.at/home/rurban/ |