csl-clio/Utilitaires/Makefile
2023-08-19 15:27:29 +02:00

96 lines
3.0 KiB
Makefile

INPUT_DATA_DIR = ../Tests-Data
CHANGELOG = ../CHANGELOG.md
BIBLIO_FILE = $(INPUT_DATA_DIR)/BIBLIO_CSL-Tests.json
CSL_FILE_SUFFIX = .csl
INPUT_FILE = $(INPUT_DATA_DIR)/CSL-Tests.md
STYLESHEETS_DIR = ..
VALIDATION_FILE_SUFFIX = _CSL-Validation.native
OUTPUT_FILE_SUFFIX = _CSL-Tests.native
VISUALISATION_FILE_SUFFIX = .html
VISUALISATION_PREFIX = PROV_
HTML-VIEWER = palemoon
ifdef JOURNAL
THIS_STYLE_DIR = $(STYLESHEETS_DIR)/$(JOURNAL)
DOC_DIR = $(THIS_STYLE_DIR)
DOC_FILE = $(DOC_DIR)/GUIDE_$(JOURNAL)
VISUALISATION_FILE = $(VISUALISATION_PREFIX)$(JOURNAL)$(VISUALISATION_FILE_SUFFIX)
CSL_FILE = $(THIS_STYLE_DIR)/$(JOURNAL)$(CSL_FILE_SUFFIX)
VALIDATION_FILE = $(THIS_STYLE_DIR)/$(JOURNAL)$(VALIDATION_FILE_SUFFIX)
OUTPUT_FILE = $(THIS_STYLE_DIR)/$(JOURNAL)$(OUTPUT_FILE_SUFFIX)
FILTERS_FILE_FIRST = $(THIS_STYLE_DIR)/$(JOURNAL)_filters-first.txt
FILTERS_LIST_FIRST != ./get-filters.sh $(FILTERS_FILE_FIRST)
FILTERS_FILE_LAST = $(THIS_STYLE_DIR)/$(JOURNAL)_filters-last.txt
FILTERS_LIST_LAST != ./get-filters.sh $(FILTERS_FILE_LAST)
else
DOC_DIR = ../Documentation
DOC_FILE = $(DOC_DIR)/GUIDE_CSL-Clio
endif
PANDOC_OPTIONS = \
$(FILTERS_LIST_FIRST) \
-C \
--bibliography=$(BIBLIO_FILE) \
--csl=$(CSL_FILE) \
-M lang=fr \
--wrap=none \
$(FILTERS_LIST_LAST)
COMMON_DOC_OPTIONS= -s \
--filter pandoc-crossref \
-L license-dans-metadonnees.lua \
-L changelog-dans-annexes.lua \
$(DOC_FILE).md \
--resource-path=.:$(DOC_DIR)
test: $(VALIDATION_FILE) $(OUTPUT_FILE)
echo "Résultat de la comparaison"
echo "============="
diff -s -C 0 \
$(OUTPUT_FILE) \
$(VALIDATION_FILE)
echo "============="
test-compact: $(VALIDATION_FILE) $(OUTPUT_FILE)
dwdiff -3 $(OUTPUT_FILE) $(VALIDATION_FILE) | sort | uniq
$(OUTPUT_FILE): $(CSL_FILE) $(BIBLIO_FILE)
pandoc $(PANDOC_OPTIONS) \
$(INPUT_FILE) \
-t native \
-o $(OUTPUT_FILE)
visualisation: $(VISUALISATION_FILE)
$(HTML-VIEWER) $(VISUALISATION_FILE)
$(VISUALISATION_FILE): $(BIBLIO_FILE) $(CSL_FILE) $(INPUT_FILE)
pandoc -s $(PANDOC_OPTIONS) \
$(INPUT_FILE) \
-o $(VISUALISATION_FILE)
validation-docx: $(VALIDATION_DOCX_FILE)
$(VALIDATION_DOCX_FILE): $(BIBLIO_FILE) $(CSL_FILE) $(INPUT_FILE)
pandoc $(PANDOC_OPTIONS) \
$(INPUT_FILE) \
-o $(VALIDATION_DOCX_FILE)
$(INPUT_FILE): $(BIBLIO_FILE)
./generer-md-pour-citeproc.sh $(BIBLIO_FILE) $(INPUT_FILE)
install: $(OUTPUT_FILE)
mv $(OUTPUT_FILE) $(VALIDATION_FILE)
clean:
rm $(STYLESHEETS_DIR)/*/*$(OUTPUT_FILE_SUFFIX)
doc: docA4 docDiapo
docA4: $(DOC_FILE).md TEMPLATE_Guide-CSL-Clio.latex $(CHANGELOG)
pandoc $(COMMON_DOC_OPTIONS) -o $(DOC_FILE)_A4.tex --template=TEMPLATE_Guide-CSL-Clio.latex && \
cd $(DOC_DIR) && \
latexmk -lualatex $(DOC_FILE)_A4
docDiapo: $(DOC_FILE).md TEMPLATE_Guide-CSL-Clio.context $(CHANGELOG)
pandoc $(COMMON_DOC_OPTIONS) -o $(DOC_FILE)_Diapo.tex -t context --template=TEMPLATE_Guide-CSL-Clio.context && \
./microfixes-docDiapo.sh $(DOC_FILE)_Diapo.tex && \
cd $(DOC_DIR) && \
context --noconsole --errors $(DOC_FILE)_Diapo.tex