tblog_duopack 0.0.3 → 0.0.5
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/tblog_duopack.rb +40 -70
- 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: 67aca1228ea382eedfe5cd4311bba5bac0f58c7086bab65742981b1fd94df259
|
4
|
+
data.tar.gz: 4d9399e4ca2201f9124d730528fad53e94d6ea74e140202e8510a70eb51dcd9e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a5bfde0b177e7c1ec89d2651af06931fd4e54ff71e7f4ee5de1486fcaddea5f90c51945b7ed2c61c80a3d31d253de780a9381e34414c4e0bd3c11717ca01f9f0
|
7
|
+
data.tar.gz: 04b37e0db153e7973c7b480e0affd256418358187bf51f02cfe105a280724d0e2352dc4ab900a053d945e0d829e70ffc906575cf70cb11e07acb45f3125acae2
|
data/lib/tblog_duopack.rb
CHANGED
@@ -2250,104 +2250,74 @@ class Wordpress
|
|
2250
2250
|
end
|
2251
2251
|
|
2252
2252
|
image_thum_ids = Array.new
|
2253
|
-
|
2254
2253
|
image_memory = Array.new
|
2255
|
-
|
2254
|
+
|
2256
2255
|
if @data['포스트설정']['내용사진자동삽입'].checked?
|
2257
2256
|
puts '내용사진자동삽입...'
|
2257
|
+
|
2258
2258
|
sn = @data['포스트설정']['내용사진자동삽입시작숫자'].text.to_s.force_encoding('utf-8').to_i
|
2259
2259
|
en = @data['포스트설정']['내용사진자동삽입끝숫자'].text.to_s.force_encoding('utf-8').to_i
|
2260
|
+
|
2260
2261
|
begin
|
2261
2262
|
cn = rand(sn..en)
|
2262
2263
|
rescue
|
2263
2264
|
cn = 0
|
2264
2265
|
puts 'cn = rand(sn..en) error cn = 1'
|
2265
2266
|
end
|
2266
|
-
|
2267
|
+
|
2267
2268
|
if cn != 0
|
2268
|
-
|
2269
|
-
|
2270
|
-
|
2271
|
-
|
2272
|
-
|
2273
|
-
|
2274
|
-
|
2275
|
-
|
2276
|
-
|
2277
|
-
|
2278
|
-
|
2279
|
-
|
2280
|
-
|
2281
|
-
|
2282
|
-
if @data['포스트설정']['내용과자동생성'].checked? or @data['포스트설정']['gpt키워드'].checked?
|
2283
|
-
content5 = content.split("(자동생성글)")[0].to_s.split("\n")
|
2284
|
-
content55 = content.split("(자동생성글)")[1].to_s
|
2285
|
-
|
2286
|
-
else
|
2287
|
-
content55 = ''
|
2288
|
-
content5 = content.split("(자동생성글)")[0].to_s.split("\n")
|
2289
|
-
end
|
2290
|
-
|
2291
|
-
p content5
|
2292
|
-
puts content55
|
2293
|
-
p position
|
2294
|
-
|
2295
|
-
while true
|
2296
|
-
check11 = 0
|
2297
|
-
for nn in 0..position.length-1
|
2298
|
-
if content5[position[nn]].to_s.include?('style') or content5[position[nn]].to_s.include?('<') or content5[position[nn]].to_s.include?('>')
|
2299
|
-
check11 = 1
|
2300
|
-
position[nn] += 4
|
2301
|
-
end
|
2302
|
-
end
|
2303
|
-
if check11 == 0
|
2304
|
-
break
|
2269
|
+
# 내용 분할 (자동 생성 글과 텍스트)
|
2270
|
+
content5 = content.split("(자동생성글)")[0].to_s.split("\n")
|
2271
|
+
content55 = content.split("(자동생성글)")[1].to_s if @data['포스트설정']['내용과자동생성'].checked? || @data['포스트설정']['gpt키워드'].checked?
|
2272
|
+
|
2273
|
+
# 빈 줄 찾기
|
2274
|
+
empty_positions = content5.each_with_index.select { |line, index| line.strip.empty? }.map { |line, index| index }
|
2275
|
+
|
2276
|
+
# 빈 줄이 부족하면 텍스트 끝에 빈 줄 추가
|
2277
|
+
if empty_positions.length < cn
|
2278
|
+
# 부족한 빈 줄의 수
|
2279
|
+
missing_empty_lines = cn - empty_positions.length
|
2280
|
+
missing_empty_lines.times do
|
2281
|
+
content5 << "" # 텍스트 마지막에 빈 줄 추가
|
2305
2282
|
end
|
2283
|
+
empty_positions = content5.each_with_index.select { |line, index| line.strip.empty? }.map { |line, index| index } # 다시 빈 줄 위치 계산
|
2306
2284
|
end
|
2307
|
-
|
2308
|
-
|
2309
|
-
|
2310
|
-
|
2285
|
+
|
2286
|
+
# 이미지 삽입할 위치를 지정 (빈 줄 위치에 삽입)
|
2287
|
+
position = empty_positions[0..cn-1]
|
2288
|
+
|
2289
|
+
# 이미지 URL 가져오기
|
2290
|
+
if @data['포스트설정']['내용과자동생성'].checked? || @data['포스트설정']['gpt키워드'].checked?
|
2311
2291
|
image_url22 = get_image_file().force_encoding('utf-8')
|
2312
2292
|
end
|
2313
|
-
|
2293
|
+
|
2294
|
+
# 각 위치에 이미지를 하나씩만 삽입
|
2314
2295
|
position.each do |i|
|
2315
2296
|
image_url = get_image_file().force_encoding('utf-8')
|
2316
|
-
puts
|
2317
|
-
|
2318
|
-
|
2297
|
+
puts '사진넣는위치 => ' + i.to_s
|
2298
|
+
|
2299
|
+
# 링크가 있을 경우 링크 포함
|
2319
2300
|
if @data['포스트설정']['내용사진링크'].checked?
|
2320
|
-
image_memory << "
|
2321
|
-
content5
|
2301
|
+
image_memory << "<a href='" + @data['포스트설정']['내용사진링크값'].text.to_s.force_encoding('utf-8') + "'><img src='" + image_url + "' alt='" + keyword.force_encoding('utf-8') + "'></a>"
|
2302
|
+
content5[i] = '**image**' # 빈 줄에 이미지를 삽입
|
2322
2303
|
else
|
2323
|
-
image_memory << "
|
2324
|
-
content5
|
2304
|
+
image_memory << "<img src='" + image_url + "' alt='" + keyword + "' class='aligncenter size-full'>"
|
2305
|
+
content5[i] = '**image**' # 빈 줄에 이미지를 삽입
|
2325
2306
|
end
|
2326
2307
|
end
|
2327
|
-
|
2328
|
-
|
2329
|
-
|
2330
|
-
|
2331
|
-
# content = iconv.iconv(content)
|
2332
|
-
# content = content.encode('UTF-8', 'binary', invalid: :replace, replace: '')
|
2333
|
-
puts content
|
2334
|
-
image_url = image_url22
|
2335
|
-
|
2336
|
-
# if @data['포스트설정']['자동글 수식에 입력'].checked?
|
2337
|
-
|
2338
|
-
# else
|
2339
|
-
# if @data['포스트설정']['내용사진링크'].checked?
|
2340
|
-
# content = content.split('(자동생성글)')[0]+""+'<a href="'+@data['포스트설정']['내용사진링크값'].text.to_s.force_encoding('utf-8')+'"><img src="'+image_url+'" alt="'+keyword+'"></a>'+""+'(자동생성글)'+content.split('(자동생성글)')[1]
|
2341
|
-
# else
|
2342
|
-
# content = content.split('(자동생성글)')[0]+""+'<img src="'+image_url+'" alt="'+keyword+'" >'+""+'(자동생성글)'+content.split('(자동생성글)')[1]
|
2343
|
-
# end
|
2344
|
-
# end
|
2308
|
+
|
2309
|
+
# 자동 생성된 내용과 합치기
|
2310
|
+
if @data['포스트설정']['내용과자동생성'].checked? || @data['포스트설정']['gpt키워드'].checked?
|
2311
|
+
content = content5.join("\n") + '(자동생성글)' + content55
|
2345
2312
|
else
|
2346
2313
|
content = content5.join("\n")
|
2347
2314
|
end
|
2315
|
+
|
2316
|
+
puts content
|
2348
2317
|
end
|
2349
2318
|
end
|
2350
2319
|
|
2320
|
+
|
2351
2321
|
@data['table'][index][-1] = 70
|
2352
2322
|
@data['table'] << []
|
2353
2323
|
@data['table'].pop
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tblog_duopack
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- zon
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-12-
|
11
|
+
date: 2024-12-20 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: File to Clipboard gem
|
14
14
|
email: mymin26@naver.com
|