ENV = export $(shell cat .env | grep -v '^\#' | grep -v '^$$' | xargs)

.PHONY: fetch write translate upload clean all

## Downloads a wiki page into SOURCE.md
## Usage: make fetch URL=/path/to/page
fetch:
	@$(ENV) && python3 generator.py fetch $(URL)

## Writes a blog post from SOURCE.md → BLOGPOST.md
write:
	@$(ENV) && python3 generator.py write

## Translates BLOGPOST.md → TRANSLATED_BLOGPOST.md
translate:
	@$(ENV) && python3 generator.py translate

## Uploads TRANSLATED_BLOGPOST.md to the wiki
upload:
	@$(ENV) && python3 generator.py upload

## Deletes .md files from the output directory
clean:
	@$(ENV) && python3 generator.py clean

## Full pipeline: write → translate → upload
all: write translate upload