Quote:
Originally Posted by Doitsu
Unless I'm missing something it's currently not possible to add additional replace functions that don't use one of the predefined custom functions e.g. replace_uppercase, replace_lowercase etc.
Let's take a trivial, rather contrived example. How would a user write a custom function that wraps certain words in a <span> tag with the search expression as a title attribute?
Find:(word1|word2|word3)
The result should be <span title="word1">word1</span>.
|
Off the top of my head I would try the following:
Code:
def replace(match, number, file_name, metadata, data):
if match:
return '<span title="' + match.group(1) +'">' + match.group(1) + '</span>'
You use the 'New' button to get a new empty function replace and then edit it to look like the above, then hit the "use button to initialize the replace field
in F&R and close the Editor.
If you have trouble making your own functions, then my guess is you are missing some changes from your build as this works in Sigil master but did not in the original version of my repo.
So maybe try a clean build from normal Sigil master?