fix: correct character category testing

main
F. G. Dorais 2023-03-11 14:57:14 -05:00 committed by Henrik Böving
parent 5f59fbaac4
commit 755f06fb0d
1 changed files with 2 additions and 4 deletions

View File

@ -55,13 +55,12 @@ partial def xmlGetHeadingId (el : Xml.Element) : String :=
|>.filter (!·.isEmpty) |>.filter (!·.isEmpty)
|> replacement.intercalate |> replacement.intercalate
unicodeToDrop (c : Char) : Bool := unicodeToDrop (c : Char) : Bool :=
let generalCategory := Unicode.getGeneralCategory c
let cats := [ let cats := [
Unicode.GeneralCategory.P, -- punctuation Unicode.GeneralCategory.P, -- punctuation
Unicode.GeneralCategory.S, -- separator Unicode.GeneralCategory.S, -- separator
Unicode.GeneralCategory.C -- other Unicode.GeneralCategory.C -- other
] ]
cats.elem generalCategory cats.any (Unicode.isInGeneralCategory c)
/-- /--
This function try to find the given name, both globally and in current module. This function try to find the given name, both globally and in current module.
@ -179,12 +178,11 @@ def autoLink (el : Element) : HtmlM Element := do
| none => | none =>
return [Content.Character s] return [Content.Character s]
unicodeToSplit (c : Char) : Bool := unicodeToSplit (c : Char) : Bool :=
let generalCategory := Unicode.getGeneralCategory c
let cats := [ let cats := [
Unicode.GeneralCategory.S, -- separator Unicode.GeneralCategory.S, -- separator
Unicode.GeneralCategory.C -- other Unicode.GeneralCategory.C -- other
] ]
cats.elem generalCategory cats.any (Unicode.isInGeneralCategory c)
/-- Core function of modifying the cmark rendered docstring html. -/ /-- Core function of modifying the cmark rendered docstring html. -/
partial def modifyElement (element : Element) : HtmlM Element := partial def modifyElement (element : Element) : HtmlM Element :=