lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On 1/6/2011 2:59 AM, cormullion@mac.com wrote:
[snip]
-- Encode/escape certain characters inside Markdown code runs.
-- The point is that in code, these characters are literals,
-- and lose their special Markdown meanings.
function encode_code(s)
s = s:gsub("%&", "&")
s = s:gsub("<", "&lt;")
s = s:gsub(">", "&gt;")
for k,v in pairs(escape_table) do
s = s:gsub("%"..k, v)
end
return s
end

I've played with calling Vim, but - as a newcomer - imagined that
the necessary Lua code had already been written and would be
better than trying to interact with other processes... I had also
imagined that it would be simpler... :)

Yeah, I have a purely Lua-based one <300 lines that I used in a simple wiki-style text processor. I'll send it to you shortly.

--
Cheers,
Kein-Hong Man (esq.)
Kuala Lumpur, Malaysia