[svn r38144] Fixed a problem with the linker which on building api/source docs found matches
in its own source code, moved some elements in the apigen docs out of a header where they shouldn't have been (making the font too large). --HG-- branch : trunk
This commit is contained in:
		
							parent
							
								
									9643b7d6f8
								
							
						
					
					
						commit
						46f8c56c9b
					
				| 
						 | 
					@ -22,16 +22,17 @@ class H(html):
 | 
				
			||||||
    class ClassDescription(Description):
 | 
					    class ClassDescription(Description):
 | 
				
			||||||
        pass
 | 
					        pass
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    class ClassDef(html.h1):
 | 
					    class ClassDef(html.div):
 | 
				
			||||||
        def __init__(self, classname, bases, docstring, sourcelink,
 | 
					        def __init__(self, classname, bases, docstring, sourcelink,
 | 
				
			||||||
                     properties, methods):
 | 
					                     properties, methods):
 | 
				
			||||||
            super(H.ClassDef, self).__init__('class %s(' % classname,)
 | 
					            header = H.h1('class %s(' % (classname,))
 | 
				
			||||||
            for name, href in bases:
 | 
					            for name, href in bases:
 | 
				
			||||||
                link = name
 | 
					                link = name
 | 
				
			||||||
                if href is not None:
 | 
					                if href is not None:
 | 
				
			||||||
                    link = H.a(name, href=href)
 | 
					                    link = H.a(name, href=href)
 | 
				
			||||||
                self.append(H.BaseDescription(link))
 | 
					                header.append(H.BaseDescription(link))
 | 
				
			||||||
            self.append('):')
 | 
					            header.append('):')
 | 
				
			||||||
 | 
					            super(H.ClassDef, self).__init__(header)
 | 
				
			||||||
            self.append(H.div(H.Docstring(docstring or
 | 
					            self.append(H.div(H.Docstring(docstring or
 | 
				
			||||||
                                          '*no docstring available*'),
 | 
					                                          '*no docstring available*'),
 | 
				
			||||||
                              sourcelink,
 | 
					                              sourcelink,
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -2,6 +2,12 @@ import py
 | 
				
			||||||
import os
 | 
					import os
 | 
				
			||||||
html = py.xml.html
 | 
					html = py.xml.html
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# this here to serve two functions: first it makes the proto part of the temp
 | 
				
			||||||
 | 
					# urls (see TempLinker) customizable easily (for tests and such) and second
 | 
				
			||||||
 | 
					# it makes sure the temp links aren't replaced in generated source code etc.
 | 
				
			||||||
 | 
					# for this file (and its tests) itself.
 | 
				
			||||||
 | 
					TEMPLINK_PROTO = 'apigen.temp'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def getrelfspath(dotted_name):
 | 
					def getrelfspath(dotted_name):
 | 
				
			||||||
    # XXX need to make sure its imported on non-py lib 
 | 
					    # XXX need to make sure its imported on non-py lib 
 | 
				
			||||||
    return eval(dotted_name, {"py": py})
 | 
					    return eval(dotted_name, {"py": py})
 | 
				
			||||||
| 
						 | 
					@ -58,20 +64,22 @@ class TempLinker(object):
 | 
				
			||||||
        self._linkid2target = {}
 | 
					        self._linkid2target = {}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def get_lazyhref(self, linkid):
 | 
					    def get_lazyhref(self, linkid):
 | 
				
			||||||
        return 'apigen.linker://%s' % (linkid,)
 | 
					        return '%s://%s' % (TEMPLINK_PROTO, linkid)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def set_link(self, linkid, target):
 | 
					    def set_link(self, linkid, target):
 | 
				
			||||||
        assert linkid not in self._linkid2target
 | 
					        assert linkid not in self._linkid2target
 | 
				
			||||||
        self._linkid2target[linkid] = target
 | 
					        self._linkid2target[linkid] = target
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def get_target(self, tempurl, fromlocation=None):
 | 
					    def get_target(self, tempurl, fromlocation=None):
 | 
				
			||||||
 | 
					        assert tempurl.startswith('%s://' % (TEMPLINK_PROTO,))
 | 
				
			||||||
        linkid = '://'.join(tempurl.split('://')[1:])
 | 
					        linkid = '://'.join(tempurl.split('://')[1:])
 | 
				
			||||||
        linktarget = self._linkid2target[linkid]
 | 
					        linktarget = self._linkid2target[linkid]
 | 
				
			||||||
        if fromlocation is not None:
 | 
					        if fromlocation is not None:
 | 
				
			||||||
            linktarget = relpath(fromlocation, linktarget)
 | 
					            linktarget = relpath(fromlocation, linktarget)
 | 
				
			||||||
        return linktarget
 | 
					        return linktarget
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    _reg_tempurl = py.std.re.compile('"(apigen.linker:\/\/[^"\s]*)"')
 | 
					    _reg_tempurl = py.std.re.compile('["\'](%s:\/\/[^"\s]*)["\']' % (
 | 
				
			||||||
 | 
					                                      TEMPLINK_PROTO,))
 | 
				
			||||||
    def replace_dirpath(self, dirpath, stoponerrors=True):
 | 
					    def replace_dirpath(self, dirpath, stoponerrors=True):
 | 
				
			||||||
        """ replace temporary links in all html files in dirpath and below """
 | 
					        """ replace temporary links in all html files in dirpath and below """
 | 
				
			||||||
        for fpath in dirpath.visit('*.html'):
 | 
					        for fpath in dirpath.visit('*.html'):
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -34,10 +34,6 @@ ul li {
 | 
				
			||||||
  list-style-type: none;
 | 
					  list-style-type: none;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
.classdoc {
 | 
					 | 
				
			||||||
  font-size: 0.8em;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
.code a {
 | 
					.code a {
 | 
				
			||||||
  color: blue;
 | 
					  color: blue;
 | 
				
			||||||
  font-weight: bold;
 | 
					  font-weight: bold;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue