diff --git a/src/js/app.js b/src/js/app.js
index 26eb94b..e1046c1 100644
--- a/src/js/app.js
+++ b/src/js/app.js
@@ -132,7 +132,7 @@ function getArticles(feed) {
}
function makePages(content) {
- paragraphs = content.split(/<\/p>|[\r\n\t\f\v]+/gim);
+ paragraphs = content.split(/<\/p>|
|[\r\n\t\f\v]+/gim);
for (paragraphNum = 0; paragraphNum < paragraphs.length; paragraphNum++) {
paragraphs[paragraphNum] = formatText(paragraphs[paragraphNum]);
}
@@ -152,7 +152,7 @@ function makePages(content) {
}
else {
if (paragraphNum === 0) {
- // On the round, make first page only include title and author.
+ // On the round, make first page only include title and author on first page.
pages = processParagraphs(pages, 0, 0, paragraphs[paragraphNum]);
}
else {
@@ -172,14 +172,19 @@ function processParagraphs(pageArr, maxCharsPerPage, maxCharsExtension, content)
//Prevent page split from occurring mid-word.
firstPart = firstPart.split(" ");
- afterLastSpace = firstPart[ firstPart.length - 1 ];
- laterPart = afterLastSpace + laterPart;
- firstPart.pop(); //remove afterLastSpace from firstPart
- firstPart = firstPart.join(' ');
-
- firstPart = firstPart + String.fromCharCode(160) + "›";
- laterPart = "‹" + String.fromCharCode(160) + laterPart;
-
+ //console.log(firstPart);
+ if (firstPart.length > 1) {
+ afterLastSpace = firstPart[ firstPart.length - 1 ];
+ laterPart = afterLastSpace + laterPart;
+ firstPart.pop(); //remove afterLastSpace from firstPart
+ firstPart = firstPart.join(' ');
+
+ firstPart = firstPart + String.fromCharCode(160) + "›";
+ laterPart = "‹" + String.fromCharCode(160) + laterPart;
+ }
+ else {
+ firstPart = firstPart[0] + "..." + String.fromCharCode(160) + "›";
+ }
pageArr.push(firstPart);
pageArr.concat(processParagraphs(pageArr, maxCharsPerPage, maxCharsExtension, laterPart));
}
@@ -195,34 +200,31 @@ function formatText(text) {
return "";
}
else {
- text = text.replace(/
/g, "\n");
-
- text = text.replace(/