Skip to content

Commit

Permalink
Merge pull request lunarmodules#217 from cjtallman/module_see
Browse files Browse the repository at this point in the history
Adding module-level see reference support.
  • Loading branch information
stevedonovan committed Oct 26, 2015
2 parents fe15020 + b9803db commit aa4cd9d
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
8 changes: 7 additions & 1 deletion ldoc/doc.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1198,7 +1198,8 @@ end
-- and try to to resolve this.
function Module:resolve_references(modules)
local found = List()
for item in self.items:iter() do
-- Resolve see references in item. Can be Module or Item type.
local function resolve_item_references(item)
local see = item.tags.see
if see then -- this guy has @see references
item.see = List()
Expand All @@ -1213,6 +1214,11 @@ function Module:resolve_references(modules)
end
end
end

resolve_item_references(self); -- Resolve module-level see references.
for item in self.items:iter() do
resolve_item_references(item); -- Resolve item-level see references.
end
-- mark as found, so we don't waste time re-searching
for f in found:iter() do
f[1].tags.see:remove_value(f[2])
Expand Down
9 changes: 9 additions & 0 deletions ldoc/html/ldoc_ltp.lua
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,15 @@ return [==[
# if module.tags.include then
$(M(ldoc.include_file(module.tags.include)))
# end
# if module.see then
# local li,il = use_li(module.see)
<h3>See also:</h3>
<ul>
# for see in iter(module.see) do
$(li)<a href="$(ldoc.href(see))">$(see.label)</a>$(il)
# end -- for
</ul>
# end -- if see
# if module.usage then
# local li,il = use_li(module.usage)
<h3>Usage:</h3>
Expand Down

0 comments on commit aa4cd9d

Please sign in to comment.