<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<META NAME="Generator" CONTENT="MS Exchange Server version 6.0.6487.1">
<TITLE>problem with automatic generated includes</TITLE>
</HEAD>
<BODY>
<!-- Converted from text/rtf format -->
<P><FONT SIZE=2 FACE="Arial">Hi list,</FONT>
</P>
<P><FONT SIZE=2 FACE="Arial">I defined a markup (see end of message), which searches a wiki page for the (:calendarlist:) keyword, and replaces it with the results of the CalendarList function. This markup is defined to be run before the include markup is applied, because I will be generating (:include:) inside the CalendarList function.</FONT></P>
<P><FONT SIZE=2 FACE="Arial">This almost works like a charm! I am able to see if a page exists for a certain date, and display the contents on an overview page (something like Outlook Today). However, some things are not completely correct. When the target page starts with a list without anything before it (no whitespace, no other text), then the first item is not recognized as a list item on the page with the include. When the target page ends with a list without whitespace or other text, then the UL list is never closed, resulting in messy markup later on the page.</FONT></P>
<P><FONT SIZE=2 FACE="Arial">However, when I make these includes manual on a test page, everything is processed correctly.</FONT>
</P>
<P><FONT SIZE=2 FACE="Arial">Simple testing code is included below. To test it out, just make a page name on the wiki with as name the date of today, formatted as yyyymmdd. Put a list of 3 items on it, like: </FONT></P>
<P><FONT SIZE=2 FACE="Arial">*test 1</FONT>
<BR><FONT SIZE=2 FACE="Arial">*test 2</FONT>
<BR><FONT SIZE=2 FACE="Arial">*test 3</FONT>
</P>
<P><FONT SIZE=2 FACE="Arial">without whitespaces or text before/after. On another page, just put in (:calendarlist:) and view the results. If you put in the (:include yyyymmdd:) manually, you will see correct markup, but with my generated include, the page is messy.</FONT></P>
<P><FONT SIZE=2 FACE="Arial">What could cause this?</FONT>
</P>
<P><FONT SIZE=2 FACE="Arial">Jan Jacobs</FONT>
</P>
<P><FONT SIZE=2 FACE="Arial">PS: as a late remark: when I don't put in the DIV's around the include, markup seems ok, but with the DIV's, it screws up.</FONT></P>
<P><FONT SIZE=2 FACE="Arial">------------------------------------------------------------------------------------------------------------------------------------------------</FONT></P>
<P><FONT SIZE=2 FACE="Arial">Markup('calendarlist','<include',"/\(:calendarlist:\)/e","CalendarList(\$pagename)");</FONT>
</P>
<P><FONT SIZE=2 FACE="Courier New">function</FONT> <FONT SIZE=2 FACE="Arial">CalendarList</FONT><FONT SIZE=2 FACE="Courier New">($pagename) {</FONT>
<BR><FONT SIZE=2 FACE="Courier New"> $r = "";</FONT>
<BR><FONT SIZE=2 FACE="Courier New"> $date = strtotime("now");</FONT>
<BR><FONT SIZE=2 FACE="Courier New"> $r .= "<div>(:include " . date("Ymd", $date) . ":)</div>";</FONT>
<BR> <FONT SIZE=2 FACE="Courier New">return $r;</FONT>
<BR><FONT SIZE=2 FACE="Courier New">}</FONT>
</P>
<BR>
</BODY>
</HTML>