Fossil SCM

Render forum content as <description> in RSS feed. page /timeline.rss renders final HTML; command rss renders the source.

vor0nwe 2024-10-02 06:51 trunk
Commit 9fbdea8b2b18defb303611f4ac5ba577a9d117a5c520c50c86d7e5295ffef38f
1 file changed +27 -1
+27 -1
--- src/rss.c
+++ src/rss.c
@@ -165,10 +165,11 @@
165165
@ <generator>Fossil version %s(MANIFEST_VERSION) %s(MANIFEST_DATE)</generator>
166166
free(zPubDate);
167167
db_prepare(&q, "%s", blob_sql_text(&bSQL));
168168
blob_reset( &bSQL );
169169
while( db_step(&q)==SQLITE_ROW && nLine<nLimit ){
170
+ int rid = db_column_int(&q, 0);
170171
const char *zId = db_column_text(&q, 1);
171172
const char *zEType = db_column_text(&q, 3);
172173
const char *zCom = db_column_text(&q, 4);
173174
const char *zAuthor = db_column_text(&q, 5);
174175
char *zPrefix = "";
@@ -176,10 +177,11 @@
176177
char *zDate;
177178
int nChild = db_column_int(&q, 5);
178179
int nParent = db_column_int(&q, 7);
179180
const char *zTagList = db_column_text(&q, 8);
180181
time_t ts;
182
+ Manifest *pPost;
181183
182184
if( zTagList && zTagList[0]==0 ) zTagList = 0;
183185
ts = (time_t)((db_column_double(&q,2) - 2440587.5)*86400.0);
184186
zDate = cgi_rfc822_datestamp(ts);
185187
@@ -205,11 +207,23 @@
205207
}
206208
207209
@ <item>
208210
@ <title>%s(zPrefix)%h(zCom)%h(zSuffix)</title>
209211
@ <link>%s(g.zBaseURL)/info/%s(zId)</link>
212
+ if ('f'==zEType[0]
213
+ && (g.perm.ModForum || !content_is_private(rid))
214
+ ){
215
+ pPost = manifest_get(rid, CFTYPE_FORUM, 0);
216
+ if( pPost ){
217
+ @ <description>%s(zPrefix)<![CDATA[
218
+ forum_render(0, pPost->zMimetype, pPost->zWiki, 0, 0);
219
+ @]]>%h(zSuffix)</description>
220
+ manifest_destroy(pPost);
221
+ }
222
+ }else{
210223
@ <description>%s(zPrefix)%h(zCom)%h(zSuffix)</description>
224
+ }
211225
@ <pubDate>%s(zDate)</pubDate>
212226
@ <dc:creator>%h(zAuthor)</dc:creator>
213227
@ <guid>%s(g.zBaseURL)/info/%s(zId)</guid>
214228
@ </item>
215229
free(zDate);
@@ -366,20 +380,23 @@
366380
MANIFEST_VERSION, MANIFEST_DATE);
367381
free(zPubDate);
368382
db_prepare(&q, "%s", blob_sql_text(&bSQL));
369383
blob_reset( &bSQL );
370384
while( db_step(&q)==SQLITE_ROW && nLine<nLimit ){
385
+ int rid = db_column_int(&q, 0);
371386
const char *zId = db_column_text(&q, 1);
372387
const char *zCom = db_column_text(&q, 3);
373388
const char *zAuthor = db_column_text(&q, 4);
389
+ char *zDesc;
374390
char *zPrefix = "";
375391
char *zSuffix = 0;
376392
char *zDate;
377393
int nChild = db_column_int(&q, 5);
378394
int nParent = db_column_int(&q, 6);
379395
const char *zTagList = db_column_text(&q, 7);
380396
time_t ts;
397
+ Manifest *pPost;
381398
382399
if( zTagList && zTagList[0]==0 ) zTagList = 0;
383400
ts = (time_t)((db_column_double(&q,2) - 2440587.5)*86400.0);
384401
zDate = cgi_rfc822_datestamp(ts);
385402
@@ -392,19 +409,28 @@
392409
}
393410
394411
if( zTagList ){
395412
zSuffix = mprintf(" (tags: %s)", zTagList);
396413
}
414
+
415
+ pPost = manifest_get(rid, CFTYPE_FORUM, 0);
416
+ if( pPost ){
417
+ zDesc = mprintf("%s<pre>%h</pre>%h", zPrefix, pPost->zWiki, zSuffix);
418
+ manifest_destroy(pPost);
419
+ }else{
420
+ zDesc = mprintf("%s%h%h", zPrefix, zCom, zSuffix);
421
+ }
397422
398423
fossil_print("<item>");
399424
fossil_print("<title>%s%h%h</title>\n", zPrefix, zCom, zSuffix);
400425
fossil_print("<link>%s/info/%s</link>\n", zBaseURL, zId);
401
- fossil_print("<description>%s%h%h</description>\n", zPrefix, zCom, zSuffix);
426
+ fossil_print("<description>%s</description>\n", zDesc);
402427
fossil_print("<pubDate>%s</pubDate>\n", zDate);
403428
fossil_print("<dc:creator>%h</dc:creator>\n", zAuthor);
404429
fossil_print("<guid>%s/info/%s</guid>\n", g.zBaseURL, zId);
405430
fossil_print("</item>\n");
431
+ fossil_free(zDesc);
406432
free(zDate);
407433
free(zSuffix);
408434
nLine++;
409435
}
410436
411437
--- src/rss.c
+++ src/rss.c
@@ -165,10 +165,11 @@
165 @ <generator>Fossil version %s(MANIFEST_VERSION) %s(MANIFEST_DATE)</generator>
166 free(zPubDate);
167 db_prepare(&q, "%s", blob_sql_text(&bSQL));
168 blob_reset( &bSQL );
169 while( db_step(&q)==SQLITE_ROW && nLine<nLimit ){
 
170 const char *zId = db_column_text(&q, 1);
171 const char *zEType = db_column_text(&q, 3);
172 const char *zCom = db_column_text(&q, 4);
173 const char *zAuthor = db_column_text(&q, 5);
174 char *zPrefix = "";
@@ -176,10 +177,11 @@
176 char *zDate;
177 int nChild = db_column_int(&q, 5);
178 int nParent = db_column_int(&q, 7);
179 const char *zTagList = db_column_text(&q, 8);
180 time_t ts;
 
181
182 if( zTagList && zTagList[0]==0 ) zTagList = 0;
183 ts = (time_t)((db_column_double(&q,2) - 2440587.5)*86400.0);
184 zDate = cgi_rfc822_datestamp(ts);
185
@@ -205,11 +207,23 @@
205 }
206
207 @ <item>
208 @ <title>%s(zPrefix)%h(zCom)%h(zSuffix)</title>
209 @ <link>%s(g.zBaseURL)/info/%s(zId)</link>
 
 
 
 
 
 
 
 
 
 
 
210 @ <description>%s(zPrefix)%h(zCom)%h(zSuffix)</description>
 
211 @ <pubDate>%s(zDate)</pubDate>
212 @ <dc:creator>%h(zAuthor)</dc:creator>
213 @ <guid>%s(g.zBaseURL)/info/%s(zId)</guid>
214 @ </item>
215 free(zDate);
@@ -366,20 +380,23 @@
366 MANIFEST_VERSION, MANIFEST_DATE);
367 free(zPubDate);
368 db_prepare(&q, "%s", blob_sql_text(&bSQL));
369 blob_reset( &bSQL );
370 while( db_step(&q)==SQLITE_ROW && nLine<nLimit ){
 
371 const char *zId = db_column_text(&q, 1);
372 const char *zCom = db_column_text(&q, 3);
373 const char *zAuthor = db_column_text(&q, 4);
 
374 char *zPrefix = "";
375 char *zSuffix = 0;
376 char *zDate;
377 int nChild = db_column_int(&q, 5);
378 int nParent = db_column_int(&q, 6);
379 const char *zTagList = db_column_text(&q, 7);
380 time_t ts;
 
381
382 if( zTagList && zTagList[0]==0 ) zTagList = 0;
383 ts = (time_t)((db_column_double(&q,2) - 2440587.5)*86400.0);
384 zDate = cgi_rfc822_datestamp(ts);
385
@@ -392,19 +409,28 @@
392 }
393
394 if( zTagList ){
395 zSuffix = mprintf(" (tags: %s)", zTagList);
396 }
 
 
 
 
 
 
 
 
397
398 fossil_print("<item>");
399 fossil_print("<title>%s%h%h</title>\n", zPrefix, zCom, zSuffix);
400 fossil_print("<link>%s/info/%s</link>\n", zBaseURL, zId);
401 fossil_print("<description>%s%h%h</description>\n", zPrefix, zCom, zSuffix);
402 fossil_print("<pubDate>%s</pubDate>\n", zDate);
403 fossil_print("<dc:creator>%h</dc:creator>\n", zAuthor);
404 fossil_print("<guid>%s/info/%s</guid>\n", g.zBaseURL, zId);
405 fossil_print("</item>\n");
 
406 free(zDate);
407 free(zSuffix);
408 nLine++;
409 }
410
411
--- src/rss.c
+++ src/rss.c
@@ -165,10 +165,11 @@
165 @ <generator>Fossil version %s(MANIFEST_VERSION) %s(MANIFEST_DATE)</generator>
166 free(zPubDate);
167 db_prepare(&q, "%s", blob_sql_text(&bSQL));
168 blob_reset( &bSQL );
169 while( db_step(&q)==SQLITE_ROW && nLine<nLimit ){
170 int rid = db_column_int(&q, 0);
171 const char *zId = db_column_text(&q, 1);
172 const char *zEType = db_column_text(&q, 3);
173 const char *zCom = db_column_text(&q, 4);
174 const char *zAuthor = db_column_text(&q, 5);
175 char *zPrefix = "";
@@ -176,10 +177,11 @@
177 char *zDate;
178 int nChild = db_column_int(&q, 5);
179 int nParent = db_column_int(&q, 7);
180 const char *zTagList = db_column_text(&q, 8);
181 time_t ts;
182 Manifest *pPost;
183
184 if( zTagList && zTagList[0]==0 ) zTagList = 0;
185 ts = (time_t)((db_column_double(&q,2) - 2440587.5)*86400.0);
186 zDate = cgi_rfc822_datestamp(ts);
187
@@ -205,11 +207,23 @@
207 }
208
209 @ <item>
210 @ <title>%s(zPrefix)%h(zCom)%h(zSuffix)</title>
211 @ <link>%s(g.zBaseURL)/info/%s(zId)</link>
212 if ('f'==zEType[0]
213 && (g.perm.ModForum || !content_is_private(rid))
214 ){
215 pPost = manifest_get(rid, CFTYPE_FORUM, 0);
216 if( pPost ){
217 @ <description>%s(zPrefix)<![CDATA[
218 forum_render(0, pPost->zMimetype, pPost->zWiki, 0, 0);
219 @]]>%h(zSuffix)</description>
220 manifest_destroy(pPost);
221 }
222 }else{
223 @ <description>%s(zPrefix)%h(zCom)%h(zSuffix)</description>
224 }
225 @ <pubDate>%s(zDate)</pubDate>
226 @ <dc:creator>%h(zAuthor)</dc:creator>
227 @ <guid>%s(g.zBaseURL)/info/%s(zId)</guid>
228 @ </item>
229 free(zDate);
@@ -366,20 +380,23 @@
380 MANIFEST_VERSION, MANIFEST_DATE);
381 free(zPubDate);
382 db_prepare(&q, "%s", blob_sql_text(&bSQL));
383 blob_reset( &bSQL );
384 while( db_step(&q)==SQLITE_ROW && nLine<nLimit ){
385 int rid = db_column_int(&q, 0);
386 const char *zId = db_column_text(&q, 1);
387 const char *zCom = db_column_text(&q, 3);
388 const char *zAuthor = db_column_text(&q, 4);
389 char *zDesc;
390 char *zPrefix = "";
391 char *zSuffix = 0;
392 char *zDate;
393 int nChild = db_column_int(&q, 5);
394 int nParent = db_column_int(&q, 6);
395 const char *zTagList = db_column_text(&q, 7);
396 time_t ts;
397 Manifest *pPost;
398
399 if( zTagList && zTagList[0]==0 ) zTagList = 0;
400 ts = (time_t)((db_column_double(&q,2) - 2440587.5)*86400.0);
401 zDate = cgi_rfc822_datestamp(ts);
402
@@ -392,19 +409,28 @@
409 }
410
411 if( zTagList ){
412 zSuffix = mprintf(" (tags: %s)", zTagList);
413 }
414
415 pPost = manifest_get(rid, CFTYPE_FORUM, 0);
416 if( pPost ){
417 zDesc = mprintf("%s<pre>%h</pre>%h", zPrefix, pPost->zWiki, zSuffix);
418 manifest_destroy(pPost);
419 }else{
420 zDesc = mprintf("%s%h%h", zPrefix, zCom, zSuffix);
421 }
422
423 fossil_print("<item>");
424 fossil_print("<title>%s%h%h</title>\n", zPrefix, zCom, zSuffix);
425 fossil_print("<link>%s/info/%s</link>\n", zBaseURL, zId);
426 fossil_print("<description>%s</description>\n", zDesc);
427 fossil_print("<pubDate>%s</pubDate>\n", zDate);
428 fossil_print("<dc:creator>%h</dc:creator>\n", zAuthor);
429 fossil_print("<guid>%s/info/%s</guid>\n", g.zBaseURL, zId);
430 fossil_print("</item>\n");
431 fossil_free(zDesc);
432 free(zDate);
433 free(zSuffix);
434 nLine++;
435 }
436
437

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button