Secciones de la página

pdb. tol


Declaraciones


Constantes


Funciones


Time oriented language


Árbol de ficheros

Funciones

Set PdbRead()

Text PdbIndex()

Text PdbTxtKeyword()

Set PdbFrm()

Text PdbGetRand()

Text PdbGetDescription()

Tol

Artículos del sitio

Presentación de Tol

Todos los programas

Simuladores visuales

Sitios que me gustan

Por categorías

Algoritmia

Búsqueda y ordenación

Computación fisiológica

Editorial y edición

Gráficos de datos

Herramientas y utilidades

Hipertexto

Informática forense

Lectura óptica de datos

Metaprogramación

No determinista

Ofimática

Recursión e iteración

Reglas y restricciones

Series y estadística









pdb.tol de Omr.Forms

Funciones para una agenda de posts.

Declaraciones

Constantes

  • Text PdbSep
    Separador de los post en la agenda de contenidos.

Funciones

  • Set PdbRead(Text inpFil)
    Lee y retorna una estructura de posts en el mismo orden de lectura la agenda. Los posts anulados, con su estado a A no son retornados. Si un post no tiene estado se asume el estado C, que es el común.
  • Text PdbIndex(Set setPdb)
    Retorna un indice para un conjunto de posts.
  • Text PdbTxtKeyword(Set setPdb, Real maxWrd)
    Retorna un texto con las maxWrd keywords de un conjunto de posts.
  • Set PdbFrm(Real pdbPos, Real ctrMax, Set frmTab, Real ctrRnd)
    Retorna un conjunto de ctrMax imagenes de formularios y los puede elegir de forma secuencial a partir de pdbPos o de forma aleatoria.
  • Text PdbGetRand(Text inpTxt, Text iniTag)
    Retorna un texto del campo que comienza con fldIni del texto pstTxt de un post, si existen varias altertanivas de texto retorna una al azar. Se retorna compactado.
  • Text PdbGetDescription(Text inpTxt)
    Retorna la descripcion del post que es el parrafo principal.

Constantes

Text PdbSep

//////////////////////////////////////////////////////////////////////////////
Text PdbSep = Repeat("_",78);
//////////////////////////////////////////////////////////////////////////////
PutDescription(
"Separador de los post en la agenda de contenidos.",
PdbSep);
//////////////////////////////////////////////////////////////////////////////

Funciones

Set PdbRead()

//////////////////////////////////////////////////////////////////////////////
Set PdbRead(Text inpFil)
//////////////////////////////////////////////////////////////////////////////
{
  Text WriteLn("Reading "+inpFil+"...");
  Text inpTxt = Replace(ReadFile(inpFil), PdbSep+"\n", Char(7));
  Set  inpSet = Tokenizer(inpTxt, Char(7));
  Text fldEnd = "\n<Pst.";
  Set  inpTab = EvalSet(inpSet, Set(Text inpPst)
  {
    Text iniSta = TxtBetween2Tag(inpPst,"<Pst.Sta>", fldEnd, TRUE);
    Text pstSta = Sub(iniSta+"C",1,1); // C por defecto

    Text filNam = TxtBetween2Tag(inpPst,"<Pst.Fil>", fldEnd, TRUE);

//  Antes se sorteaba en lectura un titulo que se usaba en todas las páginas.
//  Ahora se sortea en escritura por lo que la aleatoriedad es aun mayor.
//  Text titLar = PdbGetRand    (inpPst,"<Pst.Tit>");
    Text titLar = TxtBetween2Tag(inpPst,"<Pst.Tit>", fldEnd, TRUE);

//  Text iniSor = PdbGetRand(    inpPst,"<Pst.Lbl>");
    Text iniSor = TxtBetween2Tag(inpPst,"<Pst.Lbl>", fldEnd, TRUE);
    Text titSor = If(iniSor!="", iniSor, titLar); // Si no hay -> el largo

//  Text titSub = PdbGetRand    (inpPst,"<Pst.Sub>");
    Text titSub = TxtBetween2Tag(inpPst,"<Pst.Sub>", fldEnd, TRUE);

    Text pstHtm = TxtBetween2Tag(inpPst,"<Pst.Htm>", fldEnd, FALSE);

    Text pstDes = PdbGetDescription(pstHtm);

    PdbSt(pstSta, filNam, titLar, titSor, titSub, pstHtm, pstDes)
  });
  
  Set  inpSel = Select(inpTab, Real(Set pstObj)
                       { pstObj->pstSta != "A" }); // No Anulados
  Set  selSet = Select(inpSel, Real(Set pstObj)
                       { pstObj->filNam != "" });  // Con nombre de fichero

  Set  selCla = Classify(selSet, Real(Set a, Set b) // Check ficheros dobles
                { Compare(a->filNam, b->filNam) });
  Set  selDup = Select(selCla, Real(Set claSet) { GT(Card(claSet),1) });
  Set  wriDup = EvalSet(selDup, Real(Set claSet)
                { Text WriteLn("Repeated: "+claSet[1]->filNam); TRUE });

  Text WriteLn("Readed Ok  "+F(Card(selSet))+" registers");
  Text WriteLn("Status ABC "+F(Card(inpTab))+" registers");
  Text WriteLn("Status _BC "+F(Card(inpSel))+" registers");

  selSet
};
//////////////////////////////////////////////////////////////////////////////
PutDescription(
"Lee y retorna una estructura de posts en el mismo orden de lectura la agenda.
Los posts anulados, con su estado a A no son retornados.
Si un post no tiene estado se asume el estado C, que es el común.",
PdbRead);
//////////////////////////////////////////////////////////////////////////////

Text PdbIndex()

//////////////////////////////////////////////////////////////////////////////
Text PdbIndex(Set setPdb) // Set of post
//////////////////////////////////////////////////////////////////////////////
{
  Set indCic = EvalSet(setPdb, Text(Set pdbObj) // Index
  {
    "    <li><a href='" +   pdbObj->filNam  + ".html'>" +
                          R(pdbObj->titLar) + "</a>" +
             ": "+ R(pdbObj->titSub) + ".</li>\n"
  });
  "\n  <ul>\n" + SetSum(indCic) + "  </ul>\n"
};
//////////////////////////////////////////////////////////////////////////////
PutDescription(
"Retorna un indice para un conjunto de posts.",
PdbIndex);
//////////////////////////////////////////////////////////////////////////////

Text PdbTxtKeyword()

//////////////////////////////////////////////////////////////////////////////
Text PdbTxtKeyword(Set  setPdb, // Set of post
                   Real maxWrd) // Average of word for a random number 
//////////////////////////////////////////////////////////////////////////////
{
  Text setKey = KeyWord(
                  EvalSet(setPdb, Text(Set pst)
                  {
                    pst->titLar+" "+
                    pst->titSub+" "+
                    pst->titSor+" "+
                    TxtOutHtmTag(pst->pstHtm)
                  }),
                  5, FALSE, Round(Rand(maxWrd-5, maxWrd+5)));

  ReplaceTable(setKey,
   [[ [["antonio",  ""]],
      [["salmerón", ""]],
      [["cabañas",  ""]],
      [[", ,",     ","]] ]])
};
//////////////////////////////////////////////////////////////////////////////
PutDescription(
"Retorna un texto con las maxWrd keywords de un conjunto de posts.",
PdbTxtKeyword);
//////////////////////////////////////////////////////////////////////////////

Set PdbFrm()

//////////////////////////////////////////////////////////////////////////////
Set PdbFrm(Real pdbPos, // Post position
           Real ctrMax, // Maximum of images
           Set  frmTab, // Forms tab
           Real ctrRnd) // If true ramdom, else secuential
//////////////////////////////////////////////////////////////////////////////
{
  Real frmCrd = Card(frmTab);

  Real frmIni = If(ctrRnd,
    Min(frmCrd, Max(1, Round(Rand(0,frmCrd)+0.5))), // Aleatorio
    (1+(pdbPos-1)*CtrMax) % Card(frmTab));          // Secuencial

  SetSubCicle(frmTab, frmIni, CtrMax)
};
//////////////////////////////////////////////////////////////////////////////
PutDescription(
"Retorna un conjunto de ctrMax imagenes de formularios y los puede elegir de
forma secuencial a partir de pdbPos o de forma aleatoria.",
PdbFrm);
//////////////////////////////////////////////////////////////////////////////

Text PdbGetRand()

//////////////////////////////////////////////////////////////////////////////
Text PdbGetRand(Text inpTxt, // Texto de un post
                Text iniTag) // Inicio del nombre del campo
//////////////////////////////////////////////////////////////////////////////
{
  Text subTxt = TxtBetween2Tag(inpTxt, iniTag, "\n<Pst.", TRUE);
  If(subTxt=="", "", R(subTxt))
};
//////////////////////////////////////////////////////////////////////////////
PutDescription(
"Retorna un texto del campo que comienza con fldIni del texto pstTxt de un
post, si existen varias altertanivas de texto retorna una al azar.
Se retorna compactado.",
PdbGetRand);
//////////////////////////////////////////////////////////////////////////////

Text PdbGetDescription()

//////////////////////////////////////////////////////////////////////////////
Text PdbGetDescription(Text inpTxt) // Texto de un post
//////////////////////////////////////////////////////////////////////////////
{
  Text iniTag = "<p class="+Q("PutDes")+">";
  Text subTxt = TxtBetween2Tag(inpTxt, iniTag, "</p>", TRUE);
  Text clsTxt = TxtOutHtmTag(subTxt);
  Compact(clsTxt)
};
//////////////////////////////////////////////////////////////////////////////
PutDescription(
"Retorna la descripcion del post que es el parrafo principal.",
PdbGetDescription);
//////////////////////////////////////////////////////////////////////////////

Time oriented language

//////////////////////////////////////////////////////////////////////////////
// FILE    : pdb.tol
// AUTHOR  : http://www.asolver.com
// PURPOSE : Funciones para una agenda de posts.
//////////////////////////////////////////////////////////////////////////////


//////////////////////////////////////////////////////////////////////////////
// CONSTANTS
//////////////////////////////////////////////////////////////////////////////

//////////////////////////////////////////////////////////////////////////////
Text PdbSep = Repeat("_",78);
//////////////////////////////////////////////////////////////////////////////
PutDescription(
"Separador de los post en la agenda de contenidos.",
PdbSep);
//////////////////////////////////////////////////////////////////////////////


//////////////////////////////////////////////////////////////////////////////
// FUNCTIONS
//////////////////////////////////////////////////////////////////////////////

//////////////////////////////////////////////////////////////////////////////
Set PdbRead(Text inpFil)
//////////////////////////////////////////////////////////////////////////////
{
  Text WriteLn("Reading "+inpFil+"...");
  Text inpTxt = Replace(ReadFile(inpFil), PdbSep+"\n", Char(7));
  Set  inpSet = Tokenizer(inpTxt, Char(7));
  Text fldEnd = "\n<Pst.";
  Set  inpTab = EvalSet(inpSet, Set(Text inpPst)
  {
    Text iniSta = TxtBetween2Tag(inpPst,"<Pst.Sta>", fldEnd, TRUE);
    Text pstSta = Sub(iniSta+"C",1,1); // C por defecto

    Text filNam = TxtBetween2Tag(inpPst,"<Pst.Fil>", fldEnd, TRUE);

//  Antes se sorteaba en lectura un titulo que se usaba en todas las páginas.
//  Ahora se sortea en escritura por lo que la aleatoriedad es aun mayor.
//  Text titLar = PdbGetRand    (inpPst,"<Pst.Tit>");
    Text titLar = TxtBetween2Tag(inpPst,"<Pst.Tit>", fldEnd, TRUE);

//  Text iniSor = PdbGetRand(    inpPst,"<Pst.Lbl>");
    Text iniSor = TxtBetween2Tag(inpPst,"<Pst.Lbl>", fldEnd, TRUE);
    Text titSor = If(iniSor!="", iniSor, titLar); // Si no hay -> el largo

//  Text titSub = PdbGetRand    (inpPst,"<Pst.Sub>");
    Text titSub = TxtBetween2Tag(inpPst,"<Pst.Sub>", fldEnd, TRUE);

    Text pstHtm = TxtBetween2Tag(inpPst,"<Pst.Htm>", fldEnd, FALSE);

    Text pstDes = PdbGetDescription(pstHtm);

    PdbSt(pstSta, filNam, titLar, titSor, titSub, pstHtm, pstDes)
  });
  
  Set  inpSel = Select(inpTab, Real(Set pstObj)
                       { pstObj->pstSta != "A" }); // No Anulados
  Set  selSet = Select(inpSel, Real(Set pstObj)
                       { pstObj->filNam != "" });  // Con nombre de fichero

  Set  selCla = Classify(selSet, Real(Set a, Set b) // Check ficheros dobles
                { Compare(a->filNam, b->filNam) });
  Set  selDup = Select(selCla, Real(Set claSet) { GT(Card(claSet),1) });
  Set  wriDup = EvalSet(selDup, Real(Set claSet)
                { Text WriteLn("Repeated: "+claSet[1]->filNam); TRUE });

  Text WriteLn("Readed Ok  "+F(Card(selSet))+" registers");
  Text WriteLn("Status ABC "+F(Card(inpTab))+" registers");
  Text WriteLn("Status _BC "+F(Card(inpSel))+" registers");

  selSet
};
//////////////////////////////////////////////////////////////////////////////
PutDescription(
"Lee y retorna una estructura de posts en el mismo orden de lectura la agenda.
Los posts anulados, con su estado a A no son retornados.
Si un post no tiene estado se asume el estado C, que es el común.",
PdbRead);
//////////////////////////////////////////////////////////////////////////////


//////////////////////////////////////////////////////////////////////////////
Text PdbIndex(Set setPdb) // Set of post
//////////////////////////////////////////////////////////////////////////////
{
  Set indCic = EvalSet(setPdb, Text(Set pdbObj) // Index
  {
    "    <li><a href='" +   pdbObj->filNam  + ".html'>" +
                          R(pdbObj->titLar) + "</a>" +
             ": "+ R(pdbObj->titSub) + ".</li>\n"
  });
  "\n  <ul>\n" + SetSum(indCic) + "  </ul>\n"
};
//////////////////////////////////////////////////////////////////////////////
PutDescription(
"Retorna un indice para un conjunto de posts.",
PdbIndex);
//////////////////////////////////////////////////////////////////////////////


