summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Gruno <humbedooh@apache.org>2012-04-25 09:36:17 +0200
committerDaniel Gruno <humbedooh@apache.org>2012-04-25 09:36:17 +0200
commit6f118da1ae9d3a19c0ed86d550c8cbe8d7c13133 (patch)
tree407e6207e0f9e3a052790a2cccbed47427fb9b04
parentAdd Lua syntax support (diff)
downloadapache2-6f118da1ae9d3a19c0ed86d550c8cbe8d7c13133.tar.xz
apache2-6f118da1ae9d3a19c0ed86d550c8cbe8d7c13133.zip
Highlight Lua source code
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1330137 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--docs/manual/mod/mod_lua.html.en34
-rw-r--r--docs/manual/mod/mod_lua.xml28
2 files changed, 40 insertions, 22 deletions
diff --git a/docs/manual/mod/mod_lua.html.en b/docs/manual/mod/mod_lua.html.en
index 6ec674f2d2..16d82e332c 100644
--- a/docs/manual/mod/mod_lua.html.en
+++ b/docs/manual/mod/mod_lua.html.en
@@ -118,7 +118,9 @@ and <code class="module"><a href="../mod/mod_status.html">mod_status</a></code>.
just evaluating a script body CGI style. A handler function looks
something like this:</p>
-<div class="example"><h3>example.lua</h3><pre>
+
+<pre class="prettyprint lang-lua">
+<strong>example.lua</strong>
-- example handler
require "string"
@@ -144,7 +146,8 @@ function handle(r)
r:puts("unknown HTTP method " .. r.method)
end
end
-</pre></div>
+</pre>
+
<p>
This handler function just prints out the uri or form encoded
@@ -172,7 +175,8 @@ they'll return OK, DONE, or DECLINED, which you can write in lua as
<code>apache2.OK</code>, <code>apache2.DONE</code>, or
<code>apache2.DECLINED</code>, or else an HTTP status code.</p>
-<div class="example"><h3>translate_name.lua</h3><pre>
+<pre class="prettyprint lang-lua">
+<strong>translate_name.lua</strong>
-- example hook that rewrites the URI to a filesystem path.
require 'apache2'
@@ -185,9 +189,11 @@ function translate_name(r)
-- we don't care about this URL, give another module a chance
return apache2.DECLINED
end
-</pre></div>
+</pre>
-<div class="example"><h3>translate_name2.lua</h3><pre>
+
+<pre class="prettyprint lang-lua">
+<strong>translate_name2.lua</strong>
--[[ example hook that rewrites one URI to another URI. It returns a
apache2.DECLINED to give other URL mappers a chance to work on the
substitution, including the core translate_name hook which maps based
@@ -206,7 +212,8 @@ function translate_name(r)
end
return apache2.DECLINED
end
-</pre></div>
+</pre>
+
</div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
<div class="section">
<h2><a name="datastructures" id="datastructures">Data Structures</a></h2>
@@ -388,7 +395,7 @@ end
<div class="section">
<h2><a name="logging" id="logging">Logging Functions</a></h2>
-<div class="example"><p><code>
+<pre class="prettyprint lang-lua">
-- examples of logging messages<br />
r:trace1("This is a trace log message") -- trace1 through trace8 can be used <br />
r:debug("This is a debug log message")<br />
@@ -399,7 +406,8 @@ end
r:alert("This is an alert log message")<br />
r:crit("This is an crit log message")<br />
r:emerg("This is an emerg log message")<br />
-</code></p></div>
+</pre>
+
</div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
<div class="section">
@@ -485,7 +493,7 @@ hook function usually returns OK, DECLINED, or HTTP_FORBIDDEN.</p>
a request. This can be used to implement arbitrary authentication
and authorization checking. A very simple example:
</p>
-<div class="example"><pre>
+<pre class="prettyprint lang-lua">
require 'apache2'
-- fake authcheck hook
@@ -516,7 +524,8 @@ function authcheck_hook(r)
end
return apache2.OK
end
-</pre></div>
+</pre>
+
<div class="note"><h3>Ordering</h3><p>The optional arguments "early" or "late"
control when this script runs relative to other modules.</p></div>
@@ -603,7 +612,9 @@ processing</td></tr>
<div class="example"><pre>
# httpd.conf
LuaHookTranslateName /scripts/conf/hooks.lua silly_mapper
+</pre></div>
+<pre class="prettyprint lang-lua">
-- /scripts/conf/hooks.lua --
require "apache2"
function silly_mapper(r)
@@ -614,7 +625,8 @@ function silly_mapper(r)
return apache2.DECLINED
end
end
-</pre></div>
+</pre>
+
<div class="note"><h3>Context</h3><p>This directive is not valid in <code class="directive"><a href="../mod/core.html#directory">&lt;Directory&gt;</a></code>, <code class="directive"><a href="../mod/core.html#files">&lt;Files&gt;</a></code>, or htaccess
context.</p></div>
diff --git a/docs/manual/mod/mod_lua.xml b/docs/manual/mod/mod_lua.xml
index 0c51337d8d..56fdd3adec 100644
--- a/docs/manual/mod/mod_lua.xml
+++ b/docs/manual/mod/mod_lua.xml
@@ -86,7 +86,9 @@ and <module>mod_status</module>.</p>
just evaluating a script body CGI style. A handler function looks
something like this:</p>
-<example><title>example.lua</title><pre>
+
+<highlight language="lua">
+<strong>example.lua</strong>
-- example handler
require "string"
@@ -112,7 +114,7 @@ function handle(r)
r:puts("unknown HTTP method " .. r.method)
end
end
-</pre></example>
+</highlight>
<p>
This handler function just prints out the uri or form encoded
@@ -140,7 +142,8 @@ they'll return OK, DONE, or DECLINED, which you can write in lua as
<code>apache2.OK</code>, <code>apache2.DONE</code>, or
<code>apache2.DECLINED</code>, or else an HTTP status code.</p>
-<example><title>translate_name.lua</title><pre>
+<highlight language="lua">
+<strong>translate_name.lua</strong>
-- example hook that rewrites the URI to a filesystem path.
require 'apache2'
@@ -153,9 +156,10 @@ function translate_name(r)
-- we don't care about this URL, give another module a chance
return apache2.DECLINED
end
-</pre></example>
+</highlight>
-<example><title>translate_name2.lua</title><pre>
+<highlight language="lua">
+<strong>translate_name2.lua</strong>
--[[ example hook that rewrites one URI to another URI. It returns a
apache2.DECLINED to give other URL mappers a chance to work on the
substitution, including the core translate_name hook which maps based
@@ -174,7 +178,7 @@ function translate_name(r)
end
return apache2.DECLINED
end
-</pre></example>
+</highlight>
</section>
<section id="datastructures"><title>Data Structures</title>
@@ -356,7 +360,7 @@ end
<section id="logging"><title>Logging Functions</title>
-<example>
+<highlight language="lua">
-- examples of logging messages<br />
r:trace1("This is a trace log message") -- trace1 through trace8 can be used <br />
r:debug("This is a debug log message")<br />
@@ -367,7 +371,7 @@ end
r:alert("This is an alert log message")<br />
r:crit("This is an crit log message")<br />
r:emerg("This is an emerg log message")<br />
-</example>
+</highlight>
</section>
@@ -570,7 +574,9 @@ end
<example><pre>
# httpd.conf
LuaHookTranslateName /scripts/conf/hooks.lua silly_mapper
+</pre></example>
+<highlight language="lua">
-- /scripts/conf/hooks.lua --
require "apache2"
function silly_mapper(r)
@@ -581,7 +587,7 @@ function silly_mapper(r)
return apache2.DECLINED
end
end
-</pre></example>
+</highlight>
<note><title>Context</title><p>This directive is not valid in <directive
type="section" module="core">Directory</directive>, <directive
@@ -661,7 +667,7 @@ processing</description>
a request. This can be used to implement arbitrary authentication
and authorization checking. A very simple example:
</p>
-<example><pre>
+<highlight language="lua">
require 'apache2'
-- fake authcheck hook
@@ -692,7 +698,7 @@ function authcheck_hook(r)
end
return apache2.OK
end
-</pre></example>
+</highlight>
<note><title>Ordering</title><p>The optional arguments "early" or "late"
control when this script runs relative to other modules.</p></note>
</usage>