changeset 1521:d3e61cd2aca0

docs and shell bug fix
author Franklin Schmidt <fschmidt@gmail.com>
date Thu, 25 Jun 2020 23:17:14 -0600
parents d9a5405a3102
children bafe6a6797ce
files src/luan/modules/http/tools/Shell.luan website/src/diff.html website/src/docs.html website/src/examples/upload-and-email.html.luan website/src/index.html website/src/manual.html website/src/pil.html website/src/tutorial.html website/src/why.html
diffstat 9 files changed, 85 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/src/luan/modules/http/tools/Shell.luan	Sun Jun 21 18:14:13 2020 -0600
+++ b/src/luan/modules/http/tools/Shell.luan	Thu Jun 25 23:17:14 2020 -0600
@@ -33,11 +33,13 @@
 
 function fns.run(cmd)
 	try
+		local line
 		try
-			return load("return "..cmd,"<web_shell>",env)
+			line = load("return "..cmd,"<web_shell>",env)
 		catch e
-			return load(cmd,"<web_shell>",env)
+			line = load(cmd,"<web_shell>",env)
 		end
+		return line()
 	catch e
 --		Io.print_to(Io.stderr,e)
 		return to_string(e)
--- a/website/src/diff.html	Sun Jun 21 18:14:13 2020 -0600
+++ b/website/src/diff.html	Thu Jun 25 23:17:14 2020 -0600
@@ -2,6 +2,7 @@
 <html>
 <head>
 	<title>How Luan differs from Lua</title>
+	<meta name="viewport" content="width=device-width, initial-scale=1">
 	<style>
 		@import "site.css";
 	</style>
@@ -92,11 +93,11 @@
 
 <p>Luan has no global environment at all, no <code>_G</code>.  By default, Luan doesn't define <code>_ENV</code> either, but if you define it as a local table in a chunk, then it acts like it does in Lua.  When <code>_ENV</code> isn't defined, there are no global variables and an unrecognized variable name produces a compile error.</p>
 
-<p>Every module is initialized with two local functions: <code>require</code> and <code>java</code>.  The module then uses these functions to get access to whatever else it needs.</p>
+<p>Every module is initialized with one local function: <code>require</code>.  The module then uses this function to get access to whatever else it needs.</p>
 
 <h3 heading><a name="error" href="#error">Error Handling</a></h3>
 
-<p>Luan has the functions <code>error</code> but does not have <code>pcall</code> or <code>xpcall</code>.  Luan adds the <a href="#try">try statement</a> instead.  Luan errors are implemented as an error table, not as a message object.</p>
+<p>Luan has the function <code>error</code> but does not have <code>pcall</code> or <code>xpcall</code>.  Luan adds the <a href="#try">try statement</a> instead.  Luan errors are implemented as an error table, not as a message object.</p>
 
 <h3 heading><a name="meta" href="#meta">Metatables and Metamethods</a></h3>
 
@@ -129,7 +130,7 @@
 
 <h3 heading><a name="stmt" href="#stmt">Statements</a></h3>
 
-<p>Luan adds the block terminators <b>end_do</b>, <b>end_for</b>, <b>end_function</b>, <b>end_if</b>, and <b>end_while</b>.  These can be used to end the appropriate block type, but <b>end</b> can also be used to end any block.</p>
+<p>Luan adds the block terminators <b>end_do</b>, <b>end_for</b>, <b>end_function</b>, <b>end_if</b>, <b>end_try</b>, and <b>end_while</b>.  These can be used to end the appropriate block type, but <b>end</b> can also be used to end any block.</p>
 
 <p>Most statements in Luan are the same as Lua.  Only those statements that differ will be listed here.</p>
 
--- a/website/src/docs.html	Sun Jun 21 18:14:13 2020 -0600
+++ b/website/src/docs.html	Thu Jun 25 23:17:14 2020 -0600
@@ -2,6 +2,7 @@
 <html>
 	<head>
 		<title>Luan Documentation</title>
+		<meta name="viewport" content="width=device-width, initial-scale=1">
 		<style>
 			@import "site.css";
 		</style>
--- a/website/src/examples/upload-and-email.html.luan	Sun Jun 21 18:14:13 2020 -0600
+++ b/website/src/examples/upload-and-email.html.luan	Thu Jun 25 23:17:14 2020 -0600
@@ -46,11 +46,11 @@
 	else
 		local file = Http.request.parameters.file
 		send{
-			from = "smtp@luan.ws";
-			to = email;
-			subject = "Upload and Email";
-			body = "file should be attached";
-			attachments = {file};
+			from = "smtp@luan.ws"
+			to = email
+			subject = "Upload and Email"
+			body = "file should be attached"
+			attachments = {file}
 		}
 		sent()
 	end
--- a/website/src/index.html	Sun Jun 21 18:14:13 2020 -0600
+++ b/website/src/index.html	Thu Jun 25 23:17:14 2020 -0600
@@ -2,6 +2,7 @@
 <html>
 	<head>
 		<title>Luan</title>
+		<meta name="viewport" content="width=device-width, initial-scale=1">
 		<style>
 			@import "site.css";
 		</style>
@@ -13,6 +14,7 @@
 
 		<p>Luan is a <a href="http://www.lua.org">Lua</a>-like language implemented in <a href="https://www.oracle.com/java/">Java</a>.</p>
 
+		<div link><a href="why.html">Why Luan?</a></div>
 		<div link><a href="docs.html">Documentation</a></div>
 		<div link><a href="download/">Download</a></div>
 		<div link><a href="https://hg.luan.ws/luan">Source</a></div>
--- a/website/src/manual.html	Sun Jun 21 18:14:13 2020 -0600
+++ b/website/src/manual.html	Thu Jun 25 23:17:14 2020 -0600
@@ -2,6 +2,7 @@
 <html>
 <head>
 	<title>Luan Reference Manual</title>
+	<meta name="viewport" content="width=device-width, initial-scale=1">
 	<style>
 		@import "site.css";
 	</style>
--- a/website/src/pil.html	Sun Jun 21 18:14:13 2020 -0600
+++ b/website/src/pil.html	Thu Jun 25 23:17:14 2020 -0600
@@ -2,6 +2,7 @@
 <html>
 	<head>
 		<title>Programming in Lua</title>
+		<meta name="viewport" content="width=device-width, initial-scale=1">
 		<style>
 			@import "site.css";
 		</style>
--- a/website/src/tutorial.html	Sun Jun 21 18:14:13 2020 -0600
+++ b/website/src/tutorial.html	Thu Jun 25 23:17:14 2020 -0600
@@ -2,6 +2,7 @@
 <html>
 <head>
 	<title>Luan Tutorial</title>
+	<meta name="viewport" content="width=device-width, initial-scale=1">
 	<style>
 		@import "site.css";
 	</style>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/website/src/why.html	Thu Jun 25 23:17:14 2020 -0600
@@ -0,0 +1,66 @@
+<!doctype html>
+<html>
+	<head>
+		<title>Luan Documentation</title>
+		<meta name="viewport" content="width=device-width, initial-scale=1">
+		<style>
+			@import "site.css";
+		</style>
+	</head>
+	<body>
+		<div small>
+			<a href=".">Luan</a>
+		</div>
+
+		<h1>Why Luan?</h1>
+
+		<p>Luan is designed for simplicity and readability.  It rejects the complexity of modern software.  It is mature software that I have been using for years for web programming.  Whether Luan will appeal to you depends on who you are.  So I will address different groups of people.</p>
+
+		<h2>For Modern Scum</h2>
+
+		<p>I define modern scum as members of depraved modern western culture.  They will hate Luan and shouldn't use it.  This is because they are evil people who love complexity and hate simplicity.  They worship their own insane ideas and ideologies while ignoring practical real-world concerns.  This is taken to an extreme in Silicon Valley where the world's worst software is produced.</p>
+
+		<h2>For the Right</h2>
+
+		<p>Those on the Right that think their issue is primarily political are basically modern scum, and Luan isn't for them.  But those on the Right that understand that the core issue is cultural and religious should find Luan appealing.  The West first decayed religiously and then decayed culturally.  This decay made the people evil to the point where they are completely incapable of producing anything good.  But this is recent, happening between 2000 and 2010.  America produced great software in the last century, and Luan is designed in this spirit.  Things like Unix, C, and the internet protocols were all designed for simplicity and power.  Luan has the same kind of design.</p>
+
+		<p>How does this matter practically?  The Right is suffering because the Left dominates technology.  And when the Right does try to produce technology, like a number of social media platforms, the results are poor.  I believe that one reason for this is that the Right is using software tools designed by the Left.  These tools are horrible and overcomplicated.  The Silicon Valley types who produce them are not stupid, they are just extremely evil.  So these tools are only really suited for them.  Decent programmers want simple tools that don't force them to struggle to conform to some insane ideology.  So decent programmers should use software produced in the West before it became fully depraved, meaning before 2000 to be safe.  When more recent software is needed, look for software produced outside of western culture.  For example <a href="https://nginx.org/">nginx</a> is okay because it was produced in Russia.</p>
+
+		<p>I designed Luan in reaction to horrible modern software.  I think Luan should appeal to programmers on the Right who share my traditional western values.  And I think Luan would allow these programmers to more efficiently produce websites to compete with the Left.</p>
+
+		<h2>For Muslims</h2>
+
+		<p>Many Muslims seem to have lost sight of what the Quran teaches.  They focus on specific rituals when in fact the Quran has a broad message.  This broad message is to do good deeds and to generally seek the good and avoid the bad.  The Quran is meant as a general guide for how Muslims should conduct all of their life.  And this includes programming.</p>
+
+		<p>I am not Muslim, I follow the Old Testament.  But all scripture has a similar message.  Programming is a way of expressing ideas, just like any kind of writing.  And where are ideas best expressed?  In scripture.  I use the writing style of the Torah as my guide for how I should program.  Biblical Hebrew is a very simple language, yet the Torah expresses profound ideas in a simple and direct way using this language.  This is exactly what one wants from good programming.  And Luan is designed for this kind of programming.</p>
+
+		<p>Look at modern culture, especially the culture of Silicon Valley.  Can any religious person deny that this culture is the product of Satan?  And so their software is inspired by Satan.  Is this the kind of software that a Muslim or any religious person should use?</p>
+
+		<p>As I use the Torah for inspiration, Muslims should use the Quran.  Consider how ideas are expressed in the Quran and try to apply the same style to your programming.  The Silicon Valley obsession with programming ideologies is really nothing more than idolatry.  Don't allow idolatry into your code.  Scripture is full of general wisdom.  I have <a href="http://software.mikraite.org/The-Old-Testament-on-Programming-tp3.html">applied</a> the wisdom of the Old Testament to programming.  Muslims should try to do the same with the Quran.</p>
+
+		<p>The Muslim world will not improve until Muslims free themselves from dependencies on the degenerate West.  For programmers the place to start is with software tools.  Luan is one step in the right direction.</p>
+
+		<h2>For Japanese</h2>
+
+		<p>Japan is the only remaining culture that I know of that values quality.  The Japanese understand that quality is the result of keeping things clean and simple, and of continuous improvement.  I have applied these things to Luan.  I discussed how Japanese ideas apply to my programming <a href="http://www.mikraite.org/Core-Programming-Principles-tp1237.html">here</a>.  I think you can see all these principles in my code.</p>
+
+		<p>Western software does not follow these idea.  Instead it just continuously gets more complicated and unreliable.  In contrast, Luan has been getting simpler and more reliable over the years as a result of continuous improvement.  You cannot expect to achieve Japanese standards of quality and reliability if you use modern western software.  So use Luan instead.</p>
+
+		<h2>For Chinese</h2>
+
+		<p>The Chinese have mostly practical concerns, so I will address this first.  But then I will show that principles are actually very practical.</p>
+
+		<p>Because Luan is simple and flexible, you can quickly create a website.  And Luan code is easy to change, so maintenance is easy.  Most other systems for web development have a bigger learning curve and are not so flexible.  I will admit that Luan documentation could be better.  I will fix this, but for now I promise fast support to answer your questions.</p>
+
+		<p>The best way to explain why principles are practical is to consider the game of Go (围棋).  To win at Go, you must both be practical and apply principles.  Your initial moves will determine the structure of the game, so are critical.  Consider how this relates to programming.  To just pick any random tools when starting a programming project is like picking random moves at the beginning of a Go game.  In Go, your structure will be horrible and you will lose.  And in programming, you will be stuck with messy code that will be hard to maintain.  So the choices you make at the beginning of a Go game or at the beginning of a programming project are critical.  In both cases, your initial choices should be based on sound principles.</p>
+
+		<p>Another point is that Go begins with an empty board, giving you complete flexibility about how you want to develop your position.  Luan is the same, allowing you to create a clean design from scratch.  This is in contrast to frameworks that impose structure on you which adds complexity and reduces flexibility.</p>
+
+		<p>Many Chinese programmers are willing to struggle to make any tool work.  But this is a mistake because most of the work in programming isn't writing the code, it is maintaining the code.  With messy code, the struggle never ends.  But with clean readable code, maintenance is easy.  Luan is designed to be simple and readable, so code written in Luan should be easier to maintain than code written in another language.</p>
+
+		<h2>For Nabble Users</h2>
+
+		<p><a href="https://www.nabble.com/">Nabble</a> is a forum platform that I developed long ago, before I fully understood the importance of simplicity.  Because users wanted to customize their forums, I developed <a href="http://naml.nabble.com/">NAML</a>.  This started out as a simple macro language that looks like HTML.  But as more and more functionality was needed in NAML, it grew into a monster.  Now I hate my own creation.  The lesson I learned is that front end code needs logic, so it should be implemented with a full programming language.  I actually started working on Luan as a replacement for NAML, but Luan was so successful for me that I ended up using it in many projects.  Because Luan was designed for end-users, it is the simplest programming language that I know of.  I hope that a future replacement for Nabble will use Luan for customization.  In that case, customization will be easy and unlimited.</p>
+
+	</body>
+</html>