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