/**************************************************************************
* Licensed Materials - Property of IBM *
* *
* IBM Cognos Products: AGS *
* *
* (C) Copyright IBM Corp. 2005, 2017 *
* *
* US Government Users Restricted Rights - Use, duplication or disclosure *
* restricted by GSA ADP Schedule Contract with IBM Corp. *
**************************************************************************/
/*
Replaces some of the html tags before changing the mode to plain text mode.
This is required to maintain carriage return / line breaks in plain text mode
It mainly replaces
,
,
and tags
*/
function replaceHtmlTags(html)
{
var returnValue = "";
if(html != null)
{
html=html.replace(/\ /gi, "\n");
html=html.replace(/\ /gi, "\n");
html=html.replace(/\ /gi, "\n");
html=html.replace(/\<\/p\>/gi, "\n");
html=html.replace(/\<\/p\s\/\>/gi, "\n");
html=html.replace(/\<\/p\/\>/gi, "\n");
html=html.replace(/\ |
/gi, "");
html=html.replace(/\
/gi, "");
html=html.replace(/\
/gi, "");
html=html.replace(/\<\/tr\>/gi, "\n");
html=html.replace(/\<\/tr\s\/\>/gi, "\n");
html=html.replace(/\<\/tr\/\>/gi, "\n");
html=html.replace(/\/gi, " ");
html=html.replace(/\ | /gi, " ");
html=html.replace(/\ | /gi, " ");
html=html.replace(/\ \<\/td\>/gi, " ");
html=html.replace(/\ \s\<\/td\s\/\>/gi, " ");
html=html.replace(/\ \<\/td\/\>/gi, " ");
html=html.replace(/\<\/td\>/gi, " ");
html=html.replace(/\<\/td\s\/\>/gi, " ");
html=html.replace(/\<\/td\/\>/gi, " ");
html=html.replace(/\ /gi, "\n");
html=html.replace(/\ /gi, "\n");
html=html.replace(/\ /gi, "\n");
var tmp = document.createElement("DIV");
tmp.innerHTML = html;
returnValue = tmp.textContent || tmp.innerText || "";
}
return returnValue;
} |