prompt_manager 0.5.1 → 0.5.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2aca1f240d8875e6b39eb7865755c8023b1ddd4ba92cf4c9afe87f5d9be9d8c9
4
- data.tar.gz: 37a50393b556f8947336d0c74a97d423eb512c12ae68f8e3b9da3ab5e4bb3652
3
+ metadata.gz: 9520d380488f2d4ef62d07dfc4a9b27bcc66086f5adb1f2d6fa874e8e179cfd3
4
+ data.tar.gz: 1df0ea5efe721cd24293ed2172a72406b0e649e61a6778bb25615121c0ab39cb
5
5
  SHA512:
6
- metadata.gz: 7bcaf2474a6c7f32f46f9fed7dca357863fe66cd4bc23300bb608347ceb31f60a9cbf0c542fa2feb43e557667f2624c4317ace50d0fb6c01bf73dcdbea8fac1b
7
- data.tar.gz: 7dca847777e8f70b7df180fc4082f393afb208c94f837b3739365df86abb748c92449bb9240ee490f72939d6c3ba92b3d3c4cc57bc00758498f57adacbd7632b
6
+ metadata.gz: ed5b5fdb6592797bd3bb5a564f13235360e8fde690e0781d51b39deb5f2d26590173bc2257f78dae132d2d91b12c27bf246d392c7cb9a84b1f22c1b409b88004
7
+ data.tar.gz: 76425c4b30f68977dd4e16513c53bac2bc84e277e7e209dc1eb57f5f9f2267d23b354fd8d2fe79f871c05c0672198b53db4fe687b38966350c1aa0540e158913
@@ -114,12 +114,35 @@ class PromptManager::Prompt
114
114
 
115
115
  def db = self.class.storage_adapter
116
116
 
117
+
117
118
  def remove_comments
118
- lines = @text.split("\n")
119
+ lines = @text.gsub(/<!--.*?-->/m, '').lines(chomp: true)
120
+ markdown_block_depth = 0
121
+ filtered_lines = []
119
122
  end_index = lines.index("__END__") || lines.size
120
- lines[0...end_index].reject { |line| line.strip.start_with?(COMMENT_SIGNAL) }.join("\n")
123
+
124
+ lines[0...end_index].each do |line|
125
+ trimmed_line = line.strip
126
+
127
+ if trimmed_line.start_with?('```')
128
+ if trimmed_line == '```markdown'
129
+ markdown_block_depth += 1
130
+ elsif markdown_block_depth > 0
131
+ markdown_block_depth -= 1
132
+ end
133
+ end
134
+
135
+ if markdown_block_depth > 0 || !trimmed_line.start_with?(COMMENT_SIGNAL)
136
+ filtered_lines << line
137
+ end
138
+ end
139
+
140
+ filtered_lines.join("\n")
121
141
  end
122
142
 
143
+
144
+
145
+
123
146
  def substitute_values(input_text, values_hash)
124
147
  if values_hash.is_a?(Hash) && !values_hash.empty?
125
148
  values_hash.each do |key, value|
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module PromptManager
4
- VERSION = "0.5.1"
4
+ VERSION = "0.5.2"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: prompt_manager
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.1
4
+ version: 0.5.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dewayne VanHoozer