Use the following steps to recreate this bug:
- Ensure the linebreak and insert view filters are turned on
- Create a new page with the following content:
[view:myview] - View the source of the resulting page
You'll see that the view's content contains <div> tags nested inside of <p> tags. This does not validate as XHTML. My first attempt to solve this was to force the insert_view filter to run before the linebreak filter because the linebreak filter knows that p tags cannot contain block level elements (including div) -- this didn't work. I popped the hood and found that insert_view is not handling filtering in hook_filter thus ignoring the filter weight that can be set. The README file says that hook_nodeapi is used for the proper "context" but I'm not sure what is meant by that.
The attached patch allows the filter to be run in hook_filter and thus the order can be changed. It properly creates teaser and body views and if it is set to run before the linebreak filter it generates valid XHTML. If this patch breaks something let me know and I'll help work out a solution.
| Comment | File | Size | Author |
|---|---|---|---|
| insert_view.diff | 1.54 KB | imrook |
Comments
Comment #1
mlsamuelson commentedimrook,
Since I took over Insert View, I've not quite been clear on the whole "context" thing either, and have been wanting to conduct testing around this issue, to see if we can't simplify things and make the module work a little more as expected - ie. as a filter module.
And of course we want to have semantic code.
I'll be looking into your patch and getting back to this thread before long.
Thank you.
mlsamuelson
Comment #2
jpetso commentedNice patch - gets rid of a bad hack, makes stuff work (tested), and is cleanly coded. I don't see any reason why this patch should not be committed.
Comment #3
mlsamuelson commentedAgreed and committed.
Thanks imrook for the great patch. And thanks jpetso for the review.
This patch solves an issue that has cropped up over time, namely that Insert View tags didn't work in blocks but the filter help text showed up there anyway. Well now they work, and so the help text is actually helpful there.
Also note: previously, due to the reliance on hook_nodeapi(), Insert View tags would work even if one hadn't enabled the filter. Now that is not the case and users will have to explicitly enable the filter for each input format they wish to use it with. View the README.txt for more information on this.
Thank you both.
I have a few other issues I'm hoping to resolve prior to making a long-overdue release for Insert View. If you'd like to help further in that process, you could test the patch at http://drupal.org/node/148400#comment-755628 (for allowing users to use a special view_pager tag to insert pager views).
mlsamuelson
Comment #4
Anonymous (not verified) commentedAutomatically closed -- issue fixed for two weeks with no activity.
Comment #5
webel commentedI had same problem, however could not use line break filter before view filter as caused linebreaks in a tagadelic view.
My solution was to create a special InsertView input filter for use only on nodes with a single [view:ViewName].
Only applicable in certain cases of course.