forked from 01walid/goarabic
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 4b160e4
Showing
8 changed files
with
805 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# For more documentation, see: editorconfig.org | ||
root = true | ||
|
||
# Unix-style newlines with a newline ending every file | ||
[*] | ||
end_of_line = lf | ||
charset = utf-8 | ||
trim_trailing_whitespace = true | ||
insert_final_newline = true | ||
|
||
[*.go] | ||
indent_style = tab | ||
|
||
[*.html] | ||
indent_style = tab | ||
indent_size = 2 | ||
|
||
[*.json] | ||
indent_style = space | ||
indent_size = 4 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# Set the default behavior, in case people don't have core.autocrlf set. | ||
* text=auto | ||
* text eof=lf | ||
|
||
# Extensions that should be treated as binary files | ||
*.png binary | ||
*.jepg binary | ||
*.jpg binary | ||
*.gif binary | ||
|
||
*.ttf binary | ||
*.eot binary | ||
*.otf binary | ||
*.woff binary | ||
*.woff2 binary | ||
|
||
*.xls binary | ||
*.xlsx binary | ||
*.doc binary | ||
*.docx binary | ||
*.odf binary | ||
*.odt binary |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# Compiled Object files, Static and Dynamic libs (Shared Objects) | ||
*.o | ||
*.a | ||
*.so | ||
|
||
# Folders | ||
_obj | ||
_test | ||
|
||
# Architecture specific extensions/prefixes | ||
*.[568vq] | ||
[568vq].out | ||
|
||
*.cgo1.go | ||
*.cgo2.c | ||
_cgo_defun.c | ||
_cgo_gotypes.go | ||
_cgo_export.* | ||
|
||
_testmain.go | ||
|
||
*.exe | ||
*.test | ||
*.prof |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
The MIT License (MIT) | ||
|
||
Copyright (c) [2015] [Walid ZIOUCHE] | ||
|
||
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: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
# GoArabic | ||
A Go Lang package for dealing with Arabic text. | ||
|
||
This is an initial work on a set of Go functions developed to enhance Arabic web applications. | ||
It all started when I wanted to develop a self-hosted no-dependency and standalone Arabic Captcha in Go (for fun, as I'm discovering Go), and as expected, the Arabic text wasn't rendered as it should: | ||
|
||
![Before processing](https://res.cloudinary.com/walid/image/upload/v1429186546/before_pcyoha.png) | ||
|
||
So I started playing with Glyphs, unicode, and the special Arabic rules for joining letters. After a bit of work, I got this: | ||
|
||
![Before processing](https://res.cloudinary.com/walid/image/upload/v1429186546/after_cmkukt.png) | ||
|
||
shouldn't this be a separated package, along with other functionalities? I guess it should! | ||
|
||
## Current functionalities | ||
- Glyph representation of the given Arabic text for images/pdf .. etc generation. | ||
- Strip Tashkeel (Arabic Vowels). | ||
- SmartLengh: return the length of the given Arabic String without considering Tashkeel (Arabic Vowels). | ||
- Strip Tatweel | ||
- rune-wise (UTF-8) reverse of the Arabic text, leaving out the Latin one. | ||
|
||
## Todo | ||
- Arabic text normalization (Unshaping) | ||
- Add support for some special Quran text characters in Glyphs | ||
- Richer SmartLengh, ignoring some special characters. | ||
- Slugify: a simple Arabic slug generation. Striping Tashkeel and other special chars. | ||
- Spell numbers in Arabic idiom. | ||
- Present dates in Arabic or Hijri and convert Hijri date into Unix timestamp | ||
And maybe more... | ||
|
||
## Usage | ||
|
||
### Importing | ||
```go | ||
got get github.com/01walid/goarabic | ||
``` | ||
##### Example Usage | ||
```go | ||
package main | ||
|
||
import ( | ||
"fmt" | ||
"github.com/01walid/goarabic" | ||
) | ||
|
||
func main() { | ||
fmt.Println(goarabic.RemoveTashkeel("نًصٌ عَربيُّ")) | ||
fmt.Println(goarabic.ToGlyph("تجربة النص العربي")) | ||
} | ||
|
||
``` | ||
## Documentation | ||
Package docs available on [gopkgdoc]() | ||
|
||
## Contributing | ||
Contributions are greatly appreciated. Please fork this repository, make your changes, and open a pull request. More test cases and considerations might be needed, you can run tests using `go test` for the existing functionalities. | ||
|
||
This a [SemVer](http://semver.org/)sioned package. | ||
## License | ||
MIT License. |
Oops, something went wrong.