fhp

Descripción del contenido de la página

Herramientas en Forth para crear documentos HTML.

Etiquetas:

fhp es una herramienta que escribí para construir páginas XHTML. Con el tiempo se convirtió en la librería sobre la que escribí otro programa para construir sedes completas en Internet, ForthCMS, que aún no he publicado.

Durante varios años desarrollé y usé fhp con Forth 5mx; algún tiempo después, con unos pequeños cambios, lo hice funcionar en Gforth.

Código fuente

fhp.fs

\ fhp.fs
cr .( fhp  )

\ Copyright (C) 2004,2005,2006,2007,2008,2009,2010,2012 Marcos Cruz (programandala.net)

\ This file is part of
\ fhp ("Forth HTML Preprocessor") version B-00-201206
\ (http://programandala.net/en.program.fhp).
\ This is the main file: it does some general configuration
\ and loads all fhp modules.

\ fhp is free software; you can redistribute it and/or modify
\ it under the terms of the GNU General Public License as published by
\ the Free Software Foundation; either version 2 of the License, or
\ (at your option) any later version.
\
\ fhp is distributed in the hope that it will be useful, but
\ WITHOUT ANY WARRANTY; without even the implied warranty of
\ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
\ General Public License for more details.
\
\ You should have received a copy of the GNU General Public License
\ along with fhp; if not, see <http://gnu.org/licenses>.

\ fhp is written in the Forth language
\ with Gforth (http://gnu.org/software/gforth/).

\ .............................................................
\ History

\ 2015-02-04: Header updated; layout a bit changed.
\
\ 2004-12: This project started.  Every fhp module has a a detailed change
\ history in its source.
\
\ 2008-01-20:  The word LOCAL-SLASH is not a constant any more but a value, to
\ make it easier to configure; now it changes depending on the Forth system.
\
\ 2010-10-07: First support for Simplilo's format output: 'simplilo?' flag.
\
\ 2012-07-31: First support for Fendo's format output: 'fendo?' flag.

\ .............................................................
\ Init

[undefined] from_forth5mx  [IF]  S" from_forth5mx.fs" INCLUDED  [THEN]

\ [undefined] fstr  [IF]  S" fstr.fs" INCLUDED  [THEN]  \ strings toolkit needed
[undefined] ftrac  [IF]
  S" ftrac/ftrac.fs" INCLUDED  \ char translation tool needed
  S" ftrac/ftrac-utf8es.fs" INCLUDED \ translation table for HTML entities
[THEN]

\ [undefined] ftra  [IF]
\  S" ftra/ftra.fs" INCLUDED  \ string translation tool needed when Simplilo's format output is active
\  S" ftra/ftra-simplilo.fs" INCLUDED \ translation table for HTML entities
\ [THEN]
[undefined] fjpg  [IF]  S" fjpg.fs" INCLUDED  [THEN]  \ jpeg tookit needed
[undefined] n>str  [IF]  S" n2str.fs" INCLUDED  [THEN]  \ number to string conversion tool

\ S" ffl/rgx.fs" INCLUDED  \ Regular expressions library of the File Foundation Library (needed when Simplilo's format output is active) deprecated!!!

\ .............................................................
\ Configuration

false VALUE simplilo?  \ flag: Do create Simplilo's WikiCreole pages instead of HTML pages?
\ (implemented in 2010-10 in order to export several websites from fhp+ForthCMS to Simplilo).
false VALUE fendo?  \ flag: Do use the new file names (planned for Simplilo) in order to make it easier to migrate to Fendo (the projected Forth web engine that will substitute fhp+ForthCMS)?
\ (implemented in 2012-07-31).

CHAR \ VALUE local-slash  \ used when joining local paths
gforth? [IF]  CHAR / TO local-slash  [THEN]  \ the word gforth? is defined in the file from_forth5mx.fs

defer trac-default
' trac-utf8es is trac-default

\ .............................................................
\ Load all fhp modules

S" fhp-core.fs" INCLUDED  \ core

S" fhp-paths.fs" INCLUDED  \ local and web paths tools
\ 2007-02-07:
\ The fhp-paths module must be loaded before the fhp-tags module.
\ Otherwise +extension word doesn't work in multilingual mode. I don't understand why.
\ The bug arised after moving the +extension word into the fhp-paths module.
\ It must be caused by the definition order of certain words.
S" fhp-tags.fs" INCLUDED  \ XHTML tags
S" fhp-ml.fs" INCLUDED  \ multilingual core tools
S" fhp-img.fs" INCLUDED  \ image tags
S" fhp-date.fs" INCLUDED  \ date and time tools

\ .............................................................
\ Misc

: fhp-link  ( -- )

  \ Create a promotional fhp link.

  xhtml11
  IF   S" <abbr xml:lang='en' title='Forth HTML Preprocessor'>fhp</abbr>"
  ELSE  S" <abbr xml:lang='en' lang='en' title='Forth HTML Preprocessor'>fhp</abbr>"
  THEN

  \ S" hreflang='es' title='Página de fhp'" S" http://programandala.net/es.programa.fhp"
  \ S" hreflang='eo' title='fhp-retpa&#285;o'" S" http://programandala.net/eo.programo.fhp"
  S" hreflang='en' title='fhp web page'" S" http://programandala.net/en.program.fhp"

  {a/a}

  ;

.(  fhp ok! )

Módulos

Los módulos de fhp están listados en páginas individuales:

Descargas

Páginas relacionadas

Fendo
Generador de hipertexto escrito en Forth.