cafe_basics 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.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: ad6177d348599083944ff5ff033854d1312dd29d01de0b1233e48137a7260290
|
4
|
+
data.tar.gz: edc6948cd9f7e643d8f59e79e3d0d93ee3ac407b04fbb6d184df6964603adaab
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f5888d3053856bfebd7a89af2cfdf42662f30c553c4e12043233e80a570fffab8b57cfffd5d4041cd98ef376e40ef511bc5296c88cf2b2a5eec8a2b6b5b7d61e
|
7
|
+
data.tar.gz: a203cb5d7412893098e648c1cb2a558640048e18ba7b49c16406bc6e3c17f6323cfd3bf97fcbd59b1ba3b307c651cbb1f4bb067434779fe81674cb5a8a64681c
|
data/lib/cafe_basics.rb
CHANGED
@@ -2512,6 +2512,22 @@ class Wordpress
|
|
2512
2512
|
@data['table'].pop
|
2513
2513
|
#제목끝
|
2514
2514
|
# content = " #{content} "
|
2515
|
+
if @data['포스트설정']['gpt키워드'].checked?
|
2516
|
+
gpt_keyword_prompt = @data['포스트설정']['gpt키워드_프롬프트'].text.to_s.force_encoding('utf-8')
|
2517
|
+
gpt_keyword_prompt_sample = gpt_keyword_prompt.strip.empty? ? "프롬프트: 관련된 글을 1500자에서 2500자 사이로 만들어줘" : gpt_keyword_prompt
|
2518
|
+
chat = Chat.new(@data['포스트설정']['api_key'].text.to_s.force_encoding('utf-8'), gpt_keyword_prompt)
|
2519
|
+
gpt_text = chat.message(keyword)
|
2520
|
+
#content = content.to_s + "\n(자동생성글)\n" + gpt_text.to_s
|
2521
|
+
content = content.to_s + "(자동생성글)" + gpt_text.to_s
|
2522
|
+
elsif @data['포스트설정']['내용을자동생성'].checked?
|
2523
|
+
content = auto_text
|
2524
|
+
elsif @data['포스트설정']['내용과자동생성'].checked?
|
2525
|
+
#content = content + "\n(자동생성글)\n" + auto_text
|
2526
|
+
content = content + "(자동생성글)" + auto_text
|
2527
|
+
end
|
2528
|
+
@data['table'][index][-1] = 45
|
2529
|
+
@data['table'] << []
|
2530
|
+
@data['table'].pop
|
2515
2531
|
|
2516
2532
|
if @data['포스트설정']['특정단어굵기'].checked?
|
2517
2533
|
content2 = ''
|
@@ -2551,7 +2567,7 @@ class Wordpress
|
|
2551
2567
|
content = content2
|
2552
2568
|
end
|
2553
2569
|
end
|
2554
|
-
@data['table'][index][-1] =
|
2570
|
+
@data['table'][index][-1] = 50
|
2555
2571
|
@data['table'] << []
|
2556
2572
|
@data['table'].pop
|
2557
2573
|
if @data['포스트설정']['단어크기변경'].checked?
|
@@ -2572,19 +2588,7 @@ class Wordpress
|
|
2572
2588
|
@data['table'][index][-1] = 50
|
2573
2589
|
@data['table'] << []
|
2574
2590
|
@data['table'].pop
|
2575
|
-
|
2576
|
-
gpt_keyword_prompt = @data['포스트설정']['gpt키워드_프롬프트'].text.to_s.force_encoding('utf-8')
|
2577
|
-
gpt_keyword_prompt_sample = gpt_keyword_prompt.strip.empty? ? "프롬프트: 관련된 글을 1500자에서 2500자 사이로 만들어줘" : gpt_keyword_prompt
|
2578
|
-
chat = Chat.new(@data['포스트설정']['api_key'].text.to_s.force_encoding('utf-8'), gpt_keyword_prompt)
|
2579
|
-
gpt_text = chat.message(keyword)
|
2580
|
-
#content = content.to_s + "\n(자동생성글)\n" + gpt_text.to_s
|
2581
|
-
content = content.to_s + "(자동생성글)" + gpt_text.to_s
|
2582
|
-
elsif @data['포스트설정']['내용을자동생성'].checked?
|
2583
|
-
content = auto_text
|
2584
|
-
elsif @data['포스트설정']['내용과자동생성'].checked?
|
2585
|
-
#content = content + "\n(자동생성글)\n" + auto_text
|
2586
|
-
content = content + "(자동생성글)" + auto_text
|
2587
|
-
end
|
2591
|
+
|
2588
2592
|
|
2589
2593
|
if @data['포스트설정']['내용키워드삽입'].checked?
|
2590
2594
|
puts '내용키워드삽입...'
|
@@ -2845,7 +2849,10 @@ class Wordpress
|
|
2845
2849
|
end
|
2846
2850
|
end
|
2847
2851
|
end
|
2852
|
+
|
2848
2853
|
|
2854
|
+
|
2855
|
+
##여기서부터 이미지 순서대로 수정코드 변경####-------------------------------------------------------------------------------
|
2849
2856
|
@data['table'][index][-1] = 70
|
2850
2857
|
@data['table'] << []
|
2851
2858
|
@data['table'].pop
|
@@ -2853,13 +2860,22 @@ class Wordpress
|
|
2853
2860
|
content_memory = content.split('(자동생성글)')
|
2854
2861
|
content = content_memory[0]
|
2855
2862
|
content_end = content_memory[1].to_s
|
2863
|
+
if @data['포스트설정']['gpt키워드'].checked?
|
2864
|
+
if @data['포스트설정']['gpt상단'].checked?
|
2865
|
+
content = "(자동생성글)\n" + content_end + "\n" + content
|
2866
|
+
else
|
2867
|
+
content = content + "\n(자동생성글)\n" + content_end
|
2868
|
+
end
|
2869
|
+
else
|
2870
|
+
content = content + "\n(자동생성글)\n" + content_end
|
2871
|
+
end
|
2856
2872
|
|
2857
2873
|
if @data['포스트설정']['특정단어키워드로변경'].checked?
|
2858
2874
|
@data['포스트설정']['특정단어키워드로변경값'].text.to_s.force_encoding('utf-8').split(',').each do |i|
|
2859
2875
|
content = content.split(i.force_encoding('utf-8')).join(keyword)
|
2860
2876
|
end
|
2861
2877
|
end
|
2862
|
-
|
2878
|
+
|
2863
2879
|
@data['table'][index][-1] = 75
|
2864
2880
|
@data['table'] << []
|
2865
2881
|
@data['table'].pop
|
@@ -2876,12 +2892,7 @@ class Wordpress
|
|
2876
2892
|
ttr = 0
|
2877
2893
|
@data['포스트설정']['단어사진으로변경단어'].text.to_s.force_encoding('utf-8').split(',').each do |i|
|
2878
2894
|
ttr = 1
|
2879
|
-
|
2880
|
-
# if @data['포스트설정']['내용사진링크'].checked?
|
2881
|
-
# 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>')
|
2882
|
-
# else
|
2883
|
-
# content = content.split(i.force_encoding('utf-8')).join('<img src="'+image_url+'" alt="'+keyword+'">')
|
2884
|
-
# end
|
2895
|
+
|
2885
2896
|
content = content.split(i.force_encoding('utf-8'))
|
2886
2897
|
content.each_with_index do |ccm, index3|
|
2887
2898
|
if index3 == content.length-1
|
@@ -2891,6 +2902,7 @@ class Wordpress
|
|
2891
2902
|
if i.force_encoding('utf-8').to_s.include?('@')
|
2892
2903
|
image_memory << ""+'<img src="'+image_url+'" alt="'+keyword+'">'+""
|
2893
2904
|
content[index3] = content[index3] + '**image()**'
|
2905
|
+
|
2894
2906
|
else
|
2895
2907
|
image_memory << ""+ '<img src="'+image_url+'" alt="'+keyword+'">'+""
|
2896
2908
|
content[index3] = content[index3] + '**image**'
|
@@ -2900,6 +2912,8 @@ class Wordpress
|
|
2900
2912
|
content = content.join('')
|
2901
2913
|
end
|
2902
2914
|
end
|
2915
|
+
|
2916
|
+
|
2903
2917
|
|
2904
2918
|
con_memory = Array.new
|
2905
2919
|
index5 = 0
|
@@ -2937,6 +2951,8 @@ class Wordpress
|
|
2937
2951
|
content = content.split(i.force_encoding('utf-8')).join("<sticker></sticker>")
|
2938
2952
|
end
|
2939
2953
|
end
|
2954
|
+
|
2955
|
+
|
2940
2956
|
|
2941
2957
|
if @data['포스트설정']['영상으로변경'].checked?
|
2942
2958
|
if @video.length == 0
|
@@ -2965,36 +2981,79 @@ class Wordpress
|
|
2965
2981
|
# end
|
2966
2982
|
#end
|
2967
2983
|
if @data['포스트설정']['지도로변경'].checked?
|
2968
|
-
# 지도 주소와 사용자 설정 단어들을 가져옵니다.
|
2969
2984
|
map_address = @data['포스트설정']['지도주소'].text.to_s.force_encoding('utf-8')
|
2970
|
-
|
2971
|
-
# 여러 단어로 설정된 '지도로변경단어'를 분리하여 배열로 저장
|
2972
2985
|
change_words = @data['포스트설정']['지도로변경단어'].text.to_s.force_encoding('utf-8').split(',')
|
2973
2986
|
|
2974
|
-
# content를 각 줄로 분할
|
2975
2987
|
content_lines = content.split("\n")
|
2988
|
+
new_lines = []
|
2989
|
+
|
2990
|
+
content_lines.each do |line|
|
2991
|
+
# 이미 처리된 줄은 건너뜀
|
2992
|
+
if line.include?("<koreamap>")
|
2993
|
+
new_lines << line
|
2994
|
+
next
|
2995
|
+
end
|
2996
|
+
|
2997
|
+
processed = false
|
2976
2998
|
|
2977
|
-
content_lines.each_with_index do |line, index|
|
2978
|
-
# 각 단어에 대해 처리
|
2979
2999
|
change_words.each do |change_word|
|
2980
|
-
#
|
2981
|
-
if line.
|
2982
|
-
|
2983
|
-
if
|
2984
|
-
|
2985
|
-
|
2986
|
-
|
2987
|
-
|
2988
|
-
#
|
2989
|
-
|
3000
|
+
# 1. [단어][주소] 패턴 처리: 분리 + 출력
|
3001
|
+
if line =~ /#{Regexp.escape(change_word)}\[(.*?)\]/
|
3002
|
+
match_data = line.match(/(.*)#{Regexp.escape(change_word)}\[(.*?)\](.*)/)
|
3003
|
+
if match_data
|
3004
|
+
before = match_data[1]
|
3005
|
+
address = match_data[2]
|
3006
|
+
after = match_data[3]
|
3007
|
+
|
3008
|
+
# 태그 추출
|
3009
|
+
open_tag = before[/<p[^>]*?>/i] || ""
|
3010
|
+
close_tag = after[/<\/p>/i] || ""
|
3011
|
+
|
3012
|
+
# 텍스트 정리
|
3013
|
+
before_text = before.sub(open_tag, '')
|
3014
|
+
after_text = after.sub(close_tag, '')
|
3015
|
+
|
3016
|
+
# 줄 분리
|
3017
|
+
new_lines << "#{open_tag}#{before_text}</p>" unless before_text.strip.empty?
|
3018
|
+
new_lines << "<koreamap>#{address}</koreamap>"
|
3019
|
+
new_lines << "#{open_tag}#{after_text}#{close_tag}" unless after_text.strip.empty?
|
3020
|
+
|
3021
|
+
processed = true
|
3022
|
+
break
|
2990
3023
|
end
|
2991
3024
|
end
|
3025
|
+
|
3026
|
+
# 2. 일반 단어 처리 (한 줄에만 등장하는 경우)
|
3027
|
+
if !processed && line.include?(change_word)
|
3028
|
+
parts = line.split(change_word, 2)
|
3029
|
+
prefix = parts[0]
|
3030
|
+
suffix = parts[1]
|
3031
|
+
|
3032
|
+
open_tag = prefix[/<p[^>]*?>/i] || ""
|
3033
|
+
close_tag = suffix[/<\/p>/i] || ""
|
3034
|
+
|
3035
|
+
prefix_text = prefix.sub(open_tag, '')
|
3036
|
+
suffix_text = suffix.sub(close_tag, '')
|
3037
|
+
|
3038
|
+
new_lines << "#{open_tag}#{prefix_text}</p>" unless prefix_text.strip.empty?
|
3039
|
+
new_lines << "<koreamap>#{map_address}</koreamap>"
|
3040
|
+
new_lines << "#{open_tag}#{suffix_text}#{close_tag}" unless suffix_text.strip.empty?
|
3041
|
+
|
3042
|
+
processed = true
|
3043
|
+
break
|
3044
|
+
end
|
2992
3045
|
end
|
3046
|
+
|
3047
|
+
# 변경이 없었으면 원래 줄 추가
|
3048
|
+
new_lines << line unless processed
|
2993
3049
|
end
|
2994
3050
|
|
2995
|
-
|
2996
|
-
content = content_lines.join("\n")
|
3051
|
+
content = new_lines.join("\n")
|
2997
3052
|
end
|
3053
|
+
|
3054
|
+
|
3055
|
+
|
3056
|
+
|
2998
3057
|
|
2999
3058
|
if @data['포스트설정']['인용구변경'].checked?
|
3000
3059
|
if @data['포스트설정']['인용구문구설정'].checked?
|
@@ -3032,21 +3091,26 @@ class Wordpress
|
|
3032
3091
|
@data['table'] << []
|
3033
3092
|
@data['table'].pop
|
3034
3093
|
|
3094
|
+
|
3095
|
+
parts = content.split('(자동생성글)', 2)
|
3096
|
+
content_main = parts[0].strip
|
3097
|
+
content_end = parts[1].to_s.strip
|
3098
|
+
|
3035
3099
|
soosick_1 = ''
|
3036
3100
|
soosick_2 = ''
|
3037
3101
|
if @data['포스트설정']['자동글 수식에 입력'].checked?
|
3038
|
-
|
3039
|
-
|
3102
|
+
content = content_main
|
3103
|
+
soosick_1 = content_end
|
3040
3104
|
else
|
3041
|
-
|
3042
|
-
|
3043
|
-
|
3044
|
-
else
|
3045
|
-
content = content+"\n"+content_end+"\n"
|
3046
|
-
end
|
3105
|
+
if @data['포스트설정']['gpt키워드'].checked?
|
3106
|
+
if @data['포스트설정']['gpt상단'].checked?
|
3107
|
+
content = content_end + "\n" + content_main + "\n"
|
3047
3108
|
else
|
3048
|
-
|
3109
|
+
content = content_main + "\n" + content_end + "\n"
|
3049
3110
|
end
|
3111
|
+
else
|
3112
|
+
content = content_main + "\n" + content_end + "\n"
|
3113
|
+
end
|
3050
3114
|
end
|
3051
3115
|
|
3052
3116
|
if @data['포스트설정']['막글삽입'].checked?
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cafe_basics
|
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
|