/* * This is simple jEdit macro to strip selected tag from HTML code and leave inner text intouched. * * charset: UTF-8 * * (c) TAAT Digital Technologies 2006 * Tomasz Pęszor * info at taat dot pl * http://taat.pl/jedit/ */ public static void strip_enclosing_tags() { while(true) { tags = Macros.input(view, "Enter tag name to strip","span"); if(tags == null) return; if (textArea.getSelectedText()==null) { mcp=textArea.getCaretPosition(); textArea.selectAll(); sn=true; } String[] tostrip=tags.split(" "); try { SearchAndReplace.setBeanShellReplace(true); SearchAndReplace.setIgnoreCase(true); SearchAndReplace.setRegexp(true); for(int i=0;i]*>([^("); SearchAndReplace.setReplaceString("_1"); SearchAndReplace.replace(view); } if (sn==true) { textArea.selectNone(); len=buffer.getLength(); if (mcp>len) mcp=len; textArea.setCaretPosition(mcp); } return; } catch(NumberFormatException e){ } } } // main if(buffer.isReadOnly()) Macros.error(view, "Buffer is read-only."); else strip_enclosing_tags(); /* Macro index entry (in DocBook XML) Strip_enclosing_tag.bsh This is simple jEdit macro to strip selected tag from HTML code and leave inner text intouched. (c) TAAT Digital Technologies 2006 */