cafe_basics_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_basics_duo.rb +46 -8
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6b868b13d28d76acb532714d33421cd445eb6b369b1a369a80c3711f26fb995a
4
- data.tar.gz: b4b5777cb76884c022ed55c6ab9c16a34b84e9a61db13923a1fd94da9ed1e50e
3
+ metadata.gz: 254da32d83fd097f8d5ae9e26d4c3c306c4afbfbbe37f6e57a8529a577cf202f
4
+ data.tar.gz: c6d2b84d4404ed78ab26a0e5e892d5b45422c94876223d85e2fdfde8dd9749cb
5
5
  SHA512:
6
- metadata.gz: 4b60c2de99e80f65a1b9bb4b0fc231c9c7ee0fb3fb5d81d5fdb20524391a047e6003bb188924aec1614c76936e6aa8941b31d5e2609e60c7eaff1160df4b0812
7
- data.tar.gz: 4caf5a67d2c104a676c40e5c41dedef98c3aabcd276d8f3f36fc9ecc10d9328516caebbe998725d5a3394541aca32877638c44bf73f44d443e5693e71d8d459d
6
+ metadata.gz: 22a2b190f6907f9030b9ba07d68297b2c56725b9f42c65273479ba47765e96adc4ce8789306f5bc493c4b90fe51dc4cabe84524a573df4aad294f5b01a26e0cc
7
+ data.tar.gz: df99d99bcf10e80010526e0e0a0fb3abe361930114f17af054c30cf7dbdbdd04d971952d0eb4204d38a28de77e4ac1023e5d3cda4a316dbbf6342f13d8867b59
@@ -3621,15 +3621,34 @@ class Wordpress
3621
3621
  # title = content.split("\n")[0]
3622
3622
  #end
3623
3623
  if @data['포스트설정']['내용첫줄제목에입력'].checked?
3624
- # 콘텐츠를 줄 단위로 분리
3625
3624
  content_lines = content.split("\n")
3626
-
3627
- # 번째 줄이 <img src=로 시작하는지 확인하고, 시작하는 경우 두 번째 줄부터 확인
3628
- title = content_lines.find { |line| !line.start_with?('<img src=') }
3629
-
3630
- # 만약 첫 번째 줄부터 <img src=로 시작하는 경우, 두 번째 줄을 제목으로 설정
3631
- title ||= content_lines[1] # 첫 번째 줄이 <img src=일 경우 두 번째 줄을 사용
3632
-
3625
+
3626
+ title = content_lines.find do |line|
3627
+ line = line.strip
3628
+ !line.empty? && !line.start_with?('<img src=')
3629
+ end
3630
+
3631
+ title ||= content_lines[1]
3632
+
3633
+ if title
3634
+ # 마침표(.) 포함 첫 문장 추출
3635
+ first_part = title[/.*?\./]
3636
+ first_part = first_part ? first_part.strip : title.strip
3637
+
3638
+ # 200bytes 제한 (한글 100자 내외)
3639
+ bytes_limit = 200
3640
+ truncated = ""
3641
+ current_bytes = 0
3642
+
3643
+ first_part.each_char do |char|
3644
+ char_bytes = char.bytesize
3645
+ break if current_bytes + char_bytes > bytes_limit
3646
+ truncated << char
3647
+ current_bytes += char_bytes
3648
+ end
3649
+
3650
+ title = truncated
3651
+ end
3633
3652
  end
3634
3653
 
3635
3654
  if @data['포스트설정']['제목을내용첫줄입력'].checked?
@@ -3653,6 +3672,25 @@ class Wordpress
3653
3672
  @data['table'] << []
3654
3673
  @data['table'].pop
3655
3674
 
3675
+ # content를 줄 단위로 쪼갬
3676
+ lines = content.lines
3677
+
3678
+ # 맨 앞부터 빈 줄(공백 또는 빈 문자열) 갯수 계산
3679
+ empty_line_count = 0
3680
+ lines.each do |line|
3681
+ if line.strip.empty?
3682
+ empty_line_count += 1
3683
+ else
3684
+ break
3685
+ end
3686
+ end
3687
+
3688
+ # 앞 빈 줄 제거
3689
+ lines = lines.drop(empty_line_count)
3690
+
3691
+ # 다시 content로 합침
3692
+ content = lines.join
3693
+
3656
3694
  p option
3657
3695
 
3658
3696
  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_basics_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