function markup(str) local function trim(tbl) for i=#tbl,1,-1 do if tbl[i] == ' ' then tbl[i] = nil else return tbl end end end local parse, block, block2, element, code, url, title, def, dt, dd function parse(out, next) local c = next() if not c then return out end if c == ' ' or c == '\t' then return parse(out, next) end out[#out+1] = '
' if c == '[' then return element(out, next) end out[#out+1] = c return block(out, next) end function block(out, next) local c = next() if not c then out[#out+1] = '
' return out end if c == '[' then return element(out, next) end if c == '\n' then return block2(out, next) end out[#out+1] = c return block(out, next) end function block2(out, next) local c = next() if not c then out[#out+1] = '' return out end if c == '[' then return element(out, next) end if c == '\n' then out[#out+1] = '' return parse(out, next) end if c ~= ' ' and c ~= '\t' then out[#out+1] = c end return block(out, next) end function element(out, next) local c = assert(next(), 'markup error') if c == '^' then out[#out+1] = '' return code(out, next) end out[#out+1] = '['..c return block(out, next) end function url(out, next) local c = assert(next(), 'markup error') assert(c ~= ']', 'incomplete link definition') if c == ' ' then out[#out+1] = '">' return title(out, next) end out[#out+1] = c return url(out, next) end function title(out, next) local c = assert(next(), 'markup error') if c == ']' then out[#out+1] = '' return block(out, next) end out[#out+1] = c return title(out, next) end function def(out, next) local c = assert(next(), 'markup error') if c == ' ' or c == '\t' or c == '\n' then return def(out, next) end if c == ']' then out[#out+1] = '' return block(out, next) end out[#out+1] = ''..rest..'
' end
if cmd == '*' then return ''..rest..'' end
if cmd == '!' then return ''..rest..'' end
return m
end
return table.concat(parse({}, str:gmatch('.'))):gsub('%b{}', spans):gsub('%b{}', spans)
end
-- PREPARE DOCUMENTATION MARKUP
local DOC = { short = {}, long = {} }
function Module(M)
for _,field in ipairs{'name', 'title', 'short', 'long'} do
assert(M[field], "Module: Required field `"..field.."' is missing")
end
DOC.short[#DOC.short+1] = ('%s = require "%s"
', M.title:gsub("^(%w+)%W.+", "%1"), M.name)
F(markup(M.long))
F('')
F(M.example[i])
F('
')
end
F('%s
%s')
F(M.example[i])
F('
')
end
F('Helper Utilities for a Multitude of Problems is a set of lightweight helpers for the awesome LÖVE Engine.
It features
hump differs from other libraries in that every component is independent of the remaining ones (apart from camera.lua, which does depends on vector.lua). hump's footprint is very small and thus should fit nicely into your projects.
Yay, free software:
Copyright (c) 2010 Matthias Richter
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
Except as contained in this notice, the name(s) of the above copyright holders shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.