Thread: Snippets
View Single Post
Old 07-26-2023, 09:41 AM   #1
thiago.eec
Wizard
thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.
 
Posts: 1,217
Karma: 1419583
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
I use it to transform simple <img> tags into a SVG cover.

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 09:46 AM.
thiago.eec is offline   Reply With Quote