-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use Makefile for compiling blog articles.
- Loading branch information
Showing
4 changed files
with
61 additions
and
66 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
out | ||
build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
SOURCE = source | ||
BUILD = build | ||
ARTICLES = $(wildcard $(SOURCE)/*.adoc) | ||
|
||
ifndef AUTHOR | ||
$(error AUTHOR is not set) | ||
endif | ||
|
||
ifndef BASEURL | ||
$(error BASEURL is not set) | ||
endif | ||
|
||
ifndef EMAIL | ||
$(error EMAIL is not set) | ||
endif | ||
|
||
ifndef HOMEPAGE | ||
$(error HOMEPAGE is not set) | ||
endif | ||
|
||
ifndef REVNUMBER | ||
$(error REVNUMBER is not set) | ||
endif | ||
|
||
ASCIIDOC_COMPILER = asciidoctor | ||
ASCIIDOCTOR_FLAGS = $\ | ||
--doctype article $\ | ||
--safe-mode server $\ | ||
--attribute source-highlighter=rouge $\ | ||
--attribute prewrap! $\ | ||
--attribute author="$(AUTHOR)" $\ | ||
--attribute email=$(EMAIL) $\ | ||
--attribute homepage="$(HOMEPAGE)" $\ | ||
--attribute revnumber=$(REVNUMBER) | ||
|
||
$(BUILD)/%.html: $(SOURCE)/%.adoc | ||
mkdir -p $(BUILD) | ||
asciidoctor "$(SOURCE)/$*.adoc" --out-file "$(BUILD)/$*.html" $(ASCIIDOCTOR_FLAGS) --attribute imagesdir="$(BASEURL)/blog/raw/$*" --backend html5 --attribute nofooter --attribute webfonts! | ||
sed -i 's/^<head>$$/<head>\n<base target="_parent">/' "$(BUILD)/$*.html" | ||
|
||
$(BUILD)/%.pdf: $(SOURCE)/%.adoc | ||
mkdir -p $(BUILD) | ||
asciidoctor-pdf "$(SOURCE)/$*.adoc" --out-file "$(BUILD)/$*.pdf" $(ASCIIDOCTOR_FLAGS) --attribute imagesdir="$*" --attribute pdf-theme="pdf-theme.yml" | ||
|
||
clean: | ||
rm -r $(BUILD) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters