Defect #5445


External links not correctly displayed in Wiki TOC

Added by ha thach about 14 years ago. Updated almost 14 years ago.

Text formatting
Target version:
Start date:
Due date:
% Done:


Estimated time:
Affected version:



h1. "Link1":

h2. "Link2":

h1. "Link3":


toc_external_link.jpg (9.3 KB) toc_external_link.jpg ha thach, 2010-05-05 10:42
formatter.rb.diff (846 Bytes) formatter.rb.diff Yuki Kita, 2010-05-25 15:52
toclinks.diff (1.86 KB) toclinks.diff Maksim Morozov, 2010-05-25 17:07
5445_git.diff (1.73 KB) 5445_git.diff Jean-Baptiste Barth, 2010-06-19 23:04
formatter.rb.diff (708 Bytes) formatter.rb.diff Yuki Kita, 2010-06-22 15:59
Actions #1

Updated by Felix Schäfer about 14 years ago

  • Subject changed from TOC does not display correctly headers linked to the external to External links not correctly displayed in Wiki TOC
  • Target version set to 0.9.5

Not sure how complex the problem is, but I'd wager it's more a small-ish parser/filter issue that could be included in 0.9.5.

Actions #2

Updated by Yuki Kita almost 14 years ago


Actions #3

Updated by Maksim Morozov almost 14 years ago

My variant

Actions #4

Updated by yamasi yamasi almost 14 years ago


Actions #5

Updated by Eric Davis almost 14 years ago

Can someone add some tests for these patches? The wiki syntax is a high risk area of code and I want to make sure these changes don't break anything.

Actions #6

Updated by Jean-Baptiste Barth almost 14 years ago

Yuki version with pre/post strings detected in LINK_RE regex, and a unit test. Maybe this test should be moved into test/unit/lib/redmine/wiki_formatting/textile_formatter_test.rb ?

Actions #7

Updated by Eric Davis almost 14 years ago

  • Category changed from Wiki to Text formatting
  • Status changed from New to Resolved
  • Assignee set to Eric Davis
  • % Done changed from 0 to 100
  • Resolution set to Fixed

Fixed in r3786. Thank you for adding some tests for this bug, it will make it easier to prevent this from reoccurring later.

Actions #8

Updated by Eric Davis almost 14 years ago

  • Status changed from Resolved to Closed

Merged to 0.9-stable for release.

Actions #9

Updated by Roland Discein almost 14 years ago

  • Status changed from Closed to Reopened

r3786 has broken my installation:

Processing WelcomeController#index (for at 2010-06-22 14:34:00) [GET]
  Parameters: {"action"=>"index", "controller"=>"welcome"}
Rendering template within layouts/base
Rendering welcome/index

ActionView::TemplateError (undefined method `+' for nil:NilClass) on line #23 of app/views/welcome/index.rhtml:
20:         <% for project in @projects %>
21:             <li>
22:             <%= link_to h(, :controller => 'projects', :action => 'show', :id => project %> (<%= format_time(project.created_on) %>)
23:             <%= textilizable project.short_description, :project => project %>
24:             </li>
25:         <% end %>
26:         </ul>

    lib/redmine/wiki_formatting/textile/formatter.rb:70:in `textile_p_withtoc'
    lib/redmine/wiki_formatting/textile/formatter.rb:70:in `gsub!'
    lib/redmine/wiki_formatting/textile/formatter.rb:70:in `textile_p_withtoc'
    lib/redcloth3.rb:711:in `call'
    lib/redcloth3.rb:711:in `block_textile_prefix'
    lib/redcloth3.rb:659:in `call'
    lib/redcloth3.rb:659:in `blocks'
    lib/redcloth3.rb:658:in `each'
    lib/redcloth3.rb:658:in `blocks'
    lib/redcloth3.rb:633:in `collect'
    lib/redcloth3.rb:633:in `blocks'
    lib/redcloth3.rb:304:in `to_html'
    lib/redmine/wiki_formatting/textile/formatter.rb:38:in `to_html'
    lib/redmine/wiki_formatting.rb:54:in `to_html'
    app/helpers/application_helper.rb:421:in `textilizable'
    app/views/welcome/index.rhtml:23:in `_run_rhtml_app47views47welcome47index46rhtml'
    app/views/welcome/index.rhtml:20:in `each'
    app/views/welcome/index.rhtml:20:in `_run_rhtml_app47views47welcome47index46rhtml'

Rendering /opt/redmine/public/500.html (500 Internal Server Error)


Ruby version              1.8.7 (i486-linux)
RubyGems version          1.3.7
Rack version              1.0
Rails version             2.3.5
Active Record version     2.3.5
Active Resource version   2.3.5
Action Mailer version     2.3.5
Active Support version    2.3.5
Application root          /path/to/redmine
Environment               production
Database adapter          mysql
Database schema version   20100313171051

About your Redmine plugins
Redmine Whining plugin         0.0.3
Redmine Opensearch plugin      0.1
Thumbnails plugin              0.1.1
Redmine Status Updates         0.1.1
Redmine Request Tracker link   0.1.0
Redmine Graphs plugin          0.1.0
Issue Resources                0.2.0
Redmine Bugcloud plugin
ezFAQ plugin                   0.3.5
Redmine Favicon plugin         0.1
Redmine link                   0.1.0
Redmine Code Review plugin     0.3.1
Redmine Local Avatars plugin   0.0.2
Redmine Issues Group plugin    0.1.7
Redmine Todo Lists plugin
Redmine My Widgets plugin      0.1.0
Redmine ezSummary plugin       0.0.1
Redmine Charts                 0.1.0
Redmine Question plugin        0.3.0

Maybe it die while textilizing the short description of one of the last projects in my installation:

h2. "Project Name   !/attachments/1234/logo_small.gif! !/attachments/5678/logo_2.png!":/projects/projectname/issues

| "New Issue here" |
| "Create issue in Category A" |

What am I doing wrong?

Actions #10

Updated by Roland Discein almost 14 years ago

formatter.rb.diff patch works fine, except it actually cant remove

!attachedimage!, version:smth, attachment:file
link tags from toc, only
"Link name":
, but commited r3786 patch brakes system at every place where it tries to textilize links. For example, MyController displays page, but ProjectsController falls in 500.html..

Actions #11

Updated by Yuki Kita almost 14 years ago

So I updated the patch.

Actions #12

Updated by Eric Davis almost 14 years ago

  • Status changed from Reopened to Closed

Roland Discein:

I've applied Yuki Kita's update and also a small change to remove the textile image links !/path/img.gif! from the table of contents generator.


Also available in: Atom PDF