aboutsummaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
Diffstat (limited to 'modules')
-rw-r--r--modules/cpp/init.lua10
-rw-r--r--modules/lua/adeptsensedoc.lua86
-rw-r--r--modules/lua/init.lua10
-rw-r--r--modules/lua/lua.luadoc26
-rw-r--r--modules/textadept/adeptsense.lua22
-rw-r--r--modules/textadept/bookmarks.lua8
-rw-r--r--modules/textadept/command_entry.lua8
-rw-r--r--modules/textadept/editing.lua35
-rw-r--r--modules/textadept/filter_through.lua13
-rw-r--r--modules/textadept/find.lua38
-rw-r--r--modules/textadept/keys.lua2
-rw-r--r--modules/textadept/menu.lua3
-rw-r--r--modules/textadept/mime_types.lua5
-rw-r--r--modules/textadept/run.lua5
-rw-r--r--modules/textadept/session.lua14
-rw-r--r--modules/textadept/snapopen.lua20
-rw-r--r--modules/textadept/snippets.lua7
17 files changed, 156 insertions, 156 deletions
diff --git a/modules/cpp/init.lua b/modules/cpp/init.lua
index 1d26bf31..a63ad0e8 100644
--- a/modules/cpp/init.lua
+++ b/modules/cpp/init.lua
@@ -8,9 +8,7 @@ local M = {}
-- It provides utilities for editing C/C++ code.
-- User tags are loaded from `_USERHOME/modules/cpp/tags` and user apis are
-- loaded from `_USERHOME/modules/cpp/api`.
-module('_M.cpp')]]
-
--- Markdown:
+--
-- ## Key Commands
--
-- + `Ctrl+L, M` (`⌘L, M` on Mac OSX)
@@ -23,11 +21,9 @@ module('_M.cpp')]]
-- and functions.
-- + `Shift+Return` (`⇧↩`)
-- Add ';' to line end and insert newline.
---
--- ## Fields
---
--- * `sense`
+-- @field sense
-- The C/C++ [Adeptsense](_M.textadept.adeptsense.html).
+module('_M.cpp')]]
local m_editing, m_run = _M.textadept.editing, _M.textadept.run
-- Comment string tables use lexer names.
diff --git a/modules/lua/adeptsensedoc.lua b/modules/lua/adeptsensedoc.lua
index 89379ea6..11d89396 100644
--- a/modules/lua/adeptsensedoc.lua
+++ b/modules/lua/adeptsensedoc.lua
@@ -40,16 +40,35 @@ local function write_apidoc(file, m, b)
-- Block documentation for the function or field.
local doc = {}
-- Function arguments or field type.
+ local class = b.class
local header = name
- if b.class == 'function' then
+ if class == 'function' then
header = header..(b.param and '('..table.concat(b.param, ', ')..')' or '')
+ elseif class == 'field' and b.description:find('^%s*%b()') then
+ header = header..' '..b.description:match('^%s*(%b())')
+ elseif class == 'module' or class == 'table' then
+ header = header..' ('..class..')'
end
- if b.modifier and b.modifier ~= '' then header = header..' '..b.modifier end
doc[#doc + 1] = header
-- Function or field description.
- doc[#doc + 1] = b.description:gsub('\\n', '\\\\n')
+ local description = b.description
+ if class == 'module' then
+ -- Modules usually have additional Markdown documentation so just grab the
+ -- documentation before a Markdown header.
+ description = description:match('^(.-)[\r\n]+#') or description
+ elseif class == 'field' then
+ -- Type information is already in the header; discard it in the description.
+ description = description:match('^%s*%b()[\t ]*[\r\n]*(.+)$') or description
+ -- Strip consistent leading whitespace.
+ local indent
+ indent, description = description:match('^(%s*)(.*)$')
+ if indent ~= '' then description = description:gsub('\n'..indent, '\n') end
+ end
+ doc[#doc + 1] = description:gsub('\\n', '\\\\n')
+ :gsub('%[([^%]]+)%]%b[]', '%1') -- Markdown links
+ :gsub('%[([^%]]+)%]%b()', '%1') -- Markdown links
-- Function parameters (@param).
- if b.class == 'function' and b.param then
+ if class == 'function' and b.param then
for _, p in ipairs(b.param) do
if b.param[p] and #b.param[p] > 0 then
doc[#doc + 1] = '@param '..p..' '..b.param[p]:gsub('\\n', '\\\\n')
@@ -57,7 +76,7 @@ local function write_apidoc(file, m, b)
end
end
-- Function usage (@usage).
- if b.class == 'function' and b.usage then
+ if class == 'function' and b.usage then
if type(b.usage) == 'string' then
doc[#doc + 1] = '@usage '..b.usage
else
@@ -65,7 +84,7 @@ local function write_apidoc(file, m, b)
end
end
-- Function returns (@return).
- if b.class == 'function' and b.ret then
+ if class == 'function' and b.ret then
if type(b.ret) == 'string' then
doc[#doc + 1] = '@return '..b.ret
else
@@ -92,10 +111,10 @@ function M.start(doc)
-- local profiler = require 'profiler'
-- profiler.start()
- local modules = doc.modules
+ local modules, files = doc.modules, doc.files
-- Convert module functions in the Lua luadoc into LuaDoc modules.
- local lua_luadoc = doc.files['../modules/lua/lua.luadoc']
+ local lua_luadoc = files['../modules/lua/lua.luadoc']
if lua_luadoc then
for _, f in ipairs(lua_luadoc.functions) do
f = lua_luadoc.functions[f]
@@ -113,45 +132,50 @@ function M.start(doc)
end
end
+ -- Create a map of file names to doc objects so their module names can be
+ -- determined.
+ local filedocs = {}
+ for _, name in ipairs(files) do filedocs[name] = files[name].doc end
+
-- Parse out module fields (-- * `FIELD`: doc) and insert them into the
-- module's LuaDoc.
- for _, file in ipairs(doc.files) do
+ for _, file in ipairs(files) do
local module_name, field, docs
+ local module_doc = filedocs[file][1]
+ if module_doc and module_doc.class == 'module' then
+ module_name = module_doc.name
+ modules[module_name].fields = module_doc.field
+ elseif module_doc then
+ print('[WARN] '..file..' has no module declaration')
+ end
-- Adds the field to its module's LuaDoc.
local function add_field()
local doc = table.concat(docs, '\n')
- doc = doc:gsub('%[([^%]]+)%]%b[]', '%1'):gsub('%[([^%]]+)%]%b()', '%1')
field.description = doc
local m = modules[field.module]
if not m then
local name = field.module
- _G.print("Module '"..name.."' does not exist. Faking...")
+ print('[INFO] module `'..name..'\' does not exist. Faking...')
m = { name = name, functions = {}, fake = true }
modules[#modules + 1] = name
modules[name] = m
end
if not m.fields then m.fields = {} end
m.fields[#m.fields + 1] = field.name
- m.fields[field.name] = field
+ m.fields[field.name] = field.description
field = nil
end
local f = io.open(file, 'rb')
for line in f:lines() do
- if not field and line:find('^module%(') then
- -- Get the module's name to add the parsed fields to.
- module_name = line:match("^module%('([^']+)'")
- elseif line:find('^%-%- %* `') then
+ if line:find('^%-%- %* `') then
-- New field; if another field was parsed right before this one, add
-- the former field to its module's LuaDoc.
if field then add_field() end
field, docs = {}, {}
- local name, doc = line:match('^%-%- %* `([^`]+)`([^\r\n]*)')
+ local name, doc = line:match('^%-%- %* `([^`]+)`%s*([^\r\n]*)')
field.module = name:match('^_G%.(.-)%.[^%.]+$') or module_name or
name:match('^[^%.]+')
field.name = name:match('[^%.]+$')
- if doc ~= '' then
- field.modifier, doc = doc:match('^%s*([^:]*):?%s*(.*)$')
- end
if doc ~= '' then docs[#docs + 1] = doc end
elseif field and line:find('^%-%-%s+[^\r\n]+') then
docs[#docs + 1] = line:match('^%-%-%s%s%s(%s*[^\r\n]+)')
@@ -180,7 +204,7 @@ function M.start(doc)
-- Tag the module as a global table.
write_tag(ctags, module, 't', '')
end
- m.modifier = '[module]'
+ m.class = 'module'
write_apidoc(apidoc, { name = '_G' }, m)
end
-- Tag the functions and write the apidoc.
@@ -195,32 +219,38 @@ function M.start(doc)
local table = m.tables[t]
local module = module -- define locally so any modification stays local
if t:find('^_G%.') then module, t = t:match('^_G%.(.-)%.?([^%.]+)$') end
- if not module then _G.print(table.name) end
+ if not module then print(table.name) end
local ext_fields = module == '_G' and '' or 'class:'..module
write_tag(ctags, t, 't', ext_fields)
- table.modifier = '[table]'
write_apidoc(apidoc, m, table)
-- Tag the fields of the tables.
t = module..'.'..t
for _, f in ipairs(table.field or {}) do
write_tag(ctags, f, 'F', 'class:'..t)
- write_apidoc(apidoc, { name = t },
- { name = f, description = table.field[f] })
+ write_apidoc(apidoc, { name = t }, {
+ name = f,
+ description = table.field[f],
+ class = 'table'
+ })
end
end
-- Tag the fields.
for _, f in ipairs(m.fields or {}) do
local ext_fields = module == '_G' and '' or 'class:'..module
write_tag(ctags, f, 'F', ext_fields)
- write_apidoc(apidoc, m, m.fields[f])
+ write_apidoc(apidoc, { name = f }, {
+ name = module..'.'..f,
+ description = m.fields[f],
+ class = 'field'
+ })
end
end
table.sort(ctags)
table.sort(apidoc)
- local f = io.open(M.options.output_dir..'/tags', 'w')
+ local f = io.open(M.options.output_dir..'/tags', 'wb')
f:write(table.concat(ctags, '\n'))
f:close()
- f = io.open(M.options.output_dir..'api', 'w')
+ f = io.open(M.options.output_dir..'api', 'wb')
f:write(table.concat(apidoc, '\n'))
f:close()
diff --git a/modules/lua/init.lua b/modules/lua/init.lua
index 235a7e8c..173398ac 100644
--- a/modules/lua/init.lua
+++ b/modules/lua/init.lua
@@ -8,9 +8,7 @@ local M = {}
-- It provides utilities for editing Lua code.
-- User tags are loaded from `_USERHOME/modules/lua/tags` and user apis are
-- loaded from `_USERHOME/modules/lua/api`.
-module('_M.lua')]]
-
--- Markdown:
+--
-- ## Key Commands
--
-- + `Ctrl+L, M` (`⌘L, M` on Mac OSX)
@@ -25,11 +23,9 @@ module('_M.lua')]]
-- + `:`
-- When to the right of a known symbol, show an autocompletion list of
-- functions only.
---
--- ## Fields
---
--- * `sense`
+-- @field sense
-- The Lua [Adeptsense](_M.textadept.adeptsense.html).
+module('_M.lua')]]
local m_editing, m_run = _M.textadept.editing, _M.textadept.run
-- Comment string tables use lexer names.
diff --git a/modules/lua/lua.luadoc b/modules/lua/lua.luadoc
index 22551dfb..a288c6c9 100644
--- a/modules/lua/lua.luadoc
+++ b/modules/lua/lua.luadoc
@@ -59,7 +59,7 @@ function dofile([filename]) end
-- message.
function error(message [, level]) end
--- * `_G._G`
+-- * `_G._G` (table)
-- A global variable (not a function) that holds the global environment
-- (see §2.2). Lua itself does not use this variable; changing its value does
-- not affect any environment, nor vice-versa.
@@ -235,7 +235,7 @@ function tostring(v) end
-- "`table`", "`function`", "`thread`", and "`userdata`".
function type(v) end
--- * `_G._VERSION` [string]
+-- * `_G._VERSION` (string)
-- A global variable (not a function) that holds a string containing the
-- current interpreter version. The current contents of this variable is
-- "`Lua 5.2`".
@@ -322,7 +322,7 @@ function coroutine.yield(···) end
-- any loader for the module, then `require` raises an error.
function require(modname) end
--- * `package.config`
+-- * `package.config` (string)
-- A string describing some compile-time configurations for packages. This
-- string is a sequence of lines:
-- The first line is the directory separator string. Default is '`\`' for
@@ -336,14 +336,14 @@ function require(modname) end
-- The fifth line is a mark to ignore all text before it when building the
-- `luaopen_` function name. Default is '`-`'.
--- * `package.cpath`
+-- * `package.cpath` (string)
-- The path used by `require` to search for a C loader.
-- Lua initializes the C path `package.cpath` in the same way it initializes
-- the Lua path `package.path`, using the environment variable `LUA_CPATH_5_2`
-- or the environment variable `LUA_CPATH` or a default path defined in
-- `luaconf.h`.
--- * `package.loaded`
+-- * `package.loaded` (table)
-- A table used by `require` to control which modules are already loaded. When
-- you require a module `modname` and `package.loaded[modname]` is not false,
-- `require` simply returns the value stored there.
@@ -371,7 +371,7 @@ function require(modname) end
-- systems that support the `dlfcn` standard).
function package.loadlib(libname, funcname) end
--- * `package.path`
+-- * `package.path` (string)
-- The path used by `require` to search for a Lua loader.
-- At start-up, Lua initializes this variable with the value of the
-- environment variable `LUA_PATH_5_2` or the environment variable `LUA_PATH`
@@ -379,12 +379,12 @@ function package.loadlib(libname, funcname) end
-- variables are not defined. Any "`;;`" in the value of the environment
-- variable is replaced by the default path.
--- * `package.preload`
+-- * `package.preload` (table)
-- A table to store loaders for specific modules (see `require`).
-- This variable is only a reference to the real table; assignments to this
-- variable do not change the table used by `require`.
--- * `package.searchers`
+-- * `package.searchers` (table)
-- A table used by `require` to control how to load modules.
-- Each entry in this table is a *searcher function*. When looking for a
-- module, `require` calls each of these searchers in ascending order, with
@@ -725,7 +725,7 @@ function math.fmod(x, y) end
-- absolute value of `m` is in the range *[0.5, 1)* (or zero when `x` is zero).
function math.frexp(x) end
--- * `math.huge`
+-- * `math.huge` (number)
-- The value `HUGE_VAL`, a value larger than or equal to any other numerical
-- value.
@@ -751,7 +751,7 @@ function math.min(x, ···) end
-- `x`.
function math.modf(x) end
--- * `math.pi`
+-- * `math.pi` (number)
-- The value of 'π'.
---
@@ -963,11 +963,11 @@ function io.popen(prog [, mode]) end
-- Equivalent to `io.input():read(···)`.
function io.read(···) end
--- * `io.stderr`
+-- * `io.stderr` (file)
-- Standard error.
--- * `io.stdin`
+-- * `io.stdin` (file)
-- Standard in.
--- * `io.stdout`
+-- * `io.stdout` (file)
-- Standard out.
---
diff --git a/modules/textadept/adeptsense.lua b/modules/textadept/adeptsense.lua
index b1004fd2..7e3d7449 100644
--- a/modules/textadept/adeptsense.lua
+++ b/modules/textadept/adeptsense.lua
@@ -5,9 +5,7 @@ local M = {}
--[[ This comment is for LuaDoc.
---
-- Language autocompletion support for the textadept module.
-module('_M.textadept.adeptsense')]]
-
--- Markdown:
+--
-- ## Overview
--
-- Adeptsense is a form of autocompletion for programming. It has the means to
@@ -142,7 +140,7 @@ module('_M.textadept.adeptsense')]]
-- in your shell. Since Adeptsense only cares about classes, functions, and
-- fields, you need to let it know which kind of tag is which. Unfortunately,
-- Lua support in Ctags is not good at all. Instead, Textadept has a utility
--- (`scripts/adeptsensedoc.lua`) to generate a fake set of tags that is more
+-- (`modules/lua/adeptsensedoc.lua`) to generate a fake set of tags that is more
-- useful. Functions are tagged `'f'` and should be recognized as such; table
-- keys are tagged `'t'` and should be recognized as fields; module fields,
-- `'F'`, should be fields; and modules, `'m'`, should be classes:
@@ -201,7 +199,7 @@ module('_M.textadept.adeptsense')]]
-- characters for an Adeptsense is sufficient for most static and some dynamic
-- languages. The rest of this document is devoted to more complex techniques.
--
--- ### Overriding Adeptsense Functions
+-- ### Fine-Tuning
--
-- Sometimes Adeptsense's default behavior is not sufficient. Maybe the
-- `type_declarations` and `type_assignments` tables used by the
@@ -343,22 +341,16 @@ module('_M.textadept.adeptsense')]]
-- [`load_ctags()`](#load_ctags) and [`api_files`](#api_files) respectively.
--
-- [LuaDoc]: http://keplerproject.github.com/luadoc/
---
--- ### Other Adeptsense Settings
---
--- * `always_show_globals` [bool]
+-- @field always_show_globals (bool)
-- Include globals in the list of completions offered.
-- Globals are classes, functions, and fields that do not belong to another
-- class. They are contained in `completions['']`. The default value is
-- `true`.
-
---
--- ## Settings
---
--- * `FUNCTIONS` [string]
+-- @field FUNCTIONS (string)
-- XPM image for Adeptsense functions.
--- * `FIELDS` [string]
+-- @field FIELDS (string)
-- XPM image for Adeptsense fields.
+module('_M.textadept.adeptsense')]]
local senses = {}
diff --git a/modules/textadept/bookmarks.lua b/modules/textadept/bookmarks.lua
index 33fcf0e9..4219da58 100644
--- a/modules/textadept/bookmarks.lua
+++ b/modules/textadept/bookmarks.lua
@@ -5,13 +5,9 @@ local M = {}
--[[ This comment is for LuaDoc.
---
-- Bookmarks for the textadept module.
-module('_M.textadept.bookmarks')]]
-
--- Markdown:
--- ## Settings
---
--- * `MARK_BOOKMARK_COLOR` [number]
+-- @field MARK_BOOKMARK_COLOR (number)
-- The color used for a bookmarked line in `0xBBGGRR` format.
+module('_M.textadept.bookmarks')]]
M.MARK_BOOKMARK_COLOR = 0xB3661A
diff --git a/modules/textadept/command_entry.lua b/modules/textadept/command_entry.lua
index 5483ffa9..0ae836c4 100644
--- a/modules/textadept/command_entry.lua
+++ b/modules/textadept/command_entry.lua
@@ -4,13 +4,9 @@
--[[ This comment is for LuaDoc.
---
-- Textadept's Command entry.
-module('gui.command_entry')]]
-
--- Markdown:
--- ## Fields
---
--- * `entry_text` [string]
+-- @field entry_text (string)
-- The text in the entry.
+module('gui.command_entry')]]
-- Environment for abbreviated commands.
-- @class table
diff --git a/modules/textadept/editing.lua b/modules/textadept/editing.lua
index 9093a150..6dfea6b7 100644
--- a/modules/textadept/editing.lua
+++ b/modules/textadept/editing.lua
@@ -5,34 +5,30 @@ local M = {}
--[[ This comment is for LuaDoc.
---
-- Editing commands for the textadept module.
-module('_M.textadept.editing')]]
-
--- Markdown:
--- ## Settings
---
--- * `AUTOPAIR` [bool]
+-- @field AUTOPAIR (bool)
-- Opening `(`, `[`, `[`, `"`, or `'` characters are automatically closed.
-- The default value is `true`.
--- * `HIGHLIGHT_BRACES` [bool]
--- Highlight matching `()[]{}<>` characters.
+-- @field HIGHLIGHT_BRACES (bool)
+-- Highlight matching `()[]{}` characters.
-- The default value is `true`.
--- * `AUTOINDENT` [bool]
+-- @field AUTOINDENT (bool)
-- Match the indentation level of the previous line when pressing the Enter
-- key.
-- The default value is `true`.
--- * `STRIP_WHITESPACE_ON_SAVE` [bool]
+-- @field STRIP_WHITESPACE_ON_SAVE (bool)
-- Strip trailing whitespace on file save.
-- The default value is `true`.
--- * `MARK_HIGHLIGHT_BACK` [number]
+-- @field MARK_HIGHLIGHT_BACK (number)
-- The background color used for a line containing a highlighted word in
-- `0xBBGGRR` format.
--- * `INDIC_HIGHLIGHT_BACK` [number]
+-- @field INDIC_HIGHLIGHT_BACK (number)
-- The color used for an indicator for a highlighted word in `0xBBGGRR`
-- format.
--- * `INDIC_HIGHLIGHT_ALPHA` [number]
+-- @field INDIC_HIGHLIGHT_ALPHA (number)
-- The alpha transparency value between `0` (transparent) and `255` (opaque)
-- used for an indicator for a highlighted word.
-- The default value is `100`.
+module('_M.textadept.editing')]]
M.AUTOPAIR = true
M.HIGHLIGHT_BRACES = true
@@ -44,7 +40,7 @@ M.INDIC_HIGHLIGHT_ALPHA = 100
---
-- Comment strings for various lexer languages.
--- Used for the `block_comment()` function. Keys are lexer language names and
+-- Used by the `block_comment()` function. Keys are lexer language names and
-- values are the line comment delimiters for the language. This table is
-- typically populated by language-specific modules.
-- @class table
@@ -61,6 +57,7 @@ M.comment_string = {}
-- @class table
-- @name char_matches
-- @usage _M.textadept.editing.char_matches.hypertext = { ..., [60] = '>' }
+-- @see AUTOPAIR
M.char_matches = { [40] = ')', [91] = ']', [123] = '}', [39] = "'", [34] = '"' }
---
@@ -71,6 +68,7 @@ M.char_matches = { [40] = ')', [91] = ']', [123] = '}', [39] = "'", [34] = '"' }
-- @class table
-- @name braces
-- @usage _M.textadept.editing.braces.hypertext = { ..., [60] = 1, [62] = 1 }
+-- @see HIGHLIGHT_BRACES
M.braces = { [40] = 1, [41] = 1, [91] = 1, [93] = 1, [123] = 1, [125] = 1 }
-- The current call tip.
@@ -232,8 +230,10 @@ end
---
-- Block comments or uncomments code with a given comment string.
+-- If none is specified, uses the `comment_string` table.
-- @param comment The comment string inserted or removed from the beginning of
-- each line in the selection.
+-- @see comment_string
-- @name block_comment
function M.block_comment(comment)
local buffer = buffer
@@ -281,8 +281,9 @@ end
---
-- Prepares the buffer for saving to a file.
--- Strips trailing whitespace off of every line, ensures an ending newline, and
--- converts non-consistent EOLs.
+-- Strips trailing whitespace off of every line if `STRIP_WHITESPACE_ON_SAVE` is
+-- `true`, ensures an ending newline, and converts non-consistent EOLs.
+-- @see STRIP_WHITESPACE_ON_SAVE
-- @name prepare_for_save
function M.prepare_for_save()
if not M.STRIP_WHITESPACE_ON_SAVE then return end
@@ -386,7 +387,7 @@ end
---
-- Selects the current word under the caret.
-- @name select_word
-function M.select_word(action)
+function M.select_word()
local buffer = buffer
buffer:set_sel(buffer:word_start_position(buffer.current_pos, true),
buffer:word_end_position(buffer.current_pos, true))
diff --git a/modules/textadept/filter_through.lua b/modules/textadept/filter_through.lua
index 3c43a131..0e6a0fc0 100644
--- a/modules/textadept/filter_through.lua
+++ b/modules/textadept/filter_through.lua
@@ -14,13 +14,16 @@ local filter_through_active = false
---
-- Prompts for a Linux, Mac OSX, or Windows shell command to filter text
-- through.
--- The standard input (stdin) for shell commands is determined as follows: (1)
--- If text is selected and spans multiple lines, all text on the lines
+-- The standard input (stdin) for shell commands is determined as follows:
+--
+-- 1. If text is selected and spans multiple lines, all text on the lines
-- containing the selection is used. However, if the end of the selection is at
-- the beginning of a line, only the EOL (end of line) characters from the
--- previous line are included as input. The rest of the line is excluded. (2) If
--- text is selected and spans a single line, only the selected text is used. (3)
--- If no text is selected, the entire buffer is used.
+-- previous line are included as input. The rest of the line is excluded.
+-- 2. If text is selected and spans a single line, only the selected text is
+-- used.
+-- 3. If no text is selected, the entire buffer is used.
+--
-- The input text is replaced with the standard output (stdout) of the command.
-- @name filter_through
function M.filter_through()
diff --git a/modules/textadept/find.lua b/modules/textadept/find.lua
index 8e6ef20f..62fbc5fe 100644
--- a/modules/textadept/find.lua
+++ b/modules/textadept/find.lua
@@ -5,53 +5,49 @@ local find = gui.find
--[[ This comment is for LuaDoc.
---
-- Textadept's integrated find/replace dialog.
-module('gui.find')]]
-
--- Markdown:
--- ## Fields
---
--- * `find_entry_text` [string]
+-- @field find_entry_text (string)
-- The text in the find entry.
--- * `replace_entry_text` [string]
+-- @field replace_entry_text (string)
-- The text in the replace entry.
--- * `match_case` [bool]
+-- @field match_case (bool)
-- Searches are case-sensitive.
--- * `whole_word` [bool]
+-- @field whole_word (bool)
-- Only whole-word matches are allowed in searches.
--- * `lua` [bool]
+-- @field lua (bool)
-- The search text is interpreted as a Lua pattern.
--- * `in_files` [bool]
+-- @field in_files (bool)
-- Search for the text in a list of files.
--- * `find_label_text` [string] (Write-only)
+-- @field find_label_text (string, Write-only)
-- The text of the 'Find' label.
-- This is primarily used for localization.
--- * `replace_label_text` [string] (Write-only)
+-- @field replace_label_text (string, Write-only)
-- The text of the 'Replace' label.
-- This is primarily used for localization.
--- * `find_next_button_text` [string] (Write-only)
+-- @field find_next_button_text (string, Write-only)
-- The text of the 'Find Next' button.
-- This is primarily used for localization.
--- * `find_prev_button_text` [string] (Write-only)
+-- @field find_prev_button_text (string, Write-only)
-- The text of the 'Find Prev' button.
-- This is primarily used for localization.
--- * `replace_button_text` [string] (Write-only)
+-- @field replace_button_text (string, Write-only)
-- The text of the 'Replace' button.
-- This is primarily used for localization.
--- * `replace_all_button_text` [string] (Write-only)
+-- @field replace_all_button_text (string, Write-only)
-- The text of the 'Replace All' button.
-- This is primarily used for localization.
--- * `match_case_label_text` [string] (Write-only)
+-- @field match_case_label_text (string, Write-only)
-- The text of the 'Match case' label.
-- This is primarily used for localization.
--- * `whole_word_label_text` [string] (Write-only)
+-- @field whole_word_label_text (string, Write-only)
-- The text of the 'Whole word' label.
-- This is primarily used for localization.
--- * `lua_pattern_label_text` [string] (Write-only)
+-- @field lua_pattern_label_text (string, Write-only)
-- The text of the 'Lua pattern' label.
-- This is primarily used for localization.
--- * `in_files_label_text` [string] (Write-only)
+-- @field in_files_label_text (string, Write-only)
-- The text of the 'In files' label.
-- This is primarily used for localization.
+module('gui.find')]]
local _L = _L
find.find_label_text = _L['Find:']
diff --git a/modules/textadept/keys.lua b/modules/textadept/keys.lua
index 33ceb8e8..f2e8bf73 100644
--- a/modules/textadept/keys.lua
+++ b/modules/textadept/keys.lua
@@ -6,7 +6,7 @@ local M = {}
---
-- Defines key commands for Textadept.
-- This set of key commands is pretty standard among other text editors.
--- This module, should be `require`ed last, but before `_M.textadept.menu`.
+-- This module, should be `require`d last, but before `_M.textadept.menu`.
module('_M.textadept.keys')]]
-- Utility functions.
diff --git a/modules/textadept/menu.lua b/modules/textadept/menu.lua
index 967521a9..29a1a85a 100644
--- a/modules/textadept/menu.lua
+++ b/modules/textadept/menu.lua
@@ -6,7 +6,7 @@ local M = {}
--[[ This comment is for LuaDoc.
---
-- Provides dynamic menus for Textadept.
--- This module should be `require`ed last, after `_M.textadept.keys` since it
+-- This module should be `require`d last, after `_M.textadept.keys` since it
-- looks up defined key commands to show them in menus.
module('_M.textadept.menu')]]
@@ -279,6 +279,7 @@ end
-- for setting a menu accelerator. If the menu text is `'separator'`, a menu
-- separator is created and no action table is required.
-- @see keys.get_gdk_key
+-- @see rebuild_command_tables
-- @name set_menubar
function M.set_menubar(menubar)
key_shortcuts = {}
diff --git a/modules/textadept/mime_types.lua b/modules/textadept/mime_types.lua
index 1760f23d..9efbbec9 100644
--- a/modules/textadept/mime_types.lua
+++ b/modules/textadept/mime_types.lua
@@ -5,9 +5,7 @@ local M = {}
--[[ This comment is for LuaDoc.
---
-- Handles file-specific settings.
-module('_M.textadept.mime_types')]]
-
--- Markdown:
+--
-- ## Mime-type Events
--
-- * `_G.events.LANGUAGE_MODULE_LOADED`
@@ -16,6 +14,7 @@ module('_M.textadept.mime_types')]]
-- when Textadept starts.
-- Arguments:
-- * `lang`: The language lexer name.
+module('_M.textadept.mime_types')]]
-- Events.
local events, events_connect = events, events.connect
diff --git a/modules/textadept/run.lua b/modules/textadept/run.lua
index 42423c7b..b8af5f66 100644
--- a/modules/textadept/run.lua
+++ b/modules/textadept/run.lua
@@ -8,9 +8,7 @@ local M = {}
-- Typically, language-specific modules populate the `compile_command`,
-- `run_command`, and `error_detail` tables for a particular language's file
-- extension.
-module('_M.textadept.run')]]
-
--- Markdown:
+--
-- ## Run Events
--
-- * `_G.events.COMPILE_OUTPUT`
@@ -31,6 +29,7 @@ module('_M.textadept.run')]]
-- Arguments:
-- * `lexer`: The lexer language.
-- * `output`: The output from the command.
+module('_M.textadept.run')]]
-- Events.
local events, events_connect, events_emit = events, events.connect, events.emit
diff --git a/modules/textadept/session.lua b/modules/textadept/session.lua
index 5dffaaf6..91adf795 100644
--- a/modules/textadept/session.lua
+++ b/modules/textadept/session.lua
@@ -5,21 +5,17 @@ local M = {}
--[[ This comment is for LuaDoc.
---
-- Session support for the textadept module.
-module('_M.textadept.session')]]
-
--- Markdown:
--- ## Settings
---
--- * `DEFAULT_SESSION` [string]
+-- @field DEFAULT_SESSION (string)
-- The path to the default session file.
--- * `SAVE_ON_QUIT` [bool]
+-- @field SAVE_ON_QUIT (bool)
-- Save the session when quitting.
-- The default value is `true` and can be disabled by passing the command line
-- switch `-n` or `--nosession` to Textadept.
--- * `MAX_RECENT_FILES` [number]
+-- @field MAX_RECENT_FILES (number)
-- The maximum number of files from the recent files list to save to the
-- session.
-- The default value is `10`.
+module('_M.textadept.session')]]
M.DEFAULT_SESSION = _USERHOME..'/session'
M.SAVE_ON_QUIT = true
@@ -33,6 +29,7 @@ M.MAX_RECENT_FILES = 10
-- value is `DEFAULT_SESSION`.
-- @return `true` if the session file was opened and read; `false` otherwise.
-- @usage _M.textadept.session.load(filename)
+-- @see DEFAULT_SESSION
-- @name load
function M.load(filename)
local not_found = {}
@@ -112,6 +109,7 @@ events.connect('arg_none', function() if M.SAVE_ON_QUIT then M.load() end end)
-- @param filename The absolute path to the session file to save. The default
-- value is either the current session file or `DEFAULT_SESSION`.
-- @usage _M.textadept.session.save(filename)
+-- @see DEFAULT_SESSION
-- @name save
function M.save(filename)
local session = {}
diff --git a/modules/textadept/snapopen.lua b/modules/textadept/snapopen.lua
index 6f8d4772..3ccfe376 100644
--- a/modules/textadept/snapopen.lua
+++ b/modules/textadept/snapopen.lua
@@ -5,15 +5,6 @@ local M = {}
--[[ This comment is for LuaDoc.
---
-- Snapopen for the textadept module.
-module('_M.textadept.snapopen')]]
-
--- Markdown:
--- ## Settings
---
--- * `DEFAULT_DEPTH` [number]
--- Maximum directory depth to search. The default value is `4`.
--- * `MAX` [number]
--- Maximum number of files to list. The default value is `1000`.
--
-- ## Examples
--
@@ -29,8 +20,15 @@ module('_M.textadept.snapopen')]]
-- snapopen(nil, '!%.lua$')
--
-- -- Ignore the project's 'images' folder and HTML pages.
--- snapopen('/path/to/project',
--- { folders = { 'images' }, extensions = { 'html' } }, true)
+-- snapopen('/path/to/project', {
+-- folders = { 'images' },
+-- extensions = { 'html' }
+-- }, true)
+-- @field DEFAULT_DEPTH (number)
+-- Maximum directory depth to search. The default value is `4`.
+-- @field MAX (number)
+-- Maximum number of files to list. The default value is `1000`.
+module('_M.textadept.snapopen')]]
---
-- Table of default UTF-8 paths to search.
diff --git a/modules/textadept/snippets.lua b/modules/textadept/snippets.lua
index 1647c3fe..3674a079 100644
--- a/modules/textadept/snippets.lua
+++ b/modules/textadept/snippets.lua
@@ -2,12 +2,10 @@
local M = {}
---[[ This comment is for LuaDoc.
+--[=[ This comment is for LuaDoc.
---
-- Provides Lua-style snippets for Textadept.
-module('_M.textadept.snippets')]]
-
--- Markdown:
+--
-- ## Overview
--
-- Snippets are dynamic pieces of text inserted into a document that contain
@@ -117,6 +115,7 @@ module('_M.textadept.snippets')]]
--
-- It is recommended to use tab characters instead of spaces like in the last
-- example. Tabs will be converted to spaces as necessary.
+module('_M.textadept.snippets')]=]
-- The stack of currently running snippets.
local snippet_stack = {}