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 +4 -4
- data/lib/prompt_manager/prompt.rb +25 -2
- data/lib/prompt_manager/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9520d380488f2d4ef62d07dfc4a9b27bcc66086f5adb1f2d6fa874e8e179cfd3
|
4
|
+
data.tar.gz: 1df0ea5efe721cd24293ed2172a72406b0e649e61a6778bb25615121c0ab39cb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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.
|
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
|
-
|
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|
|