cafe_buy 0.1.53 → 0.1.55

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/cafe_buy.rb +46 -8
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 377206e549689ca46032b752398b86bddfdb202779e465a904faaf90045c5ab6
4
- data.tar.gz: a59c83c0b4ab6966c9c039caa7eb5aa82834bd85a95518e9b1ee637a2418882f
3
+ metadata.gz: 1b14e8e371491f2be06f04ae67f13dd328dd42a46cc83e79d8690fca5e64009e
4
+ data.tar.gz: 5308a6bd4f2834e52cec5ed8c49cc441b6f7907f34e3a157ebbf09bd3e0d44e6
5
5
  SHA512:
6
- metadata.gz: b37d8f1d406ec35b5ae6dd9cf68b4d757c43f2297921c36aedafdda45a8d6fc478cc557afdfe16a970f54948162b6a6ddc0d9913609c349223ce466de2d859a1
7
- data.tar.gz: 0a66c5866111aaad5471e8e024662a1d3d881496691a86b71c86d2589849f69f1f03d98626b13697b575a54e68294d54c914bf996cb6f7698cd8134ec3608022
6
+ metadata.gz: 9231706e9259d4d1c333cc6458ac55add55aaa90b03d85e7c736e32cc785544fbe8ffb00e22085bdf64b4e69dd900ae6382fb1559da82df608acb5910aa3ccfa
7
+ data.tar.gz: 30a6be435830890e10b4d59f8789bb5792ae5b42b161575af231ca1f4899b4fc127db69ae5f27756360948bc1383c1743a03ad0daecd159d5ae751f1717b3938
data/lib/cafe_buy.rb CHANGED
@@ -3938,15 +3938,34 @@ class Wordpress
3938
3938
  # title = content.split("\n")[0]
3939
3939
  #end
3940
3940
  if @data['포스트설정']['내용첫줄제목에입력'].checked?
3941
- # 콘텐츠를 줄 단위로 분리
3942
3941
  content_lines = content.split("\n")
3943
-
3944
- # 번째 줄이 <img src=로 시작하는지 확인하고, 시작하는 경우 두 번째 줄부터 확인
3945
- title = content_lines.find { |line| !line.start_with?('<img src=') }
3946
-
3947
- # 만약 첫 번째 줄부터 <img src=로 시작하는 경우, 두 번째 줄을 제목으로 설정
3948
- title ||= content_lines[1] # 첫 번째 줄이 <img src=일 경우 두 번째 줄을 사용
3949
-
3942
+
3943
+ title = content_lines.find do |line|
3944
+ line = line.strip
3945
+ !line.empty? && !line.start_with?('<img src=')
3946
+ end
3947
+
3948
+ title ||= content_lines[1]
3949
+
3950
+ if title
3951
+ # 마침표(.) 포함 첫 문장 추출
3952
+ first_part = title[/.*?\./]
3953
+ first_part = first_part ? first_part.strip : title.strip
3954
+
3955
+ # 200bytes 제한 (한글 100자 내외)
3956
+ bytes_limit = 200
3957
+ truncated = ""
3958
+ current_bytes = 0
3959
+
3960
+ first_part.each_char do |char|
3961
+ char_bytes = char.bytesize
3962
+ break if current_bytes + char_bytes > bytes_limit
3963
+ truncated << char
3964
+ current_bytes += char_bytes
3965
+ end
3966
+
3967
+ title = truncated
3968
+ end
3950
3969
  end
3951
3970
 
3952
3971
  if @data['포스트설정']['제목을내용첫줄입력'].checked?
@@ -3970,6 +3989,25 @@ class Wordpress
3970
3989
  @data['table'] << []
3971
3990
  @data['table'].pop
3972
3991
 
3992
+ # content를 줄 단위로 쪼갬
3993
+ lines = content.lines
3994
+
3995
+ # 맨 앞부터 빈 줄(공백 또는 빈 문자열) 갯수 계산
3996
+ empty_line_count = 0
3997
+ lines.each do |line|
3998
+ if line.strip.empty?
3999
+ empty_line_count += 1
4000
+ else
4001
+ break
4002
+ end
4003
+ end
4004
+
4005
+ # 앞 빈 줄 제거
4006
+ lines = lines.drop(empty_line_count)
4007
+
4008
+ # 다시 content로 합침
4009
+ content = lines.join
4010
+
3973
4011
  p option
3974
4012
 
3975
4013
  dd_time = @data['table'][index][9].to_s.force_encoding('utf-8').to_i
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cafe_buy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.53
4
+ version: 0.1.55
5
5
  platform: ruby
6
6
  authors:
7
7
  - zon
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 2025-06-26 00:00:00.000000000 Z
10
+ date: 2025-07-02 00:00:00.000000000 Z
11
11
  dependencies: []
12
12
  description: File to Clipboard gem
13
13
  email: mymin26@naver.com