Posts Html functions.
Funciones
Text PhtExpText(Text txtHtm, Real ctrHtm)Text PhtCleanFilePath(Text dirNam, Text filNam, Text filExt)Text PhtLinkClass(Text claNam)Text PhtLinkPost(Set pstObj)Text PhtLinkClassSet(Set setCla)Text PhtLinkPostSet(Set setPst)Text PhtQuote(Text resTxt, Real opeQuo, Real common)Text PhtCleanHtml(Text htmCod)Text PhtSpanishDate(Set objPst)//////////////////////////////////////////////////////////////////////////////
Text PhtExpText(Text txtHtm, // Expande este texto
Real ctrHtm) // Si true con html si false sin html
//////////////////////////////////////////////////////////////////////////////
{
Text outHtm = ReplaceTable(txtHtm,
[[
[["_avp_", "<a href=" + Q("http://www.avppm.es") + ">AVPPM</a>"]],
[["_cnQ_", "<a href=" + Q("http://www.con-q.es") + ">con-Q</a>"]],
[["_Qre_", "<a href=" + Q("http://www.qred.es") + ">Qred</a>"]],
[["_new_", "<a href=" + Q("../newsletter.html") + ">Newsletter</a>"]]
]], 1); // Solo 1 ciclo
If(ctrHtm, outHtm, TxtOutHtmScr(outHtm))
};
//////////////////////////////////////////////////////////////////////////////
PutDescription(
"Expande pequeños textos muy habituales dentro de los posts.",
PhtExpText);
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
Text PhtCleanFilePath(Text dirNam, // Directorio
Text filNam, // Nombre del fichero sin extension
Text filExt) // Extension sin punto
//////////////////////////////////////////////////////////////////////////////
{
Text filLow = ToLower(filNam);
Text filRep = ReplaceTable(filLow,
[[
[["á", "a"]], [["é", "e"]], [["í", "i"]], [["ó", "o"]], [["ú", "u"]],
[["ñ", "n"]]
]]);
Set letCic = TxtForChr(filRep, Text(Text let)
{ If(Or(And(let>="0", let<="9"), And(let>="a", let<="z")), let, "_") });
dirNam + "/" + SetSum(letCic) + "." + filExt
};
//////////////////////////////////////////////////////////////////////////////
PutDescription(
"Retorna limpia la ruta de un fichero eliminado los acentos y cambiando por
_ todos los caracteres que no son basicos.",
PhtCleanFilePath);
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
Text PhtLinkClass(Text claNam)
//////////////////////////////////////////////////////////////////////////////
{
Text claPth = PhtCleanFilePath("../quiosco", claNam, "html");
"<a href=" + Q(claPth) + ">" + claNam + "</a>"
};
//////////////////////////////////////////////////////////////////////////////
PutDescription(
"Retorna el link de enlace a una pagina de clases.",
PhtLinkClass);
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
Text PhtLinkPost(Set pstObj)
//////////////////////////////////////////////////////////////////////////////
{ "<a href=" + Q("../"+pstObj->pstFil) + ">" + pstObj->pstTit + "</a>" };
//////////////////////////////////////////////////////////////////////////////
PutDescription(
"Retorna el link de enlace a un post.",
PhtLinkPost);
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
Text PhtLinkClassSet(Set setCla) // Set of classes
//////////////////////////////////////////////////////////////////////////////
{
SetSum(EvalSet(setCla, Text(Text claNam)
{ "<li>" + PhtLinkClass(claNam) + ".</li>" }))
};
//////////////////////////////////////////////////////////////////////////////
PutDescription(
"Retorna una lista de link de enlaces a un conjunto de clases,
a modo de indice.",
PhtLinkClassSet);
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
Text PhtLinkPostSet(Set setPst) // Set of posts
//////////////////////////////////////////////////////////////////////////////
{
SetSum(EvalSet(setPst, Text(Set pstObj)
{ "<li>" + PhtLinkPost(pstObj) + ".</li>" }))
};
//////////////////////////////////////////////////////////////////////////////
PutDescription(
"Retorna una lista de link de enlaces a un conjunto de post,
a modo de indice.",
PhtLinkPostSet);
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
Text PhtQuote(Text resTxt, // Resume text
Real opeQuo, // Open quote, ese close
Real common) // Normal color
//////////////////////////////////////////////////////////////////////////////
{
Text filQuo = Case
(
And( opeQuo, common), "quoteopenred.png",
And( opeQuo, !common), "quoteopenwhite.png",
And(!opeQuo, common), "quoteclosered.png",
And(!opeQuo, !common), "quoteclosewhite.png",
TRUE, "quoteopenred.png"
);
Text htmQuo = "<p><img src=" + Q("../css/"+filQuo) +
" alt=" + Q("Resumen de la noticia") + " />";
TxtReplaceFirst(resTxt, "<p>", htmQuo)
};
//////////////////////////////////////////////////////////////////////////////
PutDescription(
"Retorna el codigo html con las imagenes de las comillas de apertura y
cierre y el resumen del post.",
PhtQuote);
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
Text PhtCleanHtml(Text htmCod) // Limpia para email, deja interior iframe
//////////////////////////////////////////////////////////////////////////////
{
Text notDoc = TxtOutside2Tag(htmCod, "<!DOCTYPE", ">");
Text notXml = "<html>" +
TxtOutside2Tag(notDoc, "<html", ">");
Text notBck = TxtOutside2Tag(notXml, "background-image:", ";");
Text notEFr = Replace( notBck, "</iframe>", "");
Text notIFr = TxtOutside2Tag(notEFr, "<iframe", ">");
Text notIco = TxtOutside2Tag(notIFr, "<link rel=", ">");
Text notScr = TxtOutside2Tag(notIco, "<script", "</script>");
Text notFrm = TxtOutside2Tag(notScr, "<form", "</form>");
Text notAds = TxtOutside2Tag(notFrm, AdsCla, "</div>");
notAds
};
//////////////////////////////////////////////////////////////////////////////
PutDescription(
"Retorna un codigo limpio de referencias externas a internet,
con el objetivo que al enviarse el codigo html por correo electronico
el gestor de email no diga que para proteger la privacidad se han bloqueado
elementos externos.
Tambien elimina los iframes de videos que no se visualizan por email,
al hacerlo deja las imagenes insertadas entre el <iframe y el </iframe> que
muestran la portada del video.
Tambien elimina los anuncios publicitarios.",
PhtCleanHtml);
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
Text PhtSpanishDate(Set objPst) // Posts
//////////////////////////////////////////////////////////////////////////////
{
Text dteTxt = TxtBetween2Tag(objPst->pstFil,"noticia/","_", TRUE);
Sub(dteTxt,7,8)+"/"+Sub(dteTxt,5,6)+"/"+Sub(dteTxt,1,4)
};
//////////////////////////////////////////////////////////////////////////////
PutDescription(
"Retorna una fecha en formato español, aaaa/mm/dd, al que estan acostumbrados
los lectores de la newsletter.",
PhtSpanishDate);
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
// FILE : pht.tol
// AUTHOR : http://www.asolver.com
// PURPOSE : Posts Html functions.
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
// FUNCTIONS
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
Text PhtExpText(Text txtHtm, // Expande este texto
Real ctrHtm) // Si true con html si false sin html
//////////////////////////////////////////////////////////////////////////////
{
Text outHtm = ReplaceTable(txtHtm,
[[
[["_avp_", "<a href=" + Q("http://www.avppm.es") + ">AVPPM</a>"]],
[["_cnQ_", "<a href=" + Q("http://www.con-q.es") + ">con-Q</a>"]],
[["_Qre_", "<a href=" + Q("http://www.qred.es") + ">Qred</a>"]],
[["_new_", "<a href=" + Q("../newsletter.html") + ">Newsletter</a>"]]
]], 1); // Solo 1 ciclo
If(ctrHtm, outHtm, TxtOutHtmScr(outHtm))
};
//////////////////////////////////////////////////////////////////////////////
PutDescription(
"Expande pequeños textos muy habituales dentro de los posts.",
PhtExpText);
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
Text PhtCleanFilePath(Text dirNam, // Directorio
Text filNam, // Nombre del fichero sin extension
Text filExt) // Extension sin punto
//////////////////////////////////////////////////////////////////////////////
{
Text filLow = ToLower(filNam);
Text filRep = ReplaceTable(filLow,
[[
[["á", "a"]], [["é", "e"]], [["í", "i"]], [["ó", "o"]], [["ú", "u"]],
[["ñ", "n"]]
]]);
Set letCic = TxtForChr(filRep, Text(Text let)
{ If(Or(And(let>="0", let<="9"), And(let>="a", let<="z")), let, "_") });
dirNam + "/" + SetSum(letCic) + "." + filExt
};
//////////////////////////////////////////////////////////////////////////////
PutDescription(
"Retorna limpia la ruta de un fichero eliminado los acentos y cambiando por
_ todos los caracteres que no son basicos.",
PhtCleanFilePath);
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
Text PhtLinkClass(Text claNam)
//////////////////////////////////////////////////////////////////////////////
{
Text claPth = PhtCleanFilePath("../quiosco", claNam, "html");
"<a href=" + Q(claPth) + ">" + claNam + "</a>"
};
//////////////////////////////////////////////////////////////////////////////
PutDescription(
"Retorna el link de enlace a una pagina de clases.",
PhtLinkClass);
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
Text PhtLinkPost(Set pstObj)
//////////////////////////////////////////////////////////////////////////////
{ "<a href=" + Q("../"+pstObj->pstFil) + ">" + pstObj->pstTit + "</a>" };
//////////////////////////////////////////////////////////////////////////////
PutDescription(
"Retorna el link de enlace a un post.",
PhtLinkPost);
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
Text PhtLinkClassSet(Set setCla) // Set of classes
//////////////////////////////////////////////////////////////////////////////
{
SetSum(EvalSet(setCla, Text(Text claNam)
{ "<li>" + PhtLinkClass(claNam) + ".</li>" }))
};
//////////////////////////////////////////////////////////////////////////////
PutDescription(
"Retorna una lista de link de enlaces a un conjunto de clases,
a modo de indice.",
PhtLinkClassSet);
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
Text PhtLinkPostSet(Set setPst) // Set of posts
//////////////////////////////////////////////////////////////////////////////
{
SetSum(EvalSet(setPst, Text(Set pstObj)
{ "<li>" + PhtLinkPost(pstObj) + ".</li>" }))
};
//////////////////////////////////////////////////////////////////////////////
PutDescription(
"Retorna una lista de link de enlaces a un conjunto de post,
a modo de indice.",
PhtLinkPostSet);
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
Text PhtQuote(Text resTxt, // Resume text
Real opeQuo, // Open quote, ese close
Real common) // Normal color
//////////////////////////////////////////////////////////////////////////////
{
Text filQuo = Case
(
And( opeQuo, common), "quoteopenred.png",
And( opeQuo, !common), "quoteopenwhite.png",
And(!opeQuo, common), "quoteclosered.png",
And(!opeQuo, !common), "quoteclosewhite.png",
TRUE, "quoteopenred.png"
);
Text htmQuo = "<p><img src=" + Q("../css/"+filQuo) +
" alt=" + Q("Resumen de la noticia") + " />";
TxtReplaceFirst(resTxt, "<p>", htmQuo)
};
//////////////////////////////////////////////////////////////////////////////
PutDescription(
"Retorna el codigo html con las imagenes de las comillas de apertura y
cierre y el resumen del post.",
PhtQuote);
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
Text PhtCleanHtml(Text htmCod) // Limpia para email, deja interior iframe
//////////////////////////////////////////////////////////////////////////////
{
Text notDoc = TxtOutside2Tag(htmCod, "<!DOCTYPE", ">");
Text notXml = "<html>" +
TxtOutside2Tag(notDoc, "<html", ">");
Text notBck = TxtOutside2Tag(notXml, "background-image:", ";");
Text notEFr = Replace( notBck, "</iframe>", "");
Text notIFr = TxtOutside2Tag(notEFr, "<iframe", ">");
Text notIco = TxtOutside2Tag(notIFr, "<link rel=", ">");
Text notScr = TxtOutside2Tag(notIco, "<script", "</script>");
Text notFrm = TxtOutside2Tag(notScr, "<form", "</form>");
Text notAds = TxtOutside2Tag(notFrm, AdsCla, "</div>");
notAds
};
//////////////////////////////////////////////////////////////////////////////
PutDescription(
"Retorna un codigo limpio de referencias externas a internet,
con el objetivo que al enviarse el codigo html por correo electronico
el gestor de email no diga que para proteger la privacidad se han bloqueado
elementos externos.
Tambien elimina los iframes de videos que no se visualizan por email,
al hacerlo deja las imagenes insertadas entre el <iframe y el </iframe> que
muestran la portada del video.
Tambien elimina los anuncios publicitarios.",
PhtCleanHtml);
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
Text PhtSpanishDate(Set objPst) // Posts
//////////////////////////////////////////////////////////////////////////////
{
Text dteTxt = TxtBetween2Tag(objPst->pstFil,"noticia/","_", TRUE);
Sub(dteTxt,7,8)+"/"+Sub(dteTxt,5,6)+"/"+Sub(dteTxt,1,4)
};
//////////////////////////////////////////////////////////////////////////////
PutDescription(
"Retorna una fecha en formato español, aaaa/mm/dd, al que estan acostumbrados
los lectores de la newsletter.",
PhtSpanishDate);
//////////////////////////////////////////////////////////////////////////////
con-Q.tv construye las páginas del sitio y newsletter Con-Q.tv
2015 asolver.com | Aviso legal | XHTML | Δ Θ Ξ | Creative Commons | Mapa y funciones del sitio