I have a GNU makefile
with one of the recipe lines reading:
sed -i 's|<span class="math">$$\(.*\)$$</span>|<span style="font-size:100%">'"$$(curl -d "type=tex&q=\1" http://localhost:16000/)"'</span>|g' $(NAME).a4.xhtml
The idea is to replace <span class="math">$$\(.*\)$$</span>
by <span style="font-size:100%">..SVG..</span>
where ..SVG..
is the string returned by executing the shell command curl -d "type=tex&q=\1" http://localhost:16000/
and where \1
should be the previously remembered pattern \(.*\)
.
Problem: Both the pattern detection and the shell execution are working alright. However, \1
is not substituted by the previously remembered pattern.
PS: If one prefers to use sed
with the -r
option, matching inside the makefile
is as follows:
sed -i -r 's@<span class="math">\$$(.*)\$$</span>@..@..' $(NAME).a4.xhtml