nblog_duo 111.120.003 → 111.120.005

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/nblog_duo.rb +46 -8
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 86ab7a8651d203747ab15ea4cca81b769adfec5c0e7c0cc10636b14a8daea03a
4
- data.tar.gz: 0df26f49762720cdc20d17b8d4943539db9aa51b31161c6fc0268bdee600f6d6
3
+ metadata.gz: 76def0a49a36e9251c9be08af5f3843cd22d35f2c7a27d0e0fa837194db92236
4
+ data.tar.gz: bf3f94327a2caf50bcb23db5d8e0cb716fab3de4cf3353b0099eff415cf77881
5
5
  SHA512:
6
- metadata.gz: 553ce970ce17140182002e176f8eaa14a2d9e426dc5fdd9bd003ae9f749088a08b318092fcf1b51c69e142d57491927f8213755819dee32970cf770b81c2284a
7
- data.tar.gz: 65ad848b5e5e2a90cc97502afa5f5186463e9b6028c380e6191a3ccea8a44be9cd1ffd2bb9dc2c1e03ff3e70669a2f9eaaae033e8239902bed9e186759b6bd83
6
+ metadata.gz: f30e1f0db3dcc850b995fb23c2ef46b74ebea34b46bccf1e3fed174a87e5ce47b93e2a70adda736aeaa8312401f5415b8272c95db8b338625f303978b52a6850
7
+ data.tar.gz: 2c709f923361390f2391b1b5668370ba5e44d5532232d5c2aa1b21e11287affb7bf13cb5250942b8b5010cd35cef12cd86ed5e014d55a64dd53f9e4964f0b65b
data/lib/nblog_duo.rb CHANGED
@@ -3951,15 +3951,34 @@ class Wordpress
3951
3951
  # title = content.split("\n")[0]
3952
3952
  #end
3953
3953
  if @data['포스트설정']['내용첫줄제목에입력'].checked?
3954
- # 콘텐츠를 줄 단위로 분리
3955
3954
  content_lines = content.split("\n")
3956
-
3957
- # 번째 줄이 <img src=로 시작하는지 확인하고, 시작하는 경우 두 번째 줄부터 확인
3958
- title = content_lines.find { |line| !line.start_with?('<img src=') }
3959
-
3960
- # 만약 첫 번째 줄부터 <img src=로 시작하는 경우, 두 번째 줄을 제목으로 설정
3961
- title ||= content_lines[1] # 첫 번째 줄이 <img src=일 경우 두 번째 줄을 사용
3962
-
3955
+
3956
+ title = content_lines.find do |line|
3957
+ line = line.strip
3958
+ !line.empty? && !line.start_with?('<img src=')
3959
+ end
3960
+
3961
+ title ||= content_lines[1]
3962
+
3963
+ if title
3964
+ # 마침표(.) 포함 첫 문장 추출
3965
+ first_part = title[/.*?\./]
3966
+ first_part = first_part ? first_part.strip : title.strip
3967
+
3968
+ # 200bytes 제한 (한글 100자 내외)
3969
+ bytes_limit = 200
3970
+ truncated = ""
3971
+ current_bytes = 0
3972
+
3973
+ first_part.each_char do |char|
3974
+ char_bytes = char.bytesize
3975
+ break if current_bytes + char_bytes > bytes_limit
3976
+ truncated << char
3977
+ current_bytes += char_bytes
3978
+ end
3979
+
3980
+ title = truncated
3981
+ end
3963
3982
  end
3964
3983
 
3965
3984
  if @data['포스트설정']['제목을내용첫줄입력'].checked?
@@ -3992,6 +4011,25 @@ class Wordpress
3992
4011
  @data['table'] << []
3993
4012
  @data['table'].pop
3994
4013
 
4014
+ # content를 줄 단위로 쪼갬
4015
+ lines = content.lines
4016
+
4017
+ # 맨 앞부터 빈 줄(공백 또는 빈 문자열) 갯수 계산
4018
+ empty_line_count = 0
4019
+ lines.each do |line|
4020
+ if line.strip.empty?
4021
+ empty_line_count += 1
4022
+ else
4023
+ break
4024
+ end
4025
+ end
4026
+
4027
+ # 앞 빈 줄 제거
4028
+ lines = lines.drop(empty_line_count)
4029
+
4030
+ # 다시 content로 합침
4031
+ content = lines.join
4032
+
3995
4033
  dd_time = @data['table'][index][10].to_s.force_encoding('utf-8').to_i
3996
4034
  #template_no = @data['table'][index][7].to_s.force_encoding('utf-8').to_i
3997
4035
  naver.update(title,content,option,soosick_1,soosick_2, dd_time)
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nblog_duo
3
3
  version: !ruby/object:Gem::Version
4
- version: 111.120.003
4
+ version: 111.120.005
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