Skip to content

Commit bb12d87

Browse files
authored
Merge pull request skygragon#144 from jdneo/master
Replace the <sup> with '^'
2 parents 2646b67 + 2287d33 commit bb12d87

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

lib/plugins/leetcode.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -157,11 +157,12 @@ plugin.getProblem = function(problem, cb) {
157157

158158
problem.totalAC = JSON.parse(q.stats).totalAccepted;
159159
problem.totalSubmit = JSON.parse(q.stats).totalSubmission;
160-
if (!q.translatedContent) {
161-
problem.desc = he.decode(cheerio.load(q.content).root().text());
162-
}else{
163-
problem.desc = he.decode(cheerio.load(q.translatedContent).root().text());
164-
}
160+
161+
let content = q.translatedContent ? q.translatedContent : q.content;
162+
// Replace <sup/> with '^' as the power operator
163+
content = content.replace(/<\/sup>/gm, '').replace(/<sup>/gm, '^');
164+
problem.desc = he.decode(cheerio.load(content).root().text());
165+
165166
problem.templates = JSON.parse(q.codeDefinition);
166167
problem.testcase = q.sampleTestCase;
167168
problem.testable = q.enableRunCode;

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy