Юрий Карпов - Пишем программу для создания книг FB2.

Здесь есть возможность читать онлайн «Юрий Карпов - Пишем программу для создания книг FB2.» весь текст электронной книги совершенно бесплатно (целиком полную версию без сокращений). В некоторых случаях можно слушать аудио, скачать через торрент в формате fb2 и присутствует краткое содержание. Жанр: Программирование, Программы, на русском языке. Описание произведения, (предисловие) а так же отзывы посетителей доступны на портале библиотеки ЛибКат.

Пишем программу для создания книг FB2.: краткое содержание, описание и аннотация

Предлагаем к чтению аннотацию, описание, краткое содержание или предисловие (зависит от того, что написал сам автор книги «Пишем программу для создания книг FB2.»). Если вы не нашли необходимую информацию о книге — напишите в комментариях, мы постараемся отыскать её.

Подробный комментарий к исходному коду программы создающей книжку в формате FB2.

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

Ниже представлен текст книги, разбитый по страницам. Система сохранения места последней прочитанной страницы, позволяет с удобством читать онлайн бесплатно книгу «Пишем программу для создания книг FB2.», без необходимости каждый раз заново искать на чём Вы остановились. Поставьте закладку, и сможете в любой момент перейти на страницу, на которой закончили чтение.

Тёмная тема
Сбросить

Интервал:

Закладка:

Сделать

PrintString('middle-name',mname);

PrintString('nick',nick);

PrintString('email',email);

end;

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

end;

end;

procedure SaveSequence;

var

s: string;

begin

with Form1 do

begin

if sequence.Text = '' then exit;

S:= '

if tome.Text = ''

then S:= S + '/>'

else S:= S + ' number="'+tome.Text+'"/>';

end;

OutList.Add(S);

end;

procedure SaveDescription;

const

max = 5;

mas: array[1..max] of string =

(

'',

'

' xmlns: l="http://www.w3.org/1999/xlink">',

' ',

' '

);

var

i: byte;

S: string;

begin

// head

for i:= 1 to max do

OutList.Add(Mas[i]);

with form1.GenresBox do

if Items.Count > 0 then

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

OutList.Add(''+GetGaner(Items[i])+'');

SavePersons('author',Form1.ListBox3);

SavePersons('translator',Form1.ListBox2);

with Form1 do

begin

PrintString('book-title',book_title.text);

if Annotation.Lines.Count > 0

then SaveAnnotation;

//if _date.text <> '' then

//OutList.Add(''+_date.text+'');

SaveSequence;

OutList.Add(' '+Lang.Text+'');

if SLang.ItemIndex > -1 then

begin

S:= Lg[SLang.ItemIndex][1];

if S <> '' then

OutList.Add(' '+S+'');

end;

OutList.Add(' ');

// **** document-info ****

OutList.Add(' ');

OutList.Add(' my_Make_FB2');

PrintString('src-url', url.Text); //??

OutList.Add(' '+ DateToStr(now) +'');

PrintString('id', id.Text); //??

OutList.Add(' 1.0');

OutList.Add(' ');

// **** publish-info ****

OutList.Add(' ');

if Book_name.Text = ''

then PrintString('book-name', book_title.Text)

else PrintString('book-name', Book_name.Text);

PrintString('publisher', publisher.Text); //

PrintString('city', city.Text); //

PrintString('year', year.Text); //

PrintString('isbn', isbn.Text); //

//OutList.Add(' 1.0');

OutList.Add(' ');

end;

OutList.Add(' ');

