Even if there is no floating image in the post.
Even if there is no image at all. I think this is bad practice.
The problem that occurs for me is that I have my blocks written with the same content type including the img_assist filter, and because of the nasty <br class="clear" /> tag I have an extra line in each of the blocks. This looks awful, and was also not necessary in the 4.6 version.
Please be less intrusive with additions to every node that the module touches.
For starters, you could just skip the <br ...> tag when there is no image in the node.
(And no, I don't want to add another content type just for not having an unnessecary line break. If I had to do that for every module I'm using, it would be the total chaos. Don't tell me to have a workaround.)
| Comment | File | Size | Author |
|---|---|---|---|
| #42 | img_assist-DRUPAL-5_2.patch | 2.01 KB | sun |
| #36 | img_assist-DRUPAL-5_1.patch | 1.86 KB | sun |
| #28 | img_assist-DRUPAL-5.patch | 1.29 KB | sun |
| #24 | img_assist.module_9.patch | 827 bytes | sun |
| #10 | img_assist_nobr.patch.txt | 695 bytes | binford2k |
Comments
Comment #1
benshell commentedI understand the concern... but if I DIDN'T have the br clear in there someone else would be on here complaining about how img_assist is messing up their layouts. It's basically a lose-lose situation for me as the developer. This is now in a theme file so you can easily override it. Otherwise, submit a patch that makes it work different way and I'll take a look at it. Sorry to be blunt, but you need to remember that Drupal and contributed modules like img_assist are free. If you don't like them, you can change them. A patch for this issue would be welcome, but I'm not sure how to best change this (nor do I have time right now).
Comment #2
zach harkey commentedAn additional negative side effect to the
<br class=\"clear-both\" />is that it seems to be triggering the 'read more' even if there isn't any more to read. Now I have some pretty complicated theme logic so it may just be affecting me.That's how I found this thread — trying to root out all of these unneeded 'read more' links, and this looks like the culprit. Anyone else notice this behavior?
Comment #3
zach harkey commentedI hate to say it (because he appears to be kind of a jerkoff) but, the more I think about this, the more I agree with jpetso.
This kind of thing is really the responsibility of the theme's css. Let the theme designer's worry about clearing their own floats.
Comment #4
jpetso commentedI'm sorry to have been rude, that was not my intention. (Seems like I let my frustration on this issue shine through.)
It's still a good thing to have img_assist, although I have some problems with it.
On the patch side, I'm afraid I might not be skilled enough to do it, I don't know PHP and the code is not exactly easy to understand.
(I already had a hard time tracking this down to img_assist in the first place.)
Comment #5
jpetso commentedAs a short note, I don't fully understand why img_assist has to do the layout at all.
At least for me, all I want is to have an easy way to insert images (I wouldn't mind if the caption went away as well) and I can still place the image in an further or
Comment #6
mariagwyn commentedI am having the same problem, though it is not clear that it is due to img_assist. I have turned it off, left it on, and in all cases, the
appears at the end of the text portion of every field I create within a node.
So:
Title
....and so on.
Any ideas how to get rid of this b/c it is somewhat of a problem. In the CSS, I simply set br.clear to 'display:none' but this doesn't help in those cases where it might be necessary.
Could something else be causing this?
I am running drupal 4.7...
Thanks,
Maria
Comment #7
AjK commentedAll,
I can see benshell's point of view from a developers angle and appreciate the theme angle too. However, it doesn't have to be a lose-lose situation.
The above patch adds a checkbox to the "Other properties" that can disable the <br class="clear"/> tagging. The default is as per the module, include it. But it allows those that don't want it to switch it off.
Maybe this is an acceptable trade off all would be happy with?
best regards
--AjK
Comment #8
mariagwyn commentedI am happy to try this, but I don't know how to run a patch. Can you tell me what to do?
Thanks,
Maria
Comment #9
sun@Maria: HOWTO: Apply patches.
Comment #10
binford2k commentedI changed it to append a div instead and it seems to do what both of you want without the complexity of adding another preference that nobody will understand.
Comment #11
bacon333 commentedafter applying the patch by binford it stills seems to trigger the "read more" for me on the front page. Once i click on read more, the rest of the text would show. does anyone else have this problem?
Comment #12
kayfish commentedI'm really glad I found this thread. I was banging my head against a wall and never thought of img_assist. The patch in #10 is working for me and removes the large space between the teaser and the "read more" link.
BUT
When I use the following filters, everything is fine.
- Line Break COnverter
- Inline Images
However, If I use this set of filters, I get the breaks again.
- HTML filter
- Line Break COnverter
- Inline Images
Could the HTML filter be doing the same thing?
Comment #13
mariagwyn commentedI applied the checkbox patch (#7) rather than the div patch (#10) as I don't want a stray clearing div appearing after various field outputs. So far so good. I don't see a br.class appearing after my field output.
Just out of curiousity, what was the purpose of the br.clear?
Thanks also to Sun for the patch howto.
Maria
Comment #14
sunWhy don't you disable this line break with your theme CSS?
If you do not want to have this line break and are not able to remove it from code this is the preferred way to disable it. The purpose of this align-cleaning line break is simple: img_assist inserts an inline image into a node which is maybe aligned left or right. If there is few text next to the image the following links (comments, attachments, login/register, etc.) are displayed below the image and not below the text. (
drupal.csshas to be included in your theme to have the appropriate style rules forbr.clear.)Comment #15
kastaway commentedWow, this just used about 6 hours of my life. Thanks for the CSS trick, it seems to do the trick.
Really, I'm not sure my grief was caused by img_assist, since I did a grep for the code, found
in img_assist.module, added some test characters, but the modification did not appear in the code on my front page. Theoretically could be some weird caching, but I suspect my problems were not caused by img_assist. There is another thread here which places the blame on filter.module. I don't understand the code inside that module, so I don't know whether it is at fault.
But in short: no module should be doing this. Whether img_assist, filter, or something else. Why would anything add code to areas that it should not affect? It is confusing; far more confusing than a picture which requires a bit of manual tweaking. At least we can see the image is messed up, and know where to start fixing it.
Comment #16
sunComment #17
benovic commentedhave the same prob atm. as im not handling with pictures yet - if i set display:none;
will the clear thing still work?
sorry for that question. i am glad i found this discussion!
Comment #18
sunI doubt that the additional
<br class="clear" />has been removed from img_assist since it's usable for many sites.But CSS always works.
Comment #19
jpetso commentedReopening this issue.
I think there's a solution to the problem that can make both sides happy. I just read about this here, and it seems to me that using
<span class="clear" />works just as well as the currently used
<br class="clear" />but span doesn't have the drawback of a visible trailing newline.
How about changing it this way?
Comment #20
moonray commentedI second using span instead of br.
Comment #21
sunAFAIK, this has been sourced out into a theme function.
Comment #22
moonray commentedYes, it's a theme, and fairly easy to override.
But wouldn't it be better to have the default option be something less intrusive than a line break?
Comment #23
Anonymous (not verified) commentedI agree that it would be better to have something else than a line break. For me it causes a problem I have not been able to fix so far, although there might be a CSS hack I am not aware of. I display a "Read more...." link immediately after the teaser content. (I have disabled the other links for the teaser view as I don't need them.)
Unfortunately, with the line break inserted by Image Assist, there is now a fairly large gap between the teaser content and the "Read more...." link - any ideas how to fix that?
Comment #24
sunGuys, it's been one year since my CSS trick and noone was able to create this simple patch?
Please thoroughly test the attached patch.
Comment #25
zoo33 commentedLooks good. Only we'll have to add the span.clear class to img_assist.css, can't find that anywhere. (The br worked automatically, a span needs to have clear: both.) Or does Drupal core provide .clear?
Comment #26
TobiasH commentedplease have a look at this:
http://drupal.org/node/64292#clear
Comment #27
zoo33 commentedYes, I know about .clear-block, but that would require that the whole node content would be wrapped in a new div:
<div class="clear-block">[node content]</div>Maybe that's preferred, but I feel that maybe a single
<span />at the end of the node content is less intrusive. Thoughts?Comment #28
sunComment #29
zoo33 commentedI committed this with a small change to the css. Garland uses a similar technique so I used its version of span.clear.
Comment #30
sun@zoo33: Thanks for comitting. However, please adhere to Drupal's CVS commit message guideline.
Comment #31
zoo33 commentedI thought that's what I did.
Is it the order in which the information is given that bothers you, or is it the fact that I took a shortcut and used the title as a description?
Comment #32
sunDon't get me wrong, I did not want to offend you.
The CVS log is parsed automatically by different systems.
Your commit message should have read:
That is what the CVS commit message guideline is basically about.
Comment #33
zoo33 commentedI was only aware of the automatic linking of issue numbers. I'm all for following conventions though, so thanks for pointing that out. I'll definitely do that in the future.
Comment #34
sunRe-opening this issue - two reasons:
<span />nor<span></span>is XHTML-valid.class="clear"is too ambigious and already used as a global style in many themes. We should stick toclass="image-clear"or the like.Since code has already changed in 5.x-dev, this issue needs a bit more love and attention than usual, thus setting the status to critical.
Comment #35
zoo33 commentedWhat would you say we should do wrt xhtml validity? Use a surrounding
<div>instead?'<div class="clear-block">' . $content . '</div>'I'm a little reluctant to this, if too many modules do this we'll end up with loads of nested divs.
Comment #36
sunIMHO, a surrounding
class="clear-block"is not an option, because the clear-block style coming from defaults.css will break custom layouts. Overriding that style (namely.clear-block:after) is too difficult.AFAIS, converting that span to a div seems to be the only acceptible option.
Please test attached patch, especially regarding XHTML validation.
Another one: Image Assist inserts this code even if there is no image in the post at all. That's wrong and should be fixed within this issue. Thus, I've also altered img_assist_filter() to only invoke theme_img_assist_filter() if at least one replacement has been performed.
Comment #37
sunComment #38
sunBetter title.
Comment #39
Boinng commentedjust to confirm, the current
<span class="clear" />method is really undesirable and should be changed quickly, toif no other solution presents itself.The current method caused me a major headache all weekend, as - as part of a wholesale upgrade to Drupal 5.2 - this module caused most of my site to be illegible in internet explorer, under any theme. Everything after that span clear tag was rendered in a font so small you could barely see it, let alone read it! You'll find my agonised wail here - http://drupal.org/node/173795
Disabling modules one by one eventually uncovered img_assist as the culprit, and changing the span tag as above has now cured the problem for me.
Comment #40
Boinng commentedSorry, messed up my code tags there - the change should be from
<span class="clear" />to<span class="clear"></span>. Or something better/more compliant if possible, but make sure it works in IE first!Comment #41
zoo33 commentedWow, why do problems always surface only after a commit... OK, so let's fix this quickly.
@sun: I tested these four lines in W3C's XHTML validator:
None of them gave any errors. Are you sure an empty div is better than a span? I would prefer
<span></span>unless it's invalid of course.Nice job with the $processed check! Please add a
$processed = FALSEbefore the loop so that we don't through unnecessary warnings. (Or I can just do it before I commit.)Comment #42
sunFirefox' HTML validator yields a "Trimming empty <span>" warning for each instance of
<span class="image-clear"></span>. Additionally, there is a visible gap between the node content and the following output.However, an empty div container works. Successfully tested in IE6.
Added the missing declaration of $processed.
Comment #43
zoo33 commentedFair enough. Committed!
Comment #44
(not verified) commented