File:Ambox warning blue construction.svg | This module is rated as pre-alpha. It is unfinished, and may or may not be in active development. It should not be used from article namespace pages. Modules remain pre-alpha until the original editor (or someone who takes one over if it is abandoned for some time) is satisfied with the basic structure. |
UsageEdit
{{#invoke:Sandbox/Luis150902/cleanup|main|string}}
, where string is the string to be escaped. This eases the editing of wiki markup containing bidirectional text. Inserting =
(escaped form of =
) is displayed as ;61#&
between right-to-left characters.
- Test 1:
Template:((subst:#invoke:Sandbox/Luis150902/cleanup|main|ATemplate:))
returned A - Test 2:
Template:((subst:#invoke:Sandbox/Luis150902/cleanup|main|BTemplate:))
returned B - Test 3:
Template:((subst:#invoke:Sandbox/Luis150902/cleanup|main|אTemplate:))
returned א - Test 4:
Template:((subst:#invoke:Sandbox/Luis150902/cleanup|main|אתבשTemplate:))
returned אתבש (Atbash)
-- This module escapes Unicode characters >= U+0100.
local p = {}
function p._main(s)
local r = ""
local i = 1
local l = mw.ustring.len(s)
local e = ""
while i <= l do
if mw.ustring.codepoint(s, i) >= 256 then
e = mw.ustring.format("&#x%04x;", mw.ustring.codepoint(s, i))
else
e = mw.ustring.sub(s, i, i + 1)
end
r = r .. e
i = i + 1
end
return r
end
function p.main(frame)
return p._main(frame.args[1])
end
return p