Modify

Opened 11 years ago

Closed 11 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:

Description

... 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.

Example:

  • tracpydoc/tracpydoc.py

    diff -r cd5b88745b73 tracpydoc/tracpydoc.py
    a b  
    1717class TracDoc(pydoc.HTMLDoc):
    1818
    1919    _cleanup_re = re.compile(r'(?:bg)?color="[^"]+"')
     20    _cleanup_heading_re = re.compile(r'href="([^"]+).html"')
    2021
    2122    def __init__(self, env):
    2223        self.env = env
     
    4546        return '.'.join(links)
    4647
    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))
    4951
    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 11 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 11 years ago by Alec Thomas

Resolution: fixed
Status: newclosed

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Alec Thomas.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment


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

 
Note: See TracTickets for help on using tickets.