lua-users home
lua-l archive

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

target:gsub("[%z#]", ".html")

From: Peter Matulis <>
Sent: Friday, 22 January 2021 3:37 AM
To: <>
Subject: Combining two tiny scripts
Hi, I am very new to Lua but I do have two tiny Pandoc Lua filters that work. They are extremely similar and I would like to combine them. I'm just not sure how to introduce the conditional aspect.

1. This script simply exchanges the '.md' file extension for the '.html' extension:

function Link (link) ='(.+)', '%1.html')
  return link

2. This script does the same except it handles the case where the link contains an anchor:

function Link (link) ='(.+)', '%1.html#%2')
  return link