Modify

Opened 10 years ago

Closed 10 years ago

Last modified 3 years ago

#16 closed defect (fixed)

anchor suffix keeps increasing with each page view

Reported by: anonymous Owned by: athomas
Priority: highest Component: AnchorPatch
Severity: blocker Keywords:
Cc: Trac Release:

Description

I just applied the anchor patch to my trac installation, and I can see from the page source that the anchors are being added to the headings on each page. The problem is, each time I view the page, the anchor suffix is increase by 1.

Example: The heading 'Primary' has this source <h1 id="Primary">Primary</h1>, but the second time I view the page it gets this <h1 id="Primary1">Primary</h1>, then next time <h1 id="Primary2">Primary</h1>, etc.

The TOC macro only ever links to the first anchor (without the number appended) so my TOC only works the first time a view a page.

I'm using TRAC 0.8.1 on Debian with mod_python to serve multiple projects.

Attachments (0)

Change History (7)

comment:1 Changed 10 years ago by anonymous

  • Cc peter.milner@… added; anonymous removed

i wonder if this has anything to do with chaching with mod_python ...

comment:2 Changed 10 years ago by athomas

  • Status changed from new to assigned

Try adding the following constructor to class Formatter in trac/WikiFormatter.py around line 280:

    def __init__(self, hdf, env, db, absurls=0):
        CommonFormatter.__init__(self, hdf, env, db, absurls)
        self.seen_anchors = []

Let me know if that solves your problem.

comment:3 Changed 10 years ago by anonymous

  • Cc anonymous added; peter.milner@… removed

Yes, that seems to have fixed to issue! Thanks!

comment:4 Changed 10 years ago by athomas

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

(In [38]) * Add constructor to CommonFormatter, closes #16.

comment:5 Changed 3 years ago by zerodeux

(In [10744]) (vcaron) Add draft template for import plugin (upload phase), see #16

comment:6 Changed 3 years ago by zerodeux

(In [10772]) (vcaron) Import plugin: upload template OK, import_max_size option defined for upoad mechanism, see #16. Next step: actually list real uploaded files

comment:7 Changed 3 years ago by zerodeux

(In [10777]) (vcaron) Implemented selector + import preview, see #16

Add Comment

Modify Ticket

Action
as closed The owner will remain athomas.
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.