default template and style sheets now loaded as Lua modules, to get no-fuss LuaRocks install.
This commit is contained in:
parent
226d3d372c
commit
094852da4c
|
@ -1,3 +1,4 @@
|
|||
return [==[
|
||||
/* BEGIN RESET
|
||||
|
||||
Copyright (c) 2010, Yahoo! Inc. All rights reserved.
|
||||
|
@ -281,5 +282,6 @@ ul ol { margin-top: 0px; }
|
|||
.string { color: #8888AA; }
|
||||
.comment { color: #666600; }
|
||||
.prepro { color: #006666; }
|
||||
]==]
|
||||
|
||||
|
|
@ -1,3 +1,4 @@
|
|||
return [==[
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html>
|
||||
|
@ -197,4 +198,5 @@
|
|||
</div> <!-- id="container" -->
|
||||
</body>
|
||||
</html>
|
||||
]==]
|
||||
|
|
@ -1,3 +1,4 @@
|
|||
return [==[
|
||||
/* BEGIN RESET
|
||||
|
||||
Copyright (c) 2010, Yahoo! Inc. All rights reserved.
|
||||
|
@ -273,3 +274,4 @@ dl.table h3, dl.function h3 {font-size: .95em;}
|
|||
.string { color: #8888AA; }
|
||||
.comment { color: #666600; }
|
||||
.prepro { color: #006666; }
|
||||
]==]
|
30
ldoc.lua
30
ldoc.lua
|
@ -14,7 +14,7 @@ local lapp = require 'pl.lapp'
|
|||
app.require_here()
|
||||
|
||||
local args = lapp [[
|
||||
ldoc, a documentation generator for Lua, vs 0.5
|
||||
ldoc, a documentation generator for Lua, vs 0.6
|
||||
-d,--dir (default docs) output directory
|
||||
-o,--output (default 'index') output name
|
||||
-v,--verbose verbose
|
||||
|
@ -118,7 +118,7 @@ end
|
|||
local ldoc_contents = {
|
||||
'alias','add_language_extension','new_type','add_section',
|
||||
'file','project','title','package','format','output','dir','ext',
|
||||
'one','style','description','examples','readme','all','extended_markdown'
|
||||
'one','style','template','description','examples','readme','all','extended_markdown'
|
||||
}
|
||||
ldoc_contents = tablex.makeset(ldoc_contents)
|
||||
|
||||
|
@ -126,6 +126,9 @@ ldoc_contents = tablex.makeset(ldoc_contents)
|
|||
-- handled specially. It will be loaded using 'ldoc' as the environment.
|
||||
local function read_ldoc_config (fname)
|
||||
local directory = path.dirname(fname)
|
||||
if directory == '' then
|
||||
directory = '.'
|
||||
end
|
||||
local err
|
||||
print('reading configuration from '..fname)
|
||||
local txt,not_found = utils.readfile(fname)
|
||||
|
@ -460,11 +463,24 @@ if args.one then
|
|||
ldoc.css = 'ldoc_one.css'
|
||||
end
|
||||
|
||||
-- '!' here means 'use same directory as ldoc.lua
|
||||
local ldoc_html = path.join(ldoc_dir,'html')
|
||||
if args.style == '!' then args.style = ldoc_html end
|
||||
if args.template == '!' then args.template = ldoc_html end
|
||||
|
||||
if args.style == '!' or args.template == '!' then
|
||||
-- '!' here means 'use built-in templates'
|
||||
local tmpdir = path.join(path.is_windows and os.getenv('TMP') or '/tmp','ldoc')
|
||||
if not path.isdir(tmpdir) then
|
||||
lfs.mkdir(tmpdir)
|
||||
end
|
||||
local function tmpwrite (name)
|
||||
utils.writefile(path.join(tmpdir,name),require('html.'..name:gsub('%.','_')))
|
||||
end
|
||||
if args.style == '!' then
|
||||
tmpwrite(ldoc.templ)
|
||||
args.style = tmpdir
|
||||
end
|
||||
if args.template == '!' then
|
||||
tmpwrite(ldoc.css)
|
||||
args.template = tmpdir
|
||||
end
|
||||
end
|
||||
|
||||
-- create the function that renders text (descriptions and summaries)
|
||||
ldoc.markup = markup.create(ldoc, args.format)
|
||||
|
|
|
@ -85,7 +85,7 @@ function html.generate_output(ldoc, args, project)
|
|||
|
||||
local module_template,err = utils.readfile (path.join(args.template,ldoc.templ))
|
||||
if not module_template then
|
||||
quit("template not found. Use -l to specify directory containing ldoc.ltp")
|
||||
quit("template not found at '"..args.template.."' Use -l to specify directory containing ldoc.ltp")
|
||||
end
|
||||
|
||||
local css = ldoc.css
|
||||
|
|
Loading…
Reference in New Issue