November 14, 2012 at 6:52 am #10627
Stefan
Participant
.
Hi and welcome.
1.)
Do “<span" and "” always be on the same line?
Or could it be that they are on different lines like
1.
CCNA Portable Command Guide
Your example doesn’t provide this detail.
– – –
2.)
Is it always the first occurrence of “” in a line that can be remove?
Then the rule would be easier:
if there is found a closing tag without an opening tag before, then it can be removed.
Proof Of Concept:
openTag = "<span";
closingTag = "</span";
yLine = document.selection.GetActivePointY( eePosLogical );
str = document.GetLine( yLine );
openTagPos = str.indexOf(openTag);
closingTagPos = str.indexOf(closingTag);
if(closingTagPos > -1){
if(openTagPos == -1 || (closingTagPos < openTagPos)){
alert("delete");
}else{
alert("all ok");
}
}else{
alert("not found " + closingTag);
}