From ae59e7f08b35ec98f2358b0d9526fbf822a32f01 Mon Sep 17 00:00:00 2001 From: Ted Trask Date: Wed, 10 Aug 2016 15:48:23 +0000 Subject: Remove trailing whitespace --- html.lua | 66 ++++++++++++++++++++++++++++++++-------------------------------- 1 file changed, 33 insertions(+), 33 deletions(-) (limited to 'html.lua') diff --git a/html.lua b/html.lua index e32eeaa..425fd0b 100644 --- a/html.lua +++ b/html.lua @@ -1,4 +1,4 @@ ---[[ lowlevel html functions +--[[ lowlevel html functions Written for Alpine Configuration Framework (ACF) -- see www.alpinelinux.org Copyright (C) 2007 Nathan Angelacos Licensed under the terms of GPL2 @@ -22,7 +22,7 @@ mymodule.cookie.set = function ( name, value, path ) if path == nil then path = "/" end - return (string.format('Set-Cookie: %s=%s; path=%s; %s\n', mymodule.html_escape(tostring(name)), + return (string.format('Set-Cookie: %s=%s; path=%s; %s\n', mymodule.html_escape(tostring(name)), mymodule.html_escape(tostring(value)), mymodule.html_escape(path), mymodule.html_escape(expires))) end @@ -36,7 +36,7 @@ end -- escape unsafe html characters function mymodule.html_escape (text ) - text = text or "" + text = text or "" local str = string.gsub (text, "&", "&" ) str = string.gsub (str, "<", "<" ) str = string.gsub (str, ">", ">" ) @@ -51,19 +51,19 @@ function mymodule.url_encode ( text ) str = string.gsub (str, "([^%w ])", function (c) return string.format ("%%%02X", string.byte(c)) end) str = string.gsub (str, " ", "+") - return str + return str end --- return a name,value pair as a string. +-- return a name,value pair as a string. local nv_pair = function ( name, value) if ( name == nil ) then return ( value or "" ) end - + if ( type(value) == "boolean" ) then value = tostring(value) end - + if ( value == nil ) then return ( "" ) else @@ -81,7 +81,7 @@ local boolean_attribute = function ( name, value ) end --[[ - each of these functions take a table that has an associative array of + each of these functions take a table that has an associative array of the values we might care about: value -- this is the value in the form element, or the selected element @@ -107,14 +107,14 @@ generic_input = function ( field_type, v ) v.name = name return table.concat(ret) end - if ( field_type == nil ) then + if ( field_type == nil ) then return nil end - + local str = string.format ( '" ) end - - + + --[[ Form functions ]]------------------------------------------------------ -- These expect something like a cfe to work (see mvc.lua) @@ -145,13 +145,13 @@ mymodule.form.longtext = function ( v ) local str = "', - nv_pair ( "class", mymodule.html_escape(v.class) ), - nv_pair ( "method", mymodule.html_escape(v.method) ), + nv_pair ( "class", mymodule.html_escape(v.class) ), + nv_pair ( "method", mymodule.html_escape(v.method) ), nv_pair ( "action", mymodule.html_escape(v.action) ) ) ) end - + function mymodule.form.stop ( ) return ("") end --- For "h1, h2, p," etc +-- For "h1, h2, p," etc -- WARNING - Text is printed verbatim - you may want to -- wrap the text in mymodule.html_escape function mymodule.entity (tag, text, class, id) @@ -282,9 +282,9 @@ function mymodule.entity (tag, text, class, id) nv_pair("id", id), mymodule.html_escape(text), mymodule.html_escape(tag)) ) end - -function mymodule.link ( v ) + +function mymodule.link ( v ) if ( v.value == nil ) then return nil end -- cgit v1.2.3