From c6100d8a25092770601ad9aa836927eb76a4eb12 Mon Sep 17 00:00:00 2001 From: Guido Draheim Date: Mon, 18 Sep 2006 10:03:38 +0000 Subject: [PATCH] overview (docs/) --- docs/makedocs.py | 13 +++++++++---- docs/zzipdoc/functionlistreference.py | 19 +++++++++++++++++++ 2 files changed, 28 insertions(+), 4 deletions(-) diff --git a/docs/makedocs.py b/docs/makedocs.py index e6586c2..0771870 100644 --- a/docs/makedocs.py +++ b/docs/makedocs.py @@ -12,6 +12,8 @@ from zzipdoc.dbk2htm import * def _src_to_xml(text): return text.replace("&", "&").replace("<", "<").replace(">", ">") +def _email_to_xml(text): + return text & Match("<([^<>]*@[^<>]*)>") >> "<\\1>" class PerFileEntry: def __init__(self, header, comment): @@ -218,8 +220,9 @@ class RefEntryManualPageAdapter: if entry: comment = entry.filecomment.xml_text() if comment: - check = Match(r"(?s)\s*[Aa]uthors*\b:*((?:.(?!))*.)") - if comment & check: return _src_to_xml(check[1]) + check = Match(r"(?s)\s*[Aa]uthors*\b:*" + r"((?:.(?!))*.)") + if comment & check: return _email_to_xml(check[1]) return None def get_copyright(self): comment = None @@ -228,8 +231,9 @@ class RefEntryManualPageAdapter: if entry: comment = entry.filecomment.xml_text() if comment: - check = Match(r"(?s)\s*[Cc]opyright\b((?:.(?!))*.)") - if comment & check: return check[0] + check = Match(r"(?s)\s*[Cc]opyright\b" + r"((?:.(?!))*.)") + if comment & check: return _email_to_xml(check[0]) return None def makedocs(filenames, o): @@ -293,6 +297,7 @@ def makedocs(filenames, o): & func_adapter.src_mainheader()): continue man3.add(func_adapter) + man3.add_overview(func_adapter) man3.cut() man3.cut() man3_filename = "zziplib"+o.suffix+".docbook" diff --git a/docs/zzipdoc/functionlistreference.py b/docs/zzipdoc/functionlistreference.py index 61524f3..ec94840 100644 --- a/docs/zzipdoc/functionlistreference.py +++ b/docs/zzipdoc/functionlistreference.py @@ -1,6 +1,9 @@ from match import Match from htm2dbk import * +def _to_word(text): + return text & Match("[^\w]+") >> "_" + class FunctionListReference: """ Creating a docbook-style list of parts that will each be translated into a unix manual page in a second step """ @@ -13,6 +16,7 @@ class FunctionListReference: self.o = o self.pages = [] self.entry = None + self.overview = None def cut(self): if not self.entry: return self.pages += [ self.entry ] @@ -34,11 +38,26 @@ class FunctionListReference: for item in entry.list_seealso(): if item not in self.entry.seealso_list: self.entry.seealso_list += [ item ] + def add_overview(self, entry): + if self.overview is None: + title = entry.get_mainheader() & Match(".*<(.*)>.*") >> "\\1" + self.overview = FunctionListRefEntry(entry, self.o) + self.overview.funcsynopsisinfo = entry.get_mainheader() + self.overview.refpurpose = self.o.package.strip() + self.overview.refentrytitle = title + self.overview.refname = _to_word(title) + description = entry.get_title().strip() & Match("^[.]+") >> "" + funcsynopsis = entry.head_xml_text() + self.overview.funcsynopsis_list += [ funcsynopsis ] + if description: + self.overview.description_list += [ + " - "+ description +"" ] def xml_text(self): T = self.doctype T += ""+self.o.package+" Function List\n" for item in self.pages: T += self.sane(item.refentry_text()) + T += self.sane(self.overview.refentry_text()) T += "\n" return T def sane(self, text): -- 2.40.0