Fossil SCM
Render forum content as <description> in RSS feed. page /timeline.rss renders final HTML; command rss renders the source.
Commit
9fbdea8b2b18defb303611f4ac5ba577a9d117a5c520c50c86d7e5295ffef38f
Parent
e483b3b15fad08e…
1 file changed
+27
-1
+27
-1
| --- src/rss.c | ||
| +++ src/rss.c | ||
| @@ -165,10 +165,11 @@ | ||
| 165 | 165 | @ <generator>Fossil version %s(MANIFEST_VERSION) %s(MANIFEST_DATE)</generator> |
| 166 | 166 | free(zPubDate); |
| 167 | 167 | db_prepare(&q, "%s", blob_sql_text(&bSQL)); |
| 168 | 168 | blob_reset( &bSQL ); |
| 169 | 169 | while( db_step(&q)==SQLITE_ROW && nLine<nLimit ){ |
| 170 | + int rid = db_column_int(&q, 0); | |
| 170 | 171 | const char *zId = db_column_text(&q, 1); |
| 171 | 172 | const char *zEType = db_column_text(&q, 3); |
| 172 | 173 | const char *zCom = db_column_text(&q, 4); |
| 173 | 174 | const char *zAuthor = db_column_text(&q, 5); |
| 174 | 175 | char *zPrefix = ""; |
| @@ -176,10 +177,11 @@ | ||
| 176 | 177 | char *zDate; |
| 177 | 178 | int nChild = db_column_int(&q, 5); |
| 178 | 179 | int nParent = db_column_int(&q, 7); |
| 179 | 180 | const char *zTagList = db_column_text(&q, 8); |
| 180 | 181 | time_t ts; |
| 182 | + Manifest *pPost; | |
| 181 | 183 | |
| 182 | 184 | if( zTagList && zTagList[0]==0 ) zTagList = 0; |
| 183 | 185 | ts = (time_t)((db_column_double(&q,2) - 2440587.5)*86400.0); |
| 184 | 186 | zDate = cgi_rfc822_datestamp(ts); |
| 185 | 187 | |
| @@ -205,11 +207,23 @@ | ||
| 205 | 207 | } |
| 206 | 208 | |
| 207 | 209 | @ <item> |
| 208 | 210 | @ <title>%s(zPrefix)%h(zCom)%h(zSuffix)</title> |
| 209 | 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{ | |
| 210 | 223 | @ <description>%s(zPrefix)%h(zCom)%h(zSuffix)</description> |
| 224 | + } | |
| 211 | 225 | @ <pubDate>%s(zDate)</pubDate> |
| 212 | 226 | @ <dc:creator>%h(zAuthor)</dc:creator> |
| 213 | 227 | @ <guid>%s(g.zBaseURL)/info/%s(zId)</guid> |
| 214 | 228 | @ </item> |
| 215 | 229 | free(zDate); |
| @@ -366,20 +380,23 @@ | ||
| 366 | 380 | MANIFEST_VERSION, MANIFEST_DATE); |
| 367 | 381 | free(zPubDate); |
| 368 | 382 | db_prepare(&q, "%s", blob_sql_text(&bSQL)); |
| 369 | 383 | blob_reset( &bSQL ); |
| 370 | 384 | while( db_step(&q)==SQLITE_ROW && nLine<nLimit ){ |
| 385 | + int rid = db_column_int(&q, 0); | |
| 371 | 386 | const char *zId = db_column_text(&q, 1); |
| 372 | 387 | const char *zCom = db_column_text(&q, 3); |
| 373 | 388 | const char *zAuthor = db_column_text(&q, 4); |
| 389 | + char *zDesc; | |
| 374 | 390 | char *zPrefix = ""; |
| 375 | 391 | char *zSuffix = 0; |
| 376 | 392 | char *zDate; |
| 377 | 393 | int nChild = db_column_int(&q, 5); |
| 378 | 394 | int nParent = db_column_int(&q, 6); |
| 379 | 395 | const char *zTagList = db_column_text(&q, 7); |
| 380 | 396 | time_t ts; |
| 397 | + Manifest *pPost; | |
| 381 | 398 | |
| 382 | 399 | if( zTagList && zTagList[0]==0 ) zTagList = 0; |
| 383 | 400 | ts = (time_t)((db_column_double(&q,2) - 2440587.5)*86400.0); |
| 384 | 401 | zDate = cgi_rfc822_datestamp(ts); |
| 385 | 402 | |
| @@ -392,19 +409,28 @@ | ||
| 392 | 409 | } |
| 393 | 410 | |
| 394 | 411 | if( zTagList ){ |
| 395 | 412 | zSuffix = mprintf(" (tags: %s)", zTagList); |
| 396 | 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 | + } | |
| 397 | 422 | |
| 398 | 423 | fossil_print("<item>"); |
| 399 | 424 | fossil_print("<title>%s%h%h</title>\n", zPrefix, zCom, zSuffix); |
| 400 | 425 | 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); | |
| 402 | 427 | fossil_print("<pubDate>%s</pubDate>\n", zDate); |
| 403 | 428 | fossil_print("<dc:creator>%h</dc:creator>\n", zAuthor); |
| 404 | 429 | fossil_print("<guid>%s/info/%s</guid>\n", g.zBaseURL, zId); |
| 405 | 430 | fossil_print("</item>\n"); |
| 431 | + fossil_free(zDesc); | |
| 406 | 432 | free(zDate); |
| 407 | 433 | free(zSuffix); |
| 408 | 434 | nLine++; |
| 409 | 435 | } |
| 410 | 436 | |
| 411 | 437 |
| --- 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 |