Sublime Forum

Plugin to duplicate line at another xml tag

#1

Dear all,

If somebody could help me to write a plugin to do the following, I would be forever grateful! I am working with a lot of xml files that have a lot of duplicate lines between different tags.

This plugin should be activated for all files whose name is NominalResultRouting*.xml* (* is wildcard). It should detect if text is written after the tag “Tourbriefing” and before the subtag “RouteBriefing”, and duplicate the text inside “Routebriefing”. So, for example, if we have

 <Tourbriefing merge="true">
     I write something here
     <RouteBriefing>
     </RouteBriefing>
 </Tourbriefing> 

then this should automatically result to this:

 <Tourbriefing merge="true">
     I write something here
     <RouteBriefing>
          I write something here
     </RouteBriefing>
 </Tourbriefing> 

Is that possible?

Thank you very much in advance.

0 Likes