Sonya* Posted May 21, 2013 Posted May 21, 2013 If text is truncated and there are new lines within it then there is no space between the them. The words from different lines and sentences are attached just like they were one word. Example: Hi you! I have a question about my board. would be truncated to: Hi you!Ihave a question... Better would be Hi you! I have a question...
Sonya* Posted May 21, 2013 Author Posted May 21, 2013 Off: Oh no... :sad: blank lines inside quotes are back :cry: What am I doing wrong? Why are they added to the first quote above? When I try to edit, there is no blank line in the quote in raw mode, hence no possibility to delete something that is not there... But it is there you can see it above.
Aiwa Posted May 21, 2013 Posted May 21, 2013 I don't know that this has anything to do with truncate. I think this is related to strip_tags($content). When you strip tags, you strip new line characters / BBCode / HTML. If you strip a new line character and there wasn't a space before it or starting the new line, it will put the lines back to back no space because there isn't a space there...
Sonya* Posted May 21, 2013 Author Posted May 21, 2013 @Aiwa, I think that stripping html tags should be integrated into IPSText::truncate by default. Means there is no reason to truncate a string that contains HTML, as HTML is very likely to be broken. If IPSText::truncate would strip the tags, it can also replace <br>, /n and other new lines characters by space and then strip. Just an idea ;)
Aiwa Posted May 21, 2013 Posted May 21, 2013 Strip tags is a php function, not part of an IP.Board API. They'd have to rewrite the php strip tags function to do that. Currently the only thing strip tags can do is ignore specific tags. Which you can tell it to do in your custom output then match and replace any tags you left behind with a space.
Sonya* Posted May 21, 2013 Author Posted May 21, 2013 They'd have to rewrite the php strip tags function to do that. They do not have to rewrite anything, if they replace <br>, /n and any other sign representing line break by space in IPSText::truncate before applying strip_tags(). ;)
bfarber Posted May 21, 2013 Posted May 21, 2013 Strip tags is a php function, not part of an IP.Board API. They'd have to rewrite the php strip tags function to do that. Currently the only thing strip tags can do is ignore specific tags. Which you can tell it to do in your custom output then match and replace any tags you left behind with a space. Sonya is suggesting that when you call IPSText::truncate() to let this method run the PHP strip_tags() function instead of calling it manually, and in the process replacing <br> with a space or newline first.
bfarber Posted May 21, 2013 Posted May 21, 2013 Off: Oh no... :sad: blank lines inside quotes are back :cry: What am I doing wrong? Why are they added to the first quote above? When I try to edit, there is no blank line in the quote in raw mode, hence no possibility to delete something that is not there... But it is there you can see it above. When I click edit, the blank lines are there both in STD and RTE mode. If there's a blank line there in the editor, it should be retained on submit I'd think? Would you like me to edit your post to remove it? This doesn't seem to be an editor/parser bug...there's genuinely a line there. " alt="2013-05-21_0946.png">
Recommended Posts
Archived
This topic is now archived and is closed to further replies.