@ -221,32 +221,41 @@ def processApiDoc(parts, funcname, testrefs, used_tags):
# the 'hidechar' span is to allow browser search without showing the char
# the 'hidechar' span is to allow browser search without showing the char
res . append ( ' <h1 id= " %s " ><a href= " # %s " ><span class= " hidechar " >.</span> %s ()</a></h1> ' % ( funcname , funcname , funcname ) )
res . append ( ' <h1 id= " %s " ><a href= " # %s " ><span class= " hidechar " >.</span> %s ()</a></h1> ' % ( funcname , funcname , funcname ) )
res . append ( ' <div class= " api-call " > ' )
if parts . has_key ( ' proto ' ) :
if parts . has_key ( ' proto ' ) :
p = parts [ ' proto ' ]
p = parts [ ' proto ' ]
res . append ( ' <div class= " api-part " > ' )
res . append ( ' <h2 class= " api-proto " >Prototype</h2> ' )
res . append ( ' <h2 class= " api-proto " >Prototype</h2> ' )
res . append ( ' <pre class= " c-code " > ' )
res . append ( ' <pre class= " c-code " > ' )
for i in p :
for i in p :
res . append ( htmlEscape ( i ) )
res . append ( htmlEscape ( i ) )
res . append ( ' </pre> ' )
res . append ( ' </pre> ' )
res . append ( ' </div> ' ) # api-part
res . append ( ' ' )
res . append ( ' ' )
else :
else :
pass
pass
if parts . has_key ( ' stack ' ) :
if parts . has_key ( ' stack ' ) :
p = parts [ ' stack ' ]
p = parts [ ' stack ' ]
res . append ( ' <div class= " api-part " > ' )
res . append ( ' <h2 class= " api-stack " >Stack</h2> ' )
res . append ( ' <h2 class= " api-stack " >Stack</h2> ' )
for line in p :
for line in p :
res . append ( ' <pre class= " stack " > ' + \
res . append ( ' <pre class= " stack " > ' + \
' %s ' % htmlEscape ( line ) + \
' %s ' % htmlEscape ( line ) + \
' </pre> ' )
' </pre> ' )
res . append ( ' </div> ' )
res . append ( ' ' )
res . append ( ' ' )
else :
else :
res . append ( ' <div class= " api-part " > ' )
res . append ( ' <h2 class= " api-stack " >Stack</h2> ' )
res . append ( ' <h2 class= " api-stack " >Stack</h2> ' )
res . append ( ' <p>(No effect on value stack.)</p> ' )
res . append ( ' <p>(No effect on value stack.)</p> ' )
res . append ( ' </div> ' ) # api-part
res . append ( ' ' )
res . append ( ' ' )
if parts . has_key ( ' summary ' ) :
if parts . has_key ( ' summary ' ) :
p = parts [ ' summary ' ]
p = parts [ ' summary ' ]
res . append ( ' <div class= " api-part " > ' )
res . append ( ' <h2 class= " api-summary " >Summary</h2> ' )
res . append ( ' <h2 class= " api-summary " >Summary</h2> ' )
# If text contains a '<p>', assume it is raw HTML; otherwise
# If text contains a '<p>', assume it is raw HTML; otherwise
@ -266,26 +275,33 @@ def processApiDoc(parts, funcname, testrefs, used_tags):
for i in p :
for i in p :
res . append ( htmlEscape ( i ) )
res . append ( htmlEscape ( i ) )
res . append ( ' </p> ' )
res . append ( ' </p> ' )
res . append ( ' </div> ' ) # api-part
res . append ( ' ' )
res . append ( ' ' )
if parts . has_key ( ' example ' ) :
if parts . has_key ( ' example ' ) :
p = parts [ ' example ' ]
p = parts [ ' example ' ]
res . append ( ' <div class= " api-part " > ' )
res . append ( ' <h2 class= " api-example " >Example</h2> ' )
res . append ( ' <h2 class= " api-example " >Example</h2> ' )
res . append ( ' <pre class= " c-code " > ' )
res . append ( ' <pre class= " c-code " > ' )
for i in p :
for i in p :
res . append ( htmlEscape ( i ) )
res . append ( htmlEscape ( i ) )
res . append ( ' </pre> ' )
res . append ( ' </pre> ' )
res . append ( ' </div> ' ) # api-part
res . append ( ' ' )
res . append ( ' ' )
if parts . has_key ( ' seealso ' ) :
if parts . has_key ( ' seealso ' ) :
p = parts [ ' seealso ' ]
p = parts [ ' seealso ' ]
res . append ( ' <div class= " api-part " > ' )
res . append ( ' <h2 class= " api-seealso " >See also</h2> ' )
res . append ( ' <h2 class= " api-seealso " >See also</h2> ' )
res . append ( ' <ul> ' )
res . append ( ' <ul> ' )
for i in p :
for i in p :
res . append ( ' <li><a href= " # %s " > %s </a></li> ' % ( htmlEscape ( i ) , htmlEscape ( i ) ) )
res . append ( ' <li><a href= " # %s " > %s </a></li> ' % ( htmlEscape ( i ) , htmlEscape ( i ) ) )
res . append ( ' </ul> ' )
res . append ( ' </ul> ' )
res . append ( ' </div> ' ) # api-part
res . append ( ' ' )
if testcase_refs :
if testcase_refs :
res . append ( ' <div class= " api-part " > ' )
res . append ( ' <h2 class= " api-testcases " >Related test cases</h2> ' )
res . append ( ' <h2 class= " api-testcases " >Related test cases</h2> ' )
if testrefs . has_key ( funcname ) :
if testrefs . has_key ( funcname ) :
res . append ( ' <ul> ' )
res . append ( ' <ul> ' )
@ -294,12 +310,15 @@ def processApiDoc(parts, funcname, testrefs, used_tags):
res . append ( ' </ul> ' )
res . append ( ' </ul> ' )
else :
else :
res . append ( ' <p>None.</p> ' )
res . append ( ' <p>None.</p> ' )
res . append ( ' </div> ' ) # api-part
res . append ( ' ' )
if not testrefs . has_key ( funcname ) :
if not testrefs . has_key ( funcname ) :
res . append ( ' <div class= " fixme " >This API call has no test cases.</div> ' )
res . append ( ' <div class= " fixme " >This API call has no test cases.</div> ' )
if list_tags and parts . has_key ( ' tags ' ) :
if list_tags and parts . has_key ( ' tags ' ) :
# FIXME: placeholder
# FIXME: placeholder
res . append ( ' <div class= " api-part " > ' )
res . append ( ' <h2 class= " api-tags " >Tags</h2> ' )
res . append ( ' <h2 class= " api-tags " >Tags</h2> ' )
res . append ( ' <p> ' )
res . append ( ' <p> ' )
p = parts [ ' tags ' ]
p = parts [ ' tags ' ]
@ -308,6 +327,7 @@ def processApiDoc(parts, funcname, testrefs, used_tags):
res . append ( ' ' )
res . append ( ' ' )
res . append ( htmlEscape ( val ) )
res . append ( htmlEscape ( val ) )
res . append ( ' </p> ' )
res . append ( ' </p> ' )
res . append ( ' </div> ' ) # api-part
res . append ( ' ' )
res . append ( ' ' )
if parts . has_key ( ' fixme ' ) :
if parts . has_key ( ' fixme ' ) :
@ -318,6 +338,7 @@ def processApiDoc(parts, funcname, testrefs, used_tags):
res . append ( ' </div> ' )
res . append ( ' </div> ' )
res . append ( ' ' )
res . append ( ' ' )
res . append ( ' </div> ' ) # api-call div
return res
return res
def processRawDoc ( filename ) :
def processRawDoc ( filename ) :