I am not quit sure where your script fails. Do you have an example or can
you provide more information about how it fails? Your expression looks
quite general. I imagine that it also catches values that you don't intend
to change (e.g. the duration of the effects).
This is probably the case. It may not be feasible to edit the XML using
grep and sed, as this indiscriminately changes the text based on the
line match and does not look at context. I have played around with
Python and lxml to mitigate this; I attach the commented script which
should be ok to follow. This still fails as some effects appear to be
incorrectly numbered / ordered. I.e. the file can still be opened in a
brower and some effects are displayed, but in the wrong order, and some
seem lost.
Looking at the nodes in Inkscape XML editor however seems fine to me, so
I am not sure why the problem occurs.
I cannot see why this fails, but maybe someone else can spot it.
Basically, what the script does is:
- Load the .svg (xml) file as an etree in Python
- Loop through the tree until a jessink effect node is found
- Loop through the children of this node to find the element specifying
the order (there will be some overlap with the loop above as when this
loop exits, the above loop goes to the next element; however this
shouldn't - be a problem due to the conditionals not being fulfilled
for other nodes)
- Save the all effect order numbers in a vector that is then sorted
- Create a dictionary from the sorted vector and remap the numbers in
increments of 10
- Loop through the tree in the same way again and when the order
attribute is found, replace it by the value in the dictionary
- Write the file back through etree.write()
On a test file, renumbering could be done by
./jessy_renumber -v test_file.svg
Next week, I will have access to my laptop again. I'll look into
the issue
in more detail then.
> I made an attempt as I outlined by using grep and sed, but this seems to
> break the file somewhere. Basically, I just look for all lines
> ,----
> | sodipodi:role=\"line\">[0-9]*</tspan></text>"
> `----
> and renumber them in increments of 10. I thought this was only used for
> effects, but apparently not? Any ideas of why this fails?
>
> I attach the trivial bash script below (my Python skills are not up to
> the task). This is a simplistic way that do not respect the
> slides as mentioned below and as mentioned breaks the file (partly), so
> use on some test file!
>
>
>
> Johnny <yggdrasil@...2719...> writes:
>
>> Hi Hannes and thanks for your reply. I will try to get around to develop
>> some renumbering scheme to rebaseline. Thanks for the reminder of
>> different slides/layers; as I do not use this but only transformations
>> it had not occured to me.
>>
>> Regards,
>>
>> Johnny
>>
>> "Hannes Hochreiner" <hannes@...2460...> writes:
>>
>>> Hi Jonny,
>>>
>>> currently, there is no way to reassign the order numbers. As you said,
>>> it
>>> should not be very hard to write one. For the implementation I would
>>> prefer Python to avoid problems when using the script on other
>>> platforms.
>>>
>>> Also, keep in mind that the effect numbering of one slide is
>>> independent
>>> from the next.
>>>
>>> Cheers,
>>> Hannes
>>>
>>>> Hi all,
>>>>
>>>> Jessyink [1]is really a very nice extension to Inkscape to enable
>>>> doing
>>>> dynamic presentations, I can really recommend it! There are two
>>>> versions, I use the latter, Jessyink 2.0.0-alpha1.
>>>>
>>>> However, I usually end up adding effects and manually setting the
>>>> order
>>>> and eventually running out of numbers. E.g. I start to number the
>>>> effects by 10, 20, 30, etc. but soon end up having orders 1, 2, 3, 4,
>>>> ... and wanting to insert a new efect between e.g. 2 and 3. Therefore
>>>> I
>>>> wonder, is there some way to renumber the effects to make some space
>>>> that I have missed?
>>>>
>>>> As the svg-files are just text files, I am considering a script to do
>>>> this to find and renumber the effects; the finding part can be
>>>> achieved by
>>>> e.g.
>>>>
>>>> ,----
>>>> | cat my_svg_file_with_jessyink.svg|grep
>>>>
"sodipodi:role=\"line\">[0-9]*</tspan></text>"|grep
[0-9]*
>>>> `----
>>>>
>>>> This gives all the lines with effect numbers, maybe sed or awk can be
>>>> used in a loop to renumber in order and increment by a
>>>> desired step (e.g. 10). Now, my skills are not really up to the task,
>>>> so
>>>> before embarking, the question is is this really the best route to go
>>>> or
>>>> are there any better ideas?
>>>>
>>>> Thanks and cheers!
>>>>
>>>>
>>>> Footnotes:
>>>> [1]
http://code.google.com/p/jessyink/
>>>>
>>>> --
>>>> Johnny
>>>>
>>>>
------------------------------------------------------------------------------
>>>> Virtualization & Cloud Management Using Capacity Planning
>>>> Cloud computing makes use of virtualization - but cloud computing
>>>> also focuses on allowing computing to be delivered as a service.
>>>>
http://www.accelacomm.com/jaw/sfnl/114/51521223/
>>>> _______________________________________________
>>>> Inkscape-user mailing list
>>>> Inkscape-user(a)lists.sourceforge.net
>>>>
https://lists.sourceforge.net/lists/listinfo/inkscape-user
>>>>
>>>>
>>>
>>>
>>>
------------------------------------------------------------------------------
>>> Virtualization & Cloud Management Using Capacity Planning
>>> Cloud computing makes use of virtualization - but cloud computing
>>> also focuses on allowing computing to be delivered as a service.
>>>
http://www.accelacomm.com/jaw/sfnl/114/51521223/
>>> _______________________________________________
>>> Inkscape-user mailing list
>>> Inkscape-user(a)lists.sourceforge.net
>>>
https://lists.sourceforge.net/lists/listinfo/inkscape-user
>
> --
> Johnny
> ------------------------------------------------------------------------------
> Virtualization & Cloud Management Using Capacity Planning
> Cloud computing makes use of virtualization - but cloud computing
> also focuses on allowing computing to be delivered as a service.
>
http://www.accelacomm.com/jaw/sfnl/114/51521223/_________________________...
> Inkscape-user mailing list
> Inkscape-user(a)lists.sourceforge.net
>
https://lists.sourceforge.net/lists/listinfo/inkscape-user
>
------------------------------------------------------------------------------
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d
_______________________________________________
Inkscape-user mailing list
Inkscape-user(a)lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/inkscape-user