cafe_buy_duo 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_duo.rb +46 -8
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 385bc3207c8c11406b1a4334217f61a88631a28085a923a52fa8b17adb665257
4
- data.tar.gz: c582a195fb18bed9a08b9cb0c7e2c109292e6341bf209974d412965d6ae90b99
3
+ metadata.gz: 3e3fa15289ffaa9e4d4a8e63f5265686f3140e018031382cf339e18aca728701
4
+ data.tar.gz: 71c0e1f53c2ad1ea7dd7dbf6d303065b820bfa2200d702a6e4e229974f5403d9
5
5
  SHA512:
6
- metadata.gz: d9126d46589500b7ebf21dcb59117cde07a547ffdba727d7973588f762562807f5672c9ef0c3a1053dddbce1013f77bf2b6b93c000f57fd64db5148d9c77300b
7
- data.tar.gz: 949882637008bafc25eaa2841c22bf95f8287b038e1b7244ac6ed74d646ec17c97069aa956ce568c3570474fd2c8fd00fa8f99d449e4bf1eef7316654ea86a93
6
+ metadata.gz: 3a2485806831d6e4b6c22a4bd4afd8875c88d33a386854adbf509c46b4c03e9817fb5f55cd8b819f75e9aad41bce307c5d37930bc19c226edc3258caae38375b
7
+ data.tar.gz: dea6ecf9bbd2dff434404cb0716ac613e681c6cfd020d909775a7a41bec335e91b1b86708f162d288f3d428403feee33b176bb1ef3377f29fdc2c46c27f1ccb0
data/lib/cafe_buy_duo.rb CHANGED
@@ -4006,15 +4006,34 @@ class Wordpress
4006
4006
  # title = content.split("\n")[0]
4007
4007
  #end
4008
4008
  if @data['포스트설정']['내용첫줄제목에입력'].checked?
4009
- # 콘텐츠를 줄 단위로 분리
4010
4009
  content_lines = content.split("\n")
4011
-
4012
- # 번째 줄이 <img src=로 시작하는지 확인하고, 시작하는 경우 두 번째 줄부터 확인
4013
- title = content_lines.find { |line| !line.start_with?('<img src=') }
4014
-
4015
- # 만약 첫 번째 줄부터 <img src=로 시작하는 경우, 두 번째 줄을 제목으로 설정
4016
- title ||= content_lines[1] # 첫 번째 줄이 <img src=일 경우 두 번째 줄을 사용
4017
-
4010
+
4011
+ title = content_lines.find do |line|
4012
+ line = line.strip
4013
+ !line.empty? && !line.start_with?('<img src=')
4014
+ end
4015
+
4016
+ title ||= content_lines[1]
4017
+
4018
+ if title
4019
+ # 마침표(.) 포함 첫 문장 추출
4020
+ first_part = title[/.*?\./]
4021
+ first_part = first_part ? first_part.strip : title.strip
4022
+
4023
+ # 200bytes 제한 (한글 100자 내외)
4024
+ bytes_limit = 200
4025
+ truncated = ""
4026
+ current_bytes = 0
4027
+
4028
+ first_part.each_char do |char|
4029
+ char_bytes = char.bytesize
4030
+ break if current_bytes + char_bytes > bytes_limit
4031
+ truncated << char
4032
+ current_bytes += char_bytes
4033
+ end
4034
+
4035
+ title = truncated
4036
+ end
4018
4037
  end
4019
4038
 
4020
4039
  if @data['포스트설정']['제목을내용첫줄입력'].checked?
@@ -4038,6 +4057,25 @@ class Wordpress
4038
4057
  @data['table'] << []
4039
4058
  @data['table'].pop
4040
4059
 
4060
+ # content를 줄 단위로 쪼갬
4061
+ lines = content.lines
4062
+
4063
+ # 맨 앞부터 빈 줄(공백 또는 빈 문자열) 갯수 계산
4064
+ empty_line_count = 0
4065
+ lines.each do |line|
4066
+ if line.strip.empty?
4067
+ empty_line_count += 1
4068
+ else
4069
+ break
4070
+ end
4071
+ end
4072
+
4073
+ # 앞 빈 줄 제거
4074
+ lines = lines.drop(empty_line_count)
4075
+
4076
+ # 다시 content로 합침
4077
+ content = lines.join
4078
+
4041
4079
  p option
4042
4080
 
4043
4081
  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_duo
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