rtfm-filemanager 6.0.10 → 6.0.11

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/bin/rtfm +46 -3
  3. metadata +3 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ae2f555bf52ad3f1fcbaa0e110b4f3b4252bf906bee100aa2a4092c6f00b858a
4
- data.tar.gz: 20f17f27d98841596a0950eef615fd2916811459483ff3b41842f177fc6de640
3
+ metadata.gz: 3bd4479747f5beca81bc4706028e03670623f615a03b57fa0977b05ab3f545f3
4
+ data.tar.gz: 02b5fa470a870fd2bfb911047ac0bf753a3147800722c2ad6e39b28f0c0f56bf
5
5
  SHA512:
6
- metadata.gz: 55d86c42f7130b275c0bc467de36f4371269c21e33bef33b6ad4bc7d09fa6d9a21b3b75133525e8c994db7213a98e481cb5f4fc3bba292ce456472851a31120c
7
- data.tar.gz: 4346e80ddf4a689c083becf9a6cef921fddb57659c192a3ad4e9b82c3a63deefdd74a224ae6e7abae3e5c6660f102255ab890119b571fed634fe2ca0e35954a8
6
+ metadata.gz: 1804a401ce8f0c2a95bd87b652e06f8bbdd7982f22989ba615938b831a8a3bf19a08f2a7d4702b985e66c650cff930766cdc5d3d5081d0e6a205f9056f34e39b
7
+ data.tar.gz: 5f98f9999120a4bc6d2529f01770c5f87d35bded515f63514b162a153b1c089d712e9d86bbb4610d4c956229e2a961173cf6c5fdcf1475d3508b5a104f429a6b
data/bin/rtfm CHANGED
@@ -18,7 +18,7 @@
18
18
  # get a great understanding of the code itself by simply sending
19
19
  # or pasting this whole file into you favorite AI for coding with
20
20
  # a prompt like this: "Help me understand every part of this code".
21
- @version = '6.0.10' # Fixed filename escaping for PDF preview and GUI applications with special characters
21
+ @version = '6.0.11' # Added SVG file preview support with ImageMagick conversion
22
22
 
23
23
  # SAVE & STORE TERMINAL {{{1
24
24
  ORIG_STTY = `stty -g`.chomp
@@ -822,11 +822,11 @@ preview_specs = {
822
822
  'xls' => "xls2csv @s 2>/dev/null",
823
823
  'ppt' => "catppt @s 2>/dev/null",
824
824
  # images ⇒ nil => call showimage
825
- 'png, jpg, jpeg, bmp, gif, webp, tif, tiff' => nil,
825
+ 'png, jpg, jpeg, bmp, gif, webp, tif, tiff, svg' => nil,
826
826
  # video ⇒ nil, but detected via pattern below
827
827
  'mpg, mpeg, avi, mov, mkv, mp4' => nil
828
828
  }
829
- @imagefile ||= /\.(?:png|jpe?g|bmp|gif|webp|tiff?)$/i
829
+ @imagefile ||= /\.(?:png|jpe?g|bmp|gif|webp|tiff?|svg)$/i
830
830
  @pdffile ||= /\.pdf$/i
831
831
  # rubocop:enable Style/StringLiterals
832
832
 
@@ -5178,6 +5178,49 @@ def showcontent # SHOW CONTENTS IN THE RIGHT WINDOW {{{2
5178
5178
  end
5179
5179
  elsif pattern # Nil template → image or video
5180
5180
  case @selected
5181
+ when /\.svg$/i
5182
+ # Convert SVG to PNG for display
5183
+ begin
5184
+ file_size = File.size(@selected)
5185
+ if file_size > 50_000_000 # 50MB limit for images
5186
+ @pR.say("SVG too large for preview (#{(file_size / 1024.0 / 1024.0).round(1)}MB > 50MB limit)")
5187
+ else
5188
+ tn = '/tmp/rtfm_svg_preview.png'
5189
+ # Try direct conversion first
5190
+ if system("convert #{Shellwords.escape(@selected)} #{Shellwords.escape(tn)} 2>/dev/null")
5191
+ showimage(tn)
5192
+ @image = true
5193
+ else
5194
+ # If direct conversion fails, try fixing XML entities and retry
5195
+ temp_svg = '/tmp/rtfm_svg_fixed.svg'
5196
+ begin
5197
+ content = File.read(@selected, encoding: 'UTF-8')
5198
+ # Fix common XML entity issues (replace unescaped ampersands)
5199
+ # First escape all &, then restore valid entities
5200
+ fixed_content = content.gsub('&', '&')
5201
+ .gsub('&', '&')
5202
+ .gsub('<', '<')
5203
+ .gsub('>', '>')
5204
+ .gsub('"', '"')
5205
+ .gsub(''', ''')
5206
+ .gsub(/&#(\d+);/, '&#\1;')
5207
+ .gsub(/&#x([0-9a-fA-F]+);/, '&#x\1;')
5208
+ File.write(temp_svg, fixed_content)
5209
+
5210
+ if system("convert #{Shellwords.escape(temp_svg)} #{Shellwords.escape(tn)} 2>/dev/null")
5211
+ showimage(tn)
5212
+ @image = true
5213
+ else
5214
+ @pR.say("Error converting SVG to PNG for preview")
5215
+ end
5216
+ ensure
5217
+ File.delete(temp_svg) if File.exist?(temp_svg)
5218
+ end
5219
+ end
5220
+ end
5221
+ rescue => e
5222
+ @pR.say("Error processing SVG: #{e}")
5223
+ end
5181
5224
  when /\.(?:png|jpe?g|bmp|gif|webp|tiff?)$/i
5182
5225
  # Allow larger image files up to 50MB
5183
5226
  begin
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rtfm-filemanager
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.0.10
4
+ version: 6.0.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Geir Isene
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-07-24 00:00:00.000000000 Z
11
+ date: 2025-08-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rcurses
@@ -53,7 +53,7 @@ dependencies:
53
53
  - !ruby/object:Gem::Version
54
54
  version: '7.4'
55
55
  description: |-
56
- RTFM v6.0.10: Fixed filename escaping for PDF preview and GUI applications with special characters (spaces, parentheses, apostrophes).
56
+ RTFM v6.0.11: Added SVG file preview support with ImageMagick conversion to PNG for display.
57
57
  A full featured terminal browser with syntax highlighted files, images shown in the terminal, videos thumbnailed, etc. Features include remote SSH/SFTP browsing, interactive SSH shell, comprehensive undo system, bookmarks, and much more. You can bookmark and jump around easily, delete, rename, copy, symlink and move files. RTFM is one of the most feature-packed terminal file managers.
58
58
  email: g@isene.com
59
59
  executables: