nblog_zon 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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/nblog_zon.rb +105 -44
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 12b41759a6005b39dfc1b2c867c7f4a48bc0c1c975973baef98d8503937f03be
4
- data.tar.gz: cf03b591242b7514d3086224499551e4562a77401917fe3689621c331c312664
3
+ metadata.gz: 25ed13d86ba37e1d7148f3f244e32f4e09ccad595dbd05b010bb7df959962356
4
+ data.tar.gz: 63fd6e53b871e37661d6f2561a447b73ab6b2508bebc007fdfdfc04d860f3577
5
5
  SHA512:
6
- metadata.gz: 9baef2b794c44c2b3311fd7e84a1608b54c278f6658b36318ffce4a1093aef0df76013ec3673a052d5be9db0e86157781c2234a291b4bcf1c63a1c6191247c54
7
- data.tar.gz: e456183f6f1c6a51207fc19d6b1d4435e87c8933501fab2cad3ce8a1ab60644cb11ed0ef3cb98fbf042841829d42059a0fbe548184761f9e3af451039f567766
6
+ metadata.gz: e4c3b6d7863487e9b4a54be4979c8ce1721c51849085a21248fbe075f31254def552485e803b1d868fdc43d4f254137a64d15c8001b4c51f28fc3bda9058d4ec
7
+ data.tar.gz: 0cbddb5f47a301779b0bca6d1ece6f557e2260bd37ad62111e1ff46d8f9c43beabb35fc1116c21fa770fc15abf27698e23edebbab1fa92a9e9c48eaed5fffa5e
data/lib/nblog_zon.rb CHANGED
@@ -2735,6 +2735,22 @@ class Wordpress
2735
2735
  @data['table'].pop
2736
2736
  #제목끝
2737
2737
  # content = " #{content} "
2738
+ if @data['포스트설정']['gpt키워드'].checked?
2739
+ gpt_keyword_prompt = @data['포스트설정']['gpt키워드_프롬프트'].text.to_s.force_encoding('utf-8')
2740
+ gpt_keyword_prompt_sample = gpt_keyword_prompt.strip.empty? ? "프롬프트: 관련된 글을 1500자에서 2500자 사이로 만들어줘" : gpt_keyword_prompt
2741
+ chat = Chat.new(@data['포스트설정']['api_key'].text.to_s.force_encoding('utf-8'), gpt_keyword_prompt)
2742
+ gpt_text = chat.message(keyword)
2743
+ #content = content.to_s + "\n(자동생성글)\n" + gpt_text.to_s
2744
+ content = content.to_s + "(자동생성글)" + gpt_text.to_s
2745
+ elsif @data['포스트설정']['내용을자동생성'].checked?
2746
+ content = auto_text
2747
+ elsif @data['포스트설정']['내용과자동생성'].checked?
2748
+ #content = content + "\n(자동생성글)\n" + auto_text
2749
+ content = content + "(자동생성글)" + auto_text
2750
+ end
2751
+ @data['table'][index][-1] = 45
2752
+ @data['table'] << []
2753
+ @data['table'].pop
2738
2754
 
2739
2755
  if @data['포스트설정']['특정단어굵기'].checked?
2740
2756
  content2 = ''
@@ -2774,7 +2790,7 @@ class Wordpress
2774
2790
  content = content2
2775
2791
  end
2776
2792
  end
2777
- @data['table'][index][-1] = 35
2793
+ @data['table'][index][-1] = 50
2778
2794
  @data['table'] << []
2779
2795
  @data['table'].pop
2780
2796
  if @data['포스트설정']['단어크기변경'].checked?
@@ -2795,19 +2811,7 @@ class Wordpress
2795
2811
  @data['table'][index][-1] = 50
2796
2812
  @data['table'] << []
2797
2813
  @data['table'].pop
2798
- if @data['포스트설정']['gpt키워드'].checked?
2799
- gpt_keyword_prompt = @data['포스트설정']['gpt키워드_프롬프트'].text.to_s.force_encoding('utf-8')
2800
- gpt_keyword_prompt_sample = gpt_keyword_prompt.strip.empty? ? "프롬프트: 관련된 글을 1500자에서 2500자 사이로 만들어줘" : gpt_keyword_prompt
2801
- chat = Chat.new(@data['포스트설정']['api_key'].text.to_s.force_encoding('utf-8'), gpt_keyword_prompt)
2802
- gpt_text = chat.message(keyword)
2803
- #content = content.to_s + "\n(자동생성글)\n" + gpt_text.to_s
2804
- content = content.to_s + "(자동생성글)" + gpt_text.to_s
2805
- elsif @data['포스트설정']['내용을자동생성'].checked?
2806
- content = auto_text
2807
- elsif @data['포스트설정']['내용과자동생성'].checked?
2808
- #content = content + "\n(자동생성글)\n" + auto_text
2809
- content = content + "(자동생성글)" + auto_text
2810
- end
2814
+
2811
2815
 
