(* Index file sorted by full classification line *) maintainIndexf := ( Print["Running maintainIndexf ..."]; filesample = ToFileName[{dirwork, "templates"}, "indexf.htm"]; checkfile[filesample]; text = Import[filesample, "Text"]; spanRead[text]; spanNew["topline"] = toplinefix[spanOld["topline"]]; line0 = linef0 = ""; spanNew["items"] = Table[ name = data[[1]]; (* Checking synonyms *) namerepl = name /. replnames; If[namerepl =!= name && MemberQ[namespic, namerepl], Print["Error: name ", name, " -> ", namerepl, " already in the list!"]; "", getAttributes[name]; line1 = classline4; spanNew["order"] = If[line1 === line0, "", StringReplace[spanOld["order"], "LINEORDER" -> line1]]; line0 = line1; linef1 = familyen; If[familyL =!= nofamily, linef1 = " family <> "\">" <> linef1 <> ""]; spanNew["family"] = If[linef1 === linef0, "", StringReplace[spanOld["family"], "FAMILYTR" -> linef1]]; linef0 = linef1; spanNew["species"] = StringReplace[spanOld["species"], "NAMETR" -> nameen]; spanNew["synonyms"] = If[synline === "", "", StringReplace[spanOld["synonyms"], "SYNONYMS" -> synline]]; cnames = translatename[idname, "en"]; spanNew["common"] = ""; (* show it only on individual mushroom pages *) spanNew["wiki"] = ""; spanNew["pictures"] = StringReplace[spanOld["pictures"], "amanita_muscaria.htm" -> nameLUnd <> ".htm"]; set = picset[name]; If[Length[set] > 1, spanNew["pictures"] = StringReplace[spanNew["pictures"], "amanita_muscaria.jpg" -> nameLUnd <> ".jpg"], {year, roll, pic} = set[[1]]; urljpg = "asergeev/pictures/archives/compress/" <> year <> "/" <> roll <> "/" <> "/jpeg/" <> pic <> "t.jpg"; spanNew["pictures"] = StringReplace[spanNew["pictures"], "pic/amanita_muscaria.jpg" -> urljpg], Print["Error: No pictures for the name: ", name]; spanNew["pictures"] = ""; ]; spanReplace[spanOld["items"]]], {data, listsort}] // StringJoin; spanNew["familylist"] = Table[ StringReplace[spanOld["familylist"], "FamilyName" -> family], {family, familyList}] // StringJoin; epilog = StringReplace[epilog0, {"SCRIPTNAME" -> "indexf", RegularExpression["(?i)\\s*
  • .*?\"indexf.htm\".*"] -> ""}]; spanNew["epilog"] = epilog; text = spanReplace[text]; file = ToFileName[dir0, "indexf.htm"]; Export[file, text, "Text"]; );