mod: article: show code

Closes #759

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2025-04-27 10:10:22 +08:00
parent c591b57f22
commit 3dad24e7b4
18 changed files with 78 additions and 25 deletions

View File

@@ -8,6 +8,7 @@ class Paragraph {
Pic? pic;
Line? line;
LinkCard? linkCard;
Code? code;
Paragraph({
this.align,
@@ -16,6 +17,7 @@ class Paragraph {
this.pic,
this.line,
this.linkCard,
this.code,
});
factory Paragraph.fromJson(Map<String, dynamic> json) => Paragraph(
@@ -31,6 +33,7 @@ class Paragraph {
linkCard: json['link_card'] == null
? null
: LinkCard.fromJson(json['link_card']),
code: json['code'] == null ? null : Code.fromJson(json['code']),
);
Map<String, dynamic> toJson() => {
@@ -41,6 +44,16 @@ class Paragraph {
};
}
class Code {
String? content;
String? lang;
Code.fromJson(Map<String, dynamic> json) {
content = json['content'];
lang = json['lang'];
}
}
class Ugc {
String? cover;
String? descSecond;

View File

@@ -85,7 +85,7 @@ class RcmdStat implements BaseStat {
class RcmdOwner extends BaseOwner {
RcmdOwner.fromJson(Map<String, dynamic> json) {
name = json['goto'] == 'av'
? (json['args']?['up_name'])
? (json['args']?['up_name'] ?? '')
: (json['desc_button']?['text'] ?? '');
mid = json['args']?['up_id'] ?? 0;
}