Issue #150: 'info' section ordering is now consistent

This commit is contained in:
steve donovan 2014-01-07 17:48:50 +02:00
parent a8c4d9fa1e
commit d367390c68
2 changed files with 5 additions and 4 deletions

View File

@ -19,6 +19,7 @@ local path = require 'pl.path'
local stringx = require 'pl.stringx' local stringx = require 'pl.stringx'
local template = require 'pl.template' local template = require 'pl.template'
local tablex = require 'pl.tablex' local tablex = require 'pl.tablex'
local OrderedMap = require 'pl.orderedMap'
local tools = require 'ldoc.tools' local tools = require 'ldoc.tools'
local markup = require 'ldoc.markup' local markup = require 'ldoc.markup'
local prettify = require 'ldoc.prettify' local prettify = require 'ldoc.prettify'
@ -39,16 +40,16 @@ local function cleanup_whitespaces(text)
end end
local function get_module_info(m) local function get_module_info(m)
local info = {} local info = OrderedMap()
for tag in doc.module_info_tags() do for tag in doc.module_info_tags() do
local val = m.tags[tag] local val = m.tags[tag]
if type(val)=='table' then if type(val)=='table' then
val = table.concat(val,',') val = table.concat(val,',')
end end
tag = stringx.title(tag) tag = stringx.title(tag)
info[tag] = val info:set(tag,val)
end end
if next(info) then if #info:keys() > 0 then
return info return info
end end
end end

View File

@ -99,7 +99,7 @@ return [==[
# if module.info then # if module.info then
<h3>Info:</h3> <h3>Info:</h3>
<ul> <ul>
# for tag, value in ldoc.pairs(module.info) do # for tag, value in module.info:iter() do
<li><strong>$(tag)</strong>: $(M(value,module))</li> <li><strong>$(tag)</strong>: $(M(value,module))</li>
# end # end
</ul> </ul>