Further lua5.3 compatibility fixes

Tue, 16 Jan 2018 17:02:29 +0000

author
Tuomo Valkonen <tuomov@iki.fi>
date
Tue, 16 Jan 2018 17:02:29 +0000
changeset 9
751216807683
parent 8
836dac92eced
child 10
118ab361da29

Further lua5.3 compatibility fixes

lgen.lua file | annotate | diff | comparison | revisions
plugin.lua file | annotate | diff | comparison | revisions
plugin/breadcrumb.lua file | annotate | diff | comparison | revisions
plugin/inline.lua file | annotate | diff | comparison | revisions
--- a/lgen.lua	Tue Jan 16 17:02:22 2018 +0000
+++ b/lgen.lua	Tue Jan 16 17:02:29 2018 +0000
@@ -5,6 +5,7 @@
 end
 
 -- Lua 5.1 setfenv/getfenv compatibility for Lua 5.2
+-- This is required by the "obsolete" ltp module
 local CE = require('compat_env')
 _G.setfenv = CE.setfenv
 _G.getfenv = CE.getfenv
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/plugin.lua	Tue Jan 16 17:02:29 2018 +0000
@@ -0,0 +1,9 @@
+
+--@module plugin
+
+local plugin={}
+
+plugin.inline=require('plugin.inline')
+plugin.breadcrumb=require('plugin.breadcrumb')
+
+return plugin
--- a/plugin/breadcrumb.lua	Tue Jan 16 17:02:22 2018 +0000
+++ b/plugin/breadcrumb.lua	Tue Jan 16 17:02:29 2018 +0000
@@ -1,8 +1,12 @@
 
-module("plugin.breadcrumb", package.seeall)
+--@module plugin.breadcrumb
 
-require("path")
+local plugin_breadcrumb={}
 
-function trail(env)
+local path=require("path")
+
+function plugin_breadcrumb.trail(env)
     return "(TODO)"
 end
+
+return plugin_breadcrumb
--- a/plugin/inline.lua	Tue Jan 16 17:02:22 2018 +0000
+++ b/plugin/inline.lua	Tue Jan 16 17:02:29 2018 +0000
@@ -1,9 +1,13 @@
 
-module("plugin.inline", package.seeall)
+--@ module plugin.inline
+
+local plugin_inline={}
 
-require('handlers.render')
+local path=require('path')
+local handlers_render=require('handlers.render')
+local filecache=require('filecache')
 
-function find(env, opts)
+function plugin_inline.find(env, opts)
     local found={}
     for name, _ in pairs(env.pages) do
         if string.match(name, opts.pattern) then
@@ -37,7 +41,7 @@
     end
 end
 
-function render(env, opts, pages_)
+function plugin_inline.render(env, opts, pages_)
     local inlinepages={}
     local page=env.page
     local to_root=path.to_root(page.destination)
@@ -63,7 +67,7 @@
         inlinepages[i]=table.copy(inlinepage)
         -- TODO: env väärin?
         if not opts.no_content then
-            inlinepages[i].content=handlers.render.render(file, env, path_prefix)
+            inlinepages[i].content=handlers_render.render(file, env, path_prefix)
         end
         inlinepages[i].location=location
     end
@@ -72,9 +76,11 @@
     local inline_template=filecache.get(tmplfile)
 
     local newenv=table.join(env, { inlinepages=inlinepages })
-    return handlers.render.process_lua(inline_template, newenv)
+    return handlers_render.process_lua(inline_template, newenv)
 end
 
-function inline(env, opts)
-    return render(env, opts, find(env, opts))
+function plugin_inline.inline(env, opts)
+    return plugin_inline.render(env, opts, plugin_inline.find(env, opts))
 end
+
+return plugin_inline

mercurial