diff --git a/refpolicy/doc/policy.dtd b/refpolicy/doc/policy.dtd index 88e6f94..a9c3e11 100644 --- a/refpolicy/doc/policy.dtd +++ b/refpolicy/doc/policy.dtd @@ -1,5 +1,7 @@ + + - + @@ -8,7 +10,7 @@ name CDATA #REQUIRED dftval CDATA #REQUIRED> - + @@ -20,3 +22,7 @@ + + + + diff --git a/refpolicy/doc/templates/int_list.html b/refpolicy/doc/templates/int_list.html index 52d5e5f..c2ebfb3 100644 --- a/refpolicy/doc/templates/int_list.html +++ b/refpolicy/doc/templates/int_list.html @@ -24,8 +24,10 @@ Layer: [[end]] )
-
-[[int['interface_desc']]]

-
+[[if int['interface_summary']]] +
+[[int['interface_summary']]] +
+[[end]] [[end]] diff --git a/refpolicy/doc/templates/interface.html b/refpolicy/doc/templates/interface.html index e9b12ab..85a669a 100644 --- a/refpolicy/doc/templates/interface.html +++ b/refpolicy/doc/templates/interface.html @@ -24,12 +24,15 @@ [[end]] )
+[[if int['interface_summary']]] +
+
Summary
+[[int['interface_summary']]] +
+[[end]]
-

Description:
-
 [[int['interface_desc']]]

-
Parameters:
diff --git a/refpolicy/doc/templates/module.html b/refpolicy/doc/templates/module.html index 53cac90..94824be 100644 --- a/refpolicy/doc/templates/module.html +++ b/refpolicy/doc/templates/module.html @@ -1,9 +1,10 @@

Layer: [[mod_layer]]

Module: [[mod_name]]

-

Summary:


-
-[[mod_summary]]

-

-
+

Description:

+[[if mod_desc]] +[[mod_desc]] +[[else]] +[[mod_summary]] +[[end]]

Interfaces:

[[interfaces]] diff --git a/refpolicy/doc/templates/style.css b/refpolicy/doc/templates/style.css index a0eba00..6f01e5a 100644 --- a/refpolicy/doc/templates/style.css +++ b/refpolicy/doc/templates/style.css @@ -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; } diff --git a/refpolicy/support/sedoctool.py b/refpolicy/support/sedoctool.py index a4d9b9c..73a5a10 100755 --- a/refpolicy/support/sedoctool.py +++ b/refpolicy/support/sedoctool.py @@ -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 += "

" + desc.data + "

" + elif desc.nodeName == "p": + desc_buf += "

" + desc.firstChild.data + "

" + for chld in desc.childNodes: + if chld.nodeName == "ul": + print "got a ul!" + desc_buf += "
    " + for li in chld.getElementsByTagName("li"): + desc_buf += "
  • " + li.firstChild.data + "
  • " + + 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)