Skip to content

Instantly share code, notes, and snippets.

@attakei
Created October 12, 2024 14:47
Show Gist options
  • Save attakei/8b72599b2d3106bd3827055dafd7216e to your computer and use it in GitHub Desktop.
Save attakei/8b72599b2d3106bd3827055dafd7216e to your computer and use it in GitHub Desktop.
go-task for sphinx
version: '3'
vars:
# If you run bare environment or activated venv, set '' (blank string)
# RUN_PYTHON: 'uv run'
SPHINX_DEFAULT_BUILD: 'html'
SPHINX_SOURCE_DIR: 'content'
SPHINX_BUILD_DIR: 'build'
tasks:
# If you want to build pdf on local, remove it.
build-latexpdf:
desc: 'Make PDF by passed latex'
vars:
RUN_PYTHON: 'docker run --rm -v {{.USER_WORKING_DIR}}:/docs sphinxdoc/sphinx-latexpdf'
TARGET: 'latexpdf'
cmds:
- '{{.RUN_PYTHON}} sphinx-build -M {{.TARGET}} {{.SPHINX_SOURCE_DIR}} {{.SPHINX_BUILD_DIR}}'
build-*:
desc: 'Make docs'
dir: '{{.TASKFILE_DIR}}'
vars:
TARGET: '{{index .MATCH 0}}'
cmds:
- '{{.RUN_PYTHON}} sphinx-build -M {{.TARGET}} {{.SPHINX_SOURCE_DIR}} {{.SPHINX_BUILD_DIR}}'
build:
desc: 'Make docs (default target)'
deps:
- 'build-{{.SPHINX_DEFAULT_BUILD}}'
help:
desc: 'Display help of docs'
deps:
- 'build-help'
clean:
desc: 'Clean build files of docs'
deps:
- 'build-clean'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment