Skip to content

Commit

Permalink
added stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
btr1975 committed Sep 4, 2022
1 parent bde5aaa commit 542b2f4
Show file tree
Hide file tree
Showing 5 changed files with 63 additions and 6 deletions.
3 changes: 2 additions & 1 deletion cookiecutter.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@
"app_description": "A short description",
"app_version": "0.1.0",
"app_documents_location": ["readthedocs.io", "github-pages"],
"app_documents_theme": ["sphinx_rtd_theme", "alabaster"],
"use_requests": "n",
"use_cryptography": "n",
"__template_repo": "https://github.com/btr1975/cookiecutter-python-fastapi-openapi",
"__template_version": "1.0.0"
"__template_version": "1.0.1"
}
12 changes: 10 additions & 2 deletions {{cookiecutter.git_repo_name}}/Makefile
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
# Makefile for project needs
# Author: Ben Trachtenberg
# Version: 1.0.0
# Version: 1.0.1
#

.PHONY: info app-run coverage pylint pytest gh-pages
.PHONY: info app-run coverage pylint pytest gh-pages pdf word

info:
@echo "make options"
@echo " app-run To run the app"
@echo " coverage To run coverage and display ASCII and output to htmlcov"
@echo " pylint To run pylint"
@echo " pytest To run pytest with verbose option"
@echo " pdf To create PDF Docs"
@echo " word To create Word Docs"
{% if cookiecutter.app_documents_location == 'github-pages' %} @echo " gh-pages To create the GitHub pages"{% endif %}

app-run:
Expand All @@ -28,6 +30,12 @@ pylint:
pytest:
@pytest -vvv

pdf:
@sphinx-build -b rinoh ./docs ./docs/_build/pdf

word:
@sphinx-build -b docx ./docs ./docs/_build/word

{% if cookiecutter.app_documents_location == 'github-pages' %}
gh-pages:
@sphinx-build ./docs ./docs/gh-pages
Expand Down
35 changes: 33 additions & 2 deletions {{cookiecutter.git_repo_name}}/docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,10 @@
# ones.
extensions = ['sphinx.ext.todo',
'sphinx.ext.viewcode',
'sphinx.ext.autodoc'
'sphinx.ext.autodoc',
'myst_parser',
'docxsphinx',
'sphinxcontrib.mermaid',
]

# Add any paths that contain templates here, relative to this directory.
Expand All @@ -56,7 +59,7 @@
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
html_theme = 'alabaster'
html_theme = '{{ cookiecutter.app_documents_theme }}'
if html_theme == 'alabaster':
html_theme_options = {
'description': f'{about["__description__"]}',
Expand All @@ -67,8 +70,36 @@
'github_user': '{{ cookiecutter.git_username }}',
'github_repo': about["__title__"]
}
elif html_theme == 'sphinx_rtd_theme':
html_theme_options = {
# 'analytics_id': 'G-XXXXXXXXXX',
# 'analytics_anonymize_ip': False,
'logo_only': False,
'display_version': True,
'prev_next_buttons_location': 'bottom',
'style_external_links': False,
'vcs_pageview_mode': '',
'style_nav_header_background': '#2980B9',
# Toc options
'collapse_navigation': True,
'sticky_navigation': True,
'navigation_depth': 4,
'includehidden': True,
'titles_only': False
}

# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']

# This is used fpr making a PDF using rinohtype
# See https://www.mos6581.org/rinohtype/master/sphinx.html
rinoh_documents = [{'doc': 'index', 'target': f'{about["__title__"]}'}]

# This is used for render markdown using myst-parser
# see https://www.sphinx-doc.org/en/master/usage/markdown.html
source_suffix = {
'.rst': 'restructuredtext',
'.md': 'markdown',
}
14 changes: 13 additions & 1 deletion {{cookiecutter.git_repo_name}}/make.bat
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
@ECHO OFF
REM Makefile for project needs
REM Author: Ben Trachtenberg
REM Version: 1.0.0
REM Version: 1.0.1
REM

IF "%1" == "app-run" (
Expand All @@ -27,6 +27,16 @@ IF "%1" == "pytest" (
GOTO END
)

IF "%1" == "pdf" (
sphinx-build -b rinoh ./docs ./docs/_build/pdf
GOTO END
)

IF "%1" == "word" (
sphinx-build -b docx ./docs ./docs/_build/word
GOTO END
)

{% if cookiecutter.app_documents_location == 'github-pages' %}
IF "%1" == "gh-pages" (
sphinx-build ./docs ./docs/gh-pages
Expand All @@ -39,6 +49,8 @@ IF "%1" == "gh-pages" (
@ECHO coverage To run coverage and display ASCII and output to htmlcov
@ECHO pylint To run pylint
@ECHO pytest To run pytest with verbose option
@ECHO pdf To create PDF Docs
@ECHO word To create Word Docs
{% if cookiecutter.app_documents_location == 'github-pages' %}@ECHO gh-pages To create the GitHub pages{% endif %}

:END
5 changes: 5 additions & 0 deletions {{cookiecutter.git_repo_name}}/requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,9 @@ pytest
coverage
sphinx
pylint
rinohtype
myst-parser
docxsphinx
sphinx_rtd_theme
sphinxcontrib-mermaid
{% if cookiecutter.use_requests == 'y' %}requests-mock{% endif %}

0 comments on commit 542b2f4

Please sign in to comment.