2812
2816
  if @data['포스트설정']['내용키워드삽입'].checked?
2813
2817
  puts '내용키워드삽입...'
@@ -3079,6 +3083,15 @@ class Wordpress
3079
3083
  content_memory = content.split('(자동생성글)')
3080
3084
  content = content_memory[0]
3081
3085
  content_end = content_memory[1].to_s
3086
+ if @data['포스트설정']['gpt키워드'].checked?
3087
+ if @data['포스트설정']['gpt상단'].checked?
3088
+ content = "(자동생성글)\n" + content_end + "\n" + content
3089
+ else
3090
+ content = content + "\n(자동생성글)\n" + content_end
3091
+ end
3092
+ else
3093
+ content = content + "\n(자동생성글)\n" + content_end
3094
+ end
3082
3095
 
3083
3096
  if @data['포스트설정']['특정단어키워드로변경'].checked?
3084
3097
  @data['포스트설정']['특정단어키워드로변경값'].text.to_s.force_encoding('utf-8').split(',').each do |i|
@@ -3167,8 +3180,8 @@ class Wordpress
3167
3180
  slide_names_only = slide_images.map { |pair| pair[1] }.join(' ')
3168
3181
 
3169
3182
  # 각각 <slide>와 <slide1> 태그로 감싸기
3170
- slide_html_full = "<slide>" + slide_full_paths + "</slide>"
3171
- slide_html_names = "<slide1>" + slide_names_only + "</slide1>"
3183
+ slide_html_full = "\n<slide>" + slide_full_paths + "</slide>\n"
3184
+ slide_html_names = "\n<slide1>" + slide_names_only + "</slide1>\n"
3172
3185
 
3173
3186
  # 두 태그를 content에 추가
3174
3187
  content[index3] = content[index3] + slide_html_full
@@ -3244,36 +3257,79 @@ class Wordpress
3244
3257
  # end
3245
3258
  #end
3246
3259
  if @data['포스트설정']['지도로변경'].checked?
3247
- # 지도 주소와 사용자 설정 단어들을 가져옵니다.
3248
3260
  map_address = @data['포스트설정']['지도주소'].text.to_s.force_encoding('utf-8')
3249
-
3250
- # 여러 단어로 설정된 '지도로변경단어'를 분리하여 배열로 저장
3251
3261
  change_words = @data['포스트설정']['지도로변경단어'].text.to_s.force_encoding('utf-8').split(',')
3252
3262
 
3253
- # content를 각 줄로 분할
3254
3263
  content_lines = content.split("\n")
3264
+ new_lines = []
3265
+
3266
+ content_lines.each do |line|
3267
+ # 이미 처리된 줄은 건너뜀
3268
+ if line.include?("<koreamap>")
3269
+ new_lines << line
3270
+ next
3271
+ end
3272
+
3273
+ processed = false
3255
3274
 
3256
- content_lines.each_with_index do |line, index|
3257
- # 각 단어에 대해 처리
3258
3275
  change_words.each do |change_word|
