comparison website/src/tutorial.html.luan @ 1938:bd00b36380d9 default tip

ai options
author Franklin Schmidt <fschmidt@gmail.com>
date Fri, 16 May 2025 17:20:29 -0600
parents 31f006c64782
children
comparison
equal deleted inserted replaced
1937:d44659709959 1938:bd00b36380d9
1 local Luan = require "luan:Luan.luan" 1 local Luan = require "luan:Luan.luan"
2 local error = Luan.error 2 local error = Luan.error
3 local Io = require "luan:Io.luan" 3 local Io = require "luan:Io.luan"
4 local Site_translator = require "luan:gpt/Site_translator.luan" 4 local Site_translator = require "luan:ai/Site_translator.luan"
5 local get_lang = Site_translator.get_lang or error() 5 local get_lang = Site_translator.get_lang or error()
6 local text_writer = Site_translator.text_writer or error() 6 local text_writer = Site_translator.text_writer or error()
7 local Shared = require "site:/lib/Shared.luan" 7 local Shared = require "site:/lib/Shared.luan"
8 local head = Shared.head or error() 8 local head = Shared.head or error()
9 local header = Shared.docs_header or error() 9 local header = Shared.docs_header or error()
81 local Http = require "luan:http/Http.luan" 81 local Http = require "luan:http/Http.luan"
82 82
83 return function() 83 return function()
84 Io.stdout = Http.response.text_writer() 84 Io.stdout = Http.response.text_writer()
85 %&gt; 85 %&gt;
86 &lt;!doctype html> 86 &lt;!doctype html&gt;
87 &lt;html> 87 &lt;html&gt;
88 &lt;body> 88 &lt;body&gt;
89 Hello World 89 Hello World
90 &lt;/body> 90 &lt;/body&gt;
91 &lt;/html> 91 &lt;/html&gt;
92 &lt;% 92 &lt;%
93 end 93 end
94 </code> 94 </code>
95 95
96 <p>Now go back to the parent directory and do <code>luan luan:http/serve.luan src</code>. This will run the Luan web server on port 8080. Try going to <a href="http://localhost:8080/">http://localhost:8080/</a>. You should see the directory. If you click on <b>hi.html.luan</b> you will see the source. But if you remove the <b>.luan</b> and just go to <a href="http://localhost:8080/hi.html">http://localhost:8080/hi.html</a> then you will run the program which will generate the web page. In fact the page that you are currently looking at <b>tutorial.html</b> is generated from <a href="tutorial.html.luan">tutorial.html.luan</a>.</p> 96 <p>Now go back to the parent directory and do <code>luan luan:http/serve.luan src</code>. This will run the Luan web server on port 8080. Try going to <a href="http://localhost:8080/">http://localhost:8080/</a>. You should see the directory. If you click on <b>hi.html.luan</b> you will see the source. But if you remove the <b>.luan</b> and just go to <a href="http://localhost:8080/hi.html">http://localhost:8080/hi.html</a> then you will run the program which will generate the web page. In fact the page that you are currently looking at <b>tutorial.html</b> is generated from <a href="tutorial.html.luan">tutorial.html.luan</a>.</p>