var dict := new SortedDictionary>; function DictToItems: string; begin var sb := new StringBuilder; foreach var kv in dict do begin sb.AppendLine('
  • '); sb.AppendLine($' '); foreach var v in kv.Value do sb.AppendLine($' '); sb.AppendLine(''); end; Result := sb.ToString; end; begin var tt := ReadAllText('Table of Contents New.hhc'); var filesmatch := tt.Matches(''); foreach var fmatch in filesmatch do begin var fname := fmatch.Groups[1].Value; //Println(fname); var txt := ReadAllText('.\'+fname); var mm := txt.Matches(''); foreach var m in mm do begin var keyword := m.Groups[1]; var s := keyword.ToString.Trim; if s.Length > 0 then begin if s not in dict then dict[s] := new List; dict[s].Add(fname) end; end; end; //dict.PrintLines; var s := ''+NewLine+ ''+NewLine+ ''+NewLine+ ''+NewLine+ ''+NewLine+ ''+NewLine+ '
      '+NewLine+ DictToItems + '
    '+NewLine+ '' ; WriteAllText('Index.hhk',s); end.