Mercurial Hosting > luan
diff core/src/luan/modules/Html.luan @ 503:92c3d22745b8
make _ENV optional
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Wed, 20 May 2015 23:24:46 -0600 |
parents | 55f9f74f1e55 |
children | 195a64f948f2 |
line wrap: on
line diff
--- a/core/src/luan/modules/Html.luan Tue May 19 17:57:20 2015 -0600 +++ b/core/src/luan/modules/Html.luan Wed May 20 23:24:46 2015 -0600 @@ -1,9 +1,11 @@ java() local HtmlLuan = require "java:luan.modules.HtmlLuan" -encode = HtmlLuan.encode -parse = HtmlLuan.parse -to_string = HtmlLuan.to_string +local M = {} + +M.encode = HtmlLuan.encode +M.parse = HtmlLuan.parse +M.to_string = HtmlLuan.to_string @@ -15,11 +17,11 @@ local Io = require "luan:Io" local URLEncoder = require "java:java.net.URLEncoder" -function url_encode(s) +function M.url_encode(s) return URLEncoder.encode(s,"UTF-8") end -function process_url_tags(html) +function M.process_url_tags(html) for i, v in ipairs(html) do if type(v) == "table" and v.type == "tag" then if v.name == "url" then @@ -34,7 +36,7 @@ end end -function add_nofollow(html) +function M.add_nofollow(html) for i, v in ipairs(html) do if type(v) == "table" and v.type == "tag" and v.name == "a" then v.attributes.rel = "nofollow" @@ -43,7 +45,7 @@ end -function simply_html_head() %> +function M.simply_html_head() %> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> @@ -55,6 +57,8 @@ <script src="http://www.simplyhtml.org/assets/simplyhtml/simplyhtml.js"></script> <% end -function simply_html_body_bottom() %> +function M.simply_html_body_bottom() %> <script src="http://www.simplyhtml.org/assets/bootstrap/js/bootstrap.min.js"></script> <% end + +return M