function pugpig_get_rss_section($edition_id, $nid)
{
    // print_r('pugpig_get_rss_section(' . $edition_id . ',' . $nid . ')');
    $edition = pugpig_get_edition($edition_id, false);
    $section = pugpig_get_page($nid);
    $d = new DomDocument('1.0', 'UTF-8');
    $feed = $d->createElement('rss');
    $feed->setAttribute('version', '2.0');
    $channel = $d->createElement('channel');
    $feed->appendChild($channel);
    $channel->appendChild(newElement($d, 'title', $section['title']));
    $in_section = false;
    foreach (pugpig_get_kindle_page_array($edition) as $page) {
        if ($page['id'] == $nid && $page['level'] == 1 && !$in_section) {
            $in_section = true;
        } else {
            if ($page['level'] == 1) {
                // Bail when we hit the section higher level page
                $in_section = false;
            } elseif ($in_section) {
                $item = $d->createElement('item');
                $abs_path = pugpig_abs_link('editions/' . pugpig_get_atom_tag($edition['key']) . '/data/' . $page['id'] . '/kindle.html');
                $item->appendChild(newElement($d, 'link', $abs_path));
                $channel->appendChild($item);
            }
        }
    }
    $d->appendChild($feed);
    return $d;
}
function pugpig_get_pages($id, $edition_id, $content_filter = null)
{
    $page_info = pugpig_get_page($id, $edition_id, $content_filter);
    $pages = empty($page_info) ? array() : array($page_info);
    $pages = apply_filters('pugpig_get_pages', $pages, $id, $edition_id, $content_filter);
    return $pages;
}
 function pugpig_get_pages($key)
 {
     return array(pugpig_get_page($key));
 }