1
0
mirror of https://github.com/elua/elua.git synced 2025-01-08 20:56:17 +08:00

New HTML doc structure still under evaluation and development.

Please read file readme.txt on /doc for more info.
This commit is contained in:
Dado Sutter 2009-02-02 21:08:31 +00:00
parent bdecd89d31
commit 6137c01714
50 changed files with 1243 additions and 0 deletions

62
doc/readme.txt Normal file
View File

@ -0,0 +1,62 @@
This document describes the eLua documentation structure, formats and the
tools used to maintain it.
## Temporary note:
## - This is the new doc structure proposed for eLua, still
## under evaluation but probably replacing soon the single manual format.
## - The /doc directory will soon replace the current /docs
eLua documentation is created and maintained offline, in HTML format and
integrated with the same version control system used for eLua Source Code.
This allows the same content to be deployed both online, published on the
site, and offline, included in our releases.
All the content pages are created and edited offline, using any HTML
editor. We're currently using KompoZer and opened to new sugestions :)
The "doc site" structure is created by a help doc generator tool called
WebBook, created at Tecgraf/PUC-Rio. WebBook is Open Source and Free
Software, 100% written in Lua and it's usage is described in
http://www.tecgraf.puc-rio.br/webbook
WebBook takes the created pages and a configuration file, which is simply
a Lua Table, and generates the main menu and overall site structure, in
plain HTML and JavaScript, with regular support for CSS. There is no need
for JavaScript programming or cgi-bin scripts to "run" the site. The result
is pure HTML (and JavaScript) and any browser must be able to navigate the
complete doc structure generated by WebBook.
eLua documentation is kept on the development repository, on the /doc
directory, under the trunk, branch and/or tag versions.
Different doc language versions are kept under their own sub-directories (ie:
/doc/en for english, /doc/pt for portuguese, /doc/ro for romanian etc...)
Directory /doc/wb is used to run WebBook build script and to store
configuration files. It does NOT need to be published or included in an
offline version of the doc "site".
File wb_usr.lua is the main configuration file. It defines the main titles,
menu structure, utility fields/buttons and the startup options.
File wb_build.lua is the main WebBook build script. Some facilities (bat files)
are included for easy build under Windows but we haven't tested them.
To create a WebBook Structure site, just edit wb_usr.lua and, from /wb dir, run
$ lua5.1 wb_build.lua
Directories that needed to be published and included in the distros are:
/doc (## maybe not all files but tests are required here ##)
/doc/en (english version doc pages and optional style sheets)
/doc/pt (portuguese version doc pages and optional style sheets)
/doc/img (images, logos and art files)
eLua Doc can be viewed on any browser, simply opening the file
index_en.html (or index_pt.html for the portuguese version), on the /doc
directory.

BIN
doc/ssSearch.class Executable file

Binary file not shown.

BIN
doc/ssSearchThread.class Executable file

Binary file not shown.

22
doc/template_ssSearch.html Executable file
View File

@ -0,0 +1,22 @@
<html>
<head>
<title>ssSearch</title>
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
<h3>WB_SEARCH</h3>
<blockquote>
<center>
<applet code="ssSearch.class" width="640" height="480">
<param name="BGCOLOR" value="0B6DCE">
<param name="LISTAREACOLOR" value="ffffff">
<!-- Use "_self", "_blank", "_parent", "_top" or any other user-defined name -->
<param name="TARGETFRAME" value="_self">
<param name="DATAFILE" value="wb_searchWB_LNG.txt">
<!-- The APPLETHOME param is just an acknowledgement -->
<!-- Do not edit the value of APPLETHOME param -->
<param name="APPLETHOME" value="http://www.geocities.com/SiliconValley/Lakes/5365/index.html">
</applet>
</center>
</blockquote>
</body></html>

1
doc/wb/js2lua.bat Executable file
View File

@ -0,0 +1 @@
@lua5.1 js2lua.lua %1 %2

28
doc/wb/js2lua.lua Executable file
View File

@ -0,0 +1,28 @@
-- Convert JavaScript into Lua
if (not arg[1]) then
error("Javascript filename must be passed as a parameter.")
end
if (not arg[2]) then
error("Lua filename must be passed as a parameter.")
end
print("Converting...")
local js_filename = arg[1]
local file = io.open(js_filename)
local wb_lua = file:read("*a")
file:close()
wb_lua = string.gsub(wb_lua, ":", "=")
wb_lua = string.gsub(wb_lua, "http=", "http:")
wb_lua = string.gsub(wb_lua, ";", " ")
wb_lua = string.gsub(wb_lua, "%[", "{")
wb_lua = string.gsub(wb_lua, "%]", "}")
local lua_filename = arg[2]
local file = io.open(lua_filename, "w")
file:write(wb_lua)
file:close()
print("Done.")

274
doc/wb/make_hh.lua Executable file
View File

@ -0,0 +1,274 @@
---------------------------------------------------------------------
-- This program converts from Tecgraf's WebBook to HTML Help Project Files.
-- by Mark Stroetzel Glasberg and Antonio Scuri
-- 09 Dec, 2004
---------------------------------------------------------------------
languages_description = {
en = "0x0409 English - United States",
es = "0x040A Spanish - Standard",
fr = "0x040C French - Standard",
de = "0x0407 German - Standard",
-- pt = "0x0816 Portuguese - Standard",
pt = "0x0416 Portuguese - Brazil",
it = "0x0410 Italian - Standard"
}
-- INITIALIZATION ---------------------------------------------------
function isinlist(lng, list)
local i = 1
local n = #list
while i <= n do
if list[i] == lng then
return 1
end
i = i + 1;
end
return nil
end
-- BASIC FUNCTIONS --------------------------------------------------
function out(string)
file:write(string)
end
function outln(string)
local i = ident + 1
while i>0 do
file:write(" ")
i = i - 1
end
file:write(string.."\n")
end
-- HHP FILE FUNCTIONS ------------------------------------------------
files = {}
function add2files(v)
if v then
-- only up to "#"
local j = string.find(v, "#")
if j then
f = string.sub(v, 0, j-1)
else
f = v
end
files[f] = f
end
end
function writehhpheader()
out("[OPTIONS]\n")
outln("Binary Index=No")
outln("Compatibility=1.0")
outln("Compiled file=" .. wb_usr.file_title .. "_" .. lng .. ".chm")
outln("Contents file=wb_tree" .. "_" .. lng .. ".hhc")
outln("Default topic=" .. lng .. "/" .. wb_usr.tree.link)
outln("Display compile notes=Yes")
outln("Display compile progress=Yes")
outln("Full-text search=Yes")
outln("Language="..languages_description[lng])
outln("Title="..wb_usr.messages[lng].title)
out("\n")
out("[FILES]\n")
outln(lng .. "/" .. wb_usr.tree.link)
end
function writehhpfooter()
local tmp = [[
[INFOTYPES]
]]
out(tmp)
end
function writehhpcenter()
if (not files) then return end
local v = next(files, nil)
while v ~= nil do
outln(dir..v)
v = next(files, v)
end
end
function writehhp()
writehhpheader()
writehhpcenter()
writehhpfooter()
end
-- HHC FILE FUNCTIONS ------------------------------------------------
function writeheader()
out("<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML//EN\">\n")
out("<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML//EN\">\n")
out("<HTML>\n")
out("<HEAD>\n")
out("<meta name=\"GENERATOR\" content=\"Microsoft&reg; HTML Help Workshop 4.1\">\n")
out("<!-- Sitemap 1.0 -->\n")
out("<!-- Generated by WebBook -->\n")
out("</HEAD><BODY>\n")
out(" <UL>\n")
out(" <LI> <OBJECT type=\"text/sitemap\">\n")
out(" <param name=\"Name\" value=\""..wb_usr.messages[lng].title.."\">\n")
out(" <param name=\"Local\" value=\""..lng .. "/" .. wb_usr.tree.link .. "\">\n")
out(" </OBJECT>\n")
end
function type_string (o)
return type(o) == "string"
end
function writeend()
out(" </UL>\n")
out("</BODY>\n")
out("</HTML>\n")
end
function writesubitems(tree, mainlink)
if (not tree) then
return
end
local i = 1
local n = #tree
while i <= n do
writetopic(tree[i], mainlink)
i = i + 1
end
ident = ident - 1
end
-- mainlink is the link of the father -> if no link is specified
-- this is the one that is used.
function writetopic(t, mainlink)
local link
local topic_name
add2files(mainlink)
if t.name == nil then
print("ERROR: Title is nil.")
return
end
if (t.name[lng]) then
topic_name = t.name[lng]
else
topic_name = t.name["nl"]
end
if topic_name == nil then
print("ERROR: Title is nil in language [" .. lng .. "].")
return
end
if t.link and t.link ~= "" then
link = t.link
else
link = nil
end
add2files(link)
if t.bookmark then
if link == nil and mainlink == nil then
print("Error saving bookmark!!!")
return
end
if link then
linkB = link .. "#" .. t.bookmark
else
linkB = mainlink .. "#" .. t.bookmark
end
else
linkB = nil
end
outln("<LI> <OBJECT type=\"text/sitemap\">")
outln("<param name=\"Name\" value=\""..topic_name.."\">")
if linkB then
outln("<param name=\"Local\" value=\""..dir..linkB.."\">")
else
if link then
outln("<param name=\"Local\" value=\""..dir..link.."\">")
end
end
if useimage == 1 then
if t.folder then
if ident == 0 then
outln("<param name=\"ImageNumber\" value=\"1\">")
else
outln("<param name=\"ImageNumber\" value=\"6\">")
end
else
outln("<param name=\"ImageNumber\" value=\"11\">")
end
end
outln("</OBJECT>")
-- Write folder --
if t.folder then
ident = ident + 1
outln("<UL>")
if link == nil then
writesubitems(t.folder, mainlink)
else
writesubitems(t.folder, link)
end
outln("</UL>")
end
end
function writetopics(tree)
if (not tree) then return end
local i = 1;
local n = #tree
while i <= n do
outln("<UL>")
writetopic(tree[i], nil)
outln("</UL>")
i = i + 1
end
end
-- MAIN -------------------------------------------------------------
-- lng -> from the command line
dofile("wb_usr.lua")
if (not arg[1]) then
error("Missing language parameter.")
end
lng = arg[1]
dir = lng.."/"
ident = 0
useimage = 1 -- Use images based on given information
file = nil
print("Writing \"wb_tree" .. "_" .. lng .. ".hhc\" file.")
file = io.open("wb_tree" .. "_" .. lng .. ".hhc", "w")
writeheader()
writetopics(wb_usr.tree.folder)
writeend()
file:close()
if ident ~= 0 then
print("Ident not correct!")
end
print("Writing \"wb" .. "_" .. lng .. ".hhp\" file.")
file = io.open("wb" .. "_" .. lng .. ".hhp", "w")
writehhp()
file:close()
print("done.")

28
doc/wb/template_index.html Executable file
View File

@ -0,0 +1,28 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Strict//EN">
<html>
<head>
<meta http-equiv="Content-Language" content="en-us">
<title>WB_TITLE</title>
</head>
<frameset rows="51,*" frameborder="0" framespacing="0" bordercolor="#0B6DCE">
<frame name="wb_title" scrolling="no" noresize="noresize" src="wb_titleWB_LNG.html"
frameborder="0" marginheight="0" marginwidth="0" target="wb_cont">
<frameset cols="WB_START_SIZE,*" frameborder="1" framespacing="4" bordercolor="#0B6DCE" border="4">
<frameset rows="27,*" frameborder="0" framespacing="0" bordercolor="#0B6DCE">
<frame name="wb_bar" scrolling="no" src="wb_barWB_LNG.html" frameborder="0" target="wb_cont">
<frame name="wb_tree" src="wb_treeWB_LNG.html" frameborder="1" target="wb_cont">
</frameset>
<frame name="wb_cont" src="WB_START_PAGE" frameborder="0">
</frameset>
<noframes>
<body>
<p>This page uses frames, but your browser doesn&#39;t support them.</p>
</body>
</noframes>
</frameset>
</html>

25
doc/wb/template_ssSearch.html Executable file
View File

@ -0,0 +1,25 @@
<html>
<head>
<title>ssSearch</title>
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
<h3>WB_SEARCH</h3>
<blockquote>
<center>
<applet code="ssSearch.class" width="640" height="480">
<param name="BGCOLOR" value="0B6DCE">
<param name="LISTAREACOLOR" value="ffffff">
<!-- Use "_self", "_blank", "_parent", "_top" or any other user-defined name -->
<param name="TARGETFRAME" value="_self">
<param name="DATAFILE" value="wb_searchWB_LNG.txt">
<!-- The APPLETHOME param is just an acknowledgement -->
<!-- Do not edit the value of APPLETHOME param -->
<param name="APPLETHOME" value="http://www.geocities.com/SiliconValley/Lakes/5365/index.html">
</applet>
</center>
</blockquote>
<p>Powered by <a href="http://us.geocities.com/nsenthil/ssSearch.html">ssSearch</a>
from Nalla
Senthilnathan.</p>
</body></html>

26
doc/wb/template_wb_bar.html Executable file
View File

@ -0,0 +1,26 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Strict//EN">
<html>
<head>
<meta http-equiv="Content-Language" content="en-us" >
<title>Bar</title>
<base target="wb_cont">
<style type="text/css">
.navigation{
padding: 0;
margin: 0;
white-space: nowrap;
border: 1px solid #7F93C7;
background-color: #FFFFFF;
line-height: 19px;
}
.navigation p { margin: 1px; white-space: nowrap; }
.navigation img { vertical-align: middle; }
</style>
</head>
<body style="margin: 2px; background-color: #F1F1F1">
<div class="navigation">
<p><a target="_blank" href="http://www.tecgraf.puc-rio.br/webbook"><img src="wb_img/webbook.png" onmouseover="this.src='wb_img/webbook_over.png'" onmouseout="this.src='wb_img/webbook.png'" style="border-width: 0px"></a><img src="wb_img/barlineleft.png"><img alt="WB_EXPALL_ALT" src="wb_img/showall.png" onclick="parent.wb_tree.showAllFolders()" onmouseover="this.src='wb_img/showall_over.png'" onmouseout="this.src='wb_img/showall.png'"><img alt="WB_CONTALL_ALT" src="wb_img/hideall.png" onclick="parent.wb_tree.hideAllFolders()" onmouseover="this.src='wb_img/hideall_over.png'" onmouseout="this.src='wb_img/hideall.png'"><img alt="WB_SYNC_ALT" src="wb_img/sync.png" onclick="parent.wb_tree.syncContents()" onmouseover="this.src='wb_img/sync_over.png'" onmouseout="this.src='wb_img/sync.png'"><img alt="WB_NEXT_ALT" src="wb_img/next.png" onclick="parent.wb_tree.nextContents()" onmouseover="this.src='wb_img/next_over.png'" onmouseout="this.src='wb_img/next.png'"><img alt="WB_PREV_ALT" src="wb_img/previous.png" onclick="parent.wb_tree.prevContents()" onmouseover="this.src='wb_img/previous_over.png'" onmouseout="this.src='wb_img/previous.png'">WB_LNG_BUTTON</p>
</div>
</body>
</html>

64
doc/wb/template_wb_title.html Executable file
View File

@ -0,0 +1,64 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Strict//EN">
<head>
<meta http-equiv="Content-Language" content="en-us">
<title>Title</title>
<base target="wb_cont">
<style type="text/css">
td.title {
font-family: Arial, Helvetica, sans-serif;
font-size: 16pt;
font-weight: bold;
color: #FFFFFF;
text-align: left;
vertical-align: middle;
}
td.contact {
text-align: center;
vertical-align: middle;
width: 11em;
}
a.contact {
font-family: Arial, Helvetica, sans-serif;
color: #0962BB;
font-size: 9pt;
text-decoration: none;
font-weight: bold;
}
a.contact:hover {
text-decoration: underline;
}
</style>
</head>
<body style="background-color: WB_TITLE_BGCOLOR; margin-left: 3px; margin-right: 3px; margin-top: 2px; margin-bottom: 0; background-image: url('wb_img/title_background.png');">
<table style="width: 100%" cellspacing="0" cellpadding="0">
<tr>
<td style="width: 50px;"><img src="logo.gif"></td>
<td class="title">WB_BAR_TITLE</td>
<td style="width: 3.5em">
<a class="contact" href="ssSearchWB_LNG.html">SimpleSearch</a>
</td>
<td style="width: 11em">
<FORM method=GET action="http://www.google.com/search" style="margin-bottom: 0; margin: 0; text-align: center; ">
<input type=hidden name=ie value=UTF-8>
<input type=hidden name=oe value=UTF-8>
<INPUT TYPE=text name=q size=21 maxlength=255 value=""><br>
<A HREF="http://www.google.com/"><IMG SRC="wb_img/google.gif" border="0" ALT="Google"></A>
<INPUT type=submit name=btnG VALUE="Search" style="height: 21px; vertical-align: top; font-size: x-small;">
<input type=hidden name=domains value="WB_SEARCH_LINK">
<input type=hidden name=sitesearch value="WB_SEARCH_LINK" checked>
<input type=hidden name=sitesearch value="">
</FORM>
</td>
<td class="contact">
<a class="contact" target="_blank" href="WB_COPYRIGHT_LINK"><EFBFBD> WB_COPYRIGHT_NAME</a>
<br>
<a class="contact" href="mailto:WB_CONTACT">(WB_CONTACT)</a>
</td>
</tr>
</table>
</body>
</html>

220
doc/wb/template_wb_tree.html Executable file
View File

@ -0,0 +1,220 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Strict//EN">
<html>
<head>
<meta http-equiv="Content-Language" content="en-us" >
<title>Tree</title>
<base target="wb_cont">
<style type="text/css">
.tree { font-family: helvetica, sans-serif; font-size: 10pt; }
.tree h3 {
margin: 5px 0px 0px 0px;
font-size: 12pt;
}
.tree p { margin: 0px; white-space: nowrap; }
.tree p.sep { margin: 0px; white-space: nowrap; line-height: 8px; font-size: 5px; }
.tree div { display: none; margin: 0px; }
.tree img { vertical-align: middle; }
.tree a.el { text-decoration: none; margin-left: 4px; color: #003366; }
.tree a:hover { text-decoration: none; background-color: #e0e0ff }
</style>
<script type="text/javascript">
lastLink = null;
function hideFolder(folder, id)
{
var imageNode = document.images["img" + id];
if (imageNode != null)
{
var len = imageNode.src.length;
if (imageNode.src.substring(len-8,len-4) == "last")
imageNode.src = "wb_img/plusnodelast.png";
else if (imageNode.src.substring(len-8,len-4) == "node")
imageNode.src = "wb_img/plusnode.png";
}
folder.style.display = "none";
}
function showFolder(folder, id)
{
var imageNode = document.images["img" + id];
if (imageNode != null)
{
var len = imageNode.src.length;
if (imageNode.src.substring(len-8,len-4) == "last")
imageNode.src = "wb_img/minusnodelast.png";
else if (imageNode.src.substring(len-8,len-4) == "node")
imageNode.src = "wb_img/minusnode.png";
}
folder.style.display = "block";
}
function toggleFolder(id)
{
var folder = document.getElementById(id);
if (folder.style.display == "block")
hideFolder(folder, id);
else
showFolder(folder, id);
}
function setFoldersAtLevel(level, show)
{
var i = 1;
do
{
var folder_id = level + "." + i;
var id = "folder" + folder_id;
var folder = document.getElementById(id);
if (folder != null)
{
setFoldersAtLevel(folder_id, show);
if (show)
showFolder(folder, id);
else
hideFolder(folder, id);
}
i++;
} while(folder != null);
}
function showAllFolders()
{
setFoldersAtLevel("", true);
}
function hideAllFolders()
{
setFoldersAtLevel("", false);
}
function getFolderId(name)
{
return name.substring(name.indexOf("folder"), name.length);
}
function showFolderRec(id)
{
var folder = document.getElementById(id);
if (folder != null)
{
showFolder(folder, id);
var parent_id = id.substring(0, id.lastIndexOf("."))
if (parent_id != null && parent_id != "folder")
{
showFolderRec(parent_id)
}
}
}
function clearLastLink()
{
if (lastLink != null)
{
lastLink.style.color = ""
lastLink = null;
}
}
function goToLink(link)
{
var id = getFolderId(link.name);
showFolderRec(id);
location.hash = "#" + link.name;
link.style.color = "#ff0000";
clearLastLink();
lastLink = link;
}
function syncContents()
{
var cur_topic = parent.wb_cont.location.href
for (var i = 0; i < document.links.length; i++)
{
var link = document.links[i];
if (cur_topic == link.href)
{
goToLink(link)
return
}
}
}
function nextContents()
{
var cur_topic = parent.wb_cont.location.href
for (var i = 0; i < document.links.length; i++)
{
var link = document.links[i];
if (cur_topic == link.href)
{
if (i == document.links.length-1)
link = document.links[0];
else
link = document.links[i+1];
goToLink(link)
parent.wb_cont.location.href = link.href;
return
}
}
}
function prevContents()
{
var cur_topic = parent.wb_cont.location.href
var prev_link = document.links[document.links.length-1]
for (var i = 0; i < document.links.length; i++)
{
var link = document.links[i];
if (cur_topic == link.href)
{
if (i == 0)
link = document.links[document.links.length-1];
else
link = document.links[i-1];
goToLink(link)
parent.wb_cont.location.href = link.href;
return
}
}
}
function showStartPage()
{
var full_url = parent.document.URL;
if (full_url == null)
return;
var param = full_url.substring(full_url.indexOf("?") + 1, full_url.length);
if (param == null)
return;
var param_url = param.substring(param.indexOf("url=") + 4, param.length);
if (param_url == null)
return;
var param_len = param_url.length;
for (var i = 0; i < document.links.length; i++)
{
var link = document.links[i];
var link_url = link.href.substring(link.href.length-param_len, link.href.length)
if (link_url == param_url)
{
goToLink(link)
parent.wb_cont.location.href = link.href;
return
}
}
}
</script>
</head>
<body style="margin: 2px; background-color: #F1F1F1" onload="showStartPage()">
<div class="tree" onmouseout="clearLastLink()">

29
doc/wb/wb2hh.bat Executable file
View File

@ -0,0 +1,29 @@
@echo off
Echo Building...
lua5.1 make_hh.lua %1
Echo .
pause
Echo Preparing...
move wb_%1.hhp ..
move wb_tree_%1.hhc ..
cd ..
move download download.old
Echo .
pause
Echo Compiling...
hhc wb_%1.hhp
Echo .
pause
Echo Finishing...
move wb_%1.hhp wb
move wb_tree_%1.hhc wb
move download.old download
move /y *.chm download
cd wb
Echo .
Echo Done.

1
doc/wb/wb_build.bat Executable file
View File

@ -0,0 +1 @@
@lua5.1 wb_build.lua

364
doc/wb/wb_build.lua Executable file
View File

@ -0,0 +1,364 @@
dofile("wb_usr.lua")
lngCount = nil
lngSuffix = nil
lngIndex = nil
lngNext = nil
linkCount = 1
function readFile(filename)
local file = io.open(filename)
local text = file:read("*a")
file:close()
return text
end
function writeFile(filename, text)
local file = io.open(filename, "w")
file:write(text)
file:close()
end
-- #####################################################################
htmlFiles = {}
function addHtmlFile(v)
if v then
-- only up to "#"
local j = string.find(v, "#")
if j then
f = string.sub(v, 0, j-1)
else
f = v
end
htmlFiles[f] = f
end
end
-- #####################################################################
function writeIndexFile()
print("Writing \"../index"..lngSuffix..".html\".")
local wb_index = readFile("template_index.html")
wb_index = string.gsub(wb_index, "WB_TITLE", wb_usr.messages[lngIndex].title)
wb_index = string.gsub(wb_index, "WB_START_SIZE", wb_usr.start_size)
wb_index = string.gsub(wb_index, "WB_START_PAGE", lngIndex.."/"..wb_usr.tree.link)
if (lngCount > 1) then
wb_index = string.gsub(wb_index, "WB_LNG", lngSuffix)
else
wb_index = string.gsub(wb_index, "WB_LNG", "")
end
writeFile("../index"..lngSuffix..".html", wb_index)
end
-- #####################################################################
function writeTitleFile()
print("Writing \"../wb_title"..lngSuffix..".html\".")
local wb_title = readFile("template_wb_title.html")
wb_title = string.gsub(wb_title, "WB_BAR_TITLE", wb_usr.messages[lngIndex].bar_title)
wb_title = string.gsub(wb_title, "WB_TITLE_BGCOLOR", wb_usr.title_bgcolor)
wb_title = string.gsub(wb_title, "WB_SEARCH_LINK", wb_usr.search_link)
wb_title = string.gsub(wb_title, "WB_COPYRIGHT_LINK", wb_usr.copyright_link)
wb_title = string.gsub(wb_title, "WB_COPYRIGHT_NAME", wb_usr.copyright_name)
wb_title = string.gsub(wb_title, "WB_CONTACT", wb_usr.contact)
if (lngCount > 1) then
wb_title = string.gsub(wb_title, "WB_LNG", lngSuffix)
else
wb_title = string.gsub(wb_title, "WB_LNG", "")
end
writeFile("../wb_title"..lngSuffix..".html", wb_title)
end
-- #####################################################################
function writeIndent(file, level)
-- base identation
file:write(" ")
for i = 1, level*2, 1 do
file:write(" ")
end
end
function getNodeName(node)
local name = nil
if (node.name[lngIndex]) then
name = node.name[lngIndex]
else
name = node.name["nl"]
end
if not name then
error("Name not found.")
end
return name
end
function writeNode(file, node, opened, level, folder_index, folder_suffix, node_suffix, child_prefix)
if (node.folder) then -- folder
-- box image
writeIndent(file, level)
file:write("<p>")
folder_suffix = folder_suffix .. "." .. folder_index
file:write(child_prefix.."<img name=\"imgfolder"..folder_suffix.."\" ")
if (opened) then
file:write("src=\"wb_img/minusnode"..node_suffix..".png\" ")
else
file:write("src=\"wb_img/plusnode"..node_suffix..".png\" ")
end
file:write("onclick=\"toggleFolder('folder"..folder_suffix.."')\">")
if (node.link) then
file:write("<a name=\"link"..linkCount.."folder"..folder_suffix.."\" class=\"el\" href=\""..lngIndex.."/"..node.link.."\">"..getNodeName(node).."</a>")
addHtmlFile(node.link)
linkCount = linkCount + 1
else
file:write(" "..getNodeName(node))
end
file:write("</p>\n")
-- folder div
writeIndent(file, level)
if (opened) then
file:write("<div id=\"folder"..folder_suffix.."\" style=\"display:block\">\n")
else
file:write("<div id=\"folder"..folder_suffix.."\">\n")
end
local n = #(node.folder)
local next_folder_index = 0
local next_node_suffix = ""
local next_child_prefix = "<img src=\"wb_img/vertline.png\">"
if (node_suffix == "last") then
next_child_prefix = "<img src=\"wb_img/blank.png\">"
end
for i = 1, n, 1 do
if (i == n) then
next_node_suffix = "last"
end
if (node.folder[i].folder) then
next_folder_index = next_folder_index + 1
end
writeNode(file, node.folder[i], false, level+1, next_folder_index, folder_suffix, next_node_suffix, child_prefix..next_child_prefix)
end
writeIndent(file, level)
file:write("</div>\n")
else -- leaf
if (node.link and node.link ~= "") then -- normal leaf
writeIndent(file, level)
file:write("<p>"..child_prefix.."<img src=\"wb_img/node"..node_suffix..".png\"><a class=\"el\" name=\"link"..linkCount.."folder"..folder_suffix.."\" href=\""..lngIndex.."/"..node.link.."\">"..getNodeName(node).."</a></p>\n")
addHtmlFile(node.link)
linkCount = linkCount + 1
else -- separator leaf
writeIndent(file, level)
file:write("<p class=\"sep\">")
local sep_child_prefix = string.gsub(child_prefix, "/vertline", "/sepvertline")
sep_child_prefix = string.gsub(sep_child_prefix, "/blank", "/sepblank")
file:write(sep_child_prefix.."<img src=\"wb_img/sepnode.png\"></p>\n")
end
end
end
function writeTree(file)
-- root node
file:write(" <h3><a name=\"link0folder.0\" class=\"el\" href=\""..lngIndex.."/"..wb_usr.tree.link.."\">"..getNodeName(wb_usr.tree).."</a></h3>\n")
addHtmlFile(wb_usr.tree.link)
local folder = wb_usr.tree.folder
local n = #folder
local node_suffix = ""
local folder_index = 0
for i = 1, n, 1 do
if (i == n) then
node_suffix = "last"
end
if (folder[i].folder) then
folder_index = folder_index + 1
end
if (i == 1 and wb_usr.start_open) then
writeNode(file, folder[i], true, 1, folder_index, "", node_suffix, "")
else
writeNode(file, folder[i], false, 1, folder_index, "", node_suffix, "")
end
end
end
function writeTreeFile()
print("Writing \"../wb_tree"..lngSuffix..".html\".")
local file = io.open("../wb_tree"..lngSuffix..".html", "w")
-- Write Header
local wb_tree = readFile("template_wb_tree.html")
file:write(wb_tree)
-- Write Tree Nodes and Leafs
writeTree(file)
-- Write Footer
file:write(" </div>\n")
file:write("</body>\n")
file:write("</html>\n")
file:close()
end
-- #####################################################################
lngMessages =
{
search= {
en= "Simple Search",
pt= "Busca Simples",
es= "Busca Simples",
},
exp_all= {
en= "Expand All Nodes",
pt= "Expande Todos os N<>s",
es= "Ensanchar Todos Nodos",
},
cont_all= {
en= "Contract All Nodes",
pt= "Contrai Todos os N<>s",
es= "Contrato Todos Nodos",
},
sync= {
en= "Sync Tree with Contents",
pt= "Sincroniza <20>rvore com Conte<74>do",
es= "Sincroniza <20>rbol con el Contenido",
},
lang= {
en= "Switch Language",
pt= "Troca Idioma",
es= "Cambie Idioma",
},
next= {
en= "Next Link",
pt= "Pr<EFBFBD>ximo Link",
es= "Pr<EFBFBD>ximo Link",
},
prev= {
en= "Previous Link",
pt= "Link Anterior",
es= "Link Anterior",
},
}
function writeBarFile()
print("Writing \"../wb_bar"..lngSuffix..".html\".")
local file = io.open("../wb_bar"..lngSuffix..".html", "w")
local wb_bar = readFile("template_wb_bar.html")
wb_bar = string.gsub(wb_bar, "WB_EXPALL_ALT", lngMessages.exp_all[lngIndex])
wb_bar = string.gsub(wb_bar, "WB_CONTALL_ALT", lngMessages.cont_all[lngIndex])
wb_bar = string.gsub(wb_bar, "WB_SYNC_ALT", lngMessages.sync[lngIndex])
wb_bar = string.gsub(wb_bar, "WB_NEXT_ALT", lngMessages.next[lngIndex])
wb_bar = string.gsub(wb_bar, "WB_PREV_ALT", lngMessages.prev[lngIndex])
if (lngCount > 1) then
local lng_button = "<img src=\"wb_img/barlineright.png\">"
lng_button = lng_button .. "<a target=\"_top\" href=\"index_"..lngNext..".html\"><img alt=\""..lngMessages.lang[lngIndex].."\" src=\"wb_img/lng"..lngSuffix..".png\" onmouseover=\"this.src='wb_img/lng"..lngSuffix.."_over.png'\" onmouseout=\"this.src='wb_img/lng"..lngSuffix..".png'\" style=\"border-width: 0px\"></a>"
wb_bar = string.gsub(wb_bar, "WB_LNG_BUTTON", lng_button)
else
wb_bar = string.gsub(wb_bar, "WB_LNG_BUTTON", "")
end
file:write(wb_bar)
file:close()
end
-- #####################################################################
function writeSearchFile()
print("Writing \"../ssSearch"..lngSuffix..".html\".")
local file = io.open("../ssSearch"..lngSuffix..".html", "w")
local wb_search = readFile("template_ssSearch.html")
wb_search = string.gsub(wb_search, "WB_SEARCH", lngMessages.search[lngIndex])
if (lngCount > 1) then
wb_search = string.gsub(wb_search, "WB_LNG", lngSuffix)
else
wb_search = string.gsub(wb_search, "WB_LNG", "")
end
file:write(wb_search)
file:close()
end
function writeSearchIndexFile()
print("Writing \"../wb_search"..lngSuffix..".txt\".")
local file = io.open("../wb_search"..lngSuffix..".txt", "w")
local v = next(htmlFiles, nil)
while v ~= nil do
file:write(lngIndex.."/"..v.."\n")
v = next(htmlFiles, v)
end
file:close()
end
-- #####################################################################
lngCount = 0
local first_name = nil
local prev_elem = nil
for name, elem in pairs(wb_usr.messages) do
if (lngCount == 0) then
first_name = name
end
lngCount = lngCount + 1
if (prev_elem) then
prev_elem.next = name
end
prev_elem = elem
end
prev_elem.next = first_name
print("Building...")
for name, elem in pairs(wb_usr.messages) do
lngIndex = name
lngNext = elem.next
if (lngCount > 1) then
lngSuffix = "_"..lngIndex
else
lngSuffix = ""
end
writeIndexFile()
writeTitleFile()
writeBarFile()
writeTreeFile()
writeSearchFile()
writeSearchIndexFile()
end
print("Done.")

99
doc/wb/wb_usr.lua Executable file
View File

@ -0,0 +1,99 @@
-------------------------------------------------------------------------------
-- eLua Documentation Structure Definition
--
-- This is a config file for the WebBook help html generator
-- More info about WebBook can be found @ http://www.tecgraf.puc-rio.br/webbook
--
--
-------------------------------------------------------------------------------
wb_usr = {
langs = {"en","pt"},
start_size = "200",
contact = "dadosutter@eluaproject.net",
copyright_link = "http://www.eluaproject.net",
search_link = "http://www.eluaproject.net/doc",
copyright_name = "eLua Team",
title_bgcolor = "midnightblue",
file_title = "wb",
start_open = "1"
}
wb_usr.messages = {
pt = {
title = "eLua Doc",
bar_title = "eLua"
},
en = {
title = "eLua Doc",
bar_title = "eLua"
}
}
wb_usr.tree =
{
name= {nl= "eLua API"},
link= "api_doc.html",
folder=
{
{
name= {en= "Modules", pt= "M<EFBFBD>dulos"},
link= "modules_doc.html",
folder=
{
{
name= {en="gpio", pt= "gpio"},
link= "gpio_doc.html"
},
{
name= {en= "term", pt= "term"},
link= "term_doc.html"
},
{
name= {en = "bit", pt = "bit"},
link= "bit_doc.html"
},
{
name= {en = "uart", pt = "uart"},
link= "uart_doc.html"
},
{
name= {en = "spi", pt = "spi"},
link= "spi_doc.html"
},
}
},
{
name= {en = "Reference", pt = "Refer<EFBFBD>ncia"},
link= "ref.html",
folder=
{
name= {en="gpio", pt= "gpio"},
link= "gpio_ref.html",
folder=
{
name={en="gpio.fun1", pt="gpio.fun1"},
link="gpio_ref.html#fun1"
},
{
name= {en= "term", pt= "term"},
link= "gpio_ref.html#fun2"
}
},
{
name= {en = "bit", pt = "bit"},
link= "bit_ref.html",
folder=
{
name={en="bit.fun1", pt="bit.fun1"},
link="bit_ref.html#fun1"
},
{
name={en="bit.fun2", pt="bit.fun2"},
link="bit_ref.html#fun2"
},
},
},
}
}

BIN
doc/wb_img/Thumbs.db Executable file

Binary file not shown.

BIN
doc/wb_img/barlineleft.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 169 B

BIN
doc/wb_img/barlineright.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 165 B

BIN
doc/wb_img/blank.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 219 B

BIN
doc/wb_img/google.gif Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

BIN
doc/wb_img/hideall.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 204 B

BIN
doc/wb_img/hideall_over.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 294 B

BIN
doc/wb_img/lng_en.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 280 B

BIN
doc/wb_img/lng_en_over.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 288 B

BIN
doc/wb_img/lng_es.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 293 B

BIN
doc/wb_img/lng_es_over.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 298 B

BIN
doc/wb_img/lng_pt.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 296 B

BIN
doc/wb_img/lng_pt_over.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 300 B

BIN
doc/wb_img/minusnode.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 227 B

BIN
doc/wb_img/minusnodelast.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 223 B

BIN
doc/wb_img/next.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 330 B

BIN
doc/wb_img/next_over.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 334 B

BIN
doc/wb_img/node.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 248 B

BIN
doc/wb_img/nodelast.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 248 B

BIN
doc/wb_img/plusnode.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 231 B

BIN
doc/wb_img/plusnodelast.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 227 B

BIN
doc/wb_img/previous.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 330 B

BIN
doc/wb_img/previous_over.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 336 B

BIN
doc/wb_img/sepblank.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 209 B

BIN
doc/wb_img/sepnode.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 264 B

BIN
doc/wb_img/sepvertline.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 233 B

BIN
doc/wb_img/showall.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 220 B

BIN
doc/wb_img/showall_over.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 328 B

BIN
doc/wb_img/sync.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 288 B

BIN
doc/wb_img/sync_over.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 348 B

BIN
doc/wb_img/title_background.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

BIN
doc/wb_img/vertline.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 240 B

BIN
doc/wb_img/webbook.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 608 B

BIN
doc/wb_img/webbook_over.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 612 B