Git Product home page Git Product logo

Comments (5)

nbubna avatar nbubna commented on August 25, 2024

Looking into it... It appears my regex's are not diacritic savvy. This may take a little time. I'll look into it, if no one beats me too it.

from case.

tallesl avatar tallesl commented on August 25, 2024

I searched for 10 minutes and looks like js' regex and Unicode sux... big time. You can see on Stack Overflow results all sorts of magic stuff; not really that classy.

Looks like that the least hackish way to accomplish this is to rely on an external library to do the job, such as xregexp. But that would mean adding it as a dependency and replacing js' RegExp calls...

from case.

nbubna avatar nbubna commented on August 25, 2024

Blech. Case is too small for dependencies. There may be simpler ways. Not giving up on this yet. :)

from case.

nbubna avatar nbubna commented on August 25, 2024

Ok, i think i can pretty easily support at least this much unicode: http://www.utf8-chartable.de/ That'll give us common diacritics, as well as a better range of symbols that can be "filled".

Pressing on to the second page gets more difficult, as the smalls and capitals begin to alternate both rapidly and inconsistently. http://www.utf8-chartable.de/unicode-utf8-table.pl?start=256 Pressing on beyond latin into greek shows little end to the challenge.

Eventually, i'd like to make Case's regexps officially extensible so that it's not too hard for people to create things like a Case.greek.js extension.

from case.

nbubna avatar nbubna commented on August 25, 2024

Ok, so you can now easily extend/replace the regexp set like so:

Case._.re = Case._.regexps([symbols][, lowers, uppers][, impropers]);

The four parameters are the logical expressions needed to make all the different transformations supported out of the box by Case. The first three should be strings that will go inside regexp character sets (e.g. new RegExp('['+symbols+']', 'g')). The impropers should be a regexp string that matches words that shouldn't be capitalized in title case (e.g. 'A|An|The' and so on). If any are missing, they will be filled in with the default ones.

Also, the symbols regexps are no longer exclusive but inclusive, meaning that you will never see the disappearing letter problem again.

from case.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.