Opened 12 years ago

Closed 12 years ago

#114 closed defect (fixed)

Workaround for pydoc generated module link ending with `.html`

Reported by: Christian Boos Owned by: Alec Thomas
Priority: normal Component: PyDocPlugin
Severity: minor Keywords:
Cc: Trac Release:


... and this is annoying since we can't just truncate a trailing .html in load_object(), as that method takes a dot-separated module path.

The solution would be to clean up the generated title HTML.


  • tracpydoc/

    diff -r cd5b88745b73 tracpydoc/
    a b  
    1717class TracDoc(pydoc.HTMLDoc):
    1919    _cleanup_re = re.compile(r'(?:bg)?color="[^"]+"')
     20    _cleanup_heading_re = re.compile(r'href="([^"]+).html"')
    2122    def __init__(self, env):
    2223        self.env = env
    4546        return '.'.join(links)
    4748    def heading(self, *args):
    48         return self._cleanup('heading', *args)
     49        return re.sub(self._cleanup_heading_re, r'href="\1"',
     50                      self._cleanup('heading', *args))
    5052    def section(self, *args):
    5153        return self._cleanup('section', *args)

(this is on top of my previous patch, posted on the Trac ML, but you see the kind of change needed).

Attachments (0)

Change History (2)

comment:1 Changed 12 years ago by Alec Thomas

Thanks Christian, I've applied both of these patches. Out of curiosity, where are you seeing the spurious .html's?

comment:2 Changed 12 years ago by Alec Thomas

Resolution: fixed
Status: newclosed

Modify Ticket

Change Properties
Set your email in Preferences
as closed The owner will remain Alec Thomas.
The resolution will be deleted.

Add Comment

E-mail address and name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.