Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow passing configuration values #294

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions ldoc.lua
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,9 @@ local file_types = {
------- ldoc external API ------------

-- the ldoc table represents the API available in `config.ld`.
local ldoc = { charset = 'UTF-8', version = version }
local ldoc = { charset = 'UTF-8', version = version}

local config_values = {}

local known_types, kind_names = {}

Expand Down Expand Up @@ -229,6 +231,10 @@ function ldoc.custom_see_handler(pat, handler)
doc.add_custom_see_handler(pat, handler)
end

function ldoc.add_config_value(name, value)
config_values[name] = value
end

local ldoc_contents = {
'alias','add_language_extension','custom_tags','new_type','add_section', 'tparam_alias',
'file','project','title','package','format','output','dir','ext', 'topics',
Expand All @@ -241,7 +247,8 @@ local ldoc_contents = {
'dont_escape_underscore','global_lookup','prettify_files','convert_opt', 'user_keywords',
'postprocess_html',
'custom_css','version',
'no_args_infer'
'no_args_infer',
'add_config_value'
}
ldoc_contents = tablex.makeset(ldoc_contents)

Expand Down Expand Up @@ -810,6 +817,7 @@ ldoc.modules = module_list
ldoc.title = ldoc.title or args.title
ldoc.project = ldoc.project or args.project
ldoc.package = args.package:match '%a+' and args.package or nil
ldoc.config = config_values

local source_date_epoch = os.getenv("SOURCE_DATE_EPOCH")
if args.testing then
Expand Down