Beauty.hasunicodesupportMethod

Guesses if an IO object has support for unicode and returns true if this is the case, false otherwise.

Implemented by checking for a nonstandard property :unicode and falling back to the property :color. The rationale is that if a terminal is smart enough to support color, it will probably also be modern enough to support unicode. If this heuristic fails, explicitly set the :unicode to be false to overrule it.

To Do

An IOContext might come with an entire history of past settings. Consider checking if :color was ever true in that history to get a better heuristic (:color can be turned off simply because colorful output is undesired in some context).

Beauty.stringreplaceMethod

Replace arbitrary many pairs of strings (e.g. "ac" => "abc") in an AbstractString passed as first argument.

import Beauty
Beauty.stringreplace("ACDFH", "A" => "AB", "D" => "DE", "FH" => "FGH")

# output

"ABCDEFGH"
Beauty.unicode_superscript_digitsMethod

Return the argument, an AbstractString, with all digits and the minus sign replaced by superscript digits.

import Beauty
Beauty.unicode_superscript_digits("x^-13")

# output

"x^⁻¹³"