Skip to content

Commit

Permalink
Merge pull request #81 from paolo-de-rosa/feat/mkdocs
Browse files Browse the repository at this point in the history
Feat/mkdocs
  • Loading branch information
paolo-de-rosa authored Sep 9, 2023
2 parents d055e7c + 2950fe3 commit ebf837b
Show file tree
Hide file tree
Showing 24 changed files with 180 additions and 1,235 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@
/*.docx
node_modules
dist
build
site
71 changes: 47 additions & 24 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,37 +1,60 @@
# Makefile
# Converts Markdown to other formats (HTML, PDF, DOCX, EPUB) using Pandoc and MkDocs
#
# Run "make" (or "make all") to convert to all other formats
# Run "make clean" to delete converted files

# Prerequisites
# pandoc
#
# sudo apt install pandoc
# Install pandoc, latex and mkdocs in your environment
#
# Parameters and Variables
# https://www.gnu.org/software/make/manual/html_node/Automatic-Variables.html#Automatic-Variables
GENERATED= arf.html \
arf.docx
#

SOURCE_DOCS := $(wildcard docs/*.md)
BUILD_DIR :=./build
SITE_DIR :=./site
EXPORTED_DOCS=\
$(SOURCE_DOCS:.md=.pdf) \
$(SOURCE_DOCS:.md=.docx) \
$(SOURCE_DOCS:.md=.epub)

RM=/bin/rm
PANDOC=pandoc
MKDOCS=mkdocs

PANDOC_OPTIONS=--toc --metadata title="The European Digital Identity Wallet Architecture and Reference Framework" --metadata lang="en" --data-dir docs/media
PANDOC_PDF_OPTIONS= --pdf-engine=xelatex
PANDOC_DOCX_OPTIONS=
PANDOC_EPUB_OPTIONS=--to epub3

# Pattern-matching Rules

%.pdf : %.md
mkdir -p $(BUILD_DIR)/pdf
$(PANDOC) $(PANDOC_OPTIONS) $(PANDOC_PDF_OPTIONS) -o $(BUILD_DIR)/pdf/$(notdir $@) $<

all: $(GENERATED)
%.docx : %.md
mkdir -p $(BUILD_DIR)/docx
$(PANDOC) $(PANDOC_OPTIONS) $(PANDOC_DOCX_OPTIONS) -o $(BUILD_DIR)/docx/$(notdir $@) $<

# Gerenate html, doc from the html
arf.html: arf.md
pandoc -s -o ./dist/$@ $< --toc --metadata title="The European Digital Identity Wallet Architecture and Reference Framework" --metadata lang="en" --self-contained --css=styles/style.css
node fix.js
cd ./dist && cp output.html $@ && rm output.html
pandoc -o ./dist/$@.docx ./dist/$@ --reference-doc=styles/reference.docx
%.epub : %.md
mkdir -p $(BUILD_DIR)/epub
$(PANDOC) $(PANDOC_OPTIONS) $(PANDOC_EPUB_OPTIONS) -o $(BUILD_DIR)/epub/$(notdir $@) $<

# Generate docx
arf.docx: arf.md
pandoc -o ./dist/$@ $<

# Run a local http server
# Targets and dependencies

.PHONY: all clean

all : $(EXPORTED_DOCS) mkdocs

mkdocs:
$(MKDOCS) build

serve:
npx http-server .
$(MKDOCS) serve

prepare:
mkdir -p dist
npm install

clean:
echo $(GENERATED)
rm -f $(GENERATED) arf.html.docx
rm -f ./dist -R
- $(RM) -rf $(BUILD_DIR) $(SITE_DIR)

File renamed without changes.
Loading

0 comments on commit ebf837b

Please sign in to comment.