OpenLayers OpenLayers

Changeset 3353

Show
Ignore:
Timestamp:
06/17/07 09:21:09 (1 year ago)
Author:
crschmidt
Message:

add optparse support to html_docs, and add docstring to output (don't know how
I missed that one...)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • sandbox/crschmidt/docs/tools/class_template.html

    r3349 r3353  
    6060    #for $prop in $class[$i.lower()]: 
    6161        <div id="$prop['name']"> 
    62         <b>$prop['name']</b><br /> 
     62        <b>$prop['name']</b> 
     63        <p>$prop['docstring']</p> 
    6364        #if $prop['info'].has_key('function_sig'): 
    6465          Function signature: <b>$prop['info']['function_sig']</b><br /> 
  • sandbox/crschmidt/docs/tools/html_docs.py

    r3349 r3353  
    33import os 
    44 
    5  
    6 out_dir = "docs" 
    7 web_out = "http://crschmidt.net/~crschmidt/docs/" 
    8  
     5from optparse import OptionParser 
     6parser = OptionParser() 
     7parser.add_option("--js", dest="js_files", help="Location of Javascript files", default="../lib/OpenLayers") 
     8parser.add_option("--web", dest="web_location", help="Absolute path of output HTML", default="/docs/") 
     9parser.add_option("--dir", dest="local_dir", help="Relative filesystem path of output", default="docs") 
     10parser.add_option("--template_dir", dest="template_dir", help="Location of doc templates", default=".") 
     11(options, args) = parser.parse_args() 
    912out = {}  
    1013 
    11 for root, dirs, files  in os.walk('../lib/OpenLayers'): 
     14for root, dirs, files  in os.walk(options.js_files): 
    1215    for filename in files: 
    1316        file = os.path.join(root, filename) 
     
    1619            out.update(docs.extract_docs_from_file(file)) 
    1720 
    18 keys = out.keys() 
     21keys = out.keys() 
    1922keys.sort() 
    2023for key in keys: 
    2124    out_filename = "OpenLayers/%s.html" % "/".join(key.split("."))   
    22     if not os.access("%s/%s" % (out_dir, "/".join(out_filename.split("/")[0:-1])), os.R_OK): 
    23         os.makedirs("%s/%s" % (out_dir, "/".join(out_filename.split("/")[0:-1]))) 
    24     fh = open("%s/%s" % (out_dir, out_filename), "w") 
    25     data = str(Template( file = "class_template.html",  searchList=[{'web_base':web_out, 'name':key, 'class': out[key]}])) 
     25    if not os.access("%s/%s" % (options.local_dir, "/".join(out_filename.split("/")[0:-1])), os.R_OK): 
     26        os.makedirs("%s/%s" % (options.local_dir, "/".join(out_filename.split("/")[0:-1]))) 
     27    fh = open("%s/%s" % (options.local_dir, out_filename), "w") 
     28    data = str(Template( file = "%s/class_template.html" % options.template_dir,  searchList=[{'web_base':options.web_location, 'name':key, 'class': out[key]}])) 
    2629    fh.write(data) 
    2730    fh.close() 
     
    3033 
    3134for key in keys: 
    32     html += "<li><a href='/~crschmidt/docs/OpenLayers/%s.html'>OpenLayers.%s</a>" %  (key.replace(".", "/"), key) 
     35    html += "<li><a href='OpenLayers/%s.html'>OpenLayers.%s</a>" %  (key.replace(".", "/"), key) 
    3336 
    3437html += "</ul>" 
    3538 
    36 fh = open("docs/index.html","w") 
     39fh = open("%s/index.html" % options.local_dir,"w") 
    3740fh.write(html) 
    3841fh.close()