Am 11.01.2007 um 18:51 schrieb Patrick R. Michaud:
On Thu, Jan 11, 2007 at 09:09:37AM +0100, Laurent Meister wrote:for a long time we were using our own modified rss.php (even after the switch to feed.php in the distribution). Now I want to try to use therss-possibilities which are built in pmwiki. [...]So if I understand the description on PmWiki/WebFeeds right, i've toconfigure the Titel changes with: $FeedFmt['rss']['item']['title'] = '{$Group} / {$Title} : $LastModifiedSummary';Yes.
Is it possible to insert the date/time of Change in the title?
But how do I got the history-output in the content of the feed? I've noidea.How were you getting the history output in your modified rss.php ? We can come up with a module that duplicates it for feeds.php .
our modified rss.php (only RSS 2.0) is attached to this mail. Laurent
<?php if (!defined('PmWiki')) exit();
/*
@version: 1.4
*/
SDV($RssDiffDelFmt['a'],"<i style='color:red;'><b>\$[Deleted line \$DiffLines:]</b></i><br/>");
SDV($RssDiffDelFmt['c'],"<i style='color:red;'><b>\$[Changed line \$DiffLines from:]</b></i><br />");
SDV($RssDiffAddFmt['d'],"<i style='color:green;'><b>\$[Added line \$DiffLines:]</b></i><br/>");
SDV($RssDiffAddFmt['c'],"<br/><i style='color:green;'><b>$[to:]</b></i><br/> ");
SDV($RssDiffEndDelAddFmt,"<br/>");
/***********************************/
SDV($HandleActions['rss'],'HandleRss');
SDV($HandleActions['rdf'],'HandleRss');
SDV($RssMaxItems,5); # maximum items to display
SDV($RssSourceSize,400); # max size to build desc from
SDV($RssDescSize,5000); # max desc size
SDV($RssItems,array()); # RSS item elements
SDV($RssItemsRDFList,array()); # RDF <items> elements
if ($action=='rdf') {
### RSS 1.0 (RDF) definitions
SDV($RssTimeFmt,'%Y-%m-%dT%H:%MZ'); # time format
SDV($RssItemsRDFListFmt,"<rdf:li rdf:resource=\"\$PageUrl\" />\n");
SDV($RssChannelFmt,array('<?xml version="1.0"?'.'>
<rdf:RDF xmlns="http://purl.org/rss/1.0/"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:dc="http://purl.org/dc/elements/1.1/">
<channel rdf:about="$PageUrl">
<title>$WikiTitle | $Group / $Title</title>
<link>$PageUrl</link>
<description>$RssChannelDesc</description>
<dc:date>$RssChannelBuildDate</dc:date>
<items>
<rdf:Seq>',&$RssItemsRDFList,'
</rdf:Seq>
</items>
</channel>'));
SDV($RssItemFmt,'
<item rdf:about="$PageUrl">
<title>$WikiTitle | $Group / $Title</title>
<link>$PageUrl</link>
<description>$RssItemDesc</description>
<dc:date>$RssItemPubDate</dc:date>
</item>');
SDV($HandleRssFmt,array(&$RssChannelFmt,&$RssItems,'</rdf:RDF>'));
}
### RSS 2.0 definitions
SDV($RssTimeFmt,'%Y-%m-%dT%H:%MZ');
SDV($RssChannelFmt,'<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
<channel>
<title>$WikiTitle | $Group / $Title</title>
<link>$PageUrl</link>
<description>$RssChannelDesc</description>
<lastBuildDate>$RssChannelBuildDate</lastBuildDate>
<generator>$Version</generator>');
SDV($RssItemFmt,'
<item>
<title>$Group - $RssItemTitle ... $RssItemTime von $RssItemAuthor - $RssItemChangeSum</title>
<link>$PageUrl</link>
<description>$RssItemDesc</description>
<dc:contributor>$RssItemAuthor</dc:contributor>
<dc:date>$RssItemPubDate</dc:date>
</item>');
SDV($HandleRssFmt,array(&$RssChannelFmt,&$RssItems,'</channel></rss>'));
function HandleRss($pagename) {
global $RssMaxItems,$RssSourceSize,$RssDescSize,
$RssChannelFmt,$RssChannelDesc,$RssTimeFmt,$RssChannelBuildDate,
$RssItemsRDFList,$RssItemsRDFListFmt,$RssItems,$RssItemFmt,
$HandleRssFmt,$FmtV;
global $RssDiffDelFmt,$RssDiffAddFmt, $RssDiffEndDelAddFmt;
$t = ReadTrail($pagename,$pagename);
$page = RetrieveAuthPage($pagename, 'read', false, READPAGE_CURRENT);
if (!$page) Abort("?cannot read $pagename");
$cbgmt = $page['time'];
$r = array();
for($i=0;$i<count($t) && count($r)<$RssMaxItems;$i++) {
if (!PageExists($t[$i]['pagename'])) continue;
$page = RetrieveAuthPage($t[$i]['pagename'],'read',false);
if (!$page) continue;
#look if there is a page title
if (preg_match("/\\(:title\\s(.*?):\\)/",$page['text'],$pagetitle))
$pagetitle = $pagetitle[1];
else
$pagetitle = FmtPageName("\$Name",$t[$i]['pagename']);
$text="";
foreach ($page as $k => $v) {
if (!preg_match("/^diff:(\d+):(\d+):?([^:]*)/", $k, $match))
continue;
$diffgmt = $match[1];
$csum = utf8_decode($page["csum:$diffgmt"]);
$difflines = explode("\n", $v."\n");
$in = array ();
$out = array ();
$dtype = '';
foreach($difflines as $d) {
if ($d>'') {
if ($d[0]=='-' || $d[0]=='\\') continue;
if ($d[0]=='<') { $out[]=substr($d,2); continue; }
if ($d[0]=='>') { $in[]=substr($d,2); continue; }
}
if (preg_match("/^(\\d+)(,(\\d+))?([adc])(\\d+)(,(\\d+))?/",
$dtype,$match)) {
if (@$match[7]>'') {
$lines='lines';
$count=$match[1].'-'.($match[1]+$match[7]-$match[5]);
} elseif ($match[3]>'') {
$lines='lines'; $count=$match[1].'-'.$match[3];
} else { $lines='line'; $count=$match[1]; }
if ($match[4]=='a' || $match[4]=='c') {
$txt = str_replace('line',$lines,$RssDiffDelFmt[$match[4]]);
$FmtV['$DiffLines'] = $count;
$text.= FmtPageName($txt,$pagename);
$text.= str_replace("\n","<br />",htmlspecialchars(join("\n",$in)));
}
if ($match[4]=='d' || $match[4]=='c') {
$txt = str_replace('line',$lines,$RssDiffAddFmt[$match[4]]);
$FmtV['$DiffLines'] = $count;
$text.= FmtPageName($txt,$pagename);
$text.= str_replace("\n","<br />",htmlspecialchars(join("\n",$out)));
}
$text .= FmtPageName($RssDiffEndDelAddFmt,$pagename);
}
$in=array(); $out=array(); $dtype=$d;
}
break;
}
$text = "<![CDATA[". (utf8_decode($text))."]]>";
$text = entityencode(preg_replace("/<(?!!\[CDATA\[|i|\/i|b|\/b).*?>/s", "", $text));
if (strstr($t[$i]['pagename'],"PITS")) $text = "";
$r[] = array(
'name' => $t[$i]['pagename'],
'time' => $page['time'],
'desc' => $text,
'author' => utf8_decode($page['author']),
'csum' => $csum,
'pagetitle' => utf8_decode($pagetitle),
);
if ($page['time']>$cbgmt) $cbgmt=$page['time'];
}
SDV($RssChannelBuildDate,
entityencode(gmdate('D, d M Y H:i:s \G\M\T', $cbgmt)));
SDV($RssChannelDesc,entityencode(FmtPageName('$Group.$Title',$pagename)));
foreach($r as $page) {
$FmtV['$RssItemTitle'] = $page['pagetitle'];
$FmtV['$RssItemPubDate'] = gmstrftime($RssTimeFmt,$page['time']);
$FmtV['$RssItemTime'] = strftime('%d.%m. %H:%M',$page['time']);
$FmtV['$RssItemDesc'] = $page['desc'];
$FmtV['$RssItemAuthor'] = $page['author'];
$FmtV['$RssItemChangeSum'] = $page['csum'];
$RssItemsRDFList[] =
entityencode(FmtPageName($RssItemsRDFListFmt,$page['name']));
$RssItems[] =
entityencode(FmtPageName($RssItemFmt,$page['name']));
}
header("Content-type: text/xml");
PrintFmt($pagename,$HandleRssFmt);
exit();
}
# entityencode() and $EntitiesTable are used to convert non-ASCII characters
# and named entities into numeric entities, since the RSS and RDF
# specifications don't have a good way of incorporating them by default.
function entityencode($s) {
global $EntitiesTable;
$s = str_replace(array_keys($EntitiesTable),array_values($EntitiesTable),$s);
return preg_replace('/([\\x80-\\xff])/e',"'&#'.ord('\$1').';'",$s);
}
SDVA($EntitiesTable, array(
# entities defined in "http://www.w3.org/TR/xhtml1/DTD/xhtml-lat1.ent"
' ' => ' ',
'¡' => '¡',
'¢' => '¢',
'£' => '£',
'¤' => '¤',
'¥' => '¥',
'¦' => '¦',
'§' => '§',
'¨' => '¨',
'©' => '©',
'ª' => 'ª',
'«' => '«',
'¬' => '¬',
'­' => '­',
'®' => '®',
'¯' => '¯',
'°' => '°',
'±' => '±',
'²' => '²',
'³' => '³',
'´' => '´',
'µ' => 'µ',
'¶' => '¶',
'·' => '·',
'¸' => '¸',
'¹' => '¹',
'º' => 'º',
'»' => '»',
'¼' => '¼',
'½' => '½',
'¾' => '¾',
'¿' => '¿',
'À' => 'À',
'Á' => 'Á',
'Â' => 'Â',
'Ã' => 'Ã',
'Ä' => 'Ä',
'Å' => 'Å',
'Æ' => 'Æ',
'Ç' => 'Ç',
'È' => 'È',
'É' => 'É',
'Ê' => 'Ê',
'Ë' => 'Ë',
'Ì' => 'Ì',
'Í' => 'Í',
'Î' => 'Î',
'Ï' => 'Ï',
'Ð' => 'Ð',
'Ñ' => 'Ñ',
'Ò' => 'Ò',
'Ó' => 'Ó',
'Ô' => 'Ô',
'Õ' => 'Õ',
'Ö' => 'Ö',
'×' => '×',
'Ø' => 'Ø',
'Ù' => 'Ù',
'Ú' => 'Ú',
'Û' => 'Û',
'Ü' => 'Ü',
'Ý' => 'Ý',
'Þ' => 'Þ',
'ß' => 'ß',
'à' => 'à',
'á' => 'á',
'â' => 'â',
'ã' => 'ã',
'ä' => 'ä',
'å' => 'å',
'æ' => 'æ',
'ç' => 'ç',
'è' => 'è',
'é' => 'é',
'ê' => 'ê',
'ë' => 'ë',
'ì' => 'ì',
'í' => 'í',
'î' => 'î',
'ï' => 'ï',
'ð' => 'ð',
'ñ' => 'ñ',
'ò' => 'ò',
'ó' => 'ó',
'ô' => 'ô',
'õ' => 'õ',
'ö' => 'ö',
'÷' => '÷',
'ø' => 'ø',
'ù' => 'ù',
'ú' => 'ú',
'û' => 'û',
'ü' => 'ü',
'ý' => 'ý',
'þ' => 'þ',
'ÿ' => 'ÿ',
# entities defined in "http://www.w3.org/TR/xhtml1/DTD/xhtml-special.ent"
'"' => '"',
#'&' => '&#38;',
#'<' => '&#60;',
#'>' => '>',
''' => ''',
'Œ' => 'Œ',
'œ' => 'œ',
'Š' => 'Š',
'š' => 'š',
'Ÿ' => 'Ÿ',
'ˆ' => 'ˆ',
'˜' => '˜',
' ' => ' ',
' ' => ' ',
' ' => ' ',
'‌' => '‌',
'‍' => '‍',
'‎' => '‎',
'‏' => '‏',
'–' => '–',
'—' => '—',
'‘' => '‘',
'’' => '’',
'‚' => '‚',
'“' => '“',
'”' => '”',
'„' => '„',
'†' => '†',
'‡' => '‡',
'‰' => '‰',
'‹' => '‹',
'›' => '›',
'€' => '€',
# entities defined in "http://www.w3.org/TR/xhtml1/DTD/xhtml-symbol.ent"
'ƒ' => 'ƒ',
'Α' => 'Α',
'Β' => 'Β',
'Γ' => 'Γ',
'Δ' => 'Δ',
'Ε' => 'Ε',
'Ζ' => 'Ζ',
'Η' => 'Η',
'Θ' => 'Θ',
'Ι' => 'Ι',
'Κ' => 'Κ',
'Λ' => 'Λ',
'Μ' => 'Μ',
'Ν' => 'Ν',
'Ξ' => 'Ξ',
'Ο' => 'Ο',
'Π' => 'Π',
'Ρ' => 'Ρ',
'Σ' => 'Σ',
'Τ' => 'Τ',
'Υ' => 'Υ',
'Φ' => 'Φ',
'Χ' => 'Χ',
'Ψ' => 'Ψ',
'Ω' => 'Ω',
'α' => 'α',
'β' => 'β',
'γ' => 'γ',
'δ' => 'δ',
'ε' => 'ε',
'ζ' => 'ζ',
'η' => 'η',
'θ' => 'θ',
'ι' => 'ι',
'κ' => 'κ',
'λ' => 'λ',
'μ' => 'μ',
'ν' => 'ν',
'ξ' => 'ξ',
'ο' => 'ο',
'π' => 'π',
'ρ' => 'ρ',
'ς' => 'ς',
'σ' => 'σ',
'τ' => 'τ',
'υ' => 'υ',
'φ' => 'φ',
'χ' => 'χ',
'ψ' => 'ψ',
'ω' => 'ω',
'ϑ' => 'ϑ',
'ϒ' => 'ϒ',
'ϖ' => 'ϖ',
'•' => '•',
'…' => '…',
'′' => '′',
'″' => '″',
'‾' => '‾',
'⁄' => '⁄',
'℘' => '℘',
'ℑ' => 'ℑ',
'ℜ' => 'ℜ',
'™' => '™',
'ℵ' => 'ℵ',
'←' => '←',
'↑' => '↑',
'→' => '→',
'↓' => '↓',
'↔' => '↔',
'↵' => '↵',
'⇐' => '⇐',
'⇑' => '⇑',
'⇒' => '⇒',
'⇓' => '⇓',
'⇔' => '⇔',
'∀' => '∀',
'∂' => '∂',
'∃' => '∃',
'∅' => '∅',
'∇' => '∇',
'∈' => '∈',
'∉' => '∉',
'∋' => '∋',
'∏' => '∏',
'∑' => '∑',
'−' => '−',
'∗' => '∗',
'√' => '√',
'∝' => '∝',
'∞' => '∞',
'∠' => '∠',
'∧' => '∧',
'∨' => '∨',
'∩' => '∩',
'∪' => '∪',
'∫' => '∫',
'∴' => '∴',
'∼' => '∼',
'≅' => '≅',
'≈' => '≈',
'≠' => '≠',
'≡' => '≡',
'≤' => '≤',
'≥' => '≥',
'⊂' => '⊂',
'⊃' => '⊃',
'⊄' => '⊄',
'⊆' => '⊆',
'⊇' => '⊇',
'⊕' => '⊕',
'⊗' => '⊗',
'⊥' => '⊥',
'⋅' => '⋅',
'⌈' => '⌈',
'⌉' => '⌉',
'⌊' => '⌊',
'⌋' => '⌋',
'⟨' => '〈',
'⟩' => '〉',
'◊' => '◊',
'♠' => '♠',
'♣' => '♣',
'♥' => '♥',
'♦' => '♦'));
?>
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________ pmwiki-users mailing list [email protected] http://www.pmichaud.com/mailman/listinfo/pmwiki-users
