Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre > Editor

Notices

Reply
 
Thread Tools Search this Thread
Old 10-23-2021, 12:44 PM   #1
abraum
Enthusiast
abraum began at the beginning.
 
Posts: 31
Karma: 10
Join Date: Aug 2020
Device: Tablet
Delete Images in preview window / external script to customize code / shortcut

Hi,

at the moment i edit a very complex ebook that was created from abbyy finereader from a scanned book. the ebook contains a lot of images and sometimes i have to replace or delete an image. i can do this in the file browser with a right click on the image and delete or replace or export the image. its a lot of scrolling when i have more then 20 xhtml or image files. is there a way to have the same options directly when i right click on the image in the preview? here i can open an image with an external program but i miss the other options. also deleting the code (<img src=....>) would be interesting.

sometimes abbyy finereader makes the same terrible sh*t every time with the same kind of content (e.g. tables or lists). i have scripted some little shell scripts with a little bit search&replace that creates clear code. i would be helpful if i could highlight a part of the code, right click, "run external script" and copy back what the output of the script is.

and last:
can i create a shortcut for a regularly used tag (in my case figcaption)?
abraum is offline   Reply With Quote
Old 10-23-2021, 01:21 PM   #2
theducks
Well trained by Cats
theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.
 
theducks's Avatar
 
Posts: 29,944
Karma: 55705602
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
Clicking in Preview synchronizes Code view to the line.
Delete that line. That deletes the USAGE

At the end, Run tools:reports:Image files; Those with 0 are not used
You can delete the ACTUAL Image from there
theducks is offline   Reply With Quote
Advert
Old 10-23-2021, 01:36 PM   #3
lomkiri
Zealot
lomkiri ought to be getting tired of karma fortunes by now.lomkiri ought to be getting tired of karma fortunes by now.lomkiri ought to be getting tired of karma fortunes by now.lomkiri ought to be getting tired of karma fortunes by now.lomkiri ought to be getting tired of karma fortunes by now.lomkiri ought to be getting tired of karma fortunes by now.lomkiri ought to be getting tired of karma fortunes by now.lomkiri ought to be getting tired of karma fortunes by now.lomkiri ought to be getting tired of karma fortunes by now.lomkiri ought to be getting tired of karma fortunes by now.lomkiri ought to be getting tired of karma fortunes by now.
 
lomkiri's Avatar
 
Posts: 136
Karma: 1000102
Join Date: Jul 2021
Device: N/A
Quote:
Originally Posted by abraum View Post
can i create a shortcut for a regularly used tag (in my case figcaption)?
Snippets do that. See this Kovid's post.
You have also a button "insert a tag" in the page's toolbar.
lomkiri is offline   Reply With Quote
Old 11-02-2021, 06:40 AM   #4
abraum
Enthusiast
abraum began at the beginning.
 
Posts: 31
Karma: 10
Join Date: Aug 2020
Device: Tablet
Quote:
Originally Posted by lomkiri View Post
You have also a button "insert a tag" in the page's toolbar.
i can add a tag to the button but not insert a tag using a shortcut, e.g. ALT+F for 'figcaption'?

Quote:
Originally Posted by lomkiri View Post
Snippets do that. See this Kovid's post.
that's not what i mean. in my books very offen i have this situation:

Code:
<img .../>
<p>text</p>
and i want this

Code:
<figure>
<img .../>
<figcaption>
<p class="caption">text</p>
</figcaption>
</figure>
can i highlight the first code and then "do something", e.g. running a script with the highlighted text as input and output the second text?

there is a plugin called "Action Chains" and i've installed it. but i can't find it in the calibre editor? the plugin only works in the normal calibre GUI not in the calibre editor?
abraum is offline   Reply With Quote
Old 11-02-2021, 10:44 AM   #5
theducks
Well trained by Cats
theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.
 
theducks's Avatar
 
Posts: 29,944
Karma: 55705602
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
*assumed* follows
That the IMG tag is always followed by a caption (p tag)
(BTW I don't think a naked <img is allowed) I wrapped it in a basic div

REGEX (saved search if you intend to use again)
Simply search
Code:
(<img .+?</img>)\s+<p>(.+?)</p>
Replace:
Code:
<figure>
<div>\1</div>
<figcaption>
<p class="caption">\2</p>
</figcaption>
</figure>
theducks is offline   Reply With Quote
Advert
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
4.20 Code window and preview not syncing JSWolf Editor 7 07-07-2020 05:44 PM
KUAL: Shortcut to run script in myts aswanson Kindle Developer's Corner 2 05-11-2018 06:35 PM
Replace/customize keyboard shortcut? eosrose Calibre 2 11-10-2011 07:17 PM
How do I get a shortcut for a Python script onto the taskbar in W7? Sydney's Mom Workshop 6 03-28-2010 08:11 PM
Could you make a script for changing button shortcut for me? harpum iRex 42 07-13-2008 02:00 AM


All times are GMT -4. The time now is 01:07 PM.


MobileRead.com is a privately owned, operated and funded community.