add show retweet weibo

This commit is contained in:
A.C.Sukazyo Eyre 2023-11-29 21:08:08 +08:00
parent 79d41d5e72
commit 20c9916535
Signed by: Eyre_S
GPG Key ID: C17CE40291207874
2 changed files with 13 additions and 2 deletions

View File

@ -5,7 +5,7 @@ MORNY_ARCHIVE_NAME = morny-coeur
MORNY_CODE_STORE = https://github.com/Eyre-S/Coeur-Morny-Cono MORNY_CODE_STORE = https://github.com/Eyre-S/Coeur-Morny-Cono
MORNY_COMMIT_PATH = https://github.com/Eyre-S/Coeur-Morny-Cono/commit/%s MORNY_COMMIT_PATH = https://github.com/Eyre-S/Coeur-Morny-Cono/commit/%s
VERSION = 1.3.0-dev12 VERSION = 1.3.0-dev13
USE_DELTA = false USE_DELTA = false
VERSION_DELTA = VERSION_DELTA =

View File

@ -11,12 +11,23 @@ object SocialWeiboParser {
@throws[HttpError[?] | SttpClientException | ParsingFailure | DecodingFailure] @throws[HttpError[?] | SttpClientException | ParsingFailure | DecodingFailure]
def parseMStatus (api: MApi[MStatus]): SocialContent = { def parseMStatus (api: MApi[MStatus]): SocialContent = {
def retweetedMessage (retweetedStatus: Option[MStatus]): String =
retweetedStatus match
case Some(status) =>
val pic_preview = if status.pic_ids.isEmpty then "" else
"\n" + (for (pic <- status.pic_ids) yield "🖼️").mkString(" ")
// language=html
s"""
|<i>//<a href="https://weibo.com/${status.user.id}/${status.id}">${h(status.user.screen_name)}</a>:</i>
|${ch(status.text)}$pic_preview
|""".stripMargin
case None => ""
val content = val content =
// language=html // language=html
s"""🔸<b><a href="${api.data.user.profile_url}">${h(api.data.user.screen_name)}</a></b> s"""🔸<b><a href="${api.data.user.profile_url}">${h(api.data.user.screen_name)}</a></b>
| |
|${ch(api.data.text)} |${ch(api.data.text)}
| |${retweetedMessage(api.data.retweeted_status)}
|<i><a href="${genWeiboStatusUrl(StatusUrlInfo(api.data.user.id.toString, api.data.id))}">${h(api.data.created_at)}</a></i>""".stripMargin |<i><a href="${genWeiboStatusUrl(StatusUrlInfo(api.data.user.id.toString, api.data.id))}">${h(api.data.created_at)}</a></i>""".stripMargin
api.data.pics match api.data.pics match
case None => case None =>