Modify ↓
Opened 19 years ago
Closed 19 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 17 17 class TracDoc(pydoc.HTMLDoc): 18 18 19 19 _cleanup_re = re.compile(r'(?:bg)?color="[^"]+"') 20 _cleanup_heading_re = re.compile(r'href="([^"]+).html"') 20 21 21 22 def __init__(self, env): 22 23 self.env = env … … 45 46 return '.'.join(links) 46 47 47 48 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)) 49 51 50 52 def section(self, *args): 51 53 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 19 years ago by
comment:2 Changed 19 years ago by
Resolution: | → fixed |
---|---|
Status: | new → closed |
Note: See
TracTickets for help on using
tickets.
Thanks Christian, I've applied both of these patches. Out of curiosity, where are you seeing the spurious .html's?