-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmakefile
676 lines (566 loc) · 28.9 KB
/
makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
# Makefile for TeXtallion
# Tiny almost-Kiss Word Processor
# http://anamnese.online.fr/site2/textallion/docs/presentation.html
# License: http://en.wikipedia.org/wiki/BSD_licenses
#
# get newest txt2tags at http://txt2tags.org (might not be fully compatible with textallion)
# get newest textallion at https://bitbucket.org/farvardin/textallion
#
# This is a Makefile for *GNU make*, the default for Linux.
# On *BSD systems, you'll need to use "gmake" instead of "make"
# Makefile initially generated on 2016-09-16
TEXTALLIONFOLDER = /usr/share/textallion//
# <!> keep /usr/share/textallion if it is written so!
ifeq ($(wildcard /usr/bin/python2),)
PYTHONVER = python
else
PYTHONVER = python2
endif
TXT2TAGS = $(PYTHONVER) $(TEXTALLIONFOLDER)/contrib/txt2tags/txt2tags
#TXT2TAGS = txt2tags
ifdef TEXTALLIONDOC
DOCUMENT = $(TEXTALLIONDOC)
else
DOCUMENT = picoloop_manual
#DOCUMENT = sample
endif
DOCUMENT_TITLE = Picoloop Manual
DOCUMENT_AUTHOR = Garvalf
DOCUMENT_TAGS = music, audio, picoloop
DOCUMENT_INFO = textallion - https://bitbucket.org/farvardin/textallion
DOCUMENT_LANGUAGE = en
#DOCUMENT_COVER = $(TEXTALLIONFOLDER)/media/sample_cover.png
DOCUMENT_COVER = $(DOCUMENT).jpg
PDFREADER = xdg-open
EPUBREADER = ebook-viewer
HTMLREADER = firefox
DIFFTOOL = meld
RENPY = /opt/renpy/renpy.sh
UNAME := $(shell uname)
ifeq ($(UNAME), Darwin)
EDITTOOL = open
else
# EDITTOOL = gvim
EDITTOOL = geany
endif
info:
printf "make: + \n all \n beamer \n booklet \n clean \n cleanall \n clean-everything \n configuration-update \n cover \n cyoa-epub \n cyoa-gbl \n cyoa-graph \n cyoa-html \n cyoa-hyena \n cyoa-inform7 \n cyoa-pdf \n cyoa-play \n cyoa-ramus \n cyoa-renpy \n cyoa-togbl \n cyoa-twee \n cyoa-txt \n edit \n epub \n html \n htmlhandhelds \n info \n makefile \n pdf \n pdfsmall \n read \n readepub \n readhtml \n readindex \n readpdf \n slidy \n split \n tidy \n txt \n vignettes \n website \n xetex \n \n"
all: epub html pdf website clean
#distrib: html clean
# -rm $(DOCUMENT).zip
# -rm -fr $(DOCUMENT)
# -mkdir $(DOCUMENT)
# -cp * $(DOCUMENT)
# zip $(DOCUMENT).zip -r $(DOCUMENT) -x $(DOCUMENT).zip
md:
$(TXT2TAGS) -t md --no-toc --outfile $(DOCUMENT).md $(DOCUMENT).t2t
html:
$(TXT2TAGS) -T $(TEXTALLIONFOLDER)/templates/xhtml.html -t xhtml --css-inside --css-sugar --toc --outfile $(DOCUMENT).html $(DOCUMENT).t2t
htmlhandhelds:
$(TXT2TAGS) -t xhtml --no-style --style=$(TEXTALLIONFOLDER)/includes/sample_handheld.css --toc --outfile $(DOCUMENT).html $(DOCUMENT).t2t
edit:
$(EDITTOOL) $(DOCUMENT).t2t &
txt:
$(TXT2TAGS) --no-headers -t txt $(DOCUMENT).t2t
pdf:
$(TXT2TAGS) -T $(TEXTALLIONFOLDER)/templates/latex_no_title.tex -t tex --toc --outfile $(DOCUMENT).tex $(DOCUMENT).t2t
ifeq ($(DOCUMENT_LANGUAGE),en)
sed -i -e "s/,frenchb,francais//g" $(DOCUMENT).tex
endif
-pdflatex -interaction batchmode $(DOCUMENT).tex
-makeindex $(DOCUMENT).idx
-pdflatex -interaction batchmode $(DOCUMENT).tex
# (the compilation of the latex document is duplicated so the TOC generated the first time will be included the second time)
-pdflatex -interaction batchmode $(DOCUMENT).tex
-pdfjoin --paper a4paper --rotateoversize false includes/picoloop_manual_cover.pdf includes/picoloop_manual_blank_page.pdf $(DOCUMENT).pdf includes/picoloop_manual_blank_page.pdf includes/picoloop_manual_blank_page.pdf --outfile $(DOCUMENT)-joined.pdf
-mv $(DOCUMENT)-joined.pdf $(DOCUMENT).pdf
# and one again because of makeindex
pdfweb:
make html
wkhtmltopdf --page-size A4 --margin-top 1.0cm --margin-bottom 1.0cm --margin-left 0.5cm --margin-right 0.5cm $(DOCUMENT).html $(DOCUMENT).pdf
pdfwk:
make pdfweb
pdfnolatex:
make pdfweb
xetex:
$(TXT2TAGS) -T $(TEXTALLIONFOLDER)/templates/xetex.tex -t tex --toc --outfile $(DOCUMENT).tex $(DOCUMENT).t2t
ifeq ($(DOCUMENT_LANGUAGE),en)
sed -i -e "s/,frenchb,francais//g" $(DOCUMENT).tex
endif
-xelatex -interaction batchmode $(DOCUMENT).tex
-xelatex -interaction batchmode $(DOCUMENT).tex
latex:
make pdf
lettre:
$(TXT2TAGS) -T $(TEXTALLIONFOLDER)/templates/lettre.tex -t tex --no-toc --outfile $(DOCUMENT).tex $(DOCUMENT).t2t
-pdflatex -interaction batchmode $(DOCUMENT).tex
-make clean
lettre-1page:
pdfjam $(DOCUMENT).pdf '1' --outfile $(DOCUMENT)b.pdf
mv $(DOCUMENT)b.pdf $(DOCUMENT).pdf
readpdf:
$(PDFREADER) $(DOCUMENT).pdf &
readhtml:
$(HTMLREADER) $(DOCUMENT).html &
readindex:
$(HTMLREADER) index_$(DOCUMENT).html &
readepub:
$(EPUBREADER) $(DOCUMENT).epub &
read:
make readpdf &
pdfsmall: pdf
-pdfnup $(DOCUMENT).pdf --nup 2x1
booklet: pdf
-pdf2ps $(DOCUMENT).pdf
-psbook $(DOCUMENT).ps | psnup -2 > $(DOCUMENT)_booklet.ps
-ps2pdf $(DOCUMENT)_booklet.ps
slidy:
$(TXT2TAGS) -C $(TEXTALLIONFOLDER)/templates/slidy.conf.t2t -T $(TEXTALLIONFOLDER)/templates/slidy -t xhtml --css-inside -o $(DOCUMENT)_slide.html $(DOCUMENT).t2t
beamer:
$(TXT2TAGS) --no-style --no-infile -C $(TEXTALLIONFOLDER)/templates/beamer.conf.t2t -C $(TEXTALLIONFOLDER)/core/textallion_beamer.t2t -T $(TEXTALLIONFOLDER)/templates/beamer -t tex -o $(DOCUMENT)_slide.tex $(DOCUMENT).t2t
pdflatex $(DOCUMENT)_slide.tex
# uses html tidy
tidy:
-tidy -asxhtml --tidy-mark 1 --wrap 0 --clean 1 --output-xhtml 1 --input-encoding utf8 --doctype strict --new-inline-tags video,audio,canvas $(DOCUMENT).html > $(DOCUMENT)2.html
cat $(DOCUMENT)2.html | sed -e "s/<meta name=\"generator\" content=\"http:\/\/txt2tags.org\" \/>//g" | sed -e "s/border=\"0\"//g" | sed -e "s/lang=\"fr\"//g" | sed -e "s/border=\"0\"//g" | sed -e "s/<\?xml version=\"1.0\" encoding=\"utf8\"\?>//g" | sed -e "s/name=\"toc[0-9]\"//g"> $(DOCUMENT).html
# uses calibre
epub:
$(TXT2TAGS) -T epub.html -t xhtml --no-style --no-toc --outfile $(DOCUMENT).html $(DOCUMENT).t2t
cat $(DOCUMENT).html | sed -e "s/<audio\(.*\)audio>//g" > $(DOCUMENT)2.html
mv $(DOCUMENT)2.html $(DOCUMENT).html
-make tidy
cat $(DOCUMENT).html | sed -e "s/❦/*/g" | sed -e "s/❧/*/g" | sed -e "s/✵/*/g" | sed -e "s/☼/*/g" | sed -e "s/☽/*/g" | sed -e "s/☾/*/g" | sed -e "s/○/*/g" | sed -e "s/html\#ftn/html/g" > $(DOCUMENT)2.html
mv $(DOCUMENT)2.html $(DOCUMENT).html
#
ebook-convert $(DOCUMENT).html $(DOCUMENT).epub --max-levels 0 --pretty-print --level1-toc //h:h1 --level2-toc //h:h2 --level3-toc //h:h3 --max-toc-links 0 --toc-threshold 3 --chapter-mark pagebreak --cover images/$(DOCUMENT_COVER) --extra-css $(TEXTALLIONFOLDER)/includes/epub.css --no-default-epub-cover --preserve-cover-aspect-ratio --no-chapters-in-toc --disable-font-rescaling
# --filter-css font-family
#
ebook-meta $(DOCUMENT).epub --title "$(DOCUMENT_TITLE)" --authors "$(DOCUMENT_AUTHOR)" --tags "$(DOCUMENT_TAGS)" --language $(DOCUMENT_LANGUAGE) --book-producer 'textallion - https://bitbucket.org/farvardin/textallion' --comments "$(DOCUMENT_INFO)" --cover images/$(DOCUMENT_COVER)
# split (not working well...)
split:
htmldoc --no-links --charset utf8 --strict --book -t htmlsep -d ebook $(DOCUMENT)2.html
#$(TXT2TAGS) -t html --split 2 --no-toc --outfile $(DOCUMENT).html $(DOCUMENT).t2t
website:
cat $(TEXTALLIONFOLDER)/templates/website.html | sed -e "s|%%DOCUMENT AUTHOR%%|$(DOCUMENT_AUTHOR)|g" | sed -e "s|%%DOCUMENT TITLE%%|$(DOCUMENT_TITLE)|g" | sed -e "s|%%DOCUMENT%%|$(DOCUMENT)|g" | sed -e "s|%%DOCUMENT COVER%%|$(DOCUMENT_COVER)|g" > index_$(DOCUMENT).html
cover:
convert $(DOCUMENT).svg $(DOCUMENT).jpg
convert $(DOCUMENT).svg $(DOCUMENT).png
configuration-update:
$(DIFFTOOL) makefile $(TEXTALLIONFOLDER)/samples/makefile
$(DIFFTOOL) $(DOCUMENT).sty $(TEXTALLIONFOLDER)/includes/sample.sty
$(DIFFTOOL) $(DOCUMENT).css $(TEXTALLIONFOLDER)/includes/sample.css
# CYOA part
cyoa-play:
$(BROWSER) $(DOCUMENT).html
cyoa-html:
$(TXT2TAGS) -T $(TEXTALLIONFOLDER)/templates/cyoa.html --config-file $(TEXTALLIONFOLDER)/core/txt2cyoa.t2t -t xhtml --css-inside --outfile $(DOCUMENT).html $(DOCUMENT).t2t
cyoa-ramus:
$(TXT2TAGS) -T $(TEXTALLIONFOLDER)/templates/ramus.html --config-file $(TEXTALLIONFOLDER)/core/txt2cyoa.t2t -t xhtml --no-css-inside --outfile $(DOCUMENT)_ramus.html $(DOCUMENT).t2t
sed -i -e "s/href=\"#/rel=\"/g" $(DOCUMENT)_ramus.html
sed -i -e "s/style=\"display:none\"//g" $(DOCUMENT)_ramus.html
#sed -i -e "s/onclick\(.*\)rel/rel/" $(DOCUMENT)_ramus.html
sed -i -e "s/<p><br\/><br\/><br\/><\/p><\/div>/xxCLEARLINKSxx\n<\/div>/g" $(DOCUMENT)_ramus.html
# remove the 1st occurence only
sed -i -e "0,/\xxCLEARLINKSxx/s/\xxCLEARLINKSxx//" $(DOCUMENT)_ramus.html
# Create the do clear links
# If you don't like it this way, uncomment the next line first, to remove everything
#sed -i -e "s/xxCLEARLINKSxx//g" $(DOCUMENT)_ramus.html
sed -i -e "s/\xxCLEARLINKSxx/\[\?do clear_links\(\)\; \?\]/g" $(DOCUMENT)_ramus.html
sed -i -e "s/xxRAMUS_INITxx/<div id=\"story\" style=\"Display: none;\">\n<div id=\"start\">\n<li>Start: <b><a rel=\"page1\">1<\/a><\/b>/g" $(DOCUMENT)_ramus.html
cyoa-txt:
$(TXT2TAGS) --no-headers -t txt $(DOCUMENT).t2t
cyoa-pdf:
#$(TXT2TAGS) -t tex --outfile $(DOCUMENT).tex $(DOCUMENT).t2t
#-pdflatex $(DOCUMENT).tex
$(TXT2TAGS) -T $(TEXTALLIONFOLDER)/templates/latex.tex --config-file $(TEXTALLIONFOLDER)/core/txt2cyoa.t2t -t tex --no-toc --outfile $(DOCUMENT).tex $(DOCUMENT).t2t
-pdflatex -interaction batchmode $(DOCUMENT).tex
cyoa-gamebook:
# doesnt work yet!
# http://www.ctan.org/tex-archive/macros/latex/contrib/gamebook
#$(TXT2TAGS) -t tex --outfile $(DOCUMENT).tex $(DOCUMENT).t2t
#-pdflatex $(DOCUMENT).tex
$(TXT2TAGS) -T $(TEXTALLIONFOLDER)/templates/gamebook.tex --config-file $(TEXTALLIONFOLDER)/core/txt2cyoa.t2t -t tex --no-toc --outfile $(DOCUMENT).tex $(DOCUMENT).t2t
#sed -i -e "s/\\textbf{\\begin{center}\\subsection\*{\\Huge{([^ ].*?)}}\\end{center}\\vskip-2em}/\gbsection{\1}/g" $(DOCUMENT).tex
sed -i -e "s/\\textbf{\\begin{itemize}/\begin{gbturnoptions}/g" $(DOCUMENT).tex
sed -i -e "s/\\item/\gbitem/g" $(DOCUMENT).tex
-pdflatex -interaction batchmode $(DOCUMENT).tex
cyoa-epub:
$(TXT2TAGS) -T $(TEXTALLIONFOLDER)/templates/epub.html --config-file $(TEXTALLIONFOLDER)/core/txt2cyoa.t2t -t xhtml --no-style --no-toc --outfile $(DOCUMENT).html $(DOCUMENT).t2t
cat $(DOCUMENT).html | sed -e "s/<audio\(.*\)audio>//g" > $(DOCUMENT)2.html
mv $(DOCUMENT)2.html $(DOCUMENT).html
-make tidy
cat $(DOCUMENT).html | sed -e "s/❦/*/g" | sed -e "s/❧/*/g" | sed -e "s/✵/*/g" | sed -e "s/☼/*/g" | sed -e "s/☽/*/g" | sed -e "s/☾/*/g" | sed -e "s/○/*/g" |\
sed -e "s/el[1-9].style.visibility = 'hidden';//g" |\
sed -e "s/span.c[1-9] {display:none}//g" |\
sed -e "s/span.c[1-9] {display: none}//g" |\
sed -e "s/div.c[1-9] {display:none}//g" |\
sed -e "s/span.c[1-9] {visibility:hidden}//g" > $(DOCUMENT)2.html
mv $(DOCUMENT)2.html $(DOCUMENT).html
#
ebook-convert $(DOCUMENT).html $(DOCUMENT).epub --max-levels 0 --pretty-print --level1-toc //h:h1 --level2-toc //h:h2 --level3-toc //h:h3 --max-toc-links 0 --toc-threshold 3 --chapter-mark pagebreak --page-breaks-before //h:div[@id] --cover $(DOCUMENT_COVER) --extra-css $(TEXTALLIONFOLDER)/includes/epub.css --no-default-epub-cover --no-svg-cover --preserve-cover-aspect-ratio --no-chapters-in-toc
#
ebook-meta $(DOCUMENT).epub --title "$(DOCUMENT_TITLE)" --authors "$(DOCUMENT_AUTHOR)" --tags "$(DOCUMENT_TAGS)" --language $(DOCUMENT_LANGUAGE) --book-producer 'textallion & txt2cyoa - https://bitbucket.org/farvardin/textallion' --comments 'textallion - https://bitbucket.org/farvardin/textallion' --cover $(DOCUMENT_COVER)
cyoa-graph:
printf "\n \n \n \n" > graph.txt
-cat $(TEXTALLIONFOLDER)/core/txt2cyoa.t2t $(DOCUMENT).t2t |grep -E "^#|^>|^==|^-|rdv|preproc|postproc" >> graph.txt
-$(TXT2TAGS) --no-headers -o graph2.txt -t txt graph.txt
-echo "digraph G { " > graph.txt
-echo "bgcolor=beige; " >> graph.txt
-echo "node [shape=egg, fillcolor=antiquewhite2, style=filled];" >> graph.txt
-echo "edge [arrowsize=1, fillcolor=gold];" >> graph.txt
-cat graph2.txt | grep -E "\->|;" | sed -e "s/'//g" >> graph.txt
-echo "} " >> graph.txt
-cp graph.txt graph2.txt
#gawk '/->/ { z=$0} /[0-9]+[^->]/ {print z$0}' fichier.txt
# we convert to graphviz using the python script, and remove the extra "0->" before the conf
-cat graph2.txt | $(PYTHONVER) $(TEXTALLIONFOLDER)/includes/lines.py | sed -e "s/0->bgcolor/bgcolor/g" | sed -e "s/0->node/node/g" | sed -e "s/0->edge/edge/g" > graph.txt
-rm graph2.txt
-dot graph.txt -Tpng > $(DOCUMENT)_graph.png
-dot graph.txt -Tsvg > $(DOCUMENT)_graph.svg
-mv graph.txt $(DOCUMENT)_graph.txt
cyoa-gbl:
printf "$(DOCUMENT)\nPar YourName\n%%date(%Y-%m-%d)\n" > $(DOCUMENT)_gbl.t2t
echo "%!includeconf: txt2cyoa.t2t" >> $(DOCUMENT)_gbl.t2t
cat $(DOCUMENT).gbl | sed -e "s/= \(.*\) =/\n=== \1 ===\n/g" |\
# sed -e "s/=\(.*\)=/\n=== \1 ===\n/g" | sed -e "s/= \(.*\)=/\n=== \1 ===\n/g" | sed -e "s/=\(.*\) =/\n=== \1 ===\n/g" |\
sed -e "s/^#\([0-9]*\)# \(.*\)/\n\n== \1 ==\n\n=== \2 ===\n\n/g" | sed -e "s/^>\(.*\)=\([0-9]*\)/- \1, rdv au \2/g" >> $(DOCUMENT)_gbl.t2t
cyoa-togbl:
cat $(DOCUMENT).t2t | sed -e "s/=== \1 ===/ \(.*\) =/g" |\
sed -e "s/^#\([0-9]*\)# \(.*\)/\n\n== \1 ==\n\n=== \2 ===\n\n/g" | sed -e "s/^>\(.*\)=\([0-9]*\)/- \1, rdv au \2/g" >> $(DOCUMENT)_export.gbl
cyoa-twine: cyoa-twee
cyoa-twee:
# for use with http://gimcrackd.com/etc/src/
# corrected twee parser at https://github.com/mcdemarco/twee
#echo "du texte et puis à la fin de la ligne, un numéro par exemple 42"|sed -e "s/\([0-9]\+\)$/\[\[\1 \1\]\]/g"
# try to use Unix line feed if possible
echo ":: StoryTitle" > $(DOCUMENT)_export.tw
cat $(DOCUMENT).t2t | perl -pe 's/^\%(.*)\n//' |\
# remove extra textallion syntax |\
perl -pe 's/TESTLUCK/\/\/Am I lucky today? (throwing a dice, 5 or 6 means luck)\/\//'|\
# abbreviations |\
perl -pe 's/tt (\d+)/turn to [[\1]]/g' |\
perl -pe 's/rdv au (\d+)/rendez-vous au [[\1]]/g' |\
perl -pe 's/rendez-vous au (\d+)/rendez-vous au [[\1]]/g' |\
# replace any ="introduction" by 0 |\
perl -pe "s/[I-i]ntro["duction"]*/0/g" |\
perl -pe "s/\=\"[I-i]ntro["duction"]*/0/g" |\
# italic and underline are the same. Only bold is different |\
perl -pe "s/\*\*(.*?)\*\*/''\1''/g" |\
perl -pe "s/\`\`(.*?)\`\`/{{{\1}}}/g" |\
perl -pe 's/¯/ /g' |\
perl -pe 's/[ ]*\{.{4}\}[ ]*//g' |\
perl -pe 's/[ ]*\{.{3}\}[ ]*//g' |\
perl -pe 's/rdv/rendez-vous/' |\
# images / [[bla.jpg] 1] est pour image sur premiere page |\
perl -pe 's/\[\[(.*).jpg] 1\]//' |\
perl -pe 's/\[\[(.*).png] 1\]//' |\
perl -pe 's/\[(.*).jpg\]/\[img\[\1.jpg\]\]/' |\
perl -pe 's/\[(.*).png\]/\[img\[\1.png\]\]/' |\
# why did we remove media? |\
#perl -pe 's/..\/media\///' |\
perl -pe 's/\[(.*).ogg\]//' |\
# choices and links (\r is for windows newline) \
perl -pe 's/- (.*?) (\d+?)( *)\n/- \1 [[\2]]\n/g' |\
perl -pe 's/- (.*?) (\d+?)( *)\r/- \1 [[\2]]/g' |\
# deprecated: perl -pe 's/\[(\d+) \#(.*?)\]/[[\2|\1]]/g' |\
perl -pe 's/\[([^\#].*?) \| \#(.*?)\]/[[\1|\2]]/g' |\
perl -pe 's/\[([^\#].*?)\|\#(.*?)\]/[[\1|\2]]/g' |\
perl -pe 's/\[([^\#].*?) \#(.*?)\]/[[\1|\2]]/g' |\
#perl -pe 's/\[(\d+) \#(\d+)\]/[[\1]]/g' |\
#perl -pe 's/ \#(\d+?) / [[\1]] /g' |\
#perl -pe 's/ \#(.*?) / [[\1]] /g' |\
#perl -pe 's/ \#([^ ].*) / [[\1]]/g' |\
perl -pe 's/\[\#(\d+?)\]/[[\1]]/g' |\
perl -pe 's/\[\#(.*?)\]/[[\1]]/g' |\
# notes \
perl -pe 's/°°(.*?)°°(.*?)°°/ \/\/\2\/\/ /' |\
# chapters \
perl -pe 's/== (\d+) ==/:: \1/' |\
perl -pe 's/==(\d+)==\[(.*)\]/:: \1/' |\
perl -pe 's/==(\d+)==/:: \2/' |\
perl -pe 's/== (.*?) ==\[(.*?)\]/:: \2/' |\
perl -pe 's/== (.*?) ==/:: \1/' |\
# make twee lists \
perl -pe 's/^- /* /' |\
perl -pe 's/^+ /# /' |\
# \
perl -pe 's/:: 0/:: Start/' >> $(DOCUMENT)_export.tw
-iconv -f UTF-8 -t ISO-8859-15 $(DOCUMENT)_export.tw -o $(DOCUMENT)_export_iso8859.tw
# export to html
$(PYTHONVER) $(TEXTALLIONFOLDER)/templates/twee/twee -t jonah $(DOCUMENT)_export.tw > $(DOCUMENT)_twee_jonah.html
$(PYTHONVER) $(TEXTALLIONFOLDER)/templates/twee/twee -t sugarcane $(DOCUMENT)_export.tw > $(DOCUMENT)_twee_sugarcane.html
$(PYTHONVER) $(TEXTALLIONFOLDER)/templates/twee/twee -t mobile $(DOCUMENT)_export.tw > $(DOCUMENT)_twee_mobile.html
$(PYTHONVER) $(TEXTALLIONFOLDER)/templates/twee/twee -t sugarcube $(DOCUMENT)_export.tw > $(DOCUMENT)_twee_sugarcube.html
cyoa-hyena:
# for use with http://www.projectaon.org/staff/jens/
# specifications: http://www.collectingsmiles.com/wiki/index.php?title=Hyena_AudioGame_specifications
# implementation (player): http://www.freegameengines.org/gamebook-engine/
printf "#start \nStart the game: Click #page0\n" > $(DOCUMENT)_export.gamebook
cat $(DOCUMENT).t2t | perl -pe 's/^\%(.*)\n//' | perl -pe 's/(\d+)\n/Click #page\1\n/' | perl -pe 's/== (\d+) ==/#page\1/' | perl -pe 's/==(\d+)==\[(.*)\]/page\1/' >> $(DOCUMENT)_export.gamebook
printf "\n#script\n\n" >> $(DOCUMENT)_export.gamebook
cyoa-choicescript:
# for use with http://www.choiceofgames.com/
# specifications: http://www.choiceofgames.com/make-your-own-games/choicescript-intro/
-rm -fr $(DOCUMENT)_choicescript
-mkdir -p $(DOCUMENT)_choicescript/media/
-cp -fr $(TEXTALLIONFOLDER)/templates/choicescript/* $(DOCUMENT)_choicescript
sed "s/ChoiceScript Game/`sed q $(DOCUMENT).t2t`/" $(TEXTALLIONFOLDER)/templates/choicescript/mygame/index.html > $(DOCUMENT)_choicescript/mygame/index.html
sed "s/ChoiceScript Game/`sed q $(DOCUMENT).t2t`/" $(TEXTALLIONFOLDER)/templates/choicescript/mygame/index_fr.html > $(DOCUMENT)_choicescript/mygame/index_fr.html
printf "*comment Made using ChoiceScript and Textallion.\n" > $(DOCUMENT)_choicescript/mygame/scenes/textallion.txt
#printf "Welcome \n*page_break\n" > choicescript/mygame/scenes/textallion.txt \
cat $(DOCUMENT).t2t | perl -pe 's/^\%(.*)\n//' | perl -pe 's/^\%(.*)\n//' |\
#sed can't replace multiple newlines. So we remove them, and add them back later. \
perl -pe 's/\n/NEWLINE/g' |\
perl -pe 's/NEWLINENEWLINE- /\n\n*choice\n- /g' |\
perl -pe 's/NEWLINE/\n/g' |\
perl -pe 's/(\d+)\n/\1\n\t\t*goto \1\n/' |\
perl -pe 's/- /\t# \1/' |\
perl -pe 's/== (\d+) ==/\n*label \1\n\[b\]\1\[\/b\]/g' |\
perl -pe 's/==(\d+)==\[(.*)\]/*label \1\n\[b\]\1\[\/b\]/g' |\
perl -pe 's/==(\d+)==/*label \1\n\[b\]\1\[\/b\]/g' |\
# end of game |\
perl -pe 's/FIN/FIN\n*ending/' |\
perl -pe 's/THE END/THE END\n*ending/' |\
# remove extra textallion syntax |\
perl -pe 's/TESTLUCK/\[i\]Am I lucky today? (throwing a dice, 5 or 6 means luck)\[\/i\]/'|\
perl -pe 's/¯/ /g' |\
perl -pe 's/[ ]*\{.{4}\}[ ]*//g' |\
perl -pe 's/[ ]*\{.{3}\}[ ]*//g' |\
perl -pe 's|\/\/(.*)\/\/|\[i\]\1\[/i\]|' |\
perl -pe 's/\[\[(.*).jpg] 1\]/*image \1.jpg/' |\
perl -pe 's/\[\[(.*).png] 1\]/*image \1.jpg/' |\
perl -pe 's/\[(.*).jpg\]/*image \1.jpg/' |\
perl -pe 's/\[(.*).jpg\]/*image \1.jpg/' |\
perl -pe 's/..\/media\///' |\
perl -pe 's/\[(.*).ogg\]//' |\
perl -pe 's/rdv/rendez-vous/' >> $(DOCUMENT)_choicescript/mygame/scenes/textallion.txt
-cp *.jpg $(DOCUMENT)_choicescript/mygame/
-cp *.png $(DOCUMENT)_choicescript/mygame/
-cp ../media/*.jpg $(DOCUMENT)_choicescript/mygame/
-cp ../media/*.png $(DOCUMENT)_choicescript/mygame/
cyoa-cs: cyoa-choicescript
cyoa-undum:
# for use with http://www.undum.com/
# pb with undum if 1 extra line break in the code
-rm -fr $(DOCUMENT)_undum
-mkdir -p $(DOCUMENT)_undum/media/
-cp -fr $(TEXTALLIONFOLDER)/templates/undum_media/* $(DOCUMENT)_undum/media/
-cat $(TEXTALLIONFOLDER)/templates/undum.html > $(DOCUMENT)_undum/$(DOCUMENT)_undum.html
-cat $(DOCUMENT).t2t | perl -pe 's/^\%(.*)\n//' |\
# remove 1 empty useless image \
perl -pe 's/\{->--\}\[\[(.*)\] 1\]\{-<--\}//' |\
# remove 3 first lines of the t2t doc \
sed '1,4d' |\
perl -pe 's/^\%(.*)\n//' |\
# remove textallion specific syntax (and later also) \
perl -pe 's/[ ]*\{.{4}\}[ ]*//g' |\
perl -pe 's/[ ]*\{.{3}\}[ ]*//g' |\
perl -pe 's/\{/NEWLINE/g' |\
#sed can't replace multiple newlines. So we remove them, and add them back later. |\
perl -pe 's/\n/NEWLINE/g' |\
perl -pe "s/\'/APOSTROPHE/g" |\
perl -pe 's/NEWLINENEWLINE- (.*?)(\d+)NEWLINE/<\/p>APOSTROPH2\n\+ APOSTROPH2<ul class=GUILLEMEToptionsGUILLEMET><li><a href=GUILLEMETnode\2GUILLEMET>\1 \2<\/a><\/li>APOSTROPH2NEWLINE/g' |\
perl -pe 's/NEWLINENEWLINENEWLINE//g' |\
perl -pe 's/NEWLINENEWLINE//g' |\
perl -pe 's/\.NEWLINE/. /g' |\
perl -pe 's/\. NEWLINE/. /g' |\
perl -pe 's/\!NEWLINE/! /g' |\
perl -pe 's/\! NEWLINE/! /g' |\
perl -pe 's/\?NEWLINE/? /g' |\
perl -pe 's/\? NEWLINE/? /g' |\
perl -pe 's/»NEWLINE/» /g' |\
perl -pe 's/NEWLINE/\n/g' |\
perl -pe 's/- (.*?)(\d+)/\+ APOSTROPH2<li><a href=GUILLEMETnode\2GUILLEMET>\1 \2<\/a><\/li>APOSTROPH2/g' |\
perl -pe 's/== (\d+) ==/ \n \);\n\n undum.game.situations.node\1 = new undum.SimpleSituation\(\nAPOSTROPH2<p><br\/><h2>\1<\/h2>/g' |\
# end of game |\
perl -pe 's/FIN/FIN APOSTROPH2/' |\
perl -pe 's/THE END/THE END APOSTROPH2/' |\
# remove extra textallion syntax |\
perl -pe 's/TESTLUCK/\[i\]Am I lucky today? (throwing a dice, 5 or 6 means luck)\[\/i\]/'|\
perl -pe 's/¯/ /g' |\
perl -pe "s/APOSTROPHE/\\\'/g" |\
perl -pe "s/APOSTROPH2/\'/g" |\
perl -pe 's/GUILLEMET/\"/g' |\
perl -pe 's/[ ]*\{.{4}\}[ ]*//g' |\
perl -pe 's/[ ]*\{.{3}\}[ ]*//g' |\
perl -pe 's|\/\/(.*)\/\/|\[i\]\1\[/i\]|' |\
perl -pe 's/\[\[(.*).jpg] 1\]/*image \1.jpg/' |\
perl -pe 's/\[\[(.*).png] 1\]/*image \1.jpg/' |\
perl -pe 's/\[(.*).jpg\]/*image \1.jpg/' |\
perl -pe 's/\[(.*).jpg\]/*image \1.jpg/' |\
perl -pe 's/..\/media\///' |\
perl -pe 's/\[(.*).ogg\]//' |\
perl -pe 's/rdv/rendez-vous/' >> $(DOCUMENT)_undum/$(DOCUMENT)_undum.html
-echo "); </script></body></html>" >> $(DOCUMENT)_undum/$(DOCUMENT)_undum.html
play-cyoa-renpy:
#
$(RENPY) $(DOCUMENT)_renpy
cyoa-renpy:
# for use with http://renpy.org/
rm -fr $(DOCUMENT)_renpy
mkdir $(DOCUMENT)_renpy
# sed can't replace multiple newlines. So we remove them, and add them back later.
cp -fr $(TEXTALLIONFOLDER)/templates/renpy/* $(DOCUMENT)_renpy
touch $(DOCUMENT)_renpy/.nomedia
cat $(DOCUMENT).t2t |\
sed '1,4d' |\
perl -pe 's/^\%(.*)\n//' |\
perl -pe 's/^(.*): *\n/ "\1:"\n/' |\
perl -pe 's/\n/NEWLINE/' |\
perl -pe 's/NEWLINENEWLINE-/\n\n menu:\n-/g' |\
perl -pe 's/NEWLINE/\n/g' |\
perl -pe 's/" menu:\"/menu:\n/' |\
perl -pe 's/tt (\d+)/continue \1/g' |\
perl -pe 's/\(rdv au (\d+)\)/ \1/g' |\
perl -pe 's/rdv au (\d+)/ \1/g' |\
perl -pe 's/continue[r|z] au (\d+)/continuer \1/g' |\
perl -pe 's/rendez-vous au (\d+)/ \1/g' |\
perl -pe 's/[A|a]lle[z|r] au (\d+)/: \1/g' |\
perl -pe 's/ au (\d+)/ \1/g' |\
perl -pe 's/(.*) (\d+)[ ]*\n/ "\1":\n jump page\2\n/' |\
perl -pe 's/(.*) \[(.*) #(.*)\][ ]*\n/ "\1":\n jump page\2\n/' |\
perl -pe 's/== (\d+) ==[ ]*\n/\nlabel page\1:\n scene bg\n with None\n/' |\
perl -pe 's/==(\d+)==\[(.*)\]\n/\nlabel page\1:\n scene bg\n with None\n/' |\
perl -pe 's/== (.*) ==[ ]*\n/\nlabel page\1:\n scene bg\n with None\n/' |\
perl -pe 's/\[\[(.*).jpg] 1\]/ image \1 = "\1.jpg"\n \x{0024} showmypic("\1")/' |\
perl -pe 's/\[\[(.*).png] 1\]/ image \1 = "\1.png"\n \x{0024} showmypic("\1")/' |\
perl -pe 's/\[(.*).jpg\]/ image \1 = "\1.jpg"\n \x{0024} showmypic("\1")/' |\
perl -pe 's/\[(.*).png\]/ image \1 = "\1.png"\n \x{0024} showmypic("\1")/' |\
perl -pe 's/\[(.*).ogg\]/ \x{0024} renpy.music.play("\1.ogg", loop=False)\n/' |\
perl -pe 's/\[(.*).mid\]/ \x{0024} renpy.music.play("\1.mid", loop=False)\n/' |\
perl -pe 's/..\/images\///g' |\
perl -pe 's/..\/media\///g' |\
perl -pe 's/¯/ /g' |\
perl -pe 's/\[(.*)\]//' |\
perl -pe 's/^(.*)\.[ ]*\n/ "\1."/' |\
perl -pe 's/^(.*),[ ]*\n/ "\1,"/' |\
perl -pe 's/^(.*)”[ ]*\n/ "\1”"/' |\
perl -pe 's/^(.*)»[ ]*\n/ "\1»"/' |\
perl -pe 's/^(.*)![ ]*\n/ "\1!"/' |\
perl -pe 's/^(.*)\?[ ]*\n/ "\1?"/' |\
perl -pe 's/^\/\/(.*)\/\/\n/ "\{i\}\1\{\/i\}"/' |\
perl -pe 's/^\*\*(.*)\*\*\n/ "\{b\}\1\{\/b\}"/' |\
perl -pe 's/^-(.*)/ "~~ missing line (please review your source code)~~"/' |\
perl -pe 's/ \"- / " /' |\
#italic |\
#perl -pe 's/\{ \/\/ \}/\{i\}/' |\
#perl -pe 's/\{\/\/\/ \}/\{\/i\}/' |\
perl -pe 's/\{ \/\/ \}//' |\
perl -pe 's/\{\/\/\/ \}//' |\
perl -pe 's/\/\/(.*)\/\//\{i\}\1\{\/i\}/' |\
perl -pe 's/\{.{3}\}(.*){(.*)\}/ "\2"/' |\
perl -pe 's/\{{3}\}//' |\
perl -pe 's/TESTLUCK/ "Am I lucky today? (throwing a dice, 5 or 6 means luck)"/'|\
perl -pe 's/:\":/\":/'|\
perl -pe 's/\" THE END \"/jump end/' |\
perl -pe 's/THE END/ jump end/' >> $(DOCUMENT)_renpy/game/script.rpy
printf "\nlabel end:\n show expression Text(\"THE END.\", size=50, yalign=0.5, xalign=0.5, drop_shadow=(2, 2)) as text\n with dissolve\n \" \" \n" >> $(DOCUMENT)_renpy/game/script.rpy
cyoa-inform7-temp:
# before : remove comments
# change " |\
# TODO # perl -pe 's/\"(.*)\"/\[\"\]\1\[\"\]/g' |\
cyoa-inform7:
sed 's/^$$/ /' $(DOCUMENT).t2t > $(DOCUMENT).tmp
printf "== 00 ==\n" >> $(DOCUMENT).tmp
cat $(DOCUMENT).tmp |\
perl -pe 's/==(\d+)==\[(.*)\]/== \1 ==/' |\
perl -pe 's/== (\d+) ==/\n== \1 ==\n/' |\
perl -pe 's/TESTLUCK/Am I lucky today? (throwing a dice, 5 or 6 means luck)/'|\
# remove comments |\
perl -pe 's/^\%(.*)\n//' |\
# remove syntax such as [11 #nord] |\
perl -pe 's/\[(\d+) #([^ ].*?)\]/\2/g' |\
perl -pe 's/- (.*) \[(.*)\]\n/- \1 \2\n/g' |\
perl -pe 's/- (.*) \((.*)\)\n/- \1 \2\n/g' |\
perl -pe 's/\[(.*)\]{(.*)\}\n//g' |\
perl -pe 's/\[(.*)\]\n//g' |\
perl -pe 's/\[(.*)\]//g' |\
perl -pe 's/{~~~~}/ /g' |\
perl -pe 's/¯/ /g' |\
perl -pe 's/\?/\? /g' > $(DOCUMENT).tmp2
printf "\"$(DOCUMENT_TITLE)\" by $(DOCUMENT_AUTHOR)\n\nInclude Adventure Book by Edward Griffiths.\n\n\n" > $(DOCUMENT).i7
printf "The first Page is a page. \"Starting the game...\" It is followed by Page1.\n\n" >> $(DOCUMENT).i7
perl $(TEXTALLIONFOLDER)/core/adventurebook.pl $(DOCUMENT).tmp2 >> $(DOCUMENT).i7
cat $(DOCUMENT).i7 |\
# remove extra spaces |\
perl -pe 's/ [ ]*"./ "./g' |\
perl -pe 's/ [ ]*/ /g' |\
perl -pe 's/\{->--\} FIN \{-<--\}[ ]*"./". \nIt is followed by GameEnd./' |\
perl -pe 's/\{->--\} THE END \{-<--\}[ ]*"./". \nIt is followed by GameEnd./' |\
# remove extra textallion syntax |\
perl -pe 's/{(.*)}\n//g' |\
perl -pe 's/{(.*)}//g' > $(DOCUMENT).tmp
printf "\nGameEnd is a page. \"** THE END **\".\n\n" >> $(DOCUMENT).tmp
# convert French apostrophes for inform7 source
cat $(DOCUMENT).tmp | sed -e "s/S'/S[\']/g" | sed -e "s/N'/N[\']/g" | sed -e "s/L'/L[\']/g" | sed -e "s/C'/C[\']/g" | sed -e "s/D'/D[\']/g" | sed -e "s/J'/J[\']/g" | sed -e "s/M'/M[\']/g" | sed -e "s/U'/U[\']/g" | sed -e "s/s'/s[\']/g" | sed -e "s/ n'/ n[\']/g" | sed -e "s/l'/l[\']/g" | sed -e "s/ c'/ c[\']/g" | sed -e "s/d'/d[\']/g" | sed -e "s/j'/j[\']/g" | sed -e "s/m'/m[\']/g" | sed -e "s/u'/u[\']/g" > $(DOCUMENT).i7
-rm $(DOCUMENT).tmp
-rm $(DOCUMENT).tmp2
cp -fr $(TEXTALLIONFOLDER)/templates/inform7 ./
cp $(DOCUMENT).i7 inform7/cyoa.inform/Source/story.ni
cd inform7
make z8
cyoa-inform6:
inform +source_path=$(TEXTALLIONFOLDER)/templates/inform6/ +include_path=./,$(TEXTALLIONFOLDER)/templates/inform6/,/usr/share/inform/include +code_path=./ "$1".inf
# images (thumbnails)
vignettes:
sh $(TEXTALLIONFOLDER)/core/vignettes.sh
mv vignettes_doc.t2t vignettes_$(DOCUMENT).t2t
sed -i -e "s/@@DOCUMENT_TITLE@@/$(DOCUMENT_TITLE)/" vignettes_$(DOCUMENT).t2t
sed -i -e "s/@@DOCUMENT_AUTHOR@@/$(DOCUMENT_AUTHOR)/" vignettes_$(DOCUMENT).t2t
$(TXT2TAGS) -T $(TEXTALLIONFOLDER)/templates/xhtml.html -t xhtml --style=$(TEXTALLIONFOLDER)/includes/sample.css --css-inside --no-toc --outfile vignettes_$(DOCUMENT).html vignettes_$(DOCUMENT).t2t
#$(TXT2TAGS) -T $(TEXTALLIONFOLDER)/templates/xhtml.html -t xhtml --css-inside --toc --outfile #$(DOCUMENT).html $(DOCUMENT).t2t
# CLEAN part
clean: clean-temp
clean-temp:
-rm *~
-rm .*~
-rm $(DOCUMENT).toc
-rm $(DOCUMENT).tex
-rm $(DOCUMENT)_slide.tex
-rm $(DOCUMENT)2.html
-rm $(DOCUMENT).ps
-rm $(DOCUMENT)_booklet.ps
-rm *.log
-rm *.out
-rm *.aux
-rm *.toc
-rm *.nav
-rm *.snm
-rm *.ilg
-rm *.idx
-rm *.ind
-rm *.fax
-rm *.tns
clean-docs:
-rm -i $(DOCUMENT).pdf
-rm -i $(DOCUMENT)*.pdf
-rm -i $(DOCUMENT)*.html
-rm -i $(DOCUMENT).epub
-rm -i vignettes_*
-rm -fri tb
-rm -i *graph.svg
-rm -i *graph.png
-rm -i *graph.txt
-rm -i *.pdf
-rm -i *.ps
-rm -i *.tex
-rm -i *.html
-rm -i *.epub
cleanall: clean-temp clean-docs
clean-everything: cleanall
DOCUMENTNEWNAME = newname
rename:
@echo "Edit the DOCUMENTNEWNAME variable at the end of the makefile (no space please)"
@echo "(current document name to replace is $(DOCUMENT))"
@echo "(current document new name is $(DOCUMENTNEWNAME))"
@echo "(We will keep the older $(DOCUMENT).t2t as a reference)"
@echo "press a key to start"
@read PAUSE
-cp $(DOCUMENT).t2t $(DOCUMENTNEWNAME).t2t
-mv $(DOCUMENT).sty $(DOCUMENTNEWNAME).sty
-mv $(DOCUMENT).css $(DOCUMENTNEWNAME).css
-mv $(DOCUMENT).jpg $(DOCUMENTNEWNAME).jpg
-mv $(DOCUMENT).png $(DOCUMENTNEWNAME).png
-mv $(DOCUMENT).svg $(DOCUMENTNEWNAME).svg
-sed -i -e "s/$(DOCUMENT)/$(DOCUMENTNEWNAME)/" $(DOCUMENTNEWNAME).t2t
-sed -i -e "s/$(DOCUMENT)/$(DOCUMENTNEWNAME)/" makefile