From 3c233131f2d56b57eecd156b4603de70738edfdd Mon Sep 17 00:00:00 2001 From: adrian Date: Fri, 3 Feb 2012 19:16:11 +0200 Subject: [PATCH] updated API script --- scripts/python/nasal_api.py | 45 +++++++++++++++++++++++++------------ 1 file changed, 31 insertions(+), 14 deletions(-) diff --git a/scripts/python/nasal_api.py b/scripts/python/nasal_api.py index 983cc719f..51b82ce9b 100755 --- a/scripts/python/nasal_api.py +++ b/scripts/python/nasal_api.py @@ -29,6 +29,7 @@ The API doc in HTML format is generated in the current working directory""" ########### Local $FGROOT/Nasal/ path ########## NASAL_PATH="../fgfs/fgdata/Nasal/" + def get_files(nasal_dir): if nasal_dir[-1]!='/': @@ -38,7 +39,9 @@ def get_files(nasal_dir): except: print "The path does not exist" sys.exit() - + fgroot_dir = nasal_dir.rstrip('/').replace('Nasal','') + f_version = open(fgroot_dir+'version','rb') + version = f_version.read(256).rstrip('\n') top_level = [] modules = [] top_namespaces = [] @@ -66,17 +69,31 @@ def get_files(nasal_dir): functions=parse_file(f) top_namespaces.append([m,functions]) - output_text(top_namespaces,modules) + output_text(top_namespaces,modules,version) -def output_text(top_namespaces,modules): +def output_text(top_namespaces,modules,version): fw=open('./nasal_api.html','wb') buf='\ Nasal API\ - ' + \n\ + ' - buf+='

Nasal $FGROOT Library

\n
 ' + buf+='

\ + Nasal $FGROOT Library
Flightgear version: '+version+'\ +
This file is generated automatically by scripts/python/nasal_api.py\ +

\ +
Nasal documentation  \ + Flightgear Nasal documentation\n
 ' buf+='

\n' done=[] for namespace in top_namespaces: @@ -84,14 +101,14 @@ def output_text(top_namespaces,modules): if namespace[0] in modules: color='cc0000' if namespace[0] not in done: - buf+=''+namespace[0]+' 
\n' + buf+=''+namespace[0]+' 
\n' done.append(namespace[0]) buf+='

\n' done2=[] for namespace in top_namespaces: if namespace[0] not in done2: - buf+='
\n' - buf += '

'+namespace[0]+'

\n' + buf+='