Skip to content

Commit b04b8b0

Browse files
Tweak api docs
1 parent 7485cff commit b04b8b0

File tree

3 files changed

+15
-14
lines changed

3 files changed

+15
-14
lines changed

lua/orgmode/api/file.lua

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
11
local OrgHeadline = require('orgmode.api.headline')
22

33
---@class OrgFile
4-
---@field category string current file category name. By default only filename without extension unless defined via #+CATEGORY directive
4+
---@field category string current file category name. By default it's only filename without extension unless defined differently via #+CATEGORY directive
55
---@field filename string absolute path of the current file
66
---@field headlines OrgHeadline[]
77
---@field is_archive_file boolean
8-
---@field private file File
8+
---@field private _file File
99
local OrgFile = {}
1010

1111
---@param headline OrgHeadline
1212
---@param headlines_by_id table<string, OrgHeadline>
1313
---@private
1414
local function map_child_headlines(headline, headlines_by_id)
15-
if #headline.section.sections == 0 then
15+
if #headline._section.sections == 0 then
1616
return headline
1717
end
1818

1919
local child_headlines = {}
20-
for _, child_section in ipairs(headline.section.sections) do
20+
for _, child_section in ipairs(headline._section.sections) do
2121
local child_headline = headlines_by_id[child_section.id]
2222
child_headline.parent = headline
2323
table.insert(child_headlines, child_headline)
@@ -34,7 +34,7 @@ function OrgFile:_new(opts)
3434
data.filename = opts.filename
3535
data.headlines = opts.headlines
3636
data.is_archive_file = opts.is_archive_file or false
37-
data.file = opts.file
37+
data._file = opts._file
3838
setmetatable(data, self)
3939
self.__index = self
4040
return data
@@ -52,7 +52,7 @@ function OrgFile._build_from_internal_file(file)
5252
end
5353

5454
local instance = OrgFile:_new({
55-
file = file,
55+
_file = file,
5656
category = file.category,
5757
filename = file.filename,
5858
headlines = headlines,
@@ -70,7 +70,7 @@ end
7070
--- Return refreshed instance of the file
7171
---@return OrgFile
7272
function OrgFile:reload()
73-
return OrgFile._build_from_internal_file(self.file:refresh())
73+
return OrgFile._build_from_internal_file(self._file:refresh())
7474
end
7575

7676
return OrgFile

lua/orgmode/api/headline.lua

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ local Calendar = require('orgmode.objects.calendar')
2222
---@field parent OrgHeadline|nil
2323
---@field priority string|nil
2424
---@field headlines OrgHeadline[]
25-
---@field private section Section
26-
---@field private index number
25+
---@field private _section Section
26+
---@field private _index number
2727
local OrgHeadline = {}
2828

2929
---@private
@@ -45,8 +45,8 @@ function OrgHeadline:_new(opts)
4545
data.dates = opts.dates
4646
data.parent = opts.parent
4747
data.headlines = opts.headlines or {}
48-
data.section = opts.section
49-
data.index = opts.index
48+
data._section = opts._section
49+
data._index = opts._index
5050

5151
setmetatable(data, self)
5252
self.__index = self
@@ -72,16 +72,16 @@ function OrgHeadline._build_from_internal_section(section, index)
7272
return date:is_none()
7373
end, section.dates),
7474
priority = section.priority,
75-
section = section,
76-
index = index,
75+
_section = section,
76+
_index = index,
7777
})
7878
end
7979

8080
--- Return updated version of headline
8181
---@return OrgHeadline
8282
function OrgHeadline:reload()
8383
local file = self.file:reload()
84-
return file.headlines[self.index]
84+
return file.headlines[self._index]
8585
end
8686

8787
--- Set tags on the headline. This replaces all current tags with provided ones

lua/orgmode/api/init.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ function OrgApi.load(name)
3434

3535
return list
3636
end
37+
error('Invalid argument to OrgApi.load')
3738
end
3839

3940
--- Get current org buffer file

0 commit comments

Comments
 (0)