Skip to content
This repository has been archived by the owner on Oct 10, 2019. It is now read-only.

Commit

Permalink
Andreas Krennmair:
Browse files Browse the repository at this point in the history
	implement issue #8.
  • Loading branch information
akrennmair committed Nov 29, 2007
1 parent d083cad commit ee110c3
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGES
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ Changes for newsbeuter:
0.8:
implemented custom configurability of feed list and article list format
improved reload speed by checking the Last-Modified header
added special tags to rename feeds

0.7 (2007-09-18):
implemented the possibility to predefine filters
Expand Down
7 changes: 7 additions & 0 deletions doc/chapter-tagging.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,10 @@ a tag. When you select the tag "news", you will see all three RSS feeds. Pressin
"t" again and e.g. selecting the "conspiracy" tag, you will only see the
http://blog.fefe.de/rss.xml?html RSS feed. Pressing "^T" clears the current tag,
and again shows all RSS feeds, regardless of their assigned tags.

A special type of tag are tags that start with the tilde character ("~"). When such
a tag is found, the feed title is set to the tag name (excluding the ~ character).
With this feature, you can give feeds any title you want in your feed list:

http://rss.orf.at/news.xml "~ORF News"

1 change: 1 addition & 0 deletions src/controller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -775,6 +775,7 @@ void controller::reload_urls_file() {
for (std::vector<rss_feed>::iterator jt=feeds.begin();jt!=feeds.end();++jt) {
if (*it == jt->rssurl()) {
found = true;
jt->set_tags(urlcfg->get_tags(*it));
new_feeds.push_back(*jt);
break;
}
Expand Down
17 changes: 14 additions & 3 deletions src/rss.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -461,8 +461,10 @@ bool rss_feed::matches_tag(const std::string& tag) {
std::string rss_feed::get_tags() {
std::string tags;
for (std::vector<std::string>::iterator it=tags_.begin();it!=tags_.end();++it) {
tags.append(*it);
tags.append(" ");
if (it->substr(0,1) == "~") {
tags.append(*it);
tags.append(" ");
}
}
return tags;
}
Expand Down Expand Up @@ -501,7 +503,16 @@ std::string rss_item::description() const {
}

std::string rss_feed::title() const {
return utils::convert_text(title_, nl_langinfo(CODESET), "utf-8");
bool found_title = false;
std::string alt_title;
for (std::vector<std::string>::const_iterator it=tags_.begin();it!=tags_.end();it++) {
if (it->substr(0,1) == "~") {
found_title = true;
alt_title = it->substr(1, it->length()-1);
break;
}
}
return found_title ? alt_title : utils::convert_text(title_, nl_langinfo(CODESET), "utf-8");
}

std::string rss_feed::description() const {
Expand Down
3 changes: 2 additions & 1 deletion src/urlreader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ std::vector<std::string>& urlreader::get_tags(const std::string& url) {
std::vector<std::string> urlreader::get_alltags() {
std::vector<std::string> tmptags;
for (std::set<std::string>::iterator it=alltags.begin();it!=alltags.end();++it) {
tmptags.push_back(*it);
if (it->substr(0,1) != "~")
tmptags.push_back(*it);
}
return tmptags;
}
Expand Down

0 comments on commit ee110c3

Please sign in to comment.