lua-users home
lua-l archive

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


On Thu, Jan 21, 2021 at 7:38 PM Peter Matulis wrote:
1. This script simply exchanges the '.md' file extension for the '.html' extension:

function Link (link)
  link.target = link.target:gsub('(.+)%.md', '%1.html')
  return link
end

To avoid replacing ".md" in the middle of a link (as in "www.md.com"), the "$" anchor is needed.
link.target = link.target:gsub('^(.+)%.md$', '%1.html')

The combination of the two scripts may look like the following:
link.target = link.target:gsub('^(.+)%.md%f[%z#]', '%1.html')