ref: 4a1caf253849c19c1197d1da45c9eefd1210c611
parent: d2e6790b3ff30aaa4a3a91e80334548155219d81
author: sirjofri <sirjofri@sirjofri.de>
date: Tue Jun 23 04:08:39 EDT 2020
adds atom-compatible content and summary fields summary == description and will be printed before content, so that template: title: title pubDate: pubDate | updated link: link (href or text) summary | description content
--- a/rssfill.c
+++ b/rssfill.c
@@ -57,6 +57,8 @@
fprint(fd, "link: %s\n", f->link);
if(f->desc != nil)
fprint(fd, "\n%s\n", f->desc);
+ if(f->cont != nil)
+ fprint(fd, "\n%s\n", f->cont);
nulldir(&dir);
dir.mtime = d;
@@ -81,6 +83,8 @@
free(f->desc);
if(f->date != nil)
free(f->date);
+ if(f->cont != nil)
+ free(f->cont);
free(f);
}
return;
@@ -238,6 +242,13 @@
st = DESC;
break;
}
+ if(!strcmp(x->na, "summary") && st == ITEM){
+ st = DESC;
+ break;
+ }
+ if(!strcmp(x->na, "content") && st == ITEM){
+ st = CONTENT;
+ }
if(!strcmp(x->na, "link") && st == ITEM){
st = LINK;
break;
@@ -268,6 +279,9 @@
case DESC:
f->desc = strdup(x->na);
break;
+ case CONTENT:
+ f->cont = strdup(x->na);
+ break;
case DATE:
f->date = strdup(x->na);
break;
@@ -297,6 +311,14 @@
break;
}
if(!strcmp(x->na, "description") && st == DESC){
+ st = ITEM;
+ break;
+ }
+ if(!strcmp(x->na, "summary") && st == DESC){
+ st = ITEM;
+ break;
+ }
+ if(!strcmp(x->na, "content") && st == CONTENT){
st = ITEM;
break;
}
--- a/rssfill.h
+++ b/rssfill.h
@@ -4,6 +4,7 @@
char *link;
char *desc;
char *date;
+ char *cont;
int s;
Feed *n;
Feed *p;
@@ -15,6 +16,7 @@
TITLE,
LINK,
DESC,
+ CONTENT,
DATE,
END,
};