I would like to request an option "force-lowercase" to control whether to keep uppercase letters or not in the titlecase and sentencecase functions. The main use case for this is acronyms and proper names in titles/headings, and also sentence continuation in ambiguous cases (see #39).
With force-lowercase: false (default) these two functions would only transform lowercase to uppercase letters as required, but not vice-verca (i.e. keep what is already uppercase). This is the current behaviour of the titlecase function.
With force-lowercase: true both functions would additionally transform uppercase letters to lowercase as per the styling rules, so as to fix ALL UPPERCASE INPUTS. This is the current behaviour of the sentencecase function.
Example (using typst):
#import "@preview/decasify:0.9.0": sentencecase, titlecase
#set text(lang: "en")
#sentencecase[Typst supports export to PDF and HTML.]
// Output: Typst supports export to PDF and HTML.
#titlecase[Typst supports export to PDF and HTML.] // current behaviour
// Output: Typst Supports Export to PDF and HTML.
#sentencecase(force-lowercase: true)[TYPST SUPPORTS EXPORT TO PDF AND HTML.] // current behaviour
// Output: Typst supports export to pdf and html.
#titlecase(force-lowercase: true)[TYPST SUPPORTS EXPORT TO PDF AND HTML.]
// Output: Typst Supports Export to Pdf and Html.
Note that in principle force-lowercase: true in the above example could then also be achieved with #sentencecase(lowercase[TYPST ...]) once the default behaviour has been altered to preserve uppercase letters
I would favour if the default setting was force-lowercase: false consistently for both titlecase and sentencecase, i.e. preserving the current behaviour of the titlecase function. Alternatively, force-lowercase: false could be the default for the titlecase function and force-lowercase: true the default for the sentencecase function to keep the respective current behaviour of either function as-is, while allowing to change it to the respective opposite behaviour if desired.
As a bonus, there could be a clever force-lowercase: auto as default for either function, which would translate to force-lowercase: true if more than 50% of characters in the input are already uppercase, and translate to force-lowercase: false otherwise.
I would like to request an option "
force-lowercase" to control whether to keep uppercase letters or not in the titlecase and sentencecase functions. The main use case for this is acronyms and proper names in titles/headings, and also sentence continuation in ambiguous cases (see #39).With
force-lowercase: false(default) these two functions would only transform lowercase to uppercase letters as required, but not vice-verca (i.e. keep what is already uppercase). This is the current behaviour of the titlecase function.With
force-lowercase: trueboth functions would additionally transform uppercase letters to lowercase as per the styling rules, so as to fix ALL UPPERCASE INPUTS. This is the current behaviour of the sentencecase function.Example (using typst):
Note that in principle
force-lowercase: truein the above example could then also be achieved with#sentencecase(lowercase[TYPST ...])once the default behaviour has been altered to preserve uppercase lettersI would favour if the default setting was
force-lowercase: falseconsistently for both titlecase and sentencecase, i.e. preserving the current behaviour of the titlecase function. Alternatively,force-lowercase: falsecould be the default for the titlecase function andforce-lowercase: truethe default for the sentencecase function to keep the respective current behaviour of either function as-is, while allowing to change it to the respective opposite behaviour if desired.As a bonus, there could be a clever
force-lowercase: autoas default for either function, which would translate toforce-lowercase: trueif more than 50% of characters in the input are already uppercase, and translate toforce-lowercase: falseotherwise.