- From: Sebastian Zartner via GitHub <noreply@w3.org>
- Date: Fri, 25 Jul 2025 21:44:23 +0000
- To: public-css-archive@w3.org
Giving this some more thought in regard of #12526 and #8893, I think `@text-transform` needs to be defined a bit differently. ```ebnf @text-transform <transform-name> { <declaration-list> } <transform-name> = <dashed-ident> ``` Descriptors: ```ebnf rules = <text-transform-rule># <text-transform-rule> = [ initial || medial || final ]? [ in [ first-word | last-word ] ]? [ <char-list> to <char-list> ] | <'text-transform'> <char-list> = <enumeration> | <range> <enumeration> = <string> <range> = <urange> | <string> ``` This basically resembles what's in @frivoal's proposal with the addition of `[ initial || medial || final ]?` being part of the rule itself, so there can be different rules for different parts of the words. This replaced the `position` descriptor of the proposal. The additional `[ in [ first-word | last-word ] ]?` allows to apply specific rules to the first or last word in a sentence. The first rule that matches a character will be applied, any following rules will be ignored. ```ebnf ignore-words = <string>+ [ except [ first || last ] ]? ``` This represents a list of words that should be excluded from transformation. (Issue: With that, no rules are applied to those words. So they will stay as defined in the source, which might not be what you'd want. So maybe there should be another type of transformation rule that applies to whole words.) The `except [ first || last ]` bit allows to _include_ words of the ignore list in the transformation if they are the first or last in a sentence. With that, [sentence case](https://github.com/w3c/csswg-drafts/issues/8893) could be done via ```css @text-transform --sentence-case { rules: initial in first-word "a-z" to "A-Z", "A-Z" to "a-z"; } ``` (Given the text is restricted to ASCII letters.) And [title case](https://github.com/w3c/csswg-drafts/issues/12526) could be done via ```css @text-transform --title-case { rules: initial "a-z" to "A-Z", "A-Z" to "a-z"; ignore-words: "a" "an" "and" "or" "the" "in" "on" "of" "at" "by" "for" "but" "nor" "to" "with" except first last; } ``` Sebastian -- GitHub Notification of comment by SebastianZ Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/3132#issuecomment-3120458377 using your GitHub account -- Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config
Received on Friday, 25 July 2025 21:44:24 UTC