| 
			
			 | 
		#1 | 
| 
			
			
			
			 Wizard 
			
			![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,292 
				Karma: 1428263 
				Join Date: Dec 2016 
				Location: Goiânia - Brazil 
				
				
				Device: iPad, Kindle Paperwhite, Kindle Oasis 
				
				
				 | 
	
	
	
		
		
			
			 
				
				Snippets
			 
			
			
			Hi, 
		
	
		
		
		
		
		
		
		
		
		
		
		
			I have a snippet for SVG covers: Code: 
	<?xml version='1.0' encoding='utf-8'?>
<html xmlns="http://www.w3.org/1999/xhtml" lang="${1:pt-BR}" xml:lang="${2:pt-BR}">
    <head>
        <title>${3:Capa}</title>
        <style type="text/css" title="override_css">
            @page {padding: 0pt; margin:0pt}
            body { text-align: center; padding:0pt; margin: 0pt; }
        </style>
    </head>
    <body>
        <div>
            <svg version="1.1" xmlns="http://www.w3.org/2000/svg"
                xmlns:xlink="http://www.w3.org/1999/xlink"
                width="100%" height="100%" viewBox="0 0 ${4:903} ${5:1354}"
                preserveAspectRatio="xMidYMid meet">
                <image width="${6:903}" height="${7:1354}" xlink:href="${8*:../Images/cover.jpg}"/>
            </svg>
        </div>
    </body>
</html>$9
To start, I select the image path (e.g.: '../Images/cover.jpg') and press Ctrl+J. The snippet get this path and creates the SVG cover. All good, except for the image height and width, that I have to edit manually. My question: is it possible to get these attributes as parameters for the snippet? The manual doesn't mention it, but maybe it might be possible. P.S.: I know I can use the "Add cover" option. But it is very specific for covers, and the lang attribute is always "en". I also use this for other full page images as well. Last edited by thiago.eec; 07-26-2023 at 10:46 AM.  | 
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| 
			
			 | 
		#2 | 
| 
			
			
			
			 creator of calibre 
			
			![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 45,609 
				Karma: 28549044 
				Join Date: Oct 2006 
				Location: Mumbai, India 
				
				
				Device: Various 
				
				
				 | 
	
	
	
		
		
		
		
		 
			
			Not sure what you mean by parameters for snippets? Where would you enter the parameters? I suspect you mean you want to fill out the width and height only once. In that case use mirroring, see https://manual.calibre-ebook.com/snippets.html
		 
		
	
		
		
		
		
		
		
		
		
		
		
	
	 | 
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| Advert | |
| 
         | 
    
| 
			
			 | 
		#3 | |
| 
			
			
			
			 Wizard 
			
			![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,292 
				Karma: 1428263 
				Join Date: Dec 2016 
				Location: Goiânia - Brazil 
				
				
				Device: iPad, Kindle Paperwhite, Kindle Oasis 
				
				
				 | 
	
	
	
		
		
		
		
		 Quote: 
	
 P.S.: Thanks for the tip. I didn't know about mirroring.  | 
|
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| 
			
			 | 
		#4 | 
| 
			
			
			
			 Well trained by Cats 
			
			![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 31,267 
				Karma: 61916422 
				Join Date: Aug 2009 
				Location: The Central Coast of California 
				
				
				Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A 
				
				
				 | 
	
	
	
		
		
		
		
		 
			
			I wondered why the Insert Image Tool did not have an AS SVG, tic option with all the expanded options  (not just for covers) 
		
	
		
		
		
		
		
		
		
		
		
		
	
	Gotta ask: Why not just have Calibre (Main) embed the cover (and metadata)?  | 
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| 
			
			 | 
		#5 | |
| 
			
			
			
			 Wizard 
			
			![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,292 
				Karma: 1428263 
				Join Date: Dec 2016 
				Location: Goiânia - Brazil 
				
				
				Device: iPad, Kindle Paperwhite, Kindle Oasis 
				
				
				 | 
	
	
	
		
		
		
		
		 Quote: 
	
 Like I said, calibre uses lang="en", while my books are in "pt-BR". Also, the <title> attribute would be in english. And as for metadata, I rather do it myself, for best control. Also, I have to many custom columns that would be incorporated unnecessarily.  | 
|
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| Advert | |
| 
         | 
    
| 
			
			 | 
		#6 | |
| 
			
			
			
			 creator of calibre 
			
			![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 45,609 
				Karma: 28549044 
				Join Date: Oct 2006 
				Location: Mumbai, India 
				
				
				Device: Various 
				
				
				 | 
	
	
	
		
		
		
		
		 Quote: 
	
  | 
|
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| 
			
			 | 
		#7 | 
| 
			
			
			
			 Wizard 
			
			![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,292 
				Karma: 1428263 
				Join Date: Dec 2016 
				Location: Goiânia - Brazil 
				
				
				Device: iPad, Kindle Paperwhite, Kindle Oasis 
				
				
				 | 
	
	|
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
![]()  | 
            
        
    
| Thread Tools | Search this Thread | 
            
  | 
    
			 
			Similar Threads
		 | 
	||||
| Thread | Thread Starter | Forum | Replies | Last Post | 
| recover snippets only | rjwse@aol.com | Calibre | 2 | 10-10-2020 08:34 AM | 
| Random crashes using snippets | Phssthpok | Editor | 14 | 09-23-2017 11:58 PM | 
| Color code and snippets. | apoiata | Sigil | 14 | 02-22-2017 10:44 PM | 
| Snippets !!! Icon for the toolbar?? | phossler | Editor | 12 | 01-12-2015 06:05 AM | 
| Emailing snippets from Kindle... | gfmucci | Amazon Kindle | 0 | 05-17-2010 09:56 AM |