This entry didn't have any title in the symbol file. I added
<title id="pound gbp">GBP Currency Pound</title>
But there are around 1000 + symbols like this in the sprite file. Is there any way to automate this process and make titles available inside Inkscape while using Symbols. Also because we can search Titles inside the Symbols window. I got the name from " class " value. Thanks.
@TylerDurden hi, is there any way to change the topic title. I should have used " How to add a Title to Symbols in a Symbol file ". Perhaps the wrong title is keeping this thread idle. Thanks.
Ok, looks like I managed to add a title to every <symbol>
But when I use this inside Inkscape 1.0 as Symbol it says " without a title ". It would be nice to know what is wrong. Have I not added a title the right way ? If not, please guide. Thanks.
Thanks @inklinea , all Looking forward to your Python based script :)
I somehow managed to add <title> properly to my Symbol pack. I just finished doing the same and got this notification for the above post. Lots of hard work and a lot of people helped 🏆
This entry didn't have any title in the symbol file. I added
<title id="pound gbp">GBP Currency Pound</title>
But there are around 1000 + symbols like this in the sprite file. Is there any way to automate this process and make titles available inside Inkscape while using Symbols. Also because we can search Titles inside the Symbols window. I got the name from " class " value. Thanks.
@TylerDurden hi, is there any way to change the topic title. I should have used " How to add a Title to Symbols in a Symbol file ". Perhaps the wrong title is keeping this thread idle. Thanks.
Yes, but it requires writing a script to do so. There isn't a feature in Inkscape which would do this automatically.
I would do this without using Inkscape at all.
You might have some luck if you can find an XML editor which has advanced tag features ( similar to mp3 tagging )
For a single file it's very easy to do in javascript in web browser.
An example :
If you open your svg file in a browser such as Chrome and press F12 to bring up the development console
These three lines will demonstrate how to update for a single symbol ( the first one found )
var className = document.getElementsByTagName('symbol')[0].getAttribute('class')
document.getElementsByTagName('symbol')[0].setAttribute('Title', className)
console.log(document.getElementsByTagName('svg')[0])
A loop for the above is what you need. If you expand the code that console.log outputs, you will see the first symbol will have a title.
Thanks +TylerDurden +inklinea
I will try to find some method to execute this JS in a loop.
I have VS Code. Will it have any plugin that can be used to achieve this ? So nice of you to help.
@inklinea got some help. Sadly, I am not able to use it
var input = document.getElementsByTagName("input");
alert(input.length);
for(let i = 0;i < input.length; i++)
{
ShowResults(input[i].value);
}
for(let i = 0;i < input.length; i++)
{
ShowResults(input[i].value);
}
var className = document.getElementsByTagName('symbol')[0].getAttribute('class')
var input=document.getElementsByTagName('symbol');
for(let i = 0;i < input.length; i++)
{
document.getElementsByTagName('symbol')[i].setAttribute('Title', className);
}
put ur code in place of showresults above
and use i instead of 0
Ok, looks like I managed to add a title to every <symbol>
But when I use this inside Inkscape 1.0 as Symbol it says " without a title ". It would be nice to know what is wrong. Have I not added a title the right way ? If not, please guide. Thanks.
<symbol
id="arrow-clockwise"
width="16"
height="16"
fill="currentColor"
class="bi bi-arrow-clockwise"
title="arrow-clockwise"
viewBox="0 0 16 16">
<path
fill-rule="evenodd"
d="M8 3a5 5 0 1 0 4.546 2.914.5.5 0 0 1 .908-.417A6 6 0 1 1 8 2v1z"
id="path77" />
<path
d="M8 4.466V.534a.25.25 0 0 1 .41-.192l2.36 1.966c.12.1.12.284 0 .384L8.41 4.658A.25.25 0 0 1 8 4.466z"
id="path79" />
</symbol>
Apologies, my fault.
The code I posted was to create an attribute called title.
var className = document.getElementsByTagName('symbol')[0].getAttribute('class')
var sym = document.createElement('title')
sym.innerHTML = className
document.getElementsByTagName('symbol')[0].appendChild(sym)
I might write something in python as an inkscape extension in the future.
Paths > symbol etc is something that I have definitely used in the past.
console.log(document.getElementsByTagName('svg')[0])
Thanks @inklinea , all Looking forward to your Python based script :)
I somehow managed to add <title> properly to my Symbol pack. I just finished doing the same and got this notification for the above post. Lots of hard work and a lot of people helped 🏆