Modify

Opened 9 years ago

Closed 9 years ago

#114 closed defect (fixed)

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

Reported by: cboos Owned by: athomas
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 9 years ago by athomas

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

comment:2 Changed 9 years ago by athomas

  • Resolution set to fixed
  • Status changed from new to closed

Add Comment

Modify Ticket

Action
as closed .
as The resolution will be set. Next status will be 'closed'.
to The owner will be changed from athomas. Next status will be 'closed'.
The resolution will be deleted. Next status will be 'reopened'.
Author


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

 
Note: See TracTickets for help on using tickets.