The areas / V34. The tactics of Mathlib
Mathlib.Tactic.Linter.TextBased.UnicodeLinter
9 declarations. Mathlib docs · Source
Tools for the unicode Linter
The actual linter is defined in TextBased.lean.
This file defines the allowlist and other tools used by the linter.
When changing, make sure to stay in sync with style guide
def Mathlib.Linter.TextBased.UnicodeLinter.UnicodeVariant.emoji E1 #
Char
Following any unicode character, this indicates that the emoji variant should be displayed
def Mathlib.Linter.TextBased.UnicodeLinter.UnicodeVariant.text E1 #
Char
Following any unicode character, this indicates that the text variant should be displayed
def Mathlib.Linter.TextBased.UnicodeLinter.Char.printCodepointHex E1 #
Char → String
Prints a unicode character's codepoint in hexadecimal with prefix 'U+'. E.g., 'a' is "U+0061".
def Mathlib.Linter.TextBased.UnicodeLinter.String.printCodepointHex E1 #
String → String
Prints all characters in a string in hexadecimal with prefix 'U+'. E.g., "ab" is "U+0061;U+0062".
def Mathlib.Linter.TextBased.UnicodeLinter.emojis E1 #
Array Char
Unicode symbols in mathlib that should always be followed by the emoji variant selector.
def Mathlib.Linter.TextBased.UnicodeLinter.nonEmojis E1 #
Array Char
Unicode symbols in mathlib that should always be followed by the text variant selector.
def Mathlib.Linter.TextBased.UnicodeLinter.unrestricted E1 #
Array Char
Unicode symbols in mathlib that have no restrictions on whether they are followed by a selector or which selector they are followed by.
def Mathlib.Linter.TextBased.UnicodeLinter.isAllowedCharacter E1 #
Char → Bool
If false, the character is not allowed in Mathlib.
Implemented using an allowlist consisting of:
- certain ASCII characters
- certain emojis (
emojis) - certain non-emoji variants of emojifiable characters (
nonEmojis) - certain characters with no selector restrictions (
unrestricted) - characters with abbreviations in the VSCode extension (
withVSCodeAbbrev) - "the rest" (
othersInMathlib)
Note: if true, a character might still not be allowed depending on context
(e.g. misplaced variant selectors).
def Mathlib.Linter.TextBased.UnicodeLinter.replaceDisallowed E1 #
Char → Option String
Provide default replacement (String) for a disallowed character, or none if none defined