nblog_zon 111.120.003 → 111.120.005

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 +47 -8
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fe5bf260ce4df25706be5b4c50d08b9b31c50949b0e7ed6c17dbd6dbc566b622
4
- data.tar.gz: 0d4b42bf5d55b0b553c6dede47877dc82b218b49c7deba4c2474cd59ab426cc1
3
+ metadata.gz: b3b94404780022c0989c4af14f8afde18358c17b6854fbbb5da857b6a3b180ee
4
+ data.tar.gz: b5a23c8a6ec9e454ffc0d7ea17fdc9a056479c95833b8bd5b554452282d1a2cf
5
5
  SHA512:
6
- metadata.gz: '0870375b45d3327fc7b74eb96a86ccf16f3c9d0714f1c3f0942174af02a2f3bfcd4703f5f3bedfe7b1db225bec6d26ae9e9db11de602e20f4d486b29b9316482'
7
- data.tar.gz: 3bece6f01d16968e558695f5d457809f90f5ae6c141e7c5ba908fcc34d490027111e8aa9e259d6486e9fc36be1c5963dd03eaeb384b69efc670cff976591b1a7
6
+ metadata.gz: 9b425dba02142d503994d8ff65bb98b60bfc13f1e85af818ca1ac6d7a961029a678a843818d5e68e222c204bd3b082bb093ae4bbf217bd8905b8b173af928ab4
7
+ data.tar.gz: 47ccedbaab3c34c37084e152cbfe9b7dc864026de02ef196fb5acbe15cea91d9f17779cc68ba57a40c0ef59ebb6ec90176a889cd7b71cf9830b2a87c1d1dc0d0
data/lib/nblog_zon.rb CHANGED
@@ -22,6 +22,7 @@ require 'httpclient'
22
22
  include AutoClickMethods
23
23
  using Rainbow
24
24
  include Glimmer
25
+
25
26
  class Chat
26
27
  def initialize(api_key, gpt_keyword_prompt, model)
27
28
  @api_key = api_key
@@ -3879,15 +3880,34 @@ class Wordpress
3879
3880
  # title = content.split("\n")[0]
3880
3881
  #end
3881
3882
  if @data['포스트설정']['내용첫줄제목에입력'].checked?
3882
- # 콘텐츠를 줄 단위로 분리
3883
3883
  content_lines = content.split("\n")
3884
-
3885
- # 번째 줄이 <img src=로 시작하는지 확인하고, 시작하는 경우 두 번째 줄부터 확인
3886
- title = content_lines.find { |line| !line.start_with?('<img src=') }
3887
-
3888
- # 만약 첫 번째 줄부터 <img src=로 시작하는 경우, 두 번째 줄을 제목으로 설정
3889
- title ||= content_lines[1] # 첫 번째 줄이 <img src=일 경우 두 번째 줄을 사용
3890
-
3884
+
3885
+ title = content_lines.find do |line|
3886
+ line = line.strip
3887
+ !line.empty? && !line.start_with?('<img src=')
3888
+ end
3889
+
3890
+ title ||= content_lines[1]
3891
+
3892
+ if title
3893
+ # 마침표(.) 포함 첫 문장 추출
3894
+ first_part = title[/.*?\./]
3895
+ first_part = first_part ? first_part.strip : title.strip
3896
+
3897
+ # 200bytes 제한 (한글 100자 내외)
3898
+ bytes_limit = 200
3899
+ truncated = ""
3900
+ current_bytes = 0
3901
+
3902
+ first_part.each_char do |char|
3903
+ char_bytes = char.bytesize
3904
+ break if current_bytes + char_bytes > bytes_limit
3905
+ truncated << char
3906
+ current_bytes += char_bytes
3907
+ end
3908
+
3909
+ title = truncated
3910
+ end
3891
3911
  end
3892
3912
 
3893
3913
  if @data['포스트설정']['제목을내용첫줄입력'].checked?
@@ -3920,6 +3940,25 @@ class Wordpress
3920
3940
  @data['table'] << []
3921
3941
  @data['table'].pop
3922
3942
 
3943
+ # content를 줄 단위로 쪼갬
3944
+ lines = content.lines
3945
+
3946
+ # 맨 앞부터 빈 줄(공백 또는 빈 문자열) 갯수 계산
3947
+ empty_line_count = 0
3948
+ lines.each do |line|
3949
+ if line.strip.empty?
3950
+ empty_line_count += 1
3951
+ else
3952
+ break
3953
+ end
3954
+ end
3955
+
3956
+ # 앞 빈 줄 제거
3957
+ lines = lines.drop(empty_line_count)
3958
+
3959
+ # 다시 content로 합침
3960
+ content = lines.join
3961
+
3923
3962
  dd_time = @data['table'][index][10].to_s.force_encoding('utf-8').to_i
3924
3963
  #template_no = @data['table'][index][7].to_s.force_encoding('utf-8').to_i
3925
3964
  naver.update(title,content,option,soosick_1,soosick_2, dd_time)
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.120.003
4
+ version: 111.120.005
5
5
  platform: ruby
6
6
  authors:
7
7
  - zon
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 2025-06-26 00:00:00.000000000 Z
10
+ date: 2025-07-02 00:00:00.000000000 Z
11
11
  dependencies: []
12
12
  description: File to Clipboard gem
13
13
  email: rnjstnswp123@naver.com