prawn_hebrew 0.0.5 → 0.0.6

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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/prawn_hebrew.rb +6 -11
  3. metadata +3 -6
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ad2256a5c7e53cc0b335bce5f5284ad3d33372d8580239c83283a4ab2542796c
4
- data.tar.gz: 4464fb1beb01533773a6eb1969455c539af02619fb6e4153d93a3682ca988121
3
+ metadata.gz: d5df90e0dbfa49359bec17f0242bd74575961defdbcd08fa0a9e349e16b741cb
4
+ data.tar.gz: 0d6d7e0e2894a4aed5174ca6a16fe7d2e53f44546974feb741d417f5c46c67a4
5
5
  SHA512:
6
- metadata.gz: fd4e466a35cdfa7d047419c0b49e08b6fb0b16dce0a1e36649f9245ed645ce81bbfefd5fb6783e7a0c0d5497d3af4086c7488c6925ffabd73db7524156d9c21f
7
- data.tar.gz: 7268788094ed4044b2b4621bfa3598a0bf3eb6fd5e8bfa8105b752fa41a9be764625dee7be864407db8f4444fc36633188e80cbe2873f016ca2bb0ac5e06238f
6
+ metadata.gz: ddaaa14bc478082942318462c87f774ad2ed195bd1fe8d3595179a7b61ec3c0d295fb97829f0a88ce575fd496b5c0bffb49d2e67a1a09316e3ebbc0228d0bc5d
7
+ data.tar.gz: 524de0466b4737077454a0e42148c3ec96ab8e4d6e8883d32440f7bd0cfe9edcb9f147b8a9ad837795d98fdc3f6ec75d24720ca19c4a529fa7467e00955e33a9
data/lib/prawn_hebrew.rb CHANGED
@@ -6,9 +6,6 @@ module PrawnHebrew
6
6
  DEFAULT_HEBREW_FONT = 'GveretLevinHebrew'.freeze
7
7
  DEFAULT_ENGLISH_FONT = 'Arial'.freeze
8
8
 
9
- # Returns array of text fragments for Prawn's formatted_text methods
10
- # Example:
11
- # formatted_text_box hebrew_formatted_text('שלום world'), at: [0,100]
12
9
  def hebrew_formatted_text(text, size: 12, style: :normal, hebrew_font: DEFAULT_HEBREW_FONT, english_font: DEFAULT_ENGLISH_FONT)
13
10
  words = text.to_s.split(/(\s+|\n)/)
14
11
  hebrew_run = []
@@ -16,7 +13,7 @@ module PrawnHebrew
16
13
 
17
14
  words.each do |word|
18
15
  if word.strip.empty?
19
- fragments << { text: word, font: english_font, size: size, style: style } if word != ' '
16
+ fragments << { text: word, font: english_font, size: size, styles: [style] } if word != ' '
20
17
  next
21
18
  end
22
19
 
@@ -25,27 +22,25 @@ module PrawnHebrew
25
22
  else
26
23
  unless hebrew_run.empty?
27
24
  hebrew_run.reverse.each_with_index do |hw, idx|
28
- fragments << { text: hw, font: hebrew_font, size: size, direction: :rtl, style: style }
29
- fragments << { text: ' ', font: hebrew_font, size: size, direction: :rtl, style: style } if idx < hebrew_run.length - 1
25
+ fragments << { text: hw, font: hebrew_font, size: size, direction: :rtl, styles: [style] }
26
+ fragments << { text: ' ', font: hebrew_font, size: size, direction: :rtl, styles: [style] } if idx < hebrew_run.length - 1
30
27
  end
31
28
  fragments << { text: ' ' }
32
29
  hebrew_run.clear
33
30
  end
34
- fragments << { text: "#{word} ", font: english_font, size: size, style: style }
31
+ fragments << { text: "#{word} ", font: english_font, size: size, styles: [style] }
35
32
  end
36
33
  end
37
34
 
38
35
  unless hebrew_run.empty?
39
36
  hebrew_run.reverse.each_with_index do |hw, idx|
40
- fragments << { text: hw, font: hebrew_font, size: size, direction: :rtl, style: style }
41
- fragments << { text: ' ', font: hebrew_font, size: size, direction: :rtl, style: style } if idx < hebrew_run.length - 1
37
+ fragments << { text: hw, font: hebrew_font, size: size, direction: :rtl, styles: [style] }
38
+ fragments << { text: ' ', font: hebrew_font, size: size, direction: :rtl, styles: [style] } if idx < hebrew_run.length - 1
42
39
  end
43
40
  end
44
-
45
41
  fragments
46
42
  end
47
43
 
48
- # Helper combining hebrew_formatted_text with formatted_text_box
49
44
  def hebrew_text_box(text, size: 12, style: :normal,
50
45
  hebrew_font: DEFAULT_HEBREW_FONT,
51
46
  english_font: DEFAULT_ENGLISH_FONT, **box_opts)
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: prawn_hebrew
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ben Lite
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2025-06-19 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies: []
13
12
  description: Working with hebrew words in prawn
14
13
  email: benlite96@gmail.com
@@ -22,7 +21,6 @@ homepage: https://rubygems.org/gems/prawn_hebrew
22
21
  licenses:
23
22
  - MIT
24
23
  metadata: {}
25
- post_install_message:
26
24
  rdoc_options: []
27
25
  require_paths:
28
26
  - lib
@@ -37,8 +35,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
37
35
  - !ruby/object:Gem::Version
38
36
  version: '0'
39
37
  requirements: []
40
- rubygems_version: 3.0.3
41
- signing_key:
38
+ rubygems_version: 3.6.7
42
39
  specification_version: 4
43
40
  summary: Hebrew Text in Prawn
44
41
  test_files: []