Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
160 views
in Technique[技术] by (71.8m points)

Calibre - Regex code to add parameter to a tag

Good morning,

I am new in calibre, and when I did my first conversion from azw3 to epub, the text appears in positions that do not correspond,

then investigating a little more in the code I have verified that it is missing to add a parameter to a label.

<span class="word si fs5" style="left: 518px; top: 613px; width: 165px; ">COU</span>
<span class="word si fs5" style="left: 697px; top: 613px; width: 149px; ">RSE</span>
<span class="word si fs6" style="left: 891px; top: 613px; width: 219px; ">BOOK</span>

What I need is to add the word "pos" after "word si", the result should look like this.

<span class="word si pos fs5" style="left: 518px; top: 613px; width: 165px; ">COU</span>
<span class="word si pos fs5" style="left: 697px; top: 613px; width: 149px; ">RSE</span>
<span class="word si pos fs6" style="left: 891px; top: 613px; width: 219px; ">BOOK</span>

In this way the absolute position of the left and top scrolling parameters will be respected, and the text will be scrolled to the correct position.

I started reading the regex examples, and the only thing I could do was this, but I don't achieve the desired result.

search : word si([^f]+)

replace : 1pos

somebody please help me.

Greetings.

question from:https://stackoverflow.com/questions/65644207/calibre-regex-code-to-add-parameter-to-a-tag

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...