Changeset 24 for trunk/UAcronym.pas


Ignore:
Timestamp:
May 5, 2016, 12:09:19 AM (9 years ago)
Author:
chronos
Message:
  • Modified: Better import source parsing.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/UAcronym.pas

    r22 r24  
    217217  while (TagBegin > 0) do begin  // while there is a < in S
    218218    TagEnd := Pos('>', S);              // find the matching >
    219     TagLength := TagEnd - TagBegin + 1;
    220     Delete(S, TagBegin, TagLength);     // delete the tag
    221     TagBegin:= Pos( '<', S);            // search for next <
     219    if TagEnd = 0 then TagLength := Length(S) - TagBegin
     220      else TagLength := TagEnd - TagBegin + 1;
     221    if TagLength > 0 then
     222      Delete(S, TagBegin, TagLength)     // delete the tag
     223      else Delete(S, 1, TagEnd);     // delete the tag
     224    TagBegin := Pos( '<', S);            // search for next <
    222225  end;
    223226
     
    400403
    401404          // Meaning
    402           P := Pos(Format.Meaning.StartString, S);
    403           Delete(S, 1, P + Length(Format.Meaning.StartString) - 1);
     405          if Length(Format.Meaning.StartString) > 0 then begin
     406            P := Pos(Format.Meaning.StartString, S);
     407            Delete(S, 1, P + Length(Format.Meaning.StartString) - 1);
     408          end;
    404409          P := Pos(Format.Meaning.EndString, S);
    405410          NewAcronym.Meaning := Trim(StripHTML(Copy(S, 1, P - 1)));
Note: See TracChangeset for help on using the changeset viewer.