streamd 0.1.2 → 0.1.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 +4 -4
- data/lib/streamd/version.rb +2 -2
- data/lib/streamd.rb +17 -6
- metadata +3 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 25a907b94c4d5bc5c28062160e1fb8967d88d4dc798e1f4c8eaf06df48031288
|
|
4
|
+
data.tar.gz: d8017f6a892f0a61d5d3430d25c91e0a9df3b2ed4741c84c1aafa0cebee44f3b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 5bd48d7ed57f1c808e4074d3d27679242f05fec87d50160e85d810ed1eaabe3a66bec4f8d86bdc4af64d10f25f704a4874baa1e5685ed3512da8b3380a629af0
|
|
7
|
+
data.tar.gz: 1e85ec7551214fa870569e6566e1fcf9f49b41bc5fd9fd2569563951ed5b457f14bf6fd368ec9bf78b93944a563b73341458cd8f2511005bbfbb50249998a4ae
|
data/lib/streamd/version.rb
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
module Streamd
|
|
2
|
-
VERSION = "0.1.
|
|
3
|
-
end
|
|
2
|
+
VERSION = "0.1.3"
|
|
3
|
+
end
|
data/lib/streamd.rb
CHANGED
|
@@ -14,8 +14,18 @@ module Streamd
|
|
|
14
14
|
curr = ""
|
|
15
15
|
chunk.each_char do |char|
|
|
16
16
|
whole << char
|
|
17
|
-
if whole =~ /\n
|
|
18
|
-
in_code_block =
|
|
17
|
+
if whole =~ /\n[\s\t]*`{3}\w*\n\z/
|
|
18
|
+
in_code_block = whole.scan(/\n[\s\t]*`{3}\w*\n/).size.odd?
|
|
19
|
+
curr << char
|
|
20
|
+
if in_code_block
|
|
21
|
+
code_sign = curr.index(/[\s\t]*`{3}\w*\n\z/)
|
|
22
|
+
e << [curr[0...code_sign], true]
|
|
23
|
+
curr = curr[code_sign..-1]
|
|
24
|
+
else
|
|
25
|
+
e << [curr, true]
|
|
26
|
+
curr = ""
|
|
27
|
+
end
|
|
28
|
+
next
|
|
19
29
|
end
|
|
20
30
|
if whole =~ /\n[\n\s\t]*\n[^\n]\z/ && !in_code_block
|
|
21
31
|
e << [curr, true]
|
|
@@ -32,6 +42,8 @@ module Streamd
|
|
|
32
42
|
current = ""
|
|
33
43
|
enum.each do |chunk, neo|
|
|
34
44
|
current << chunk
|
|
45
|
+
next if current.strip.empty?
|
|
46
|
+
|
|
35
47
|
styled =
|
|
36
48
|
if current =~ /^\|/
|
|
37
49
|
renderer.render(current)
|
|
@@ -41,7 +53,7 @@ module Streamd
|
|
|
41
53
|
|
|
42
54
|
styled =
|
|
43
55
|
case
|
|
44
|
-
when current =~ /\A
|
|
56
|
+
when current =~ /\A[\s\t]*`{3}/
|
|
45
57
|
" " + styled.gsub(/\A[\s\n]*(\e\[[0-9;]*m[\s\n]*\e\[0m[\s\n]*)+/m, '').gsub(/(\e\[[0-9;]*m[\s\n]*\e\[0m[\s\n]*)+[\s\n]*\Z/m, '').strip
|
|
46
58
|
when current =~ /\A\*\*\*/ || current =~ /\A---/ || current =~ /\A___/
|
|
47
59
|
styled.gsub(/\e\[[0-9;]*m[\s\n]*\e\[0m/m, '').strip
|
|
@@ -51,13 +63,12 @@ module Streamd
|
|
|
51
63
|
" " + styled.gsub(/\e\[[0-9;]*m[\s\n]*\e\[0m/m, '').strip
|
|
52
64
|
end
|
|
53
65
|
|
|
54
|
-
|
|
55
|
-
# File.open("/tmp/streamd.#{name}.txt", 'w'){|f| f.puts styled}
|
|
66
|
+
# File.open("/tmp/streamd.current.#{name}.txt", 'w'){|f| f.puts current}
|
|
56
67
|
live.update(styled)
|
|
57
68
|
if neo
|
|
58
69
|
# name += 1
|
|
59
70
|
puts "\n\n"
|
|
60
|
-
live = TTY::Live.new
|
|
71
|
+
live = TTY::Live.new
|
|
61
72
|
current.clear
|
|
62
73
|
end
|
|
63
74
|
end
|
metadata
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: streamd
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- c
|
|
8
8
|
bindir: exe
|
|
9
9
|
cert_chain: []
|
|
10
|
-
date:
|
|
10
|
+
date: 2026-03-14 00:00:00.000000000 Z
|
|
11
11
|
dependencies:
|
|
12
12
|
- !ruby/object:Gem::Dependency
|
|
13
13
|
name: glamour
|
|
@@ -96,7 +96,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
96
96
|
- !ruby/object:Gem::Version
|
|
97
97
|
version: '0'
|
|
98
98
|
requirements: []
|
|
99
|
-
rubygems_version: 3.6.
|
|
99
|
+
rubygems_version: 3.6.3
|
|
100
100
|
specification_version: 4
|
|
101
101
|
summary: Render markdown is stream
|
|
102
102
|
test_files: []
|