Giter Club home page Giter Club logo

accent-folding's People

Contributors

aristus avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

accent-folding's Issues

Case not respected

Example, with the second item of the accent_map array: 'Á':'a'
Should be 'Á':'A', nope ?

Allow an array for the q parameter instead of a string in the accent_folded_hilite function

Hi.

I'm using your javascript code in a project and I have make some changes. I paste the top of the function with the changes.

// accent_folded_hilite("Fulanilo López", 'lo')
//	 --> "Fulani<b>lo</b> <b>Ló</b>pez"
//
function accent_folded_hilite(str, q) {
	var str_folded = accent_fold(str).toLowerCase().replace(/[<>]+/g, '');
	// ORIGINAL CODE THAT ONLY ALLOW A STRING
	// var q_folded = accent_fold(q).toLowerCase().replace(/[<>]+/g, '');
	// MODIFIED CODE TO ALLOW AN ARRAY INSTEAD OF A STRING
	var q_folded=[];
	for(var i in q) {
		q_folded[i]=accent_fold(q[i]).toLowerCase().replace(/[<>]+/g, '');
	}

	// create an intermediary string with hilite hints
	// example: fulani<lo> <lo>pez
	// ORIGINAL CODE THAT ONLY ALLOW A STRING
	// var re = new RegExp(q_folded, 'g');
	// var hilite_hints = str_folded.replace(re, '<'+q_folded+'>');
	// MODIFIED CODE TO ALLOW AN ARRAY INSTEAD OF A STRING
	var hilite_hints = str_folded;
	var re = null;
	for(var i in q) {
		re = new RegExp(q_folded[i], 'g');
		hilite_hints=hilite_hints.replace(re, '<'+q_folded[i]+'>');
	}
.
.
.

You can see the project here: https://trifacho.github.io

License?

Hi @aristus:
What would be the license for the Python code example?
Thanks!

Duplicate key/value pairs

There appears to be a grip of duplicate key/value pairs in this hash.. For example Ł is in there as a key twice. Some of the duplicates have the same key with different values. I noticed this cause ExecJS complains about duplicate keys in hashes when it compiles Coffee to JS (I ported the hash to Coffee real quick).

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.