lib/slack/smart-bot/utils/build_help.rb in slack-smart-bot-1.9.2 vs lib/slack/smart-bot/utils/build_help.rb in slack-smart-bot-1.10.0
- old
+ new
@@ -7,12 +7,12 @@
elsif File.exist?(path)
files = [path]
else
return help_message
end
-
files.each do |t|
+
if Dir.exist?(t)
res = build_help(t, expanded)
help_message[:master][t.scan(/\/(\w+)$/).join.to_sym] = res[:master]
help_message[:admin][t.scan(/\/(\w+)$/).join.to_sym] = res[:admin]
help_message[:normal][t.scan(/\/(\w+)$/).join.to_sym] = res[:normal]
@@ -48,11 +48,11 @@
resf += "\n#{line}"
command_done = true
elsif !explanation_done and line.match?(/^\s+[^`].+\s*/i)
resf += "\n#{line}"
explanation_done = true
- elsif !example_done and line.match?(/^\s*_.+_\s*/i)
- resf += "\n Example: #{line}"
+ elsif !example_done and line.match?(/^\s*>?\s*_.+_\s*$/i)
+ resf += "\n Example: #{line.gsub(/^\s*>/,'')}"
example_done = true
end
end
resf += "\n\n"
help_message[key][t.scan(/\/(\w+)\.rb$/).join.to_sym] = resf