26 | 26 |
|
27 | 27 |
-- Penlight compatibility
|
28 | 28 |
utils.unpack = utils.unpack or unpack or table.unpack
|
29 | |
|
30 | 29 |
local append = table.insert
|
31 | |
|
32 | 30 |
local lapp = require 'pl.lapp'
|
|
31 |
|
|
32 |
local version = '1.4.4'
|
33 | 33 |
|
34 | 34 |
-- so we can find our private modules
|
35 | 35 |
app.require_here()
|
36 | 36 |
|
37 | 37 |
--- @usage
|
38 | 38 |
local usage = [[
|
39 | |
ldoc, a documentation generator for Lua, vs 1.4.3
|
|
39 |
ldoc, a documentation generator for Lua, vs ]]..version..[[
|
|
40 |
|
40 | 41 |
-d,--dir (default doc) output directory
|
41 | 42 |
-o,--output (default 'index') output name
|
42 | 43 |
-v,--verbose verbose
|
|
65 | 66 |
--filter (default none) filter output as Lua data (e.g pl.pretty.dump)
|
66 | 67 |
--tags (default none) show all references to given tags, comma-separated
|
67 | 68 |
--fatalwarnings non-zero exit status on any warning
|
|
69 |
--testing reproducible build; no date or version on output
|
|
70 |
|
68 | 71 |
<file> (string) source file or directory containing source
|
69 | 72 |
|
70 | 73 |
`ldoc .` reads options from an `config.ld` file in same directory;
|
|
100 | 103 |
self.fieldname = 'type'
|
101 | 104 |
end
|
102 | 105 |
|
103 | |
|
104 | |
|
105 | 106 |
local lua, cc = lang.lua, lang.cc
|
106 | 107 |
|
107 | 108 |
local file_types = {
|
|
119 | 120 |
------- ldoc external API ------------
|
120 | 121 |
|
121 | 122 |
-- the ldoc table represents the API available in `config.ld`.
|
122 | |
local ldoc = { charset = 'UTF-8' }
|
|
123 |
local ldoc = { charset = 'UTF-8', version = version }
|
123 | 124 |
|
124 | 125 |
local known_types, kind_names = {}
|
125 | 126 |
|
|
237 | 238 |
'unqualified', 'custom_display_name_handler', 'kind_names', 'custom_references',
|
238 | 239 |
'dont_escape_underscore','global_lookup','prettify_files','convert_opt', 'user_keywords',
|
239 | 240 |
'postprocess_html',
|
240 | |
'custom_css',
|
|
241 |
'custom_css','version'
|
241 | 242 |
}
|
242 | 243 |
ldoc_contents = tablex.makeset(ldoc_contents)
|
243 | 244 |
|
|
805 | 806 |
ldoc.project = ldoc.project or args.project
|
806 | 807 |
ldoc.package = args.package:match '%a+' and args.package or nil
|
807 | 808 |
|
808 | |
if os.getenv("SOURCE_DATE_EPOCH") == nil then
|
|
809 |
local source_date_epoch = os.getenv("SOURCE_DATE_EPOCH")
|
|
810 |
if args.testing then
|
|
811 |
ldoc.updatetime = "2015-01-01 12:00:00"
|
|
812 |
ldoc.version = 'TESTING'
|
|
813 |
elseif source_date_epoch == nil then
|
809 | 814 |
if args.date == 'system' then
|
810 | 815 |
ldoc.updatetime = os.date("%Y-%m-%d %H:%M:%S")
|
811 | 816 |
else
|
812 | 817 |
ldoc.updatetime = args.date
|
813 | 818 |
end
|
814 | 819 |
else
|
815 | |
ldoc.updatetime = os.date("!%Y-%m-%d %H:%M:%S",os.getenv("SOURCE_DATE_EPOCH"))
|
|
820 |
ldoc.updatetime = os.date("!%Y-%m-%d %H:%M:%S",source_date_epoch)
|
816 | 821 |
end
|
817 | 822 |
|
818 | 823 |
local html = require 'ldoc.html'
|