happydoc-checkins Mailing List for HappyDoc (Page 11)
Brought to you by:
doughellmann,
krlosaqp
You can subscribe to this list here.
| 2002 |
Jan
(3) |
Feb
(40) |
Mar
(1) |
Apr
|
May
(12) |
Jun
(4) |
Jul
|
Aug
(39) |
Sep
|
Oct
(4) |
Nov
(49) |
Dec
(78) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2003 |
Jan
(54) |
Feb
|
Mar
(41) |
Apr
(1) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2006 |
Jan
|
Feb
|
Mar
|
Apr
(3) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(13) |
|
From: Doug H. <dou...@us...> - 2002-08-25 14:41:02
|
Update of /cvsroot/happydoc/HappyDoc/happydoclib/docstring/StructuredText
In directory usw-pr-cvs1:/tmp/cvs-serv474/happydoclib/docstring/StructuredText
Modified Files:
ClassicDocumentClass.py ClassicStructuredText.py
DocBookClass.py DocumentClass.py DocumentWithImages.py
HTMLClass.py HTMLWithImages.py ST.py STDOM.py STletters.py
StructuredText.py Zwiki.py __init__.py
Log Message:
Updated to the latest StructuredText implementation from Zope CVS.
Index: ClassicDocumentClass.py
===================================================================
RCS file: /cvsroot/happydoc/HappyDoc/happydoclib/docstring/StructuredText/ClassicDocumentClass.py,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** ClassicDocumentClass.py 8 Dec 2001 15:33:27 -0000 1.2
--- ClassicDocumentClass.py 25 Aug 2002 14:40:59 -0000 1.3
***************
*** 2,6 ****
#
# Copyright (c) 2001 Zope Corporation and Contributors. All Rights Reserved.
! #
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
--- 2,6 ----
#
# Copyright (c) 2001 Zope Corporation and Contributors. All Rights Reserved.
! #
# This software is subject to the provisions of the Zope Public License,
[...988 lines suppressed...]
-
-
-
-
-
-
--- 608,620 ----
end = end -1
link = s[st:end]
! #end = end - 1
!
# name is the href title, link is the target
# of the href
return (StructuredTextLink(name, href=link),
start, end)
!
#return (StructuredTextLink(s[start:end], href=s[start:end]),
# start, end)
else:
return None
Index: ClassicStructuredText.py
===================================================================
RCS file: /cvsroot/happydoc/HappyDoc/happydoclib/docstring/StructuredText/ClassicStructuredText.py,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** ClassicStructuredText.py 8 Dec 2001 15:33:27 -0000 1.2
--- ClassicStructuredText.py 25 Aug 2002 14:40:59 -0000 1.3
***************
*** 1,10 ****
#! /usr/bin/env python -- # -*- python -*-
- #
- # HappyDoc:docStringFormat='ClassicStructuredText'
- #
##############################################################################
#
# Copyright (c) 2001 Zope Corporation and Contributors. All Rights Reserved.
! #
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
--- 1,7 ----
#! /usr/bin/env python -- # -*- python -*-
##############################################################################
#
# Copyright (c) 2001 Zope Corporation and Contributors. All Rights Reserved.
! #
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
***************
*** 13,25 ****
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE
! #
##############################################################################
'''Structured Text Manipulation
! Parse a structured text string into a form that can be used with
structured formats, like html.
Structured text is text that uses indentation and simple
! symbology to indicate the structure of a document.
A structured string consists of a sequence of paragraphs separated by
--- 10,22 ----
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE
! #
##############################################################################
'''Structured Text Manipulation
! Parse a structured text string into a form that can be used with
structured formats, like html.
Structured text is text that uses indentation and simple
! symbology to indicate the structure of a document.
A structured string consists of a sequence of paragraphs separated by
***************
*** 64,68 ****
is made strong.
! - Text surrounded by '_' underscore characters (with whitespace to the left
and whitespace or punctuation to the right) is made underlined.
--- 61,65 ----
is made strong.
! - Text surrounded by '_' underscore characters (with whitespace to the left
and whitespace or punctuation to the right) is made underlined.
***************
*** 78,91 ****
- Text enclosed by double quotes followed by a comma, one or more spaces,
an absolute URL and concluded by punctuation plus white space, or just
! white space, is treated as a hyper link. For example:
"mail me", mailto:am...@di....
! Is interpreted as '<a href="mailto:am...@di...">mail me</a>.'
- Text enclosed in brackets which consists only of letters, digits,
underscores and dashes is treated as hyper links within the document.
For example:
!
As demonstrated by Smith [12] this technique is quite effective.
--- 75,88 ----
- Text enclosed by double quotes followed by a comma, one or more spaces,
an absolute URL and concluded by punctuation plus white space, or just
! white space, is treated as a hyper link. For example:
"mail me", mailto:am...@di....
! Is interpreted as '<a href="mailto:am...@di...">mail me</a>.'
- Text enclosed in brackets which consists only of letters, digits,
underscores and dashes is treated as hyper links within the document.
For example:
!
As demonstrated by Smith [12] this technique is quite effective.
***************
*** 96,104 ****
periods and a space is treated as a named link. For example:
! .. [12] "Effective Techniques" Smith, Joe ...
Is interpreted as '<a name="12">[12]</a> "Effective Techniques" ...'.
Together with the previous rule this allows easy coding of references or
! end notes.
--- 93,101 ----
periods and a space is treated as a named link. For example:
! .. [12] "Effective Techniques" Smith, Joe ...
Is interpreted as '<a name="12">[12]</a> "Effective Techniques" ...'.
Together with the previous rule this allows easy coding of references or
! end notes.
***************
*** 140,144 ****
import regex
from ts_regex import gsub
- from string import split, join, strip, find
import string,re
--- 137,140 ----
***************
*** 166,174 ****
def indent(aString, indent=2):
"""Indent a string the given number of spaces"""
! r=split(untabify(aString),'\n')
if not r: return ''
if not r[-1]: del r[-1]
! tab=' '*level
! return "%s%s\n" % (tab,join(r,'\n'+tab))
def reindent(aString, indent=2, already_untabified=0):
--- 162,170 ----
def indent(aString, indent=2):
"""Indent a string the given number of spaces"""
! r=untabify(aString).split('\n')
if not r: return ''
if not r[-1]: del r[-1]
! tab=' '*indent
! return "%s%s\n" % (tab,('\n'+tab).join(r))
def reindent(aString, indent=2, already_untabified=0):
***************
*** 186,195 ****
if indent > l:
tab=' ' * (indent-l)
! for s in split(aString,'\n'): append(tab+s)
else:
l=l-indent
! for s in split(aString,'\n'): append(s[l:])
! return join(r,'\n')
def indent_level(aString,
--- 182,191 ----
if indent > l:
tab=' ' * (indent-l)
! for s in aString.split('\n'): append(tab+s)
else:
l=l-indent
! for s in aString.split('\n'): append(s[l:])
! return '\n'.join(r)
def indent_level(aString,
***************
*** 239,254 ****
ROW=' <TR>\n%s </TR>\n'
TABLE='\n<TABLE BORDER=1 CELLPADDING=2>\n%s</TABLE>'
-
def create(self,aPar,
! #
! # HappyDoc fix
! #
! # td_reg=re.compile(r'[ \t\n]*\|\|([^\0x00|]*)')
! td_reg=re.compile(r'[ \t\n]*\|\|([^|]*)')
):
'''parses a table and returns nested list representing the
table'''
self.table=[]
! text=filter(None,split(aPar,'\n'))
for line in text:
row=[]
--- 235,245 ----
ROW=' <TR>\n%s </TR>\n'
TABLE='\n<TABLE BORDER=1 CELLPADDING=2>\n%s</TABLE>'
def create(self,aPar,
! td_reg=re.compile(r'[ \t\n]*\|\|([^\0|]*)')
):
'''parses a table and returns nested list representing the
table'''
self.table=[]
! text=filter(None,aPar.split('\n'))
for line in text:
row=[]
***************
*** 276,281 ****
htmlrow.append(self.CELL%(colspan,cell))
colspan=1
! htmltable.append(self.ROW%join(htmlrow,''))
! return self.TABLE%join(htmltable,'')
table=Table()
--- 267,272 ----
htmlrow.append(self.CELL%(colspan,cell))
colspan=1
! htmltable.append(self.ROW % ''.join(htmlrow))
! return self.TABLE % ''.join(htmltable)
table=Table()
***************
*** 305,317 ****
pat = ' \"([%s0-9-_,./?=@~&]*)\":' % string.letters+ \
'([-:%s0-9_,./?=@#~&]*?)' % string.letters + \
! '([.:?;] )'
p_reg = re.compile(pat,re.M)
!
aStructuredString = p_reg.sub(r'<a href="\2">\1</a>\3 ' , aStructuredString)
pat = ' \"([%s0-9-_,./?=@~&]*)\", ' % string.letters+ \
'([-:%s0-9_,./?=@#~&]*?)' % string.letters + \
! '([.:?;] )'
p_reg = re.compile(pat,re.M)
--- 296,308 ----
pat = ' \"([%s0-9-_,./?=@~&]*)\":' % string.letters+ \
'([-:%s0-9_,./?=@#~&]*?)' % string.letters + \
! '([.:?;] )'
p_reg = re.compile(pat,re.M)
!
aStructuredString = p_reg.sub(r'<a href="\2">\1</a>\3 ' , aStructuredString)
pat = ' \"([%s0-9-_,./?=@~&]*)\", ' % string.letters+ \
'([-:%s0-9_,./?=@#~&]*?)' % string.letters + \
! '([.:?;] )'
p_reg = re.compile(pat,re.M)
***************
*** 320,324 ****
! protoless = find(aStructuredString, '<a href=":')
if protoless != -1:
aStructuredString = re.sub('<a href=":', '<a href="',
--- 311,315 ----
! protoless = aStructuredString.find('<a href=":')
if protoless != -1:
aStructuredString = re.sub('<a href=":', '<a href="',
***************
*** 337,344 ****
! ctag_prefix=r'([\x00- \\(]|^)'
! ctag_suffix=r'([\x00- ,.:;!?\\)]|$)'
! ctag_middle=r'[%s]([^\x00- %s][^%s]*[^\x00- %s]|[^%s])[%s]'
! ctag_middl2=r'[%s][%s]([^\x00- %s][^%s]*[^\x00- %s]|[^%s])[%s][%s]'
def ctag(s,
--- 328,335 ----
! ctag_prefix=r'([\x00- \\(]|^)'
! ctag_suffix=r'([\x00- ,.:;!?\\)]|$)'
! ctag_middle=r'[%s]([^\x00- %s][^%s]*[^\x00- %s]|[^%s])[%s]'
! ctag_middl2=r'[%s][%s]([^\x00- %s][^%s]*[^\x00- %s]|[^%s])[%s][%s]'
def ctag(s,
***************
*** 357,361 ****
s=code.sub( r'\1<code>\2</code>\3',s)
s=em.sub( r'\1<em>\2</em>\3',s)
! return s
class HTML(StructuredText):
--- 348,352 ----
s=code.sub( r'\1<code>\2</code>\3',s)
s=em.sub( r'\1<em>\2</em>\3',s)
! return s
class HTML(StructuredText):
***************
*** 381,390 ****
def ul(self, before, p, after):
! if p: p="<p>%s</p>" % strip(ctag(p))
return ('%s<ul><li>%s\n%s\n</li></ul>\n'
% (before,p,after))
def ol(self, before, p, after):
! if p: p="<p>%s</p>" % strip(ctag(p))
return ('%s<ol><li>%s\n%s\n</li></ol>\n'
% (before,p,after))
--- 372,381 ----
def ul(self, before, p, after):
! if p: p="<p>%s</p>" % ctag(p).strip()
return ('%s<ul><li>%s\n%s\n</li></ul>\n'
% (before,p,after))
def ol(self, before, p, after):
! if p: p="<p>%s</p>" % ctag(p).strip()
return ('%s<ol><li>%s\n%s\n</li></ol>\n'
% (before,p,after))
***************
*** 397,403 ****
if level > 0 and level < 6:
return ('%s<h%d>%s</h%d>\n%s\n'
! % (before,level,strip(ctag(t)),level,d))
!
! t="<p><strong>%s</strong></p>" % strip(ctag(t))
return ('%s<dl><dt>%s\n</dt><dd>%s\n</dd></dl>\n'
% (before,t,d))
--- 388,394 ----
if level > 0 and level < 6:
return ('%s<h%d>%s</h%d>\n%s\n'
! % (before,level,ctag(t).strip(),level,d))
!
! t="<p><strong>%s</strong></p>" % ctag(t).strip()
return ('%s<dl><dt>%s\n</dt><dd>%s\n</dd></dl>\n'
% (before,t,d))
***************
*** 416,423 ****
if not tagged: r=r+'</PRE>\n'
return r
!
def table(self,before,table,after):
return '%s<p>%s</p>\n%s\n' % (before,ctag(table),after)
!
def _str(self,structure,level,
# Static
--- 407,414 ----
if not tagged: r=r+'</PRE>\n'
return r
!
def table(self,before,table,after):
return '%s<p>%s</p>\n%s\n' % (before,ctag(table),after)
!
def _str(self,structure,level,
# Static
***************
*** 486,490 ****
r=self.normal(r,s[0],self._str(s[1],level))
return r
!
def html_quote(v,
--- 477,481 ----
r=self.normal(r,s[0],self._str(s[1],level))
return r
!
def html_quote(v,
***************
*** 495,502 ****
(re.compile('"'), '"')
)): #"
! text=str(v)
! for re,name in character_entities:
! text=re.sub(name,text)
! return text
def html_with_references(text, level=1):
--- 486,493 ----
(re.compile('"'), '"')
)): #"
! text=str(v)
! for re,name in character_entities:
! text=re.sub(name,text)
! return text
def html_with_references(text, level=1):
***************
*** 510,514 ****
r'\1<a href="#\2">[\2]</a>\3',
text)
!
text = re.sub(
r'([\0- ,])\[([^]]+)\.html\]([\0- ,.:])',
--- 501,505 ----
r'\1<a href="#\2">[\2]</a>\3',
text)
!
text = re.sub(
r'([\0- ,])\[([^]]+)\.html\]([\0- ,.:])',
***************
*** 517,521 ****
return HTML(text,level=level)
!
def main():
--- 508,512 ----
return HTML(text,level=level)
!
def main():
***************
*** 545,552 ****
if mo is not None:
s = s[len(mo.group(0)) :]
!
s=str(html_with_references(s))
if s[:4]=='<h1>':
! t=s[4:find(s,'</h1>')]
s='''<html><head><title>%s</title>
</head><body>
--- 536,543 ----
if mo is not None:
s = s[len(mo.group(0)) :]
!
s=str(html_with_references(s))
if s[:4]=='<h1>':
! t=s[4: s.find('</h1>')]
s='''<html><head><title>%s</title>
</head><body>
Index: DocBookClass.py
===================================================================
RCS file: /cvsroot/happydoc/HappyDoc/happydoclib/docstring/StructuredText/DocBookClass.py,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** DocBookClass.py 8 Dec 2001 13:55:19 -0000 1.2
--- DocBookClass.py 25 Aug 2002 14:40:59 -0000 1.3
***************
*** 2,6 ****
#
# Copyright (c) 2001 Zope Corporation and Contributors. All Rights Reserved.
! #
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
--- 2,6 ----
#
# Copyright (c) 2001 Zope Corporation and Contributors. All Rights Reserved.
! #
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
***************
*** 9,212 ****
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE
! #
##############################################################################
- import string
- from string import join, split, find, lstrip
class DocBookClass:
! element_types={
! '#text': '_text',
! 'StructuredTextDocument': 'document',
! 'StructuredTextParagraph': 'paragraph',
! 'StructuredTextExample': 'example',
! 'StructuredTextBullet': 'bullet',
! 'StructuredTextNumbered': 'numbered',
! 'StructuredTextDescription': 'description',
! 'StructuredTextDescriptionTitle': 'descriptionTitle',
! 'StructuredTextDescriptionBody': 'descriptionBody',
! 'StructuredTextSection': 'section',
! 'StructuredTextSectionTitle': 'sectionTitle',
! 'StructuredTextLiteral': 'literal',
! 'StructuredTextEmphasis': 'emphasis',
! 'StructuredTextStrong': 'strong',
! 'StructuredTextLink': 'link',
! 'StructuredTextXref': 'xref',
! 'StructuredTextSGML': 'sgml',
! }
! def dispatch(self, doc, level, output):
! getattr(self, self.element_types[doc.getNodeName()])(doc, level, output)
!
! def __call__(self, doc, level=1):
! r=[]
! self.dispatch(doc, level-1, r.append)
! return join(r,'')
! def _text(self, doc, level, output):
! if doc.getNodeName() == 'StructuredTextLiteral':
! output(doc.getNodeValue())
! else:
! output(lstrip(doc.getNodeValue()))
! def document(self, doc, level, output):
! output('<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook V4.1//EN">\n')
! output('<book>\n')
! children=doc.getChildNodes()
! if (children and
! children[0].getNodeName() == 'StructuredTextSection'):
! output('<title>%s</title>' % children[0].getChildNodes()[0].getNodeValue())
! for c in children:
! getattr(self, self.element_types[c.getNodeName()])(c, level, output)
! output('</book>\n')
! def section(self, doc, level, output):
! output('\n<section>\n')
! children=doc.getChildNodes()
! for c in children:
! getattr(self, self.element_types[c.getNodeName()])(c, level+1, output)
! output('\n</section>\n')
!
! def sectionTitle(self, doc, level, output):
! output('<title>')
! for c in doc.getChildNodes():
! try:
getattr(self, self.element_types[c.getNodeName()])(c, level, output)
! except:
! print "failed", c.getNodeName(), c
! output('</title>\n')
! def description(self, doc, level, output):
! p=doc.getPreviousSibling()
! if p is None or p.getNodeName() is not doc.getNodeName():
! output('<variablelist>\n')
! for c in doc.getChildNodes():
! getattr(self, self.element_types[c.getNodeName()])(c, level, output)
! n=doc.getNextSibling()
! if n is None or n.getNodeName() is not doc.getNodeName():
! output('</variablelist>\n')
!
! def descriptionTitle(self, doc, level, output):
! output('<varlistentry><term>\n')
! for c in doc.getChildNodes():
! getattr(self, self.element_types[c.getNodeName()])(c, level, output)
! output('</term>\n')
!
! def descriptionBody(self, doc, level, output):
! output('<listitem><para>\n')
! for c in doc.getChildNodes():
! getattr(self, self.element_types[c.getNodeName()])(c, level, output)
! output('</para></listitem>\n')
! output('</varlistentry>\n')
! def bullet(self, doc, level, output):
! p=doc.getPreviousSibling()
! if p is None or p.getNodeName() is not doc.getNodeName():
! output('<itemizedlist>\n')
! output('<listitem><para>\n')
! for c in doc.getChildNodes():
! getattr(self, self.element_types[c.getNodeName()])(c, level, output)
! n=doc.getNextSibling()
! output('</para></listitem>\n')
! if n is None or n.getNodeName() is not doc.getNodeName():
! output('</itemizedlist>\n')
! def numbered(self, doc, level, output):
! p=doc.getPreviousSibling()
! if p is None or p.getNodeName() is not doc.getNodeName():
! output('<orderedlist>\n')
! output('<listitem><para>\n')
! for c in doc.getChildNodes():
! getattr(self, self.element_types[c.getNodeName()])(c, level, output)
! n=doc.getNextSibling()
! output('</para></listitem>\n')
! if n is None or n.getNodeName() is not doc.getNodeName():
! output('</orderedlist>\n')
! def example(self, doc, level, output):
! i=0
! for c in doc.getChildNodes():
! if i==0:
! output('<programlisting>\n<![CDATA[\n')
! ##
! ## eek. A ']]>' in your body will break this...
! ##
! output(prestrip(c.getNodeValue()))
! output('\n]]></programlisting>\n')
! else:
getattr(self, self.element_types[c.getNodeName()])(
c, level, output)
! def paragraph(self, doc, level, output):
! output('<para>\n\n')
! for c in doc.getChildNodes():
! getattr(self, self.element_types[c.getNodeName()])(
! c, level, output)
! output('</para>\n\n')
!
! def link(self, doc, level, output):
! output('<ulink url="%s">' % doc.href)
! for c in doc.getChildNodes():
! getattr(self, self.element_types[c.getNodeName()])(c, level, output)
! output('</ulink>')
! def emphasis(self, doc, level, output):
! output('<emphasis>')
! for c in doc.getChildNodes():
! getattr(self, self.element_types[c.getNodeName()])(c, level, output)
! output('</emphasis> ')
! def literal(self, doc, level, output):
! output('<literal>')
! for c in doc.getChildNodes():
! output(c.getNodeValue())
! output('</literal>')
! def strong(self, doc, level, output):
! output('<emphasis>')
! for c in doc.getChildNodes():
! getattr(self, self.element_types[c.getNodeName()])(c, level, output)
! output('</emphasis>')
! def xref(self, doc, level, output):
! output('<xref linkend="%s"/>' % doc.getNodeValue())
! def sgml(self, doc, level, output):
! output(doc.getNodeValue())
def prestrip(v):
! v=string.replace(v, '\r\n', '\n')
! v=string.replace(v, '\r', '\n')
! v=string.replace(v, '\t', ' ')
! lines=string.split(v, '\n')
! indent=len(lines[0])
! for line in lines:
! if not len(line): continue
! i=len(line)-len(string.lstrip(line))
! if i < indent:
! indent=i
! nlines=[]
! for line in lines:
! nlines.append(line[indent:])
! return string.join(nlines, '\n')
class DocBookChapter(DocBookClass):
! def document(self, doc, level, output):
! output('<chapter>\n')
! children=doc.getChildNodes()
! if (children and
! children[0].getNodeName() == 'StructuredTextSection'):
! output('<title>%s</title>' % children[0].getChildNodes()[0].getNodeValue())
! for c in children[0].getChildNodes()[1:]:
! getattr(self, self.element_types[c.getNodeName()])(c, level, output)
! output('</chapter>\n')
ets = DocBookClass.element_types
! ets.update({'StructuredTextImage': 'image'})
class DocBookChapterWithFigures(DocBookChapter):
--- 9,210 ----
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE
! #
##############################################################################
class DocBookClass:
! element_types={
! '#text': '_text',
! 'StructuredTextDocument': 'document',
! 'StructuredTextParagraph': 'paragraph',
! 'StructuredTextExample': 'example',
! 'StructuredTextBullet': 'bullet',
! 'StructuredTextNumbered': 'numbered',
! 'StructuredTextDescription': 'description',
! 'StructuredTextDescriptionTitle': 'descriptionTitle',
! 'StructuredTextDescriptionBody': 'descriptionBody',
! 'StructuredTextSection': 'section',
! 'StructuredTextSectionTitle': 'sectionTitle',
! 'StructuredTextLiteral': 'literal',
! 'StructuredTextEmphasis': 'emphasis',
! 'StructuredTextStrong': 'strong',
! 'StructuredTextLink': 'link',
! 'StructuredTextXref': 'xref',
! 'StructuredTextSGML': 'sgml',
! }
! def dispatch(self, doc, level, output):
! getattr(self, self.element_types[doc.getNodeName()])(doc, level, output)
! def __call__(self, doc, level=1):
! r=[]
! self.dispatch(doc, level-1, r.append)
! return ''.join(r)
! def _text(self, doc, level, output):
! if doc.getNodeName() == 'StructuredTextLiteral':
! output(doc.getNodeValue())
! else:
! output(doc.getNodeValue().lstrip())
! def document(self, doc, level, output):
! output('<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook V4.1//EN">\n')
! output('<book>\n')
! children=doc.getChildNodes()
! if (children and
! children[0].getNodeName() == 'StructuredTextSection'):
! output('<title>%s</title>' % children[0].getChildNodes()[0].getNodeValue())
! for c in children:
getattr(self, self.element_types[c.getNodeName()])(c, level, output)
! output('</book>\n')
! def section(self, doc, level, output):
! output('\n<section>\n')
! children=doc.getChildNodes()
! for c in children:
! getattr(self, self.element_types[c.getNodeName()])(c, level+1, output)
! output('\n</section>\n')
! def sectionTitle(self, doc, level, output):
! output('<title>')
! for c in doc.getChildNodes():
! try:
! getattr(self, self.element_types[c.getNodeName()])(c, level, output)
! except:
! print "failed", c.getNodeName(), c
! output('</title>\n')
! def description(self, doc, level, output):
! p=doc.getPreviousSibling()
! if p is None or p.getNodeName() is not doc.getNodeName():
! output('<variablelist>\n')
! for c in doc.getChildNodes():
! getattr(self, self.element_types[c.getNodeName()])(c, level, output)
! n=doc.getNextSibling()
! if n is None or n.getNodeName() is not doc.getNodeName():
! output('</variablelist>\n')
! def descriptionTitle(self, doc, level, output):
! output('<varlistentry><term>\n')
! for c in doc.getChildNodes():
! getattr(self, self.element_types[c.getNodeName()])(c, level, output)
! output('</term>\n')
! def descriptionBody(self, doc, level, output):
! output('<listitem><para>\n')
! for c in doc.getChildNodes():
! getattr(self, self.element_types[c.getNodeName()])(c, level, output)
! output('</para></listitem>\n')
! output('</varlistentry>\n')
!
! def bullet(self, doc, level, output):
! p=doc.getPreviousSibling()
! if p is None or p.getNodeName() is not doc.getNodeName():
! output('<itemizedlist>\n')
! output('<listitem><para>\n')
!
! for c in doc.getChildNodes():
! getattr(self, self.element_types[c.getNodeName()])(c, level, output)
! n=doc.getNextSibling()
! output('</para></listitem>\n')
! if n is None or n.getNodeName() is not doc.getNodeName():
! output('</itemizedlist>\n')
!
! def numbered(self, doc, level, output):
! p=doc.getPreviousSibling()
! if p is None or p.getNodeName() is not doc.getNodeName():
! output('<orderedlist>\n')
! output('<listitem><para>\n')
! for c in doc.getChildNodes():
! getattr(self, self.element_types[c.getNodeName()])(c, level, output)
! n=doc.getNextSibling()
! output('</para></listitem>\n')
! if n is None or n.getNodeName() is not doc.getNodeName():
! output('</orderedlist>\n')
!
! def example(self, doc, level, output):
! i=0
! for c in doc.getChildNodes():
! if i==0:
! output('<programlisting>\n<![CDATA[\n')
! ##
! ## eek. A ']]>' in your body will break this...
! ##
! output(prestrip(c.getNodeValue()))
! output('\n]]></programlisting>\n')
! else:
! getattr(self, self.element_types[c.getNodeName()])(
! c, level, output)
!
! def paragraph(self, doc, level, output):
! output('<para>\n\n')
! for c in doc.getChildNodes():
getattr(self, self.element_types[c.getNodeName()])(
c, level, output)
+ output('</para>\n\n')
! def link(self, doc, level, output):
! output('<ulink url="%s">' % doc.href)
! for c in doc.getChildNodes():
! getattr(self, self.element_types[c.getNodeName()])(c, level, output)
! output('</ulink>')
! def emphasis(self, doc, level, output):
! output('<emphasis>')
! for c in doc.getChildNodes():
! getattr(self, self.element_types[c.getNodeName()])(c, level, output)
! output('</emphasis> ')
! def literal(self, doc, level, output):
! output('<literal>')
! for c in doc.getChildNodes():
! output(c.getNodeValue())
! output('</literal>')
! def strong(self, doc, level, output):
! output('<emphasis>')
! for c in doc.getChildNodes():
! getattr(self, self.element_types[c.getNodeName()])(c, level, output)
! output('</emphasis>')
! def xref(self, doc, level, output):
! output('<xref linkend="%s"/>' % doc.getNodeValue())
! def sgml(self, doc, level, output):
! output(doc.getNodeValue())
def prestrip(v):
! v=v.replace( '\r\n', '\n')
! v=v.replace( '\r', '\n')
! v=v.replace( '\t', ' ')
! lines=v.split('\n')
! indent=len(lines[0])
! for line in lines:
! if not len(line): continue
! i=len(line)-len(line.lstrip())
! if i < indent:
! indent=i
! nlines=[]
! for line in lines:
! nlines.append(line[indent:])
! return '\n'.join(nlines, '\n')
class DocBookChapter(DocBookClass):
! def document(self, doc, level, output):
! output('<chapter>\n')
! children=doc.getChildNodes()
! if (children and
! children[0].getNodeName() == 'StructuredTextSection'):
! output('<title>%s</title>' % children[0].getChildNodes()[0].getNodeValue())
! for c in children[0].getChildNodes()[1:]:
! getattr(self, self.element_types[c.getNodeName()])(c, level, output)
! output('</chapter>\n')
ets = DocBookClass.element_types
! ets.update({'StructuredTextImage': 'image'})
class DocBookChapterWithFigures(DocBookChapter):
***************
*** 215,260 ****
def image(self, doc, level, output):
! if hasattr(doc, 'key'):
! output('<figure id="%s"><title>%s</title>\n' % (doc.key, doc.getNodeValue()) )
! else:
! output('<figure><title>%s</title>\n' % doc.getNodeValue())
## for c in doc.getChildNodes():
## getattr(self, self.element_types[c.getNodeName()])(c, level, output)
! output('<graphic fileref="%s"></graphic>\n</figure>\n' % doc.href)
class DocBookArticle(DocBookClass):
! def document(self, doc, level, output):
! output('<!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook V4.1//EN">\n')
! output('<article>\n')
! children=doc.getChildNodes()
! if (children and
! children[0].getNodeName() == 'StructuredTextSection'):
! output('<articleinfo>\n<title>%s</title>\n</articleinfo>\n' %
! children[0].getChildNodes()[0].getNodeValue())
! for c in children:
! getattr(self, self.element_types[c.getNodeName()])(c, level, output)
! output('</article>\n')
class DocBookBook:
! def __init__(self, title=''):
! self.title = title
! self.chapters = []
!
! def addChapter(self, chapter):
! self.chapters.append(chapter)
! def read(self):
! out = '<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook V4.1//EN">\n<book>\n'
! out = out + '<title>%s</title>\n' % self.title
! for chapter in self.chapters:
! out = out + chapter + '\n</book>\n'
! return out
! def __str__(self):
! return self.read()
!
--- 213,256 ----
def image(self, doc, level, output):
! if hasattr(doc, 'key'):
! output('<figure id="%s"><title>%s</title>\n' % (doc.key, doc.getNodeValue()) )
! else:
! output('<figure><title>%s</title>\n' % doc.getNodeValue())
## for c in doc.getChildNodes():
## getattr(self, self.element_types[c.getNodeName()])(c, level, output)
! output('<graphic fileref="%s"></graphic>\n</figure>\n' % doc.href)
class DocBookArticle(DocBookClass):
! def document(self, doc, level, output):
! output('<!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook V4.1//EN">\n')
! output('<article>\n')
! children=doc.getChildNodes()
! if (children and
! children[0].getNodeName() == 'StructuredTextSection'):
! output('<articleinfo>\n<title>%s</title>\n</articleinfo>\n' %
! children[0].getChildNodes()[0].getNodeValue())
! for c in children:
! getattr(self, self.element_types[c.getNodeName()])(c, level, output)
! output('</article>\n')
class DocBookBook:
! def __init__(self, title=''):
! self.title = title
! self.chapters = []
! def addChapter(self, chapter):
! self.chapters.append(chapter)
! def read(self):
! out = '<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook V4.1//EN">\n<book>\n'
! out = out + '<title>%s</title>\n' % self.title
! for chapter in self.chapters:
! out = out + chapter + '\n</book>\n'
! return out
+ def __str__(self):
+ return self.read()
Index: DocumentClass.py
===================================================================
RCS file: /cvsroot/happydoc/HappyDoc/happydoclib/docstring/StructuredText/DocumentClass.py,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** DocumentClass.py 8 Dec 2001 15:33:27 -0000 1.2
--- DocumentClass.py 25 Aug 2002 14:40:59 -0000 1.3
***************
*** 2,6 ****
#
# Copyright (c) 2001 Zope Corporation and Contributors. All Rights Reserved.
! #
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
--- 2,6 ----
#
# Copyright (c) 2001 Zope Corporation and Contributors. All Rights Reserved.
! #
# This software is subject to the provisions of the Zope Public License,
[...1400 lines suppressed...]
# of the href
return (StructuredTextLink(name, href=link),
start, end)
!
#return (StructuredTextLink(s[start:end], href=s[start:end]),
# start, end)
else:
return None
!
def doc_sgml(self,s,expr=re.compile(r"\<[%s0-9\.\=\'\"\:\/\-\#\+\s\*]+\>" % letters).search):
"""
***************
*** 948,953 ****
else:
return None
-
-
-
-
--- 952,953 ----
Index: DocumentWithImages.py
===================================================================
RCS file: /cvsroot/happydoc/HappyDoc/happydoclib/docstring/StructuredText/DocumentWithImages.py,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** DocumentWithImages.py 8 Dec 2001 13:55:42 -0000 1.2
--- DocumentWithImages.py 25 Aug 2002 14:40:59 -0000 1.3
***************
*** 2,6 ****
#
# Copyright (c) 2001 Zope Corporation and Contributors. All Rights Reserved.
! #
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
--- 2,6 ----
#
# Copyright (c) 2001 Zope Corporation and Contributors. All Rights Reserved.
! #
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
***************
*** 9,18 ****
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE
! #
##############################################################################
! import re, ST, STDOM
! from string import split, join, replace, expandtabs, strip, find
!
from DocumentClass import *
--- 9,16 ----
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE
! #
##############################################################################
! import re
from DocumentClass import *
***************
*** 20,24 ****
"A simple embedded image"
! class DocumentWithImages(DocumentClass):
"""
--- 18,22 ----
"A simple embedded image"
! class DocumentWithImages(DocumentClass):
"""
***************
*** 33,38 ****
def doc_img(
self, s,
! expr1=re.compile('\"([ _a-zA-Z0-9*.:/;,\-\n\~]+)\":img:([a-zA-Z0-9\-.:/;,\n\~]+)').search,
! expr2=re.compile('\"([ _a-zA-Z0-9*.:/;,\-\n\~]+)\":img:([a-zA-Z0-9\-.:/;,\n\~]+):([a-zA-Z0-9\-.:/;,\n\~]+)').search
):
--- 31,36 ----
def doc_img(
self, s,
! expr1=re.compile('\"([ _a-zA-Z0-9*.:/;,\-\n\~]+)\":img:([a-zA-Z0-9\_\-.:/;,\n\~]+)').search,
! expr2=re.compile('\"([ _a-zA-Z0-9*.:/;,\-\n\~]+)\":img:([a-zA-Z0-9\_\-.:/;,\n\~]+):([a-zA-Z0-9_\-.:/;,\n\~]+)').search
):
***************
*** 47,61 ****
if not r.group(2) in ['http','file','ftp']:
! startt, endt = r.span(1)
! startk, endk = r.span(2)
! starth, endh = r.span(3)
! start, end = r.span()
!
! key = s[startk:endk]
!
! return (StructuredTextImage(s[startt:endt], href=s[starth:endh], key=s[startk:endk]),
! start, end)
-
r=expr1(s)
if r:
--- 45,59 ----
if not r.group(2) in ['http','file','ftp']:
! startt, endt = r.span(1)
! startk, endk = r.span(2)
! starth, endh = r.span(3)
! start, end = r.span()
!
! key = s[startk:endk]
!
! return (StructuredTextImage(s[startt:endt], href=s[starth:endh], key=s[startk:endk]),
! start, end)
!
r=expr1(s)
if r:
***************
*** 67,69 ****
return None
-
--- 65,66 ----
Index: HTMLClass.py
===================================================================
RCS file: /cvsroot/happydoc/HappyDoc/happydoclib/docstring/StructuredText/HTMLClass.py,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** HTMLClass.py 8 Dec 2001 15:33:27 -0000 1.2
--- HTMLClass.py 25 Aug 2002 14:40:59 -0000 1.3
***************
*** 2,6 ****
#
# Copyright (c) 2001 Zope Corporation and Contributors. All Rights Reserved.
! #
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
--- 2,6 ----
#
# Copyright (c) 2001 Zope Corporation and Contributors. All Rights Reserved.
! #
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
***************
*** 9,16 ****
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE
! #
##############################################################################
- from string import join, split, find
from cgi import escape
import re, sys, ST
--- 9,15 ----
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE
! #
##############################################################################
from cgi import escape
import re, sys, ST
***************
*** 45,62 ****
def dispatch(self, doc, level, output):
getattr(self, self.element_types[doc.getNodeName()])(doc, level, output)
!
def __call__(self, doc, level=1, header=1):
r=[]
self.header = header
self.dispatch(doc, level-1, r.append)
! return join(r,'')
def _text(self, doc, level, output):
! output((doc.getNodeValue()))
def document(self, doc, level, output):
children=doc.getChildNodes()
! if self.header==1:
output('<html>\n')
if (children and
--- 44,61 ----
def dispatch(self, doc, level, output):
getattr(self, self.element_types[doc.getNodeName()])(doc, level, output)
!
def __call__(self, doc, level=1, header=1):
r=[]
self.header = header
self.dispatch(doc, level-1, r.append)
! return ''.join(r)
def _text(self, doc, level, output):
! output(doc.getNodeValue())
def document(self, doc, level, output):
children=doc.getChildNodes()
! if self.header:
output('<html>\n')
if (children and
***************
*** 69,73 ****
getattr(self, self.element_types[c.getNodeName()])(c, level, output)
! if self.header==1:
output('</body>\n')
output('</html>\n')
--- 68,72 ----
getattr(self, self.element_types[c.getNodeName()])(c, level, output)
! if self.header:
output('</body>\n')
output('</html>\n')
***************
*** 77,81 ****
for c in children:
getattr(self, self.element_types[c.getNodeName()])(c, level+1, output)
!
def sectionTitle(self, doc, level, output):
output('<h%d>' % (level))
--- 76,80 ----
for c in children:
getattr(self, self.element_types[c.getNodeName()])(c, level+1, output)
!
def sectionTitle(self, doc, level, output):
output('<h%d>' % (level))
***************
*** 86,97 ****
def description(self, doc, level, output):
p=doc.getPreviousSibling()
! if p is None or p.getNodeName() is not doc.getNodeName():
output('<dl>\n')
for c in doc.getChildNodes():
getattr(self, self.element_types[c.getNodeName()])(c, level, output)
n=doc.getNextSibling()
! if n is None or n.getNodeName() is not doc.getNodeName():
output('</dl>\n')
!
def descriptionTitle(self, doc, level, output):
output('<dt>')
--- 85,96 ----
def description(self, doc, level, output):
p=doc.getPreviousSibling()
! if p is None or p.getNodeName() is not doc.getNodeName():
output('<dl>\n')
for c in doc.getChildNodes():
getattr(self, self.element_types[c.getNodeName()])(c, level, output)
n=doc.getNextSibling()
! if n is None or n.getNodeName() is not doc.getNodeName():
output('</dl>\n')
!
def descriptionTitle(self, doc, level, output):
output('<dt>')
***************
*** 99,103 ****
getattr(self, self.element_types[c.getNodeName()])(c, level, output)
output('</dt>\n')
!
def descriptionBody(self, doc, level, output):
output('<dd>')
--- 98,102 ----
getattr(self, self.element_types[c.getNodeName()])(c, level, output)
output('</dt>\n')
!
def descriptionBody(self, doc, level, output):
output('<dd>')
***************
*** 110,130 ****
if p is None or p.getNodeName() is not doc.getNodeName():
output('\n<ul>\n')
! output('<li><p>')
for c in doc.getChildNodes():
getattr(self, self.element_types[c.getNodeName()])(c, level, output)
n=doc.getNextSibling()
! output('</p></li>\n')
! if n is None or n.getNodeName() is not doc.getNodeName():
output('\n</ul>\n')
def numbered(self, doc, level, output):
p=doc.getPreviousSibling()
! if p is None or p.getNodeName() is not doc.getNodeName():
output('\n<ol>\n')
! output('<li><p>')
for c in doc.getChildNodes():
getattr(self, self.element_types[c.getNodeName()])(c, level, output)
n=doc.getNextSibling()
! output('</p></li>\n')
if n is None or n.getNodeName() is not doc.getNodeName():
output('\n</ol>\n')
--- 109,129 ----
if p is None or p.getNodeName() is not doc.getNodeName():
output('\n<ul>\n')
! output('<li>')
for c in doc.getChildNodes():
getattr(self, self.element_types[c.getNodeName()])(c, level, output)
n=doc.getNextSibling()
! output('</li>\n')
! if n is None or n.getNodeName() is not doc.getNodeName():
output('\n</ul>\n')
def numbered(self, doc, level, output):
p=doc.getPreviousSibling()
! if p is None or p.getNodeName() is not doc.getNodeName():
output('\n<ol>\n')
! output('<li>')
for c in doc.getChildNodes():
getattr(self, self.element_types[c.getNodeName()])(c, level, output)
n=doc.getNextSibling()
! output('</li>\n')
if n is None or n.getNodeName() is not doc.getNodeName():
output('\n</ol>\n')
***************
*** 142,146 ****
def paragraph(self, doc, level, output):
! i=0
output('<p>')
for c in doc.getChildNodes():
--- 141,145 ----
def paragraph(self, doc, level, output):
!
output('<p>')
for c in doc.getChildNodes():
***************
*** 176,180 ****
getattr(self, self.element_types[c.getNodeName()])(c, level, output)
output('</strong>')
!
def underline(self, doc, level, output):
output("<u>")
--- 175,179 ----
getattr(self, self.element_types[c.getNodeName()])(c, level, output)
output('</strong>')
!
def underline(self, doc, level, output):
output("<u>")
***************
*** 182,186 ****
getattr(self, self.element_types[c.getNodeName()])(c, level, output)
output("</u>")
!
def innerLink(self, doc, level, output):
output('<a href="#ref');
--- 181,185 ----
getattr(self, self.element_types[c.getNodeName()])(c, level, output)
output("</u>")
!
def innerLink(self, doc, level, output):
output('<a href="#ref');
***************
*** 191,195 ****
getattr(self, self.element_types[c.getNodeName()])(c, level, output)
output(']</a>')
!
def namedLink(self, doc, level, output):
output('<a name="ref')
--- 190,194 ----
getattr(self, self.element_types[c.getNodeName()])(c, level, output)
output(']</a>')
!
def namedLink(self, doc, level, output):
output('<a name="ref')
***************
*** 200,204 ****
getattr(self, self.element_types[c.getNodeName()])(c, level, output)
output(']</a>')
!
def sgml(self,doc,level,output):
for c in doc.getChildNodes():
--- 199,203 ----
getattr(self, self.element_types[c.getNodeName()])(c, level, output)
output(']</a>')
!
def sgml(self,doc,level,output):
for c in doc.getChildNodes():
***************
*** 208,212 ****
val = doc.getNodeValue()
output('<a href="#ref%s">[%s]</a>' % (val, val) )
!
def table(self,doc,level,output):
"""
--- 207,211 ----
val = doc.getNodeValue()
output('<a href="#ref%s">[%s]</a>' % (val, val) )
!
def table(self,doc,level,output):
"""
***************
*** 236,242 ****
output("</tr>\n")
output("</table>\n")
-
-
-
-
-
--- 235,236 ----
Index: HTMLWithImages.py
===================================================================
RCS file: /cvsroot/happydoc/HappyDoc/happydoclib/docstring/StructuredText/HTMLWithImages.py,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** HTMLWithImages.py 8 Dec 2001 13:56:02 -0000 1.2
--- HTMLWithImages.py 25 Aug 2002 14:40:59 -0000 1.3
***************
*** 2,6 ****
#
# Copyright (c) 2001 Zope Corporation and Contributors. All Rights Reserved.
! #
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
--- 2,6 ----
#
# Copyright (c) 2001 Zope Corporation and Contributors. All Rights Reserved.
! #
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
***************
*** 9,23 ****
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE
! #
##############################################################################
- from string import join, split, find
- import re, sys, ST
- import time
from HTMLClass import HTMLClass
ets = HTMLClass.element_types
! ets.update({'StructuredTextImage': 'image'})
class HTMLWithImages(HTMLClass):
--- 9,20 ----
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE
! #
##############################################################################
from HTMLClass import HTMLClass
ets = HTMLClass.element_types
! ets.update({'StructuredTextImage': 'image'})
class HTMLWithImages(HTMLClass):
***************
*** 25,56 ****
element_types = ets
- def document(self, doc, level, output):
- output('<html>\n')
- children=doc.getChildNodes()
- if (children and
- children[0].getNodeName() == 'StructuredTextSection'):
- output('<head>\n<title>%s</title>\n</head>\n' %
- children[0].getChildNodes()[0].getNodeValue())
- output('<body bgcolor="#FFFFFF">\n')
- for c in children:
- getattr(self, self.element_types[c.getNodeName()])(c, level, output)
- output('</body>\n')
- output('</html>\n')
def image(self, doc, level, output):
! if hasattr(doc, 'key'):
! output('<a name="%s"></a>\n' % doc.key)
! output('<img src="%s" alt="%s">\n' % (doc.href, doc.getNodeValue()))
! if doc.getNodeValue() and hasattr(doc, 'key'):
! output('<p><b>Figure %s</b> %s</p>\n' % (doc.key, doc.getNodeValue()))
!
! def xref(self, doc, level, output):
! val = doc.getNodeValue()
! output('<a href="#%s">Figure %s</a>' % (val, val) )
!
!
!
!
!
!
!
--- 22,30 ----
element_types = ets
def image(self, doc, level, output):
! if hasattr(doc, 'key'):
! output('<a name="%s"></a>\n' % doc.key)
! output('<img src="%s" alt="%s">\n' % (doc.href, doc.getNodeValue()))
! if doc.getNodeValue() and hasattr(doc, 'key'):
! output('<p><b>Figure %s</b> %s</p>\n' % (doc.key, doc.getNodeValue()))
Index: ST.py
===================================================================
RCS file: /cvsroot/happydoc/HappyDoc/happydoclib/docstring/StructuredText/ST.py,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** ST.py 24 Oct 2001 21:27:35 -0000 1.1
--- ST.py 25 Aug 2002 14:40:59 -0000 1.2
***************
*** 1,4 ****
import re, STDOM
- from string import split, join, replace, expandtabs, strip, find
#####################################################################
--- 1,16 ----
+ ##############################################################################
+ #
+ # Copyright (c) 2001 Zope Corporation and Contributors. All Rights Reserved.
+ #
+ # This software is subject to the provisions of the Zope Public License,
+ # Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
+ # THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+ # WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+ # FOR A PARTICULAR PURPOSE
+ #
+ ##############################################################################
+
import re, STDOM
#####################################################################
***************
*** 7,14 ****
def indention(str,front = re.compile("^\s+").match):
! """
Find the number of leading spaces. If none, return 0.
"""
!
result = front(str)
if result is not None:
--- 19,26 ----
def indention(str,front = re.compile("^\s+").match):
! """
Find the number of leading spaces. If none, return 0.
"""
!
result = front(str)
if result is not None:
***************
*** 37,41 ****
#print "parent for level ", level, " was => ", run.getColorizableTexts()
return run.getSubparagraphs()
!
def display(struct):
"""
--- 49,53 ----
#print "parent for level ", level, " was => ", run.getColorizableTexts()
return run.getSubparagraphs()
!
def display(struct):
"""
***************
*** 45,49 ****
the orignal paragraphs.
"""
!
if struct.getColorizableTexts():
print join(struct.getColorizableTexts()),"\n"
--- 57,61 ----
the orignal paragraphs.
"""
!
if struct.getColorizableTexts():
print join(struct.getColorizableTexts()),"\n"
***************
*** 51,55 ****
for x in struct.getSubparagraphs():
display(x)
!
def display2(struct):
"""
--- 63,67 ----
for x in struct.getSubparagraphs():
display(x)
!
def display2(struct):
"""
***************
*** 57,63 ****
the paragraphs. If the insertion works
correctly, display's results should mimic
! the orignal paragraphs.
"""
!
if struct.getNodeValue():
print struct.getNodeValue(),"\n"
--- 69,75 ----
the paragraphs. If the insertion works
correctly, display's results should mimic
! the orignal paragraphs.
"""
!
if struct.getNodeValue():
print struct.getNodeValue(),"\n"
***************
*** 65,69 ****
for x in struct.getSubparagraphs():
display(x)
!
def findlevel(levels,indent):
"""
--- 77,81 ----
for x in struct.getSubparagraphs():
display(x)
!
def findlevel(levels,indent):
"""
***************
*** 73,77 ****
paragraph
"""
!
keys = levels.keys()
for key in keys:
--- 85,89 ----
paragraph
"""
!
keys = levels.keys()
for key in keys:
***************
*** 98,102 ****
def StructuredText(paragraphs, delimiter=re.compile(para_delim)):
"""
! StructuredText accepts paragraphs, which is a list of
lines to be parsed. StructuredText creates a structure
which mimics the structure of the paragraphs.
--- 110,114 ----
def StructuredText(paragraphs, delimiter=re.compile(para_delim)):
"""
! StructuredText accepts paragraphs, which is a list of
lines to be parsed. StructuredText creates a structure
which mimics the structure of the paragraphs.
***************
*** 111,132 ****
run = struct
! paragraphs = expandtabs(paragraphs)
paragraphs = '%s%s%s' % ('\n\n', paragraphs, '\n\n')
paragraphs = delimiter.split(paragraphs)
! paragraphs = filter(strip, paragraphs)
if not paragraphs: return StructuredTextDocument()
!
ind = [] # structure based on indention levels
for paragraph in paragraphs:
ind.append([indention(paragraph), paragraph])
!
currentindent = indention(paragraphs[0])
levels[0] = currentindent
!
#############################################################
# updated #
#############################################################
!
for indent,paragraph in ind :
if indent == 0:
--- 123,144 ----
run = struct
! paragraphs = paragraphs.expandtabs()
paragraphs = '%s%s%s' % ('\n\n', paragraphs, '\n\n')
paragraphs = delimiter.split(paragraphs)
! paragraphs = [ x for x in paragraphs if x.strip() ]
if not paragraphs: return StructuredTextDocument()
!
ind = [] # structure based on indention levels
for paragraph in paragraphs:
ind.append([indention(paragraph), paragraph])
!
currentindent = indention(paragraphs[0])
levels[0] = currentindent
!
#############################################################
# updated #
#############################################################
!
for indent,paragraph in ind :
if indent == 0:
***************
*** 157,163 ****
else:
run = struct
! currentindet = indent
run.append(StructuredTextParagraph(paragraph, indent=indent, level=currentlevel))
!
return StructuredTextDocument(struct)
--- 169,175 ----
else:
run = struct
! currentindent = indent
run.append(StructuredTextParagraph(paragraph, indent=indent, level=currentlevel))
!
return StructuredTextDocument(struct)
***************
*** 172,176 ****
self._src=src
self._subs=list(subs)
!
self._attributes=kw.keys()
for k, v in kw.items(): setattr(self, k, v)
--- 184,188 ----
self._src=src
self._subs=list(subs)
!
self._attributes=kw.keys()
for k, v in kw.items(): setattr(self, k, v)
***************
*** 183,187 ****
def getAttribute(self, name):
return getattr(self, name, None)
!
def getAttributeNode(self, name):
if hasattr(self, name):
--- 195,199 ----
def getAttribute(self, name):
return getattr(self, name, None)
!
def getAttributeNode(self, name):
if hasattr(self, name):
***************
*** 214,218 ****
for p in self._subs: a(`p`)
a((' '*(self.indent or 0))+'])')
! return join(r,'\n')
"""
--- 226,230 ----
for p in self._subs: a(`p`)
a((' '*(self.indent or 0))+'])')
! return '\n'.join(r)
"""
***************
*** 222,229 ****
def _get_Children(self, type=type, lt=type([])):
return self.getChildren(type,lt)
!
def _get_Attribute(self, name):
return self.getAttribute(name)
!
def _get_AttributeNode(self, name):
return self.getAttributeNode(name)
--- 234,241 ----
def _get_Children(self, type=type, lt=type([])):
return self.getChildren(type,lt)
!
def _get_Attribute(self, name):
return self.getAttribute(name)
!
def _get_AttributeNode(self, name):
return self.getAttributeNode(name)
***************
*** 250,254 ****
"""
_attributes=()
!
def __init__(self, subs=None, **kw):
apply(StructuredTextParagraph.__init__,
--- 262,266 ----
"""
_attributes=()
!
def __init__(self, subs=None, **kw):
apply(StructuredTextParagraph.__init__,
***************
*** 258,265 ****
def getChildren(self...
[truncated message content] |
|
From: Doug H. <dou...@us...> - 2002-08-25 14:41:01
|
Update of /cvsroot/happydoc/HappyDoc/happydoclib/docstring
In directory usw-pr-cvs1:/tmp/cvs-serv474/happydoclib/docstring
Modified Files:
docstring_StructuredText.py
Log Message:
Updated to the latest StructuredText implementation from Zope CVS.
Index: docstring_StructuredText.py
===================================================================
RCS file: /cvsroot/happydoc/HappyDoc/happydoclib/docstring/docstring_StructuredText.py,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** docstring_StructuredText.py 12 May 2002 21:22:29 -0000 1.5
--- docstring_StructuredText.py 25 Aug 2002 14:40:58 -0000 1.6
***************
*** 449,502 ****
<ul>
! <li><p>A single-line paragraph whose immediately succeeding paragraphs are lower
! level is treated as a header.</p></li>
! <li><p>A paragraph that begins with a '-', <code>*</code>, or <code>o</code> is treated as an
! unordered list (bullet) element.</p></li>
! <li><p>A paragraph that begins with a sequence of digits followed by a
! white-space character is treated as an ordered list element.</p></li>
! <li><p>A paragraph that begins with a sequence of sequences, where each
sequence is a sequence of digits or a sequence of letters followed
! by a period, is treated as an ordered list element.</p></li>
! <li><p>A paragraph with a first line that contains some text, followed by
some white-space and <code>--</code> is treated as
a descriptive list element. The leading text is treated as the
! element title.</p></li>
! <li><p>Sub-paragraphs of a paragraph that ends in the word <code>example</code> or the
! word <code>examples</code>, or <code>::</code> is treated as example code and is output as is.</p></li>
! <li><p>Text enclosed single quotes (with white-space to the left of the
first quote and whitespace or puctuation to the right of the second quote)
! is treated as example code.</p></li>
! <li><p>Text surrounded by '<em><code> characters (with white-space to the left of the
! first </code></em>' and whitespace or puctuation to the right of the second <code>*</code>)
! is emphasized.</p></li>
! <li><p>Text surrounded by '<strong><code> characters (with white-space to the left of the
! first </code></strong>' and whitespace or puctuation to the right of the second <code>**</code>)
! is made strong.</p></li>
! <li><p>Text surrounded by <code>_</code> underscore characters (with whitespace to the left
! and whitespace or punctuation to the right) is made underlined.</p></li>
! <li><p>Text encloded by double quotes followed by a colon, a URL, and concluded
by punctuation plus white space, <em>or</em> just white space, is treated as a
hyper link. For example:<p> <a href="http://www.zope.org/">Zope</a> is ...</p>
<p> Is interpreted as '<a href="http://www.zope.org/">Zope</a> is ....'
Note: This works for relative as well as absolute URLs.</p>
! </p></li>
! <li><p>Text enclosed by double quotes followed by a comma, one or more spaces,
an absolute URL and concluded by punctuation plus white space, or just
white space, is treated as a hyper link. For example: <p> <a href="mailto:am...@di...">mail me</a>.</p>
<p> Is interpreted as '<a href="mailto:am...@di...">mail me</a>.' </p>
! </p></li>
! <li><p>Text enclosed in brackets which consists only of letters, digits,
underscores and dashes is treated as hyper links within the document.
For example:<p> As demonstrated by Smith <a href="#12"><a href="#ref12">[12]</a></a> this technique is quite effective.</p>
<p> Is interpreted as '... by Smith <a href="#12"><a href="#ref12">[12]</a></a> this ...'. Together
with the next rule this allows easy coding of references or end notes.</p>
! </p></li>
! <li><p>Text enclosed in brackets which is preceded by the start of a line, two
periods and a space is treated as a named link. For example:<p> .. <a href="#12"><a href="#ref12">[12]</a></a> "Effective Techniques" Smith, Joe ... </p>
<p> Is interpreted as '<a name="12"><a href="#ref12">[12]</a></a> "Effective Techniques" ...'.
Together with the previous rule this allows easy coding of references or
end notes. </p>
! </p></li>
! <li><p>A paragraph that has blocks of text enclosed in <code>||</code> is treated as a
table. The text blocks correspond to table cells and table rows are
denoted by newlines. By default the cells are center aligned. A cell
--- 449,502 ----
<ul>
! <li>A single-line paragraph whose immediately succeeding paragraphs are lower
! level is treated as a header.</li>
! <li>A paragraph that begins with a '-', <code>*</code>, or <code>o</code> is treated as an
! unordered list (bullet) element.</li>
! <li>A paragraph that begins with a sequence of digits followed by a
! white-space character is treated as an ordered list element.</li>
! <li>A paragraph that begins with a sequence of sequences, where each
sequence is a sequence of digits or a sequence of letters followed
! by a period, is treated as an ordered list element.</li>
! <li>A paragraph with a first line that contains some text, followed by
some white-space and <code>--</code> is treated as
a descriptive list element. The leading text is treated as the
! element title.</li>
! <li>Sub-paragraphs of a paragraph that ends in the word <code>example</code> or the
! word <code>examples</code>, or <code>::</code> is treated as example code and is output as is.</li>
! <li>Text enclosed single quotes (with white-space to the left of the
first quote and whitespace or puctuation to the right of the second quote)
! is treated as example code.</li>
! <li>Text surrounded by <code>*</code> characters (with white-space to the left of the
! first <code>*</code> and whitespace or puctuation to the right of the second <code>*</code>)
! is emphasized.</li>
! <li>Text surrounded by <code>**</code> characters (with white-space to the left of the
! first <code>**</code> and whitespace or puctuation to the right of the second <code>**</code>)
! is made strong.</li>
! <li>Text surrounded by <code>_</code> underscore characters (with whitespace to the left
! and whitespace or punctuation to the right) is made underlined.</li>
! <li>Text encloded by double quotes followed by a colon, a URL, and concluded
by punctuation plus white space, <em>or</em> just white space, is treated as a
hyper link. For example:<p> <a href="http://www.zope.org/">Zope</a> is ...</p>
<p> Is interpreted as '<a href="http://www.zope.org/">Zope</a> is ....'
Note: This works for relative as well as absolute URLs.</p>
! </li>
! <li>Text enclosed by double quotes followed by a comma, one or more spaces,
an absolute URL and concluded by punctuation plus white space, or just
white space, is treated as a hyper link. For example: <p> <a href="mailto:am...@di...">mail me</a>.</p>
<p> Is interpreted as '<a href="mailto:am...@di...">mail me</a>.' </p>
! </li>
! <li>Text enclosed in brackets which consists only of letters, digits,
underscores and dashes is treated as hyper links within the document.
For example:<p> As demonstrated by Smith <a href="#12"><a href="#ref12">[12]</a></a> this technique is quite effective.</p>
<p> Is interpreted as '... by Smith <a href="#12"><a href="#ref12">[12]</a></a> this ...'. Together
with the next rule this allows easy coding of references or end notes.</p>
! </li>
! <li>Text enclosed in brackets which is preceded by the start of a line, two
periods and a space is treated as a named link. For example:<p> .. <a href="#12"><a href="#ref12">[12]</a></a> "Effective Techniques" Smith, Joe ... </p>
<p> Is interpreted as '<a name="12"><a href="#ref12">[12]</a></a> "Effective Techniques" ...'.
Together with the previous rule this allows easy coding of references or
end notes. </p>
! </li>
! <li>A paragraph that has blocks of text enclosed in <code>||</code> is treated as a
table. The text blocks correspond to table cells and table rows are
denoted by newlines. By default the cells are center aligned. A cell
***************
*** 528,532 ****
</pre>
</p>
! </p></li>
</ul>
--- 528,532 ----
</pre>
</p>
! </li>
</ul>
|
|
From: Doug H. <dou...@us...> - 2002-08-25 14:40:28
|
Update of /cvsroot/happydoc/HappyDoc/happydoclib
In directory usw-pr-cvs1:/tmp/cvs-serv373/happydoclib
Modified Files:
happydocstring.py
Log Message:
Added _compareText() method to make it easier to see where a converted
block of text differs from the expected result.
Index: happydocstring.py
===================================================================
RCS file: /cvsroot/happydoc/HappyDoc/happydoclib/happydocstring.py,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** happydocstring.py 4 Aug 2002 10:47:30 -0000 1.3
--- happydocstring.py 25 Aug 2002 14:40:24 -0000 1.4
***************
*** 192,195 ****
--- 192,213 ----
return
+ def _compareText(self, expected, actual):
+ expected_lines = expected.split('\n')
+ actual_lines = actual.split('\n')
+ num_lines = max(len(expected_lines), len(actual_lines))
+ for i in range(num_lines):
+ try:
+ e_line = expected_lines[i]
+ except IndexError:
+ self.fail('Actual result has more lines than expected.')
+ try:
+ a_line = actual_lines[i]
+ except IndexError:
+ self.fail('Expected result has more lines than actual.')
+ self.failUnlessEqual(
+ e_line, a_line,
+ 'Mismatch at line %d: "%s" is not "%s"' % (i, a_line, e_line))
+ return
+
def _testConversion(self, inputText, inputFormat, outputFormat, expectedText,
errorMessage,
***************
*** 204,210 ****
print '[EXPECTED[%s]EXPECTED]' % expectedText
print '[CONVERTED[%s]CONVERTED]' % converted_text
! assert (converted_text == expectedText), '%s ("%s", "%s") ' % (errorMessage,
! expectedText,
! converted_text)
return
--- 222,226 ----
print '[EXPECTED[%s]EXPECTED]' % expectedText
print '[CONVERTED[%s]CONVERTED]' % converted_text
! self._compareText(expectedText, converted_text)
return
|
|
From: Doug H. <dou...@us...> - 2002-08-24 20:56:39
|
Update of /cvsroot/happydoc/HappyDoc
In directory usw-pr-cvs1:/tmp/cvs-serv5099
Modified Files:
CHANGES.txt
Log Message:
Updated release notes.
Index: CHANGES.txt
===================================================================
RCS file: /cvsroot/happydoc/HappyDoc/CHANGES.txt,v
retrieving revision 1.30
retrieving revision 1.31
diff -C2 -d -r1.30 -r1.31
*** CHANGES.txt 24 Aug 2002 20:43:10 -0000 1.30
--- CHANGES.txt 24 Aug 2002 20:56:36 -0000 1.31
***************
*** 3,6 ****
--- 3,9 ----
Version 2.1 --
+ The primary reason for this release is to resolve the infamous *-d
+ bug*.
+
- **New Features**
|
|
From: Doug H. <dou...@us...> - 2002-08-24 20:56:39
|
Update of /cvsroot/happydoc/HappyDoc/misc
In directory usw-pr-cvs1:/tmp/cvs-serv5099/misc
Modified Files:
ANNOUNCE.txt
Log Message:
Updated release notes.
Index: ANNOUNCE.txt
===================================================================
RCS file: /cvsroot/happydoc/HappyDoc/misc/ANNOUNCE.txt,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** ANNOUNCE.txt 5 Feb 2002 12:47:23 -0000 1.5
--- ANNOUNCE.txt 24 Aug 2002 20:56:36 -0000 1.6
***************
*** 18,55 ****
in the 'bin' directory.
! Version 2.0.1 --
! The primary reason for this release is to resolve several bugs
! which prevented Win32 support from working properly. Support for
! Win32 operating systems should now be restored.
- **New Features**
! - Added limited support for CGI programs by expanding the docset
! processing to look for files ending in '.cgi' as well as
! '.py'.
- **Bug Fixes**
! - Resolved defect #505456 and 498204, a problem with
! 'happydocwin.py' that prevented it from working properly on
! Win32 systems.
! - Resolved defect #501240 so that path handling under Win32
! systems works properly and HappyDoc can generate output.
! - Resolved defect #505188 so that using the '-o' option will
! properly send output to stdout.
- **Other Changes**
! - Added more unit tests for formatters, especially
! 'fileformatterbase.py' and 'formatter_HTMLFile.py'.
- - Updated the StructuredTextNG docstring converter so that if an
- exception is generated during parsing of the ST, we fall back
- to ClassicStructuredText. The two syntaxes appear to be
- incompatible, and this should protect backwards compatibility
- for most users.
--- 18,57 ----
in the 'bin' directory.
! Version 2.1 --
! The primary reason for this release is to resolve the infamous *-d
! bug*.
- **New Features**
! - #514237 - The PluginLoader no longer requires a '.py'
! extension on plugins. This should allow plugins to be written
! in any language for which Python can load a module, and as
! long as the file is named with the right convention they will
! be picked up and loaded. (The source of this change request
! was the maintainers of the PLD Linux Distribution.)
- **Bug Fixes**
! - Resolved defect #513850, where output was written to the wrong
! place when the -d option was used.
! **NOTE** *The solution to this problem resulted in changes to
! the file names being used for output. It is recommended that
! a new directory be used to generate documentation for existing
! code, rather than trying to write over the top of existing
! files.*
! - Resolved defect #510447, a problem with escaping special
! characters in HTML output. Text enclosed in single quotes
! is now not escaped in output so that HTML text can be
! passed directly to the output file.
!
! - Fixed a problem with Windows installation using 'setup.py'.
- **Other Changes**
! - Minor tweaks to the build and test tools.
|
|
From: Doug H. <dou...@us...> - 2002-08-24 20:45:45
|
Update of /cvsroot/happydoc/HappyDoc
In directory usw-pr-cvs1:/tmp/cvs-serv2230
Modified Files:
README.txt
Log Message:
Add a comment describing where to go to get a complete list of the
options available for each plugin.
Index: README.txt
===================================================================
RCS file: /cvsroot/happydoc/HappyDoc/README.txt,v
retrieving revision 1.48
retrieving revision 1.49
diff -C2 -d -r1.48 -r1.49
*** README.txt 28 Jun 2002 11:27:19 -0000 1.48
--- README.txt 24 Aug 2002 20:45:42 -0000 1.49
***************
*** 180,183 ****
--- 180,186 ----
formatter_bgcolor1="#ffccaa"
+ Use the '--help' command line option to get a complete list of the
+ options available for each Parser, DocSets, and Formatter.
+
File-specific Parser Configuration Values
|
|
From: Doug H. <dou...@us...> - 2002-08-24 20:43:13
|
Update of /cvsroot/happydoc/HappyDoc
In directory usw-pr-cvs1:/tmp/cvs-serv1594
Modified Files:
CHANGES.txt
Log Message:
Updated with comments for 2.1.
Index: CHANGES.txt
===================================================================
RCS file: /cvsroot/happydoc/HappyDoc/CHANGES.txt,v
retrieving revision 1.29
retrieving revision 1.30
diff -C2 -d -r1.29 -r1.30
*** CHANGES.txt 10 Feb 2002 13:24:52 -0000 1.29
--- CHANGES.txt 24 Aug 2002 20:43:10 -0000 1.30
***************
*** 1,10 ****
HappyDoc Change History
! Version 2.0.2 --
- **New Features**
- **Bug Fixes**
- Resolved defect #510447, a problem with escaping special
characters in HTML output. Text enclosed in single quotes
--- 1,26 ----
HappyDoc Change History
! Version 2.1 --
- **New Features**
+ - #514237 - The PluginLoader no longer requires a '.py'
+ extension on plugins. This should allow plugins to be written
+ in any language for which Python can load a module, and as
+ long as the file is named with the right convention they will
+ be picked up and loaded. (The source of this change request
+ was the maintainers of the PLD Linux Distribution.)
+
- **Bug Fixes**
+ - Resolved defect #513850, where output was written to the wrong
+ place when the -d option was used.
+
+ **NOTE** *The solution to this problem resulted in changes to
+ the file names being used for output. It is recommended that
+ a new directory be used to generate documentation for existing
+ code, rather than trying to write over the top of existing
+ files.*
+
- Resolved defect #510447, a problem with escaping special
characters in HTML output. Text enclosed in single quotes
***************
*** 12,18 ****
passed directly to the output file.
! -
- **Other Changes**
--- 28,36 ----
passed directly to the output file.
! - Fixed a problem with Windows installation using 'setup.py'.
- **Other Changes**
+
+ - Minor tweaks to the build and test tools.
|
|
From: Doug H. <dou...@us...> - 2002-08-24 19:57:25
|
Update of /cvsroot/happydoc/HappyDoc/happydoclib/docstring
In directory usw-pr-cvs1:/tmp/cvs-serv20408/happydoclib/docstring
Modified Files:
docstring_ClassicStructuredText.py
Log Message:
Improved fix for -d problem.
Index: docstring_ClassicStructuredText.py
===================================================================
RCS file: /cvsroot/happydoc/HappyDoc/happydoclib/docstring/docstring_ClassicStructuredText.py,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** docstring_ClassicStructuredText.py 28 Oct 2001 13:40:25 -0000 1.2
--- docstring_ClassicStructuredText.py 24 Aug 2002 19:57:22 -0000 1.3
***************
*** 357,361 ****
filename = 'TestCases/test_classic_structuredtext.py'
import happydoclib.parseinfo
! parsed_module = happydoclib.parseinfo.getDocs(filename)
input_text = parsed_module._docstring
--- 357,361 ----
filename = 'TestCases/test_classic_structuredtext.py'
import happydoclib.parseinfo
! parsed_module = happydoclib.parseinfo.getDocs(None, filename)
input_text = parsed_module._docstring
|
|
From: Doug H. <dou...@us...> - 2002-08-24 19:57:10
|
Update of /cvsroot/happydoc/HappyDoc/happydoclib
In directory usw-pr-cvs1:/tmp/cvs-serv20338/happydoclib
Modified Files:
happydocset.py
Log Message:
Improved fix for -d problem.
Index: happydocset.py
===================================================================
RCS file: /cvsroot/happydoc/HappyDoc/happydoclib/happydocset.py,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** happydocset.py 4 Aug 2002 12:03:58 -0000 1.9
--- happydocset.py 24 Aug 2002 19:57:07 -0000 1.10
***************
*** 342,345 ****
--- 342,353 ----
fully_qualified_name = formatter.getOutputNameForObject(self)
happydoclib.TRACE.writeVar(fully_qualified_name=fully_qualified_name)
+
+ extension = '.%s' % formatter.getFilenameExtension()
+ len_extension = len(extension)
+ if fully_qualified_name[-len_extension:] == extension:
+ happydoclib.TRACE.write('fully qualified name has extension')
+ fully_qualified_name = fully_qualified_name[:-len_extension]
+ happydoclib.TRACE.writeVar(fully_qualified_name=fully_qualified_name)
+
root_node_name = formatter.getRootNodeName()
my_root_node = happydoclib.path.join(fully_qualified_name, root_node_name)
***************
*** 356,360 ****
happydoclib.TRACE.into('DocSet', 'getFullOutputNameForObject',
infoObject=infoObject)
! output_name = self._formatter.getFullOutputNameForObject(infoObject)
happydoclib.TRACE.outof(output_name)
return output_name
--- 364,371 ----
happydoclib.TRACE.into('DocSet', 'getFullOutputNameForObject',
infoObject=infoObject)
! if infoObject is None:
! output_name = self._formatter.getFullOutputNameForObject(None)
! else:
! output_name = self._formatter.getFullOutputNameForObject(infoObject)
happydoclib.TRACE.outof(output_name)
return output_name
***************
*** 546,549 ****
--- 557,573 ----
'''
+ current_docset_path = self.getPath()
+ happydoclib.TRACE.writeVar(current_docset_path=current_docset_path)
+
+ docset_base_directory_prefix = docsetBaseDirectory[:-len(packageName)]
+ while (docset_base_directory_prefix
+ and
+ (docset_base_directory_prefix[-1] == os.sep)
+ ):
+ docset_base_directory_prefix = docset_base_directory_prefix[:-1]
+ happydoclib.TRACE.writeVar(
+ docset_base_directory_prefix=docset_base_directory_prefix,
+ )
+
constructor_args = {
'formatterFactory':self._formatter_factory,
***************
*** 565,568 ****
--- 589,593 ----
'statusMessageFunc':self._status_message_func,
'useRecursion':self._use_recursion,
+ 'parent':self,
}
#
***************
*** 590,599 ****
)
self.statusMessage('Getting info for %s' % fileName)
! info = self._parser_func( fileName,
! self._include_comments,
! self._default_parser_config_values,
! )
! happydoclib.TRACE.outof(info)
! return info
def lookForPrewrittenFiles(self, dirName):
--- 615,625 ----
)
self.statusMessage('Getting info for %s' % fileName)
! module_info = self._parser_func( self,
! fileName,
! self._include_comments,
! self._default_parser_config_values,
! )
! happydoclib.TRACE.outof(module_info)
! return module_info
def lookForPrewrittenFiles(self, dirName):
***************
*** 846,868 ****
class DocsetUnitTest(happydoclib.StreamFlushTest.StreamFlushTest):
!
! def testPackageSummaries(self):
! filename = 'TestCases/test_package_summaries'
!
! basic_expected_package_info = {
! 'FromInit':'Summary from __init__.py',
! 'FromReadme':'Summary from README',
! 'FromReadmeTxt':'Summary from README.txt',
! 'FromTitle':'HappyDoc Generated Documentation (use -t to specify a new title): Nested.FromTitle',
! }
! basic_expected_package_names = basic_expected_package_info.keys()
!
! parent_expected_package_info = {}
! parent_expected_package_info.update(basic_expected_package_info)
! parent_expected_package_info['Nested'] = 'Nested Modules'
! parent_expected_package_info['FromTitle'] = 'HappyDoc Generated Documentation (use -t to specify a new title): FromTitle'
! parent_expected_package_names = parent_expected_package_info.keys()
!
! #module = getDocs(None, filename)
import happydoclib.formatter.formatter_Null
docset = DocSet( formatterFactory=happydoclib.formatter.formatter_Null.NullFormatter,
--- 872,879 ----
class DocsetUnitTest(happydoclib.StreamFlushTest.StreamFlushTest):
!
! def testOutputDirectory(self):
! filename = 'TestCases/test.py'
! test_output_dir = 'c:\\happydoc\\HappyDocTestOut'
import happydoclib.formatter.formatter_Null
docset = DocSet( formatterFactory=happydoclib.formatter.formatter_Null.NullFormatter,
***************
*** 870,906 ****
defaultParserConfigValues={'docStringFormat':'StructuredText'},
inputModuleNames=[ filename ],
! outputBaseDirectory=self.output_dir,
statusMessageFunc=self.status_message_func,
)
! for m in docset.data:
! name = m.getName()
! assert name in parent_expected_package_names, \
! 'Unexpected module %s found in docset.' % name
!
! expected_summary = parent_expected_package_info[name]
!
! actual_summary, format = m.getSummaryAndFormat()
! assert actual_summary == expected_summary, \
! 'Summary values do not match for %s (expected "%s", got "%s")' \
! % (name, expected_summary, actual_summary)
!
! if name == 'Nested':
! for cm in m.data:
! cname = cm.getName()
! if cname == '__init__':
! continue
! assert cname in basic_expected_package_names, \
! 'Unexpected child module %s found in child docset.' % cname
!
! cexpected_summary = basic_expected_package_info[cname]
! cactual_summary, format = cm.getSummaryAndFormat()
! assert cactual_summary == cexpected_summary, \
! 'Summary values do not match for child module %s (expected "%s", got "%s")' \
! % (cname, cexpected_summary, cactual_summary)
!
!
! return
def _privateNameTest(self, includePrivateNames):
--- 881,952 ----
defaultParserConfigValues={'docStringFormat':'StructuredText'},
inputModuleNames=[ filename ],
! outputBaseDirectory=test_output_dir,
statusMessageFunc=self.status_message_func,
)
! docset_base_dir = docset.getDocsetBaseDirectory()
! assert docset_base_dir == test_output_dir, 'Docset directory %s does not match %s' % \
! (docset_base_dir, test_output_dir)
! output_base_dir = docset.getOutputBaseDirectory()
! assert docset_base_dir == test_output_dir, 'Output directory %s does not match %s' % \
! (docset_base_dir, test_output_dir)
! docset_file_name = docset.getFilename()
! assert docset_file_name == test_output_dir, 'File name %s does not match expected %s' % \
! (docset_file_name, test_output_dir)
! return
! if os.name != 'nt':
! def testPackageSummaries(self):
! filename = 'TestCases/test_package_summaries'
!
! basic_expected_package_info = {
! 'FromInit':'Summary from __init__.py',
! 'FromReadme':'Summary from README',
! 'FromReadmeTxt':'Summary from README.txt',
! 'FromTitle':'HappyDoc Generated Documentation (use -t to specify a new title): Nested.FromTitle',
! }
! basic_expected_package_names = basic_expected_package_info.keys()
! parent_expected_package_info = {}
! parent_expected_package_info.update(basic_expected_package_info)
! parent_expected_package_info['Nested'] = 'Nested Modules'
! parent_expected_package_info['FromTitle'] = 'HappyDoc Generated Documentation (use -t to specify a new title): FromTitle'
! parent_expected_package_names = parent_expected_package_info.keys()
!
! #module = getDocs(None, filename)
! import happydoclib.formatter.formatter_Null
! docset = DocSet( formatterFactory=happydoclib.formatter.formatter_Null.NullFormatter,
! parserFunc=happydoclib.parseinfo.getDocs,
! defaultParserConfigValues={'docStringFormat':'StructuredText'},
! inputModuleNames=[ filename ],
! outputBaseDirectory=self.output_dir,
! statusMessageFunc=self.status_message_func,
! )
! for m in docset.data:
! name = m.getName()
! assert name in parent_expected_package_names, \
! 'Unexpected module %s found in docset.' % name
!
! expected_summary = parent_expected_package_info[name]
!
! actual_summary, format = m.getSummaryAndFormat()
! assert actual_summary == expected_summary, \
! 'Summary values do not match for %s (expected "%s", got "%s")' \
! % (name, expected_summary, actual_summary)
!
! if name == 'Nested':
! for cm in m.data:
! cname = cm.getName()
! if cname == '__init__':
! continue
! assert cname in basic_expected_package_names, \
! 'Unexpected child module %s found in child docset.' % cname
!
! cexpected_summary = basic_expected_package_info[cname]
!
! cactual_summary, format = cm.getSummaryAndFormat()
! assert cactual_summary == cexpected_summary, \
! 'Summary values do not match for child module %s (expected "%s", got "%s")' \
! % (cname, cexpected_summary, cactual_summary)
! return
def _privateNameTest(self, includePrivateNames):
|
|
From: Doug H. <dou...@us...> - 2002-08-24 19:55:43
|
Update of /cvsroot/happydoc/HappyDoc/happydoclib/parseinfo
In directory usw-pr-cvs1:/tmp/cvs-serv20001/happydoclib/parseinfo
Modified Files:
suite.py
Log Message:
Try for inherited configuration values, and fall back if we cannot get
them from our parent.
Index: suite.py
===================================================================
RCS file: /cvsroot/happydoc/HappyDoc/happydoclib/parseinfo/suite.py,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** suite.py 11 Nov 2001 18:51:37 -0000 1.1
--- suite.py 24 Aug 2002 19:55:40 -0000 1.2
***************
*** 131,138 ****
def getConfigurationValues(self):
"Return any HappyDoc configuration values related to this object."
if self._parent:
! return self._parent.getConfigurationValues()
! else:
! return self._configuration_values
def _extractInfo(self, tree):
--- 131,143 ----
def getConfigurationValues(self):
"Return any HappyDoc configuration values related to this object."
+ values = None
if self._parent:
! try:
! values = self._parent.getConfigurationValues()
! except:
! values = None
! if values is None:
! values = self._configuration_values
! return values
def _extractInfo(self, tree):
|
|
From: Doug H. <dou...@us...> - 2002-08-24 19:53:56
|
Update of /cvsroot/happydoc/HappyDoc/happydoclib/parseinfo
In directory usw-pr-cvs1:/tmp/cvs-serv19573/happydoclib/parseinfo
Modified Files:
__init__.py
Log Message:
Improved fix for -d bug (#513850).
Index: __init__.py
===================================================================
RCS file: /cvsroot/happydoc/HappyDoc/happydoclib/parseinfo/__init__.py,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** __init__.py 4 Aug 2002 12:06:26 -0000 1.7
--- __init__.py 24 Aug 2002 19:53:54 -0000 1.8
***************
*** 126,130 ****
#
! def getDocs(fileName, includeComments=1, defaultConfigValues={}):
"""Retrieve information from the parse tree of a source file.
--- 126,130 ----
#
! def getDocs(parent, fileName, includeComments=1, defaultConfigValues={}):
"""Retrieve information from the parse tree of a source file.
***************
*** 140,148 ****
"""
happydoclib.TRACE.into('parseinfo', 'getDocs',
fileName=fileName,
includeComments=includeComments,
defaultConfigValues=defaultConfigValues,
)
-
f = open(fileName)
#
--- 140,148 ----
"""
happydoclib.TRACE.into('parseinfo', 'getDocs',
+ parent=parent,
fileName=fileName,
includeComments=includeComments,
defaultConfigValues=defaultConfigValues,
)
f = open(fileName)
#
***************
*** 178,184 ****
else:
comment_info = {}
-
happydoclib.TRACE.write('Creating ModuleInfo')
! mod_info = ModuleInfo(parent=None,
tree=tup,
name=base_filename,
--- 178,183 ----
else:
comment_info = {}
happydoclib.TRACE.write('Creating ModuleInfo')
! mod_info = ModuleInfo(parent=parent,
tree=tup,
name=base_filename,
***************
*** 186,191 ****
commentInfo=comment_info,
defaultConfigValues=defaultConfigValues)
!
! happydoclib.TRACE.outof()
return mod_info
--- 185,189 ----
commentInfo=comment_info,
defaultConfigValues=defaultConfigValues)
! happydoclib.TRACE.outof(mod_info)
return mod_info
***************
*** 220,224 ****
comments_flag = self.include_comments.get(name, 1)
self.filename = filename
! self.parsed_module = getDocs(filename, includeComments=comments_flag)
return
--- 218,222 ----
comments_flag = self.include_comments.get(name, 1)
self.filename = filename
! self.parsed_module = getDocs(None, filename, includeComments=comments_flag)
return
|
|
From: Doug H. <dou...@us...> - 2002-08-24 19:53:34
|
Update of /cvsroot/happydoc/HappyDoc/happydoclib/formatter
In directory usw-pr-cvs1:/tmp/cvs-serv19480/happydoclib/formatter
Modified Files:
formatter_HTMLFile.py
Log Message:
Improved fix for -d bug (#513850).
Also fix table cell color problem in Mozilla.
Index: formatter_HTMLFile.py
===================================================================
RCS file: /cvsroot/happydoc/HappyDoc/happydoclib/formatter/formatter_HTMLFile.py,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** formatter_HTMLFile.py 10 Feb 2002 13:37:12 -0000 1.5
--- formatter_HTMLFile.py 24 Aug 2002 19:53:31 -0000 1.6
***************
*** 211,222 ****
# Figure out the name of the infoSource
#
-
- if not name:
- name = self.getNameForInfoSource( infoSource )
happydoclib.TRACE.into('HTMLTableFormatter', 'getReference',
name=name,
relativeSource=relativeSource,
)
! info_source_path = self.getOutputNameForObject( infoSource )
link = happydoclib.path.computeRelativeHTMLLink(
relativeSource,
--- 211,230 ----
# Figure out the name of the infoSource
#
happydoclib.TRACE.into('HTMLTableFormatter', 'getReference',
+ infoSource=infoSource,
name=name,
relativeSource=relativeSource,
)
!
! if hasattr(infoSource, 'getPath'):
! path = infoSource.getPath()
! happydoclib.TRACE.writeVar(path=path)
! if not name:
! name = self.getNameForInfoSource( infoSource )
! happydoclib.TRACE.writeVar(name=name)
!
! info_source_path = self.getFullOutputNameForObject( infoSource )
! happydoclib.TRACE.writeVar(info_source_path=info_source_path)
!
link = happydoclib.path.computeRelativeHTMLLink(
relativeSource,
***************
*** 224,228 ****
self._docset.getOutputBaseDirectory()
)
! happydoclib.TRACE.write('link to %s: %s' % (name, link))
if link[0] == '/':
happydoclib.TRACE.write('starts at root')
--- 232,237 ----
self._docset.getOutputBaseDirectory()
)
! happydoclib.TRACE.write('Name is "%s"' % name)
! happydoclib.TRACE.writeVar(link=link)
if link[0] == '/':
happydoclib.TRACE.write('starts at root')
***************
*** 235,239 ****
--- 244,253 ----
}
ref = '<a href="%(link)s">%(name)s</a>' % info
+ #if link=='formatterloader.html':
+ # raise 'DEBUG HERE'
+ #print 'REFERENCE:', ref
+
return happydoclib.TRACE.outof(ref)
+
***************
*** 431,441 ****
<table border="0" cellpadding="5" cellspacing="0" width="100%%">
! <tr bgcolor="%(title_bg)s">
<th rowspan="2"
valign="top"
align="left"
! width="10%%"><font color="%(title_fg)s">%(title)s</font>
</th>
- <th width="90%%" align="right"><font color="%(title_fg)s">%(subtitle)s</font></th>
</tr>
<tr>
--- 445,459 ----
<table border="0" cellpadding="5" cellspacing="0" width="100%%">
! <tr>
<th rowspan="2"
valign="top"
align="left"
! width="10%%"
! bgcolor="%(title_bg)s"><font color="%(title_fg)s">%(title)s</font>
! </th>
! <th bgcolor="%(title_bg)s"
! width="90%%"
! align="right"><font color="%(title_fg)s">%(subtitle)s</font>
</th>
</tr>
<tr>
***************
*** 664,668 ****
def descriptiveListItem(self, output, item, description, descriptionFormat):
"Format and write the 'item' and 'description' for a descriptive list to the 'output'."
! self.writeHTML('<tr><td valign="top" align="left">%s</td>' % item,
output)
self.writeHTML('<td valign="top" align="left">', output)
--- 682,686 ----
def descriptiveListItem(self, output, item, description, descriptionFormat):
"Format and write the 'item' and 'description' for a descriptive list to the 'output'."
! self.writeHTML('<tr><td valign="top" align="left"><p>%s</p></td>' % item,
output)
self.writeHTML('<td valign="top" align="left">', output)
***************
*** 804,808 ****
formatter = docset._formatter
reference = formatter.getNamedReference( cla, 'CommandLineApp', 'index.html' )
! expected_reference = '<a href="happydoclib%sCommandLineApp.py.html#CommandLineApp">CommandLineApp</a>' % os.sep
assert reference == expected_reference, 'Got reference "%s" instead of "%s"' % \
(reference, expected_reference)
--- 822,826 ----
formatter = docset._formatter
reference = formatter.getNamedReference( cla, 'CommandLineApp', 'index.html' )
! expected_reference = '<a href="CommandLineApp.html#CommandLineApp">CommandLineApp</a>'
assert reference == expected_reference, 'Got reference "%s" instead of "%s"' % \
(reference, expected_reference)
|
|
From: Doug H. <dou...@us...> - 2002-08-24 19:51:05
|
Update of /cvsroot/happydoc/HappyDoc/happydoclib/formatter
In directory usw-pr-cvs1:/tmp/cvs-serv18918/happydoclib/formatter
Modified Files:
fileformatterbase.py
Log Message:
Improved fix for -d bug (#513850).
Index: fileformatterbase.py
===================================================================
RCS file: /cvsroot/happydoc/HappyDoc/happydoclib/formatter/fileformatterbase.py,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** fileformatterbase.py 4 Aug 2002 12:06:06 -0000 1.9
--- fileformatterbase.py 24 Aug 2002 19:51:02 -0000 1.10
***************
*** 119,126 ****
--- 119,129 ----
the output path to create a full path.
"""
+ happydoclib.TRACE.into('FileBasedFormatter', 'fixUpOutputFilename',
+ filename=filename)
#
# Remove preceding slashes to make name relative
#
filename = happydoclib.path.removeRelativePrefix(filename)
+ happydoclib.TRACE.writeVar(filename_after_remove_relative_prefix=filename)
#
# Apply the path prefix, if required
***************
*** 129,132 ****
--- 132,137 ----
filename = happydoclib.path.applyPrefixToPath( filename,
self.getFilenamePrefix())
+ happydoclib.TRACE.writeVar(filename_after_apply_prefix=filename)
+ happydoclib.TRACE.outof(filename)
return filename
***************
*** 142,149 ****
--- 147,156 ----
filename=filename)
filename = self.fixUpOutputFilename(filename)
+ happydoclib.TRACE.writeVar(filename=filename)
#
# Set the correct extension for the output file
#
extension = self.getFilenameExtension()
+ happydoclib.TRACE.writeVar(extension=extension)
#
# Build the name
***************
*** 163,179 ****
happydoclib.TRACE.into('FileBasedFormatter', 'getOutputNameForObject',
infoObject=infoObject)
if type(infoObject) == types.StringType:
! happydoclib.TRACE.write('string')
name = infoObject
elif type(infoObject) == types.FileType:
! happydoclib.TRACE.write('file')
name = infoObject.name
elif infoObject is not None:
! happydoclib.TRACE.write('infoObject')
! name = self.getOutputNameForFile(infoObject.getFullyQualifiedName())
happydoclib.TRACE.write('file for %s' % infoObject.getName())
happydoclib.TRACE.write('is %s' % name)
else:
! name = self.getRootNodeName()
happydoclib.TRACE.outof(name)
return name
--- 170,199 ----
happydoclib.TRACE.into('FileBasedFormatter', 'getOutputNameForObject',
infoObject=infoObject)
+
if type(infoObject) == types.StringType:
! happydoclib.TRACE.write('object is a string')
name = infoObject
+
elif type(infoObject) == types.FileType:
! happydoclib.TRACE.write('object is a file')
name = infoObject.name
+
elif infoObject is not None:
! happydoclib.TRACE.write('object is an infoObject')
! #name = self.getOutputNameForFile(infoObject.getFullyQualifiedName())
! name = apply(happydoclib.path.join, infoObject.getPath() )
! name = '%s.%s' % (name, self.getFilenameExtension())
happydoclib.TRACE.write('file for %s' % infoObject.getName())
happydoclib.TRACE.write('is %s' % name)
+
else:
! happydoclib.TRACE.write('object is a root node')
! docset_path = self._docset.getPath()
! if docset_path:
! name = apply(happydoclib.path.join, docset_path )
! name = happydoclib.path.join(name, self.getRootNodeName())
! else:
! name = self.getRootNodeName()
!
happydoclib.TRACE.outof(name)
return name
***************
*** 196,200 ****
return name
-
def getFullOutputNameForObject(self, infoObject):
"""Get the full name, including path, to the object being output.
--- 216,219 ----
***************
*** 206,213 ****
happydoclib.TRACE.into('FileBasedFormatter', 'getFullOutputNameForObject',
infoObject=infoObject)
!
obj_output_name = self.getOutputNameForObject(infoObject)
! docset_base_directory = self._docset.getDocsetBaseDirectory()
output_base = self._docset.getOutputBaseDirectory()
happydoclib.TRACE.writeVar(obj_output_name=obj_output_name)
--- 225,241 ----
happydoclib.TRACE.into('FileBasedFormatter', 'getFullOutputNameForObject',
infoObject=infoObject)
!
! #
! # Get the basic output name for the object
! #
obj_output_name = self.getOutputNameForObject(infoObject)
! #
! # Get the root output directory
! #
output_base = self._docset.getOutputBaseDirectory()
+ #
+ # Get the base input directory for the docset
+ #
+ docset_base_directory = self._docset.getDocsetBaseDirectory()
happydoclib.TRACE.writeVar(obj_output_name=obj_output_name)
***************
*** 216,267 ****
if (not infoObject) and docset_base_directory:
- happydoclib.TRACE.write('root node for docset')
#
! # Root node for docset
#
! output_subdir = happydoclib.path.removePrefix(docset_base_directory, output_base)
! happydoclib.TRACE.writeVar(output_subdir=output_subdir)
! if ( (os.name != 'nt')
! and
! (output_subdir[0] not in (os.sep,
! os.curdir,
! )
! )
! ):
! happydoclib.TRACE.write('adding prefix for os %s' % os.name)
! output_subdir = '%s%s' % (os.sep, output_subdir)
! happydoclib.TRACE.writeVar(output_subdir=output_subdir)
! if output_subdir != output_base:
! happydoclib.TRACE.write('output_subdir and output_base do not match')
! if output_subdir[0] == os.sep:
! output_subdir=output_subdir[1:]
! happydoclib.TRACE.writeVar(output_subdir=output_subdir)
! obj_output_sub_path = happydoclib.path.join(output_subdir, obj_output_name)
! happydoclib.TRACE.writeVar(obj_output_sub_path=obj_output_sub_path)
! obj_output_sub_path = self.fixUpOutputFilename(obj_output_sub_path)
! happydoclib.TRACE.writeVar(obj_output_sub_path=obj_output_sub_path)
! name = happydoclib.path.join(output_base, obj_output_sub_path)
else:
! happydoclib.TRACE.write('output_subdir and output_base do match')
! name = happydoclib.path.join(output_base, obj_output_name)
elif docset_base_directory:
- happydoclib.TRACE.write('subnode of docset')
#
! # Subnode of docset
#
! #file_name = self.getOutputNameForObject(infoObject)
! file_name = obj_output_name
! happydoclib.TRACE.writeVar(file_name=file_name)
! name = happydoclib.path.join(output_base, file_name)
! #name = happydoclib.path.joinWithCommonMiddle(
! # output_base,
! # docset_base_directory,
! # file_name,
! # )
else:
! happydoclib.TRACE.write('other')
#
# How can we get here?
--- 244,345 ----
if (not infoObject) and docset_base_directory:
#
! # For a docset root node, just tack the object
! # output name onto the output base directory.
#
! happydoclib.TRACE.write('ROOT NODE FOR CURRENT DOCSET')
! #
! # Now reduce docset_base_minux_prefix by the
! # path of the docset itself, so we don't end
! # up with duplicate subdirectory names.
! #
! docset_path = self._docset.getPath()
! if docset_path:
! happydoclib.TRACE.write('removing docset_path')
! docset_path = apply(os.path.join, docset_path)
! len_docset_path = len(docset_path)
! docset_base_minus_prefix = docset_base_directory[:-len_docset_path]
! base = docset_base_minus_prefix
else:
! happydoclib.TRACE.write('do not need to remove prefix')
! #base = os.path.join(output_base, docset_base_minus_prefix)
! base = docset_base_directory
+ happydoclib.TRACE.writeVar(
+ base=base,
+ )
+
+ #name = happydoclib.path.join(output_base, obj_output_name)
+ name = happydoclib.path.join(base, obj_output_name)
+
elif docset_base_directory:
#
! # Here we have a real HappyDOM based object.
#
! happydoclib.TRACE.write('SUBNODE OF DOCSET')
! #obj_parent_path = infoObject.getParent().getPath()
! #obj_parent_path = infoObject.getPath()
! #obj_parent_file_path = apply(os.path.join, obj_parent_path)
! #output_dir = happydoclib.path.join(output_base, obj_parent_file_path)
!
! if type(infoObject) == types.StringType:
! #
! # What we have is a name for an external documentation
! # file, and that file name should include the full
! # path from the docset root down to the file, so
! # just stick the output base on the front and we're
! # done.
! #
! happydoclib.TRACE.write('FILENAME')
! name = os.path.join(output_base,
! infoObject)
!
! else:
! happydoclib.TRACE.write('OBJECT')
!
! #
! # Determine if there is any path component between the
! # docset base and the output base.
! #
! prefix = happydoclib.path.commonPrefix(docset_base_directory,
! output_base,
! )
! docset_base_minus_prefix = happydoclib.path.removePrefix(
! docset_base_directory,
! prefix,
! )
! happydoclib.TRACE.writeVar(
! prefix=prefix,
! docset_base_minus_prefix=docset_base_minus_prefix,
! )
!
! #
! # Now reduce docset_base_minux_prefix by the
! # path of the docset itself, so we don't end
! # up with duplicate subdirectory names.
! #
! docset_path = self._docset.getPath()
! if docset_path:
! happydoclib.TRACE.write('removing docset_path')
! docset_path = apply(os.path.join, docset_path)
! len_docset_path = len(docset_path)
! docset_base_minus_prefix = docset_base_minus_prefix[:-len_docset_path]
!
! happydoclib.TRACE.writeVar(
! prefix=prefix,
! docset_base_minus_prefix=docset_base_minus_prefix,
! docset_path=docset_path,
! )
!
! name = os.path.join(output_base,
! docset_base_minus_prefix,
! obj_output_name,
! )
! #name = happydoclib.path.join(output_base, obj_output_name)
! #name = happydoclib.path.join(docset_base_directory, obj_output_name)
else:
! happydoclib.TRACE.write('OTHER')
#
# How can we get here?
***************
*** 269,272 ****
--- 347,352 ----
name = self.getOutputNameForObject(infoObject)
+ #name = os.path.normpath(name)
+
happydoclib.TRACE.outof(name)
return name
***************
*** 281,284 ****
--- 361,367 ----
else:
name = self.getOutputNameForFile(filename)
+
+ name = os.path.normpath(name)
+
return name
***************
*** 296,308 ****
output_base_dir = os.sep + os.path.join('tmp', 'fakedocset', 'output')
def setUp(self):
class FakeDocset:
def getOutputBaseDirectory(self):
return FileFormatterBaseTest.output_base_dir
def getDocsetBaseDirectory(self):
! return os.sep + os.path.join('docset', 'base', 'directory')
class TestFormatter(FileBasedFormatter):
--- 379,405 ----
output_base_dir = os.sep + os.path.join('tmp', 'fakedocset', 'output')
+ if os.name == 'nt':
+ output_base_dir_win32 = 'c:\\%s' % output_base_dir[1:]
def setUp(self):
class FakeDocset:
+
+ def getPath(self):
+ return [ ]
+
def getOutputBaseDirectory(self):
return FileFormatterBaseTest.output_base_dir
def getDocsetBaseDirectory(self):
! return os.path.join(self.getOutputBaseDirectory(),
! 'docset', 'base', 'directory')
!
! class FakeDocsetWin32:
! def getOutputBaseDirectory(self):
! return FileFormatterBaseTest.output_base_dir_win32
!
! def getDocsetBaseDirectory(self):
! return 'c:\\' + os.path.join('docset', 'base', 'directory')
class TestFormatter(FileBasedFormatter):
***************
*** 313,316 ****
--- 410,414 ----
self.formatter = TestFormatter(FakeDocset())
+ self.formatter_win32 = TestFormatter(FakeDocsetWin32())
return
***************
*** 324,327 ****
--- 422,435 ----
return
+ if os.name == 'nt':
+ def testFixUpOutputFilenameFromRootWin32(self):
+ expected = 'c:\\' + os.path.join('fix', 'up', 'filename')
+ actual = self.formatter.fixUpOutputFilename(
+ 'c:\\' + os.path.join('fix', 'up', 'filename')
+ )
+ assert expected == actual, \
+ 'Fixed filenames do not match ("%s" vs. "%s").' % (expected, actual)
+ return
+
def testFixUpOutputFilenameParentDir(self):
expected = os.path.join('fix', 'up', 'filename')
***************
*** 349,352 ****
--- 457,487 ----
'Filenames do not match ("%s" vs. "%s").' % (expected, actual)
return
+
+ def testGetOutputNameForFile(self):
+ filename = 'TestCases/test_package_summaries/FromReadme/README.txt'
+ expected = '%s.%s' % (filename, 'test')
+ actual = self.formatter.getOutputNameForFile(filename)
+ assert expected == actual, \
+ 'Filenames do not match ("%s" vs. "%s").' % (expected, actual)
+ return
+
+ def testGetFullOutputNameForFileName(self):
+ filename = 'TestCases/test_package_summaries/FromReadme/README.txt'
+ expected = os.path.join(self.output_base_dir, '%s.%s' % (filename, 'test'))
+ actual = self.formatter.getFullOutputNameForFile(filename)
+ assert expected == actual, \
+ 'Filenames do not match ("%s" vs. "%s").' % (expected, actual)
+ return
+
+ ## def testGetFullOutputNameForFileObject(self):
+ ## filename = 'TestCases/test_package_summaries/FromReadme/README.txt'
+ ## expected = os.path.join(self.output_base_dir, 'docset', 'base', 'directory', filename)
+ ## actual = self.formatter.getFullOutputNameForObject(filename)
+ ## assert expected == actual, \
+ ## ('Filenames do not match\n'
+ ## 'Expected: "%s"\n'
+ ## 'Got: "%s"' % (expected, actual)
+ ## )
+ ## return
def testGetOutputNameForObjectNone(self):
***************
*** 382,389 ****
pass
info_obj = FakeInfoObj('myfake', None, 'filename.py', [])
! expected = 'filename.py.test'
actual = self.formatter.getOutputNameForObject(info_obj)
assert expected == actual, \
! 'Output name for object does not match ("%s" vs "%s")' % \
(expected, actual)
return
--- 517,524 ----
pass
info_obj = FakeInfoObj('myfake', None, 'filename.py', [])
! expected = 'myfake.test'
actual = self.formatter.getOutputNameForObject(info_obj)
assert expected == actual, \
! 'Output name for object does not match (\n"%s"\nvs\n"%s")' % \
(expected, actual)
return
***************
*** 395,402 ****
parent_obj = FakeInfoObj('myfakeparent', None, 'parent', [])
info_obj = FakeInfoObj('myfake', parent_obj, 'filename.py', [])
! expected = 'parent_myfake.test'
actual = self.formatter.getOutputNameForObject(info_obj)
assert expected == actual, \
! 'Output name for object does not match ("%s" vs "%s")' % \
(expected, actual)
return
--- 530,568 ----
parent_obj = FakeInfoObj('myfakeparent', None, 'parent', [])
info_obj = FakeInfoObj('myfake', parent_obj, 'filename.py', [])
! expected = 'myfakeparent/myfake.test'
actual = self.formatter.getOutputNameForObject(info_obj)
assert expected == actual, \
! 'Output name for object does not match (\n"%s"\nvs\n"%s")' % \
! (expected, actual)
! return
!
! def testGetOutputNameForObjectFullyQualifiedNameMultipleParents(self):
! import happydoclib.happydom
! class FakeInfoObj(happydoclib.happydom.HappyDOM):
! pass
! one = FakeInfoObj('one', None, 'parent', [])
! two = FakeInfoObj('two', one, 'parent', [])
! three = FakeInfoObj('three', two, 'parent', [])
! info_obj = FakeInfoObj('myfake', three, 'filename.py', [])
! expected = os.path.join('one', 'two', 'three', 'myfake.test')
! actual = self.formatter.getOutputNameForObject(info_obj)
! assert expected == actual, \
! 'Output name for object does not match (\n"%s"\nvs\n"%s")' % \
! (expected, actual)
! return
!
! def testGetFullOutputNameForObjectFullyQualifiedNameMultipleParents(self):
! import happydoclib.happydom
! class FakeInfoObj(happydoclib.happydom.HappyDOM):
! pass
! one = FakeInfoObj('one', None, 'parent', [])
! two = FakeInfoObj('two', one, 'parent', [])
! three = FakeInfoObj('three', two, 'parent', [])
! info_obj = FakeInfoObj('myfake', three, 'filename.py', [])
! expected = os.path.join(self.output_base_dir,
! 'docset', 'base', 'directory', 'one', 'two', 'three', 'myfake.test')
! actual = self.formatter.getFullOutputNameForObject(info_obj)
! assert expected == actual, \
! 'Output name for object does not match (\n"%s"\nvs\n"%s")' % \
(expected, actual)
return
***************
*** 431,459 ****
class FakeInfoObj(happydoclib.happydom.HappyDOM):
pass
! info_obj = FakeInfoObj('myfake', None, 'filename.py', [])
expected = os.sep + os.path.join('tmp', 'fakedocset', 'output',
! 'filename.py.test'
)
actual = self.formatter.getFullOutputNameForObject(info_obj)
assert expected == actual, \
! 'Output name for object does not match ("%s" vs "%s")' % \
(expected, actual)
return
def testGetFullOutputNameForObjectNone(self):
info_obj = None
! expected = os.sep + os.path.join('tmp',
! 'fakedocset',
! 'output',
! 'docset',
! 'base',
! 'directory',
! 'index.test'
! )
actual = self.formatter.getFullOutputNameForObject(info_obj)
assert expected == actual, \
! 'Output name for object does not match ("%s" vs "%s")' % \
! (expected, actual)
return
def testGetFullOutputNameForObjectFullyQualifiedNameOneParent(self):
--- 597,662 ----
class FakeInfoObj(happydoclib.happydom.HappyDOM):
pass
! info_obj = FakeInfoObj('filename', None, 'filename.py', [])
expected = os.sep + os.path.join('tmp', 'fakedocset', 'output',
! 'docset', 'base', 'directory',
! 'filename.test'
)
actual = self.formatter.getFullOutputNameForObject(info_obj)
assert expected == actual, \
! 'Output name for object does not match\n(\n"%s"\nvs\n"%s")' % \
(expected, actual)
return
+ if os.name == 'nt':
+ def testGetFullOutputNameForObjectFullyQualifiedNameRootWin32(self):
+ import happydoclib
+ import happydoclib.happydom
+ happydoclib.TRACE.verboseLevel = 1
+ class FakeInfoObj(happydoclib.happydom.HappyDOM):
+ pass
+ info_obj = FakeInfoObj('myfake', None, 'filename.py', [])
+ expected = happydoclib.path.join(
+ 'c:\\',
+ os.path.join('tmp', 'fakedocset', 'output', 'filename.py.test')
+ )
+ actual = self.formatter_win32.getFullOutputNameForObject(info_obj)
+ assert expected == actual, \
+ 'Output name for object does not match (expect "%s", got "%s")' % \
+ (expected, actual)
+ return
+
def testGetFullOutputNameForObjectNone(self):
info_obj = None
! expected = os.path.join(
! self.output_base_dir,
! 'docset', 'base', 'directory',
! 'index.test'
! )
actual = self.formatter.getFullOutputNameForObject(info_obj)
assert expected == actual, \
! ('Output name for object does not match\n'
! 'Expected: "%s"\n'
! 'Actual: "%s"' % \
! (expected, actual)
! )
return
+
+ if os.name == 'nt':
+ def testGetFullOutputNameForObjectNoneWin32(self):
+ info_obj = None
+ expected = os.path.join('c:\\',
+ 'tmp',
+ 'fakedocset',
+ 'output',
+ 'docset',
+ 'base',
+ 'directory',
+ 'index.test'
+ )
+ actual = self.formatter_win32.getFullOutputNameForObject(info_obj)
+ assert expected == actual, \
+ 'Output name for object does not match (expected "%s", got "%s")' % \
+ (expected, actual)
+ return
def testGetFullOutputNameForObjectFullyQualifiedNameOneParent(self):
***************
*** 461,472 ****
class FakeInfoObj(happydoclib.happydom.HappyDOM):
pass
! parent_obj = FakeInfoObj('myfakeparent', None, 'parent', [])
info_obj = FakeInfoObj('myfake', parent_obj, 'filename.py', [])
expected = os.sep + os.path.join('tmp', 'fakedocset', 'output',
! 'parent_myfake.test'
)
actual = self.formatter.getFullOutputNameForObject(info_obj)
assert expected == actual, \
! 'Output name for object does not match ("%s" vs "%s")' % \
(expected, actual)
return
--- 664,676 ----
class FakeInfoObj(happydoclib.happydom.HappyDOM):
pass
! parent_obj = FakeInfoObj('myfakeparentname', None, 'myfakeparentfilename', [])
info_obj = FakeInfoObj('myfake', parent_obj, 'filename.py', [])
expected = os.sep + os.path.join('tmp', 'fakedocset', 'output',
! 'docset', 'base', 'directory',
! 'myfakeparentname', 'myfake.test'
)
actual = self.formatter.getFullOutputNameForObject(info_obj)
assert expected == actual, \
! 'Output name for object does not match\n(\n"%s"\nvs\n"%s")' % \
(expected, actual)
return
***************
*** 479,483 ****
actual = self.formatter.getFullOutputNameForFile(filename)
assert expected == actual, \
! 'Output name for file does not match ("%s" vs "%s")' % \
(expected, actual)
return
--- 683,687 ----
actual = self.formatter.getFullOutputNameForFile(filename)
assert expected == actual, \
! 'Output name for file does not match\n(\n"%s"\nvs\n"%s")' % \
(expected, actual)
return
***************
*** 491,497 ****
actual = self.formatter.getFullOutputNameForFile(filename)
assert expected == actual, \
! 'Output name for file does not match ("%s" vs "%s")' % \
(expected, actual)
return
!
--- 695,701 ----
actual = self.formatter.getFullOutputNameForFile(filename)
assert expected == actual, \
! 'Output name for file does not match\n(\n"%s"\nvs\n"%s")' % \
(expected, actual)
return
!
|
|
From: Doug H. <dou...@us...> - 2002-08-24 19:50:09
|
Update of /cvsroot/happydoc/HappyDoc/happydoclib/docset
In directory usw-pr-cvs1:/tmp/cvs-serv18732/happydoclib/docset
Modified Files:
docset_MultipleFile.py
Log Message:
Improved fix for -d bug (#513850).
Index: docset_MultipleFile.py
===================================================================
RCS file: /cvsroot/happydoc/HappyDoc/happydoclib/docset/docset_MultipleFile.py,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** docset_MultipleFile.py 4 Aug 2002 12:05:06 -0000 1.6
--- docset_MultipleFile.py 24 Aug 2002 19:50:06 -0000 1.7
***************
*** 99,108 ****
def write(self):
"Write the documentation set to the output."
! self.statusMessage('Beginning to write...')
#
# Get the name of and open the docset root file
#
self._root_name = self.getFullOutputNameForObject(None)
self._root_node = self.openOutput( self._root_name, self._title, '' )
#
# Get the description for the docset from the
--- 99,111 ----
def write(self):
"Write the documentation set to the output."
! happydoclib.TRACE.into('MultiFileDocSet', 'write')
! self.statusMessage('Beginning to write %s...' % self.getName())
#
# Get the name of and open the docset root file
#
self._root_name = self.getFullOutputNameForObject(None)
+ happydoclib.TRACE.writeVar(root_name=self._root_name)
self._root_node = self.openOutput( self._root_name, self._title, '' )
+ happydoclib.TRACE.writeVar(root_node=self._root_node)
#
# Get the description for the docset from the
***************
*** 122,125 ****
--- 125,129 ----
#
self.close()
+ happydoclib.TRACE.outof()
return
***************
*** 154,169 ****
#
for x in items:
! happydoclib.TRACE.into('', 'loop', x=x)
node_name = x[0]
happydoclib.TRACE.writeVar(node_name=node_name)
dir_name = happydoclib.path.dirname(x[1].getFilename())
happydoclib.TRACE.writeVar(dir_name=dir_name)
if removePrefix:
happydoclib.TRACE.write('removing prefix')
dir_name = happydoclib.path.removeRelativePrefix( dir_name )
file_name = x[1].getFilename()
happydoclib.TRACE.writeVar(file_name=file_name)
rec = (dir_name, file_name, node_name)
subnode_ids.append(rec)
happydoclib.TRACE.outof(rec)
#
--- 158,180 ----
#
for x in items:
! happydoclib.TRACE.into('inputDict.items()', 'loop', x=x)
!
node_name = x[0]
happydoclib.TRACE.writeVar(node_name=node_name)
+
dir_name = happydoclib.path.dirname(x[1].getFilename())
happydoclib.TRACE.writeVar(dir_name=dir_name)
+
if removePrefix:
happydoclib.TRACE.write('removing prefix')
dir_name = happydoclib.path.removeRelativePrefix( dir_name )
+ happydoclib.TRACE.writeVar(dir_name=dir_name)
+
file_name = x[1].getFilename()
happydoclib.TRACE.writeVar(file_name=file_name)
+
rec = (dir_name, file_name, node_name)
subnode_ids.append(rec)
+
happydoclib.TRACE.outof(rec)
#
***************
*** 172,185 ****
#
for dir_name, file_name, subnode_name in subnode_ids:
! happydoclib.TRACE.writeVar(dir_name=dir_name)
! happydoclib.TRACE.writeVar(file_name=file_name)
! happydoclib.TRACE.writeVar(subnode_name=subnode_name)
! #print 'DIR : %s' % dir_name
! #print 'FILE : %s' % file_name
! #print 'NODE : %s' % subnode_name
! #print
l = outputDict.get(dir_name, [])
l.append( (file_name, subnode_name, inputDict) )
outputDict[dir_name] = l
happydoclib.TRACE.outof()
return
--- 183,195 ----
#
for dir_name, file_name, subnode_name in subnode_ids:
! happydoclib.TRACE.into('subnode_ids', 'loop',
! dir_name=dir_name,
! file_name=file_name,
! subnode_name=subnode_name)
l = outputDict.get(dir_name, [])
l.append( (file_name, subnode_name, inputDict) )
outputDict[dir_name] = l
+ happydoclib.TRACE.outof()
+
happydoclib.TRACE.outof()
return
***************
*** 188,191 ****
--- 198,202 ----
"Output the TOC."
happydoclib.TRACE.into('MultiFileDocSet', '_writeTOC')
+ happydoclib.TRACE.writeVar(docset_name=self.getName())
self.statusMessage()
self.statusMessage('Writing table of contents...')
***************
*** 203,206 ****
--- 214,218 ----
self._organizeSubNodesByDir(subnodes_by_dir, self._all_modules, removePrefix=1)
self._organizeSubNodesByDir(subnodes_by_dir, self._all_packages, removePrefix=0)
+ happydoclib.TRACE.writeVar(subnodes_by_dir=subnodes_by_dir)
#
***************
*** 215,219 ****
for dir_name in dirs:
! happydoclib.TRACE.into('', '', directory=dir_name)
relative_dir_name = happydoclib.path.removeRelativePrefix(dir_name)
#
--- 227,231 ----
for dir_name in dirs:
! happydoclib.TRACE.into('dirs', 'loop', directory=dir_name)
relative_dir_name = happydoclib.path.removeRelativePrefix(dir_name)
#
***************
*** 261,266 ****
--- 273,285 ----
subnode_set.sort(lambda x, y: cmp(x[1], y[1]))
for file_name, subnode_name, subnode_dict in subnode_set:
+ happydoclib.TRACE.into('subnode_set', 'loop',
+ file_name=file_name,
+ subnode_name=subnode_name,
+ subnode_dict=subnode_dict,
+ )
+
subnode = subnode_dict[subnode_name]
self.statusMessage('\tAdding %s to TOC' % subnode_name, 2)
+
#
# Build a reference to the documentation for the subnode
***************
*** 268,273 ****
--- 287,294 ----
#
new_ref = subnode.getReference(formatter, self._root_node)
+
happydoclib.TRACE.writeVar(root_node_name=self._root_node.name)
happydoclib.TRACE.writeVar(new_ref=new_ref)
+
if hasattr( subnode, 'getFullOutputNameForObject' ):
happydoclib.TRACE.write('using getFullOutputNameForObject')
***************
*** 281,284 ****
--- 302,306 ----
self._root_name,
)
+
happydoclib.TRACE.writeVar(ref=ref)
subnode_summary, subnode_format = subnode.getSummaryAndFormat()
***************
*** 289,294 ****
--- 311,320 ----
subnode_format,
)
+
+ happydoclib.TRACE.outof()
+
formatter.descriptiveListFooter(self._root_node)
happydoclib.TRACE.outof()
+
#
# Close the Modules section
***************
*** 381,385 ****
def _describeClassInModuleNode(self, output, class_output_file_name, class_info):
! ref = self._formatter.getReference(class_info, class_output_file_name)
class_info_summary, class_info_format = class_info.getSummaryAndFormat()
self._formatter.descriptiveListItem( output,
--- 407,417 ----
def _describeClassInModuleNode(self, output, class_output_file_name, class_info):
! happydoclib.TRACE.into('', '_describeClassInModuleNode',
! output=output,
! class_output_file_name=class_output_file_name,
! class_info=class_info,
! )
! #ref = self._formatter.getReference(class_info, class_output_file_name)
! ref = self._formatter.getReference(class_info, output.name)
class_info_summary, class_info_format = class_info.getSummaryAndFormat()
self._formatter.descriptiveListItem( output,
***************
*** 388,391 ****
--- 420,424 ----
class_info_format,
)
+ happydoclib.TRACE.outof()
return
***************
*** 531,536 ****
--- 564,571 ----
class_names.sort()
for class_name in class_names:
+ happydoclib.TRACE.into('class_names', 'loop', class_name=class_name)
c = module.getClassInfo(class_name)
class_output_name = self.getFullOutputNameForObject(c)
+ happydoclib.TRACE.writeVar(class_output_name=class_output_name)
self._describeClassInModuleNode(output, class_output_name , c)
class_output = self.openOutput(class_output_name,
***************
*** 539,542 ****
--- 574,578 ----
self._writeClass( module, class_name, class_output )
self.closeOutput(class_output)
+ happydoclib.TRACE.outof()
formatter.descriptiveListFooter(output)
formatter.sectionFooter( output )
***************
*** 583,586 ****
--- 619,627 ----
def _writeClass(self, parent, class_name, output):
"Output the documentation for the class in the parent object."
+ happydoclib.TRACE.into('MultiFileDocSet', '_writeClass',
+ parent=parent,
+ class_name=class_name,
+ output=output,
+ )
class_info = parent.getClassInfo(class_name)
formatter = self._formatter
***************
*** 594,597 ****
--- 635,639 ----
#
base_classes = self._filterNames(class_info.getBaseClassNames())
+ happydoclib.TRACE.writeVar(base_classes=base_classes)
if base_classes:
formatter.pushSectionLevel(output)
***************
*** 628,631 ****
--- 670,674 ----
output)
formatter.sectionFooter(output)
+
#
# Finish that indented level.
***************
*** 634,637 ****
--- 677,682 ----
formatter.popSectionLevel(output)
formatter.comment('END: Class %s' % class_name, output)
+
+ happydoclib.TRACE.outof()
return
***************
*** 811,816 ****
inputModuleNames=[ filename ],
outputBaseDirectory=self.output_dir,
descriptionFilename='-',
- #descriptionFilename='README.txt',
)
info_obj = docset[0]
--- 856,861 ----
inputModuleNames=[ filename ],
outputBaseDirectory=self.output_dir,
+ docsetBaseDirectory=os.path.join(self.output_dir, 'TestCases'),
descriptionFilename='-',
)
info_obj = docset[0]
***************
*** 818,827 ****
expected_output_name = os.path.join(self.output_dir,
'TestCases',
! 'test.py.html')
self.failUnlessEqual(
actual_output_name, expected_output_name,
! 'Outputs do not match:\n %s\nvs.\n %s' % (actual_output_name,
! expected_output_name,
! )
)
return
--- 863,875 ----
expected_output_name = os.path.join(self.output_dir,
'TestCases',
! 'test.html')
self.failUnlessEqual(
actual_output_name, expected_output_name,
! ('Outputs do not match:\n'
! 'Got: %s\n'
! 'Expected: %s' % (actual_output_name,
! expected_output_name,
! )
! )
)
return
|
|
From: Doug H. <dou...@us...> - 2002-08-24 19:48:28
|
Update of /cvsroot/happydoc/HappyDoc/happydoclib
In directory usw-pr-cvs1:/tmp/cvs-serv18310/happydoclib
Modified Files:
path.py
Log Message:
Add trace code and tests.
Index: path.py
===================================================================
RCS file: /cvsroot/happydoc/HappyDoc/happydoclib/path.py,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** path.py 17 Feb 2002 13:49:49 -0000 1.8
--- path.py 24 Aug 2002 19:48:25 -0000 1.9
***************
*** 67,71 ****
# Import Local modules
#
! from happydoclib.StreamFlushTest import StreamFlushTest
#
--- 67,74 ----
# Import Local modules
#
! from StreamFlushTest import StreamFlushTest
! from trace import trace as TRACE
!
! #TRACE.setVerbosity(3)
#
***************
*** 97,102 ****
def applyPrefixToPath(path, prefix):
"Add the prefix value to every part of a given path."
parts = string.split( path, os.sep )
! #print 'PARTS:', parts
prefix_len = len(prefix)
real_parts = []
--- 100,107 ----
def applyPrefixToPath(path, prefix):
"Add the prefix value to every part of a given path."
+ TRACE.into('PATH', 'applyPrefixToPath', path=path, prefix=prefix)
+ drive, path = os.path.splitdrive(path)
parts = string.split( path, os.sep )
! TRACE.writeVar(parts=parts)
prefix_len = len(prefix)
real_parts = []
***************
*** 105,129 ****
pass
elif p not in ( '.', '..' ) and (p[:prefix_len] != prefix):
! #print 'modifying "%s"' % p
p = '%s%s' % (prefix, p)
real_parts.append(p)
! #print 'REAL PARTS:', real_parts
name = apply(os.path.join, real_parts)
! if path and path[0] == os.sep:
name = os.sep + name
return name
def removePrefix(path, prefix):
"Remove prefix from the beginning of path, if present."
one_up = os.path.dirname(path)
common_prefix = commonPrefix(one_up, prefix)
! #print 'PATH: removePrefix( %s, %s )' % (path, prefix)
! #print 'PATH: common_prefix', common_prefix
if common_prefix == prefix:
path = path[len(common_prefix):]
while path and (path[0] == os.sep):
path = path[1:]
! #print 'PATH: result', path
return path
--- 110,152 ----
pass
elif p not in ( '.', '..' ) and (p[:prefix_len] != prefix):
! TRACE.write('modifying "%s"' % p)
p = '%s%s' % (prefix, p)
real_parts.append(p)
! TRACE.writeVar(real_parts=real_parts)
name = apply(os.path.join, real_parts)
! if drive:
! name = os.sep.join((drive, name))
! elif path and path[0] == os.sep:
name = os.sep + name
+ TRACE.outof(name)
return name
def removePrefix(path, prefix):
"Remove prefix from the beginning of path, if present."
+ TRACE.into('PATH', 'removePrefix', path=path, prefix=prefix)
+
+ path=os.path.normcase(path)
+ prefix=os.path.normcase(prefix)
+ TRACE.writeVar(path_after_norm_case=path)
+ TRACE.writeVar(prefix_after_norm_case=prefix)
+
one_up = os.path.dirname(path)
+ TRACE.writeVar(one_up=one_up)
+
common_prefix = commonPrefix(one_up, prefix)
! TRACE.writeVar(common_prefix=common_prefix)
!
if common_prefix == prefix:
path = path[len(common_prefix):]
+ else:
+ TRACE.write('common prefix (%s)' % common_prefix)
+ TRACE.write('does not match specified prefix (%s)' % prefix)
+
+ TRACE.writeVar(pathMinusPrefix=path)
while path and (path[0] == os.sep):
path = path[1:]
!
! TRACE.outof(path)
return path
***************
*** 144,162 ****
subdirectory name matches.
"""
! #print 'commonPrefix(%s, %s)' % (path1, path2)
if not path1 or not path2:
return ''
path1_parts = string.split(path1, os.sep)
path2_parts = string.split(path2, os.sep)
common = []
for p1, p2 in map(None, path1_parts, path2_parts):
! if p1 == p2:
common.append(p1)
else:
break
common = string.join(common, os.sep)
! if path1 and path1[0] == '/' and common and common[0] != '/':
! common = '/' + common
! #print '->"%s"' % common
return common
--- 167,204 ----
subdirectory name matches.
"""
! TRACE.into('PATH', 'commonPrefix', path1=path1, path2=path2)
if not path1 or not path2:
+ TRACE.outof('')
+ return ''
+
+ drive1, path1 = os.path.splitdrive(path1)
+ TRACE.writeVar(drive1=drive1)
+ drive2, path2 = os.path.splitdrive(path2)
+ TRACE.writeVar(drive2=drive2)
+ if drive1 != drive2:
+ TRACE.outof('')
return ''
+
path1_parts = string.split(path1, os.sep)
+ TRACE.writeVar(path1_parts=path1_parts)
path2_parts = string.split(path2, os.sep)
+ TRACE.writeVar(path2_parts=path2_parts)
+
common = []
for p1, p2 in map(None, path1_parts, path2_parts):
! if p1 and p1 == p2:
! TRACE.write('Found common part "%s"' % p1)
common.append(p1)
+ elif not p1:
+ pass
else:
break
common = string.join(common, os.sep)
! if drive1 and common:
! TRACE.write('have a drive spec')
! common = os.path.normcase('%s%s%s' % (drive1, os.sep, common))
! elif path1 and path1[0] == os.sep and common and common[0] != os.sep:
! common = os.sep + common
! TRACE.outof(common)
return common
***************
*** 186,194 ****
# Find the part of path1 which is *not* part of path1prefix
#
! #print 'joinWithCommonMiddle(%s, %s, %s)' % (path1prefix, path1, path2)
common_prefix = commonPrefix(path1prefix, path1)
! #print ' common prefix:', common_prefix
real_base = removePrefix(path1, common_prefix)
! #print ' real base:', real_base
#
# Remove the prefix common to the docset_real_base and
--- 228,237 ----
# Find the part of path1 which is *not* part of path1prefix
#
! TRACE.into('PATH', 'joinWithCommonMiddle', path1prefix=path1prefix,
! path1=path1, path2=path2)
common_prefix = commonPrefix(path1prefix, path1)
! TRACE.writeVar(common_prefix=common_prefix)
real_base = removePrefix(path1, common_prefix)
! TRACE.writeVar(real_base=real_base)
#
# Remove the prefix common to the docset_real_base and
***************
*** 196,205 ****
#
common_prefix = commonPrefix(real_base, path2)
! #print ' common prefix with real base and path2:', common_prefix
path2 = removePrefix(path2, common_prefix)
! #print ' fixed path2:', path2
name = join( path1, path2 )
! #print '->"%s"' % name
return name
--- 239,248 ----
#
common_prefix = commonPrefix(real_base, path2)
! TRACE.write('common prefix with real base and path2:', common_prefix)
path2 = removePrefix(path2, common_prefix)
! TRACE.write('fixed path2:', path2)
name = join( path1, path2 )
! TRACE.outof(name)
return name
***************
*** 222,230 ****
fromName will point directly to toName.
"""
! dbg=0
! if dbg: print '\nPATH: FROM: ', fromName
! if dbg: print 'PATH: TO : ', toName
! if dbg: print 'PATH: BASE: ', baseDirectory
!
#
# Normalize directory names
--- 265,273 ----
fromName will point directly to toName.
"""
! TRACE.into('PATH', 'computeRelativeHTMLLink',
! fromName=fromName,
! toName=toName,
! baseDirectory=baseDirectory,
! )
#
# Normalize directory names
***************
*** 232,237 ****
fromName = os.path.normpath(fromName)
toName = os.path.normpath(toName)
! if dbg: print 'PATH: FROM NORMALIZED : ', fromName
! if dbg: print 'PATH: TO NORMALIZED : ', toName
#
--- 275,280 ----
fromName = os.path.normpath(fromName)
toName = os.path.normpath(toName)
! TRACE.writeVar(fromNameNormalized=fromName)
! TRACE.writeVar(toNameNormalized=toName)
#
***************
*** 240,248 ****
fromName = removePrefix(fromName, baseDirectory)
toName = removePrefix(toName, baseDirectory)
! if dbg: print 'PATH: FROM - PREFIX : ', fromName
! if dbg: print 'PATH: TO - PREFIX : ', toName
if fromName == toName:
! if dbg: print '\tPATH: same name'
relative_link = os.path.basename(toName)
else:
--- 283,291 ----
fromName = removePrefix(fromName, baseDirectory)
toName = removePrefix(toName, baseDirectory)
! TRACE.writeVar(fromNameMinusPrefix=fromName)
! TRACE.writeVar(toNameMinusPrefix=toName)
if fromName == toName:
! TRACE.writeVar(toName=toName)
relative_link = os.path.basename(toName)
else:
***************
*** 251,260 ****
while from_name_no_prefix and (from_name_no_prefix[0] == os.sep):
from_name_no_prefix = from_name_no_prefix[1:]
! if dbg: print '\tPATH: from, no prefix:', from_name_no_prefix
! if dbg and from_name_no_prefix == 'z.html':
! raise 'debug'
subdir_path = os.path.dirname(from_name_no_prefix)
parts = string.split(subdir_path, os.sep)
! if dbg: print '\tPATH: parts:', parts
if parts and parts[0]:
levels = len(string.split(subdir_path, os.sep))
--- 294,301 ----
while from_name_no_prefix and (from_name_no_prefix[0] == os.sep):
from_name_no_prefix = from_name_no_prefix[1:]
! TRACE.writeVar(from_name_no_prefix=from_name_no_prefix)
subdir_path = os.path.dirname(from_name_no_prefix)
parts = string.split(subdir_path, os.sep)
! TRACE.writeVar(parts=parts)
if parts and parts[0]:
levels = len(string.split(subdir_path, os.sep))
***************
*** 266,270 ****
to_name_no_prefix = to_name_no_prefix[1:]
relative_link = "%s%s" % (up_levels, to_name_no_prefix)
! if dbg: print 'PATH: LINK: ', relative_link, '\n'
return relative_link
--- 307,311 ----
to_name_no_prefix = to_name_no_prefix[1:]
relative_link = "%s%s" % (up_levels, to_name_no_prefix)
! TRACE.outof(relative_link)
return relative_link
***************
*** 305,309 ****
def join( *args ):
"os.path.join"
! return apply(os.path.join, args)
def cwd():
--- 346,353 ----
def join( *args ):
"os.path.join"
! TRACE.into('PATH', 'join', args=args)
! result=apply(os.path.join, args)
! TRACE.outof(result)
! return result
def cwd():
***************
*** 349,352 ****
--- 393,405 ----
% (expected, actual)
return
+
+ if os.name == 'nt':
+ def testApplyPreifxToPathWin32(self):
+ expected = 'c:\\BLAH_tmp\\BLAH_foo'
+ actual = applyPrefixToPath('c:\\BLAH_tmp\\BLAH_foo', 'BLAH_')
+ assert actual == expected, \
+ 'Path modification failed.\n\tExpected "%s",\n\tgot "%s"' \
+ % (expected, actual)
+ return
def testApplyPrefixToPathEmpty(self):
***************
*** 373,376 ****
--- 426,438 ----
% (expected, actual)
return
+
+ if os.name == 'nt':
+ def testRemovePrefixWin32(self):
+ expected = 'foo'
+ actual = removePrefix('c:\\tmp\\foo', 'c:\\tmp')
+ assert actual == expected, \
+ 'Path modification failed.\n\tExpected "%s",\n\tgot "%s"' \
+ % (expected, actual)
+ return
def testRemovePrefixNotThere(self):
***************
*** 381,384 ****
--- 443,455 ----
% (expected, actual)
return
+
+ if os.name == 'nt':
+ def testRemovePrefixNotThereWin32(self):
+ expected = 'c:\\tmp\\foo'
+ actual = removePrefix('c:\\tmp\\foo', 'c:\\blah')
+ assert actual == expected, \
+ 'Path modification failed.\n\tExpected "%s",\n\tgot "%s"' \
+ % (expected, actual)
+ return
def testRemovePrefixEmptyPath(self):
***************
*** 407,410 ****
--- 478,491 ----
return
+ if os.name == 'nt':
+ def testCommonPrefixWin32(self):
+ expected = 'c:\\tmp'
+ actual = commonPrefix('c:\\tmp\\foo',
+ 'c:\\tmp\\blah')
+ assert actual == expected, \
+ 'Path modification failed.\n\tExpected "%s",\n\tgot "%s"' \
+ % (expected, actual)
+ return
+
def testCommonPrefixNone(self):
expected = ''
***************
*** 417,420 ****
--- 498,513 ----
return
+ if os.name == 'nt':
+ def testCommonPrefixNoneWin32(self):
+ expected = ''
+ actual = commonPrefix('c:\\var\\tmp\\foo',
+ 'c:\\tmp\\blah',
+ )
+ assert actual == expected, \
+ 'Path modification failed.\n\tExpected "%s",\n\tgot "%s"' \
+ % (expected, actual)
+ return
+
+
def testCommonPrefixEmptyPaths(self):
expected = ''
***************
*** 440,443 ****
--- 533,548 ----
% (expected, actual)
return
+
+ if os.name == 'nt':
+ def testJoinWithCommonMiddleWin32(self):
+ expected = 'c:\\root\\one\\two\\three\\filename.txt'
+ actual = joinWithCommonMiddle('c:\\root\\one',
+ 'c:\\root\\one\\two',
+ 'two\\three\\filename.txt'
+ )
+ assert actual == expected, \
+ 'Path modification failed.\n\tExpected "%s",\n\tgot "%s"' \
+ % (expected, actual)
+ return
def testJoinWithCommonMiddleNotCommon(self):
***************
*** 451,454 ****
--- 556,571 ----
% (expected, actual)
return
+
+ if os.name == 'nt':
+ def testJoinWithCommonMiddleNotCommonWin32(self):
+ expected = 'c:\\%s' % os.path.join('root', 'one', 'four', 'two', 'three', 'filename.txt')
+ actual = joinWithCommonMiddle('c:\\%s' % os.path.join('root', 'one', 'five'),
+ 'c:\\%s' % os.path.join('root', 'one', 'four'),
+ os.path.join('two', 'three', 'filename.txt')
+ )
+ assert actual == expected, \
+ 'Path modification failed.\n\tExpected "%s",\n\tgot "%s"' \
+ % (expected, actual)
+ return
def testJoinWithCommonMiddleEmptyPrefix(self):
***************
*** 462,465 ****
--- 579,594 ----
% (expected, actual)
return
+
+ if os.name == 'nt':
+ def testJoinWithCommonMiddleEmptyPrefixWin32(self):
+ expected = 'c:\\%s' % os.path.join('root', 'one', 'four', 'two', 'three', 'filename.txt')
+ actual = joinWithCommonMiddle('',
+ 'c:\\%s' % os.path.join('root', 'one', 'four'),
+ os.path.join('two', 'three', 'filename.txt')
+ )
+ assert actual == expected, \
+ 'Path modification failed.\n\tExpected "%s",\n\tgot "%s"' \
+ % (expected, actual)
+ return
def testJoinWithCommonMiddleEmptyPath1(self):
***************
*** 543,546 ****
if __name__ == '__main__':
! unittest.main()
!
--- 672,674 ----
if __name__ == '__main__':
! unittest.main()
|
|
From: Doug H. <dou...@us...> - 2002-08-24 19:47:51
|
Update of /cvsroot/happydoc/HappyDoc/happydoclib
In directory usw-pr-cvs1:/tmp/cvs-serv18083/happydoclib
Modified Files:
happydom.py
Log Message:
Add getPath() method.
Use getFilename() in getFullyQualifiedName().
Index: happydom.py
===================================================================
RCS file: /cvsroot/happydoc/HappyDoc/happydoclib/happydom.py,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** happydom.py 11 Nov 2001 18:46:19 -0000 1.4
--- happydom.py 24 Aug 2002 19:47:48 -0000 1.5
***************
*** 115,118 ****
--- 115,136 ----
return self._parent
+ def getPath(self):
+ "Returns a sequence of node names leading to this node."
+ happydoclib.TRACE.into('HappyDom', 'getPath',
+ object=self)
+ parent = self.getParent()
+ if parent:
+ path = parent.getPath()
+ else:
+ path = []
+ name = self.getName()
+ happydoclib.TRACE.writeVar(name=name)
+ if name:
+ path.append( name )
+ else:
+ happydoclib.TRACE.write('name was empty, ADDED NOTHING')
+ happydoclib.TRACE.outof(path)
+ return path
+
def getFilename(self):
"Return the filename from which the object came."
***************
*** 134,138 ****
happydoclib.TRACE.writeVar(parent_base=parent_base)
happydoclib.TRACE.writeVar(parent_ext=parent_ext)
! name = '%s_%s%s' % ( parent_base, self.getName(), parent_ext )
happydoclib.TRACE.outof(name)
return name
--- 152,157 ----
happydoclib.TRACE.writeVar(parent_base=parent_base)
happydoclib.TRACE.writeVar(parent_ext=parent_ext)
! my_file = self.getFilename()
! name = happydoclib.path.join(parent_base, my_file)
happydoclib.TRACE.outof(name)
return name
|
|
From: Doug H. <dou...@us...> - 2002-08-24 17:54:05
|
Update of /cvsroot/happydoc/HappyDoc
In directory usw-pr-cvs1:/tmp/cvs-serv23968
Modified Files:
test_happydoc.py
Log Message:
Test definition cleanup, and fix the fix to the fix for using
webchecker.
Index: test_happydoc.py
===================================================================
RCS file: /cvsroot/happydoc/HappyDoc/test_happydoc.py,v
retrieving revision 1.87
retrieving revision 1.88
diff -C2 -d -r1.87 -r1.88
*** test_happydoc.py 4 Aug 2002 12:37:53 -0000 1.87
--- test_happydoc.py 24 Aug 2002 17:54:02 -0000 1.88
***************
*** 71,75 ****
from happydoclib.StreamFlushTest import verboseLevel as globalVerboseLevel
! WEB_CHECKER_DIR='/home/dhellmann/Downloads/Python-2.2/Tools/webchecker/'
if os.path.exists(WEB_CHECKER_DIR) and (os.name == 'posix'):
--- 71,75 ----
from happydoclib.StreamFlushTest import verboseLevel as globalVerboseLevel
! WEB_CHECKER_DIR='../Python-2.2/Tools/webchecker/'
if os.path.exists(WEB_CHECKER_DIR) and (os.name == 'posix'):
***************
*** 98,106 ****
# Module
#
-
- if os.name == 'posix':
- WEBCHECKER_AVAILABLE=1
- else:
- WEBCHECKER_AVAILABLE=0
--- 98,101 ----
***************
*** 118,122 ****
return
! def runHappyDoc(self, modules=(), extraArgs=(), useWebChecker=WEBCHECKER_AVAILABLE):
#
# Fix up output directory variable
--- 113,117 ----
return
! def runHappyDoc(self, modules=(), extraArgs=(), useWebChecker=0):
#
# Fix up output directory variable
***************
*** 263,275 ****
assert (not self.runHappyDoc( (os.path.join('TestCases', 'test.py'),),
extraArgs=('-p', '-',),
! useWebChecker=1
)
), 'Basic single-file docset test failed.'
return
def testSelfHTMLCompact(self):
assert (not self.runHappyDoc( (os.path.join('TestCases', 'test.py'),),
extraArgs=('formatter_compactHTML=yes',),
! useWebChecker=1)
), 'Full self documentation with compact output test failed.'
return
--- 258,280 ----
assert (not self.runHappyDoc( (os.path.join('TestCases', 'test.py'),),
extraArgs=('-p', '-',),
! useWebChecker=1,
)
), 'Basic single-file docset test failed.'
return
+ def testHTMLSimpleWithPackageDescriptionFiles(self):
+ assert (not self.runHappyDoc( (os.path.join('TestCases',
+ 'test_package_summaries'),
+ ),
+ useWebChecker=1,
+ )
+ ), 'Basic docset test with package description files failed.'
+ return
+
def testSelfHTMLCompact(self):
assert (not self.runHappyDoc( (os.path.join('TestCases', 'test.py'),),
extraArgs=('formatter_compactHTML=yes',),
! useWebChecker=1,
! )
), 'Full self documentation with compact output test failed.'
return
***************
*** 278,282 ****
assert (not self.runHappyDoc( (os.path.join('TestCases', 'test.py'),),
extraArgs=('-p', '-', '-T', 'SingleFile'),
! useWebChecker=1
)
), 'Basic single-file docset test failed.'
--- 283,287 ----
assert (not self.runHappyDoc( (os.path.join('TestCases', 'test.py'),),
extraArgs=('-p', '-', '-T', 'SingleFile'),
! useWebChecker=1,
)
), 'Basic single-file docset test failed.'
***************
*** 288,292 ****
'formatter_compactHTML=yes',
),
! useWebChecker=1
)
), 'Basic single-file docset test failed.'
--- 293,297 ----
'formatter_compactHTML=yes',
),
! useWebChecker=1,
)
), 'Basic single-file docset test failed.'
***************
*** 331,335 ****
assert (not self.runHappyDoc( (os.path.join('TestCases',
'test_import_packages_basic'),),
! useWebChecker=1
)
), 'Import from packages test failed.'
--- 336,340 ----
assert (not self.runHappyDoc( (os.path.join('TestCases',
'test_import_packages_basic'),),
! useWebChecker=1,
)
), 'Import from packages test failed.'
***************
*** 340,344 ****
'test_import_packages'),),
extraArgs=('docset_usePackages=0',),
! useWebChecker=1
)
), 'Import from packages while ignoring package special handling test failed.'
--- 345,349 ----
'test_import_packages'),),
extraArgs=('docset_usePackages=0',),
! useWebChecker=1,
)
), 'Import from packages while ignoring package special handling test failed.'
***************
*** 351,355 ****
'',
'formatter_filenamePrefix=TESTPREFIX_'),
! useWebChecker=1
)
), 'Formatter output prefix test failed.'
--- 356,360 ----
'',
'formatter_filenamePrefix=TESTPREFIX_'),
! useWebChecker=1,
)
), 'Formatter output prefix test failed.'
***************
*** 362,366 ****
def testSelfHTML(self):
assert (not self.runHappyDoc( (os.path.join(os.pardir, 'HappyDoc'),),
! useWebChecker=1
)
), 'Full self documentation test failed.'
--- 367,371 ----
def testSelfHTML(self):
assert (not self.runHappyDoc( (os.path.join(os.pardir, 'HappyDoc'),),
! useWebChecker=1,
)
), 'Full self documentation test failed.'
***************
*** 372,376 ****
'SGMLDocBook',
'-T',
! 'SingleFile'))
), 'Full self documentation in SGMLDocBook format output test failed.'
return
--- 377,382 ----
'SGMLDocBook',
'-T',
! 'SingleFile'),
! )
), 'Full self documentation in SGMLDocBook format output test failed.'
return
***************
*** 381,385 ****
'docbookx',
'-T',
! 'SingleFile'))
), 'Full self documentation in DocBookS format output test failed.'
return
--- 387,392 ----
'docbookx',
'-T',
! 'SingleFile'),
! )
), 'Full self documentation in DocBookS format output test failed.'
return
|
|
From: Doug H. <dou...@us...> - 2002-08-24 17:53:13
|
Update of /cvsroot/happydoc/HappyDoc In directory usw-pr-cvs1:/tmp/cvs-serv23825 Modified Files: Makefile Log Message: Limit TAGS file to actual program source, and skip the test programs. Index: Makefile =================================================================== RCS file: /cvsroot/happydoc/HappyDoc/Makefile,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** Makefile 8 Jun 2002 16:58:58 -0000 1.30 --- Makefile 24 Aug 2002 17:53:06 -0000 1.31 *************** *** 74,76 **** tags: ! find . -name '*.py' | etags -l auto --regex='/[ \t]*\def[ \t]+\([^ :(\t]+\)/\1/' - --- 74,76 ---- tags: ! find . -name '*.py' | grep -v TestCase | etags -l auto --regex='/[ \t]*\def[ \t]+\([^ :(\t]+\)/\1/' - |
|
From: Doug H. <dou...@us...> - 2002-08-04 12:37:55
|
Update of /cvsroot/happydoc/HappyDoc
In directory usw-pr-cvs1:/tmp/cvs-serv2862
Modified Files:
test_happydoc.py
Log Message:
Only use webchecker on links when it is available.
Index: test_happydoc.py
===================================================================
RCS file: /cvsroot/happydoc/HappyDoc/test_happydoc.py,v
retrieving revision 1.86
retrieving revision 1.87
diff -C2 -d -r1.86 -r1.87
*** test_happydoc.py 4 Aug 2002 10:47:57 -0000 1.86
--- test_happydoc.py 4 Aug 2002 12:37:53 -0000 1.87
***************
*** 99,102 ****
--- 99,106 ----
#
+ if os.name == 'posix':
+ WEBCHECKER_AVAILABLE=1
+ else:
+ WEBCHECKER_AVAILABLE=0
***************
*** 114,118 ****
return
! def runHappyDoc(self, modules=(), extraArgs=(), useWebChecker=0):
#
# Fix up output directory variable
--- 118,122 ----
return
! def runHappyDoc(self, modules=(), extraArgs=(), useWebChecker=WEBCHECKER_AVAILABLE):
#
# Fix up output directory variable
|
|
From: Doug H. <dou...@us...> - 2002-08-04 12:06:52
|
Update of /cvsroot/happydoc/HappyDoc/happydoclib/parseinfo
In directory usw-pr-cvs1:/tmp/cvs-serv28739/happydoclib/parseinfo
Modified Files:
classinfo.py functioninfo.py moduleinfo.py
Log Message:
Added trace.
Index: classinfo.py
===================================================================
RCS file: /cvsroot/happydoc/HappyDoc/happydoclib/parseinfo/classinfo.py,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** classinfo.py 11 Nov 2001 18:51:37 -0000 1.1
--- classinfo.py 4 Aug 2002 12:06:49 -0000 1.2
***************
*** 61,64 ****
--- 61,65 ----
# Import Local modules
#
+ import happydoclib
from happydoclib.parseinfo.suite import SuiteInfoBase
from happydoclib.parseinfo.utils import *
***************
*** 85,88 ****
--- 86,94 ----
"""
+ happydoclib.TRACE.into('ClassInfo', '__init__',
+ parent=parent,
+ tree=tree,
+ commentInfo=commentInfo,
+ )
SuiteInfoBase.__init__(self, tree[2][1], parent, parent.getFilename(),
tree=(tree and tree[-1] or None),
***************
*** 92,95 ****
--- 98,102 ----
self._class_member_info = self._extractClassMembers(tree)
#print self._class_member_info
+ happydoclib.TRACE.outof()
return
Index: functioninfo.py
===================================================================
RCS file: /cvsroot/happydoc/HappyDoc/happydoclib/parseinfo/functioninfo.py,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** functioninfo.py 11 Nov 2001 18:51:37 -0000 1.1
--- functioninfo.py 4 Aug 2002 12:06:49 -0000 1.2
***************
*** 61,64 ****
--- 61,65 ----
# Import Local modules
#
+ import happydoclib
from happydoclib.parseinfo.suite import SuiteInfoBase
from happydoclib.parseinfo.utils import *
***************
*** 95,98 ****
--- 96,104 ----
"""
+ happydoclib.TRACE.into('FunctionInfo', '__init__',
+ parent=parent,
+ tree=tree,
+ commentInfo=commentInfo,
+ )
SuiteInfoBase.__init__(self, tree[2][1], parent, parent.getFilename(),
(tree and tree[-1] or None),
***************
*** 104,107 ****
--- 110,114 ----
# print 'EXCEPTIONS: ',
# pprint.pprint(self._exception_info)
+ happydoclib.TRACE.outof()
return
Index: moduleinfo.py
===================================================================
RCS file: /cvsroot/happydoc/HappyDoc/happydoclib/parseinfo/moduleinfo.py,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** moduleinfo.py 18 Nov 2001 22:13:24 -0000 1.2
--- moduleinfo.py 4 Aug 2002 12:06:50 -0000 1.3
***************
*** 65,68 ****
--- 65,69 ----
# Import Local modules
#
+ import happydoclib
from happydoclib.parseinfo.classinfo import ClassInfo
from happydoclib.parseinfo.functioninfo import SuiteFuncInfo, FunctionInfo
***************
*** 103,106 ****
--- 104,115 ----
"""
+ happydoclib.TRACE.into('ModuleInfo', '__init__',
+ parent=parent,
+ tree=tree,
+ name=name,
+ fileName=fileName,
+ commentInfo=commentInfo,
+ defaultConfigValues=defaultConfigValues,
+ )
self._filename = fileName
SuiteInfoBase.__init__(self, name, parent, fileName, tree,
***************
*** 118,121 ****
--- 127,132 ----
#
self._import_info = self._extractImportedModules(tree)
+
+ happydoclib.TRACE.outof()
return
|
|
From: Doug H. <dou...@us...> - 2002-08-04 12:06:29
|
Update of /cvsroot/happydoc/HappyDoc/happydoclib/parseinfo
In directory usw-pr-cvs1:/tmp/cvs-serv28643/happydoclib/parseinfo
Modified Files:
__init__.py
Log Message:
Added trace.
Index: __init__.py
===================================================================
RCS file: /cvsroot/happydoc/HappyDoc/happydoclib/parseinfo/__init__.py,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** __init__.py 5 Feb 2002 01:18:21 -0000 1.6
--- __init__.py 4 Aug 2002 12:06:26 -0000 1.7
***************
*** 139,142 ****
--- 139,148 ----
"""
+ happydoclib.TRACE.into('parseinfo', 'getDocs',
+ fileName=fileName,
+ includeComments=includeComments,
+ defaultConfigValues=defaultConfigValues,
+ )
+
f = open(fileName)
#
***************
*** 172,175 ****
--- 178,183 ----
else:
comment_info = {}
+
+ happydoclib.TRACE.write('Creating ModuleInfo')
mod_info = ModuleInfo(parent=None,
tree=tup,
***************
*** 178,181 ****
--- 186,191 ----
commentInfo=comment_info,
defaultConfigValues=defaultConfigValues)
+
+ happydoclib.TRACE.outof()
return mod_info
|
|
From: Doug H. <dou...@us...> - 2002-08-04 12:06:08
|
Update of /cvsroot/happydoc/HappyDoc/happydoclib/formatter
In directory usw-pr-cvs1:/tmp/cvs-serv28573/happydoclib/formatter
Modified Files:
fileformatterbase.py
Log Message:
Added trace.
Do not add path separator prefix to a filename if the file already
begins with the path separator or current directory indicator.
Index: fileformatterbase.py
===================================================================
RCS file: /cvsroot/happydoc/HappyDoc/happydoclib/formatter/fileformatterbase.py,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** fileformatterbase.py 10 Feb 2002 13:07:00 -0000 1.8
--- fileformatterbase.py 4 Aug 2002 12:06:06 -0000 1.9
***************
*** 222,226 ****
output_subdir = happydoclib.path.removePrefix(docset_base_directory, output_base)
happydoclib.TRACE.writeVar(output_subdir=output_subdir)
! if os.name != 'nt':
happydoclib.TRACE.write('adding prefix for os %s' % os.name)
output_subdir = '%s%s' % (os.sep, output_subdir)
--- 222,232 ----
output_subdir = happydoclib.path.removePrefix(docset_base_directory, output_base)
happydoclib.TRACE.writeVar(output_subdir=output_subdir)
! if ( (os.name != 'nt')
! and
! (output_subdir[0] not in (os.sep,
! os.curdir,
! )
! )
! ):
happydoclib.TRACE.write('adding prefix for os %s' % os.name)
output_subdir = '%s%s' % (os.sep, output_subdir)
***************
*** 246,250 ****
# Subnode of docset
#
! file_name = self.getOutputNameForObject(infoObject)
happydoclib.TRACE.writeVar(file_name=file_name)
name = happydoclib.path.join(output_base, file_name)
--- 252,257 ----
# Subnode of docset
#
! #file_name = self.getOutputNameForObject(infoObject)
! file_name = obj_output_name
happydoclib.TRACE.writeVar(file_name=file_name)
name = happydoclib.path.join(output_base, file_name)
|
|
From: Doug H. <dou...@us...> - 2002-08-04 12:05:23
|
Update of /cvsroot/happydoc/HappyDoc/happydoclib/docset
In directory usw-pr-cvs1:/tmp/cvs-serv28415/happydoclib/docset
Modified Files:
docset_mstruct.py
Log Message:
Do not call the formatter directly, use our own method to get the
output name for an object.
Index: docset_mstruct.py
===================================================================
RCS file: /cvsroot/happydoc/HappyDoc/happydoclib/docset/docset_mstruct.py,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** docset_mstruct.py 7 Feb 2002 01:17:56 -0000 1.3
--- docset_mstruct.py 4 Aug 2002 12:05:20 -0000 1.4
***************
*** 114,118 ****
# get the name of and open the docset index file
! self._index_file_name=self._formatter.getFullOutputNameForObject(None)
self._index_file=self.openOutput(self._index_file_name, self._title, '', INDEX_FILE)
--- 114,118 ----
# get the name of and open the docset index file
! self._index_file_name=self.getFullOutputNameForObject(None)
self._index_file=self.openOutput(self._index_file_name, self._title, '', INDEX_FILE)
***************
*** 172,176 ****
formatter.moduleIndex(module, self._index_file)
! output_name=self._formatter.getFullOutputNameForObject(module)
output=self.openOutput(output_name, 'Module: %s' % module_name, module.getFilename(), MODULE_FILE)
--- 172,176 ----
formatter.moduleIndex(module, self._index_file)
! output_name=self.getFullOutputNameForObject(module)
output=self.openOutput(output_name, 'Module: %s' % module_name, module.getFilename(), MODULE_FILE)
***************
*** 204,208 ****
c=module.getClassInfo(class_name)
formatter.classIndex(c, output)
! class_output_name=formatter.getFullOutputNameForObject(c)
class_output=self.openOutput(class_output_name, 'Class: %s' % class_name, \
module.getFilename(), CLASS_FILE)
--- 204,208 ----
c=module.getClassInfo(class_name)
formatter.classIndex(c, output)
! class_output_name=self.getFullOutputNameForObject(c)
class_output=self.openOutput(class_output_name, 'Class: %s' % class_name, \
module.getFilename(), CLASS_FILE)
|
|
From: Doug H. <dou...@us...> - 2002-08-04 12:05:09
|
Update of /cvsroot/happydoc/HappyDoc/happydoclib/docset
In directory usw-pr-cvs1:/tmp/cvs-serv28348/happydoclib/docset
Modified Files:
docset_MultipleFile.py
Log Message:
Do not call the formatter directly, use our own method to get the
output name for an object.
Move getFullOutputNameForObject() to DocSet from here.
Index: docset_MultipleFile.py
===================================================================
RCS file: /cvsroot/happydoc/HappyDoc/happydoclib/docset/docset_MultipleFile.py,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** docset_MultipleFile.py 9 Dec 2001 15:36:33 -0000 1.5
--- docset_MultipleFile.py 4 Aug 2002 12:05:06 -0000 1.6
***************
*** 97,104 ****
"""
- def getFullOutputNameForObject(self, infoObject=None):
- "Returns the output destination for documentation about this object."
- return self._formatter.getFullOutputNameForObject(None)
-
def write(self):
"Write the documentation set to the output."
--- 97,100 ----
***************
*** 107,111 ****
# Get the name of and open the docset root file
#
! self._root_name = self._formatter.getFullOutputNameForObject(None)
self._root_node = self.openOutput( self._root_name, self._title, '' )
#
--- 103,107 ----
# Get the name of and open the docset root file
#
! self._root_name = self.getFullOutputNameForObject(None)
self._root_node = self.openOutput( self._root_name, self._title, '' )
#
***************
*** 478,482 ****
"Output the documentation for the module named."
module = self._all_modules[module_name]
! output_name = self._formatter.getFullOutputNameForObject(module)
output = self.openOutput(output_name,
'Module: %s' % module_name,
--- 474,478 ----
"Output the documentation for the module named."
module = self._all_modules[module_name]
! output_name = self.getFullOutputNameForObject(module)
output = self.openOutput(output_name,
'Module: %s' % module_name,
***************
*** 536,540 ****
for class_name in class_names:
c = module.getClassInfo(class_name)
! class_output_name = formatter.getFullOutputNameForObject(c)
self._describeClassInModuleNode(output, class_output_name , c)
class_output = self.openOutput(class_output_name,
--- 532,536 ----
for class_name in class_names:
c = module.getClassInfo(class_name)
! class_output_name = self.getFullOutputNameForObject(c)
self._describeClassInModuleNode(output, class_output_name , c)
class_output = self.openOutput(class_output_name,
***************
*** 787,791 ****
def testIgnorePackageReadme(self):
! filename = 'TestCases/test_package_summaries/FromReadmeTxt'
import happydoclib.formatter.formatter_Null
import happydoclib.parseinfo
--- 783,787 ----
def testIgnorePackageReadme(self):
! filename = os.path.join('TestCases', 'test_package_summaries', 'FromReadmeTxt')
import happydoclib.formatter.formatter_Null
import happydoclib.parseinfo
***************
*** 805,806 ****
--- 801,853 ----
+ def testModuleOutputFileCalculation(self):
+ filename = os.path.join('TestCases', 'test.py')
+ import happydoclib.formatter.formatter_Null
+ import happydoclib.parseinfo
+ docset = MultiFileDocSet(
+ formatterFactory=happydoclib.formatter.formatter_Null.NullFormatter,
+ parserFunc=happydoclib.parseinfo.getDocs,
+ defaultParserConfigValues={'docStringFormat':'StructuredText'},
+ inputModuleNames=[ filename ],
+ outputBaseDirectory=self.output_dir,
+ descriptionFilename='-',
+ #descriptionFilename='README.txt',
+ )
+ info_obj = docset[0]
+ actual_output_name = docset.getFullOutputNameForObject(info_obj)
+ expected_output_name = os.path.join(self.output_dir,
+ 'TestCases',
+ 'test.py.html')
+ self.failUnlessEqual(
+ actual_output_name, expected_output_name,
+ 'Outputs do not match:\n %s\nvs.\n %s' % (actual_output_name,
+ expected_output_name,
+ )
+ )
+ return
+
+ def testPackageOutputFileCalculation(self):
+ filename = os.path.join('TestCases', 'test.py')
+ import happydoclib.formatter.formatter_Null
+ import happydoclib.parseinfo
+ docset = MultiFileDocSet(
+ formatterFactory=happydoclib.formatter.formatter_Null.NullFormatter,
+ parserFunc=happydoclib.parseinfo.getDocs,
+ defaultParserConfigValues={'docStringFormat':'StructuredText'},
+ inputModuleNames=[ filename ],
+ outputBaseDirectory=self.output_dir,
+ descriptionFilename='-',
+ #descriptionFilename='README.txt',
+ )
+ info_obj = None
+ actual_output_name = docset.getFullOutputNameForObject(info_obj)
+ expected_output_name = os.path.join(self.output_dir, 'index.html')
+ self.failUnlessEqual(
+ actual_output_name, expected_output_name,
+ 'Outputs do not match:\n %s\nvs.\n %s' % (actual_output_name,
+ expected_output_name,
+ )
+ )
+ return
+
+
|
|
From: Doug H. <dou...@us...> - 2002-08-04 12:04:44
|
Update of /cvsroot/happydoc/HappyDoc/happydoclib/docset
In directory usw-pr-cvs1:/tmp/cvs-serv28237/happydoclib/docset
Modified Files:
docset_Dia.py
Log Message:
Do not call the formatter directly, use our own method to get the
output name for an object.
Index: docset_Dia.py
===================================================================
RCS file: /cvsroot/happydoc/HappyDoc/happydoclib/docset/docset_Dia.py,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** docset_Dia.py 24 Oct 2001 21:27:35 -0000 1.1
--- docset_Dia.py 4 Aug 2002 12:04:41 -0000 1.2
***************
*** 152,156 ****
# Get the name of and open the docset root file
#
! self._root_name = self._formatter.getFullOutputNameForObject(None)
self._output = self.openOutput( self._root_name, self._title, '' )
--- 152,156 ----
# Get the name of and open the docset root file
#
! self._root_name = self.getFullOutputNameForObject(None)
self._output = self.openOutput( self._root_name, self._title, '' )
|