Mercurial Hosting > luan
changeset 1652:d5779a264a4a
docs work
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Thu, 31 Mar 2022 19:04:59 -0600 |
parents | 5b8f056527a3 |
children | 418b610e887b |
files | website/src/diff.html.luan website/src/docs.html.luan website/src/lib/Shared.luan website/src/manual.html.luan website/src/pil.html.luan website/src/site.css website/src/tutorial.html.luan |
diffstat | 7 files changed, 17 insertions(+), 15 deletions(-) [+] |
line wrap: on
line diff
--- a/website/src/diff.html.luan Thu Mar 31 16:13:32 2022 -0600 +++ b/website/src/diff.html.luan Thu Mar 31 19:04:59 2022 -0600 @@ -4,7 +4,7 @@ local Http = require "luan:http/Http.luan" local Shared = require "site:/lib/Shared.luan" local head = Shared.head or error() -local header = Shared.header or error() +local docs_header = Shared.docs_header or error() return function() @@ -17,7 +17,7 @@ <title>How Luan differs from Lua</title> </head> <body> -<% header{[[<a href="docs.html">Documentation</a>]]} %> +<% docs_header() %> <div content> <h1><a href="diff.html">How Luan differs from Lua</a></h1>
--- a/website/src/docs.html.luan Thu Mar 31 16:13:32 2022 -0600 +++ b/website/src/docs.html.luan Thu Mar 31 19:04:59 2022 -0600 @@ -4,7 +4,7 @@ local Http = require "luan:http/Http.luan" local Shared = require "site:/lib/Shared.luan" local head = Shared.head or error() -local header = Shared.header or error() +local docs_header = Shared.docs_header or error() return function() @@ -17,7 +17,7 @@ <title>Luan Documentation</title> </head> <body> -<% header{[[<a href="docs.html">Documentation</a>]]} %> +<% docs_header() %> <div content> <h1>Luan Documentation</h1>
--- a/website/src/lib/Shared.luan Thu Mar 31 16:13:32 2022 -0600 +++ b/website/src/lib/Shared.luan Thu Mar 31 19:04:59 2022 -0600 @@ -14,7 +14,7 @@ <% end -function Shared.header(crumbs) +local function header(crumbs) %> <div header> <a href="/">Luan</a> @@ -24,5 +24,10 @@ </div> <% end +Shared.header = header + +function Shared.docs_header() + header{[[<a href="/docs.html">Documentation</a>]]} +end return Shared
--- a/website/src/manual.html.luan Thu Mar 31 16:13:32 2022 -0600 +++ b/website/src/manual.html.luan Thu Mar 31 19:04:59 2022 -0600 @@ -4,7 +4,7 @@ local Http = require "luan:http/Http.luan" local Shared = require "site:/lib/Shared.luan" local head = Shared.head or error() -local header = Shared.header or error() +local docs_header = Shared.docs_header or error() return function() @@ -28,7 +28,7 @@ </style> </head> <body> -<% header{[[<a href="docs.html">Documentation</a>]]} %> +<% docs_header() %> <div content> <h1><a href="manual.html">Luan Reference Manual</a></h1>
--- a/website/src/pil.html.luan Thu Mar 31 16:13:32 2022 -0600 +++ b/website/src/pil.html.luan Thu Mar 31 19:04:59 2022 -0600 @@ -4,7 +4,7 @@ local Http = require "luan:http/Http.luan" local Shared = require "site:/lib/Shared.luan" local head = Shared.head or error() -local header = Shared.header or error() +local docs_header = Shared.docs_header or error() return function() @@ -17,7 +17,7 @@ <title>Programming in Lua</title> </head> <body> -<% header{[[<a href="docs.html">Documentation</a>]]} %> +<% docs_header() %> <div content> <h1>Programming in Lua</h1>
--- a/website/src/site.css Thu Mar 31 16:13:32 2022 -0600 +++ b/website/src/site.css Thu Mar 31 19:04:59 2022 -0600 @@ -13,9 +13,6 @@ a[href]:hover { text-decoration: underline; } -a[href]:visited { - color: #0000BB; -} div[header] { font-size: 14px;
--- a/website/src/tutorial.html.luan Thu Mar 31 16:13:32 2022 -0600 +++ b/website/src/tutorial.html.luan Thu Mar 31 19:04:59 2022 -0600 @@ -4,7 +4,7 @@ local Http = require "luan:http/Http.luan" local Shared = require "site:/lib/Shared.luan" local head = Shared.head or error() -local header = Shared.header or error() +local docs_header = Shared.docs_header or error() return function() @@ -17,7 +17,7 @@ <title>Luan Tutorial</title> </head> <body> -<% header{[[<a href="docs.html">Documentation</a>]]} %> +<% docs_header() %> <div content> <h1>Luan Tutorial</h1> @@ -91,7 +91,7 @@ end </pre> -<p>Now go back to the parent directory and do <b>luan luan:http/serve.luan src</b>. 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.</p> +<p>Now go back to the parent directory and do <b>luan luan:http/serve.luan src</b>. 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> <p>The Luan webserver expects the file to return a function and calls it to generate the page. Code of the form <b>%>...<%</b> writes its output to <b>Io.stdout</b> which by default is the standard output of the command line. So in the returned function one usually starts by setting <b>Io.stdout</b> to a <code>text_writer</code> which writes its output to the HTTP response (to the web browser).</p>