Posted by xenophyle on February 8, 2010 at 5:43pm
4 followers
Jump to:
| Project: | Inline and link Drupal objects (Linodef) |
| Version: | 6.x-1.0-rc5 |
| Component: | Filter |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | active |
Issue Summary
Not sure if this even a bug (or a linodef bug), but...
I am using linodef with FCKEditor within the WYSIWYG module. When trying to use the override option, the link text was appearing as "override=" (without the quotes). For example: [#45,override="this page"].
The reason turned out to be that the text the editor is sending to linodef has the quotation marks replaced with """. Replacing the """ with quotation marks
return _linodef_filter_process(preg_replace('@"@','"',$text), $format);
did the job.
I am not sure (a) if this properly should be handled by linodef or by the wysiwyg or (b) if I really should be using wysiwyg tags or something. But I thought I would mention it.
Comments
#1
I was silly and forgot that the html entity for quotes would be rendered as a quote. Let me try again:
return _linodef_filter_process(preg_replace('@"@','"',$text), $format);#2
Hi which line in which file has to be edited for this bug? Im having the same issue with ckeditor.
#3
Got this fixed with:
function _linodef_filter_process(&$body, $format = -1) {// Debug: print('_linodef_filter_process has been called with format ' . $format . '<br />');
// Tags with options, possible comment will be substituted.
// Using preg_replace_callback() to avoid modificator 'e' (which escapes ',",\ and NULL).
// Including backwards compatibility for RC2 option-value syntax without "": (?:=[a-zA-Z]*)*.
$body = str_replace(""", "\"", $body);
#4
You can fix it in the linodef filter module, but other filters that rely on quotation marks in tags will have the same problem. Do you want to fix them, too? E.g. path filter that relies on "internal:address" will not work in (f)ckeditor.
So this issue should be solved in wysiwyg-module or in the (f)ckeditor module, not in a filter module!
Perhaps it is not an issue of the editor but on the sequence of filters. If you have something like typogrify in use and placed this filter before linodef, you will get similar results.
#5
Moving this bug to the WYSIWYG queue to see how that goes.
As I mentioned at the beginning of the bug, I'm not sure what module should handle this and am trying to track it down.
#6
Though this bug is not related to Linodef directly Linodef should handle it. So Linodef becomes more robust if other Editors or filters have this issue, too. The methods posted in #1/#3 are a first start. However there has to be a check:
1) That the
"is inside a Linodef tag.2) That the
"is not set in the override text itself (so it has to follow a = or followed by a space/comma/bracket).3) This should be done for single quotes, too. See post in #560042: Add option "attributes" to allow html attributes in embedded tags (don't post there, please).
I'll be happy about patches. :) Thx @all for reporting!
#7
Please, don't do that!!!
What if I write: [#123,override="a ",translation="de""] and a wysiwyg-editor makes [#123,override="a "translation="de""] out of this?
Do I get a link wit text a ",translation="de" (as desired) or do I get a link a to a german node?
#8
Yes, this is (part of) the problem with the proposed code snippets. Therefore they need work. Also a replacement in nodeapi (as with joker) might be possible but this would be bad when converting to D7 and has all the flaws of nodeapi (e.g. not loaded in all views, so I have to use views hook for that, too).
So the proposed snippets are a good start. Before the replacement happens one should get the position of all quot and " (inside Linodef tags) and determine which ones are located inside of other quotes to exclude them from replacement.
#9
i would love to help out with this but it's just out of my league. I was able to fix the issue i had with the simple string replace function but the additional checks are just some steps to much.