terminal-table 4.0.0 → 4.1.0

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: d9db4bcea8ed79e15e8d0a0ec33cb35f757d72fe9e90777e5f52114ac12dd913
4
- data.tar.gz: 8168380a0569095ec2674df9e8e87ae99a4d377b43e1d24ac97ca7cd3a42c765
3
+ metadata.gz: 23b2fe8f55fdd00991734825bacbd04e7f395bfa5e2b61a31b666ccaa1c20560
4
+ data.tar.gz: efae59fa00957cd275e6b4a40080cc67c5cb8e1e0b833bb18792d1446d71da72
5
5
  SHA512:
6
- metadata.gz: e1a8408364ea76d142015a37009a606d4e9daa49b225fabe1a3e7133eee0e266d44c3f538fce149586af4bbbefc3e6afcdee64cb49dc5cbf8e6f7cc2471d5663
7
- data.tar.gz: ae686076af61387d41592db7289fc39dde785f614bd840841a3950cca024402ebb59b20ce04bb7098f9c09349e1c042672fb051e7daaeb19be33504c1ad9791c
6
+ metadata.gz: b81e47bb78032cee966b1c13f7bd9db291056ce71089302c757ff47be66dcd2ca17c73da4e3924ed2b0a450ae6c5e7b90a88ba71bc3d4ba27e684d9198b114ce
7
+ data.tar.gz: d30603ac110f6d9245ed43123284904568387cdd4917adc5c037d95198894192cc73dbb030a120d375a763a4b1d2896acba908e6a9c5c5f4d7ddca5d225a4048
@@ -17,7 +17,7 @@ jobs:
17
17
  runs-on: ${{ matrix.os }}-latest
18
18
 
19
19
  steps:
20
- - uses: actions/checkout@v4
20
+ - uses: actions/checkout@v7
21
21
 
22
22
  - uses: ruby/setup-ruby@v1
23
23
  with:
data/History.rdoc CHANGED
@@ -1,3 +1,11 @@
1
+ 4.1.0 / 2026-12-01
2
+ ==================
3
+
4
+ - Add `border: :none` style to render a table without any borders.
5
+ - Apply margin_left to every line of multiline cells.
6
+ - Ignore OSC 8 hyperlinks when calculating cell width.
7
+ - Split a cell's value into lines only once.
8
+
1
9
  4.0.0 / 2025-01-28
2
10
  ==================
3
11
 
data/README.md CHANGED
@@ -320,6 +320,12 @@ Ascii borders are default, but can be explicitly set with:
320
320
  table.style = { :border => :ascii }
321
321
  ```
322
322
 
323
+ ### No Borders
324
+ To remove all borders and separators:
325
+ ```
326
+ table.style = { :border => :none }
327
+ ```
328
+
323
329
  ### Customizing Borders
324
330
  Inside the `UnicodeBorder` class, there are definitions for a variety of corner/intersection and divider types.
325
331
 
@@ -48,7 +48,7 @@ module Terminal
48
48
  val.public_send(positions[position], length)
49
49
  end
50
50
  def lines
51
- @value.to_s.encode("utf-8", invalid: :replace).split(/\n/)
51
+ @lines ||= @value.to_s.encode("utf-8", invalid: :replace).split(/\n/)
52
52
  end
53
53
 
54
54
  ##
@@ -68,6 +68,14 @@ module Terminal
68
68
  end
69
69
  end
70
70
 
71
+ class NoneBorder < AsciiBorder
72
+ def initialize
73
+ super
74
+ @top, @bottom, @left, @right = false, false, false, false
75
+ @data = { x: "", y: "", i: "" }
76
+ end
77
+ end
78
+
71
79
  class UnicodeBorder < Border
72
80
 
73
81
  ALLOWED_SEPARATOR_BORDER_STYLES = %i[
@@ -170,7 +170,9 @@ module Terminal
170
170
 
171
171
  def render
172
172
  elaborate_rows unless @elaborated
173
- @rows.map { |r| style.margin_left + r.render.rstrip }.join("\n")
173
+ rows = @rows
174
+ rows = rows.reject { |r| r.is_a?(Separator) && r.implicit } if style.border.is_a?(NoneBorder)
175
+ rows.map { |r| style.margin_left + r.render.rstrip.gsub(/[ \t]*\n/) { "\n" + style.margin_left } }.join("\n")
174
176
  end
175
177
  alias :to_s :render
176
178
 
@@ -1,10 +1,11 @@
1
1
  module Terminal
2
2
  class Table
3
3
  module Util
4
- # removes all ANSI escape sequences (e.g. color)
4
+ # removes all ANSI escape sequences (e.g. color, OSC 8 hyperlinks)
5
5
  def ansi_escape(line)
6
6
  line.to_s.gsub(/\x1b(\[|\(|\))[;?0-9]*[0-9A-Za-z]/, '').
7
7
  gsub(/\x1b(\[|\(|\))[;?0-9]*[0-9A-Za-z]/, '').
8
+ gsub(/\x1b\]8;[^\x07\x1b]*(?:\x07|\x1b\\)/, '').
8
9
  gsub(/(\x03|\x1a)/, '')
9
10
  end
10
11
  module_function :ansi_escape
@@ -1,5 +1,5 @@
1
1
  module Terminal
2
2
  class Table
3
- VERSION = '4.0.0'
3
+ VERSION = '4.1.0'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: terminal-table
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.0
4
+ version: 4.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - TJ Holowaychuk
8
8
  - Scott J. Goldman
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-01-27 00:00:00.000000000 Z
11
+ date: 1980-01-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -140,7 +140,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
140
140
  - !ruby/object:Gem::Version
141
141
  version: '0'
142
142
  requirements: []
143
- rubygems_version: 3.6.2
143
+ rubygems_version: 4.0.20
144
144
  specification_version: 4
145
145
  summary: Simple, feature rich ascii table generation library
146
146
  test_files: []