Project

General

Profile

Actions

Patch #894

closed

Patch for #893

Added by Rocco Stanzione over 16 years ago. Updated over 16 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
-
Target version:
-
Start date:
2008-03-19
Due date:
% Done:

100%

Estimated time:

Description

This fixes #893, wiki links not working in tables. I considered monkey-patching redcloth, and I considered sending the patch to _why for redcloth, but apparently that project is unmaintained, so maybe it's ok to touch redcloth.rb. This patch uses a negative lookahead to not split on a pipe that's followed by two consecutive close-brackets, the closing markup for a wiki link. I tried matching both sides (open and close brackets) but MRI's regexp engine doesn't support negative lookbehinds, and I think it's safe to assume there's no other reason you'd have ]] in a table cell.


Files

wiki_links_in_tables.diff (505 Bytes) wiki_links_in_tables.diff Rocco Stanzione, 2008-03-19 18:56
wiki_links_in_tables-1.diff (540 Bytes) wiki_links_in_tables-1.diff Jean-Philippe Lang, 2008-03-19 21:58
Actions #1

Updated by Rocco Stanzione over 16 years ago

Also fixes #870

Actions #2

Updated by Jean-Philippe Lang over 16 years ago

Only wiki links with pipes do not work in tables, but simple wiki links (without pipes) work.
Example with simple wiki links:

Guide Cell
Cell RedmineInstall

This patch fixes links with pipes, but it breaks simple wiki links that do not use pipes.

Actions #3

Updated by Jean-Philippe Lang over 16 years ago

This seems to fix both:

row.split( /\|(?![^\[\|]*\]\])/ ).each do |cell|
Actions #4

Updated by Jean-Philippe Lang over 16 years ago

  • File wiki_links_in_tables-1.diff added

New patch attached.

Actions #5

Updated by Jean-Philippe Lang over 16 years ago

  • File deleted (wiki_links_in_tables-1.diff)
Actions #7

Updated by Rocco Stanzione over 16 years ago

Your fix looks pretty good. Didn't occur to me to test with no-pipe wiki links. Thanks!

Actions #8

Updated by John Goerzen over 16 years ago

Weird that it shows JP's patch as 54 bytes. Looks like it was 540 bytes to me. Is that a bug? :-)

Actions #9

Updated by Rocco Stanzione over 16 years ago

Rails bug! number_to_human_size drops trailing 0's, and jplang's patch is 540 bytes.

Actions #10

Updated by Rocco Stanzione over 16 years ago

FWIW it's fixed in Rails in http://dev.rubyonrails.org/changeset/8774 and merged in the 2-0-stable branch.

Actions #11

Updated by Jean-Philippe Lang over 16 years ago

  • Status changed from New to Closed
  • % Done changed from 0 to 100

Applied in changeset r1280.

Actions

Also available in: Atom PDF