I thought that excessive blank lines had been sorted
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Plusnet Community
- :
- Forum
- :
- Feedback
- :
- Community Site Feedback
- :
- Re: I thought that excessive blank lines had been ...
I thought that excessive blank lines had been sorted
07-06-2016 4:05 PM - edited 07-06-2016 4:09 PM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Report to Moderator
https://community.plus.net/t5/General-Chat/H-D-T-V/m-p/1340819#M202879
Is a quote of the post with the problem
There are numerous lines with
<p> </p>
Re: I thought that excessive blank lines had been sorted
07-06-2016 4:30 PM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Report to Moderator
I had a script that would remove all of these random blank paragraphs when rendering each post and they would still be visible when editting the post (I can't intercept them betweem posting and saving it in the system) but there was too much outcry over users having control over their own posts so I removed the script entirely. I guess some users feel the need to hit return twice when composing replies or leaving empty paragraphs at the end of their messages. That is fine by me and its down to the users how they wish to compose their messages.
We were looking at removing the empty paragraphs at the end of each post but this was not possible to do so.
Frontend Web Developer | www.plus.net
If you have an idea to improve the community, create a new topic on our Community Feedback board to start a discussion about your idea.
Re: I thought that excessive blank lines had been sorted
07-06-2016 4:33 PM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Report to Moderator
I'm not sure how the quoted user added all those blank lines. Resting on the return key? Just kidding. They could always edit their message if after posting it was not formatted correctly.
Or I could put my script back in that removed all blank lines on the rendered message but this would still be displayed on the emails that get generated..
Frontend Web Developer | www.plus.net
If you have an idea to improve the community, create a new topic on our Community Feedback board to start a discussion about your idea.
Re: I thought that excessive blank lines had been sorted
07-06-2016 4:37 PM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Report to Moderator
I have reported it to the mods for sorting
Re: I thought that excessive blank lines had been sorted
07-06-2016 5:16 PM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Report to Moderator
Don't you dare put your script back Anyway, I thought Lithium were going to sort out the removal of blank lines at the end of a post (no where else).
Re: I thought that excessive blank lines had been sorted
07-06-2016 5:19 PM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Report to Moderator
No, that would be down me putting a script in to do that.
I found it almost impossible to do consistently and its on my list of enhancements to look at in the future. It's much easier to go through an entire page of posts and remove dead paragraphs than it is to selectively select each post and systematically read the content, work out where the content ends and remove everything after that.
It's on my list and I may need to get someone with advanced knowledge of jQuery to help me out on that when i get round to it (and I'm pretty good with jQuery!).
Frontend Web Developer | www.plus.net
If you have an idea to improve the community, create a new topic on our Community Feedback board to start a discussion about your idea.
Re: I thought that excessive blank lines had been sorted
07-06-2016 5:23 PM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Report to Moderator
Nothing as simple as EOF and remove CR's before it then
Re: I thought that excessive blank lines had been sorted
07-06-2016 5:27 PM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Report to Moderator
thats going back to the days of visual basic with EOF (end of file) lol. If only things were that simple.
Frontend Web Developer | www.plus.net
If you have an idea to improve the community, create a new topic on our Community Feedback board to start a discussion about your idea.
Re: I thought that excessive blank lines had been sorted
07-06-2016 5:33 PM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Report to Moderator
Or even further back, just plain old DOS.
Re: I thought that excessive blank lines had been sorted
08-06-2016 10:11 AM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Report to Moderator
Frontend Web Developer | www.plus.net
If you have an idea to improve the community, create a new topic on our Community Feedback board to start a discussion about your idea.
Re: I thought that excessive blank lines had been sorted
08-06-2016 11:09 AM - edited 08-06-2016 11:09 AM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Report to Moderator
@jaread83 - I know it's not really recommended for HTML but I don't think the document structure will be changing to often so I would be inclined to use a regular expression to do this.
You said you'll be using jQuery so maybe something like this in a replace() :
$string = replace('/<p[^>]*><\\/p[^>]*>/i', '', $string)
This if from the top of the head so may not even work.
Re: I thought that excessive blank lines had been sorted
08-06-2016 11:16 AM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Report to Moderator
That would remove all of the empty paragraphs which was universally hated by the test users. What you have provided isn't too far off what I already wrote originally:
$('p').each(function() { var $this = $(this); if ($this.html().replace(/\s| /g, '').length == 0) $this.remove(); });
I had been trying to do it in a reverse order and jump from post to post to remove the end tags and this is what I got before giving up becuase it didn't work:
$(".lia-message-body-content").each(function(){ // $($("p").reverse()).each(function() { $($("p").get().reverse()).each(function() { var $this = $(this); if ($this.html().replace(/\s| /g, '').length == 0){ $this.remove(); console.log('found a match'); } else { return false; console.log('stop!'); }; }); });
So it's something I have certainly been trying to crack with little luck
Frontend Web Developer | www.plus.net
If you have an idea to improve the community, create a new topic on our Community Feedback board to start a discussion about your idea.
Re: I thought that excessive blank lines had been sorted
08-06-2016 11:19 AM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Report to Moderator
As an aside, any empty paragraphs left in posts are displayed like this:
<p> </p>
And that makes it easier to target. The problem is that I need it to only remove the empty paragraphs at the end of a post and leave any in the middle of content as they are which complicates things. I had to concede to let users be sensible with their posts and let mods and admins deal with bad inputs.
Frontend Web Developer | www.plus.net
If you have an idea to improve the community, create a new topic on our Community Feedback board to start a discussion about your idea.
Re: I thought that excessive blank lines had been sorted
08-06-2016 12:00 PM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Report to Moderator
@jaread83 - OK I see that would annoy some, so what about removing anything greater than double lines?
s/<p> <\/>{2,}/ /g
And using this you then only need to do it on each .lia-message-body-content.
Re: I thought that excessive blank lines had been sorted
08-06-2016 12:03 PM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Report to Moderator
Problem with that is that some users like to use double spaces (annoying I know). Can't remove them if they were intentional. I need to find a way to only remove the empty paragraphs after the content body. Bit of a head scratcher
Frontend Web Developer | www.plus.net
If you have an idea to improve the community, create a new topic on our Community Feedback board to start a discussion about your idea.
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Plusnet Community
- :
- Forum
- :
- Feedback
- :
- Community Site Feedback
- :
- Re: I thought that excessive blank lines had been ...