pandoc 용 Makefile을 작성하려고합니다. make filename.ext
을 입력하면 Makefile이 filename.txt
에서 filename.ext
으로 자동 컴파일됩니다. 파일 이름은 .txt라는 이름이 될 수 있습니다. 이 부분은 쉽습니다. 예 :참조 파일이있는 pandoc 용 Makefile
%.pdf: %.txt
pandoc -s --smart -f markdown -o [email protected] $<
%.html: %.txt
pandoc -s --smart --bibliography $(bib) -f markdown -t html --standalone -o [email protected] $<
%.docx: %.txt
pandoc -s --smart --bibliography references.bib -f markdown -t docx -o [email protected] $<
%.tex: %.txt
pandoc -s --smart --bibliography references.bib -o [email protected] $<
그러나, 나는 또한 filename.bib
라는 동일한 파일에서 인용을 추가 할 : 내가 좋아하는 일련의 규칙이있다. 따라서 make fudge.pdf
을 입력하면 pandoc은 fudge.txt를 fudge.pdf로 변환하고 fudge.bib의 bibtex 인용을 통합합니다. 어떻게해야합니까? 명령 줄이
pandoc -s --smart --bibliography filename.bib -f markdown -o [email protected] $<
같은 것입니다 ...하지만이 같은 것을하지 않고 fudge.txt에서 fudge.bib을 얻을 방법을 알아낼 수 없습니다 :
pandoc -s --smart --bibliography $(subst .txt,.bib,$<) -f markdown -o [email protected] $<
이 작동됩니다, 하지만 a) 파일 * .bib에 대한 사전 처리 (즉 생성 및 누락 된 참조 추가)를 수행하고 b) 모든 행에 해당 매크로가 필요합니다. 더 우아한 것이 있습니까?
완벽한 감사합니다! – Puzzled79