cafe_basics_duo 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_basics_duo.rb +112 -48
- 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: d41dca52ce32f729520ea19c0fee538e127cd50ddc24c45897883ee4dd09b331
|
4
|
+
data.tar.gz: 40cff0587a7ee6f9b14819b5b062014388acf818a401255bd6e72bb9dae93ea0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 620006031154254fc4a75709d8344dd6b60318e502bd374b045741a904f62de5e45411e2a7fc10a398922eb810b82821210f7c5b5feff9025d287afeeaa50fb4
|
7
|
+
data.tar.gz: 2bd6b2d74f70ecf298fbefc1fde2c1c7f4484e49c2c99a5600d88171c4fcc84bf1a857daa74b5e525d3e3c42c8e4141a53fca78b2ae0cb269278002376bfe795
|
data/lib/cafe_basics_duo.rb
CHANGED
@@ -2579,6 +2579,22 @@ class Wordpress
|
|
2579
2579
|
@data['table'].pop
|
2580
2580
|
#제목끝
|
2581
2581
|
# content = " #{content} "
|
2582
|
+
if @data['포스트설정']['gpt키워드'].checked?
|
2583
|
+
gpt_keyword_prompt = @data['포스트설정']['gpt키워드_프롬프트'].text.to_s.force_encoding('utf-8')
|
2584
|
+
gpt_keyword_prompt_sample = gpt_keyword_prompt.strip.empty? ? "프롬프트: 관련된 글을 1500자에서 2500자 사이로 만들어줘" : gpt_keyword_prompt
|
2585
|
+
chat = Chat.new(@data['포스트설정']['api_key'].text.to_s.force_encoding('utf-8'), gpt_keyword_prompt)
|
2586
|
+
gpt_text = chat.message(keyword)
|
2587
|
+
#content = content.to_s + "\n(자동생성글)\n" + gpt_text.to_s
|
2588
|
+
content = content.to_s + "(자동생성글)" + gpt_text.to_s
|
2589
|
+
elsif @data['포스트설정']['내용을자동생성'].checked?
|
2590
|
+
content = auto_text
|
2591
|
+
elsif @data['포스트설정']['내용과자동생성'].checked?
|
2592
|
+
#content = content + "\n(자동생성글)\n" + auto_text
|
2593
|
+
content = content + "(자동생성글)" + auto_text
|
2594
|
+
end
|
2595
|
+
@data['table'][index][-1] = 45
|
2596
|
+
@data['table'] << []
|
2597
|
+
@data['table'].pop
|
2582
2598
|
|
2583
2599
|
if @data['포스트설정']['특정단어굵기'].checked?
|
2584
2600
|
content2 = ''
|
@@ -2618,7 +2634,7 @@ class Wordpress
|
|
2618
2634
|
content = content2
|
2619
2635
|
end
|
2620
2636
|
end
|
2621
|
-
@data['table'][index][-1] =
|
2637
|
+
@data['table'][index][-1] = 50
|
2622
2638
|
@data['table'] << []
|
2623
2639
|
@data['table'].pop
|
2624
2640
|
if @data['포스트설정']['단어크기변경'].checked?
|
@@ -2639,19 +2655,7 @@ class Wordpress
|
|
2639
2655
|
@data['table'][index][-1] = 50
|
2640
2656
|
@data['table'] << []
|
2641
2657
|
@data['table'].pop
|
2642
|
-
|
2643
|
-
gpt_keyword_prompt = @data['포스트설정']['gpt키워드_프롬프트'].text.to_s.force_encoding('utf-8')
|
2644
|
-
gpt_keyword_prompt_sample = gpt_keyword_prompt.strip.empty? ? "프롬프트: 관련된 글을 1500자에서 2500자 사이로 만들어줘" : gpt_keyword_prompt
|
2645
|
-
chat = Chat.new(@data['포스트설정']['api_key'].text.to_s.force_encoding('utf-8'), gpt_keyword_prompt)
|
2646
|
-
gpt_text = chat.message(keyword)
|
2647
|
-
#content = content.to_s + "\n(자동생성글)\n" + gpt_text.to_s
|
2648
|
-
content = content.to_s + "(자동생성글)" + gpt_text.to_s
|
2649
|
-
elsif @data['포스트설정']['내용을자동생성'].checked?
|
2650
|
-
content = auto_text
|
2651
|
-
elsif @data['포스트설정']['내용과자동생성'].checked?
|
2652
|
-
#content = content + "\n(자동생성글)\n" + auto_text
|
2653
|
-
content = content + "(자동생성글)" + auto_text
|
2654
|
-
end
|
2658
|
+
|
2655
2659
|
|
2656
2660
|
if @data['포스트설정']['내용키워드삽입'].checked?
|
2657
2661
|
puts '내용키워드삽입...'
|
@@ -2912,7 +2916,10 @@ class Wordpress
|
|
2912
2916
|
end
|
2913
2917
|
end
|
2914
2918
|
end
|
2919
|
+
|
2915
2920
|
|
2921
|
+
|
2922
|
+
##여기서부터 이미지 순서대로 수정코드 변경####-------------------------------------------------------------------------------
|
2916
2923
|
@data['table'][index][-1] = 70
|
2917
2924
|
@data['table'] << []
|
2918
2925
|
@data['table'].pop
|
@@ -2920,13 +2927,22 @@ class Wordpress
|
|
2920
2927
|
content_memory = content.split('(자동생성글)')
|
2921
2928
|
content = content_memory[0]
|
2922
2929
|
content_end = content_memory[1].to_s
|
2930
|
+
if @data['포스트설정']['gpt키워드'].checked?
|
2931
|
+
if @data['포스트설정']['gpt상단'].checked?
|
2932
|
+
content = "(자동생성글)\n" + content_end + "\n" + content
|
2933
|
+
else
|
2934
|
+
content = content + "\n(자동생성글)\n" + content_end
|
2935
|
+
end
|
2936
|
+
else
|
2937
|
+
content = content + "\n(자동생성글)\n" + content_end
|
2938
|
+
end
|
2923
2939
|
|
2924
2940
|
if @data['포스트설정']['특정단어키워드로변경'].checked?
|
2925
2941
|
@data['포스트설정']['특정단어키워드로변경값'].text.to_s.force_encoding('utf-8').split(',').each do |i|
|
2926
2942
|
content = content.split(i.force_encoding('utf-8')).join(keyword)
|
2927
2943
|
end
|
2928
2944
|
end
|
2929
|
-
|
2945
|
+
|
2930
2946
|
@data['table'][index][-1] = 75
|
2931
2947
|
@data['table'] << []
|
2932
2948
|
@data['table'].pop
|
@@ -2943,12 +2959,7 @@ class Wordpress
|
|
2943
2959
|
ttr = 0
|
2944
2960
|
@data['포스트설정']['단어사진으로변경단어'].text.to_s.force_encoding('utf-8').split(',').each do |i|
|
2945
2961
|
ttr = 1
|
2946
|
-
|
2947
|
-
# if @data['포스트설정']['내용사진링크'].checked?
|
2948
|
-
# content = content.split(i.force_encoding('utf-8')).join('<a href="'+@data['포스트설정']['내용사진링크값'].text.to_s.force_encoding('utf-8')+'"><img src="'+image_url+'" alt="'+keyword+'"></a>')
|
2949
|
-
# else
|
2950
|
-
# content = content.split(i.force_encoding('utf-8')).join('<img src="'+image_url+'" alt="'+keyword+'">')
|
2951
|
-
# end
|
2962
|
+
|
2952
2963
|
content = content.split(i.force_encoding('utf-8'))
|
2953
2964
|
content.each_with_index do |ccm, index3|
|
2954
2965
|
if index3 == content.length-1
|
@@ -2958,6 +2969,7 @@ class Wordpress
|
|
2958
2969
|
if i.force_encoding('utf-8').to_s.include?('@')
|
2959
2970
|
image_memory << ""+'<img src="'+image_url+'" alt="'+keyword+'">'+""
|
2960
2971
|
content[index3] = content[index3] + '**image()**'
|
2972
|
+
|
2961
2973
|
else
|
2962
2974
|
image_memory << ""+ '<img src="'+image_url+'" alt="'+keyword+'">'+""
|
2963
2975
|
content[index3] = content[index3] + '**image**'
|
@@ -2967,6 +2979,8 @@ class Wordpress
|
|
2967
2979
|
content = content.join('')
|
2968
2980
|
end
|
2969
2981
|
end
|
2982
|
+
|
2983
|
+
|
2970
2984
|
|
2971
2985
|
con_memory = Array.new
|
2972
2986
|
index5 = 0
|
@@ -3004,6 +3018,8 @@ class Wordpress
|
|
3004
3018
|
content = content.split(i.force_encoding('utf-8')).join("<sticker></sticker>")
|
3005
3019
|
end
|
3006
3020
|
end
|
3021
|
+
|
3022
|
+
|
3007
3023
|
|
3008
3024
|
if @data['포스트설정']['영상으로변경'].checked?
|
3009
3025
|
if @video.length == 0
|
@@ -3032,36 +3048,79 @@ class Wordpress
|
|
3032
3048
|
# end
|
3033
3049
|
#end
|
3034
3050
|
if @data['포스트설정']['지도로변경'].checked?
|
3035
|
-
# 지도 주소와 사용자 설정 단어들을 가져옵니다.
|
3036
3051
|
map_address = @data['포스트설정']['지도주소'].text.to_s.force_encoding('utf-8')
|
3037
|
-
|
3038
|
-
# 여러 단어로 설정된 '지도로변경단어'를 분리하여 배열로 저장
|
3039
3052
|
change_words = @data['포스트설정']['지도로변경단어'].text.to_s.force_encoding('utf-8').split(',')
|
3040
3053
|
|
3041
|
-
# content를 각 줄로 분할
|
3042
3054
|
content_lines = content.split("\n")
|
3055
|
+
new_lines = []
|
3056
|
+
|
3057
|
+
content_lines.each do |line|
|
3058
|
+
# 이미 처리된 줄은 건너뜀
|
3059
|
+
if line.include?("<koreamap>")
|
3060
|
+
new_lines << line
|
3061
|
+
next
|
3062
|
+
end
|
3063
|
+
|
3064
|
+
processed = false
|
3043
3065
|
|
3044
|
-
content_lines.each_with_index do |line, index|
|
3045
|
-
# 각 단어에 대해 처리
|
3046
3066
|
change_words.each do |change_word|
|
3047
|
-
#
|
3048
|
-
if line.
|
3049
|
-
|
3050
|
-
if
|
3051
|
-
|
3052
|
-
|
3053
|
-
|
3054
|
-
|
3055
|
-
#
|
3056
|
-
|
3067
|
+
# 1. [단어][주소] 패턴 처리: 분리 + 출력
|
3068
|
+
if line =~ /#{Regexp.escape(change_word)}\[(.*?)\]/
|
3069
|
+
match_data = line.match(/(.*)#{Regexp.escape(change_word)}\[(.*?)\](.*)/)
|
3070
|
+
if match_data
|
3071
|
+
before = match_data[1]
|
3072
|
+
address = match_data[2]
|
3073
|
+
after = match_data[3]
|
3074
|
+
|
3075
|
+
# 태그 추출
|
3076
|
+
open_tag = before[/<p[^>]*?>/i] || ""
|
3077
|
+
close_tag = after[/<\/p>/i] || ""
|
3078
|
+
|
3079
|
+
# 텍스트 정리
|
3080
|
+
before_text = before.sub(open_tag, '')
|
3081
|
+
after_text = after.sub(close_tag, '')
|
3082
|
+
|
3083
|
+
# 줄 분리
|
3084
|
+
new_lines << "#{open_tag}#{before_text}</p>" unless before_text.strip.empty?
|
3085
|
+
new_lines << "<koreamap>#{address}</koreamap>"
|
3086
|
+
new_lines << "#{open_tag}#{after_text}#{close_tag}" unless after_text.strip.empty?
|
3087
|
+
|
3088
|
+
processed = true
|
3089
|
+
break
|
3057
3090
|
end
|
3058
3091
|
end
|
3092
|
+
|
3093
|
+
# 2. 일반 단어 처리 (한 줄에만 등장하는 경우)
|
3094
|
+
if !processed && line.include?(change_word)
|
3095
|
+
parts = line.split(change_word, 2)
|
3096
|
+
prefix = parts[0]
|
3097
|
+
suffix = parts[1]
|
3098
|
+
|
3099
|
+
open_tag = prefix[/<p[^>]*?>/i] || ""
|
3100
|
+
close_tag = suffix[/<\/p>/i] || ""
|
3101
|
+
|
3102
|
+
prefix_text = prefix.sub(open_tag, '')
|
3103
|
+
suffix_text = suffix.sub(close_tag, '')
|
3104
|
+
|
3105
|
+
new_lines << "#{open_tag}#{prefix_text}</p>" unless prefix_text.strip.empty?
|
3106
|
+
new_lines << "<koreamap>#{map_address}</koreamap>"
|
3107
|
+
new_lines << "#{open_tag}#{suffix_text}#{close_tag}" unless suffix_text.strip.empty?
|
3108
|
+
|
3109
|
+
processed = true
|
3110
|
+
break
|
3111
|
+
end
|
3059
3112
|
end
|
3113
|
+
|
3114
|
+
# 변경이 없었으면 원래 줄 추가
|
3115
|
+
new_lines << line unless processed
|
3060
3116
|
end
|
3061
3117
|
|
3062
|
-
|
3063
|
-
content = content_lines.join("\n")
|
3118
|
+
content = new_lines.join("\n")
|
3064
3119
|
end
|
3120
|
+
|
3121
|
+
|
3122
|
+
|
3123
|
+
|
3065
3124
|
|
3066
3125
|
if @data['포스트설정']['인용구변경'].checked?
|
3067
3126
|
if @data['포스트설정']['인용구문구설정'].checked?
|
@@ -3099,21 +3158,26 @@ class Wordpress
|
|
3099
3158
|
@data['table'] << []
|
3100
3159
|
@data['table'].pop
|
3101
3160
|
|
3161
|
+
|
3162
|
+
parts = content.split('(자동생성글)', 2)
|
3163
|
+
content_main = parts[0].strip
|
3164
|
+
content_end = parts[1].to_s.strip
|
3165
|
+
|
3102
3166
|
soosick_1 = ''
|
3103
3167
|
soosick_2 = ''
|
3104
3168
|
if @data['포스트설정']['자동글 수식에 입력'].checked?
|
3105
|
-
|
3106
|
-
|
3169
|
+
content = content_main
|
3170
|
+
soosick_1 = content_end
|
3107
3171
|
else
|
3108
|
-
|
3109
|
-
|
3110
|
-
|
3111
|
-
else
|
3112
|
-
content = content+"\n"+content_end+"\n"
|
3113
|
-
end
|
3172
|
+
if @data['포스트설정']['gpt키워드'].checked?
|
3173
|
+
if @data['포스트설정']['gpt상단'].checked?
|
3174
|
+
content = content_end + "\n" + content_main + "\n"
|
3114
3175
|
else
|
3115
|
-
|
3176
|
+
content = content_main + "\n" + content_end + "\n"
|
3116
3177
|
end
|
3178
|
+
else
|
3179
|
+
content = content_main + "\n" + content_end + "\n"
|
3180
|
+
end
|
3117
3181
|
end
|
3118
3182
|
|
3119
3183
|
if @data['포스트설정']['막글삽입'].checked?
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cafe_basics_duo
|
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
|