Fossil SCM

Add tags to the title and description for RSS feed items.

mistachkin 2015-07-02 02:35 UTC trunk merge
Commit 66c3bc159d4caa9f97121bc9bd363e9c4f3bd027
1 file changed +28 -6
+28 -6
--- src/rss.c
+++ src/rss.c
@@ -59,11 +59,14 @@
5959
@ uuid,
6060
@ event.mtime,
6161
@ coalesce(ecomment,comment),
6262
@ coalesce(euser,user),
6363
@ (SELECT count(*) FROM plink WHERE pid=blob.rid AND isprim),
64
- @ (SELECT count(*) FROM plink WHERE cid=blob.rid)
64
+ @ (SELECT count(*) FROM plink WHERE cid=blob.rid),
65
+ @ (SELECT group_concat(substr(tagname,5), ', ') FROM tag, tagxref
66
+ @ WHERE tagname GLOB 'sym-*' AND tag.tagid=tagxref.tagid
67
+ @ AND tagxref.rid=blob.rid AND tagxref.tagtype>0) AS tags
6568
@ FROM event, blob
6669
@ WHERE blob.rid=event.objid
6770
;
6871
6972
login_check_credentials();
@@ -167,15 +170,18 @@
167170
while( db_step(&q)==SQLITE_ROW && nLine<nLimit ){
168171
const char *zId = db_column_text(&q, 1);
169172
const char *zCom = db_column_text(&q, 3);
170173
const char *zAuthor = db_column_text(&q, 4);
171174
char *zPrefix = "";
175
+ char *zSuffix = 0;
172176
char *zDate;
173177
int nChild = db_column_int(&q, 5);
174178
int nParent = db_column_int(&q, 6);
179
+ const char *zTagList = db_column_text(&q, 7);
175180
time_t ts;
176181
182
+ if( zTagList && zTagList[0]==0 ) zTagList = 0;
177183
ts = (time_t)((db_column_double(&q,2) - 2440587.5)*86400.0);
178184
zDate = cgi_rfc822_datestamp(ts);
179185
180186
if( nParent>1 && nChild>1 ){
181187
zPrefix = "*MERGE/FORK* ";
@@ -182,20 +188,25 @@
182188
}else if( nParent>1 ){
183189
zPrefix = "*MERGE* ";
184190
}else if( nChild>1 ){
185191
zPrefix = "*FORK* ";
186192
}
193
+
194
+ if( zTagList ){
195
+ zSuffix = mprintf(" (tags: %s)", zTagList);
196
+ }
187197
188198
@ <item>
189
- @ <title>%s(zPrefix)%h(zCom)</title>
199
+ @ <title>%s(zPrefix)%h(zCom)%h(zSuffix)</title>
190200
@ <link>%s(g.zBaseURL)/info/%s(zId)</link>
191
- @ <description>%s(zPrefix)%h(zCom)</description>
201
+ @ <description>%s(zPrefix)%h(zCom)%h(zSuffix)</description>
192202
@ <pubDate>%s(zDate)</pubDate>
193203
@ <dc:creator>%h(zAuthor)</dc:creator>
194204
@ <guid>%s(g.zBaseURL)/info/%s(zId)</guid>
195205
@ </item>
196206
free(zDate);
207
+ free(zSuffix);
197208
nLine++;
198209
}
199210
200211
db_finalize(&q);
201212
@ </channel>
@@ -260,11 +271,14 @@
260271
@ uuid,
261272
@ event.mtime,
262273
@ coalesce(ecomment,comment),
263274
@ coalesce(euser,user),
264275
@ (SELECT count(*) FROM plink WHERE pid=blob.rid AND isprim),
265
- @ (SELECT count(*) FROM plink WHERE cid=blob.rid)
276
+ @ (SELECT count(*) FROM plink WHERE cid=blob.rid),
277
+ @ (SELECT group_concat(substr(tagname,5), ', ') FROM tag, tagxref
278
+ @ WHERE tagname GLOB 'sym-*' AND tag.tagid=tagxref.tagid
279
+ @ AND tagxref.rid=blob.rid AND tagxref.tagtype>0) AS tags
266280
@ FROM event, blob
267281
@ WHERE blob.rid=event.objid
268282
;
269283
if(!zType || !*zType){
270284
zType = "all";
@@ -350,15 +364,18 @@
350364
while( db_step(&q)==SQLITE_ROW && nLine<nLimit ){
351365
const char *zId = db_column_text(&q, 1);
352366
const char *zCom = db_column_text(&q, 3);
353367
const char *zAuthor = db_column_text(&q, 4);
354368
char *zPrefix = "";
369
+ char *zSuffix = 0;
355370
char *zDate;
356371
int nChild = db_column_int(&q, 5);
357372
int nParent = db_column_int(&q, 6);
373
+ const char *zTagList = db_column_text(&q, 7);
358374
time_t ts;
359375
376
+ if( zTagList && zTagList[0]==0 ) zTagList = 0;
360377
ts = (time_t)((db_column_double(&q,2) - 2440587.5)*86400.0);
361378
zDate = cgi_rfc822_datestamp(ts);
362379
363380
if( nParent>1 && nChild>1 ){
364381
zPrefix = "*MERGE/FORK* ";
@@ -365,20 +382,25 @@
365382
}else if( nParent>1 ){
366383
zPrefix = "*MERGE* ";
367384
}else if( nChild>1 ){
368385
zPrefix = "*FORK* ";
369386
}
387
+
388
+ if( zTagList ){
389
+ zSuffix = mprintf(" (tags: %s)", zTagList);
390
+ }
370391
371392
fossil_print("<item>");
372
- fossil_print("<title>%s%h</title>\n", zPrefix, zCom);
393
+ fossil_print("<title>%s%h%h</title>\n", zPrefix, zCom, zSuffix);
373394
fossil_print("<link>%s/info/%s</link>\n", zBaseURL, zId);
374
- fossil_print("<description>%s%h</description>\n", zPrefix, zCom);
395
+ fossil_print("<description>%s%h%h</description>\n", zPrefix, zCom, zSuffix);
375396
fossil_print("<pubDate>%s</pubDate>\n", zDate);
376397
fossil_print("<dc:creator>%h</dc:creator>\n", zAuthor);
377398
fossil_print("<guid>%s/info/%s</guid>\n", g.zBaseURL, zId);
378399
fossil_print("</item>\n");
379400
free(zDate);
401
+ free(zSuffix);
380402
nLine++;
381403
}
382404
383405
db_finalize(&q);
384406
fossil_print("</channel>\n");
385407
--- src/rss.c
+++ src/rss.c
@@ -59,11 +59,14 @@
59 @ uuid,
60 @ event.mtime,
61 @ coalesce(ecomment,comment),
62 @ coalesce(euser,user),
63 @ (SELECT count(*) FROM plink WHERE pid=blob.rid AND isprim),
64 @ (SELECT count(*) FROM plink WHERE cid=blob.rid)
 
 
 
65 @ FROM event, blob
66 @ WHERE blob.rid=event.objid
67 ;
68
69 login_check_credentials();
@@ -167,15 +170,18 @@
167 while( db_step(&q)==SQLITE_ROW && nLine<nLimit ){
168 const char *zId = db_column_text(&q, 1);
169 const char *zCom = db_column_text(&q, 3);
170 const char *zAuthor = db_column_text(&q, 4);
171 char *zPrefix = "";
 
172 char *zDate;
173 int nChild = db_column_int(&q, 5);
174 int nParent = db_column_int(&q, 6);
 
175 time_t ts;
176
 
177 ts = (time_t)((db_column_double(&q,2) - 2440587.5)*86400.0);
178 zDate = cgi_rfc822_datestamp(ts);
179
180 if( nParent>1 && nChild>1 ){
181 zPrefix = "*MERGE/FORK* ";
@@ -182,20 +188,25 @@
182 }else if( nParent>1 ){
183 zPrefix = "*MERGE* ";
184 }else if( nChild>1 ){
185 zPrefix = "*FORK* ";
186 }
 
 
 
 
187
188 @ <item>
189 @ <title>%s(zPrefix)%h(zCom)</title>
190 @ <link>%s(g.zBaseURL)/info/%s(zId)</link>
191 @ <description>%s(zPrefix)%h(zCom)</description>
192 @ <pubDate>%s(zDate)</pubDate>
193 @ <dc:creator>%h(zAuthor)</dc:creator>
194 @ <guid>%s(g.zBaseURL)/info/%s(zId)</guid>
195 @ </item>
196 free(zDate);
 
197 nLine++;
198 }
199
200 db_finalize(&q);
201 @ </channel>
@@ -260,11 +271,14 @@
260 @ uuid,
261 @ event.mtime,
262 @ coalesce(ecomment,comment),
263 @ coalesce(euser,user),
264 @ (SELECT count(*) FROM plink WHERE pid=blob.rid AND isprim),
265 @ (SELECT count(*) FROM plink WHERE cid=blob.rid)
 
 
 
266 @ FROM event, blob
267 @ WHERE blob.rid=event.objid
268 ;
269 if(!zType || !*zType){
270 zType = "all";
@@ -350,15 +364,18 @@
350 while( db_step(&q)==SQLITE_ROW && nLine<nLimit ){
351 const char *zId = db_column_text(&q, 1);
352 const char *zCom = db_column_text(&q, 3);
353 const char *zAuthor = db_column_text(&q, 4);
354 char *zPrefix = "";
 
355 char *zDate;
356 int nChild = db_column_int(&q, 5);
357 int nParent = db_column_int(&q, 6);
 
358 time_t ts;
359
 
360 ts = (time_t)((db_column_double(&q,2) - 2440587.5)*86400.0);
361 zDate = cgi_rfc822_datestamp(ts);
362
363 if( nParent>1 && nChild>1 ){
364 zPrefix = "*MERGE/FORK* ";
@@ -365,20 +382,25 @@
365 }else if( nParent>1 ){
366 zPrefix = "*MERGE* ";
367 }else if( nChild>1 ){
368 zPrefix = "*FORK* ";
369 }
 
 
 
 
370
371 fossil_print("<item>");
372 fossil_print("<title>%s%h</title>\n", zPrefix, zCom);
373 fossil_print("<link>%s/info/%s</link>\n", zBaseURL, zId);
374 fossil_print("<description>%s%h</description>\n", zPrefix, zCom);
375 fossil_print("<pubDate>%s</pubDate>\n", zDate);
376 fossil_print("<dc:creator>%h</dc:creator>\n", zAuthor);
377 fossil_print("<guid>%s/info/%s</guid>\n", g.zBaseURL, zId);
378 fossil_print("</item>\n");
379 free(zDate);
 
380 nLine++;
381 }
382
383 db_finalize(&q);
384 fossil_print("</channel>\n");
385
--- src/rss.c
+++ src/rss.c
@@ -59,11 +59,14 @@
59 @ uuid,
60 @ event.mtime,
61 @ coalesce(ecomment,comment),
62 @ coalesce(euser,user),
63 @ (SELECT count(*) FROM plink WHERE pid=blob.rid AND isprim),
64 @ (SELECT count(*) FROM plink WHERE cid=blob.rid),
65 @ (SELECT group_concat(substr(tagname,5), ', ') FROM tag, tagxref
66 @ WHERE tagname GLOB 'sym-*' AND tag.tagid=tagxref.tagid
67 @ AND tagxref.rid=blob.rid AND tagxref.tagtype>0) AS tags
68 @ FROM event, blob
69 @ WHERE blob.rid=event.objid
70 ;
71
72 login_check_credentials();
@@ -167,15 +170,18 @@
170 while( db_step(&q)==SQLITE_ROW && nLine<nLimit ){
171 const char *zId = db_column_text(&q, 1);
172 const char *zCom = db_column_text(&q, 3);
173 const char *zAuthor = db_column_text(&q, 4);
174 char *zPrefix = "";
175 char *zSuffix = 0;
176 char *zDate;
177 int nChild = db_column_int(&q, 5);
178 int nParent = db_column_int(&q, 6);
179 const char *zTagList = db_column_text(&q, 7);
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
186 if( nParent>1 && nChild>1 ){
187 zPrefix = "*MERGE/FORK* ";
@@ -182,20 +188,25 @@
188 }else if( nParent>1 ){
189 zPrefix = "*MERGE* ";
190 }else if( nChild>1 ){
191 zPrefix = "*FORK* ";
192 }
193
194 if( zTagList ){
195 zSuffix = mprintf(" (tags: %s)", zTagList);
196 }
197
198 @ <item>
199 @ <title>%s(zPrefix)%h(zCom)%h(zSuffix)</title>
200 @ <link>%s(g.zBaseURL)/info/%s(zId)</link>
201 @ <description>%s(zPrefix)%h(zCom)%h(zSuffix)</description>
202 @ <pubDate>%s(zDate)</pubDate>
203 @ <dc:creator>%h(zAuthor)</dc:creator>
204 @ <guid>%s(g.zBaseURL)/info/%s(zId)</guid>
205 @ </item>
206 free(zDate);
207 free(zSuffix);
208 nLine++;
209 }
210
211 db_finalize(&q);
212 @ </channel>
@@ -260,11 +271,14 @@
271 @ uuid,
272 @ event.mtime,
273 @ coalesce(ecomment,comment),
274 @ coalesce(euser,user),
275 @ (SELECT count(*) FROM plink WHERE pid=blob.rid AND isprim),
276 @ (SELECT count(*) FROM plink WHERE cid=blob.rid),
277 @ (SELECT group_concat(substr(tagname,5), ', ') FROM tag, tagxref
278 @ WHERE tagname GLOB 'sym-*' AND tag.tagid=tagxref.tagid
279 @ AND tagxref.rid=blob.rid AND tagxref.tagtype>0) AS tags
280 @ FROM event, blob
281 @ WHERE blob.rid=event.objid
282 ;
283 if(!zType || !*zType){
284 zType = "all";
@@ -350,15 +364,18 @@
364 while( db_step(&q)==SQLITE_ROW && nLine<nLimit ){
365 const char *zId = db_column_text(&q, 1);
366 const char *zCom = db_column_text(&q, 3);
367 const char *zAuthor = db_column_text(&q, 4);
368 char *zPrefix = "";
369 char *zSuffix = 0;
370 char *zDate;
371 int nChild = db_column_int(&q, 5);
372 int nParent = db_column_int(&q, 6);
373 const char *zTagList = db_column_text(&q, 7);
374 time_t ts;
375
376 if( zTagList && zTagList[0]==0 ) zTagList = 0;
377 ts = (time_t)((db_column_double(&q,2) - 2440587.5)*86400.0);
378 zDate = cgi_rfc822_datestamp(ts);
379
380 if( nParent>1 && nChild>1 ){
381 zPrefix = "*MERGE/FORK* ";
@@ -365,20 +382,25 @@
382 }else if( nParent>1 ){
383 zPrefix = "*MERGE* ";
384 }else if( nChild>1 ){
385 zPrefix = "*FORK* ";
386 }
387
388 if( zTagList ){
389 zSuffix = mprintf(" (tags: %s)", zTagList);
390 }
391
392 fossil_print("<item>");
393 fossil_print("<title>%s%h%h</title>\n", zPrefix, zCom, zSuffix);
394 fossil_print("<link>%s/info/%s</link>\n", zBaseURL, zId);
395 fossil_print("<description>%s%h%h</description>\n", zPrefix, zCom, zSuffix);
396 fossil_print("<pubDate>%s</pubDate>\n", zDate);
397 fossil_print("<dc:creator>%h</dc:creator>\n", zAuthor);
398 fossil_print("<guid>%s/info/%s</guid>\n", g.zBaseURL, zId);
399 fossil_print("</item>\n");
400 free(zDate);
401 free(zSuffix);
402 nLine++;
403 }
404
405 db_finalize(&q);
406 fossil_print("</channel>\n");
407

Keyboard Shortcuts

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