1 SRC_URL=http://www.wagner.pp.ru/~vitus/fiction
2 ID=90860948-65dc-11e5-bd77-bc5ff453db06
3 VERSION=0.$(shell date +%s)
5 all: jasmina.html jasmina.epub jasmuna.fb2.zip
10 all.mdwn: order.lst $(wildcard *.txt)
11 for i in `cat order.lst`; do sed 's/<TBD>/*(Фрагмент недописан)*/' "$$i"; echo ""; done > $@
12 jasmina.html: all.mdwn
13 pandoc -t html --toc -s all.mdwn -o jasmina.html
14 jasmina.epub: all.mdwn jasmina-title.jpg
15 pandoc -t epub -s all.mdwn -o jasmina.epub --epub-cover-image=jasmina-title.jpg
16 jasmina.fb2.zip: jasmina.fb2
19 annotation.html: annotation.txt
20 pandoc -o annotation.html annotation.txt
21 jasmina.fb2: all.mdwn annotation.html jasmina-title.jpg Makefile
22 pandoc -t fb2 -V language=ru all.mdwn -o jasmina.fb2
23 sed -i 's!<annotation>.*</annotation>!!' $@
24 sed -i 's!\(<book-title>.*</book-title>\)\(<author>.*</author>\)!\2\1!' $@
25 sed -i 's!</title-info>!<lang>ru</lang></title-info>!' $@
26 sed -i 's!</lang>!</lang><coverpage><image l:href="#cover" /></coverpage>!' $@
27 sed -i 's!<title-info>!<title-info><genre>sf_history</genre>!' $@
28 sed -i "s!</book-title>!</book-title><annotation>`cat annotation.html|tr -d '\n'`</annotation>!" $@
29 sed -i "s!</annotation>!</annotation><date value='`date "+%Y-%m-%d"`'>`date +%Y`</date>!" $@
30 sed -i "s!</program-used>!</program-used><date value='`date "+%Y-%m-%d"`'>`date +%Y`</date>!" $@
31 sed -i 's!<document-info>!<document-info><author><first-name>Виктор</first-name><last-name>Вагнер</last-name></author>!' $@
32 sed -i 's!</document-info>!<src-url>${SRC_URL}</src-url><id>${ID}</id><version>${VERSION}</version></document-info>!' $@
33 sed -i "s!</FictionBook>!<binary id='cover' content-type='image/jpeg'>`base64 -w 0 jasmina-title.jpg`</binary></FictionBook>!" $@
34 jasmina.pdf: preamble.tex all.tex
35 cp preamble.tex jasmina.tex
39 pandoc -o all.tex all.mdwn
42 # List all the footnotes
43 grep '^\[\^' all.mdwn|sort -n -k 1.3