diff options
author | Navan Chauhan <navanchauhan@gmail.com> | 2024-10-21 23:57:43 -0600 |
---|---|---|
committer | Navan Chauhan <navanchauhan@gmail.com> | 2024-10-21 23:57:43 -0600 |
commit | f12ba1e275b2e58d6489d32d79e6836a3f349f53 (patch) | |
tree | b704a056799483fa50d9be8063c9e5a48711be17 /iTexSnip/Utils/KatexUtils.swift | |
parent | 05165cc8d98ef5ffa8ee3a8ba9bf1ad5e0b5a9ab (diff) |
remove unnecessary comments
Diffstat (limited to 'iTexSnip/Utils/KatexUtils.swift')
-rw-r--r-- | iTexSnip/Utils/KatexUtils.swift | 8 |
1 files changed, 1 insertions, 7 deletions
diff --git a/iTexSnip/Utils/KatexUtils.swift b/iTexSnip/Utils/KatexUtils.swift index 697e700..5daaf13 100644 --- a/iTexSnip/Utils/KatexUtils.swift +++ b/iTexSnip/Utils/KatexUtils.swift @@ -14,17 +14,15 @@ func change( var result = "" var i = 0 let n = inputStr.count - let inputArray = Array(inputStr) // Convert string to array of characters for easier access + let inputArray = Array(inputStr) while i < n { - // Get the range for the substring equivalent to oldInst if i + oldInst.count <= n && inputStr[ inputStr.index( inputStr.startIndex, offsetBy: i)..<inputStr.index( inputStr.startIndex, offsetBy: i + oldInst.count)] == oldInst { - // Check if the old_inst is followed by old_surr_l let start = i + oldInst.count if start < n && inputArray[start] == oldSurrL { var count = 1 @@ -127,7 +125,6 @@ func changeAll( func toKatex(formula: String) -> String { var res = formula - // Remove mbox surrounding res = changeAll( inputStr: res, oldInst: "\\mbox ", newInst: " ", oldSurrL: "{", oldSurrR: "}", newSurrL: "", newSurrR: "") @@ -135,16 +132,13 @@ func toKatex(formula: String) -> String { inputStr: res, oldInst: "\\mbox", newInst: " ", oldSurrL: "{", oldSurrR: "}", newSurrL: "", newSurrR: "") - // Additional processing similar to the Python version... res = res.replacingOccurrences(of: "\\[", with: "") res = res.replacingOccurrences(of: "\\]", with: "") res = res.replacingOccurrences( of: "\\\\[?.!,\'\"](?:\\s|$)", with: "", options: .regularExpression) - // Merge consecutive `text` res = rmDollarSurr(content: res) - // Remove extra spaces res = res.replacingOccurrences(of: " +", with: " ", options: .regularExpression) return res.trimmingCharacters(in: .whitespacesAndNewlines) |