Definition at line 1148 of file html.cpp.
References TVec< TVal >::Add(), THtmlDoc::AddTokV(), TVec< TVal >::Clr(), forever, THtmlTok::GetHTok(), THtmlDoc::GetTok(), THtmlDoc::GetToks(), HldV, hsyBTag, hsyETag, hsyNum, hsySSym, hsyStr, THtmlTok::IsBreakTok(), THtmlTok::IsHTag(), TVec< TVal >::Len(), RefHtmlDoc, THtmlDoc::SaveTxt(), and TSOut::StdOut.
:
RefHtmlDoc(_RefHtmlDoc), HldV(){
bool IsTitleAct=false; THtmlTokV TitleTokV;
bool IsHAct=false; int ActHTagN=-1;
TVec<THtmlTokV> HTokV(6);
PHtmlTok Tok; THtmlLxSym TokSym; TStr TokStr;
for (int TokN=0; TokN<RefHtmlDoc->GetToks(); TokN++){
Tok=RefHtmlDoc->GetTok(TokN, TokSym, TokStr);
if ((TokSym==hsyBTag)&&(TokStr==THtmlTok::ATagNm)){
int ATokN; PHtmlTok ATok; THtmlLxSym ATokSym; TStr ATokStr;
THtmlTokV ATokV; ATokN=TokN;
forever{
ATok=RefHtmlDoc->GetTok(ATokN, ATokSym, ATokStr);
if (ATokSym!=hsySSym){ATokV.Add(ATok);}
if ((ATokSym==hsyETag)&&(ATokStr==THtmlTok::ATagNm)){break;}
ATokN++;
if (ATokN>=RefHtmlDoc->GetToks()){break;}
}
int ETagATokN=ATokN+1;
THtmlTokV PrevATokV; ATokN=TokN;
forever{
ATokN--;
if (ATokN<0){break;}
ATok=RefHtmlDoc->GetTok(ATokN, ATokSym, ATokStr);
if (THtmlTok::IsBreakTok(ATok)){break;}
if ((ATokSym==hsyStr)||(ATokSym==hsyNum)){PrevATokV.Add(ATok);}
if (ATokV.Len()>=HldWnLen){break;}
}
THtmlTokV NextATokV; ATokN=ETagATokN;
forever{
ATokN++;
if (ATokN>=RefHtmlDoc->GetToks()){break;}
ATok=RefHtmlDoc->GetTok(ATokN, ATokSym, ATokStr);
if (THtmlTok::IsBreakTok(ATok)){break;}
if ((ATokSym==hsyStr)||(ATokSym==hsyNum)){NextATokV.Add(ATok);}
if (ATokV.Len()>=HldWnLen){break;}
}
PHtmlDoc HtmlDoc=PHtmlDoc(new THtmlDoc());
HtmlDoc->AddTokV(TitleTokV);
for (int HTagN=1; HTagN<=6; HTagN++){HtmlDoc->AddTokV(HTokV[HTagN-1]);}
HtmlDoc->AddTokV(PrevATokV);
HtmlDoc->AddTokV(ATokV);
HtmlDoc->AddTokV(NextATokV);
HldV.Add(HtmlDoc);
HtmlDoc->SaveTxt(TSOut::StdOut);
} else
if (TokSym==hsyBTag){
int HTagN;
if (TokStr==THtmlTok::TitleTagNm){
IsTitleAct=true; TitleTokV.Clr(); TitleTokV.Add(Tok);
} else
if (THtmlTok::IsHTag(TokStr, HTagN)){
if (IsHAct){
HTokV[ActHTagN-1].Add(THtmlTok::GetHTok(false, ActHTagN));}
IsHAct=true; ActHTagN=HTagN;
{for (int HTagN=ActHTagN; HTagN<=6; HTagN++){HTokV[HTagN-1].Clr();}}
HTokV[ActHTagN-1].Add(Tok);
}
} else
if (TokSym==hsyETag){
int HTagN;
if (TokStr==THtmlTok::TitleTagNm){
if (IsTitleAct){TitleTokV.Add(Tok); IsTitleAct=false;}
} else
if (THtmlTok::IsHTag(TokStr, HTagN)){
if (IsHAct){HTokV[ActHTagN-1].Add(Tok); IsHAct=false;}
}
} else
if (TokSym!=hsySSym){
if (IsTitleAct){TitleTokV.Add(Tok);}
if (IsHAct){HTokV[ActHTagN-1].Add(Tok);}
}
}
}