Advertisement
KosIvantsov

replace_strip_tags.groovy

Jun 26th, 2013
215
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Groovy 0.68 KB | None | 0 0
  1. /*
  2.  * #Purpose: Remove tags in the current target
  3.  * #Details: http: // wp.me/p3fHEs-4W
  4.  *
  5.  * @author   Kos Ivantsov
  6.  * @date     2013-06-26
  7.  * @version  0.1
  8.  */
  9. import static javax.swing.JOptionPane.*
  10. import static org.omegat.util.Platform.*
  11.  
  12. // abort if a project is not opened yet
  13. def prop = project.projectProperties
  14. if (!prop) {
  15.   final def title = 'Strip tags in current segment'
  16.   final def msg   = 'Please try again after you open a project.'
  17.   showMessageDialog null, msg, title, INFORMATION_MESSAGE
  18.   return
  19. }
  20.  
  21. target = editor.getCurrentTranslation()
  22. if (target != null) {
  23. target = target.replaceAll(/<\/?[a-z]+[0-9]* ?\/?>/, '')
  24. }
  25. editor.replaceEditText(target)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement