Difference between revisions of "Module:HtmlBuilder/options"

From Minetest Wiki
Jump to navigation Jump to search
(Created page with "local options = { uniqPrefix = '\x7fUNIQ-', uniqSuffix = '-QINU\x7f' } options.encodedUniqPrefixPat = string.gsub( options.uniqPrefix, '[<>&"]', htmlencodeMap ); optio...")
 
(FnControlOption changed the content model of the page Module:HtmlBuilder/options from "plain text" to "Scribunto")
Tag: content model change
 
(2 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
local options = {
 
local options = {
 
     uniqPrefix = '\x7fUNIQ-',
 
     uniqPrefix = '\x7fUNIQ-',
     uniqSuffix = '-QINU\x7f'
+
     uniqSuffix = '-QINU\x7f',
 +
    htmlencodeMap = {
 +
        ['>'] = '&gt;',
 +
        ['<'] = '&lt;',
 +
        ['&'] = '&amp;',
 +
        ['"'] = '&quot;',
 +
    }
 
}
 
}
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

Latest revision as of 17:37, 7 June 2022

Documentation for this module may be created at Module:HtmlBuilder/options/doc

local options = {
    uniqPrefix = '\x7fUNIQ-',
    uniqSuffix = '-QINU\x7f',
    htmlencodeMap = {
        ['>'] = '&gt;',
        ['<'] = '&lt;',
        ['&'] = '&amp;',
        ['"'] = '&quot;',
    }
}
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