3259
- # 'change_word'가 포함된 줄에 대해서만 처리
3260
- if line.include?(change_word)
3261
- # 설정된 단어 뒤에 괄호가 있는지 확인
3262
- if line.include?("[") && line.include?("]")
3263
- # 괄호 안의 주소를 찾아서 그 주소는 그대로 두고, 지도로 변경된 주소로 교체
3264
- address_in_brackets = line.match(/\[(.*?)\]/)[1] # 괄호 안의 주소를 추출
3265
- content_lines[index] = "<koreamap>#{address_in_brackets}</koreamap>"
3266
- else
3267
- # 괄호가 없다면 @data['포스트설정']['지도주소']를 추가
3268
- content_lines[index] = "<koreamap>#{map_address}</koreamap>"
3276
+ # 1. [단어][주소] 패턴 처리: 분리 + 출력
3277
+ if line =~ /#{Regexp.escape(change_word)}\[(.*?)\]/
3278
+ match_data = line.match(/(.*)#{Regexp.escape(change_word)}\[(.*?)\](.*)/)
3279
+ if match_data
3280
+ before = match_data[1]
3281
+ address = match_data[2]
3282
+ after = match_data[3]
3283
+
3284
+ # 태그 추출
3285
+ open_tag = before[/<p[^>]*?>/i] || ""
3286
+ close_tag = after[/<\/p>/i] || ""
3287
+
3288
+ # 텍스트 정리
3289
+ before_text = before.sub(open_tag, '')
3290
+ after_text = after.sub(close_tag, '')
3291
+
3292
+ # 줄 분리
3293
+ new_lines << "#{open_tag}#{before_text}</p>" unless before_text.strip.empty?
3294
+ new_lines << "<koreamap>#{address}</koreamap>"
3295
+ new_lines << "#{open_tag}#{after_text}#{close_tag}" unless after_text.strip.empty?
3296
+
3297
+ processed = true
3298
+ break
3269
3299
  end
3270
3300
  end
3301
+
3302
+ # 2. 일반 단어 처리 (한 줄에만 등장하는 경우)
3303
+ if !processed && line.include?(change_word)
3304
+ parts = line.split(change_word, 2)
3305
+ prefix = parts[0]
3306
+ suffix = parts[1]
3307
+
3308
+ open_tag = prefix[/<p[^>]*?>/i] || ""
3309
+ close_tag = suffix[/<\/p>/i] || ""
3310
+
3311
+ prefix_text = prefix.sub(open_tag, '')
3312
+ suffix_text = suffix.sub(close_tag, '')
3313
+
3314
+ new_lines << "#{open_tag}#{prefix_text}</p>" unless prefix_text.strip.empty?
3315
+ new_lines << "<koreamap>#{map_address}</koreamap>"
3316
+ new_lines << "#{open_tag}#{suffix_text}#{close_tag}" unless suffix_text.strip.empty?
3317
+
3318
+ processed = true
3319
+ break
3320
+ end
3271
3321
  end
3322
+
3323
+ # 변경이 없었으면 원래 줄 추가
3324
+ new_lines << line unless processed
3272
3325
  end
3273
3326
 
3274
- # 다시 content로 합치기
3275
- content = content_lines.join("\n")
3327
+ content = new_lines.join("\n")
3276
3328
  end
3329
+
3330
+
3331
+
3332
+
3277
3333
 
3278
3334
  if @data['포스트설정']['인용구변경'].checked?
3279
3335
  if @data['포스트설정']['인용구문구설정'].checked?
@@ -3311,21 +3367,26 @@ class Wordpress
3311
3367
  @data['table'] << []
3312
3368
  @data['table'].pop
3313
3369
 
3370
+
3371
+ parts = content.split('(자동생성글)', 2)
3372
+ content_main = parts[0].strip
3373
+ content_end = parts[1].to_s.strip
3374
+
3314
3375
  soosick_1 = ''
3315
3376
  soosick_2 = ''
3316
3377
  if @data['포스트설정']['자동글 수식에 입력'].checked?
3317
- content = content
3318
- soosick_1 = content_end
3378
+ content = content_main
3379
+ soosick_1 = content_end
3319
3380
  else
3320
- if @data['포스트설정']['gpt키워드'].checked?
3321
- if @data['포스트설정']['gpt상단'].checked?
3322
- content = content_end+"\n"+content+"\n"
3323
- else
3324
- content = content+"\n"+content_end+"\n"
3325
- end
3381
+ if @data['포스트설정']['gpt키워드'].checked?
3382
+ if @data['포스트설정']['gpt상단'].checked?
3383
+ content = content_end + "\n" + content_main + "\n"
3326
3384
  else
3327
- content = content+"\n"+content_end+"\n"
3385
+ content = content_main + "\n" + content_end + "\n"
3328
3386
  end
3387
+ else
3388
+ content = content_main + "\n" + content_end + "\n"
3389
+ end
3329
3390
  end
3330
3391
 
3331
3392
  if @data['포스트설정']['막글삽입'].checked?
@@ -3495,7 +3556,7 @@ class Wordpress
3495
3556
  dd_time = @data['table'][index][10].to_s.force_encoding('utf-8').to_i
3496
3557
  #template_no = @data['table'][index][7].to_s.force_encoding('utf-8').to_i
3497
3558
  naver.update(title,content,option,soosick_1,soosick_2, dd_time)
3498
-
3559
+
3499
3560
 
3500
3561
  # if @data['포스트설정']['태그삽입2'].checked?
3501
3562
  # snumber = @data['포스트설정']['태그삽입2시작숫자'].text.to_s.force_encoding('utf-8').to_i
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nblog_zon
3
3
  version: !ruby/object:Gem::Version
4
- version: 111.113.777
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-17 00:00:00.000000000 Z
10
+ date: 2025-04-24 00:00:00.000000000 Z
11
11
  dependencies: []
12
12
  description: File to Clipboard gem
13
13
  email: rnjstnswp123@naver.com