philomath 0.0.2 → 0.0.3

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: de6e9c1a93226838154a7f40af3612342837c70409bb55b764d476012646a22d
4
- data.tar.gz: 2fabfee1a00ede53ea2fb474b268948c2011c71d4450061f48ec568a6e74b02f
3
+ metadata.gz: cd7b0c304a0ed0306aba4660fb0ee17cff27b671b8fe2606c8a41c0acf36e46c
4
+ data.tar.gz: 401b25956693d11eaa2a4337b86ec5dea2849b7b08f6b04970b59b15bddbbda6
5
5
  SHA512:
6
- metadata.gz: 5963a141fa1cc5bd0f753c7e4eb67219209032cbbe0bc4b356b3996b8ef5ff61db3c4170698d00b3b0f5104dd13a2ce58c8e2e584631c9af6c0d16652eebeaea
7
- data.tar.gz: 6eea387613f3750102a906b490f7ef22226908d26042070169cfe9179286b1b53a60c165bbc1090faecb9c137fcb6af02857b5f28f5092aae86df7e20eedfdab
6
+ metadata.gz: fcdf66b21e981a86592f0482bd47a1185b2166b3f40e1db3d3c767b2e2f32e45a14eaf524a801d95946e7a708fa52a1adc9a48bc97360e44097b44d3f1f257f9
7
+ data.tar.gz: defe87eb60a168985730e4e79f292349da7dd7dda365f80826760f2aae32ec6aa867a4c21e59f79b5048e67250a3c5113f6785f14f5f1e7ffadd4b8f13668b8f
@@ -3,7 +3,7 @@ module Philomath
3
3
  module_function
4
4
 
5
5
  def to_s
6
- "0.0.2"
6
+ "0.0.3"
7
7
  end
8
8
  end
9
9
  end
data/lib/philomath.rb CHANGED
@@ -2,6 +2,7 @@ require 'markdownlyze'
2
2
  require 'prawn'
3
3
  require 'prawn_components'
4
4
  require 'nokogiri'
5
+ require 'open-uri'
5
6
 
6
7
  require_relative 'philomath/rendering/render_code_inline'
7
8
  require_relative 'philomath/rendering/render_styled_link'
@@ -24,6 +25,7 @@ module Philomath
24
25
  content = chapter.key?(:content) ? chapter[:content] : File.read(chapter.fetch(:file_path))
25
26
  pdf_chapters << {
26
27
  name: chapter[:name],
28
+ path_to_chapter: File.dirname(chapter[:file_path]),
27
29
  parsed_elements: Markdownlyze.parse(content)
28
30
  }
29
31
  end
@@ -61,9 +63,18 @@ module Philomath
61
63
  pdf.ol(node[:value], callback: callback)
62
64
  when :ul
63
65
  pdf.ul(node[:value], callback: callback)
66
+ when :remote_image
67
+ pdf.move_down(6)
68
+ pdf.image(URI.open(node[:value]), position: :center, width: pdf.bounds.width - 25)
69
+ pdf.move_down(6)
64
70
  when :image
65
71
  pdf.move_down(6)
66
- pdf.image(chapter.images[node[:value]], position: :center, width: pdf.bounds.width - 25)
72
+
73
+ chapter_path = chapter_conf[:path_to_chapter]
74
+ path_to_image = node[:value]
75
+ image_absolute_path = File.join(chapter_path, path_to_image.sub(/^\.\//, ''))
76
+ pdf.image(image_absolute_path, position: :center, width: pdf.bounds.width - 25)
77
+
67
78
  pdf.move_down(6)
68
79
  when :quote
69
80
  pdf.quote(node[:value], callback: callback)
metadata CHANGED
@@ -1,11 +1,10 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: philomath
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Paweł Dąbrowski
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
10
  date: 2024-11-17 00:00:00.000000000 Z
@@ -30,14 +29,14 @@ dependencies:
30
29
  requirements:
31
30
  - - '='
32
31
  - !ruby/object:Gem::Version
33
- version: 0.0.2
32
+ version: 0.0.3
34
33
  type: :runtime
35
34
  prerelease: false
36
35
  version_requirements: !ruby/object:Gem::Requirement
37
36
  requirements:
38
37
  - - '='
39
38
  - !ruby/object:Gem::Version
40
- version: 0.0.2
39
+ version: 0.0.3
41
40
  - !ruby/object:Gem::Dependency
42
41
  name: prawn_components
43
42
  requirement: !ruby/object:Gem::Requirement
@@ -92,10 +91,8 @@ files:
92
91
  - lib/philomath/rendering/render_styled_link.rb
93
92
  - lib/philomath/rendering/render_without_entities.rb
94
93
  - lib/philomath/version.rb
95
- homepage:
96
94
  licenses: []
97
95
  metadata: {}
98
- post_install_message:
99
96
  rdoc_options: []
100
97
  require_paths:
101
98
  - lib
@@ -110,8 +107,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
110
107
  - !ruby/object:Gem::Version
111
108
  version: '0'
112
109
  requirements: []
113
- rubygems_version: 3.4.10
114
- signing_key:
110
+ rubygems_version: 3.6.2
115
111
  specification_version: 4
116
112
  summary: Turn markdown files into PDF book
117
113
  test_files: []