<!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.&nbsp; 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!&nbsp; 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).&nbsp; However, some things are not completely correct.&nbsp; 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.&nbsp; 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.&nbsp; To test it out, just make a page name on the wiki with as name the date of today, formatted as yyyymmdd.&nbsp; 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.&nbsp; On another page, just put in (:calendarlist:) and view the results.&nbsp; 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','&lt;include',&quot;/\(:calendarlist:\)/e&quot;,&quot;CalendarList(\$pagename)&quot;);</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">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $r = &quot;&quot;;</FONT>

<BR><FONT SIZE=2 FACE="Courier New">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $date = strtotime(&quot;now&quot;);</FONT>

<BR><FONT SIZE=2 FACE="Courier New">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $r .= &quot;&lt;div&gt;(:include &quot; . date(&quot;Ymd&quot;, $date) . &quot;:)&lt;/div&gt;&quot;;</FONT>

<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2 FACE="Courier New">return $r;</FONT>

<BR><FONT SIZE=2 FACE="Courier New">}</FONT>
</P>
<BR>

</BODY>
</HTML>