//////////////////////////////////////////////////////////////////////////////
Text PdbTxtKeyword(Set  setPdb, // Set of post
                   Real maxWrd) // Average of word for a random number 
//////////////////////////////////////////////////////////////////////////////
{
  Text setKey = KeyWord(
                  EvalSet(setPdb, Text(Set pst)
                  {
                    pst->titLar+" "+
                    pst->titSub+" "+
                    pst->titSor+" "+
                    TxtOutHtmTag(pst->pstHtm)
                  }),
                  5, FALSE, Round(Rand(maxWrd-5, maxWrd+5)));

  ReplaceTable(setKey,
   [[ [["antonio",  ""]],
      [["salmerón", ""]],
      [["cabañas",  ""]],
      [[", ,",     ","]] ]])
};
//////////////////////////////////////////////////////////////////////////////
PutDescription(
"Retorna un texto con las maxWrd keywords de un conjunto de posts.",
PdbTxtKeyword);
//////////////////////////////////////////////////////////////////////////////


//////////////////////////////////////////////////////////////////////////////
Set PdbFrm(Real pdbPos, // Post position
           Real ctrMax, // Maximum of images
           Set  frmTab, // Forms tab
           Real ctrRnd) // If true ramdom, else secuential
//////////////////////////////////////////////////////////////////////////////
{
  Real frmCrd = Card(frmTab);

  Real frmIni = If(ctrRnd,
    Min(frmCrd, Max(1, Round(Rand(0,frmCrd)+0.5))), // Aleatorio
    (1+(pdbPos-1)*CtrMax) % Card(frmTab));          // Secuencial

  SetSubCicle(frmTab, frmIni, CtrMax)
};
//////////////////////////////////////////////////////////////////////////////
PutDescription(
"Retorna un conjunto de ctrMax imagenes de formularios y los puede elegir de
forma secuencial a partir de pdbPos o de forma aleatoria.",
PdbFrm);
//////////////////////////////////////////////////////////////////////////////


//////////////////////////////////////////////////////////////////////////////
Text PdbGetRand(Text inpTxt, // Texto de un post
                Text iniTag) // Inicio del nombre del campo
//////////////////////////////////////////////////////////////////////////////
{
  Text subTxt = TxtBetween2Tag(inpTxt, iniTag, "\n<Pst.", TRUE);
  If(subTxt=="", "", R(subTxt))
};
//////////////////////////////////////////////////////////////////////////////
PutDescription(
"Retorna un texto del campo que comienza con fldIni del texto pstTxt de un
post, si existen varias altertanivas de texto retorna una al azar.
Se retorna compactado.",
PdbGetRand);
//////////////////////////////////////////////////////////////////////////////


//////////////////////////////////////////////////////////////////////////////
Text PdbGetDescription(Text inpTxt) // Texto de un post
//////////////////////////////////////////////////////////////////////////////
{
  Text iniTag = "<p class="+Q("PutDes")+">";
  Text subTxt = TxtBetween2Tag(inpTxt, iniTag, "</p>", TRUE);
  Text clsTxt = TxtOutHtmTag(subTxt);
  Compact(clsTxt)
};
//////////////////////////////////////////////////////////////////////////////
PutDescription(
"Retorna la descripcion del post que es el parrafo principal.",
PdbGetDescription);
//////////////////////////////////////////////////////////////////////////////

Árbol de ficheros

Omr.Forms construye las páginas web Html del sitio web omrforms.es

  • make.tol proceso principal de generación del sitio web omrforms.es
  • tol directorios de código Tol
    • cmm funciones comunes
    • app funciones específicas de la aplicación
      • pdb.tol de manejo de los posts de una agenda
      • key.tol generación de palabras clave para páginas
    • inc.tol para la inclusión de ficheros Tol
  • agenda directorio destinado a la única agenda de post
    • agendadb.age ejemplo de un conjunto de posts de contenido para publicar
  • web directorio destinado a las páginas web generadas
    • css directorio para ficheros de estilo Cascade Style Sheet
      • common.css fichero de estilo para las páginas Html
    • seed.htm semilla de página Html con Tol embebido para generar otras
    • sitemap.xml mapa del sitio web generado automáticamente en Xml
    • preciospresupuestoslecturaoptica.html ejemplo del código Html de una de las páginas web generadas
  • ejemplos.html ejemplos visuales de 3 páginas Html generadas automáticamente
  • omr_forms.pdf documento resumen de funciones del programa constructor de web

2015 asolver.com | Aviso legal | XHTML | Δ Θ Ξ | Creative Commons | Mapa y funciones del sitio

Tol