Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve names hierarchy #293

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ldoc.lua
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ utils.unpack = utils.unpack or unpack or table.unpack
local append = table.insert
local lapp = require 'pl.lapp'

local version = '1.4.6'
local version = '1.4.7'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please don't bump the version number as part of PR's, well do that right before an actual release.


-- so we can find our private modules
app.require_here()
Expand Down
19 changes: 15 additions & 4 deletions ldoc/doc.lua
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,11 @@ function File:finish()
end
-- Whether to use '.' or the language's version of ':' (e.g. \ for Moonscript)
item.name = class..(not static and this_mod.file.lang.method_call or '.')..item.name
item.names_hierarchy = require('pl.utils').split(
item.name,
not static and this_mod.file.lang.method_call or '.',
true
)
end
if stype == 'factory' then
if item.tags.private then to_be_removed = true
Expand Down Expand Up @@ -409,10 +414,6 @@ function File:finish()
-- must be a free-standing function (sometimes a problem...)
end
end
item.names_hierarchy = require('pl.utils').split(
item.name,
'[.:]'
)
end
end

Expand Down Expand Up @@ -620,6 +621,10 @@ function Item:finish()
local tags = self.tags
local quote = tools.quote
self.name = read_del(tags,'name')
self.names_hierarchy = require('pl.utils').split(
self.name,
"[:.]"
)
self.type = read_del(tags,'class')
self.modifiers = extract_tag_modifiers(tags)
self.usage = read_del(tags,'usage')
Expand All @@ -639,6 +644,12 @@ function Item:finish()
self.sections = List()
self.items.by_name = {}
self.sections.by_name = {}
if self.type == "example" or self.type == "topic" then
filename = self.names_hierarchy[#self.names_hierarchy - 1]
extension = self.names_hierarchy[#self.names_hierarchy]
self.names_hierarchy[#self.names_hierarchy] = nil
self.names_hierarchy[#self.names_hierarchy] = filename .. "." .. extension
end
setmetatable(self,Module)
elseif not doc.section_tag(self.type) then
-- params are either a function's arguments, or a table's fields, etc.
Expand Down