[dokuwiki] Re: RSS feed tweaks

  • From: "Joe Lapp" <joe.lapp@xxxxxxxxx>
  • To: dokuwiki@xxxxxxxxxxxxx
  • Date: Sun, 11 Sep 2005 08:54:14 -0500 (CDT)

> Both features sound reasonable to me. I don't think we new config
> options for it. We should use $conf['useheading'] for the first one and
> do the second by default.

Ah, that's the kind of feedback I need!  That's why I'd be reluctant to post 
patches without going through a review process first.

I've modified the code accordingly, plus attempted to make the <p> seek a bit 
more robust:

  foreach(array_keys($recents) as $id){

    $item = new FeedItem();
    $item->title = $id;
    if($conf['useheading']) {
        $heading = p_get_first_heading($id);
        if(!empty($heading))
            $item->title = trim($heading);
    }
    if(!empty($recents[$id]['sum'])){
      $item->title .= ' - '.strip_tags($recents[$id]['sum']);
    }

    $xhtml = p_wiki_xhtml($id,'',false);
    $matches = array();
    if(preg_match('/<p>|<p\s.*?>/', $xhtml, $matches, PREG_OFFSET_CAPTURE))
        $xhtml = substr($xhtml, $matches[0][1]);
    $desc = cleanDesc($xhtml);

    switch ($ltype){

I got rid of the callout function, since Andi's suggesting that the behavior 
become standard.

I'm still new to preg.  Do ya think my preg_match() will do the trick?

~joe
--
DokuWiki mailing list - more info at
http://wiki.splitbrain.org/wiki:mailinglist

Other related posts: