<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<meta http-equiv="Content-Type" content="text/html; charset=$(ldoc.doc_charset)"/>
<head>
    <title>$(ldoc.title)</title>
    <link rel="stylesheet" href="$(ldoc.css)" type="text/css" />
# if ldoc.custom_css then -- add custom CSS file if configured.
    <link rel="stylesheet" href="$(ldoc.custom_css)" type="text/css" />
# end
</head>
<body>

<div id="container">

<div id="product">
	<div id="product_logo"></div>
	<div id="product_name"><big><b></b></big></div>
	<div id="product_description"></div>
</div> <!-- id="product" -->


<div id="main">

# local no_spaces = ldoc.no_spaces
# local use_li = ldoc.use_li
# local display_name = ldoc.display_name
# local iter = ldoc.modules.iter
# local function M(txt,item) return ldoc.markup(txt,item,ldoc.plain) end
# local nowrap = ldoc.wrap and '' or 'nowrap'

# local function parse_source_file_table(filename, start_lineno)
#     local content = ldoc.include_file(filename)
#     local skip = true
#     local res = {}
#     for lineno, line in ldoc.ipairs(content:split('\n')) do
#         if lineno == start_lineno then
#             skip = false
#             goto continue
#         end
#         if not skip and line:endswith('}') then
#             return res
#         end
#         if not skip then
#             local key, value = line:match("^ *([%w_]-) *= *([%w']-),?$")
#             if key then
#                 res[key] = value
#             end
#         end
#         ::continue::
#     end
#     return res
# end

# -- Copied from config.ld.
# --
# -- A section description is not processed by
# -- `custom_display_name_handler`.
# local function convert_markdown_references(text)
#     local refs = {}
#     for _, line in ldoc.pairs(text:split('\n')) do
#        local anchor, url = line:lstrip():match('^%[([0-9])%]: (.*)$')
#        if anchor then
#           refs[anchor] = url
#        end
#     end
#
#     for anchor, url in ldoc.pairs(refs) do
#         text = text:gsub('\n *%[' .. anchor .. '%]: [^\n]*', '')
#         text = text:gsub('%[(.-)%]%[' .. anchor .. '%]',
#             '<a href="' .. refs[anchor] .. '">%1</a>')
#     end
#     return text
# end

# -- Copied from config.ld.
# --
# -- A section description is not processed by
# -- `custom_display_name_handler`.
# local function convert_markdown_backticks(text)
#     return text:gsub('`(.-)`', '<code>%1</code>')
# end

<!-- Menu -->

<div id="navigation">
<br/>
<h1>$(ldoc.project)</h1>

# if not ldoc.single and module then -- reference back to project index
<ul>
  <li><a href="../$(ldoc.output).html">Index</a></li>
</ul>
# end

# --------- contents of module -------------
# if module and not ldoc.no_summary and #module.items > 0 then
<h2>Contents</h2>
<ul>
# for kind,items in module.kinds() do
<li><a href="#$(no_spaces(kind))">$(kind)</a></li>
# end
</ul>
# end


# if ldoc.no_summary and module and not ldoc.one then -- bang out the functions on the side
# for kind, items in module.kinds() do
<h2>$(kind)</h2>
<ul class="nowrap">
# for item in items() do
    <li><a href="#$(item.name)">$(display_name(item))</a></li>
# end
</ul>
# end
# end
# -------- contents of project ----------
# local this_mod = module and module.name
# for kind, mods, type in ldoc.kinds() do
#  if ldoc.allowed_in_contents(type,module) then
<h2>$(kind)</h2>
<ul class="$(kind=='Topics' and '' or 'nowrap')">
#  for mod in mods() do local name = display_name(mod)
#   if mod.name == this_mod then
  <li><strong>$(name)</strong></li>
#   else
  <li><a href="$(ldoc.ref_to_module(mod))">$(name)</a></li>
#   end
#  end
# end
</ul>
# end

</div>

<div id="content">

# if ldoc.body then -- verbatim HTML as contents; 'non-code' entries
    $(ldoc.body)
# elseif module then -- module documentation
<h1>$(ldoc.module_typename(module)) <code>$(module.name)</code></h1>
<p>$(M(module.summary,module))</p>
<p>$(M(module.description,module))</p>
#   if module.tags.include then
        $(M(ldoc.include_file(module.tags.include)))
#   end
#   if module.see then
#     local li,il = use_li(module.see)
    <h3>See also:</h3>
    <ul>
#     for see in iter(module.see) do
         $(li)<a href="$(ldoc.href(see))">$(see.label)</a>$(il)
#    end -- for
    </ul>
#   end -- if see
#   if module.usage then
#     local li,il = use_li(module.usage)
    <h3>Usage:</h3>
    <ul>
#     for usage in iter(module.usage) do
        $(li)<pre class="example">$(ldoc.escape(usage))</pre>$(il)
#     end -- for
    </ul>
#   end -- if usage
#   if module.info then
    <h3>Info:</h3>
    <ul>
#     for tag, value in module.info:iter() do
        <li><strong>$(tag)</strong>: $(M(value,module))</li>
#     end
    </ul>
#   end -- if module.info


# if not ldoc.no_summary then
# -- bang out the tables of item types for this module (e.g Functions, Tables, etc)
# for kind,items in module.kinds() do
<h2><a href="#$(no_spaces(kind))">$(kind)</a></h2>
<table class="function_list">
#  for item in items() do
	<tr>
	<td class="name" $(nowrap)><a href="#$(item.name)">$(display_name(item))</a></td>
	<td class="summary">$(M(item.summary:split('\n', 1)[1],item))</td>
	</tr>
#  end -- for items
</table>
#end -- for kinds

<br/>
<br/>

#end -- if not no_summary

# --- currently works for both Functions and Tables. The params field either contains
# --- function parameters or table fields.
# local show_return = not ldoc.no_return_or_parms
# local show_parms = show_return
# for kind, items in module.kinds() do
#   local kitem = module.kinds:get_item(kind)
#   local has_description = kitem and ldoc.descript(kitem) ~= ""
    <h2 class="section-header $(has_description and 'has-description')"><a name="$(no_spaces(kind))"></a>$(kind)</h2>
    $(M(module.kinds:get_section_description(kind),nil))
#   if kitem then
#       if has_description then
          <div class="section-description">
#         local item_text = ldoc.descript(kitem)
#         item_text = convert_markdown_references(item_text)
#         item_text = convert_markdown_backticks(item_text)
          $(M(item_text,kitem))
          </div>
#       end
#       if kitem.usage then
            <h3>Usage:</h3>
            <pre class="example">$(ldoc.prettify(kitem.usage[1]))</pre>
#        end
#   end
    <dl class="function $(kitem and kitem.name or '')">
#  for item in items() do
    <dt>
    <a name="$(item.name)"></a>
#   if kitem and (kitem.name == 'options' or kitem.name == 'defaults') then
    <strong>$(item.summary)</strong>
#   else
    <strong>$(display_name(item))</strong>
#   end
#   if ldoc.prettify_files and ldoc.is_file_prettified[item.module.file.filename] then
    <a style="float:right;" href="$(ldoc.source_ref(item))">line $(item.lineno)</a>
#  end
    </dt>
    <dd>
#   if kitem and (kitem.name == 'options' or kitem.name == 'defaults') then
    $(M(item.description))</p>
#   else
    <p>$(M(ldoc.descript(item),item))</p>
#   end

#   if ldoc.custom_tags then
#    for custom in iter(ldoc.custom_tags) do
#     local tag = item.tags[custom[1]]
#     if tag and not custom.hidden then
#      local li,il = use_li(tag)
    <h3>$(custom.title or custom[1]):</h3>
    <ul>
#      for value in iter(tag) do
         $(li)$(custom.format and custom.format(value) or M(value))$(il)
#      end -- for
#     end -- if tag
    </ul>
#    end -- iter tags
#   end

#  if show_parms and item.params and #item.params > 0 then
#    local subnames = module.kinds:type_of(item).subnames
#    if subnames then
    <h3>$(subnames):</h3>
#    end
    <ul>
#   for parm in iter(item.params) do
#     local source_table = {}
#     if kitem and kitem.name == 'defaults' then
#         source_table = parse_source_file_table(item.file.filename,
#                                                item.lineno)
#     end
#     local param,sublist = item:subparam(parm)
#     if sublist then
#       local name = item:display_name_of(sublist)
#       local tp = ldoc.typename(item:type_of_param(sublist))
#       local def = item:default_of_param(sublist)
#       local sep = def and ',' or ')'
        <li><span class="parameter">$(name)</span>
#       if tp ~= '' then
            <span class="parameter-info">
                (<span class="types">$(tp)</span>$(sep)
#       end
#       if def == true then
                <span class="parameter-modifier">
                <em>optional</em>)
                </span>
#       elseif def then
                <em>default</em> $(def)
#       end
#       if item:readonly(p) then
                <em>readonly</em>
#       end
#       if tp ~= '' then
            </span>
#       end

        <br>
        <span class="parameter-description">
        <p>$(M(item.params.map[sublist],item))</p>
        </span>
        <ul>
#     end
#     for p in iter(param) do
#        local name = item:display_name_of(p)
#        local tp = ldoc.typename(item:type_of_param(p))
#        local def = item:default_of_param(p)
#        sep = def and ',' or ')'
        <li><span class="parameter">$(name)</span>
#       if tp ~= '' then
            <span class="parameter-info">
                (<span class="types">$(tp)</span>$(sep)
#       end
#       if def == true then
                <span class="parameter-modifier">
                <em>optional</em>)
                </span>
#       elseif def then
                <em>default</em> $(def)
#       end
#       if item:readonly(p) then
                <em>readonly</em>
#       end
#       if tp ~= '' then
            </span>
#       end
#       if source_table[p] ~= nil then
        = <span class="parameter-value">$(source_table[p])</span>
#       end
#       if M(item.params.map[p], item) ~= '' then
        <br>
#       end
        <span class="parameter-description">
        <p>$(M(item.params.map[p],item))</p>
        </span>
        </li>
#     end
#     if sublist then
        </li></ul>
#     end
#   end -- for
    </ul>
#   end -- if params

#  if show_return and item.retgroups then local groups = item.retgroups
    <h3>Returns:</h3>
#   for i,group in ldoc.ipairs(groups) do local li,il = use_li(group)
    <ol>
#   for r in group:iter() do local type, ctypes = item:return_type(r); local rt = ldoc.typename(type)
        $(li)
#     if rt ~= '' then
           <span class="types">$(rt)</span>
#     end
        $(M(r.text,item))$(il)
#    if ctypes then
      <ul>
#    for c in ctypes:iter() do
            <li><span class="parameter">$(c.name)</span>
            <span class="types">$(ldoc.typename(c.type))</span>
            $(M(c.comment,item))</li>
#     end
        </ul>
#    end -- if ctypes
#     end -- for r
    </ol>
#   if i < #groups then
     <h3>Or</h3>
#   end
#   end -- for group
#   end -- if returns

#   if show_return and item.raise then
    <h3>Raises:</h3>
    $(M(item.raise,item))
#   end

#   if item.see then
#     local li,il = use_li(item.see)
    <h3>See also:</h3>
    <ul>
#     for see in iter(item.see) do
         $(li)<a href="$(ldoc.href(see))">$(see.label)</a>$(il)
#    end -- for
    </ul>
#   end -- if see

#   if item.usage then
#     local li,il = use_li(item.usage)
    <h3>Usage:</h3>
    <ul>
#     for usage in iter(item.usage) do
        $(li)<pre class="example">$(ldoc.prettify(usage))</pre>$(il)
#     end -- for
    </ul>
#   end -- if usage

</dd>
# end -- for items
</dl>
# end -- for kinds

# else -- if module; project-level contents

# if ldoc.description then
  <h2>$(M(ldoc.description,nil))</h2>
# end
# if ldoc.full_description then
  <p>$(M(ldoc.full_description,nil))</p>
# end

# for kind, mods in ldoc.kinds() do
<h2>$(kind)</h2>
# kind = kind:lower()
<table class="module_list">
# for m in mods() do
	<tr>
		<td class="name"  $(nowrap)><a href="$(no_spaces(kind))/$(m.name).html">$(m.name)</a></td>
		<td class="summary">$(M(ldoc.strip_header(m.summary),m))</td>
	</tr>
#  end -- for modules
</table>
# end -- for kinds
# end -- if module

</div> <!-- id="content" -->
</div> <!-- id="main" -->
</div> <!-- id="container" -->
</body>
</html>
