diff website/src/manual.html.luan @ 479:1285c52ea9d4

add manual heading_options
author Franklin Schmidt <fschmidt@gmail.com>
date Mon, 11 May 2015 15:29:29 -0600
parents eb6d90fb0b5c
children 7e9fcfbf22ec
line wrap: on
line diff
--- a/website/src/manual.html.luan	Mon May 11 15:06:46 2015 -0600
+++ b/website/src/manual.html.luan	Mon May 11 15:29:29 2015 -0600
@@ -4,6 +4,7 @@
 local Http = require "luan:web/Http"
 local Shared = require "site:/Shared"
 
+heading_options = [[margin-top="1em"]]
 
 function service()
 	Io.stdout = Http.response.text_writer()
@@ -96,7 +97,7 @@
 <hr/>
 
 
-<h2 margin-top="1em"><a name="intro">Introduction</a></h2>
+<h2 <%=heading_options%> ><a name="intro">Introduction</a></h2>
 
 <p>Luan is a high level programming language based on <a href="http://www.lua.org">Lua</a>.  A great strength of Lua is its simplicity and Luan takes this even further, being even simpler than Lua.  The goal is to provide a simple programming language for the casual programmer with as few concepts as possible so that one can quickly learn the language and then easily understand any code written in Luan.</p>
 
@@ -105,11 +106,11 @@
 <p>Unlike Lua which is meant to be embedded, Luan is meant to be a full scripting language.  This done not by adding feature to Luan, but rather by providing a complete set of libraries.</p>
 
 
-<h2 margin-top="1em"><a name="basic">Basic Concepts</a></h2>
+<h2 <%=heading_options%> ><a name="basic">Basic Concepts</a></h2>
 
 <p>This section describes the basic concepts of the language.</p>
 
-<h3 margin-top="1em"><a name="types">Values and Types</a></h3>
+<h3 <%=heading_options%> ><a name="types">Values and Types</a></h3>
 
 <p>
 Luan is a <i>dynamically typed language</i>.
@@ -228,7 +229,7 @@
 
 
 
-<h3 margin-top="1em"><a name="env">Environments</a></h3>
+<h3 <%=heading_options%> ><a name="env">Environments</a></h3>
 
 <p>
 As will be discussed in <a href="#vars">Variables</a> and <a href=#assignment">Assignment</a>,
@@ -265,7 +266,7 @@
 
 
 
-<h3 margin-top="1em"><a name="error">Error Handling</a></h3>
+<h3 <%=heading_options%> ><a name="error">Error Handling</a></h3>
 
 <p>
 Luan code can explicitly generate an error by calling the
@@ -288,7 +289,7 @@
 
 
 
-<h3 margin-top="1em"><a name="meta">Metatables and Metamethods</a></h3>
+<h3 <%=heading_options%> ><a name="meta">Metatables and Metamethods</a></h3>
 
 <p>
 Every table in Luan can have a <i>metatable</i>.
@@ -512,7 +513,7 @@
 
 
 
-<h3 margin-top="1em"><a name="gc">Garbage Collection</a></h3>
+<h3 <%=heading_options%> ><a name="gc">Garbage Collection</a></h3>
 
 <p>
 Luan uses Java's garbage collection.
@@ -521,7 +522,7 @@
 
 
 
-<h2 margin-top="1em"><a name="lang">The Language</a></h2>
+<h2 <%=heading_options%> ><a name="lang">The Language</a></h2>
 
 <p>
 This section describes the lexis, the syntax, and the semantics of Luan.
@@ -545,7 +546,7 @@
 
 
 
-<h3 margin-top="1em"><a name="lex">Lexical Conventions</a></h3>
+<h3 <%=heading_options%> ><a name="lex">Lexical Conventions</a></h3>
 
 <p>
 Luan ignores spaces and comments
@@ -720,7 +721,7 @@
 
 
 
-<h3 margin-top="1em"><a name="vars">Variables</a></h3>
+<h3 <%=heading_options%> ><a name="vars">Variables</a></h3>
 
 <p>
 Variables are places that store values.
@@ -788,7 +789,7 @@
 
 
 
-<h3 margin-top="1em"><a name="stmts">Statements</a></h3>
+<h3 <%=heading_options%> ><a name="stmts">Statements</a></h3>
 
 <p>
 Luan supports an almost conventional set of statements,
@@ -799,7 +800,7 @@
 
 
 
-<h4 margin-top="1em"><a name="blocks">Blocks</a></h4>
+<h4 <%=heading_options%> ><a name="blocks">Blocks</a></h4>
 
 <p>
 A block is a list of statements,
@@ -837,7 +838,7 @@
 
 
 
-<h4 margin-top="1em"><a name="chunks">Chunks</a></h4>
+<h4 <%=heading_options%> ><a name="chunks">Chunks</a></h4>
 
 <p>
 The unit of compilation of Luan is called a <i>chunk</i>.
@@ -867,7 +868,7 @@
 
 
 
-<h4 margin-top="1em"><a name="assignment">Assignment</a></h4>
+<h4 <%=heading_options%> ><a name="assignment">Assignment</a></h4>
 
 <p>
 Luan allows multiple assignments.
@@ -951,7 +952,7 @@
 
 
 
-<h4 margin-top="1em"><a name="control">Control Structures</a></h4>
+<h4 <%=heading_options%> ><a name="control">Control Structures</a></h4>
 
 <p>
 The control structures
@@ -1012,7 +1013,7 @@
 
 
 
-<h4 margin-top="1em"><a name="for">For Statement</a></h4>
+<h4 <%=heading_options%> ><a name="for">For Statement</a></h4>
 
 <p>
 The <b>for</b> statement works over functions,
@@ -1078,7 +1079,7 @@
 
 
 
-<h4 margin-top="1em"><a name="fn_stmt">Function Calls as Statements</a></h4>
+<h4 <%=heading_options%> ><a name="fn_stmt">Function Calls as Statements</a></h4>
 
 <p>
 To allow possible side-effects,
@@ -1094,7 +1095,7 @@
 
 
 
-<h4 margin-top="1em"><a name="local_stmt">Local Declarations</a></h4>
+<h4 <%=heading_options%> ><a name="local_stmt">Local Declarations</a></h4>
 
 <p>
 Local variables can be declared anywhere inside a block.
@@ -1119,7 +1120,7 @@
 The visibility rules for local variables are explained in <a href="#visibility">Visibility Rules</a>.
 
 
-<h4 margin-top="1em"><a name="template_stmt">Template Statements</a></h4>
+<h4 <%=heading_options%> ><a name="template_stmt">Template Statements</a></h4>
 
 <p>Template statements are based on <a href="#template_expr">template exressions</a> and provide the full equivalent of <a href="http://en.wikipedia.org/wiki/JavaServer_Pages">JSP</a> but in a general way.  Template statements write the equivalent template exression to standard output.  For example:</p>
 
@@ -1143,7 +1144,7 @@
 
 
 
-<h3 margin-top="1em"><a name="expressions">Expressions</a></h3>
+<h3 <%=heading_options%> ><a name="expressions">Expressions</a></h3>
 
 <p>
 The basic expressions in Luan are the following:
@@ -1229,7 +1230,7 @@
 
 
 
-<h4 margin-top="1em"><a name="arithmetic">Arithmetic Operators</a></h4>
+<h4 <%=heading_options%> ><a name="arithmetic">Arithmetic Operators</a></h4>
 
 <p>
 Luan supports the following arithmetic operators:
@@ -1254,7 +1255,7 @@
 
 
 
-<h4 margin-top="1em"><a name="conversions">Coercions and Conversions</a></h4>
+<h4 <%=heading_options%> ><a name="conversions">Coercions and Conversions</a></h4>
 
 <p>
 Luan generally avoids automatic conversions.
@@ -1266,7 +1267,7 @@
 
 
 
-<h4 margin-top="1em"><a name="relational">Relational Operators</a></h4>
+<h4 <%=heading_options%> ><a name="relational">Relational Operators</a></h4>
 
 <p>
 Luan supports the following relational operators:
@@ -1332,7 +1333,7 @@
 
 
 
-<h4 margin-top="1em"><a name="logical_ops">Logical Operators</a></h4>
+<h4 <%=heading_options%> ><a name="logical_ops">Logical Operators</a></h4>
 
 <p>
 The logical operators in Luan are
@@ -1372,7 +1373,7 @@
 
 
 
-<h4 margin-top="1em"><a name="concatenation">Concatenation</a></h4>
+<h4 <%=heading_options%> ><a name="concatenation">Concatenation</a></h4>
 
 <p>
 The string concatenation operator in Luan is
@@ -1381,7 +1382,7 @@
 
 
 
-<h4 margin-top="1em"><a name="length">The Length Operator</a></h4>
+<h4 <%=heading_options%> ><a name="length">The Length Operator</a></h4>
 
 <p>
 The length operator is denoted by the unary prefix operator <tt>#</tt>.
@@ -1415,7 +1416,7 @@
 
 
 
-<h4 margin-top="1em"><a name="precedence">Precedence</a></h4>
+<h4 <%=heading_options%> ><a name="precedence">Precedence</a></h4>
 
 <p>
 Operator precedence in Luan follows the table below,
@@ -1443,7 +1444,7 @@
 
 
 
-<h4 margin-top="1em"><a name="constructors">Table Constructors</a></h4>
+<h4 <%=heading_options%> ><a name="constructors">Table Constructors</a></h4>
 
 <p>
 Table constructors are expressions that create tables.
@@ -1511,7 +1512,7 @@
 
 
 
-<h4 margin-top="1em"><a name="fn_calls">Function Calls</a></h4>
+<h4 <%=heading_options%> ><a name="fn_calls">Function Calls</a></h4>
 
 <p>
 A function call in Luan has the following syntax:
@@ -1580,7 +1581,7 @@
 
 
 
-<h4 margin-top="1em"><a name="fn_def">Function Definitions</a></h4>
+<h4 <%=heading_options%> ><a name="fn_def">Function Definitions</a></h4>
 
 <p>
 The syntax for function definition is
@@ -1728,7 +1729,7 @@
 then the function returns with no results.
 
 
-<h4 margin-top="1em"><a name="template_expr">Template Expressions</a></h4>
+<h4 <%=heading_options%> ><a name="template_expr">Template Expressions</a></h4>
 
 <p>Luan template expression are based on <a href="http://en.wikipedia.org/wiki/JavaServer_Pages">JSP</a>.  Template expressions return multiple values.  Here is an example:</p>
 
@@ -1748,7 +1749,7 @@
 
 
 
-<h3 margin-top="1em"><a name="visibility">Visibility Rules</a></h3>
+<h3 <%=heading_options%> ><a name="visibility">Visibility Rules</a></h3>
 
 <p>
 Luan is a lexically scoped language.
@@ -1811,7 +1812,7 @@
 
 
 
-<h2 margin-top="1em"><a name="libs">Standard Libraries</a></h2>
+<h2 <%=heading_options%> ><a name="libs">Standard Libraries</a></h2>
 
 <p>
 The standard Luan libraries provide useful functions
@@ -1822,25 +1823,25 @@
 others provide access to "outside" services (e.g., I/O).
 
 
-<h3 margin-top="1em"><a name="default_lib">Default Environment</a></h3>
+<h3 <%=heading_options%> ><a name="default_lib">Default Environment</a></h3>
 
 <p>
 These are provided by default as local variables for any Luan code as described in <a href="#env">Environments</a>.
 
 
-<h4 margin-top="1em"><a name="_ENV"><tt>_ENV</tt></a></h4>
+<h4 <%=heading_options%> ><a name="_ENV"><tt>_ENV</tt></a></h4>
 
 <p>
 This is a table that holds the global variables of a module as described in <a href="#env">Environments</a>.
 
 
-<h4 margin-top="1em"><a name="require"><tt>java ()</tt></a></h4>
+<h4 <%=heading_options%> ><a name="require"><tt>java ()</tt></a></h4>
 
 <p>
 This function enables Java in the current chunk if that chunk has permission to use Java.  If the chunk doesn't have permission to use Java, then an error is thrown.
 
 
-<h4 margin-top="1em"><a name="require"><tt>require (mod_uri)</tt></a></h4>
+<h4 <%=heading_options%> ><a name="require"><tt>require (mod_uri)</tt></a></h4>
 
 <p>
 Example use:
@@ -1859,7 +1860,7 @@
 </pre></tt></p>
 
 
-<h3 margin-top="1em"><a name="luan_lib">Basic Functions</a></h3>
+<h3 <%=heading_options%> ><a name="luan_lib">Basic Functions</a></h3>
 
 <p>
 Include this library by:
@@ -1872,7 +1873,7 @@
 The basic library provides basic functions to Luan that don't depend on other libaries.
 
 
-<h4 margin-top="1em"><a name="Luan.assert"><tt>Luan.assert (v [, message])</tt></a></h4>
+<h4 <%=heading_options%> ><a name="Luan.assert"><tt>Luan.assert (v [, message])</tt></a></h4>
 
 <p>
 Could be defined as:
@@ -1884,7 +1885,7 @@
 </pre></tt></p>
 
 
-<h4 margin-top="1em"><a name="Luan.assert_binary"><tt>Luan.assert_binary (v)</tt></a></h4>
+<h4 <%=heading_options%> ><a name="Luan.assert_binary"><tt>Luan.assert_binary (v)</tt></a></h4>
 
 <p>
 Could be defined as:
@@ -1897,43 +1898,43 @@
 </pre></tt></p>
 
 
-<h4 margin-top="1em"><a name="Luan.assert_boolean"><tt>Luan.assert_boolean (v)</tt></a></h4>
+<h4 <%=heading_options%> ><a name="Luan.assert_boolean"><tt>Luan.assert_boolean (v)</tt></a></h4>
 
 <p>
 Like <a href="#Luan.assert_binary"><tt>assert_binary</tt></a> but for type <tt>boolean</tt>.
 
 
-<h4 margin-top="1em"><a name="Luan.assert_integer"><tt>Luan.assert_integer (v)</tt></a></h4>
+<h4 <%=heading_options%> ><a name="Luan.assert_integer"><tt>Luan.assert_integer (v)</tt></a></h4>
 
 <p>
 Asserts that <tt>v</tt> can be converted to Java type <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Integer.html">Integer</a> and returns an Integer.
 
 
-<h4 margin-top="1em"><a name="Luan.assert_long"><tt>Luan.assert_long (v)</tt></a></h4>
+<h4 <%=heading_options%> ><a name="Luan.assert_long"><tt>Luan.assert_long (v)</tt></a></h4>
 
 <p>
 Asserts that <tt>v</tt> can be converted to Java type <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Long.html">Long</a> and returns a Long.
 
 
-<h4 margin-top="1em"><a name="Luan.assert_number"><tt>Luan.assert_number (v)</tt></a></h4>
+<h4 <%=heading_options%> ><a name="Luan.assert_number"><tt>Luan.assert_number (v)</tt></a></h4>
 
 <p>
 Like <a href="#Luan.assert_binary"><tt>assert_binary</tt></a> but for type <tt>number</tt>.
 
 
-<h4 margin-top="1em"><a name="Luan.assert_string"><tt>Luan.assert_string (v)</tt></a></h4>
+<h4 <%=heading_options%> ><a name="Luan.assert_string"><tt>Luan.assert_string (v)</tt></a></h4>
 
 <p>
 Like <a href="#Luan.assert_binary"><tt>assert_binary</tt></a> but for type <tt>string</tt>.
 
 
-<h4 margin-top="1em"><a name="Luan.assert_table"><tt>Luan.assert_table (v)</tt></a></h4>
+<h4 <%=heading_options%> ><a name="Luan.assert_table"><tt>Luan.assert_table (v)</tt></a></h4>
 
 <p>
 Like <a href="#Luan.assert_binary"><tt>assert_binary</tt></a> but for type <tt>table</tt>.
 
 
-<h4 margin-top="1em"><a name="Luan.do_file"><tt>Luan.do_file ([uri])</tt></a></h4>
+<h4 <%=heading_options%> ><a name="Luan.do_file"><tt>Luan.do_file ([uri])</tt></a></h4>
 
 <p>
 Could be defined as:
@@ -1946,13 +1947,13 @@
 
 
 
-<h4 margin-top="1em"><a name="Luan.error"><tt>Luan.error (message)</tt></a></h4>
+<h4 <%=heading_options%> ><a name="Luan.error"><tt>Luan.error (message)</tt></a></h4>
 
 <p>
 Throws an error containing the message.  This uses Java exceptions internally and the implementation is likely to change.  So this documentation is likely to change.
 
 
-<h4 margin-top="1em"><a name="Luan.get_metatable"><tt>Luan.get_metatable (table)</tt></a></h4>
+<h4 <%=heading_options%> ><a name="Luan.get_metatable"><tt>Luan.get_metatable (table)</tt></a></h4>
 
 <p>
 If <tt>table</tt> does not have a metatable, returns <b>nil</b>.
@@ -1962,7 +1963,7 @@
 Otherwise, returns the metatable of the given table.
 
 
-<h4 margin-top="1em"><a name="Luan.ipairs"><tt>Luan.ipairs (t)</tt></a></h4>
+<h4 <%=heading_options%> ><a name="Luan.ipairs"><tt>Luan.ipairs (t)</tt></a></h4>
 
 <p>
 Returns an iterator function
@@ -1994,7 +1995,7 @@
 
 
 
-<h4 margin-top="1em"><a name="Luan.load"><tt>Luan.load (text, source_name [env, [, allow_expression]])</tt></a></h4>
+<h4 <%=heading_options%> ><a name="Luan.load"><tt>Luan.load (text, source_name [env, [, allow_expression]])</tt></a></h4>
 
 <p>
 Loads a chunk.
@@ -2015,7 +2016,7 @@
 If the <tt>allow_expression</tt> parameter is <tt>true</tt> then the entire text can be nothing more than an expression in which case the chunk returns the value of this expression.
 
 
-<h4 margin-top="1em"><a name="Luan.load_file"><tt>Luan.load_file (file_uri [, add_extension])</tt></a></h4>
+<h4 <%=heading_options%> ><a name="Luan.load_file"><tt>Luan.load_file (file_uri [, add_extension])</tt></a></h4>
 
 <p>
 Similar to <a href="#Luan.load"><tt>load</tt></a>,
@@ -2037,7 +2038,7 @@
 
 
 
-<h4 margin-top="1em"><a name="Luan.pairs"><tt>Luan.pairs (t)</tt></a></h4>
+<h4 <%=heading_options%> ><a name="Luan.pairs"><tt>Luan.pairs (t)</tt></a></h4>
 
 <p>
 If <tt>t</tt> has a metamethod <tt>__pairs</tt>,
@@ -2059,7 +2060,7 @@
 
 
 
-<h4 margin-top="1em"><a name="Luan.pcall"><tt>Luan.pcall (f [, arg1, &middot;&middot;&middot;])</tt></a></h4>
+<h4 <%=heading_options%> ><a name="Luan.pcall"><tt>Luan.pcall (f [, arg1, &middot;&middot;&middot;])</tt></a></h4>
 
 <p>
 Calls function <tt>f</tt> with
@@ -2089,7 +2090,7 @@
 
 
 
-<h4 margin-top="1em"><a name="Luan.range"><tt>Luan.range (start, stop [, step])</tt></a></h4>
+<h4 <%=heading_options%> ><a name="Luan.range"><tt>Luan.range (start, stop [, step])</tt></a></h4>
 
 <p>
 Based on <a href="https://docs.python.org/2/library/functions.html#range">the Python range() function</a>, this lets one iterate through a sequence of numbers.
@@ -2126,7 +2127,7 @@
 
 
 
-<h4 margin-top="1em"><a name="Luan.raw_equal"><tt>Luan.raw_equal (v1, v2)</tt></a></h4>
+<h4 <%=heading_options%> ><a name="Luan.raw_equal"><tt>Luan.raw_equal (v1, v2)</tt></a></h4>
 
 <p>
 Checks whether <tt>v1</tt> is equal to <tt>v2</tt>,
@@ -2135,7 +2136,7 @@
 
 
 
-<h4 margin-top="1em"><a name="Luan.raw_get"><tt>Luan.raw_get (table, index)</tt></a></h4>
+<h4 <%=heading_options%> ><a name="Luan.raw_get"><tt>Luan.raw_get (table, index)</tt></a></h4>
 
 <p>
 Gets the real value of <tt>table[index]</tt>,
@@ -2145,7 +2146,7 @@
 
 
 
-<h4 margin-top="1em"><a name="Luan.raw_len"><tt>Luan.raw_len (v)</tt></a></h4>
+<h4 <%=heading_options%> ><a name="Luan.raw_len"><tt>Luan.raw_len (v)</tt></a></h4>
 
 <p>
 Returns the length of the object <tt>v</tt>,
@@ -2155,7 +2156,7 @@
 
 
 
-<h4 margin-top="1em"><a name="Luan.raw_set"><tt>Luan.raw_set (table, index, value)</tt></a></h4>
+<h4 <%=heading_options%> ><a name="Luan.raw_set"><tt>Luan.raw_set (table, index, value)</tt></a></h4>
 
 <p>
 Sets the real value of <tt>table[index]</tt> to <tt>value</tt>,
@@ -2168,7 +2169,7 @@
 This function returns <tt>table</tt>.
 
 
-<h4 margin-top="1em"><a name="Luan.set_metatable"><tt>Luan.set_metatable (table, metatable)</tt></a></h4>
+<h4 <%=heading_options%> ><a name="Luan.set_metatable"><tt>Luan.set_metatable (table, metatable)</tt></a></h4>
 
 <p>
 Sets the metatable for the given table.
@@ -2217,7 +2218,7 @@
 
 
 
-<h4 margin-top="1em"><a name="Luan.to_string"><tt>Luan.to_string (v)</tt></a></h4>
+<h4 <%=heading_options%> ><a name="Luan.to_string"><tt>Luan.to_string (v)</tt></a></h4>
 
 <p>
 Receives a value of any type and
@@ -2231,7 +2232,7 @@
 
 
 
-<h4 margin-top="1em"><a name="Luan.try"><tt>Luan.try (t)</tt></a></h4>
+<h4 <%=heading_options%> ><a name="Luan.try"><tt>Luan.try (t)</tt></a></h4>
 
 <p>
 Implements try-catch as found in other languages where each block is in table <tt>t</tt>.
@@ -2255,7 +2256,7 @@
 
 
 
-<h4 margin-top="1em"><a name="Luan.type"><tt>Luan.type (v)</tt></a></h4>
+<h4 <%=heading_options%> ><a name="Luan.type"><tt>Luan.type (v)</tt></a></h4>
 
 <p>
 Returns the type of its only argument, coded as a string.
@@ -2270,7 +2271,7 @@
 and "<tt>userdata</tt>".
 
 
-<h4 margin-top="1em"><a name="Luan.values"><tt>Luan.values (&middot;&middot;&middot;)</tt></a></h4>
+<h4 <%=heading_options%> ><a name="Luan.values"><tt>Luan.values (&middot;&middot;&middot;)</tt></a></h4>
 
 <p>
 Returns a function so that the construction
@@ -2284,7 +2285,7 @@
 
 
 
-<h4 margin-top="1em"><a name="Luan.VERSION"><tt>Luan.VERSION</tt></a></h4>
+<h4 <%=heading_options%> ><a name="Luan.VERSION"><tt>Luan.VERSION</tt></a></h4>
 
 <p>
 A global variable (not a function) that
@@ -2296,7 +2297,7 @@
 
 
 
-<h3 margin-top="1em"><a name="package_lib">Modules</a></h3>
+<h3 <%=heading_options%> ><a name="package_lib">Modules</a></h3>
 
 <p>
 Include this library by:
@@ -2310,7 +2311,7 @@
 facilities for loading modules in Luan.
 
 
-<h4 margin-top="1em"><a name="Package.load"><tt>Package.load (mod_uri)</tt></a></h4>
+<h4 <%=heading_options%> ><a name="Package.load"><tt>Package.load (mod_uri)</tt></a></h4>
 
 <p>
 Loads the given module.
@@ -2332,7 +2333,7 @@
 
 
 
-<h4 margin-top="1em"><a name="Package.loaded"><tt>Package.loaded</tt></a></h4>
+<h4 <%=heading_options%> ><a name="Package.loaded"><tt>Package.loaded</tt></a></h4>
 
 
 <p>