diff --git a/saoriview.cpp b/saoriview.cpp index fd23f70..a502e87 100644 --- a/saoriview.cpp +++ b/saoriview.cpp @@ -121,7 +121,7 @@ } if (!rebloged) { result += "
"; - result += json["content"].toString(); + result += contentParser(json["content"].toString()); result += "
"; for (auto j:json["media_attachments"].toArray()) { result += mediaParser(j.toObject()); @@ -176,11 +176,43 @@ return result; } +const QString SaoriView::contentParser(const QString content) +{ + QString result; + auto l = content.split("
"); + for (auto s:l) { + result += "
"; + int i = 0; + for (auto c:s) { + if (c != ' ') break; + result += " "; + } + result += s.right(s.count() - i); + } + result = result.right(result.count() - 6); + + l = result.split("

"); + result = ""; + for (auto s:l) { + result += "

"; + int i = 0; + for (auto c:s) { + if (c != ' ') break; + result += " "; + } + result += s.right(s.count() - i); + } + result = result.right(result.count() - 3); + + return result; +} + void SaoriView::recived(const QString timeline,const QByteArray data) { if (timeline != m_viewname) return; QJsonArray json = QJsonDocument::fromJson(data).array(); for (auto j:json) { + qDebug() << j.toObject()["content"].toString(); int i = 0; SaoriViewEntry *entry = nullptr; for(;m_entries.count() > i;i ++) { diff --git a/saoriview.h b/saoriview.h index 1632318..f14cc7d 100644 --- a/saoriview.h +++ b/saoriview.h @@ -59,6 +59,7 @@ const QString statusParser(const QJsonObject json); const QString accountParser(const QJsonObject json); const QString mediaParser(const QJsonObject json); + const QString contentParser(const QString content); const QString notificationParser(const QJsonObject json); public slots: