Posts Html functions.
//////////////////////////////////////////////////////////////////////////////
// FILE : pht.tol
// AUTHOR : http://www.asolver.com
// PURPOSE : Posts Html functions.
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
// FUNCTIONS
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
Text PhtName(Set pstObj) // If exists returns else buid one
//////////////////////////////////////////////////////////////////////////////
{
Text ideTxt = If(pstObj->pstNam!="",
pstObj->pstNam,
FormatDate(pstObj->pstDte,"%c%Y%m%d%h%m"));
Htm2Ide("", ideTxt, FALSE) // Convertir el texto en valido para Html
};
//////////////////////////////////////////////////////////////////////////////
Text PhtAName(Set pstObj)
//////////////////////////////////////////////////////////////////////////////
{ "<a name='"+PhtName(pstObj)+"'></a>" };
//////////////////////////////////////////////////////////////////////////////
Text PhtLinkTag(Text tag)
//////////////////////////////////////////////////////////////////////////////
{ "<a href=\"../"+PhtFileName(tag)+"\">" + PhtTitle(tag) + "</a>" };
//////////////////////////////////////////////////////////////////////////////
Text PhtLink(Set pstObj, // Post object
Real extern) // If true external
//////////////////////////////////////////////////////////////////////////////
{
Text pstTit = TxtOutside2Tag(pstObj->pstTit, "<", ">");
If(extern, PhtLinkTag(pstTit),
{
Text pstNam = PhtName(pstObj);
"<a href=\"#" + pstNam + "\">" + pstTit + "</a>"
})
};
//////////////////////////////////////////////////////////////////////////////
Text PhtLinkCatSet(Set set)
//////////////////////////////////////////////////////////////////////////////
{ SetSum(EvalSet(set, Text(Text cat) { "<li>"+PhtLinkTag(cat)+"</li>" })) };
//////////////////////////////////////////////////////////////////////////////
Text PhtLinkPstSet(Set set, // Set of posts
Real ext) // If true external
//////////////////////////////////////////////////////////////////////////////
{ SetSum(EvalSet(set, Text(Set pst) { "<li>"+PhtLink(pst, ext)+"</li>" })) };
//////////////////////////////////////////////////////////////////////////////
Text PhtFileName(Text tag) // File tag
//////////////////////////////////////////////////////////////////////////////
{
Text tagLow = ToLower(tag);
Text tagRep = ReplaceTable(tagLow,
[[
[["reciente", "index"]],
[["á", "a"]], [["é", "e"]], [["í", "i"]], [["ó", "o"]], [["ú", "u"]],
[["ê", "e"]], [["ü", "u"]],
[["ñ", "n"]]
]]);
Set letCic = For(1, TextLength(tagRep), Text(Real pos)
{
Text let = Sub(tagRep, pos, pos);
If(Or(And(let>="0", let<="9"), And(let>="a", let<="z")), let, "")
});
Text tagCls = Set2Txt(letCic, "", "", "", "", "", "", "", "");
Text dirNam = If(tag <: CatAll, "categorias", "articulos");
Text filNam = dirNam + "/" + tagCls + ".html"
};
//////////////////////////////////////////////////////////////////////////////
Text PhtTitle(Text tag) // For menus
//////////////////////////////////////////////////////////////////////////////
{
Case
(
tag=="Contribución", "Contribuciones",
tag=="Titulación", "Titulaciones",
tag=="Curso recibido", "Cursos recibidos",
tag=="Profesional", "Experiencia profesional",
tag=="Empresarial", "Experiencia empresarial",
tag=="Directiva", "Experiencia directiva",
tag=="Inicial", "Experiencia inicial",
tag=="Publicación", "Publicaciones",
tag=="Curso impartido", "Cursos impartidos",
tag=="Ponencia", "Ponencias",
tag=="Registro", "Propiedad intelectual",
tag=="Referencia", "Referencias y citas",
tag=="Web, post y vídeo","Webs, posts y vídeos",
tag=="Código", "Con código fuente",
tag=="Dato de interés", "Datos de interés",
tag=="Interés personal", "Intereses personales",
TRUE, tag
)
};
Antonio.Salmeron construye las páginas y documentos del sitio web antoniosalmeron.con
2015 asolver.com | Aviso legal | XHTML | Δ Θ Ξ | Creative Commons | Mapa y funciones del sitio