Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stop explicitly generating bibliography files (re #3997) #4294

Draft
wants to merge 16 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 10 additions & 48 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,6 @@ ifeq ($(HUGO_VERSION_TOO_LOW),true)
$(error "incorrect hugo version installed! Need hugo 0.$(HUGO_VERSION_MIN), but only found hugo 0.$(HUGO_VERSION)!")
endif

# check whether bibtools are installed; used by the endnote and mods targets.
HAS_XML2END=$(shell which xml2end > /dev/null && echo true || echo false)
HAS_BIB2XML=$(shell which bib2xml > /dev/null && echo true || echo false)


VENV := "venv/bin/activate"

Expand Down Expand Up @@ -167,63 +163,29 @@ build/.data: build/.basedirs $(sourcefiles) venv/bin/activate
. $(VENV) && python3 bin/create_hugo_data.py --clean
@touch build/.data

.PHONY: bibtex
bibtex: build/.bibtex

.PHONY: mods
mods: build/.mods

.PHONY: endnote
endnote: build/.endnote
.PHONY: bib
bib: build/.bib

#######################################################
build/.bibtex: build/.basedirs $(sourcefiles) venv/bin/activate
@echo "INFO Creating BibTeX files..."
. $(VENV) && python3 bin/create_bibtex.py --clean
@touch build/.bibtex

# Disable citation targets (except for 3 bibtex per volume) by setting NOBIB=true
ifeq (true, $(NOBIB))
$(info WARNING: not creating citation materials; this is not suitable for release!)
build/.mods: build/.bibtex
touch build/.mods
build/.endnote: build/.bibtex
touch build/.endnote
$(info WARNING: not creating full citation materials; this is not suitable for release!)
build/.bib:
@touch build/.bib
else

build/.mods: build/.bibtex
@if [ $(HAS_BIB2XML) = false ]; then \
echo "bib2xml not found, please install bibtools"; \
echo "alternatively, build the site without endnote files by running make hugo"; \
exit 1; \
fi
@echo "INFO Converting BibTeX files to MODS XML..."
@find build/data-export -name '*.bib' -print0 | \
xargs -0 -n 1 -P 8 bin/bib2xml_wrapper >/dev/null
@touch build/.mods

build/.endnote: build/.mods
@if [ $(HAS_XML2END) = false ]; then \
echo "xml2end not found, please install bibtools"; \
echo "alternatively, build the site without endnote files by running make hugo"; \
exit 1; \
fi
@echo "INFO Converting MODS XML files to EndNote..."
@find build/data-export -name '*.xml' -print0 | \
xargs -0 -n 1 -P 8 bin/xml2end_wrapper >/dev/null
@touch build/.endnote
build/.bib: build/.basedirs build/.data venv/bin/activate
@echo "INFO Creating extra bibliographic files..."
. $(VENV) && python3 bin/create_bib.py --clean
@touch build/.bib
endif
# end if block to conditionally disable bibtex generation
#######################################################


%.endf: %.xml
xml2end $< 2>&1 > $@

.PHONY: hugo
hugo: build/.hugo

build/.hugo: build/.static build/.data build/.bibtex build/.mods build/.endnote
build/.hugo: build/.static build/.data build/.bib
@echo "INFO Running Hugo... this may take a while."
@cd build && \
hugo -b $(ANTHOLOGYHOST)/$(ANTHOLOGYDIR) \
Expand Down
20 changes: 0 additions & 20 deletions bin/bib2xml_wrapper

This file was deleted.

Loading