Loading ...
Sorry, an error occurred while loading the content.

RE: [Clip] Editing in external programs

Expand Messages
  • Grant
    clipThe problem with the Select between tags in erics utilities library is that it fails when an element contains nested elements.
    Message 1 of 10 , Dec 7, 2000
    • 0 Attachment
      clipThe problem with the "Select between tags" in erics utilities library
      is that it fails when an element contains nested elements.

      <ul>
      <li>
      <li>
      <ul>
      <li>
      </li>
      <li>
      </li>
      </ul>
      </li>
      </li>
      </ul>

      What is needed is a way to keep track of the closure of an open tags
      Try the following clip which I just wrote as an improved version of the one
      in my xhtml library.
      Use by placing cursor between the brackets of any tag and running the clip
      Normal mode.. Selects the 'element'
      To select the 'innerHtml' (the stuff contained by the element) use "alt"
      To select the 'tag' use "ctrl"

      h=selectTag
      ^!SetScreenUpdate Off
      ^!Set %Alt%=0
      ^!IfTrue ^$IsEmpty(^$GetHtmlTag()$)$ EXIT
      ^!Set %Tag%=^$GetHtmlTag(true)$
      ^!IfTrue "^$IsCtrlKeyDown$" ^!GoTo Exit
      ^!IfTrue "^$IsAltKeyDown$" ^!Set %Alt%=1
      ^!Set %Tname%=^$GetHtmlTagName(^%Tag%)$
      ^!Set %elStart%=^$GetRowStart$:^$GetColStart$
      ^!Set %tagClosed%=1
      :deNest
      ^!Find ^%Tname% TIS
      ;is openining or closing tag.
      ^!Jump Select_Start
      ^!Set %char%=^$GetChar(-1)$
      ^!IfSame "/" "^%char%" ^!dec %tagClosed%
      ^!IfSame "<" "^%char%" ^!inc %tagClosed%
      ^!MoveCursor ^$StrSize(^%Tname%)$
      ^!If ^%tagClosed% = 0 next else deNest
      ^!Set %Tag%=^$GetHtmlTag(true)$
      ^!Set %elEnd%=^$GetRowEnd$:^$GetColEnd$
      ^!SetCursor ^%elStart%
      ^!SelectTo ^%elEnd%
      ^!IfTrue ^%Alt% Alt Else SELECT
      :Alt
      ^!Find "</" bs
      ^!Jump Select_Start
      ^!Set %elEnd%=^$GetRowEnd$:^$GetColEnd$
      ^!SetCursor ^%elStart%
      ^!Find ">" TIS
      ^!Jump Select_End
      ^!Set %elStart%=^$GetRowEnd$:^$GetColEnd$
      :SELECT
      ^!SetCursor ^%elStart%
      ^!SelectTo ^%elEnd%
      ^!GoTo Exit
    Your message has been successfully submitted and would be delivered to recipients shortly.