Skip to content

A javascript library to convert persian text for using on iOS/Android browsers.

License

Notifications You must be signed in to change notification settings

zoghal/persianParser

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 

Repository files navigation

persianParser.js

A javascript library to convert Persian (Farsi) text to another unicode range so iOS/Android browsers can recognize them as valid webfont suitable text.

Development Version

Please note that this library is under heavy development and I don't recommend using it in production environment since it might cause some problems and crash the iOS browser if used on a large amount of text.

Demo

Please visit The Demo Page on your iOS device using Safari or Google Chrome.

Please note That newer versions of Google Chrome for Android acutally support arabic/persian webfonts and you don't need to use this for that.

Usage

Include persianParser.js in your HTML page and use the method described below.

Methods

Parse Text


Use this method to do the conversion:

persianParser('این یک متن تست است و تبدیل خواهد شد.').parse();

Example Usage

var elems = document.querySelectorAll('h1, h2, p');

for(i = 0; i <= elems.length; i++)
{
    if( typeof elems[i] !== 'undefined' ){
        elems[i].innerHTML = persianParser(elems[i].innerHTML).parse();
    }
}

You might as well check the demo to see how it works.

###…

More methods coming soon.

##License persianParser was created by Sallar Kaboli and released under the MIT License.

Contains code from Arabic Parser released uner GNU GPL license.

Copyright (C) 2003-2013 Sallar Kaboli

Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:

1- The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.

2- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.

About

A javascript library to convert persian text for using on iOS/Android browsers.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%