@@ -115,6 +115,41 @@ func (t TagList) tableLine() string {
115115	return  fmt .Sprintf ("|%04d|%v|%v|%v|%v|%v|%v|%v|\n " , t .FrontendQuestionID , t .QuestionTitle , t .SolutionPath , t .Difficulty , t .TimeComplexity , t .SpaceComplexity , t .Favorite , t .Acceptance )
116116}
117117
118+ func  standardizedTitle (orig  string , frontendQuestionID  int32 ) string  {
119+ 	s0  :=  strings .TrimSpace (orig )
120+ 	s1  :=  strings .Replace (s0 , " " , "-" , - 1 )
121+ 	s2  :=  strings .Replace (s1 , "'" , "" , - 1 )
122+ 	s3  :=  strings .Replace (s2 , "%" , "" , - 1 )
123+ 	s4  :=  strings .Replace (s3 , "(" , "" , - 1 )
124+ 	s5  :=  strings .Replace (s4 , ")" , "" , - 1 )
125+ 	s6  :=  strings .Replace (s5 , "," , "" , - 1 )
126+ 	s7  :=  strings .Replace (s6 , "?" , "" , - 1 )
127+ 	count  :=  0 
128+ 	// 去掉 --- 这种情况,这种情况是由于题目标题中包含 - ,左右有空格,左右一填充,造成了 ---,3 个 - 
129+ 	for  i  :=  0 ; i  <  len (s7 )- 2 ; i ++  {
130+ 		if  s7 [i ] ==  '-'  &&  s7 [i + 1 ] ==  '-'  &&  s7 [i + 2 ] ==  '-'  {
131+ 			fmt .Printf ("【需要修正 --- 的标题是 %v】\n " , fmt .Sprintf ("%04d.%v" , int (frontendQuestionID ), s7 ))
132+ 			s7  =  s7 [:i + 1 ] +  s7 [i + 3 :]
133+ 			count ++ 
134+ 		}
135+ 	}
136+ 	if  count  >  0  {
137+ 		fmt .Printf ("总共修正了 %v 个标题\n " , count )
138+ 	}
139+ 	// 去掉 -- 这种情况,这种情况是由于题目标题中包含负号 - 
140+ 	for  i  :=  0 ; i  <  len (s7 )- 2 ; i ++  {
141+ 		if  s7 [i ] ==  '-'  &&  s7 [i + 1 ] ==  '-'  {
142+ 			fmt .Printf ("【需要修正 -- 的标题是 %v】\n " , fmt .Sprintf ("%04d.%v" , int (frontendQuestionID ), s7 ))
143+ 			s7  =  s7 [:i + 1 ] +  s7 [i + 2 :]
144+ 			count ++ 
145+ 		}
146+ 	}
147+ 	if  count  >  0  {
148+ 		fmt .Printf ("总共修正了 %v 个标题\n " , count )
149+ 	}
150+ 	return  s7 
151+ }
152+ 
118153// GenerateTagMdRows define 
119154func  GenerateTagMdRows (solutionIds  []int , metaMap  map [int ]TagList , mdrows  []Mdrow , internal  bool ) []TagList  {
120155	tl  :=  []TagList {}
@@ -123,36 +158,7 @@ func GenerateTagMdRows(solutionIds []int, metaMap map[int]TagList, mdrows []Mdro
123158			tmp  :=  TagList {}
124159			tmp .FrontendQuestionID  =  row .FrontendQuestionID 
125160			tmp .QuestionTitle  =  strings .TrimSpace (row .QuestionTitle )
126- 			s1  :=  strings .Replace (tmp .QuestionTitle , " " , "-" , - 1 )
127- 			s2  :=  strings .Replace (s1 , "'" , "" , - 1 )
128- 			s3  :=  strings .Replace (s2 , "%" , "" , - 1 )
129- 			s4  :=  strings .Replace (s3 , "(" , "" , - 1 )
130- 			s5  :=  strings .Replace (s4 , ")" , "" , - 1 )
131- 			s6  :=  strings .Replace (s5 , "," , "" , - 1 )
132- 			s7  :=  strings .Replace (s6 , "?" , "" , - 1 )
133- 			count  :=  0 
134- 			// 去掉 --- 这种情况,这种情况是由于题目标题中包含 - ,左右有空格,左右一填充,造成了 ---,3 个 - 
135- 			for  i  :=  0 ; i  <  len (s7 )- 2 ; i ++  {
136- 				if  s7 [i ] ==  '-'  &&  s7 [i + 1 ] ==  '-'  &&  s7 [i + 2 ] ==  '-'  {
137- 					fmt .Printf ("【需要修正 --- 的标题是 %v】\n " , fmt .Sprintf ("%04d.%v" , int (row .FrontendQuestionID ), s7 ))
138- 					s7  =  s7 [:i + 1 ] +  s7 [i + 3 :]
139- 					count ++ 
140- 				}
141- 			}
142- 			if  count  >  0  {
143- 				fmt .Printf ("总共修正了 %v 个标题\n " , count )
144- 			}
145- 			// 去掉 -- 这种情况,这种情况是由于题目标题中包含负号 - 
146- 			for  i  :=  0 ; i  <  len (s7 )- 2 ; i ++  {
147- 				if  s7 [i ] ==  '-'  &&  s7 [i + 1 ] ==  '-'  {
148- 					fmt .Printf ("【需要修正 -- 的标题是 %v】\n " , fmt .Sprintf ("%04d.%v" , int (row .FrontendQuestionID ), s7 ))
149- 					s7  =  s7 [:i + 1 ] +  s7 [i + 2 :]
150- 					count ++ 
151- 				}
152- 			}
153- 			if  count  >  0  {
154- 				fmt .Printf ("总共修正了 %v 个标题\n " , count )
155- 			}
161+ 			s7  :=  standardizedTitle (row .QuestionTitle , row .FrontendQuestionID )
156162			if  internal  {
157163				tmp .SolutionPath  =  fmt .Sprintf ("[Go]({{< relref \" /ChapterFour/%v/%v.md\"  >}})" , util .GetChpaterFourFileNum (int (row .FrontendQuestionID )), fmt .Sprintf ("%04d.%v" , int (row .FrontendQuestionID ), s7 ))
158164			} else  {
0 commit comments