Opened 11 years ago

Last modified 10 years ago

#2001 reopened defect

Extra closing tags being output

Reported by: cody@… Owned by: osimons
Priority: normal Component: TocMacro
Severity: normal Keywords:
Cc: Trac Release: 0.10


I noticed that an extraneous set of closing tags were being output at the end of the TOC. For example, when outputting a TOC for a very simple page, I get the following HTML:

<div class='wiki-toc'>
<h4>Table of Contents</h4>
<ol><li class="active"><a href="/wiki/WikiStart#Yay">Yay</a></li></ol></li></ol>

(Note the extra </li></ol>.)

Attached is a patch that should fix this.

Attachments (1)

tocmacro_extra_closing_tags.patch (478 bytes) - added by cody@… 11 years ago.

Download all attachments as: .zip

Change History (7)

Changed 11 years ago by cody@…

comment:1 Changed 11 years ago by osimons

Owner: changed from Noah Kantrowitz to osimons

This is no longer the case for 0.11 version following #1784 / [2801].

I'll put it on my to-do list anyway for when I open the 0.10 code again.

comment:2 Changed 10 years ago by osimons

Nope. I can't find that the problem exists with the latest 0.10 TOC macro. Not sure exactly how you called the macro or what your page looked like, but I tried a number of combinations and it kept making correct HTML.

And trying you patch was no great success - it threw off the formatting for the whole page immediately with my latest version.

Could you make sure you have the latest version for 0.10, and if the problem persists please provide more details on how I can reproduce it?

comment:3 Changed 10 years ago by cody@…

OK, I installed the latest version for 0.10 and can confirm that the problem doesn't occur anymore. However, I now get this lovely error whenever I go to my WebAdmin Plugins page:

Traceback (most recent call last):
  File "/var/lib/python-support/python2.4/trac/web/", line 406, in dispatch_request
  File "/var/lib/python-support/python2.4/trac/web/", line 237, in dispatch
    resp = chosen_handler.process_request(req)
  File "/usr/lib/python2.4/site-packages/TracWebAdmin-0.1.2dev_r5911-py2.4.egg/webadmin/", line 119, in process_request
  File "/usr/lib/python2.4/site-packages/TracWebAdmin-0.1.2dev_r5911-py2.4.egg/webadmin/", line 76, in process_admin_request
  File "/usr/lib/python2.4/site-packages/TracWebAdmin-0.1.2dev_r5911-py2.4.egg/webadmin/", line 171, in _render_view
    plugins[dist.project_name] = {
  File "/usr/lib/python2.4/site-packages/TracWebAdmin-0.1.2dev_r5911-py2.4.egg/webadmin/", line 230, in _get_pkginfo
    pkginfo = email.message_from_string(dist.get_metadata('PKG-INFO'))
  File "/usr/lib/python2.4/site-packages/", line 1137, in get_metadata
    return self._get(self._fn(self.egg_info,name))
  File "/usr/lib/python2.4/site-packages/", line 1195, in _get
    return self.loader.get_data(path)
ZipImportError: bad local file header in /usr/lib/python2.4/site-packages/TracTocMacro-1.0-py2.4.egg

I should have left well enough alone.

comment:4 in reply to:  3 Changed 10 years ago by osimons

Resolution: worksforme
Status: newclosed

Replying to

OK, I installed the latest version for 0.10 and can confirm that the problem doesn't occur anymore.

Good, closing ticket.

However, I now get this lovely error whenever I go to my WebAdmin Plugins page:

Not so good. Have not seen that problem with the macro before, and quite sure it is an install issue. Suggest you try to install it again, this time not installing it as a zipped egg file, but instead either easy_install -Z ... or just manually unzip your egg into a folder of the same name (.egg).

If it persists and you think it is related to the macro, please create a new ticket for this new issue.

comment:5 Changed 10 years ago by cody@…

Resolution: worksforme
Status: closedreopened

OK, I had installed the plugin directly from Subversion like so:


When I did that, the closing tags were being output correctly, but the problem on the WebAdmin Plugins page described above occurred.

I tried to install directly from the zip file using easy_install -Z ..., but that doesn't work because the zip file includes the source for all versions of the plugin. So, I just manually unzipped it and copied the 0.10 folder to a folder of the same name as you suggested:

mv tocmacro/0.10/ /usr/lib/python2.4/site-packages/TracTocMacro-1.0-py2.4.egg

The problem with the closing tags reoccurs now, however. Here is how I am calling the macro in my page:


And here is the exact output (note the extra </li></ol> before the </div>):

<div class='wiki-toc'>
<h4>Table of Contents</h4>

<ol><li class="active"><a href="/wiki/WikiStart#V">V</a></li><li class="active">
<a href="/wiki/WikiStart#W">W</a></li><li class="active">
<a href="/wiki/WikiStart#X">X</a></li><li class="active">
<a href="/wiki/WikiStart#Y">Y</a></li><li class="active">
<a href="/wiki/WikiStart#Z">Z</a></li></ol></li></ol></div>


comment:6 Changed 10 years ago by osimons

easy_install -Z

I'm not sure how that copying from the zip file you did would work as it is based on having to install it to get the egg-info and install registration working.

If you get back behaviour from earlier versions it feels like you have some old version of the plugin that is still active somewhere. Could you please check global + project plugins folders (all projects if you have more than one), and remove any pre-existing version before trying the easy_install above?

Modify Ticket

Change Properties
Set your email in Preferences
as reopened The owner will remain osimons.

Add Comment

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

Note: See TracTickets for help on using tickets.