View Single Post
Old 06-17-2014, 08:05 PM   #2986
cryzed
Evangelist
cryzed ought to be getting tired of karma fortunes by now.cryzed ought to be getting tired of karma fortunes by now.cryzed ought to be getting tired of karma fortunes by now.cryzed ought to be getting tired of karma fortunes by now.cryzed ought to be getting tired of karma fortunes by now.cryzed ought to be getting tired of karma fortunes by now.cryzed ought to be getting tired of karma fortunes by now.cryzed ought to be getting tired of karma fortunes by now.cryzed ought to be getting tired of karma fortunes by now.cryzed ought to be getting tired of karma fortunes by now.cryzed ought to be getting tired of karma fortunes by now.
 
cryzed's Avatar
 
Posts: 408
Karma: 1050547
Join Date: Mar 2011
Device: Kindle Oasis 2
From what I can tell, the only way that the site allows authors to upload their content is in plain text files. These text files are later displayed within pre-tags on the actual story page to preserve their formatting, including all spaces, newlines etc. If this content wouldn't be contained within these tags (and later aren't since using pre-tags within ebooks would probably cause some readers to display it strangely), normal browsers would (and I'm assuming ebook readers too) collapse repeated spaces into a single space character. Since the only way to really format a plain text file is by using tabs or spaces excessively, I added the option to replace all regular spaces with "&nbsp" HTML entities, which are basically simply spaces that won't be automatically collapsed by browsers.

I might have to improve that somehow, as well as the simple newline replacement which should really wrap paragraphs into p-tags somehow to allow further customization via the CSS file -- that would also allow me to narrow down which space characters to replace instead of replacing all of them blindly (although a RegEx might do). I did something similar a bit better in one of my other projects with this utility function. But this works for now, it's really just an option to force the ebook reader to not collapse space characters (which I'm assuming most would do), if the user really desires this behavior.

Last edited by cryzed; 06-17-2014 at 08:11 PM.
cryzed is offline