Fossil SCM

Point technote RSS link at technote page instead of checkin page.

vor0nwe 2026-03-06 16:37 rss-content
Commit a88d460c5b329777ed4840a0220b03edbb05bb7ad1760c77146406c5b1526b26
1 file changed +30 -2
+30 -2
--- src/rss.c
+++ src/rss.c
@@ -22,10 +22,24 @@
2222
#include "rss.h"
2323
#include <assert.h>
2424
2525
void forum_render_to_html(struct Blob*, const char*, const char*);
2626
void technote_render_to_html(struct Blob*, int);
27
+
28
+/*
29
+** Return the technote id (event- tag suffix) for rid, or NULL.
30
+** Caller must free the returned string.
31
+*/
32
+static char *rss_technote_id(int rid){
33
+ return db_text(0,
34
+ "SELECT substr(tagname,7) FROM tag, tagxref"
35
+ " WHERE tag.tagid=tagxref.tagid"
36
+ " AND tagxref.rid=%d"
37
+ " AND tagname GLOB 'event-*'",
38
+ rid
39
+ );
40
+}
2741
2842
/*
2943
** Append text to pOut, escaping any CDATA terminators.
3044
*/
3145
static void rss_cdata_append(Blob *pOut, const char *zIn, int nIn){
@@ -380,10 +394,11 @@
380394
char *zDate;
381395
int nChild = db_column_int(&q, 6);
382396
int nParent = db_column_int(&q, 7);
383397
const char *zTagList = db_column_text(&q, 8);
384398
Manifest *pPost = 0;
399
+ char *zTechnoteId = 0;
385400
Blob contentHtml = BLOB_INITIALIZER;
386401
int bForumContent = 0;
387402
time_t ts;
388403
389404
if( zTagList && zTagList[0]==0 ) zTagList = 0;
@@ -431,10 +446,11 @@
431446
blob_reset(&normalized);
432447
bForumContent = 1;
433448
}
434449
}
435450
}else if( zEType[0]=='e' ){
451
+ zTechnoteId = rss_technote_id(rid);
436452
technote_render_to_html(&contentHtml, rid);
437453
if( blob_size(&contentHtml)>0 ){
438454
Blob normalized = BLOB_INITIALIZER;
439455
rss_make_abs_links(&normalized, blob_str(&base),
440456
blob_str(&top), blob_str(&contentHtml),
@@ -446,11 +462,15 @@
446462
bForumContent = 1;
447463
}
448464
}
449465
@ <item>
450466
@ <title>%s(zPrefix)%h(zCom)%h(zSuffix)</title>
451
- @ <link>%s(g.zBaseURL)/info/%s(zId)</link>
467
+ if( zEType[0]=='e' && zTechnoteId!=0 ){
468
+ @ <link>%s(g.zBaseURL)/technote/%s(zTechnoteId)</link>
469
+ }else{
470
+ @ <link>%s(g.zBaseURL)/info/%s(zId)</link>
471
+ }
452472
@ <description>%s(zPrefix)%h(zCom)%h(zSuffix)</description>
453473
@ <pubDate>%s(zDate)</pubDate>
454474
@ <dc:creator>%h(zAuthor)</dc:creator>
455475
@ <guid>%s(g.zBaseURL)/info/%s(zId)</guid>
456476
if( bForumContent ){
@@ -463,10 +483,11 @@
463483
blob_reset(&cdata);
464484
@ ]]></content:encoded>
465485
}
466486
@ </item>
467487
if( pPost ) manifest_destroy(pPost);
488
+ free(zTechnoteId);
468489
blob_reset(&contentHtml);
469490
free(zDate);
470491
free(zSuffix);
471492
nLine++;
472493
}
@@ -653,10 +674,11 @@
653674
char *zDate;
654675
int nChild = db_column_int(&q, 6);
655676
int nParent = db_column_int(&q, 7);
656677
const char *zTagList = db_column_text(&q, 8);
657678
Manifest *pPost = 0;
679
+ char *zTechnoteId = 0;
658680
Blob contentHtml = BLOB_INITIALIZER;
659681
int bForumContent = 0;
660682
time_t ts;
661683
662684
if( zTagList && zTagList[0]==0 ) zTagList = 0;
@@ -699,10 +721,11 @@
699721
blob_reset(&normalized);
700722
bForumContent = 1;
701723
}
702724
}
703725
}else if( zEType[0]=='e' ){
726
+ zTechnoteId = rss_technote_id(rid);
704727
technote_render_to_html(&contentHtml, rid);
705728
if( blob_size(&contentHtml)>0 ){
706729
Blob normalized = BLOB_INITIALIZER;
707730
rss_make_abs_links(&normalized, blob_str(&base),
708731
blob_str(&top), blob_str(&contentHtml),
@@ -714,11 +737,15 @@
714737
bForumContent = 1;
715738
}
716739
}
717740
fossil_print("<item>");
718741
fossil_print("<title>%s%h%h</title>\n", zPrefix, zCom, zSuffix);
719
- fossil_print("<link>%s/info/%s</link>\n", zBaseURL, zId);
742
+ if( zEType[0]=='e' && zTechnoteId!=0 ){
743
+ fossil_print("<link>%s/technote/%s</link>\n", zBaseURL, zTechnoteId);
744
+ }else{
745
+ fossil_print("<link>%s/info/%s</link>\n", zBaseURL, zId);
746
+ }
720747
fossil_print("<description>%s%h%h</description>\n", zPrefix, zCom, zSuffix);
721748
fossil_print("<pubDate>%s</pubDate>\n", zDate);
722749
fossil_print("<dc:creator>%h</dc:creator>\n", zAuthor);
723750
fossil_print("<guid>%s/info/%s</guid>\n", g.zBaseURL, zId);
724751
if( bForumContent ){
@@ -731,10 +758,11 @@
731758
blob_reset(&cdata);
732759
fossil_print("]]></content:encoded>\n");
733760
}
734761
fossil_print("</item>\n");
735762
if( pPost ) manifest_destroy(pPost);
763
+ free(zTechnoteId);
736764
blob_reset(&contentHtml);
737765
free(zDate);
738766
free(zSuffix);
739767
nLine++;
740768
}
741769
--- src/rss.c
+++ src/rss.c
@@ -22,10 +22,24 @@
22 #include "rss.h"
23 #include <assert.h>
24
25 void forum_render_to_html(struct Blob*, const char*, const char*);
26 void technote_render_to_html(struct Blob*, int);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
27
28 /*
29 ** Append text to pOut, escaping any CDATA terminators.
30 */
31 static void rss_cdata_append(Blob *pOut, const char *zIn, int nIn){
@@ -380,10 +394,11 @@
380 char *zDate;
381 int nChild = db_column_int(&q, 6);
382 int nParent = db_column_int(&q, 7);
383 const char *zTagList = db_column_text(&q, 8);
384 Manifest *pPost = 0;
 
385 Blob contentHtml = BLOB_INITIALIZER;
386 int bForumContent = 0;
387 time_t ts;
388
389 if( zTagList && zTagList[0]==0 ) zTagList = 0;
@@ -431,10 +446,11 @@
431 blob_reset(&normalized);
432 bForumContent = 1;
433 }
434 }
435 }else if( zEType[0]=='e' ){
 
436 technote_render_to_html(&contentHtml, rid);
437 if( blob_size(&contentHtml)>0 ){
438 Blob normalized = BLOB_INITIALIZER;
439 rss_make_abs_links(&normalized, blob_str(&base),
440 blob_str(&top), blob_str(&contentHtml),
@@ -446,11 +462,15 @@
446 bForumContent = 1;
447 }
448 }
449 @ <item>
450 @ <title>%s(zPrefix)%h(zCom)%h(zSuffix)</title>
451 @ <link>%s(g.zBaseURL)/info/%s(zId)</link>
 
 
 
 
452 @ <description>%s(zPrefix)%h(zCom)%h(zSuffix)</description>
453 @ <pubDate>%s(zDate)</pubDate>
454 @ <dc:creator>%h(zAuthor)</dc:creator>
455 @ <guid>%s(g.zBaseURL)/info/%s(zId)</guid>
456 if( bForumContent ){
@@ -463,10 +483,11 @@
463 blob_reset(&cdata);
464 @ ]]></content:encoded>
465 }
466 @ </item>
467 if( pPost ) manifest_destroy(pPost);
 
