From c647fee23198791f596486f7f5927f976a84142d Mon Sep 17 00:00:00 2001 From: sairaj mote Date: Sat, 20 Feb 2021 01:24:18 +0530 Subject: [PATCH] Fix: issue with some articles having less sections --- index.html | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/index.html b/index.html index 5f21278..d361fd9 100644 --- a/index.html +++ b/index.html @@ -10096,15 +10096,22 @@ currentarticle['sections'] = {} totalsections = parsedhtml.getElementById('sectionmaster').childElementCount - + for (let j = 0; j < totalsections; j++) { tempobj = {} asection = parsedhtml.getElementById(`section${j + 1}`) - sectiontitle = asection.children[0].children[0].innerText - sectionpara1 = asection.children[1].innerText - tempobj['title'] = sectiontitle - tempobj['paragraph'] = sectionpara1 - currentarticle['sections'][j] = tempobj + if(asection){ + sectiontitle = asection.children[0].children[0].innerText + sectionpara1 = asection.children[1].innerText + tempobj['title'] = sectiontitle + tempobj['paragraph'] = sectionpara1 + currentarticle['sections'][j] = tempobj + } +/* else{ + parsedhtml.getElementById('sectionmaster') + console.log(j+1) + console.error(`current article with issue : ${currentarticle['title']}`) + } */ } parsedarticles[articlekeys[i]] = currentarticle