html tag updates

This commit is contained in:
Chris PeBenito 2005-06-10 20:39:41 +00:00
parent bef4f00aa9
commit e214f62733
6 changed files with 60 additions and 20 deletions

View File

@ -1,5 +1,7 @@
<!ENTITY % inline.class "pre|p|ul|li">
<!ELEMENT policy (module+,tunable*)>
<!ELEMENT module (summary,interface+)>
<!ELEMENT module (summary,description,interface+)>
<!ATTLIST module
name CDATA #REQUIRED
layer CDATA #REQUIRED>
@ -8,7 +10,7 @@
name CDATA #REQUIRED
dftval CDATA #REQUIRED>
<!ELEMENT summary (#PCDATA)>
<!ELEMENT interface (description,securitydesc*,parameter+,infoflow?)>
<!ELEMENT interface (summary,description,securitydesc*,parameter+,infoflow)>
<!ATTLIST interface name CDATA #REQUIRED>
<!ELEMENT description (#PCDATA)>
<!ELEMENT securitydesc (#PCDATA)>
@ -20,3 +22,7 @@
<!ATTLIST infoflow
type CDATA #REQUIRED
weight CDATA #IMPLIED>
<!ELEMENT p (#PCDATA|%inline.class;)*>
<!ELEMENT ul (li+)>
<!ELEMENT li (#PCDATA|%inline.class;|ul|ol)*>

View File

@ -24,8 +24,10 @@ Layer: <a href='[[int['mod_layer']]].html'>
[[end]]
)<br>
</div>
<pre>
[[int['interface_desc']]]<br><br>
</pre>
[[if int['interface_summary']]]
<div id="description">
[[int['interface_summary']]]
</div>
[[end]]
</div>
[[end]]

View File

@ -24,12 +24,15 @@
[[end]]
)<br>
</div>
[[if int['interface_summary']]]
<div id="description">
<h5>Summary</h5>
[[int['interface_summary']]]
</div>
[[end]]
<div id="description">
<p/>
<h5>Description:</h5>
<pre>
[[int['interface_desc']]]<br><br>
</pre>
<h5>Parameters:</h5>
<div id="description">
<table border="1" cellspacing="0" cellpadding="3" width="80%">

View File

@ -1,9 +1,10 @@
<h1>Layer: [[mod_layer]]</h1><p/>
<h2>Module: [[mod_name]]</h2><p/>
<h3>Summary:</h3><br>
<pre>
[[mod_summary]]<p/>
</pre>
<br/>
<h3>Description:</h3>
[[if mod_desc]]
[[mod_desc]]
[[else]]
[[mod_summary]]
[[end]]
<h3>Interfaces: </h3>
[[interfaces]]

View File

@ -43,7 +43,7 @@ li {
p {
/* normal */
font:11px/20px verdana, arial, helvetica, sans-serif;
margin:0px 0px 16px 0px;
margin:0px 0px 0px 10px;
padding:0px;
}

View File

@ -93,6 +93,24 @@ def gen_doc_menu(mod_layer, module_list):
x[1].sort(stupid_cmp)
return menu
def format_desc(node):
desc_buf = ''
for desc in node.childNodes:
if desc.nodeName == "#text":
desc_buf += "<p>" + desc.data + "<p>"
elif desc.nodeName == "p":
desc_buf += "<p>" + desc.firstChild.data + "</p>"
for chld in desc.childNodes:
if chld.nodeName == "ul":
print "got a ul!"
desc_buf += "<ul>"
for li in chld.getElementsByTagName("li"):
desc_buf += "<li>" + li.firstChild.data + "</li>"
return desc_buf
def gen_docs(doc, dir, templatedir):
try:
@ -135,7 +153,8 @@ def gen_docs(doc, dir, templatedir):
if name == "layer":
mod_layer = value
for desc in node.getElementsByTagName("summary"):
mod_summary = desc.firstChild.data
if desc.parentNode == node:
mod_summary = format_desc(desc)
if not module_list.has_key(mod_layer):
module_list[mod_layer] = {}
@ -183,26 +202,32 @@ def gen_docs(doc, dir, templatedir):
all_interfaces = []
for node in doc.getElementsByTagName("module"):
mod_name = mod_layer = interface_buf = ''
mod_name = mod_layer = mod_desc = interface_buf = ''
for (name, value) in node.attributes.items():
if name == "name":
mod_name = value
if name == "layer":
mod_layer = value
for desc in node.getElementsByTagName("summary"):
mod_summary = desc.firstChild.data
if desc.parentNode == node:
mod_summary = format_desc(desc)
for desc in node.getElementsByTagName("description"):
if desc.parentNode == node:
mod_desc = format_desc(desc)
interfaces = []
for interface in node.getElementsByTagName("interface"):
interface_parameters = []
interface_secdesc = None
interface_secdesc = interface_summary = None
for i,v in interface.attributes.items():
interface_name = v
for desc in interface.getElementsByTagName("description"):
interface_desc = desc.firstChild.data
interface_desc = format_desc(desc)
for desc in interface.getElementsByTagName("securitydesc"):
if desc:
interface_secdesc = desc.firstChild.data
interface_secdesc = format_desc(desc)
for desc in interface.getElementsByTagName("summary"):
interface_summary = format_desc(desc)
for args in interface.getElementsByTagName("parameter"):
paramdesc = args.firstChild.data
@ -219,11 +244,13 @@ def gen_docs(doc, dir, templatedir):
"optional" : paramopt }
interface_parameters.append(parameter)
interfaces.append( { "interface_name" : interface_name,
"interface_summary" : interface_summary,
"interface_desc" : interface_desc,
"interface_parameters" : interface_parameters,
"interface_secdesc" : interface_secdesc })
#all_interfaces is for the main interface index with all interfaces
all_interfaces.append( { "interface_name" : interface_name,
"interface_summary" : interface_summary,
"interface_desc" : interface_desc,
"interface_parameters" : interface_parameters,
"interface_secdesc" : interface_secdesc,
@ -241,6 +268,7 @@ def gen_docs(doc, dir, templatedir):
module_args = { "mod_layer" : mod_layer,
"mod_name" : mod_name,
"mod_summary" : mod_summary,
"mod_desc" : mod_desc,
"interfaces" : interface_buf }
module_tpl = pyplate.Template(moduledata)