Lisp2HTML - Write Lisp to write HTML+CSS

Lisp2HTML is a Lisp sublanguage to produce HTML pages.

Introduction

lisp2html is a Lisp sublanguage to produce HTML+CSS pages with a style like this one.

For example, the code to produce this page is as follow (the full source is here):

 (load "lisp2html.lisp")

 (html->file ("lisp2html.html")
   (title "Lisp2HTML -" " Write Lisp to write HTML+CSS")
   (subtitle "Lisp2HTML is a Lisp sublanguage to produce HTML pages.")

   (section "intro" "Introduction"
     (p "lisp2html is a Lisp sublanguage to produce HTML+CSS pages with a
 style like this one.")
     (p "The navigation sidebar is atomatically generated"))

   (section "syntax" "Syntax"
     (p "The defined function in lisp2html are as follow:")
     (itemize (protect-html "First item (&rest) <html>")
              "Second item"
              ...))

   (section "source" "Sources"
     (p "The source code for lisp2html.lisp can be found here:")
     (itemize (group (a "lisp2html.lisp"))))

   (section "Licence" "Licence"
     (p "lisp2html.lisp is under the " (a "http://www.gnu.org"
 	  				 "GNU General Public License")))

   (footer (update-date) (br)
           (a "http://validator.w3.org/check?uri=referer"
             (img "http://www.w3.org/Icons/valid-xhtml10"
                  "Valid XHTML 1.0 Strict"
 		   88 31))
           (a "lisp2html.html"
             (img "lisplogo_flag_64.png"
                   alt="Powered by Lisp")))))

The navigation sidebar is atomatically generated

Syntax

The defined function in lisp2html are as follow:

  • title (&rest title): The main title. (The first argument is in gray).
  • subtitle (&rest title): The part under the title
  • a (href &rest string): Add a new link. The link title is string if string is not nil, href in the other case.
  • p (&rest lines): Begin a new paragraph
  • section (id &rest line): begin a new section
  • br (): Begin a newline.
  • img (image alt &optional width height): Insert an image.
  • itemize (&rest lines): Itemize each lines.
  • code (&rest lines): Insert a code.
  • group (&rest items): Group function together. Useful for example with the itemize function.
  • footer (&rest line): Insert additional information in the footer section.
  • update-date (&optional (lang :us)): Insert the build date.
  • protect-html (string): Replace & with &amp; < with &lt; and so on...

Sources

The source code for lisp2html.lisp can be found here:

To use it, just load it in your favorite Lisp and begin your document with:

 (load "html2lisp.lisp")

 (html2file ("filename.html")
   (title ...)
   ...)

Licence

lisp2html.lisp is under the GNU General Public License