52610.fb2 Пишем программу для создания книг FB2. - читать онлайн бесплатно полную версию книги . Страница 28

Пишем программу для создания книг FB2. - читать онлайн бесплатно полную версию книги . Страница 28

oldStyle:= CurStyle;

end; // for просмотр текста

if SytleStack.Count > 0 then

begin // закрываем все открытые секции

while SytleStack.Count > 0 do

begin

SytleStack.Delete(SytleStack.Count-1);

OutList.Add('</section>');

end;

end;

OutList.Add('</section>');

OutList.Add('</body>');

end;

procedure SaveEndnotes;

var

S: string;

i: integer;

begin

if Form1.EndNotesList.Items.Count = 0 then exit; //<a type="note" l: href="#n_1">[1]</a>

OutList.Add('<body name="notes"><title><p>Примечания</p></title>');

for i:= 0 to Form1.EndNotesList.Items.Count - 1 do

begin

S:= Form1.EndNotesList.Items[i];

OutList.Add('<section id="n_'+IntToStr(i+1)+'"><title><p>'+IntToStr(i+1)+'</p>');

OutList.Add('</title><p>'+S+'</p>');

OutList.Add('</section>');

end;

OutList.Add('</body>');

end;

Procedure Make_fb2(S: string);

begin //

if Form1.ListBox1.Items.Count = 0 then exit;

SytleStack.Clear;

OutList.Clear;

SaveDescription;

SaveBodyFB2;

SaveEndnotes;

OutList.Add('</FictionBook>');

OutList.SaveToFile(S); //++ +

showMessage('Done.');

end;

function BookHaveName: boolean;

begin

with Form1 do

result:= (book_title.Text <> '') and

(FB2_file.Text <> '') and

(GenresBox.Count > 0);

end;

procedure TForm1.SaveasFB21Click(Sender: TObject);

begin