Modify ↓
      
        Opened 17 years ago
Last modified 11 years ago
#3584 new defect
ToC Macro doesn't work with relative links
| Reported by: | Jim Sermersheim | Owned by: | |
|---|---|---|---|
| Priority: | normal | Component: | TocMacro | 
| Severity: | normal | Keywords: | |
| Cc: | Jim Sermersheim | Trac Release: | 0.11 | 
Description
The second ToC here does not work -- gives "Error: Page ./sub does not exist"
[[TOC(inline,noheading,depth=1, test/sub, test/sub2)]] [[TOC(inline,noheading,depth=1, ./sub, ./sub2)]] [./sub sub][[BR]] [./sub2 sub2]
Note that the first ToC works (but I need relative links) as do the relative links at the bottom.
Attachments (0)
Change History (7)
comment:1 Changed 17 years ago by
| Trac Release: | 0.10 → 0.11 | 
|---|
comment:2 Changed 17 years ago by
| Cc: | Jim Sermersheim added; anonymous removed | 
|---|
comment:3 Changed 17 years ago by
comment:4 Changed 17 years ago by
      for pagename in pagenames:
            // the three lines below this comment are new
            if pagename.startswith('.'):
               rel_url = get_relative_url(self.env, self.resource,  self.context.href, pagename)
               pagename = rel_url.lstrip(self.context.href.base+'/'+self.resource.realm)
            page_resource = self.resource(id=pagename)
            if not 'WIKI_VIEW' in self.context.perm(page_resource):
                # Not access to the page, so should not be included
                continue
            if 'title_index' in params:
                self._render_title_index(ol, page_resource, active and \
                            pagename == current_page,
                            params['min_depth'] < 2)
            else:
                self._render_page_outline(ol, page_resource, active, params)
        return base
    comment:6 Changed 17 years ago by
It's not a diff because I don't think that is the perfect fix. A better fix would be to have a relative resource id generator function in trac which could be used.
comment:7 Changed 11 years ago by
| Owner: | Noah Kantrowitz deleted | 
|---|
Note: See
        TracTickets for help on using
        tickets.
    



A dirty hack for jimse was to insert the following code at the bottom of expandmacro()