Keyword

Text running together

  • Weatherly
  • Weatherly's Avatar Topic Author
  • Offline
  • New Member
More
8 years 11 months ago #150014 by Weatherly
Text running together was created by Weatherly
Example: withtheir shows up in the feed, but if you go straight to the rss feed page or main article it doesn't appear like that. Is there any way to correct this? I tested other readers and it didn't do that either (though none had the styling options of this one.)

Please Log in or Create an account to join the conversation.

More
8 years 11 months ago #150028 by Lefteris
Replied by Lefteris on topic Text running together
Hi,

Is there a link to the page with the issue?

JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

Please Log in or Create an account to join the conversation.

  • Weatherly
  • Weatherly's Avatar Topic Author
  • Offline
  • New Member
More
8 years 11 months ago #150100 by Weatherly
Replied by Weatherly on topic Text running together
Here it is. It isn't doing on every single one, but is on more than one.

www.cbmmortgage.com/mortgage-news

Please Log in or Create an account to join the conversation.

More
8 years 11 months ago #150107 by Lefteris
Replied by Lefteris on topic Text running together
What's the URL of the feed?

JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

Please Log in or Create an account to join the conversation.

More
8 years 4 months ago #156247 by Basil Clarke
Replied by Basil Clarke on topic Text running together
I have the same problem. I think the regular expression that is used to remove html formatting is probably causing this. For instance, a <br /> tag is replaced by nothing, which causes words to run together. It would be better to replace <br /> by a space. Also, spaces are removed after colons - I think your regular expressions must be replacing a double space with nothing. For examples, have a look at the home page of www.palmersgreencommunity.org.uk. The Latest News and Comments module is a Simple RSS module which I use to create a combined feed of articles and forum comments.

Please Log in or Create an account to join the conversation.

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
8 years 4 months ago #156258 by Krikor Boghossian
Replied by Krikor Boghossian on topic Text running together
Hello Basil,

Thank you for reporting this.
From a quick read through your posts, I noticed that you are using multiple instances of &nbsp; which if not stripped, it might break your layout. (Example here: www.palmersgreencommunity.org.uk/pgc/forum/council-services/532-changes-at-bowes-road-and-southgate-circus-libraries#2179)

Is it possible to have the feed's URL as well?

JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

Please Log in or Create an account to join the conversation.

More
8 years 4 months ago - 8 years 4 months ago #156262 by Basil Clarke
Replied by Basil Clarke on topic Text running together
Hi Krikor,

Thanks for looking into this.

There are two feeds:

www.palmersgreencommunity.org.uk/pgc/index.php/forum/recent/posts/sel-720?format=feed&type=rss
www.palmersgreencommunity.org.uk/pgc/index.php/local-news?format=feed&type=rss

I didn't explain that I'm using a custom Simple RSS template which it turns out was adding the non-breaking space instances. However, they were actually in a bit of code that I'd discontinued and commented out instead of deleting. Depending on which RSS feed was the source, I was adding "News:&nbsp;" or "Comment by:&nbsp;" before the subject line, but a while back I changed this. I've now deleted the commented out parts and you will see far fewer non-breaking spaces in the html source.

I've identified two cases where words are run together, but there may be more:

1. Article titles with a colon followed by two spaces. I went into the Hate Crime article and edited the title, removing one of the spaces after the title (which in any case would have been ignored by the browser, so there was no point in having a second space). Simple RSS new shows the space after the colon.

2. Between items in a list. If you again look at how the Hate Crime item is displayed in Simple RSS Feed Reader you'll see words running together. These are items in a list:

<p>CRIME motivated by PREJUDICE is HATE CRIME Don&#8217;t suffer in silence &#8211; we want you to REPORT IT to us.</p>
<ul>
<li>Verbal Abuse</li>
<li>Bullying</li>
<li>Physical Abuse</li>
<li>Vandalism</li>
<li>Intimidation</li>
<li>Threats</li>
<li>Harassment</li>
</ul>

Normally, lists come further down an article, so aren't included in the bit of text output by Simple RSS Reader.

Ideally, the function that you use to strip tags should insert a space in such cases, for instance by replacing </li> by ' ' rather than by ''.
Last edit: 8 years 4 months ago by Basil Clarke.

Please Log in or Create an account to join the conversation.

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
8 years 4 months ago #156316 by Krikor Boghossian
Replied by Krikor Boghossian on topic Text running together
The default strip_tags() function of PHP - php.net/manual/en/function.strip-tags.php - is being used.

Strip_tags() does not leave any spaces when it removes the tags so there is a possibility of text running together.

I can look into a preg_replace() solution but it can cause some issues if there are stray < and > characters in your text.

JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

Please Log in or Create an account to join the conversation.

More
8 years 4 months ago #156362 by Basil Clarke
Replied by Basil Clarke on topic Text running together
i've added two lines to the helper.php file to fix (a) the issue of no space after a colon and (b) words running together when there is a list near the beginning of the feed item. Of course, there may be unwanted consequences...
// Clean up the feed title
			$feedItem->itemTitle = trim(htmlentities($feedItem->itemTitle, ENT_QUOTES, 'utf-8'));
			$feedItem->itemTitle = str_replace(":",": ",$feedItem->itemTitle);  //ADDED BY BASIL

This adds a space after a colon in the title
// Word Limiter
	function wordLimiter($str,$limit=100,$end_char='[&#8230;]'){
		if (trim($str) == '') return $str;
		$str = str_replace("><","> <",$str);  //ADDED BY BASIL
		$str = strip_tags($str);
		preg_match('/\s*(?:\S*\s*){'. (int) $limit .'}/', $str, $matches);
		if (strlen($matches[0]) == strlen($str)) $end_char = '';
		return rtrim($matches[0]).$end_char;

Adds a space between the end of a tag and the start of another tag.

Please Log in or Create an account to join the conversation.

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
8 years 4 months ago #156370 by Krikor Boghossian
Replied by Krikor Boghossian on topic Text running together
This is an interesting solution, using reg ex.
preg_replace('#<[^>]+>#', ' ', $str);

stackoverflow.com/questions/12824899/strip-tags-replace-tags-by-space-rather-than-deleting-them

JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

Please Log in or Create an account to join the conversation.


Powered by Kunena Forum