OutList.Add('

');

end;

function SubStyle(m,w: TmyStyle):integer;

begin

result:= integer(m) - integer(w);

end;

procedure SaveBodyFB2;

var

i, j: integer;

S, ss: string;

oldStyle,

LastStyle, CurStyle: TmyStyle; // style

procedure StyleStucture;

begin

if CurStyle <> oldStyle then

begin

if SytleStack.Count = 0 then

begin

SytleStack.Add(TObject(CurStyle))

end

else

begin

LastStyle:= TmyStyle(SytleStack.Last);

case SubStyle(CurStyle,LastStyle) of

0: OutList.Add('

');

1: SytleStack.Add(TObject(CurStyle));

else

begin

OutList.Add('');

while CurStyle <> LastStyle do

begin

SytleStack.Delete(SytleStack.Count-1);

OutList.Add('');

LastStyle:= TmyStyle(SytleStack.Last);

end;

end;

end;// case

end;

OutList.Add('

');

OutList.Add('

end;

OutList.Add('

'+s+'

');

end; // StyleStucture;

begin

oldStyle:= ZZ; EndNotes_count:= 1;

// if

OutList.Add('

');

with Form1.ListBox1 do

for i:= 0 to Count - 1 do // просматриваем текст

begin

S:= Items[i];

Ss:= GetStyle(S, CurStyle); // получаем чистую строку и стиль

s:= '';

if ss <> '' then

for j:= 1 to length(Ss) do

begin // просматриваем строку

case ss[j] of

'~': begin // если это концевая сноска

S:= S + ''

+IntToStr(EndNotes_count)+'

';

inc(EndNotes_count); // увеличиваем счетчик сносок

end;

'^': S:= S + '́'; // ставим ударение

else S:= S + ss[j];

end; // case

end;

if (S = '') and (CurStyle <> Poem)

then

begin

OutList.Add('');

continue;

end;

if (CurStyle <> oldStyle) and (CurStyle <> Auth) then

begin

case oldStyle of // завершение предыдущего блока

Poem: OutList.Add('');

Epig: OutList.Add('');

Citat: OutList.Add('');

H1..H5: OutList.Add('');

end; // case завершение предыдущего блока

case CurStyle of // начало блока

Poem: OutList.Add('');

Epig: OutList.Add('');

Citat: OutList.Add('');

end; // case начало блока

end;

// анализ стилей

case CurStyle of // в зависимости от стиля абзаца

Norm,Epig,Citat: OutList.Add('

'+S+'

');

H1..H5: StyleStucture; // Heading

Sub: OutList.Add(''+s+''); // Subtitle

Poem: begin

if S = ''

then OutList.Add('')

else OutList.Add(''+S+'');

end;

Auth: begin

OutList.Add(''+S+'');

if oldStyle in [Poem, Epig, Citat]

then CurStyle:= oldStyle;

end;

None: continue; //None

end; // case

oldStyle:= CurStyle;

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

if SytleStack.Count > 0 then

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

while SytleStack.Count > 0 do

begin

SytleStack.Delete(SytleStack.Count-1);

OutList.Add('

');

end;

end;

OutList.Add('

');

OutList.Add('

');

end;

procedure SaveEndnotes;

var

S: string;

i: integer;

begin

if Form1.EndNotesList.Items.Count = 0 then exit; //[1]

OutList.Add('

Примечания

');

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

begin

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

OutList.Add('

'+IntToStr(i+1)+'

');

OutList.Add('

'+S+'

');

OutList.Add('

');

end;

OutList.Add('

');

end;

Procedure Make_fb2(S: string);

begin //

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

SytleStack.Clear;

OutList.Clear;

SaveDescription;

SaveBodyFB2;

SaveEndnotes;

OutList.Add('');

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

if not BookHaveName then

begin

PageControl1.ActivePageIndex:= 0;

ShowMessage('Fill the form.');

exit;

end;

SaveDialog1.FileName:= form1.FB2_file.Text;

if SaveDialog1.Execute then

Make_fb2(SaveDialog1.FileName);

end;

function SetStyle(n: TmyStyle):string;

begin

case n of

Norm: result:= ' N';

Epig: result:= ' E';

Auth: result:= ' A';

H1: result:= 'H1';

H2: result:= 'H2';

H3: result:= 'H3';

H4: result:= 'H4';

H5: result:= 'H5';

Sub: result:= ' S';

Poem: result:= ' P';

Citat: result:= ' C';

None: result:= '-';

end; // case

end;

function SetStyle1(n: TmyStyle):string;

begin

result:= ' '+ SetStyle(n)+'| ';

end;

procedure ChangeStyle(LStyle: TmyStyle);

var

n, curIndex: integer;

S: string;

begin

with Form1.ListBox1 do

begin

curIndex:= ItemIndex;

if curIndex = -1 then exit;

S:= Items[curIndex];

n:= pos('|', s);

delete(S, 1, n+1);

Items[curIndex]:= SetStyle1(LStyle)+ S;

if ItemIndex < Items.Count - 1

then ItemIndex:= ItemIndex+1;

Читать дальше
Тёмная тема
Сбросить

Интервал:

Закладка:

Сделать

Похожие книги на «Пишем программу для создания книг FB2.»

Представляем Вашему вниманию похожие книги на «Пишем программу для создания книг FB2.» списком для выбора. Мы отобрали схожую по названию и смыслу литературу в надежде предоставить читателям больше вариантов отыскать новые, интересные, ещё непрочитанные произведения.


Отзывы о книге «Пишем программу для создания книг FB2.»

Обсуждение, отзывы о книге «Пишем программу для создания книг FB2.» и просто собственные мнения читателей. Оставьте ваши комментарии, напишите, что Вы думаете о произведении, его смысле или главных героях. Укажите что конкретно понравилось, а что нет, и почему Вы так считаете.

x