@@ -247,15 +247,24 @@ writeExp (EDelimited op "" [Right (EArray [AlignLeft, AlignLeft] rows)]) =
247
247
writeExp (EDelimited open close es) =
248
248
if isDelim open && isDelim close
249
249
then
250
- if matchedPair open close && -- see #233
250
+ ( if matchedPair open close && -- see #233
251
251
not (any (\ x -> x == Left open || x == Left close) es)
252
- then open <> body <> close
253
- else " lr" <> inParens (open <> body <> close)
252
+ then id
253
+ else (" lr" <> ) . inParens)
254
+ (renderOpen open <> body <> renderClose close)
254
255
else esc open <> body <> esc close
255
- where fromDelimited (Left e) =
256
- " mid(" <> fromMaybe (esc e) (M. lookup e typstSymbolMap) <> " )"
256
+ where fromDelimited (Left e) = " mid(" <> renderSymbol e <> " )"
257
257
fromDelimited (Right e) = writeExp e
258
- isDelim c = c `elem` [" (" ," )" ," [" ," ]" ," {" ," }" ," |" ," ||" ]
258
+ isDelim c = c `elem` [" (" ," )" ," [" ," ]" ," {" ," }" ," |" ," ||" ," \x2016 " ]
259
+ renderOpen e =
260
+ if T. all isAscii e
261
+ then e
262
+ else renderSymbol e <> " "
263
+ renderClose e =
264
+ if T. all isAscii e
265
+ then e
266
+ else " " <> renderSymbol e
267
+ renderSymbol e = fromMaybe (esc e) (M. lookup e typstSymbolMap)
259
268
matchedPair " (" " )" = True
260
269
matchedPair " [" " ]" = True
261
270
matchedPair " {" " }" = True
0 commit comments