- From: Florian Rivoal <florian@rivoal.net>
- Date: Fri, 1 Apr 2016 23:09:24 +0900
- To: Jonathan Kew <jfkthame@gmail.com>
- Cc: www-style@w3.org
> On Apr 1, 2016, at 22:38, Jonathan Kew <jfkthame@gmail.com> wrote: > > On 1/4/16 09:03, Henrik Andersson wrote: >> The text-transform property is nice for the various effects that it can >> do. However, I think that it could do more. >> >> As such I propose a new value for the property. >> >> The new value is rot13. When this new transform is applied the >> characters in the text will be replaced according to the rot13 >> substitution cipher. >> >> Here is an example of it being used: >> >> <style> >> .spoiler { >> text-transform: rot13; >> } >> .spoiler:hover { >> text-transform: none; >> } >> </style> >> <div class="spoiler">Today is an important day.</div> >> >> > > I don't think I support this -- it's much too limited in scope, being essentially an English-only feature. (What will rot13 do with Latin-script text that includes lots of diacritics? Let alone non-Latin alphabets?) > > If -- and it's a fairly big "if", in my mind -- we want new text-transform capabilities, I think we should instead consider a more generalized feature that allows authors to specify the desired transform or substitution. I agree. There are lots of potentially useful text transforms people can think of, but many of them are either gimmicky, or serious but targeting niche use cases. A generic mechanism for author defined transforms would be a better use of WG and UA vendor time. > At a simple level, maybe a function modeled on the "tr" utility, which allows rot13 to be pretty trivially specified, but also allows alternative transforms, and could handle extended alphabets, etc: > > .spoiler { > text-transform: tr("a-zA-Z", "n-za-mN-ZA-M"); > } > > Or for a less cryptic (and more extensible) approach, > > @text-transform rot13 { > match: "a"-"z" "A"-"Z"; /* could also support U+XXXX notation? */ > replace: "n"-"z" "a"-"m" "N"-"Z" "A"-"M"; > /* could also think about other kinds of transform... reverse? > arbitrary text-munging functions? etc. */ > } > > .spoiler { > text-transform: rot13; > } I've looked into an @rule based approach a few years ago with some depth: https://wiki.csswg.org/ideas/at-text-transform I've added the rot13 example at the bottom. I'm happy to reopen this topic if people are interested, as I think it's a neat idea, but it wasn't obvious then that this would gather implementor interest. If people are going to be interested in this for more than a day, I'll happily resurrect this. - Florian
Received on Friday, 1 April 2016 14:09:47 UTC