markdown-latex-boilerplate icon indicating copy to clipboard operation
markdown-latex-boilerplate copied to clipboard

Request for the makefile to read settigns off config.txt instead

Open mofosyne opened this issue 9 years ago • 3 comments

Okay, here is something windows user might find useful. An equiv to the makefile for this boilerplate. A request has been pushed, and is awaiting your confirmation.

The only issue is that the makefile is hardcoded, so I would like to ask if you can recode the makefile to read off config.txt instead?

Oh and btw I decided to keep the sections as a separate text file. It really make it easier to keep track of sections that way, especially when it becomes very large.

This is the winmake.bat batch file:

ECHO OFF
ECHO Windows Makefile alternative for markdown-latex-boilerplate
ECHO Command List: "winmake pdf","winmake epub","winmake html": default html

SET COMMAND=%1%
ECHO "COMMAND: %COMMAND%"

for /f %%i in (config.txt) do (
    for /f "tokens=1,2 delims==" %%a IN ("%%i") DO SET "%%a=%%b"
)

set /p SECTIONS=<%SECTIONS% 

rmdir build /S /q
mkdir build

IF "%COMMAND%"=="pdf" goto pdf
IF "%COMMAND%"=="epub" goto epub
IF "%COMMAND%"=="html" goto html

ECHO Default is HTML
goto html

:pdf
markdown2pdf --toc -N --bibliography=%REFERENCES% -o ./build/example.pdf --csl=./csl/%CSL%.csl --template=%TEMPLATE% %SECTIONS%
goto exit

:epub
pandoc -S -s --biblatex --toc -N --bibliography=%REFS% -o ./build/example.epub -t epub --normalize %SECTIONS%
goto exit

:html
pandoc -S --mathjax="http://cdn.mathjax.org/mathjax/latest/MathJax.js" --section-divs -s --biblatex --toc -N --bibliography=%REFERENCES% -o ./build/example.html -t html --normalize %SECTIONS%
goto exit

:exit
ECHO All Done!
PAUSE

This is what the config.txt looks like:

SECTIONS=sections.txt
REFERENCES=references.bib
TEMPLATE=template.tex
CSL=outline.txt

This is what the sections.txt looks like:

example.md references.md

mofosyne avatar Mar 28 '15 16:03 mofosyne