local Luan = require "luan:Luan.luan" local error = Luan.error local do_file = Luan.do_file or error() local pairs = Luan.pairs or error() local Io = require "luan:Io.luan" local Http = require "luan:http/Http.luan" local Logging = require "luan:logging/Logging.luan" local logger = Logging.logger "personalize.html" local function form() %>

product:

color:

text:

text color:

<% end return function() local product = Http.request.parameters.product local color = Http.request.parameters.color local text = Http.request.parameters.text local text_color = Http.request.parameters.text_color local file = Http.request.parameters.test and "test.luan" or "info.luan" Io.stdout = Http.response.text_writer() if product==nil or color==nil or text==nil then form() return end local product_info = do_file("site:/shop/"..product.."/"..file) local info = product_info.colors[color] or error "color not in product" local type = info.pattern and "pattern_css" or "solid_css" local personalization = product_info.personalization or error "no personalization defined" local css = personalization[type] or error("personalization."..type.." not defined") local locations = personalization.locations local first_location = pairs(locations)() -- local location_css = personalization_locations %>
<%=text%>
<% for location, title in pairs(locations) do %>
<% end %> <% end