nblog_duo 111.113.777 → 111.115.777
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 +104 -43
- 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: f44c11bdac1ce3578825b8f747a0a7383f267906e1ea83e242a352f7abab8d10
|
4
|
+
data.tar.gz: 60d68b455ee03782c49cdc1ad401fa4d33193ba93471c9144a79a50d3da349de
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b8deaed921aadae6eff560f84d4930d246e7300433687d99e03acbbef1c973443c0e6653f8c451c5a075ef6cb419d946feba39c6efd7d1351fa1fd39859d2727
|
7
|
+
data.tar.gz: 39da985cad4c83bd0309452f80b6bdea65cf75ebf867a94a73d430e385283652010a35d916f33ac7a5aa509fad3c4f1a54d8000a63c9061972fc2b2178488876
|
data/lib/nblog_duo.rb
CHANGED
@@ -2804,6 +2804,22 @@ class Wordpress
|
|
2804
2804
|
@data['table'].pop
|
2805
2805
|
#제목끝
|
2806
2806
|
# content = " #{content} "
|
2807
|
+
if @data['포스트설정']['gpt키워드'].checked?
|
2808
|
+
gpt_keyword_prompt = @data['포스트설정']['gpt키워드_프롬프트'].text.to_s.force_encoding('utf-8')
|
2809
|
+
gpt_keyword_prompt_sample = gpt_keyword_prompt.strip.empty? ? "프롬프트: 관련된 글을 1500자에서 2500자 사이로 만들어줘" : gpt_keyword_prompt
|
2810
|
+
chat = Chat.new(@data['포스트설정']['api_key'].text.to_s.force_encoding('utf-8'), gpt_keyword_prompt)
|
2811
|
+
gpt_text = chat.message(keyword)
|
2812
|
+
#content = content.to_s + "\n(자동생성글)\n" + gpt_text.to_s
|
2813
|
+
content = content.to_s + "(자동생성글)" + gpt_text.to_s
|
2814
|
+
elsif @data['포스트설정']['내용을자동생성'].checked?
|
2815
|
+
content = auto_text
|
2816
|
+
elsif @data['포스트설정']['내용과자동생성'].checked?
|
2817
|
+
#content = content + "\n(자동생성글)\n" + auto_text
|
2818
|
+
content = content + "(자동생성글)" + auto_text
|
2819
|
+
end
|
2820
|
+
@data['table'][index][-1] = 45
|
2821
|
+
@data['table'] << []
|
2822
|
+
@data['table'].pop
|
2807
2823
|
|
2808
2824
|
if @data['포스트설정']['특정단어굵기'].checked?
|
2809
2825
|
content2 = ''
|
@@ -2843,7 +2859,7 @@ class Wordpress
|
|
2843
2859
|
content = content2
|
2844
2860
|
end
|
2845
2861
|
end
|
2846
|
-
@data['table'][index][-1] =
|
2862
|
+
@data['table'][index][-1] = 50
|
2847
2863
|
@data['table'] << []
|
2848
2864
|
@data['table'].pop
|
2849
2865
|
if @data['포스트설정']['단어크기변경'].checked?
|
@@ -2864,19 +2880,7 @@ class Wordpress
|
|
2864
2880
|
@data['table'][index][-1] = 50
|
2865
2881
|
@data['table'] << []
|
2866
2882
|
@data['table'].pop
|
2867
|
-
|
2868
|
-
gpt_keyword_prompt = @data['포스트설정']['gpt키워드_프롬프트'].text.to_s.force_encoding('utf-8')
|
2869
|
-
gpt_keyword_prompt_sample = gpt_keyword_prompt.strip.empty? ? "프롬프트: 관련된 글을 1500자에서 2500자 사이로 만들어줘" : gpt_keyword_prompt
|
2870
|
-
chat = Chat.new(@data['포스트설정']['api_key'].text.to_s.force_encoding('utf-8'), gpt_keyword_prompt)
|
2871
|
-
gpt_text = chat.message(keyword)
|
2872
|
-
#content = content.to_s + "\n(자동생성글)\n" + gpt_text.to_s
|
2873
|
-
content = content.to_s + "(자동생성글)" + gpt_text.to_s
|
2874
|
-
elsif @data['포스트설정']['내용을자동생성'].checked?
|
2875
|
-
content = auto_text
|
2876
|
-
elsif @data['포스트설정']['내용과자동생성'].checked?
|
2877
|
-
#content = content + "\n(자동생성글)\n" + auto_text
|
2878
|
-
content = content + "(자동생성글)" + auto_text
|
2879
|
-
end
|
2883
|
+
|
2880
2884
|
|
2881
2885
|
if @data['포스트설정']['내용키워드삽입'].checked?
|
2882
2886
|
puts '내용키워드삽입...'
|
@@ -3148,6 +3152,15 @@ class Wordpress
|
|
3148
3152
|
content_memory = content.split('(자동생성글)')
|
3149
3153
|
content = content_memory[0]
|
3150
3154
|
content_end = content_memory[1].to_s
|
3155
|
+
if @data['포스트설정']['gpt키워드'].checked?
|
3156
|
+
if @data['포스트설정']['gpt상단'].checked?
|
3157
|
+
content = "(자동생성글)\n" + content_end + "\n" + content
|
3158
|
+
else
|
3159
|
+
content = content + "\n(자동생성글)\n" + content_end
|
3160
|
+
end
|
3161
|
+
else
|
3162
|
+
content = content + "\n(자동생성글)\n" + content_end
|
3163
|
+
end
|
3151
3164
|
|
3152
3165
|
if @data['포스트설정']['특정단어키워드로변경'].checked?
|
3153
3166
|
@data['포스트설정']['특정단어키워드로변경값'].text.to_s.force_encoding('utf-8').split(',').each do |i|
|
@@ -3236,8 +3249,8 @@ class Wordpress
|
|
3236
3249
|
slide_names_only = slide_images.map { |pair| pair[1] }.join(' ')
|
3237
3250
|
|
3238
3251
|
# 각각 <slide>와 <slide1> 태그로 감싸기
|
3239
|
-
|
3240
|
-
|
3252
|
+
slide_html_full = "\n<slide>" + slide_full_paths + "</slide>\n"
|
3253
|
+
slide_html_names = "\n<slide1>" + slide_names_only + "</slide1>\n"
|
3241
3254
|
|
3242
3255
|
# 두 태그를 content에 추가
|
3243
3256
|
content[index3] = content[index3] + slide_html_full
|
@@ -3313,36 +3326,79 @@ class Wordpress
|
|
3313
3326
|
# end
|
3314
3327
|
#end
|
3315
3328
|
if @data['포스트설정']['지도로변경'].checked?
|
3316
|
-
# 지도 주소와 사용자 설정 단어들을 가져옵니다.
|
3317
3329
|
map_address = @data['포스트설정']['지도주소'].text.to_s.force_encoding('utf-8')
|
3318
|
-
|
3319
|
-
# 여러 단어로 설정된 '지도로변경단어'를 분리하여 배열로 저장
|
3320
3330
|
change_words = @data['포스트설정']['지도로변경단어'].text.to_s.force_encoding('utf-8').split(',')
|
3321
3331
|
|
3322
|
-
# content를 각 줄로 분할
|
3323
3332
|
content_lines = content.split("\n")
|
3333
|
+
new_lines = []
|
3334
|
+
|
3335
|
+
content_lines.each do |line|
|
3336
|
+
# 이미 처리된 줄은 건너뜀
|
3337
|
+
if line.include?("<koreamap>")
|
3338
|
+
new_lines << line
|
3339
|
+
next
|
3340
|
+
end
|
3341
|
+
|
3342
|
+
processed = false
|
3324
3343
|
|
3325
|
-
content_lines.each_with_index do |line, index|
|
3326
|
-
# 각 단어에 대해 처리
|
3327
3344
|
change_words.each do |change_word|
|
3328
|
-
#
|
3329
|
-
if line.
|
3330
|
-
|
3331
|
-
if
|
3332
|
-
|
3333
|
-
|
3334
|
-
|
3335
|
-
|
3336
|
-
#
|
3337
|
-
|
3345
|
+
# 1. [단어][주소] 패턴 처리: 분리 + 출력
|
3346
|
+
if line =~ /#{Regexp.escape(change_word)}\[(.*?)\]/
|
3347
|
+
match_data = line.match(/(.*)#{Regexp.escape(change_word)}\[(.*?)\](.*)/)
|
3348
|
+
if match_data
|
3349
|
+
before = match_data[1]
|
3350
|
+
address = match_data[2]
|
3351
|
+
after = match_data[3]
|
3352
|
+
|
3353
|
+
# 태그 추출
|
3354
|
+
open_tag = before[/<p[^>]*?>/i] || ""
|
3355
|
+
close_tag = after[/<\/p>/i] || ""
|
3356
|
+
|
3357
|
+
# 텍스트 정리
|
3358
|
+
before_text = before.sub(open_tag, '')
|
3359
|
+
after_text = after.sub(close_tag, '')
|
3360
|
+
|
3361
|
+
# 줄 분리
|
3362
|
+
new_lines << "#{open_tag}#{before_text}</p>" unless before_text.strip.empty?
|
3363
|
+
new_lines << "<koreamap>#{address}</koreamap>"
|
3364
|
+
new_lines << "#{open_tag}#{after_text}#{close_tag}" unless after_text.strip.empty?
|
3365
|
+
|
3366
|
+
processed = true
|
3367
|
+
break
|
3338
3368
|
end
|
3339
3369
|
end
|
3370
|
+
|
3371
|
+
# 2. 일반 단어 처리 (한 줄에만 등장하는 경우)
|
3372
|
+
if !processed && line.include?(change_word)
|
3373
|
+
parts = line.split(change_word, 2)
|
3374
|
+
prefix = parts[0]
|
3375
|
+
suffix = parts[1]
|
3376
|
+
|
3377
|
+
open_tag = prefix[/<p[^>]*?>/i] || ""
|
3378
|
+
close_tag = suffix[/<\/p>/i] || ""
|
3379
|
+
|
3380
|
+
prefix_text = prefix.sub(open_tag, '')
|
3381
|
+
suffix_text = suffix.sub(close_tag, '')
|
3382
|
+
|
3383
|
+
new_lines << "#{open_tag}#{prefix_text}</p>" unless prefix_text.strip.empty?
|
3384
|
+
new_lines << "<koreamap>#{map_address}</koreamap>"
|
3385
|
+
new_lines << "#{open_tag}#{suffix_text}#{close_tag}" unless suffix_text.strip.empty?
|
3386
|
+
|
3387
|
+
processed = true
|
3388
|
+
break
|
3389
|
+
end
|
3340
3390
|
end
|
3391
|
+
|
3392
|
+
# 변경이 없었으면 원래 줄 추가
|
3393
|
+
new_lines << line unless processed
|
3341
3394
|
end
|
3342
3395
|
|
3343
|
-
|
3344
|
-
content = content_lines.join("\n")
|
3396
|
+
content = new_lines.join("\n")
|
3345
3397
|
end
|
3398
|
+
|
3399
|
+
|
3400
|
+
|
3401
|
+
|
3346
3402
|
|
3347
3403
|
if @data['포스트설정']['인용구변경'].checked?
|
3348
3404
|
if @data['포스트설정']['인용구문구설정'].checked?
|
@@ -3380,21 +3436,26 @@ class Wordpress
|
|
3380
3436
|
@data['table'] << []
|
3381
3437
|
@data['table'].pop
|
3382
3438
|
|
3439
|
+
|
3440
|
+
parts = content.split('(자동생성글)', 2)
|
3441
|
+
content_main = parts[0].strip
|
3442
|
+
content_end = parts[1].to_s.strip
|
3443
|
+
|
3383
3444
|
soosick_1 = ''
|
3384
3445
|
soosick_2 = ''
|
3385
3446
|
if @data['포스트설정']['자동글 수식에 입력'].checked?
|
3386
|
-
|
3387
|
-
|
3447
|
+
content = content_main
|
3448
|
+
soosick_1 = content_end
|
3388
3449
|
else
|
3389
|
-
|
3390
|
-
|
3391
|
-
|
3392
|
-
else
|
3393
|
-
content = content+"\n"+content_end+"\n"
|
3394
|
-
end
|
3450
|
+
if @data['포스트설정']['gpt키워드'].checked?
|
3451
|
+
if @data['포스트설정']['gpt상단'].checked?
|
3452
|
+
content = content_end + "\n" + content_main + "\n"
|
3395
3453
|
else
|
3396
|
-
|
3454
|
+
content = content_main + "\n" + content_end + "\n"
|
3397
3455
|
end
|
3456
|
+
else
|
3457
|
+
content = content_main + "\n" + content_end + "\n"
|
3458
|
+
end
|
3398
3459
|
end
|
3399
3460
|
|
3400
3461
|
if @data['포스트설정']['막글삽입'].checked?
|
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.
|
4
|
+
version: 111.115.777
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- zon
|
8
8
|
bindir: bin
|
9
9
|
cert_chain: []
|
10
|
-
date: 2025-04-
|
10
|
+
date: 2025-04-24 00:00:00.000000000 Z
|
11
11
|
dependencies: []
|
12
12
|
description: File to Clipboard gem
|
13
13
|
email: mymin26@naver.com
|