2019-06-06 08:06:28 +02:00
|
|
|
local args = ...
|
|
|
|
|
|
|
|
|
2012-11-19 14:57:47 +01:00
|
|
|
-- Configuration file for ldoc
|
2014-05-25 14:35:44 +02:00
|
|
|
|
2012-11-19 14:57:47 +01:00
|
|
|
project='awesome'
|
|
|
|
title='awesome API documentation'
|
2015-06-14 02:35:10 +02:00
|
|
|
description='API documentation for awesome, a highly configurable X window manager (version @AWESOME_VERSION@).'
|
2014-05-19 11:48:23 +02:00
|
|
|
|
|
|
|
-- More on it: https://github.com/stevedonovan/LDoc/blob/master/doc/doc.md#markdown-support
|
2014-05-26 21:26:52 +02:00
|
|
|
format='discount'
|
|
|
|
dir='../doc'
|
2014-05-19 11:48:23 +02:00
|
|
|
|
|
|
|
-- Make the docs prettier
|
|
|
|
pretty='lua'
|
2017-10-21 20:19:00 +02:00
|
|
|
style=true
|
2019-01-04 14:19:21 +01:00
|
|
|
template=true
|
2014-05-19 11:48:23 +02:00
|
|
|
backtick_references=true
|
|
|
|
merge=true
|
2015-06-14 02:35:10 +02:00
|
|
|
use_markdown_titles=true
|
2015-02-20 15:24:26 +01:00
|
|
|
wrap=true
|
2016-12-27 14:17:39 +01:00
|
|
|
full_description = [[
|
|
|
|
Welcome to the documentation for the awesome window manager. Below you find an
|
|
|
|
overview of the individual parts which links to the full documentation.
|
|
|
|
|
|
|
|
If you are a new user, you may want to read @{07-my-first-awesome.md} to get
|
|
|
|
started. In @{05-awesomerc.md}, the default configuration is explained.
|
|
|
|
|
|
|
|
If you already used awesome in the past, @{89-NEWS.md} and @{17-porting-tips.md}
|
|
|
|
should be useful for you.
|
|
|
|
]]
|
2014-05-24 23:25:12 +02:00
|
|
|
topics={
|
2014-05-26 21:26:52 +02:00
|
|
|
'00-authors.md',
|
|
|
|
'01-readme.md',
|
|
|
|
'02-contributing.md',
|
2016-02-10 07:07:47 +01:00
|
|
|
'03-declarative-layout.md',
|
2016-02-10 07:21:29 +01:00
|
|
|
'04-new-widgets.md',
|
2016-08-12 21:18:27 +02:00
|
|
|
'05-awesomerc.md',
|
2016-08-12 08:01:45 +02:00
|
|
|
'06-appearance.md',
|
2016-12-27 13:57:56 +01:00
|
|
|
'07-my-first-awesome.md',
|
2016-06-11 05:53:17 +02:00
|
|
|
'16-using-cairo.md',
|
2016-12-21 03:59:07 +01:00
|
|
|
'17-porting-tips.md',
|
2016-04-30 11:54:16 +02:00
|
|
|
'90-FAQ.md',
|
2016-12-10 05:55:48 +01:00
|
|
|
'89-NEWS.md',
|
2014-05-24 23:25:12 +02:00
|
|
|
}
|
2015-02-15 22:33:23 +01:00
|
|
|
|
2015-07-25 00:00:07 +02:00
|
|
|
-- Setup @client to be an alias for "@tparam client.object"
|
|
|
|
tparam_alias('client', 'client.object')
|
2014-05-19 11:48:23 +02:00
|
|
|
tparam_alias('tag', 'tag')
|
2015-02-15 22:33:23 +01:00
|
|
|
-- Should be default, but is not. Sets up "@tab" => "@tparam table".
|
|
|
|
tparam_alias('tab', 'table')
|
2016-10-02 16:03:11 +02:00
|
|
|
tparam_alias('screen', 'screen')
|
|
|
|
tparam_alias('screen_or_idx', 'screen|int')
|
2016-04-03 08:59:50 +02:00
|
|
|
|
2019-06-07 20:59:34 +02:00
|
|
|
-- The first stereotype are the constructors.
|
|
|
|
new_type("constructorfct", "Constructors", false, "Parameters")
|
2019-10-27 20:39:23 +01:00
|
|
|
new_type("constructorfct2", "ldoc_skip", false, "Parameters")
|
2019-06-06 22:32:53 +02:00
|
|
|
-- Hack to get the functions on top of the signals and properties
|
2019-06-06 07:19:02 +02:00
|
|
|
new_type("function", "Functions", false, "Parameters")
|
2019-06-08 01:08:05 +02:00
|
|
|
-- For "classes", use an explicit type for static functions. This allows
|
|
|
|
-- @function and its implicit cousin to be banned in the CI.
|
|
|
|
new_type("staticfct", "Static module functions", false, "Parameters")
|
2016-04-03 08:59:50 +02:00
|
|
|
-- Documentation for objects properties
|
2019-06-08 04:53:36 +02:00
|
|
|
new_type("property", "Object properties", false, "Type constraints")
|
2019-03-12 19:36:32 +01:00
|
|
|
-- Documentation for objects deprecated properties
|
2019-06-08 04:53:36 +02:00
|
|
|
new_type("deprecatedproperty", "Deprecated object properties", false, "Type constraints")
|
2019-06-06 22:32:53 +02:00
|
|
|
-- Use a custom type for the methods to bypass the faulty ldoc built-in detection.
|
|
|
|
-- (yes, the space after Methods *is* on purpose to avoid clashing with ldoc
|
|
|
|
-- internal "methods" concept)
|
|
|
|
new_type("method", "Object methods ", false, "Parameters")
|
2015-02-27 00:24:23 +01:00
|
|
|
-- New type for signals
|
|
|
|
new_type("signal", "Signals", false, "Arguments")
|
2016-04-25 04:42:32 +02:00
|
|
|
-- New type for signals connections
|
|
|
|
new_type("signalhandler", "Request handlers", false, "Arguments")
|
2016-04-03 08:59:50 +02:00
|
|
|
-- Allow objects to define a set of beautiful properties affecting them
|
2019-06-08 04:53:36 +02:00
|
|
|
new_type("beautiful", "Theme variables", false, "Type constraints")
|
2016-04-03 08:59:50 +02:00
|
|
|
-- Put deprecated methods in their own section
|
2019-06-06 07:19:02 +02:00
|
|
|
new_type("deprecated", "Deprecated functions", false, "Parameters")
|
2016-04-03 08:59:50 +02:00
|
|
|
-- For the legacy stateless layout related functions
|
2019-06-06 07:19:02 +02:00
|
|
|
new_type("legacylayout", "Layout related functions", false, "Parameters")
|
2016-12-10 02:24:22 +01:00
|
|
|
-- Have a category for the client layouts
|
2019-06-06 07:19:02 +02:00
|
|
|
new_type("clientlayout", "Client layouts", false, "Parameters")
|
2018-08-18 22:26:59 +02:00
|
|
|
-- Source functions for the taglist/tasklist/layoutlist
|
|
|
|
new_type("sourcefunction", "List source functions", false)
|
2016-12-30 07:49:04 +01:00
|
|
|
-- Document some callback prototypes
|
|
|
|
new_type("callback", "Callback functions prototype", false, "Parameters")
|
2019-02-24 21:24:58 +01:00
|
|
|
-- gears.matcher / awful.rules sources
|
2019-06-06 07:19:02 +02:00
|
|
|
new_type("rulesources", "Rule sources", false, "Parameters")
|
2019-02-24 21:24:58 +01:00
|
|
|
-- gears.matcher / awful.rules rule components
|
|
|
|
new_type("rulecomponent", "Rule components", false, "Type")
|
2018-08-18 21:47:14 +02:00
|
|
|
-- Filter functions for the taglist/tasklist/layoutlist
|
|
|
|
new_type("filterfunction", "List filters", false)
|
2018-10-07 01:40:36 +02:00
|
|
|
-- Extra client properties available only in awful.rules/spawn constructs
|
|
|
|
new_type("clientruleproperty", "Extra properties available in awful.rules and awful.spawn", false, "Type")
|
2014-05-19 11:48:23 +02:00
|
|
|
|
2019-11-24 09:56:19 +01:00
|
|
|
-- Simulate the default "params" parser format, except the optional "[]" section
|
|
|
|
-- needs a space.
|
|
|
|
local function parse_custom_tags(text, params)
|
|
|
|
text = text:gmatch("[ ]*(.*)$")()
|
|
|
|
local raw_extra = ""
|
|
|
|
|
|
|
|
if text:sub(1,1) == '[' then
|
|
|
|
local count = 1
|
|
|
|
|
|
|
|
-- Find the matching ']'
|
|
|
|
for i=2, text:len() do
|
|
|
|
local char = text:sub(i,i)
|
|
|
|
|
|
|
|
if char == '[' then
|
|
|
|
count = count + 1
|
|
|
|
elseif char == ']' then
|
|
|
|
count = count - 1
|
|
|
|
end
|
|
|
|
|
|
|
|
raw_extra = raw_extra..char
|
|
|
|
|
|
|
|
if count == 0 then
|
|
|
|
text = text:sub(i+2)
|
|
|
|
break
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
-- Split the remaining text into words.
|
|
|
|
local words, values, description = {}, {}, {}
|
|
|
|
|
|
|
|
for word in text:gmatch("[^ \n\r]*") do
|
|
|
|
if word ~= "" then
|
|
|
|
words[#words+1] = word
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
for idx, word in ipairs(words) do
|
|
|
|
if idx <= #params then
|
|
|
|
local name = params[idx].name
|
|
|
|
values[name] = {
|
|
|
|
name = name,
|
|
|
|
title = params[idx].title or name,
|
|
|
|
value = word
|
|
|
|
}
|
|
|
|
else
|
|
|
|
description[#description+1] = word
|
|
|
|
values.description = values.description and
|
|
|
|
values.description.." "..word or
|
|
|
|
word
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
return values
|
|
|
|
end
|
|
|
|
|
|
|
|
-- Mimic the template classes.
|
|
|
|
local function default_format_callback(self, params, _, md)
|
|
|
|
local ret = ""
|
|
|
|
|
|
|
|
if self.table then
|
|
|
|
-- All columns are mandatory
|
|
|
|
for _, p in ipairs(self.params) do
|
|
|
|
local content = params[p.name] and params[p.name].value or ""
|
|
|
|
ret = ret.."<td>"..(p.markdown and md("`"..content.."`") or content).."</td>"
|
|
|
|
end
|
|
|
|
return ret .. "<td>"..md(params.description).."</td>"
|
|
|
|
else
|
|
|
|
if params.name then
|
|
|
|
ret = '<span class="parameter">'..
|
|
|
|
md("`"..params.name.value.."`")..
|
|
|
|
"</span> "
|
|
|
|
end
|
|
|
|
|
|
|
|
if params.type then
|
2019-11-24 09:57:46 +01:00
|
|
|
ret = ret .. '<span class="parameter">('..
|
|
|
|
md("`"..params.type.value.."`")..
|
|
|
|
")</span>"
|
2019-11-24 09:56:19 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
return ret.." "..md(params.description)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
-- Generate a format function.
|
|
|
|
local function default_format(self, callback)
|
|
|
|
return function(raw, item, md)
|
|
|
|
return (callback or default_format_callback)(
|
|
|
|
self, parse_custom_tags(raw, self.params or {}), item, md
|
|
|
|
)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
local named_tags = {}
|
|
|
|
|
|
|
|
-- Add a new @something which can be used in any types.
|
|
|
|
-- @tparam table args
|
|
|
|
-- @tparam string args.name The name.
|
|
|
|
-- @tparam string args.hidden Show in the doc or for internal use only.
|
|
|
|
-- @tparam table args.table Show the items in a table rather than a list. The
|
|
|
|
-- content is the list of header names.
|
|
|
|
-- @tparam table args.params The parameters (table with name, tilte, format).
|
|
|
|
-- @tparam boolean[opt=true] args.auto_subtags Create the usage and tparams subtags.
|
|
|
|
local add_custom_tag
|
|
|
|
add_custom_tag = function(args)
|
|
|
|
local name = args.name
|
|
|
|
|
|
|
|
args.name, args[1] = nil, name
|
|
|
|
|
|
|
|
custom_tags = custom_tags or {}
|
|
|
|
|
|
|
|
local f = args.format
|
|
|
|
|
|
|
|
args.format = default_format(args, f)
|
|
|
|
|
|
|
|
custom_tags[#custom_tags+1] = args
|
|
|
|
named_tags[name] = args
|
|
|
|
|
|
|
|
-- Auto create @name_tparams and @name_usage for each custom tags.
|
|
|
|
if args.auto_subtags ~= false then
|
|
|
|
add_custom_tag {
|
|
|
|
name = name.."tparam",
|
|
|
|
auto_params = true,
|
|
|
|
parent = args,
|
|
|
|
auto_subtags = false,
|
|
|
|
params = {
|
|
|
|
{ name = "type" },
|
|
|
|
{ name = "name" },
|
|
|
|
}
|
|
|
|
}
|
|
|
|
add_custom_tag {
|
|
|
|
name = name.."usage",
|
|
|
|
auto_usage = true,
|
|
|
|
parent = args,
|
|
|
|
auto_subtags = false,
|
|
|
|
}
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2019-11-24 09:57:46 +01:00
|
|
|
-- When a type will request a permission.
|
|
|
|
-- @emits class signal Message[...]
|
|
|
|
add_custom_tag {
|
|
|
|
name = "emits",
|
|
|
|
title = "Emit signals",
|
|
|
|
hidden = false,
|
|
|
|
params = {
|
|
|
|
{
|
|
|
|
name = "name"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-11-24 09:58:32 +01:00
|
|
|
-- List the beautiful variables used by the method or property fllbacks.
|
|
|
|
-- @usebeautiful beautiful.varname usage[...]
|
|
|
|
add_custom_tag {
|
|
|
|
name = "usebeautiful",
|
|
|
|
title = "Consumed theme variables",
|
|
|
|
hidden = false,
|
|
|
|
table = {
|
|
|
|
"Variable", "Usage"
|
|
|
|
},
|
|
|
|
params = {
|
|
|
|
{
|
|
|
|
name = "name",
|
|
|
|
markdown = true,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-02-20 15:24:26 +01:00
|
|
|
-- More fitting section names
|
2017-02-25 21:41:54 +01:00
|
|
|
kind_names={topic='Documentation', module='Libraries', script='Sample files'}
|
2015-02-20 15:24:26 +01:00
|
|
|
|
|
|
|
-- Sort modules alphabetically
|
|
|
|
sort_modules=true
|
|
|
|
|
2019-06-06 08:06:28 +02:00
|
|
|
-- Add more project level (left side index) types.
|
2019-10-01 07:18:15 +02:00
|
|
|
new_type("coreclassmod", "Core_components" , true)
|
2019-10-27 20:39:23 +01:00
|
|
|
new_type("inputmodule" , "Input handling" , true)
|
2019-06-06 08:06:28 +02:00
|
|
|
new_type("widgetmod" , "Widgets" , true)
|
2019-07-09 22:28:42 +02:00
|
|
|
new_type("containermod", "Widget_containers", true)
|
|
|
|
new_type("layoutmod" , "Widget_layouts" , true)
|
|
|
|
new_type("popupmod" , "Popups_and_bars" , true)
|
|
|
|
new_type("utillib" , "Utility_libraries", true)
|
|
|
|
new_type("themelib" , "Theme_related_libraries", true)
|
2019-06-06 08:06:28 +02:00
|
|
|
|
2014-05-19 11:48:23 +02:00
|
|
|
file = {
|
2015-02-27 00:24:23 +01:00
|
|
|
-- C parts of libraries
|
|
|
|
'../dbus.c',
|
|
|
|
'../luaa.c',
|
|
|
|
'../mouse.c',
|
|
|
|
'../mousegrabber.c',
|
|
|
|
'../root.c',
|
|
|
|
'../selection.c',
|
|
|
|
'../spawn.c',
|
|
|
|
'../xkb.c',
|
|
|
|
'../common/luaobject.c',
|
2017-07-02 17:12:12 +02:00
|
|
|
'../objects/client.c',
|
|
|
|
'../objects/drawable.c',
|
|
|
|
'../objects/screen.c',
|
|
|
|
'../objects/tag.c',
|
|
|
|
'../objects/window.c',
|
|
|
|
|
2014-05-24 23:25:12 +02:00
|
|
|
-- LUA libraries
|
2014-05-26 21:26:52 +02:00
|
|
|
'../lib/',
|
2017-02-25 21:41:54 +01:00
|
|
|
-- Auto generated scripts
|
|
|
|
'../script_files/',
|
2014-05-19 11:48:23 +02:00
|
|
|
exclude = {
|
|
|
|
-- exclude these modules, as they do not contain any written
|
|
|
|
-- documentation
|
2014-05-26 21:26:52 +02:00
|
|
|
'../lib/awful/autofocus.lua',
|
|
|
|
'../lib/awful/dbus.lua',
|
2018-12-27 04:26:05 +01:00
|
|
|
'../lib/awful/_compat.lua',
|
2015-02-26 17:48:10 +01:00
|
|
|
'../lib/awful/init.lua',
|
2014-05-26 21:26:52 +02:00
|
|
|
'../lib/awful/remote.lua',
|
2019-06-25 05:57:45 +02:00
|
|
|
'../lib/awful/screen/dpi.lua',
|
2014-05-26 21:26:52 +02:00
|
|
|
'../lib/awful/startup_notification.lua',
|
2019-02-24 23:05:07 +01:00
|
|
|
'../lib/awful/mouse/drag_to_tag.lua',
|
2015-02-26 17:48:10 +01:00
|
|
|
'../lib/gears/init.lua',
|
|
|
|
'../lib/wibox/layout/init.lua',
|
2016-05-23 05:56:45 +02:00
|
|
|
'../lib/wibox/container/init.lua',
|
2017-07-02 04:43:26 +02:00
|
|
|
'../lib/naughty/constants.lua',
|
|
|
|
'../lib/naughty/dbus.lua',
|
2019-06-08 01:08:05 +02:00
|
|
|
'../lib/beautiful/gtk.lua',
|
2014-05-19 11:48:23 +02:00
|
|
|
|
2014-05-20 23:52:08 +02:00
|
|
|
-- Ignore some parts of the widget library
|
2015-02-26 16:05:47 +01:00
|
|
|
'../lib/awful/widget/init.lua',
|
2017-07-02 04:43:26 +02:00
|
|
|
'../lib/naughty/layout/init.lua',
|
2019-03-13 22:22:12 +01:00
|
|
|
'../lib/naughty/widget/init.lua',
|
|
|
|
'../lib/naughty/container/init.lua',
|
|
|
|
'../lib/naughty/list/init.lua',
|
|
|
|
'../lib/naughty/widget/_default.lua',
|
2017-11-19 06:20:56 +01:00
|
|
|
|
2018-12-25 06:49:22 +01:00
|
|
|
-- Ignore components that provide no value to users and have confusing
|
|
|
|
-- names
|
|
|
|
'../objects/button.c',
|
|
|
|
'../objects/key.c',
|
|
|
|
|
2017-11-19 06:20:56 +01:00
|
|
|
-- Deprecated classes for one years or more don't deserve entries
|
|
|
|
-- in the index
|
|
|
|
'../lib/awful/widget/graph.lua',
|
|
|
|
'../lib/awful/widget/progressbar.lua',
|
2019-06-06 10:21:08 +02:00
|
|
|
'../lib/awful/widget/textclock.lua',
|
|
|
|
'../lib/awful/wibox.lua',
|
2017-11-19 06:20:56 +01:00
|
|
|
'../lib/wibox/layout/constraint.lua',
|
|
|
|
'../lib/wibox/layout/margin.lua',
|
|
|
|
'../lib/wibox/layout/mirror.lua',
|
|
|
|
'../lib/wibox/layout/rotate.lua',
|
|
|
|
'../lib/wibox/layout/scroll.lua',
|
|
|
|
'../lib/wibox/widget/background.lua',
|
2014-05-19 11:48:23 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-06-08 06:35:02 +02:00
|
|
|
-- Wrap the module name for the CSS highlight.
|
|
|
|
local function wrap_modname(str, item)
|
|
|
|
if (not item.module) or str:sub(1, #item.module.name+1) ~= item.module.name.."." then return str end
|
|
|
|
|
|
|
|
return "<span class='function_modname'>"..item.module.name..".</span>"
|
|
|
|
.. str:sub(#item.module.name+2, 9999)
|
|
|
|
end
|
|
|
|
|
2019-10-01 07:44:19 +02:00
|
|
|
local named_args = {
|
|
|
|
[ "(args)" ] = true,
|
2019-10-05 23:20:29 +02:00
|
|
|
[ "([args])" ] = true,
|
2019-10-01 07:44:19 +02:00
|
|
|
[ "([args=nil])" ] = true,
|
|
|
|
[ "([args={}])" ] = true
|
|
|
|
}
|
|
|
|
|
2019-11-24 09:56:19 +01:00
|
|
|
local delimiter_for_tag = {
|
|
|
|
usebeautiful = { "table class='widget_list' border=1", "table", "tr", "tr", {"Theme variable", "Usage"}}
|
|
|
|
}
|
|
|
|
|
|
|
|
-- Use the first word of the subtag content to map it to its tag.
|
|
|
|
local function sort_subtags(item, tag, subtag, values)
|
|
|
|
local ret = {}
|
|
|
|
|
|
|
|
for _, value in ipairs(values) do
|
|
|
|
local parsed = parse_custom_tags(value, {{name = "maps_to"}})
|
|
|
|
ret[parsed.maps_to.value] = ret[parsed.maps_to.value] or {}
|
|
|
|
ret[parsed.maps_to.value][#ret[parsed.maps_to.value]+1] = parsed.description
|
|
|
|
end
|
|
|
|
|
|
|
|
return ret
|
|
|
|
end
|
|
|
|
|
|
|
|
-- We have custom types, sub-types and different rendering.
|
|
|
|
--
|
|
|
|
-- To avoid added too much business logic in the template, handle this now.
|
|
|
|
-- Note that this works because the name handler is called when doing the table
|
|
|
|
-- of content, which is before any custom types is used.
|
|
|
|
local function init_custom_types(item)
|
|
|
|
if item.is_init then return end
|
|
|
|
|
|
|
|
item.delims, item.auto_usage, item.auto_params = {}, {}, {}
|
|
|
|
|
|
|
|
local to_rm = {}
|
|
|
|
|
|
|
|
for tag, values in pairs(item.tags) do
|
|
|
|
-- Remove the sub-tags so they don't get rendered as top level ones.
|
|
|
|
if named_tags[tag] and named_tags[tag].auto_usage then
|
|
|
|
item.auto_usage[tag] = sort_subtags(
|
|
|
|
item, named_tags[tag].parent, named_tags[tag], values
|
|
|
|
)
|
|
|
|
to_rm[#to_rm+1] = tag
|
|
|
|
elseif named_tags[tag] and named_tags[tag].auto_params then
|
|
|
|
item.auto_params[tag] = sort_subtags(
|
|
|
|
item, named_tags[tag].parent, named_tags[tag], values
|
|
|
|
)
|
|
|
|
to_rm[#to_rm+1] = tag
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
-- Remove from the top-level tag list.
|
|
|
|
for _, rm in ipairs(to_rm) do
|
|
|
|
item.tags[rm] = nil
|
|
|
|
end
|
|
|
|
|
|
|
|
-- Set the item base class.
|
|
|
|
if item.tags["baseclass"] then
|
|
|
|
item.baseclass = item.tags["baseclass"][1]
|
|
|
|
end
|
|
|
|
|
|
|
|
if not item.baseclass and item.module then
|
|
|
|
item.baseclass = item.module.name
|
|
|
|
end
|
|
|
|
|
|
|
|
-- Some methods and properties can be inherited from parent classes.
|
|
|
|
-- in those case, they need the explicit `@baseclass` tag.
|
|
|
|
item.inherited = item.baseclass and item.module
|
|
|
|
and item.module.name ~= item.baseclass
|
|
|
|
|
|
|
|
function item.get_delim(tag)
|
|
|
|
if delimiter_for_tag[tag] then
|
|
|
|
return delimiter_for_tag[tag][1],
|
|
|
|
delimiter_for_tag[tag][2],
|
|
|
|
delimiter_for_tag[tag][3],
|
|
|
|
delimiter_for_tag[tag][4],
|
|
|
|
delimiter_for_tag[tag][5]
|
|
|
|
else
|
|
|
|
return "ul", "ul", "li", "li", nil
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
-- Allow the template to fetch the right sub-tags.
|
|
|
|
function item.get_auto_params(tag, value)
|
|
|
|
if not item.auto_params[tag.."tparam"] then return nil, nil end
|
|
|
|
|
|
|
|
local parsed = parse_custom_tags(value, named_tags[tag].params)
|
|
|
|
|
|
|
|
|
|
|
|
if parsed.name and item.auto_params[tag.."tparam"][parsed.name.value] then
|
|
|
|
return item.auto_params[tag.."tparam"][parsed.name.value], named_tags[tag.."tparam"]
|
|
|
|
end
|
|
|
|
|
|
|
|
return nil, nil
|
|
|
|
end
|
|
|
|
|
|
|
|
item.is_init = true
|
|
|
|
end
|
|
|
|
|
2019-06-08 06:35:02 +02:00
|
|
|
-- Wrap the arguments for the CSS highlight.
|
|
|
|
local function wrap_args(item)
|
|
|
|
if not item.args then return "" end
|
2019-10-01 07:44:19 +02:00
|
|
|
|
|
|
|
-- Display named args with `{}` and ordered args with `()`
|
|
|
|
if named_args[item.args] then
|
|
|
|
return "<span class='function_named_args'><b>{</b>[args]<b>}</b></span>"
|
|
|
|
end
|
|
|
|
|
2019-10-05 23:20:29 +02:00
|
|
|
local new_args = item.args:sub(2, item.args:len()-1)
|
2019-10-01 07:44:19 +02:00
|
|
|
|
|
|
|
return "<span class='function_args'> <b>(</b>"..new_args.."<b>)</b></span>"
|
2019-06-08 06:35:02 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
|
2019-06-06 22:32:53 +02:00
|
|
|
-- Mimics the ldoc built-in method style, but better.
|
|
|
|
--
|
|
|
|
-- This custom renderer exists because using ldoc built-in method detection
|
|
|
|
-- turned out to be too unreliable and upstream is dead.
|
|
|
|
local function render_methods(item)
|
|
|
|
local ret = item.name
|
|
|
|
|
|
|
|
-- Some methods will have it depending on the weather. Most wont.
|
|
|
|
if not ret:find(":") then
|
|
|
|
ret = ":"..ret
|
|
|
|
end
|
|
|
|
|
2019-06-08 06:35:02 +02:00
|
|
|
return ret .. " " .. wrap_args(item)
|
2019-06-06 22:32:53 +02:00
|
|
|
end
|
|
|
|
|
2019-06-08 04:53:36 +02:00
|
|
|
-- Parse the magic parameters to type concention in something the template eats.
|
|
|
|
local function sanitize_type(item, ldoc)
|
|
|
|
|
|
|
|
for parm in ldoc.modules.iter(item.params) do
|
|
|
|
local t = item:type_of_param(parm)
|
|
|
|
|
|
|
|
-- Remove the value.
|
|
|
|
t = t:gsub("(\\[[^\\]]])","")
|
|
|
|
t = t:gsub("?","")
|
|
|
|
|
|
|
|
-- Add " or " between alternatives
|
|
|
|
t = t:gsub("|"," <i>or</i> ")
|
|
|
|
|
|
|
|
-- Fallback.
|
|
|
|
t = t == "" and parm or t
|
|
|
|
t = t == "" and "N/A" or t
|
|
|
|
|
|
|
|
item.display_type = "<span class='summary_type'>"..t.."</span>"
|
|
|
|
|
|
|
|
-- There is no value in repeating the type a second time.
|
|
|
|
if item.params.map[parm] == "" then
|
|
|
|
item.hide_params = true
|
|
|
|
end
|
|
|
|
|
|
|
|
if t ~= "N/A" then return end
|
|
|
|
end
|
|
|
|
|
|
|
|
-- It has to be set, otherwise the table will have different col count.
|
|
|
|
item.display_type = "<span class='summary_type'>N/A</span>"
|
|
|
|
end
|
2018-10-07 01:40:36 +02:00
|
|
|
local no_prefix = {
|
2019-03-12 19:36:32 +01:00
|
|
|
property = true, signal = true, clientruleproperty = true,
|
|
|
|
deprecatedproperty = true,
|
2018-10-07 01:40:36 +02:00
|
|
|
}
|
|
|
|
|
2019-06-06 10:21:08 +02:00
|
|
|
-- These modules merge the doc of their `awful` siblings.
|
|
|
|
local coreclassmap = {
|
|
|
|
tag = "tag<span class='listplusign'> and awful.tag</span>",
|
|
|
|
screen = "screen<span class='listplusign'> and awful.screen</span>",
|
|
|
|
client = "client<span class='listplusign'> and awful.client</span>",
|
|
|
|
mouse = "mouse<span class='listplusign'> and awful.mouse</span>",
|
|
|
|
}
|
|
|
|
|
2019-06-08 01:08:05 +02:00
|
|
|
-- Add the full module name in front.
|
|
|
|
local add_mod = {
|
2019-10-27 20:39:23 +01:00
|
|
|
["function"] = true,
|
|
|
|
constructorfct = true,
|
|
|
|
constructorfct2 = true,
|
|
|
|
staticfct = true,
|
|
|
|
deprecated = true,
|
|
|
|
field = true,
|
2019-06-08 01:08:05 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
-- Add the arguments.
|
|
|
|
local add_args = {
|
2019-10-27 20:39:23 +01:00
|
|
|
constructorfct = true,
|
|
|
|
constructorfct2 = true,
|
|
|
|
staticfct = true,
|
2019-06-08 01:08:05 +02:00
|
|
|
}
|
|
|
|
|
2019-06-08 04:53:36 +02:00
|
|
|
-- Add a type column to the summary and type field in the description.
|
|
|
|
local display_type = {
|
|
|
|
property = true,
|
|
|
|
beautiful = true,
|
|
|
|
field = true,
|
|
|
|
deprecatedproperty = true,
|
|
|
|
}
|
|
|
|
|
2019-06-23 00:00:40 +02:00
|
|
|
-- Show return values.
|
|
|
|
local show_return = {
|
2019-10-27 20:39:23 +01:00
|
|
|
["function"] = true,
|
|
|
|
constructorfct = true,
|
|
|
|
constructorfct2 = true,
|
|
|
|
staticfct = true,
|
|
|
|
method = true,
|
|
|
|
deprecated = true,
|
2019-06-23 00:00:40 +02:00
|
|
|
}
|
|
|
|
|
2018-05-28 19:59:22 +02:00
|
|
|
custom_display_name_handler = function(item, default_handler)
|
2019-11-24 09:56:19 +01:00
|
|
|
init_custom_types(item)
|
|
|
|
|
2019-06-08 01:08:05 +02:00
|
|
|
local ret = default_handler(item)
|
|
|
|
|
2019-06-08 04:53:36 +02:00
|
|
|
-- Edit the input so the template is notified.
|
|
|
|
if display_type[item.type] then
|
|
|
|
-- Punch a hole in the sandbox and inject the `ldoc` object.
|
|
|
|
item.sanitize_type = sanitize_type
|
|
|
|
end
|
|
|
|
|
2019-06-23 00:00:40 +02:00
|
|
|
-- LDoc hardcode the "Returns" section for "function" only, fix that.
|
|
|
|
if show_return[item.type] and item.tags["return"] then
|
|
|
|
item.ret = item.tags["return"]
|
|
|
|
item:build_return_groups()
|
|
|
|
end
|
|
|
|
|
2018-05-28 19:59:22 +02:00
|
|
|
-- Remove the "namespace" from the signals and properties
|
2018-10-07 01:40:36 +02:00
|
|
|
if no_prefix[item.type] then
|
2018-05-28 19:59:22 +02:00
|
|
|
local name = item.name:match("%.([^.]+)$")
|
|
|
|
return name ~= "" and name or item.name
|
|
|
|
end
|
|
|
|
|
2019-06-06 10:21:08 +02:00
|
|
|
-- Handle the left sidebar modules.
|
|
|
|
if item.type == "coreclassmod" and coreclassmap[item.name] then
|
|
|
|
return coreclassmap[item.name]
|
|
|
|
end
|
|
|
|
|
2019-06-08 01:08:05 +02:00
|
|
|
-- Undocumented API to make the libraries and classmod "function" section
|
|
|
|
-- more consistent. Right now some have their full awful.foo.bar while other
|
|
|
|
-- have "just" `bar`. Given we use constructors from metatables, we have no
|
|
|
|
-- choice but to use the full function name. It also makes copy/paste easier.
|
2019-06-08 01:17:02 +02:00
|
|
|
if add_mod[item.type] then
|
|
|
|
if (not ret:find(".", 1, true)) and (not ret:find(":", 1, true)) then
|
|
|
|
ret = item.module.name .. "." .. ret
|
|
|
|
elseif item.type == "field" and ret:sub(1, #item.module.name) ~= item.module.name then
|
|
|
|
ret = item.module.name .. "." .. ret
|
|
|
|
end
|
2019-06-08 01:08:05 +02:00
|
|
|
end
|
|
|
|
|
2019-03-12 19:36:32 +01:00
|
|
|
if item.type == "deprecated" or item.type == "deprecatedproperty" then
|
2019-06-08 01:08:05 +02:00
|
|
|
return ret .. "<i class=\"deprecated_label\"> [deprecated]</i>"
|
2018-05-28 20:05:05 +02:00
|
|
|
end
|
|
|
|
|
2019-06-06 22:32:53 +02:00
|
|
|
if item.type == "method" then
|
2019-06-08 06:35:02 +02:00
|
|
|
ret = render_methods(item)
|
2019-06-06 22:32:53 +02:00
|
|
|
end
|
|
|
|
|
2019-06-05 23:25:29 +02:00
|
|
|
|
|
|
|
-- Get rid of the "module:" in front of method names. It is either wrong or
|
|
|
|
-- just redundant.
|
|
|
|
ret = ret:gsub("([^:]*)(:[^:])","%2")
|
|
|
|
|
2019-06-06 07:02:31 +02:00
|
|
|
-- Undocumented API to get rid of `module.rounded_rect` rather than
|
|
|
|
-- `gears.shape.rounded_rect`
|
|
|
|
if ret:sub(1, 7) == "module." and module then
|
|
|
|
return ret:gsub("^module", item.module.name)
|
|
|
|
end
|
|
|
|
|
2019-06-07 20:59:34 +02:00
|
|
|
-- It isn't there by default.
|
2019-06-08 01:08:05 +02:00
|
|
|
if add_args[item.type] then
|
2019-06-08 06:35:02 +02:00
|
|
|
ret = ret .. " " .. wrap_args(item)
|
2019-06-06 07:02:31 +02:00
|
|
|
end
|
|
|
|
|
2019-06-08 06:35:02 +02:00
|
|
|
-- Beautify.
|
|
|
|
ret = wrap_modname(ret, item)
|
|
|
|
|
2019-06-05 23:25:29 +02:00
|
|
|
return ret
|
2018-05-28 19:59:22 +02:00
|
|
|
end
|
|
|
|
|
2015-12-12 17:42:33 +01:00
|
|
|
-- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80
|