improved spacing around punctuation in dictionary function
Browse files- lsj_dict.py +2 -1
lsj_dict.py
CHANGED
|
@@ -147,7 +147,8 @@ def format_text(data):
|
|
| 147 |
# Change <tr> tags to bold
|
| 148 |
text = text.replace("<tr>", "<span class='tr'> ").replace("</tr>", "</span>")
|
| 149 |
|
| 150 |
-
|
|
|
|
| 151 |
|
| 152 |
# .replace(",", ", ").replace(";", "; ").replace(":", ": ").replace("(", " (").replace(")", ") ").replace("[", " [").replace("]", "] ").replace(" ,", ", ").replace(" ; ", "; ").replace(" : ", ": ").replace(" ." , ". ")
|
| 153 |
|
|
|
|
| 147 |
# Change <tr> tags to bold
|
| 148 |
text = text.replace("<tr>", "<span class='tr'> ").replace("</tr>", "</span>")
|
| 149 |
|
| 150 |
+
pattern = r"\s+([,;:.()\"\'\[\]])\s+"
|
| 151 |
+
text = re.sub(pattern, r"\1 ", text)
|
| 152 |
|
| 153 |
# .replace(",", ", ").replace(";", "; ").replace(":", ": ").replace("(", " (").replace(")", ") ").replace("[", " [").replace("]", "] ").replace(" ,", ", ").replace(" ; ", "; ").replace(" : ", ": ").replace(" ." , ". ")
|
| 154 |
|