Skip to content

Commit

Permalink
fix: trim </code> in example output
Browse files Browse the repository at this point in the history
  • Loading branch information
j178 committed Mar 23, 2023
1 parent ed51b79 commit 92b73c5
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion leetcode/question.go
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,10 @@ func (q *QuestionData) ParseExampleOutputs() []string {
result := make([]string, 0, len(found))
// TODO multi-line output, like https://leetcode.cn/problems/find-valid-matrix-given-row-and-column-sums/
for _, f := range found {
output := strings.TrimSuffix(strings.TrimPrefix(strings.TrimSpace(f[1]), "<code>"), "</pre>")
output := strings.TrimSpace(f[1])
output = strings.TrimPrefix(output, "<code>")
output = strings.TrimSuffix(output, "</pre>")
output = strings.TrimSuffix(output, "</code>")
output = html2text.HTMLEntitiesToText(output)
output = strings.ReplaceAll(output, ", ", ",")
result = append(result, output)
Expand Down

0 comments on commit 92b73c5

Please sign in to comment.