Skip to content

Instantly share code, notes, and snippets.

@fredericpierron
Created November 5, 2012 00:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fredericpierron/4014572 to your computer and use it in GitHub Desktop.
Save fredericpierron/4014572 to your computer and use it in GitHub Desktop.
Template in lua
local templateHTML = {}
templateHTML.nowArticle = function(myTitre, myArticle, myImage, myURL, myAdresse, myTelephone)
local header = [[
<!doctype html>
<html class="" lang="en">
<head>
<meta charset="utf-8">
<title></title>
<meta name="description" content="">
<meta name="author" content="">
<meta name="viewport" content="width=device-width">
<meta name="viewport" content="initial-scale=1.0; maximum-scale=1.0; user-scalable=0;" />
<link rel="stylesheet" href="css/style.css">
</head>]]
local body = [[
<body>
<div class="page pageArticle" >
]]
local titre = [[
<div class="header_titre">
<div><h1>]]..myTitre..[[</h1></div>
</div>
]]
local article = [[<div class="article">]]..myArticle
local adresse
if myAdresse ~= "NULL" then
adresse = [[<ol class="orderedList"><li>
<p>]]..myAdresse..[[</p> </li></ol>]]
else
adresse = ""
end
local url
if myURL ~= "NULL" then
url = [[<p class="footer"><a href="]]..myURL..[[">]].."Website: "..myURL..[[</a></p>]]
else
url =""
end
local telephone
if myTelephone ~= "NULL" then
telephone = [[<p class="footer"><a href="]]..myTelephone..[[">]].."Tel.: "..myTelephone..[[</a></p>]]
else
myTelephone = ""
end
local image
if myImage ~= "NULL" then
image = [[<figure><img class="lazy" src="img_content/grey.jpg" data-original="http://afkcs.net/img_content/now_img/]]..myImage..[[" /></figure>]]
else
image = ""
end
local bottom = [[ <p><br>&nbsp;<br></p>
</div><!-- /.article -->
</div>
<script src="js/jquery-1.7.2.min.js" type="text/javascript"></script>
<script src="js/jquery.lazyload.min.js" type="text/javascript"></script>
<script>
$(function() {
$("img.lazy").lazyload({ effect : "fadeIn" });
});
</script>
</body>
</html>
]]
local pageHTML = header..body..titre..article..url..adresse..image..bottom
return pageHTML
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment