diff options
author | 2020-03-31 14:31:00 -0400 | |
---|---|---|
committer | 2020-03-31 14:31:00 -0400 | |
commit | 34e2924793f8271f4cc43b906750775cc96ce021 (patch) | |
tree | dc26a2bcafecb67ac1db340442d048be834e6d4f /modules/lua/tadoc.lua | |
parent | c46527cc32aef6fd332ea5e45757c0858b1cbb5d (diff) | |
download | textadept-34e2924793f8271f4cc43b906750775cc96ce021.tar.gz textadept-34e2924793f8271f4cc43b906750775cc96ce021.zip |
Updated Lua autocompletion and documentation.
Filepaths have a "_HOME" prefix that is expected to be filled in by consumers
(e.g. the experimental ctags module).
Diffstat (limited to 'modules/lua/tadoc.lua')
-rw-r--r-- | modules/lua/tadoc.lua | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/modules/lua/tadoc.lua b/modules/lua/tadoc.lua index 45ebd76c..27af0732 100644 --- a/modules/lua/tadoc.lua +++ b/modules/lua/tadoc.lua @@ -6,6 +6,7 @@ -- To preserve formatting, the included *luadoc.patch* file must be applied to -- your instance of LuaDoc. It will not affect the look of HTML web pages, only -- the look of plain-text output. +-- Also requires LuaFileSystem (lfs) to be installed. -- @usage luadoc -d [output_path] -doclet path/to/tadoc [file(s)] local M = {} @@ -13,6 +14,15 @@ local CTAG = '%s\t%s\t/^%s$/;"\t%s\t%s' local string_format = string.format local lfs = require('lfs') +-- As a special case for Textadept API tags, do not store the local path, but +-- use a `_HOME` prefix that will be filled in by consumers. Do this by making +-- use of a custom command line switch: --ta-home="path/to/ta/home". +local _HOME +for i = 1, #arg do + _HOME = arg[i]:match('^%-%-ta%-home=(.+)$') + if _HOME then _HOME = _HOME:gsub('%p', '%%%0') break end +end + -- Writes a ctag. -- @param file The file to write to. -- @param name The name of the tag. @@ -22,6 +32,7 @@ local lfs = require('lfs') -- Function, t Table, and F Field. -- @param ext_fields The ext_fields for the ctag. local function write_tag(file, name, filename, code, k, ext_fields) + if _HOME then filename = filename:gsub(_HOME, '_HOME') end if ext_fields == 'class:_G' then ext_fields = '' end file[#file + 1] = string_format(CTAG, name, filename, code, k, ext_fields) end |