Permalink
Browse files

Updating function list and documentation generators to pull from the …

…PHP documentation project
  • Loading branch information...
1 parent 7f3fa47 commit c2993d2758b9a77f8f623826af7551b0ef108563 @joshvarner joshvarner committed with Josh Varner Dec 4, 2010
View
@@ -0,0 +1 @@
+/Support/generate/phpdoc
@@ -24,6 +24,13 @@ require ENV['TM_SUPPORT_PATH'] + '/lib/exit_codes'
# ENV['TM_CURRENT_LINE'] = "date('Y-m-d', time() + ONE_MONTH)"
# ENV['TM_LINE_INDEX'] = '23'
+lang = ENV['LANG'] ? ENV['LANG'][0..2] : 'en'
+$fnFilename = ENV['TM_BUNDLE_SUPPORT'] + '/function-docs/' + lang + '.txt'
+
+if !File.exist?($fnFilename)
+ $fnFilename = ENV['TM_BUNDLE_SUPPORT'] + '/function-docs/en.txt'
+end
+
class String
def nbsp
gsub(' ', ' ')
@@ -32,24 +39,24 @@ end
def show_function_and_exit(function, line = nil)
return unless function =~ /^[A-Za-z_][A-Za-z0-9_]*$/
- functions = `grep -i '^#{function}%' "$TM_BUNDLE_SUPPORT"/functions.txt`.split("\n")
+ functions = `grep -i '^#{function}%' "#{$fnFilename}"`.split("\n")
if functions.size == 1
function, prototype, description = functions.pop.split('%')
function = PHPFunction.new(prototype)
+
params = function.params.map do |param|
- html = ''
- html << '<span class="type">' + param[:type] + '</span> '.nbsp unless param[:type].to_s.empty?
- html << param[:name]
- unless param[:default].to_s.empty?
- html << ' = '.nbsp + param[:default]
- end
- html = '<i>' + html + '</i>' if param[:optional]
- html
+ html = ''
+ html << '<span class="type">' + param[:type] + '</span> '.nbsp unless param[:type].to_s.empty?
+ html << param[:name]
+ unless param[:default].to_s.empty?
+ html << ' = '.nbsp + param[:default]
+ end
+ html = '<i>[' + html + ']</i>' if param[:optional]
+ html
end
-
if line
arg = 0
depth = 0
Oops, something went wrong.

0 comments on commit c2993d2

Please sign in to comment.