38
39
rss_item& item = feed->get_item_by_guid(guid);
39
std::string code = "{list";
40
listformatter listfmt;
41
42
rss_feed * feedptr = item.get_feedptr();
43
std::ostringstream feedtitle;
44
feedtitle << _("Feed: ");
44
std::string title, feedtitle;
45
45
if (feedptr->title().length() > 0) {
46
feedtitle << feedptr->title();
46
title = feedptr->title();
47
47
} else if (feedptr->link().length() > 0) {
48
feedtitle << feedptr->link();
48
title = feedptr->link();
49
49
} else if (feedptr->rssurl().length() > 0) {
50
feedtitle << feedptr->rssurl();
52
if (feedtitle.str().length() > 0) {
53
code.append("{listitem text:");
54
code.append(stfl::quote(feedtitle.str().c_str()));
50
title = feedptr->rssurl();
52
feedtitle = utils::strprintf("%s%s", _("Feed: "), title.c_str());
53
listfmt.add_line(feedtitle);
58
55
if (item.title().length() > 0) {
59
code.append("{listitem text:");
60
std::ostringstream title;
61
title << _("Title: ");
62
title << item.title();
63
code.append(stfl::quote(title.str()));
56
title = utils::strprintf("%s%s", _("Title: "), item.title().c_str());
57
listfmt.add_line(title);
67
60
if (item.author().length() > 0) {
68
code.append("{listitem text:");
69
std::ostringstream author;
70
author << _("Author: ");
71
author << item.author();
72
code.append(stfl::quote(author.str()));
61
std::string author = utils::strprintf("%s%s", _("Author: "), item.author().c_str());
62
listfmt.add_line(author);
76
65
if (item.link().length() > 0) {
77
code.append("{listitem text:");
78
std::ostringstream link;
81
code.append(stfl::quote(link.str()));
66
std::string link = utils::strprintf("%s%s", _("Link: "), item.link().c_str());
67
listfmt.add_line(link);
85
code.append("{listitem text:");
86
std::ostringstream date;
88
date << item.pubDate();
89
code.append(stfl::quote(date.str()));
70
std::string date = utils::strprintf("%s%s", _("Date: "), item.pubDate().c_str());
71
listfmt.add_line(date);
92
73
if (item.flags().length() > 0) {
93
code.append("{listitem text:");
94
std::ostringstream flags;
95
flags << _("Flags: ");
96
flags << item.flags();
97
code.append(stfl::quote(flags.str()));
74
std::string flags = utils::strprintf("%s%s", _("Flags: "), item.flags().c_str());
75
listfmt.add_line(flags);
101
78
if (item.enclosure_url().length() > 0) {
102
code.append("{listitem text:");
103
std::ostringstream enc_url;
104
enc_url << _("Podcast Download URL: ");
105
enc_url << item.enclosure_url() << " (" << _("type: ") << item.enclosure_type() << ")";
106
code.append(stfl::quote(enc_url.str()));
79
std::string enc_url = utils::strprintf("%s%s (%s%s)", _("Podcast Download URL: "), item.enclosure_url().c_str(), _("type: "), item.enclosure_type().c_str());
80
listfmt.add_line(enc_url);
110
code.append("{listitem text:\"\"}");
112
85
set_head(item.title());
114
87
if (!render_hack) {
137
110
lines = render_html(item.description(), links, item.feedurl(), render_width);
140
for (std::vector<std::string>::iterator it = lines.begin(); it != lines.end(); ++it) {
141
std::string line("{listitem text:");
142
line.append(stfl::quote(*it));
149
f->modify("article","replace_inner",code);
113
listfmt.add_lines(lines);
115
f->modify("article","replace_inner",listfmt.format_list());
150
116
f->set("articleoffset","0");
152
118
do_redraw = false;
205
166
v->show_error(_("Aborted saving."));
208
v->write_item(item, filename);
209
snprintf(buf, sizeof(buf), _("Saved article to %s."), filename.c_str());
169
v->get_ctrl()->write_item(item, filename);
170
v->show_error(utils::strprintf(_("Saved article to %s."), filename.c_str()));
212
snprintf(buf, sizeof(buf), _("Error: couldn't write article to file %s"), filename.c_str());
172
v->show_error(utils::strprintf(_("Error: couldn't write article to file %s"), filename.c_str()));
354
313
if (tokens[0] == "save" && tokens.size() >= 2) {
355
314
std::string filename = utils::resolve_tilde(tokens[1]);
356
315
rss_item& item = feed->get_item_by_guid(guid);
359
317
if (filename == "") {
360
318
v->show_error(_("Aborted saving."));
363
v->write_item(item, filename);
364
snprintf(buf, sizeof(buf), _("Saved article to %s"), filename.c_str());
321
v->get_ctrl()->write_item(item, filename);
322
v->show_error(utils::strprintf(_("Saved article to %s"), filename.c_str()));
367
snprintf(buf, sizeof(buf), _("Error: couldn't save article to %s"), filename.c_str());
324
v->show_error(utils::strprintf(_("Error: couldn't save article to %s"), filename.c_str()));