Fossil SCM
Point technote RSS link at technote page instead of checkin page.
Commit
a88d460c5b329777ed4840a0220b03edbb05bb7ad1760c77146406c5b1526b26
Parent
7aa1f7f2eab8717…
1 file changed
+30
-2
+30
-2
| --- src/rss.c | ||
| +++ src/rss.c | ||
| @@ -22,10 +22,24 @@ | ||
| 22 | 22 | #include "rss.h" |
| 23 | 23 | #include <assert.h> |
| 24 | 24 | |
| 25 | 25 | void forum_render_to_html(struct Blob*, const char*, const char*); |
| 26 | 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 | +} | |
| 27 | 41 | |
| 28 | 42 | /* |
| 29 | 43 | ** Append text to pOut, escaping any CDATA terminators. |
| 30 | 44 | */ |
| 31 | 45 | static void rss_cdata_append(Blob *pOut, const char *zIn, int nIn){ |
| @@ -380,10 +394,11 @@ | ||
| 380 | 394 | char *zDate; |
| 381 | 395 | int nChild = db_column_int(&q, 6); |
| 382 | 396 | int nParent = db_column_int(&q, 7); |
| 383 | 397 | const char *zTagList = db_column_text(&q, 8); |
| 384 | 398 | Manifest *pPost = 0; |
| 399 | + char *zTechnoteId = 0; | |
| 385 | 400 | Blob contentHtml = BLOB_INITIALIZER; |
| 386 | 401 | int bForumContent = 0; |
| 387 | 402 | time_t ts; |
| 388 | 403 | |
| 389 | 404 | if( zTagList && zTagList[0]==0 ) zTagList = 0; |
| @@ -431,10 +446,11 @@ | ||
| 431 | 446 | blob_reset(&normalized); |
| 432 | 447 | bForumContent = 1; |
| 433 | 448 | } |
| 434 | 449 | } |
| 435 | 450 | }else if( zEType[0]=='e' ){ |
| 451 | + zTechnoteId = rss_technote_id(rid); | |
| 436 | 452 | technote_render_to_html(&contentHtml, rid); |
| 437 | 453 | if( blob_size(&contentHtml)>0 ){ |
| 438 | 454 | Blob normalized = BLOB_INITIALIZER; |
| 439 | 455 | rss_make_abs_links(&normalized, blob_str(&base), |
| 440 | 456 | blob_str(&top), blob_str(&contentHtml), |
| @@ -446,11 +462,15 @@ | ||
| 446 | 462 | bForumContent = 1; |
| 447 | 463 | } |
| 448 | 464 | } |
| 449 | 465 | @ <item> |
| 450 | 466 | @ <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 | + } | |
| 452 | 472 | @ <description>%s(zPrefix)%h(zCom)%h(zSuffix)</description> |
| 453 | 473 | @ <pubDate>%s(zDate)</pubDate> |
| 454 | 474 | @ <dc:creator>%h(zAuthor)</dc:creator> |
| 455 | 475 | @ <guid>%s(g.zBaseURL)/info/%s(zId)</guid> |
| 456 | 476 | if( bForumContent ){ |
| @@ -463,10 +483,11 @@ | ||
| 463 | 483 | blob_reset(&cdata); |
| 464 | 484 | @ ]]></content:encoded> |
| 465 | 485 | } |
| 466 | 486 | @ </item> |
| 467 | 487 | if( pPost ) manifest_destroy(pPost); |
| 488 | + free(zTechnoteId); | |
| 468 | 489 | blob_reset(&contentHtml); |
| 469 | 490 | free(zDate); |
| 470 | 491 | free(zSuffix); |
| 471 | 492 | nLine++; |
| 472 | 493 | } |
| @@ -653,10 +674,11 @@ | ||
| 653 | 674 | char *zDate; |
| 654 | 675 | int nChild = db_column_int(&q, 6); |
| 655 | 676 | int nParent = db_column_int(&q, 7); |
| 656 | 677 | const char *zTagList = db_column_text(&q, 8); |
| 657 | 678 | Manifest *pPost = 0; |
| 679 | + char *zTechnoteId = 0; | |
| 658 | 680 | Blob contentHtml = BLOB_INITIALIZER; |
| 659 | 681 | int bForumContent = 0; |
| 660 | 682 | time_t ts; |
| 661 | 683 | |
| 662 | 684 | if( zTagList && zTagList[0]==0 ) zTagList = 0; |
| @@ -699,10 +721,11 @@ | ||
| 699 | 721 | blob_reset(&normalized); |
| 700 | 722 | bForumContent = 1; |
| 701 | 723 | } |
| 702 | 724 | } |
| 703 | 725 | }else if( zEType[0]=='e' ){ |
| 726 | + zTechnoteId = rss_technote_id(rid); | |
| 704 | 727 | technote_render_to_html(&contentHtml, rid); |
| 705 | 728 | if( blob_size(&contentHtml)>0 ){ |
| 706 | 729 | Blob normalized = BLOB_INITIALIZER; |
| 707 | 730 | rss_make_abs_links(&normalized, blob_str(&base), |
| 708 | 731 | blob_str(&top), blob_str(&contentHtml), |
| @@ -714,11 +737,15 @@ | ||
| 714 | 737 | bForumContent = 1; |
| 715 | 738 | } |
| 716 | 739 | } |
| 717 | 740 | fossil_print("<item>"); |
| 718 | 741 | 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 | + } | |
| 720 | 747 | fossil_print("<description>%s%h%h</description>\n", zPrefix, zCom, zSuffix); |
| 721 | 748 | fossil_print("<pubDate>%s</pubDate>\n", zDate); |
| 722 | 749 | fossil_print("<dc:creator>%h</dc:creator>\n", zAuthor); |
| 723 | 750 | fossil_print("<guid>%s/info/%s</guid>\n", g.zBaseURL, zId); |
| 724 | 751 | if( bForumContent ){ |
| @@ -731,10 +758,11 @@ | ||
| 731 | 758 | blob_reset(&cdata); |
| 732 | 759 | fossil_print("]]></content:encoded>\n"); |
| 733 | 760 | } |
| 734 | 761 | fossil_print("</item>\n"); |
| 735 | 762 | if( pPost ) manifest_destroy(pPost); |
| 763 | + free(zTechnoteId); | |
| 736 | 764 | blob_reset(&contentHtml); |
| 737 | 765 | free(zDate); |
| 738 | 766 | free(zSuffix); |
| 739 | 767 | nLine++; |
| 740 | 768 | } |
| 741 | 769 |
| --- 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 |