Skip to content

Commit 2f95106

Browse files
committed
Switched documentation format to LDoc from LuaDoc.
LuaDoc is obsolete and LDoc is the recommended replacement.
1 parent 4206cfb commit 2f95106

File tree

3 files changed

+27
-42
lines changed

3 files changed

+27
-42
lines changed

Makefile

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,10 @@
44

55
ta = ../..
66
cwd = $(shell pwd)
7-
docs: luadoc README.md
7+
docs: README.md
88
README.md: init.lua
9-
cd $(ta)/scripts && luadoc --doclet markdowndoc $(cwd)/$< > $(cwd)/$@
9+
cd $(ta)/scripts && ldoc --filter markdowndoc.ldoc $(cwd)/$< > $(cwd)/$@
1010
sed -i -e '1,+4d' -e '6c# Lua REPL' -e '7d' -e 's/^##/#/;' $@
11-
luadoc: init.lua
12-
cd $(ta)/modules && luadoc -d $(cwd) --doclet lua/tadoc $(cwd)/$< \
13-
--ta-home=$(shell readlink -f $(ta))
14-
sed -i 's/_HOME.\+\?_HOME/_HOME/;' tags
1511

1612
# Releases.
1713

README.md

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,6 @@ Lines may be optionally prefixed with '=' (similar to the Lua prompt) to print a
1818

1919
## Functions defined by `lua_repl`
2020

21-
<a id="M.open"></a>
22-
### `M.open`(*new*)
23-
24-
Creates or switches to a Lua REPL.
25-
If *new* is `true`, creates a new REPL even if one already exists.
26-
27-
Parameters:
28-
29-
* *`new`*: Flag that indicates whether or not to create a new REPL even if one already exists.
30-
3121
<a id="lua_repl.complete_lua"></a>
3222
### `lua_repl.complete_lua`()
3323

@@ -49,6 +39,16 @@ Cycle backward through command history, taking into account commands with multip
4939
Evaluates as Lua code the current line or the text on the currently selected lines.
5040
If the current line has a syntax error, it is ignored and treated as a line continuation.
5141

42+
<a id="lua_repl.open"></a>
43+
### `lua_repl.open`(*new*)
44+
45+
Creates or switches to a Lua REPL.
46+
If *new* is `true`, creates a new REPL even if one already exists.
47+
48+
Parameters:
49+
50+
- *new*: Flag that indicates whether or not to create a new REPL even if one already exists.
51+
5252

5353
## Tables defined by `lua_repl`
5454

@@ -58,6 +58,10 @@ If the current line has a syntax error, it is ignored and treated as a line cont
5858
Lua command history.
5959
It has a numeric `pos` field that indicates where in the history the user currently is.
6060

61+
Fields:
62+
63+
- `pos`:
64+
6165
<a id="lua_repl.keys"></a>
6266
### `lua_repl.keys`
6367

init.lua

Lines changed: 11 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
-- Copyright 2014-2023 Mitchell. See LICENSE.
22

3-
--[[ This comment is for LuaDoc
43
---
54
-- A Textadept module for loading an interactive Lua REPL using the editor's Lua State, similar
65
-- to Lua's interactive REPL.
@@ -17,8 +16,7 @@
1716
-- to evaluate and type Enter to evaluate the entire chunk.
1817
--
1918
-- Lines may be optionally prefixed with '=' (similar to the Lua prompt) to print a result.
20-
module('lua_repl')]]
21-
19+
-- @module lua_repl
2220
local M = {}
2321

2422
-- Localizations.
@@ -43,14 +41,11 @@ local env = setmetatable({
4341
---
4442
-- Lua command history.
4543
-- It has a numeric `pos` field that indicates where in the history the user currently is.
46-
-- @class table
47-
-- @name history
4844
M.history = {pos = 0}
4945

5046
---
5147
-- Evaluates as Lua code the current line or the text on the currently selected lines.
5248
-- If the current line has a syntax error, it is ignored and treated as a line continuation.
53-
-- @name evaluate_repl
5449
function M.evaluate_repl()
5550
local s, e = buffer.selection_start, buffer.selection_end
5651
local code, last_line
@@ -94,9 +89,7 @@ function M.evaluate_repl()
9489
buffer:set_save_point()
9590
end
9691

97-
---
98-
-- Shows a set of Lua code completions for the current position.
99-
-- @name complete_lua
92+
--- Shows a set of Lua code completions for the current position.
10093
function M.complete_lua()
10194
local line, pos = buffer:get_cur_line()
10295
local symbol, op, part = line:sub(1, pos - 1):match('([%w_.]-)([%.:]?)([%w_]*)$')
@@ -125,9 +118,7 @@ function M.complete_lua()
125118
buffer:auto_c_show(#part - 1, table.concat(cmpls, string.char(buffer.auto_c_separator)))
126119
end
127120

128-
---
129-
-- Cycle backward through command history, taking into account commands with multiple lines.
130-
-- @name cycle_history_prev
121+
--- Cycle backward through command history, taking into account commands with multiple lines.
131122
function M.cycle_history_prev()
132123
if buffer:auto_c_active() then
133124
buffer:line_up()
@@ -143,9 +134,7 @@ function M.cycle_history_prev()
143134
buffer:add_text(M.history[M.history.pos])
144135
end
145136

146-
---
147-
-- Cycle forward through command history, taking into account commands with multiple lines.
148-
-- @name cycle_history_next
137+
--- Cycle forward through command history, taking into account commands with multiple lines.
149138
function M.cycle_history_next()
150139
if buffer:auto_c_active() then
151140
buffer:line_down()
@@ -161,20 +150,16 @@ function M.cycle_history_next()
161150
buffer:add_text(M.history[M.history.pos])
162151
end
163152

164-
-- LuaFormatter off
165-
---
166-
-- Table of key bindings for the REPL.
167-
-- @class table
168-
-- @name keys
153+
--- Table of key bindings for the REPL.
154+
M.keys = {} -- empty declaration to avoid LDoc processing
169155
M.keys = {
170-
['\n'] = M.evaluate_repl,
171-
['ctrl+ '] = M.complete_lua,
172-
['ctrl+up'] = M.cycle_history_prev,
173-
['ctrl+down'] = M.cycle_history_next,
174-
['ctrl+p'] = M.cycle_history_prev,
156+
['\n'] = M.evaluate_repl, --
157+
['ctrl+ '] = M.complete_lua, --
158+
['ctrl+up'] = M.cycle_history_prev, --
159+
['ctrl+down'] = M.cycle_history_next, --
160+
['ctrl+p'] = M.cycle_history_prev, --
175161
['ctrl+n'] = M.cycle_history_next
176162
}
177-
-- LuaFormatter on
178163

179164
-- Cannot initially define keys in `keys.lua` because that table does not exist yet and will
180165
-- be overwritten by the Lua language module. Instead, define keys here.

0 commit comments

Comments
 (0)