From 91fcdb58bfe43b368f1bf32edc16ed7dba8c40cd Mon Sep 17 00:00:00 2001 From: mitchell <70453897+667e-11@users.noreply.github.com> Date: Mon, 8 Oct 2012 11:40:17 -0400 Subject: Use '@field' LuaDoc for events defined in modules. --- core/file_io.lua | 30 ++++++++++++++++++------------ core/iface.lua | 2 +- doc/markdowndoc.lua | 1 + modules/textadept/mime_types.lua | 8 +++----- modules/textadept/run.lua | 17 ++++++++--------- 5 files changed, 31 insertions(+), 27 deletions(-) diff --git a/core/file_io.lua b/core/file_io.lua index 0ea94bca..0cd9314a 100644 --- a/core/file_io.lua +++ b/core/file_io.lua @@ -13,6 +13,8 @@ -- them manually, use [`string.iconv()`][] along with [`_CHARSET`][], your -- filesystem's detected encoding. An example is -- +--
+-- -- events.connect(events.FILE_OPENED, function(utf8_filename) -- local filename = utf8_filename:iconv(_CHARSET, 'UTF-8') -- local f = io.open(filename, 'rb') @@ -22,31 +24,35 @@ -- -- [`string.iconv()`]: string.html#iconv -- [`_CHARSET`]: _G.html#_CHARSET --- --- ## File Events --- --- * `_G.events.FILE_OPENED` +-- @field _G.events.FILE_OPENED (string) -- Called when a file is opened in a new buffer. -- This is emitted by [`open_file()`](#open_file) -- Arguments: --- * `filename`: The filename encoded in UTF-8. --- * `_G.events.FILE_BEFORE_SAVE` +-- +-- * `filename`: The filename encoded in UTF-8. +-- @field _G.events.FILE_BEFORE_SAVE (string) -- Called right before a file is saved to disk. -- This is emitted by [`buffer:save()`][] -- Arguments: --- * `filename`: The filename encoded in UTF-8. --- * `_G.events.FILE_AFTER_SAVE` +-- +-- * `filename`: The filename encoded in UTF-8. +-- +-- [`buffer:save()`]: buffer.html#save +-- @field _G.events.FILE_AFTER_SAVE (string) -- Called right after a file is saved to disk. -- This is emitted by [`buffer:save()`][] -- Arguments: --- * `filename`: The filename encoded in UTF-8. --- * `_G.events.FILE_SAVED_AS` +-- +-- * `filename`: The filename encoded in UTF-8. +-- +-- [`buffer:save()`]: buffer.html#save +-- @field _G.events.FILE_SAVED_AS (string) -- Called when a file is saved under a different filename. -- This is emitted by [`buffer:save_as()`][] -- Arguments: --- * `filename`: The filename encoded in UTF-8. -- --- [`buffer:save()`]: buffer.html#save +-- * `filename`: The filename encoded in UTF-8. +-- -- [`buffer:save_as()`]: buffer.html#save_as module('io')]] diff --git a/core/iface.lua b/core/iface.lua index db6d0f85..19af0ea8 100644 --- a/core/iface.lua +++ b/core/iface.lua @@ -5,7 +5,7 @@ local M = {} --[[ This comment is for LuaDoc. --- -- Scintilla constants, functions, and properties. --- Do not modify anything in this module. Doing so will have unpredicable +-- Do not modify anything in this module. Doing so will have unpredictable -- consequences. module('_SCINTILLA')]] diff --git a/doc/markdowndoc.lua b/doc/markdowndoc.lua index e44e8c37..5e216457 100644 --- a/doc/markdowndoc.lua +++ b/doc/markdowndoc.lua @@ -261,6 +261,7 @@ function M.start(doc) p:close() template.toc = template.toc:gsub('(([^<]+)
', '%1') -- sans serif
+ :gsub('_G.(events.[%w_]+)', '%1')
f = io_open(M.options.output_dir..'/api/'..name..'.html', 'wb')
local html = HTML:gsub('%%%(([^)]+)%)', template)
f:write(html)
diff --git a/modules/textadept/mime_types.lua b/modules/textadept/mime_types.lua
index 4a77efc4..7c71fa7f 100644
--- a/modules/textadept/mime_types.lua
+++ b/modules/textadept/mime_types.lua
@@ -5,15 +5,13 @@ local M = {}
--[[ This comment is for LuaDoc.
---
-- Handles file type detection.
---
--- ## Mime-type Events
---
--- * `_G.events.LANGUAGE_MODULE_LOADED`
+-- @field _G.events.LANGUAGE_MODULE_LOADED (string)
-- Called after loading a language-specific module.
-- This is useful for overriding a language-specific module's key bindings
-- or other properties since the module is not loaded when Textadept starts.
-- Arguments:
--- * `lang`: The language lexer name.
+--
+-- * `lang`: The language lexer name.
module('_M.textadept.mime_types')]]
-- Events.
diff --git a/modules/textadept/run.lua b/modules/textadept/run.lua
index 56fb06c1..c19c681f 100644
--- a/modules/textadept/run.lua
+++ b/modules/textadept/run.lua
@@ -10,23 +10,22 @@ local M = {}
-- extension.
--
-- [language-specific modules]: _M.html#Compile.and.Run
---
--- ## Run Events
---
--- * `_G.events.COMPILE_OUTPUT`
+-- @field _G.events.COMPILE_OUTPUT (string)
-- Called after a compile command is executed.
-- By default, compiler output is printed to the message buffer. To override
-- this behavior, connect to the event with an index of `1` and return `true`.
-- Arguments:
--- * `lexer`: The lexer language.
--- * `output`: The output from the command.
--- * `_G.events.RUN_OUTPUT`
+--
+-- * `lexer`: The lexer language.
+-- * `output`: The output from the command.
+-- @field _G.events.RUN_OUTPUT (string)
-- Called after a run command is executed.
-- By default, output is printed to the message buffer. To override this
-- behavior, connect to the event with an index of `1` and return `true`.
-- Arguments:
--- * `lexer`: The lexer language.
--- * `output`: The output from the command.
+--
+-- * `lexer`: The lexer language.
+-- * `output`: The output from the command.
module('_M.textadept.run')]]
-- Events.
--
cgit v1.2.3