cafe_buy 0.1.30 → 0.1.33
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/cafe_buy.rb +111 -42
- 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: c27888f83aae9f7d1c6b7759a9513714a8144ed72fb051da0b2f875b8a86b15d
|
4
|
+
data.tar.gz: 23560db31a3d4fa3ec709c4f5647ba807edcc0a795384628cb4ef4e561f9f5f3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2842efb67aeead457df73a7872a5fced90ef00dddb959427223a64248de16494a57d7123c6d1db50edfe8bffa03cfef5667c0254888978af31c26dd8c6746a86
|
7
|
+
data.tar.gz: 787bd7f59bcbc5d8c9d95f14a3d4cf571066defcbc0a3e0c6ecd18065c9564d1d339f7dcd3ee4214864e451ce54ce4d246d6f70aba1e5beb1e23e1cfe399b911
|
data/lib/cafe_buy.rb
CHANGED
@@ -2863,6 +2863,22 @@ class Wordpress
|
|
2863
2863
|
@data['table'].pop
|
2864
2864
|
#제목끝
|
2865
2865
|
# content = " #{content} "
|
2866
|
+
if @data['포스트설정']['gpt키워드'].checked?
|
2867
|
+
gpt_keyword_prompt = @data['포스트설정']['gpt키워드_프롬프트'].text.to_s.force_encoding('utf-8')
|
2868
|
+
gpt_keyword_prompt_sample = gpt_keyword_prompt.strip.empty? ? "프롬프트: 관련된 글을 1500자에서 2500자 사이로 만들어줘" : gpt_keyword_prompt
|
2869
|
+
chat = Chat.new(@data['포스트설정']['api_key'].text.to_s.force_encoding('utf-8'), gpt_keyword_prompt)
|
2870
|
+
gpt_text = chat.message(keyword)
|
2871
|
+
#content = content.to_s + "\n(자동생성글)\n" + gpt_text.to_s
|
2872
|
+
content = content.to_s + "(자동생성글)" + gpt_text.to_s
|
2873
|
+
elsif @data['포스트설정']['내용을자동생성'].checked?
|
2874
|
+
content = auto_text
|
2875
|
+
elsif @data['포스트설정']['내용과자동생성'].checked?
|
2876
|
+
#content = content + "\n(자동생성글)\n" + auto_text
|
2877
|
+
content = content + "(자동생성글)" + auto_text
|
2878
|
+
end
|
2879
|
+
@data['table'][index][-1] = 45
|
2880
|
+
@data['table'] << []
|
2881
|
+
@data['table'].pop
|
2866
2882
|
|
2867
2883
|
if @data['포스트설정']['특정단어굵기'].checked?
|
2868
2884
|
content2 = ''
|
@@ -2902,7 +2918,7 @@ class Wordpress
|
|
2902
2918
|
content = content2
|
2903
2919
|
end
|
2904
2920
|
end
|
2905
|
-
@data['table'][index][-1] =
|
2921
|
+
@data['table'][index][-1] = 50
|
2906
2922
|
@data['table'] << []
|
2907
2923
|
@data['table'].pop
|
2908
2924
|
if @data['포스트설정']['단어크기변경'].checked?
|
@@ -2923,19 +2939,7 @@ class Wordpress
|
|
2923
2939
|
@data['table'][index][-1] = 50
|
2924
2940
|
@data['table'] << []
|
2925
2941
|
@data['table'].pop
|
2926
|
-
|
2927
|
-
gpt_keyword_prompt = @data['포스트설정']['gpt키워드_프롬프트'].text.to_s.force_encoding('utf-8')
|
2928
|
-
gpt_keyword_prompt_sample = gpt_keyword_prompt.strip.empty? ? "프롬프트: 관련된 글을 1500자에서 2500자 사이로 만들어줘" : gpt_keyword_prompt
|
2929
|
-
chat = Chat.new(@data['포스트설정']['api_key'].text.to_s.force_encoding('utf-8'), gpt_keyword_prompt)
|
2930
|
-
gpt_text = chat.message(keyword)
|
2931
|
-
#content = content.to_s + "\n(자동생성글)\n" + gpt_text.to_s
|
2932
|
-
content = content.to_s + "(자동생성글)" + gpt_text.to_s
|
2933
|
-
elsif @data['포스트설정']['내용을자동생성'].checked?
|
2934
|
-
content = auto_text
|
2935
|
-
elsif @data['포스트설정']['내용과자동생성'].checked?
|
2936
|
-
#content = content + "\n(자동생성글)\n" + auto_text
|
2937
|
-
content = content + "(자동생성글)" + auto_text
|
2938
|
-
end
|
2942
|
+
|
2939
2943
|
|
2940
2944
|
if @data['포스트설정']['내용키워드삽입'].checked?
|
2941
2945
|
puts '내용키워드삽입...'
|
@@ -3196,7 +3200,10 @@ class Wordpress
|
|
3196
3200
|
end
|
3197
3201
|
end
|
3198
3202
|
end
|
3203
|
+
|
3199
3204
|
|
3205
|
+
|
3206
|
+
##여기서부터 이미지 순서대로 수정코드 변경####-------------------------------------------------------------------------------
|
3200
3207
|
@data['table'][index][-1] = 70
|
3201
3208
|
@data['table'] << []
|
3202
3209
|
@data['table'].pop
|
@@ -3204,13 +3211,22 @@ class Wordpress
|
|
3204
3211
|
content_memory = content.split('(자동생성글)')
|
3205
3212
|
content = content_memory[0]
|
3206
3213
|
content_end = content_memory[1].to_s
|
3214
|
+
if @data['포스트설정']['gpt키워드'].checked?
|
3215
|
+
if @data['포스트설정']['gpt상단'].checked?
|
3216
|
+
content = "(자동생성글)\n" + content_end + "\n" + content
|
3217
|
+
else
|
3218
|
+
content = content + "\n(자동생성글)\n" + content_end
|
3219
|
+
end
|
3220
|
+
else
|
3221
|
+
content = content + "\n(자동생성글)\n" + content_end
|
3222
|
+
end
|
3207
3223
|
|
3208
3224
|
if @data['포스트설정']['특정단어키워드로변경'].checked?
|
3209
3225
|
@data['포스트설정']['특정단어키워드로변경값'].text.to_s.force_encoding('utf-8').split(',').each do |i|
|
3210
3226
|
content = content.split(i.force_encoding('utf-8')).join(keyword)
|
3211
3227
|
end
|
3212
3228
|
end
|
3213
|
-
|
3229
|
+
|
3214
3230
|
@data['table'][index][-1] = 75
|
3215
3231
|
@data['table'] << []
|
3216
3232
|
@data['table'].pop
|
@@ -3237,6 +3253,7 @@ class Wordpress
|
|
3237
3253
|
if i.force_encoding('utf-8').to_s.include?('@')
|
3238
3254
|
image_memory << ""+'<img src="'+image_url+'" alt="'+keyword+'">'+""
|
3239
3255
|
content[index3] = content[index3] + '**image()**'
|
3256
|
+
|
3240
3257
|
else
|
3241
3258
|
image_memory << ""+ '<img src="'+image_url+'" alt="'+keyword+'">'+""
|
3242
3259
|
content[index3] = content[index3] + '**image**'
|
@@ -3246,6 +3263,8 @@ class Wordpress
|
|
3246
3263
|
content = content.join('')
|
3247
3264
|
end
|
3248
3265
|
end
|
3266
|
+
|
3267
|
+
|
3249
3268
|
|
3250
3269
|
con_memory = Array.new
|
3251
3270
|
index5 = 0
|
@@ -3283,6 +3302,8 @@ class Wordpress
|
|
3283
3302
|
content = content.split(i.force_encoding('utf-8')).join("<sticker></sticker>")
|
3284
3303
|
end
|
3285
3304
|
end
|
3305
|
+
|
3306
|
+
|
3286
3307
|
|
3287
3308
|
if @data['포스트설정']['영상으로변경'].checked?
|
3288
3309
|
if @video.length == 0
|
@@ -3311,36 +3332,79 @@ class Wordpress
|
|
3311
3332
|
# end
|
3312
3333
|
#end
|
3313
3334
|
if @data['포스트설정']['지도로변경'].checked?
|
3314
|
-
# 지도 주소와 사용자 설정 단어들을 가져옵니다.
|
3315
3335
|
map_address = @data['포스트설정']['지도주소'].text.to_s.force_encoding('utf-8')
|
3316
|
-
|
3317
|
-
# 여러 단어로 설정된 '지도로변경단어'를 분리하여 배열로 저장
|
3318
3336
|
change_words = @data['포스트설정']['지도로변경단어'].text.to_s.force_encoding('utf-8').split(',')
|
3319
3337
|
|
3320
|
-
# content를 각 줄로 분할
|
3321
3338
|
content_lines = content.split("\n")
|
3339
|
+
new_lines = []
|
3340
|
+
|
3341
|
+
content_lines.each do |line|
|
3342
|
+
# 이미 처리된 줄은 건너뜀
|
3343
|
+
if line.include?("<koreamap>")
|
3344
|
+
new_lines << line
|
3345
|
+
next
|
3346
|
+
end
|
3347
|
+
|
3348
|
+
processed = false
|
3322
3349
|
|
3323
|
-
content_lines.each_with_index do |line, index|
|
3324
|
-
# 각 단어에 대해 처리
|
3325
3350
|
change_words.each do |change_word|
|
3326
|
-
#
|
3327
|
-
if line.
|
3328
|
-
|
3329
|
-
if
|
3330
|
-
|
3331
|
-
|
3332
|
-
|
3333
|
-
|
3334
|
-
#
|
3335
|
-
|
3351
|
+
# 1. [단어][주소] 패턴 처리: 분리 + 출력
|
3352
|
+
if line =~ /#{Regexp.escape(change_word)}\[(.*?)\]/
|
3353
|
+
match_data = line.match(/(.*)#{Regexp.escape(change_word)}\[(.*?)\](.*)/)
|
3354
|
+
if match_data
|
3355
|
+
before = match_data[1]
|
3356
|
+
address = match_data[2]
|
3357
|
+
after = match_data[3]
|
3358
|
+
|
3359
|
+
# 태그 추출
|
3360
|
+
open_tag = before[/<p[^>]*?>/i] || ""
|
3361
|
+
close_tag = after[/<\/p>/i] || ""
|
3362
|
+
|
3363
|
+
# 텍스트 정리
|
3364
|
+
before_text = before.sub(open_tag, '')
|
3365
|
+
after_text = after.sub(close_tag, '')
|
3366
|
+
|
3367
|
+
# 줄 분리
|
3368
|
+
new_lines << "#{open_tag}#{before_text}</p>" unless before_text.strip.empty?
|
3369
|
+
new_lines << "<koreamap>#{address}</koreamap>"
|
3370
|
+
new_lines << "#{open_tag}#{after_text}#{close_tag}" unless after_text.strip.empty?
|
3371
|
+
|
3372
|
+
processed = true
|
3373
|
+
break
|
3336
3374
|
end
|
3337
3375
|
end
|
3376
|
+
|
3377
|
+
# 2. 일반 단어 처리 (한 줄에만 등장하는 경우)
|
3378
|
+
if !processed && line.include?(change_word)
|
3379
|
+
parts = line.split(change_word, 2)
|
3380
|
+
prefix = parts[0]
|
3381
|
+
suffix = parts[1]
|
3382
|
+
|
3383
|
+
open_tag = prefix[/<p[^>]*?>/i] || ""
|
3384
|
+
close_tag = suffix[/<\/p>/i] || ""
|
3385
|
+
|
3386
|
+
prefix_text = prefix.sub(open_tag, '')
|
3387
|
+
suffix_text = suffix.sub(close_tag, '')
|
3388
|
+
|
3389
|
+
new_lines << "#{open_tag}#{prefix_text}</p>" unless prefix_text.strip.empty?
|
3390
|
+
new_lines << "<koreamap>#{map_address}</koreamap>"
|
3391
|
+
new_lines << "#{open_tag}#{suffix_text}#{close_tag}" unless suffix_text.strip.empty?
|
3392
|
+
|
3393
|
+
processed = true
|
3394
|
+
break
|
3395
|
+
end
|
3338
3396
|
end
|
3397
|
+
|
3398
|
+
# 변경이 없었으면 원래 줄 추가
|
3399
|
+
new_lines << line unless processed
|
3339
3400
|
end
|
3340
3401
|
|
3341
|
-
|
3342
|
-
content = content_lines.join("\n")
|
3402
|
+
content = new_lines.join("\n")
|
3343
3403
|
end
|
3404
|
+
|
3405
|
+
|
3406
|
+
|
3407
|
+
|
3344
3408
|
|
3345
3409
|
if @data['포스트설정']['인용구변경'].checked?
|
3346
3410
|
if @data['포스트설정']['인용구문구설정'].checked?
|
@@ -3378,21 +3442,26 @@ class Wordpress
|
|
3378
3442
|
@data['table'] << []
|
3379
3443
|
@data['table'].pop
|
3380
3444
|
|
3445
|
+
|
3446
|
+
parts = content.split('(자동생성글)', 2)
|
3447
|
+
content_main = parts[0].strip
|
3448
|
+
content_end = parts[1].to_s.strip
|
3449
|
+
|
3381
3450
|
soosick_1 = ''
|
3382
3451
|
soosick_2 = ''
|
3383
3452
|
if @data['포스트설정']['자동글 수식에 입력'].checked?
|
3384
|
-
|
3385
|
-
|
3453
|
+
content = content_main
|
3454
|
+
soosick_1 = content_end
|
3386
3455
|
else
|
3387
|
-
|
3388
|
-
|
3389
|
-
|
3390
|
-
else
|
3391
|
-
content = content+"\n"+content_end+"\n"
|
3392
|
-
end
|
3456
|
+
if @data['포스트설정']['gpt키워드'].checked?
|
3457
|
+
if @data['포스트설정']['gpt상단'].checked?
|
3458
|
+
content = content_end + "\n" + content_main + "\n"
|
3393
3459
|
else
|
3394
|
-
|
3460
|
+
content = content_main + "\n" + content_end + "\n"
|
3395
3461
|
end
|
3462
|
+
else
|
3463
|
+
content = content_main + "\n" + content_end + "\n"
|
3464
|
+
end
|
3396
3465
|
end
|
3397
3466
|
|
3398
3467
|
if @data['포스트설정']['막글삽입'].checked?
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cafe_buy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.33
|
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
|