prawn_hebrew 0.0.7 → 0.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/prawn_hebrew.rb +8 -0
- data/lib/version.rb +3 -3
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 5bce759324c9ddd6c50281d64a986b18df0390951268ec3b1d73070ab49f9484
|
|
4
|
+
data.tar.gz: 1213589f341946c555682929bd737ffe8d715ee9400f174e01377751c9c7c64c
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e9b463d274d655efcade8b1c3acab361e9f4776c9fce6c6aedc09dee0f6c8b9d7c3cd6cd2c8ae2a2f5f7e6888155477d550708e654b41561dddb765a113d4c01
|
|
7
|
+
data.tar.gz: 787b80276ff7af3e9da4c3067192562a4b8ba0f5af9cd0cd52e75e7ffd5431e32cbfba215d671728407c5dcdd8cbd052bc19baaae65f61312db8c503faab4146
|
data/lib/prawn_hebrew.rb
CHANGED
|
@@ -8,8 +8,16 @@ module PrawnHebrew
|
|
|
8
8
|
|
|
9
9
|
# Set to true for debugging which text rendering path is used
|
|
10
10
|
DEBUG_MODE = false
|
|
11
|
+
INVISIBLE_CHARS = /[\u200B\u200C\u200D\u200E\u200F\uFEFF\u00AD\u202A\u202B\u202C\u202D\u202E]/.freeze
|
|
12
|
+
NBSP_CHARS = /[\u00A0\u202F]/.freeze
|
|
13
|
+
|
|
14
|
+
def sanitize_text(text)
|
|
15
|
+
return text if text.nil?
|
|
16
|
+
text.to_s.gsub(INVISIBLE_CHARS, '').gsub(NBSP_CHARS, ' ')
|
|
17
|
+
end
|
|
11
18
|
|
|
12
19
|
def hebrew_formatted_text(text, size: 12, style: :normal, hebrew_font: DEFAULT_HEBREW_FONT, english_font: DEFAULT_ENGLISH_FONT)
|
|
20
|
+
text = sanitize_text(text)
|
|
13
21
|
words = text.to_s.split(/(\s+|\n)/)
|
|
14
22
|
hebrew_run = []
|
|
15
23
|
fragments = []
|
data/lib/version.rb
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
VERSION = "0.0.
|
|
3
|
-
end
|
|
1
|
+
module PrawnHebrew
|
|
2
|
+
VERSION = "0.0.8"
|
|
3
|
+
end
|