nblog_duo 111.120.002 → 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.
- checksums.yaml +4 -4
- data/lib/nblog_duo.rb +62 -20
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 76def0a49a36e9251c9be08af5f3843cd22d35f2c7a27d0e0fa837194db92236
|
4
|
+
data.tar.gz: bf3f94327a2caf50bcb23db5d8e0cb716fab3de4cf3353b0099eff415cf77881
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f30e1f0db3dcc850b995fb23c2ef46b74ebea34b46bccf1e3fed174a87e5ce47b93e2a70adda736aeaa8312401f5415b8272c95db8b338625f303978b52a6850
|
7
|
+
data.tar.gz: 2c709f923361390f2391b1b5668370ba5e44d5532232d5c2aa1b21e11287affb7bf13cb5250942b8b5010cd35cef12cd86ed5e014d55a64dd53f9e4964f0b65b
|
data/lib/nblog_duo.rb
CHANGED
@@ -2317,20 +2317,24 @@ class Wordpress
|
|
2317
2317
|
width = img.columns
|
2318
2318
|
height = img.rows
|
2319
2319
|
|
2320
|
+
if height > width
|
2321
|
+
min_height = (width * min_crop_ratio).to_i
|
2322
|
+
new_height = rand(min_height..width)
|
2323
|
+
crop_top = ((height - new_height) / 2.0).round
|
2320
2324
|
|
2325
|
+
cropped = img.crop(0, crop_top, width, new_height, true)
|
2321
2326
|
|
2322
|
-
|
2323
|
-
|
2324
|
-
|
2325
|
-
|
2326
|
-
|
2327
|
-
|
2328
|
-
|
2329
|
-
|
2330
|
-
|
2331
|
-
|
2332
|
-
|
2333
|
-
end
|
2327
|
+
retries = 0
|
2328
|
+
begin
|
2329
|
+
cropped.write(path)
|
2330
|
+
rescue => e
|
2331
|
+
retries += 1
|
2332
|
+
puts "이미지 저장 오류 (#{e.message}), 재시도 #{retries}/5"
|
2333
|
+
sleep(1)
|
2334
|
+
retry if retries < 5
|
2335
|
+
raise "이미지 저장 실패: #{e.message}"
|
2336
|
+
end
|
2337
|
+
end
|
2334
2338
|
end
|
2335
2339
|
|
2336
2340
|
def auto_image(keyword = nil)
|
@@ -3947,15 +3951,34 @@ class Wordpress
|
|
3947
3951
|
# title = content.split("\n")[0]
|
3948
3952
|
#end
|
3949
3953
|
if @data['포스트설정']['내용첫줄제목에입력'].checked?
|
3950
|
-
# 콘텐츠를 줄 단위로 분리
|
3951
3954
|
content_lines = content.split("\n")
|
3952
|
-
|
3953
|
-
|
3954
|
-
|
3955
|
-
|
3956
|
-
|
3957
|
-
|
3958
|
-
|
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
|
3959
3982
|
end
|
3960
3983
|
|
3961
3984
|
if @data['포스트설정']['제목을내용첫줄입력'].checked?
|
@@ -3988,6 +4011,25 @@ class Wordpress
|
|
3988
4011
|
@data['table'] << []
|
3989
4012
|
@data['table'].pop
|
3990
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
|
+
|
3991
4033
|
dd_time = @data['table'][index][10].to_s.force_encoding('utf-8').to_i
|
3992
4034
|
#template_no = @data['table'][index][7].to_s.force_encoding('utf-8').to_i
|
3993
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.
|
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-
|
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
|