468 blob_reset(&contentHtml);
469 free(zDate);
470 free(zSuffix);
471 nLine++;
472 }
@@ -653,10 +674,11 @@
653 char *zDate;
654 int nChild = db_column_int(&q, 6);
655 int nParent = db_column_int(&q, 7);
656 const char *zTagList = db_column_text(&q, 8);
657 Manifest *pPost = 0;
 
658 Blob contentHtml = BLOB_INITIALIZER;
659 int bForumContent = 0;
660 time_t ts;
661
662 if( zTagList && zTagList[0]==0 ) zTagList = 0;
@@ -699,10 +721,11 @@
699 blob_reset(&normalized);
700 bForumContent = 1;
701 }
702 }
703 }else if( zEType[0]=='e' ){
 
704 technote_render_to_html(&contentHtml, rid);
705 if( blob_size(&contentHtml)>0 ){
706 Blob normalized = BLOB_INITIALIZER;
707 rss_make_abs_links(&normalized, blob_str(&base),
708 blob_str(&top), blob_str(&contentHtml),
@@ -714,11 +737,15 @@
714 bForumContent = 1;
715 }
716 }
717 fossil_print("<item>");
718 fossil_print("<title>%s%h%h</title>\n", zPrefix, zCom, zSuffix);
719 fossil_print("<link>%s/info/%s</link>\n", zBaseURL, zId);
 
 
 
 
720 fossil_print("<description>%s%h%h</description>\n", zPrefix, zCom, zSuffix);
721 fossil_print("<pubDate>%s</pubDate>\n", zDate);
722 fossil_print("<dc:creator>%h</dc:creator>\n", zAuthor);
723 fossil_print("<guid>%s/info/%s</guid>\n", g.zBaseURL, zId);
724 if( bForumContent ){
@@ -731,10 +758,11 @@
731 blob_reset(&cdata);
732 fossil_print("]]></content:encoded>\n");
733 }
734 fossil_print("</item>\n");
735 if( pPost ) manifest_destroy(pPost);
 
736 blob_reset(&contentHtml);
737 free(zDate);
738 free(zSuffix);
739 nLine++;
740 }
741
--- src/rss.c
+++ src/rss.c
@@ -22,10 +22,24 @@
22 #include "rss.h"
23 #include <assert.h>
24
25 void forum_render_to_html(struct Blob*, const char*, const char*);
26 void technote_render_to_html(struct Blob*, int);
27
28 /*
29 ** Return the technote id (event- tag suffix) for rid, or NULL.
30 ** Caller must free the returned string.
31 */
32 static char *rss_technote_id(int rid){
33 return db_text(0,
34 "SELECT substr(tagname,7) FROM tag, tagxref"
35 " WHERE tag.tagid=tagxref.tagid"
36 " AND tagxref.rid=%d"
37 " AND tagname GLOB 'event-*'",
38 rid
39 );
40 }
41
42 /*
43 ** Append text to pOut, escaping any CDATA terminators.
44 */
45 static void rss_cdata_append(Blob *pOut, const char *zIn, int nIn){
@@ -380,10 +394,11 @@
394 char *zDate;
395 int nChild = db_column_int(&q, 6);
396 int nParent = db_column_int(&q, 7);
397 const char *zTagList = db_column_text(&q, 8);
398 Manifest *pPost = 0;
399 char *zTechnoteId = 0;
400 Blob contentHtml = BLOB_INITIALIZER;
401 int bForumContent = 0;
402 time_t ts;
403
404 if( zTagList && zTagList[0]==0 ) zTagList = 0;
@@ -431,10 +446,11 @@
446 blob_reset(&normalized);
447 bForumContent = 1;
448 }
449 }
450 }else if( zEType[0]=='e' ){
451 zTechnoteId = rss_technote_id(rid);
452 technote_render_to_html(&contentHtml, rid);
453 if( blob_size(&contentHtml)>0 ){
454 Blob normalized = BLOB_INITIALIZER;
455 rss_make_abs_links(&normalized, blob_str(&base),
456 blob_str(&top), blob_str(&contentHtml),
@@ -446,11 +462,15 @@
462 bForumContent = 1;
463 }
464 }
465 @ <item>
466 @ <title>%s(zPrefix)%h(zCom)%h(zSuffix)</title>
467 if( zEType[0]=='e' && zTechnoteId!=0 ){
468 @ <link>%s(g.zBaseURL)/technote/%s(zTechnoteId)</link>
469 }else{
470 @ <link>%s(g.zBaseURL)/info/%s(zId)</link>
471 }
472 @ <description>%s(zPrefix)%h(zCom)%h(zSuffix)</description>
473 @ <pubDate>%s(zDate)</pubDate>
474 @ <dc:creator>%h(zAuthor)</dc:creator>
475 @ <guid>%s(g.zBaseURL)/info/%s(zId)</guid>
476 if( bForumContent ){
@@ -463,10 +483,11 @@
483 blob_reset(&cdata);
484 @ ]]></content:encoded>
485 }
486 @ </item>
487 if( pPost ) manifest_destroy(pPost);
488 free(zTechnoteId);
489 blob_reset(&contentHtml);
490 free(zDate);
491 free(zSuffix);
492 nLine++;
493 }
@@ -653,10 +674,11 @@
674 char *zDate;
675 int nChild = db_column_int(&q, 6);
676 int nParent = db_column_int(&q, 7);
677 const char *zTagList = db_column_text(&q, 8);
678 Manifest *pPost = 0;
679 char *zTechnoteId = 0;
680 Blob contentHtml = BLOB_INITIALIZER;
681 int bForumContent = 0;
682 time_t ts;
683
684 if( zTagList && zTagList[0]==0 ) zTagList = 0;
@@ -699,10 +721,11 @@
721 blob_reset(&normalized);
722 bForumContent = 1;
723 }
724 }
725 }else if( zEType[0]=='e' ){
726 zTechnoteId = rss_technote_id(rid);
727 technote_render_to_html(&contentHtml, rid);
728 if( blob_size(&contentHtml)>0 ){
729 Blob normalized = BLOB_INITIALIZER;
730 rss_make_abs_links(&normalized, blob_str(&base),
731 blob_str(&top), blob_str(&contentHtml),
@@ -714,11 +737,15 @@
737 bForumContent = 1;
738 }
739 }
740 fossil_print("<item>");
741 fossil_print("<title>%s%h%h</title>\n", zPrefix, zCom, zSuffix);
742 if( zEType[0]=='e' && zTechnoteId!=0 ){
743 fossil_print("<link>%s/technote/%s</link>\n", zBaseURL, zTechnoteId);
744 }else{
745 fossil_print("<link>%s/info/%s</link>\n", zBaseURL, zId);
746 }
747 fossil_print("<description>%s%h%h</description>\n", zPrefix, zCom, zSuffix);
748 fossil_print("<pubDate>%s</pubDate>\n", zDate);
749 fossil_print("<dc:creator>%h</dc:creator>\n", zAuthor);
750 fossil_print("<guid>%s/info/%s</guid>\n", g.zBaseURL, zId);
751 if( bForumContent ){
@@ -731,10 +758,11 @@
758 blob_reset(&cdata);
759 fossil_print("]]></content:encoded>\n");
760 }
761 fossil_print("</item>\n");
762 if( pPost ) manifest_destroy(pPost);
763 free(zTechnoteId);
764 blob_reset(&contentHtml);
765 free(zDate);
766 free(zSuffix);
767 nLine++;
768 }
769

Keyboard Shortcuts

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