11use serde:: { Deserialize , Serialize } ;
2- use std:: collections:: HashMap ;
32
43#[ derive( Debug , Clone , Serialize , Deserialize ) ]
54pub struct Paper {
@@ -12,43 +11,6 @@ pub struct Paper {
1211}
1312
1413impl Paper {
15- pub fn to_display_map ( & self , columns : & [ String ] ) -> HashMap < String , String > {
16- let mut map = HashMap :: new ( ) ;
17- // Always include Link even if not in columns
18- map. insert ( "Link" . to_string ( ) , self . link . clone ( ) ) ;
19-
20- for column in columns {
21- match column. as_str ( ) {
22- "Title" => map. insert ( column. clone ( ) , self . title . clone ( ) ) ,
23- "Authors" => map. insert (
24- column. clone ( ) ,
25- if !self . authors . is_empty ( ) {
26- format ! ( "{} 等" , self . authors[ 0 ] )
27- } else {
28- String :: new ( )
29- } ,
30- ) ,
31- "Abstract" => map. insert ( column. clone ( ) , self . abstract_text . clone ( ) ) ,
32- "Date" => {
33- let date = self . date . split ( 'T' ) . next ( ) . unwrap_or ( "" ) . to_string ( ) ;
34- map. insert ( column. clone ( ) , date)
35- }
36- _ => None ,
37- } ;
38- }
39- map
40- }
41-
42- pub fn get_chinese_column_name ( name : & str ) -> & str {
43- match name {
44- "Title" => "标题" ,
45- "Authors" => "作者" ,
46- "Abstract" => "摘要" ,
47- "Date" => "日期" ,
48- _ => name,
49- }
50- }
51-
5214 // 新增方法:生成 README 表格行
5315 pub fn to_readme_markdown ( & self , index : usize ) -> String {
5416 let title_link = format ! ( "**[{}]({})**" , self . title, self . link) ;
0 commit comments