From 2287d334e0e92cacf06a19faf8bd1e67536cdc77 Mon Sep 17 00:00:00 2001 From: "sheche@microsoft.com" Date: Sat, 22 Dec 2018 16:31:44 +0800 Subject: [PATCH] Replace the with '^' --- lib/plugins/leetcode.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/lib/plugins/leetcode.js b/lib/plugins/leetcode.js index a2e17b8f..373aadfe 100644 --- a/lib/plugins/leetcode.js +++ b/lib/plugins/leetcode.js @@ -157,11 +157,12 @@ plugin.getProblem = function(problem, cb) { problem.totalAC = JSON.parse(q.stats).totalAccepted; problem.totalSubmit = JSON.parse(q.stats).totalSubmission; - if (!q.translatedContent) { - problem.desc = he.decode(cheerio.load(q.content).root().text()); - }else{ - problem.desc = he.decode(cheerio.load(q.translatedContent).root().text()); - } + + let content = q.translatedContent ? q.translatedContent : q.content; + // Replace with '^' as the power operator + content = content.replace(/<\/sup>/gm, '').replace(//gm, '^'); + problem.desc = he.decode(cheerio.load(content).root().text()); + problem.templates = JSON.parse(q.codeDefinition); problem.testcase = q.sampleTestCase; problem.testable = q.enableRunCode;