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 policy (module+,tunable*)>
<!ELEMENT module (summary,interface+)> <!ELEMENT module (summary,description,interface+)>
<!ATTLIST module <!ATTLIST module
name CDATA #REQUIRED name CDATA #REQUIRED
layer CDATA #REQUIRED> layer CDATA #REQUIRED>
@ -8,7 +10,7 @@
name CDATA #REQUIRED name CDATA #REQUIRED
dftval CDATA #REQUIRED> dftval CDATA #REQUIRED>
<!ELEMENT summary (#PCDATA)> <!ELEMENT summary (#PCDATA)>
<!ELEMENT interface (description,securitydesc*,parameter+,infoflow?)> <!ELEMENT interface (summary,description,securitydesc*,parameter+,infoflow)>
<!ATTLIST interface name CDATA #REQUIRED> <!ATTLIST interface name CDATA #REQUIRED>
<!ELEMENT description (#PCDATA)> <!ELEMENT description (#PCDATA)>
<!ELEMENT securitydesc (#PCDATA)> <!ELEMENT securitydesc (#PCDATA)>
@ -20,3 +22,7 @@
<!ATTLIST infoflow <!ATTLIST infoflow
type CDATA #REQUIRED type CDATA #REQUIRED
weight CDATA #IMPLIED> 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]] [[end]]
)<br> )<br>
</div> </div>
<pre> [[if int['interface_summary']]]
[[int['interface_desc']]]<br><br> <div id="description">
</pre> [[int['interface_summary']]]
</div>
[[end]]
</div> </div>
[[end]] [[end]]

View File

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

View File

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

View File

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

View File

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