couple of fixes for #1133 and working on other parsing things
This commit is contained in:
parent
9792895e0b
commit
fe72cd1564
@ -258,10 +258,13 @@ QStringList TextFactory::tokenizeProcessArguments(const QString& command) {
|
||||
|
||||
case TokenState::InsideArgSpaced: {
|
||||
switch (chr.unicode()) {
|
||||
case u'\\':
|
||||
// We found escaped!
|
||||
state = TokenState::EscapedFromSpaced;
|
||||
continue;
|
||||
// NOTE: Probably disable escaping in spaced arguments to provide simpler UX?
|
||||
/*
|
||||
case u'\\':
|
||||
// We found escaped!
|
||||
state = TokenState::EscapedFromSpaced;
|
||||
continue;
|
||||
*/
|
||||
|
||||
case u' ':
|
||||
// We need to end this argument.
|
||||
|
@ -41,6 +41,10 @@ FeedParser::FeedParser(QString data, bool is_xml)
|
||||
|
||||
FeedParser::~FeedParser() {}
|
||||
|
||||
QStringList FeedParser::discoverFeeds(const QUrl& url) const {
|
||||
return {};
|
||||
}
|
||||
|
||||
QString FeedParser::xmlMessageRawContents(const QDomElement& msg_element) const {
|
||||
QString raw_contents;
|
||||
QTextStream str(&raw_contents);
|
||||
|
@ -20,8 +20,14 @@ class FeedParser {
|
||||
explicit FeedParser(QString data, bool is_xml = true);
|
||||
virtual ~FeedParser();
|
||||
|
||||
// Returns list of absolute URLs of discovered feeds from provided base URL.
|
||||
virtual QStringList discoverFeeds(const QUrl& url) const;
|
||||
|
||||
// Guesses feed.
|
||||
virtual QPair<StandardFeed*, QList<IconLocation>> guessFeed(const QByteArray& content,
|
||||
const QString& content_type) const = 0;
|
||||
|
||||
// Returns list of all messages from the feed.
|
||||
virtual QList<Message> messages();
|
||||
|
||||
protected:
|
||||
|
@ -122,8 +122,8 @@ bool FeedsImportExportModel::exportToOMPL20(QByteArray& result, bool export_icon
|
||||
}
|
||||
|
||||
case RootItem::Kind::Feed: {
|
||||
auto* child_feed = dynamic_cast<StandardFeed*>(child_item);
|
||||
QDomElement outline_feed = opml_document.createElement("outline");
|
||||
auto* child_feed = qobject_cast<StandardFeed*>(child_item);
|
||||
QDomElement outline_feed = opml_document.createElement(QSL("outline"));
|
||||
|
||||
outline_feed.setAttribute(QSL("type"), QSL("rss"));
|
||||
outline_feed.setAttribute(QSL("text"), child_feed->title());
|
||||
@ -157,6 +157,14 @@ bool FeedsImportExportModel::exportToOMPL20(QByteArray& result, bool export_icon
|
||||
outline_feed.setAttribute(QSL("version"), QSL("JSON"));
|
||||
break;
|
||||
|
||||
case StandardFeed::Type::Sitemap:
|
||||
outline_feed.setAttribute(QSL("version"), QSL("Sitemap"));
|
||||
break;
|
||||
|
||||
case StandardFeed::Type::SitemapIndex:
|
||||
outline_feed.setAttribute(QSL("version"), QSL("SitemapIndex"));
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@ -181,17 +189,27 @@ bool FeedsImportExportModel::produceFeed(const FeedLookup& feed_lookup) {
|
||||
|
||||
try {
|
||||
if (feed_lookup.fetch_metadata_online) {
|
||||
new_feed = StandardFeed::guessFeed(StandardFeed::SourceType::Url,
|
||||
StandardFeed::SourceType source_type =
|
||||
feed_lookup.custom_data.contains(QSL("sourceType"))
|
||||
? feed_lookup.custom_data[QSL("sourceType")].value<StandardFeed::SourceType>()
|
||||
: StandardFeed::SourceType::Url;
|
||||
|
||||
QString pp_script = !feed_lookup.custom_data[QSL("postProcessScript")].toString().isEmpty()
|
||||
? feed_lookup.custom_data[QSL("postProcessScript")].toString()
|
||||
: feed_lookup.post_process_script;
|
||||
|
||||
new_feed = StandardFeed::guessFeed(source_type,
|
||||
feed_lookup.url,
|
||||
feed_lookup.post_process_script,
|
||||
pp_script,
|
||||
NetworkFactory::NetworkAuthentication::NoAuthentication,
|
||||
!feed_lookup.do_not_fetch_icons,
|
||||
{},
|
||||
{},
|
||||
feed_lookup.custom_proxy);
|
||||
|
||||
new_feed->setSourceType(source_type);
|
||||
new_feed->setSource(feed_lookup.url);
|
||||
new_feed->setPostProcessScript(feed_lookup.post_process_script);
|
||||
new_feed->setPostProcessScript(pp_script);
|
||||
|
||||
if (feed_lookup.do_not_fetch_titles) {
|
||||
QString old_title = feed_lookup.custom_data[QSL("title")].toString();
|
||||
@ -216,6 +234,10 @@ bool FeedsImportExportModel::produceFeed(const FeedLookup& feed_lookup) {
|
||||
new_feed = new StandardFeed();
|
||||
|
||||
if (feed_lookup.custom_data.isEmpty()) {
|
||||
// We assume these are "best-guess" defaults.
|
||||
new_feed->setSourceType(StandardFeed::SourceType::Url);
|
||||
new_feed->setType(StandardFeed::Type::Rss2X);
|
||||
|
||||
new_feed->setSource(feed_lookup.url);
|
||||
new_feed->setTitle(feed_lookup.url);
|
||||
new_feed->setIcon(qApp->icons()->fromTheme(QSL("application-rss+xml")));
|
||||
|
Loading…
x
Reference in New Issue
Block a user