Mercurial Hosting > luan
view core/src/luan/modules/Html.luan @ 340:fb18724521d2
rename Html.simple_html_page to simply_html_page
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Tue, 31 Mar 2015 02:35:40 -0600 |
parents | 78a6a71afbfd |
children | 2f5cc9c2cbf0 |
line wrap: on
line source
java() local HtmlLuan = require "java:luan.modules.HtmlLuan" encode = HtmlLuan.encode parse = HtmlLuan.parse to_string = HtmlLuan.to_string -- extras local Luan = require "luan:Luan" local ipairs = Luan.ipairs local type = Luan.type local Io = require "luan:Io" function 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 local url = v.attributes.url or html[i+1] v.name = "a" v.attributes.url = nil v.attributes.href = url elseif v.name == "/url" then v.name = "/a" end end end end function 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" end end end function simply_html_page(parts) local head = parts.head %> <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <% head and head() %> <link href="http://www.simplyhtml.org/assets/bootstrap/css/bootstrap.min.css" rel="stylesheet"> <link rel="stylesheet" href="http://www.simplyhtml.org/assets/font-awesome/css/font-awesome.min.css"> <script src="http://www.simplyhtml.org/assets/jquery/jquery.min.js"></script> <link href="http://www.simplyhtml.org/assets/simplyhtml/simplyhtml.css" rel="stylesheet"/> <script src="http://www.simplyhtml.org/assets/simplyhtml/simplyhtml.js"></script> </head> <body> <% parts.body() %> <script src="http://www.simplyhtml.org/assets/bootstrap/js/bootstrap.min.js"></script> </body> </html> <% end