diff --git a/makefile b/makefile index 1de319f5..df3928f4 100644 --- a/makefile +++ b/makefile @@ -17,9 +17,11 @@ SRC := $(wildcard *.tex) +SONGBOOKS := $(wildcard *.sb) + SOURCES := $(shell egrep -l '^[^%]*\\begin\{document\}' *.tex) -CIBLE = $(SOURCES:%.tex=%) +CIBLE = $(SOURCES:%.tex=%) $(SONGBOOKS:%.sb=%) PDF = $(CIBLE:%=%.pdf) PSF = $(CIBLE:%=%.ps.gz) @@ -90,6 +92,7 @@ clean: cleandoc @rm -f *.sbd @rm -f *.sbx *.sxd @rm -f ./lilypond/*.ps + @rm -f $(SONGBOOKS:%.sb=%.tex) cleanall: clean @rm -f $(PDF) $(PSF) @@ -151,6 +154,12 @@ $(SONGS): $(SONGS_SRC) $(CHORDS): $(CHORDS_SRC) $(MAKE_CHORDS) -o $@ +%.tex: %.sb + $(PRINT) "\newcommand{\template}{" > $@ + cat $< >> $@ + $(PRINT) "}" >> $@ + $(PRINT) "\input{template.tex}" >> $@ + # Create an empty mybook.sgl file if it does not exist mybook.sgl: touch $@ diff --git a/template.tex b/template.tex new file mode 100644 index 00000000..1be2ea25 --- /dev/null +++ b/template.tex @@ -0,0 +1,44 @@ +\providecommand{\defaulttemplate}{ + \title{Recueil de chansons pour guitare} + \author{Romain Goffe \and Alexandre Dupas} + \subtitle{} + \version{3.1} + \mail{crep@team-on-fire.com} + \picture{feel-the-music} + \picturecopyright{©foxygamergirl @ deviantart.com} + \footer{ + \begin{flushleft} + \includegraphics[width=3cm]{on-fire} + \end{flushleft} + } + \licence{\input{license.tex}} +} +\providecommand{\template}{\defaulttemplate} +\providecommand{\songslist}{} +\providecommand{\booktype}{chorded} + +\documentclass[\booktype]{crepbook} +\usepackage[utf8]{inputenc} +\usepackage[english,french]{babel} + +\newindex{titleidx}{templatetitle} +\newauthorindex{authidx}{templateauth} + +\graphicspath{ + {img/}, +} + +\template +\begin{document} + +\maketitle + +\showindex{Index des chansons}{titleidx} +\showindex{Index des auteurs}{authidx} + +\songsection{Chansons} +\begin{songs}{titleidx,authidx} + \songslist +\end{songs} + +\end{document} diff --git a/test.sb b/test.sb new file mode 100644 index 00000000..ba529213 --- /dev/null +++ b/test.sb @@ -0,0 +1,10 @@ +\defaulttemplate +\title{Ceci est un test du template} +\renewcommand{\songslist}{ + \graphicspath{ + {img/}, + {songs/Le_Donjon_de_Naheulbeuk/}, + } + \input{songs/Le_Donjon_de_Naheulbeuk/Geste_heroique.sg} + \input{songs/Le_Donjon_de_Naheulbeuk/La_biere_du_donjon.sg} +}