diff options
| author | Lua Team <team@lua.org> | 2003-04-11 12:00:00 +0000 |
|---|---|---|
| committer | repogen <> | 2003-04-11 12:00:00 +0000 |
| commit | f0e4e22f5c119865eb5a8d3844a40df2d5980b3b (patch) | |
| tree | c4df063a747e9c99f8aba1678588a030993780a9 /test/examples/www | |
| parent | 1981b7c90eb09e956e969cda5c473be4560af573 (diff) | |
| download | lua-github-5.0.tar.gz | |
Lua 5.05.0
Diffstat (limited to 'test/examples/www')
| -rw-r--r-- | test/examples/www/README | 10 | ||||
| -rw-r--r-- | test/examples/www/db.lua | 46 | ||||
| -rw-r--r-- | test/examples/www/staff.lua | 33 | ||||
| -rw-r--r-- | test/examples/www/template.html | 29 |
4 files changed, 0 insertions, 118 deletions
diff --git a/test/examples/www/README b/test/examples/www/README deleted file mode 100644 index b0e1e8bd..00000000 --- a/test/examples/www/README +++ /dev/null @@ -1,10 +0,0 @@ -This directory contains a database for a fake web site. -Standard web page for the persons listed in db.lua are created -automatically from template.html with staff.lua. -(See http://www.cos.ufrj.br for a real web site created in this way.) - -To run, type lua db.lua. - -This example is meant to show the power of gsub and Lua declarative constructs, -which have been combined here into a "mail-merge" application. - diff --git a/test/examples/www/db.lua b/test/examples/www/db.lua deleted file mode 100644 index 53d78024..00000000 --- a/test/examples/www/db.lua +++ /dev/null @@ -1,46 +0,0 @@ -dofile("staff.lua") - -global{ - ROOT='http://www.tecgraf.puc-rio.br', - EMAIL="|LOGIN|@tecgraf.puc-rio.br", - WWW="|ROOT|/~|LOGIN|", - webmast='|ROOT|/webmaster.html', - TECGRAF='<A HREF="http://www.tecgraf.puc-rio.br">TeCGraf</A>', - CS='<A HREF="http://www.inf.puc-rio.br">Computer Science Department</A>', - PUCRIO='<A HREF="http://www.puc-rio.br">PUC-Rio</A>', -} - -staff{ -DI="inf.puc-rio.br", - LOGIN="roberto", - NAME="Roberto Ierusalimschy", - TITLE="D.Sc., |PUCRIO|, 1990", - POSITION="Associate Professor, |CS|, |PUCRIO|", - AREAS="Programming Languages, Object Oriented Programming", - EMAIL="|LOGIN|@|DI|", - WWW="http://www.|DI|/~|LOGIN|", -} - -staff{ -PCG="http://www.graphics.cornell.edu", - LOGIN="celes", - NAME="Waldemar Celes", - TITLE="D.Sc., |PUCRIO|, 1995", - POSITION="Postdoctoral Associate at ".. -'<A HREF="|PCG|">Program of Computer Graphics</A>, '.. -'<A HREF="http://www.cornell.edu">Cornell University</A>', - WWW="|PCG|/~celes/", - AREAS="Image segmentation and 3D reconstruction; " -.."Physical simulation and educational software;" -.."Geometric modeling and topological data structures;" -.."Extension languages and customizable applications" -} - -staff{ - LOGIN="lhf", - NAME="Luiz Henrique de Figueiredo", - TITLE='D.Sc., <A HREF="http://www.impa.br">IMPA</A>, 1992', - POSITION='Associate Researcher at <A HREF="http://www.lncc.br">LNCC</A>; Consultant at |TECGRAF|', - AREAS="Geometric modeling; Software tools", - WWW="http://www2.lncc.br/~lhf/", -} diff --git a/test/examples/www/staff.lua b/test/examples/www/staff.lua deleted file mode 100644 index f36df4ad..00000000 --- a/test/examples/www/staff.lua +++ /dev/null @@ -1,33 +0,0 @@ -readfrom("template.html") -TEMPLATE=read("*a") -readfrom() - -PAT="|(%a%a*)|" - -GLOBAL={ - DATE=date("%d/%m/%Y %T"), -} - -function get(i) - if LOCAL[i] then return LOCAL[i] - elseif GLOBAL[i] then return GLOBAL[i] - else return "<BLINK>?"..i.."?</BLINK>" end -end - -function global(t) - for i,v in t do - GLOBAL[i]=v - end -end - -function staff(t) - LOCAL=t - if t.AREAS then t.AREAS=gsub(t.AREAS,"[;,] *","\n<LI>") end - local p,n=TEMPLATE - if t.WWW=="" then p=gsub(p,'<A HREF="|WWW|">|NAME|</A>',"|NAME|") end - repeat p,n=gsub(p,PAT,get) until n==0 - write(t.LOGIN,"\n") - writeto(t.LOGIN..".html") - write(p) - writeto() -end diff --git a/test/examples/www/template.html b/test/examples/www/template.html deleted file mode 100644 index c8494b76..00000000 --- a/test/examples/www/template.html +++ /dev/null @@ -1,29 +0,0 @@ -<HTML> -<HEAD> -<TITLE> -Imaginary web site:Staff:|LOGIN| -</TITLE> -</HEAD> - -<BODY> -<H1><A HREF="|WWW|">|NAME|</A></H1> -<A HREF="mailto:|EMAIL|">|EMAIL|</A> -<P> - -|POSITION|<BR> -|TITLE|<P> - -<H2>Research areas</H2> -<UL> -<LI>|AREAS| -</UL> -<P> - -<HR> -Last update in |DATE| by -<A HREF="|webmast|">websmaster</A>. -<P> - -</BODY> - -</HTML> |
