Difference between revisions of "Module:HtmlBuilder/options"
Jump to navigation
Jump to search
(Created page with "local options = { uniqPrefix = '\x7fUNIQ-', uniqSuffix = '-QINU\x7f' } options.encodedUniqPrefixPat = string.gsub( options.uniqPrefix, '[<>&"]', htmlencodeMap ); optio...") |
m |
||
Line 1: | Line 1: | ||
local options = { | local options = { | ||
uniqPrefix = '\x7fUNIQ-', | uniqPrefix = '\x7fUNIQ-', | ||
− | uniqSuffix = '-QINU\x7f' | + | uniqSuffix = '-QINU\x7f', |
+ | htmlencodeMap = { | ||
+ | ['>'] = '>', | ||
+ | ['<'] = '<', | ||
+ | ['&'] = '&', | ||
+ | ['"'] = '"', | ||
+ | } | ||
} | } | ||
− | options.encodedUniqPrefixPat = string.gsub( options.uniqPrefix, '[<>&"]', htmlencodeMap ); | + | options.encodedUniqPrefixPat = string.gsub( options.uniqPrefix, '[<>&"]', options.htmlencodeMap ); |
options.encodedUniqPrefixPat = string.gsub( options.encodedUniqPrefixPat, '%p', '%%%0' ); | options.encodedUniqPrefixPat = string.gsub( options.encodedUniqPrefixPat, '%p', '%%%0' ); | ||
options.uniqPrefixRepl = string.gsub( options.uniqPrefix, '%%', '%%%0' ); | options.uniqPrefixRepl = string.gsub( options.uniqPrefix, '%%', '%%%0' ); | ||
− | options.encodedUniqSuffixPat = string.gsub( options.uniqSuffix, '[<>&"]', htmlencodeMap ); | + | options.encodedUniqSuffixPat = string.gsub( options.uniqSuffix, '[<>&"]', options.htmlencodeMap ); |
options.encodedUniqSuffixPat = string.gsub( options.encodedUniqSuffixPat, '%p', '%%%0' ); | options.encodedUniqSuffixPat = string.gsub( options.encodedUniqSuffixPat, '%p', '%%%0' ); | ||
options.uniqSuffixRepl = string.gsub( options.uniqSuffix, '%%', '%%%0' ); | options.uniqSuffixRepl = string.gsub( options.uniqSuffix, '%%', '%%%0' ); | ||
return options | return options |
Revision as of 19:33, 10 April 2017
local options = {
uniqPrefix = '\x7fUNIQ-', uniqSuffix = '-QINU\x7f', htmlencodeMap = { ['>'] = '>', ['<'] = '<', ['&'] = '&', ['"'] = '"', }
} options.encodedUniqPrefixPat = string.gsub( options.uniqPrefix, '[<>&"]', options.htmlencodeMap ); options.encodedUniqPrefixPat = string.gsub( options.encodedUniqPrefixPat, '%p', '%%%0' ); options.uniqPrefixRepl = string.gsub( options.uniqPrefix, '%%', '%%%0' ); options.encodedUniqSuffixPat = string.gsub( options.uniqSuffix, '[<>&"]', options.htmlencodeMap ); options.encodedUniqSuffixPat = string.gsub( options.encodedUniqSuffixPat, '%p', '%%%0' ); options.uniqSuffixRepl = string.gsub( options.uniqSuffix, '%%', '%%%0' ); return options