From: Agnibho Mondal <mondal@agnibho.com> Date: Sun, 30 May 2021 18:58:36 +0000 (+0530) Subject: Abstract formatting X-Git-Url: https://code.agnibho.com/repo?a=commitdiff_plain;h=c8a343dfe4e1a3c8088e1a1e19a0addff0269d08;p=sysrev.git Abstract formatting --- diff --git a/custom.css b/custom.css index e1c8d68..a480caf 100644 --- a/custom.css +++ b/custom.css @@ -1,3 +1,3 @@ -pre { +.abstract { white-space: pre-wrap; } diff --git a/script.js b/script.js index df0a9db..ac948e6 100644 --- a/script.js +++ b/script.js @@ -11,6 +11,26 @@ if(localStorage.getItem("bibliographies")){ function write(){ localStorage.setItem("bibliographies", JSON.stringify(bibgraph)); } +function abstractFormat(text){ + console.log(text); + text="\n"+text; + text=text.replace(/\nobjectives?/i, "<strong>Objectives</strong>"); + text=text.replace(/\nbackground/i, "<strong>Background</strong>"); + text=text.replace(/\nmethods?/i, "\n<strong>Methods</strong>"); + text=text.replace(/\ndesigns?/i, "\n<strong>Design</strong>"); + text=text.replace(/\nmaterials? and methods?/i, "\n<strong>Materials and methods</strong>"); + text=text.replace(/\nmethodology/i, "\n<strong>Methodology</strong>"); + text=text.replace(/\ninterventions?/i, "\n<strong>Interventions</strong>"); + text=text.replace(/\nstatistical analysis/i, "\n<strong>Statistical Analysis</strong>"); + text=text.replace(/\nprincipal findings?/i, "\n<strong>Principal Findings</strong>"); + text=text.replace(/\nfindings?/i, "\n<strong>Findings</strong>"); + text=text.replace(/\noutcomes?/i, "\n<strong>Outcomes</strong>"); + text=text.replace(/\nresults?/i, "\n<strong>Results</strong>"); + text=text.replace(/\nconclusions?/i, "\n<strong>Conclusions</strong>"); + text=text.replace(/\nsignificance/i, "\n<strong>Significance</strong>"); + console.log(text); + return text; +} function showAllBibs(){ $("#all-bibs").html(""); Object.values(bibgraph).forEach(function(bib){ @@ -82,7 +102,7 @@ $(document).ready(function(){ flag=""; if(item.selected[1]==true) flag="checked"; if(item.selected[0]){ - $("#step-2").html($("#step-2").html()+"<div class='list-group-item'><a href='#' class='to-select' data-step='1' data-cite='"+item.citationKey+"'><input type='checkbox' "+flag+" class='step-2-select'> "+item.title+" ["+item.creators[0].lastName+" et al]</a><pre>"+item.abstractNote+"</pre></div>"); + $("#step-2").html($("#step-2").html()+"<div class='list-group-item'><a href='#' class='to-select' data-step='1' data-cite='"+item.citationKey+"'><input type='checkbox' "+flag+" class='step-2-select'> "+item.title+" ["+item.creators[0].lastName+" et al]</a><div class='abstract'>"+abstractFormat(item.abstractNote)+"</div></div>"); } }); });