From bb337c09d81ea522bd6e323cbb49bcc43c8dc807 Mon Sep 17 00:00:00 2001 From: Christopher Pickering Date: Tue, 27 Jul 2021 16:06:47 -0500 Subject: [PATCH] added docs --- README.md => README.rst | 22 ++++++++------- docs/Makefile | 20 +++++++++++++ docs/conf.py | 62 +++++++++++++++++++++++++++++++++++++++++ docs/index.rst | 19 +++++++++++++ docs/make.bat | 35 +++++++++++++++++++++++ docs/requirements.txt | 0 setup.py | 4 ++- 7 files changed, 151 insertions(+), 11 deletions(-) rename README.md => README.rst (84%) create mode 100644 docs/Makefile create mode 100644 docs/conf.py create mode 100644 docs/index.rst create mode 100644 docs/make.bat create mode 100644 docs/requirements.txt diff --git a/README.md b/README.rst similarity index 84% rename from README.md rename to README.rst index 7f91c36..3e066fc 100644 --- a/README.md +++ b/README.rst @@ -39,15 +39,15 @@ PR any changes needed 👍🏽 Optional args ------------- -+-------------------+---------------------------+----------------+ -| Arg | Definition | Default | -+===================+===========================+================+ -| -e, --extension | File extension to lint. | default=html | -+-------------------+---------------------------+----------------+ -| --check | Checks file formatting | -+-------------------+---------------------------+----------------+ -| --reformat | Reformats html | -+-------------------+---------------------------+----------------+ ++--------------------+---------------------------+----------------+ +| Arg | Definition | Default | ++====================+===========================+================+ +| -e, --extension | File extension to lint. | default=html | ++--------------------+---------------------------+----------------+ +| --reformat --check | Checks html formatting | | ++--------------------+---------------------------+----------------+ +| --reformat | Reformats html | | ++--------------------+---------------------------+----------------+ Linter Rules ------------ @@ -97,6 +97,8 @@ Warning Codes +--------+----------------------------------------------------------------+ | W016 | Missging title tag in html. | +--------+----------------------------------------------------------------+ +| W017 | Tag should be self closing. | ++--------+----------------------------------------------------------------+ Adding Rules ------------ @@ -111,7 +113,7 @@ A good rule consists of Contributing - Please Help! --------------------------- -Checkout the issue list and help where you can! +Checkout the `issue `_ list and help where you can! .. |codecov| image:: https://codecov.io/gh/Riverside-Healthcare/djlint/branch/master/graph/badge.svg?token=eNTG721BAA :target: https://codecov.io/gh/Riverside-Healthcare/djlint diff --git a/docs/Makefile b/docs/Makefile new file mode 100644 index 0000000..d4bb2cb --- /dev/null +++ b/docs/Makefile @@ -0,0 +1,20 @@ +# Minimal makefile for Sphinx documentation +# + +# You can set these variables from the command line, and also +# from the environment for the first two. +SPHINXOPTS ?= +SPHINXBUILD ?= sphinx-build +SOURCEDIR = . +BUILDDIR = _build + +# Put it first so that "make" without argument is like "make help". +help: + @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) + +.PHONY: help Makefile + +# Catch-all target: route all unknown targets to Sphinx using the new +# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). +%: Makefile + @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) diff --git a/docs/conf.py b/docs/conf.py new file mode 100644 index 0000000..1906b0d --- /dev/null +++ b/docs/conf.py @@ -0,0 +1,62 @@ +# Configuration file for the Sphinx documentation builder. +# +# This file only contains a selection of the most common options. For a full +# list see the documentation: +# https://www.sphinx-doc.org/en/master/usage/configuration.html + +# -- Path setup -------------------------------------------------------------- + +# If extensions (or modules to document with autodoc) are in another directory, +# add these directories to sys.path here. If the directory is relative to the +# documentation root, use os.path.abspath to make it absolute, like shown here. +# +from pathlib import Path + +CURRENT_DIR = Path(__file__).parent + +# -- Project information ----------------------------------------------------- + +project = "djlint" +copyright = "2021, Riverside Healthcare" +author = "Christopher Pickering" +release = "0.1.1" +version = release + +# -- General configuration --------------------------------------------------- + +extensions = ["myst_parser", "sphinx_copybutton"] + +templates_path = ["_templates"] + +exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"] + +# -- Options for HTML output ------------------------------------------------- + +html_theme = "alabaster" + +html_sidebars = { + "**": [ + "about.html", + "navigation.html", + "relations.html", + "searchbox.html", + ] +} + +html_theme_options = { + "show_related": False, + "description": "django template formatter", + "github_button": True, + "github_user": "Riverside-Healthcare", + "github_repo": "djlint", + "github_type": "star", + "show_powered_by": False, + "fixed_sidebar": True, + # "logo": "logo2.png", +} + +html_static_path = ["_static"] + +source_suffix = [".rst", ".md"] + +pygments_style = "sphinx" diff --git a/docs/index.rst b/docs/index.rst new file mode 100644 index 0000000..fcd2071 --- /dev/null +++ b/docs/index.rst @@ -0,0 +1,19 @@ +.. djlint documentation master file, created by + sphinx-quickstart on Tue Jul 27 15:28:35 2021. + +Django Template Formatter +========================= + +.. toctree:: + :maxdepth: 2 + :caption: Contents: + +.. toctree:: + :hidden: + + GitHub ↪ + PyPI ↪ + + +.. include:: ../readme.rst + :start-line: 1 diff --git a/docs/make.bat b/docs/make.bat new file mode 100644 index 0000000..2119f51 --- /dev/null +++ b/docs/make.bat @@ -0,0 +1,35 @@ +@ECHO OFF + +pushd %~dp0 + +REM Command file for Sphinx documentation + +if "%SPHINXBUILD%" == "" ( + set SPHINXBUILD=sphinx-build +) +set SOURCEDIR=. +set BUILDDIR=_build + +if "%1" == "" goto help + +%SPHINXBUILD% >NUL 2>NUL +if errorlevel 9009 ( + echo. + echo.The 'sphinx-build' command was not found. Make sure you have Sphinx + echo.installed, then set the SPHINXBUILD environment variable to point + echo.to the full path of the 'sphinx-build' executable. Alternatively you + echo.may add the Sphinx directory to PATH. + echo. + echo.If you don't have Sphinx installed, grab it from + echo.http://sphinx-doc.org/ + exit /b 1 +) + +%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% +goto end + +:help +%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% + +:end +popd diff --git a/docs/requirements.txt b/docs/requirements.txt new file mode 100644 index 0000000..e69de29 diff --git a/setup.py b/setup.py index 725c179..fe05419 100644 --- a/setup.py +++ b/setup.py @@ -6,6 +6,8 @@ from setuptools import find_packages, setup project_path = Path(__file__).parent +__version__ = "0.1.1" + def long_description(): """Build long description from readme and changelog.""" @@ -24,7 +26,7 @@ extras = { setup( name="djlint", - version="0.1.1", + version=__version__, author="Christopher Pickering", author_email="cpickering@rhc.net", description="Django Template Linter",