diff --git a/.cruft.json b/.cruft.json
index 0ebafc5..93a6379 100644
--- a/.cruft.json
+++ b/.cruft.json
@@ -1,6 +1,6 @@
{
"template": "https://github.com/sphinx-notes/template",
- "commit": "c781308dbd84e739727ce09aaf798444ced1e7e4",
+ "commit": "0b7d8aa478b37114cef369a217bd1d463e369d37",
"checkout": null,
"context": {
"cookiecutter": {
@@ -14,10 +14,6 @@
"github_repo": "snippet",
"pypi_name": "sphinxnotes-snippet",
"pypi_owner": "SilverRainZ",
- "dependencies": [
- "Sphinx >= 4"
- ],
- "additional_docs": [],
"_template": "https://github.com/sphinx-notes/template"
}
},
diff --git a/MANIFEST.in b/MANIFEST.in
index 6b5bf17..4c868dc 100644
--- a/MANIFEST.in
+++ b/MANIFEST.in
@@ -1,4 +1,4 @@
-# This file is generated from sphinx-notes/template.
+# This file is generated from sphinx-notes/cookiecutter.
# You need to consider modifying the TEMPLATE or modifying THIS FILE.
include LICENSE
diff --git a/Makefile b/Makefile
index fc82176..d9b7a14 100644
--- a/Makefile
+++ b/Makefile
@@ -1,37 +1,62 @@
-# This file is generated from sphinx-notes/template.
+# This file is generated from sphinx-notes/cookiecutter.
# You need to consider modifying the TEMPLATE or modifying THIS FILE.
LANG = en_US.UTF-8
-MAKE = make
-PY = python3
-RM = rm -rf
+MAKE = make
+PY = python3
+RM = rm -rf
+# Build sphinx documentation.
.PHONY: docs
docs:
$(MAKE) -C docs/
+# Run unittest.
.PHONY: test
test:
$(PY) -m unittest discover -s tests -v
+# Build distribution package, for "install" or "upload".
.PHONY: dist
dist: pyproject.toml
$(RM) dist/ # clean up old dist
$(PY) -m build
+# Install distribution package to user directory.
+#
+# NOTE: It may breaks your system-level packages, use at your own risk.
.PHONY: install
install: dist
+ export PIP_BREAK_SYSTEM_PACKAGES=1 # required by Python 3.11+, see PEP-668
$(PY) -m pip install --user --no-deps --force-reinstall dist/*.whl
+# Publish wheel to PyPI offical server when you want to
+# You should have a PyPI account and have PyPI token configured.
+#
+# See also https://packaging.python.org/en/latest/tutorials/packaging-projects/#uploading-the-distribution-archives
.PHONY: upload
upload: dist
$(PY) -m twine upload --repository pypi $*
-.PHONY: test-upload
-test-upload: dist
+# Same to the aboved "upload" target, but this publishs to PyPI test server
+# .
+.PHONY: upload-test
+upload-test: dist
$(PY) -m twine upload --repository testpypi $*
+# Keep up to date with the latest template.
+# See also https://github.com/sphinx-notes/cookiecutter.
+.PHONY: update-template
+update-template:
+ $(PY) -m cruft update
+
+# Update project version.
+.PHONY: bump-version
+bump-version:
+ @echo -n "Please enter the version to bump: "
+ @read version && $(PY) -m cruft update --variables-to-update "{ \"version\" : \"$$version\" }"
+
# Usage: make cli args=--help
.PHONY: cli
cli:
diff --git a/README.rst b/README.rst
index 01f3d6f..e839d15 100644
--- a/README.rst
+++ b/README.rst
@@ -1,4 +1,4 @@
-.. This file is generated from sphinx-notes/template.
+.. This file is generated from sphinx-notes/cookiecutter.
You need to consider modifying the TEMPLATE or modifying THIS FILE.
===================
@@ -17,7 +17,7 @@ sphinxnotes-snippet
:target: https://pypi.python.org/pypi/sphinxnotes-snippet
:alt: PyPI Package
-.. image:: https://img.shields.io/pypi/dw/sphinxnotes-snippet
+.. image:: https://img.shields.io/pypi/dm/sphinxnotes-snippet
:target: https://pypi.python.org/pypi/sphinxnotes-snippet
:alt: PyPI Package Downloads
diff --git a/docs/Makefile b/docs/Makefile
index 97d2020..57d350d 100644
--- a/docs/Makefile
+++ b/docs/Makefile
@@ -1,4 +1,4 @@
-# This file is generated from sphinx-notes/template.
+# This file is generated from sphinx-notes/cookiecutter.
# You need to consider modifying the TEMPLATE or modifying THIS FILE.
# Minimal makefile for Sphinx documentation
diff --git a/docs/_images/.gitkeep b/docs/_images/.gitkeep
new file mode 100644
index 0000000..e69de29
diff --git a/docs/_images/sphinx-notes.png b/docs/_static/sphinx-notes.png
similarity index 100%
rename from docs/_images/sphinx-notes.png
rename to docs/_static/sphinx-notes.png
diff --git a/docs/_templates/confval.rst b/docs/_templates/confval.rst
new file mode 100644
index 0000000..fbbaa4c
--- /dev/null
+++ b/docs/_templates/confval.rst
@@ -0,0 +1,11 @@
+
+:Type: :py:class:`{{ type }}`
+:Default: ``{{ default }}``
+{% if choice %}:Choices: {% for c in choice %}``{{ c }}`` {% endfor %}{% endif %}
+{% if versionadded %}:Version added: :version:`{{ versionadded }}`{% endif %}
+{% if versionchanged %}:Version changed:{% for i in range(0, versionchanged|count -1, 2) %}
+ :version:`{{ versionchanged[i] }}`
+ {{ versionchanged[i+1] }}{% endfor %}{% endif %}
+
+{{ content }}
+
diff --git a/docs/_templates/example.rst b/docs/_templates/example.rst
new file mode 100644
index 0000000..18093e6
--- /dev/null
+++ b/docs/_templates/example.rst
@@ -0,0 +1,31 @@
+
+{% if style is not defined or style == 'tab' %}
+.. tab-set::
+
+ .. tab-item:: Result
+
+ {% for line in content %}{{ line }}
+ {% endfor %}
+
+ .. tab-item:: reStructuredText
+
+ .. code:: rst
+
+ {% for line in content %}{{ line }}
+ {% endfor %}
+{% elif style == 'grid' %}
+.. grid:: 2
+
+ .. grid-item-card:: reStructuredText
+
+ .. code:: rst
+
+ {% for line in content %}{{ line }}
+ {% endfor %}
+
+ .. grid-item-card:: Result
+
+ {% for line in content %}{{ line }}
+ {% endfor %}
+{% endif %}
+
diff --git a/docs/_templates/version.rst b/docs/_templates/version.rst
index f9f8623..eac376e 100644
--- a/docs/_templates/version.rst
+++ b/docs/_templates/version.rst
@@ -1,9 +1,6 @@
-.. list-table::
- :align: left
-
- * - :ref:`📅 {{ date }} `
- - :tag:`{{ title }}`
+:Date: :ref:`📅{{ date }} `
+:Download: :tag:`{{ title }}`
{% for line in content %}
{{ line }}
diff --git a/docs/changelog.rst b/docs/changelog.rst
index 2e5ea3a..8258eb5 100644
--- a/docs/changelog.rst
+++ b/docs/changelog.rst
@@ -1,4 +1,4 @@
-.. This file is generated from sphinx-notes/template.
+.. This file is generated from sphinx-notes/cookiecutter.
You need to consider modifying the TEMPLATE or modifying THIS FILE.
==========
diff --git a/docs/conf.py b/docs/conf.py
index 8b72bc9..1d0836a 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -1,4 +1,4 @@
-# This file is generated from sphinx-notes/template.
+# This file is generated from sphinx-notes/cookiecutter.
# You need to consider modifying the TEMPLATE or modifying THIS FILE.
# Configuration file for the Sphinx documentation builder.
@@ -70,31 +70,58 @@
# It is used to indicate the location of document like canonical_url
html_baseurl = 'https://sphinx.silverrainz.me/snippet'
-html_logo = html_favicon = '_images/sphinx-notes.png'
+html_logo = html_favicon = '_static/sphinx-notes.png'
# -- Extensions -------------------------------------------------------------
+#
extensions.append('sphinxnotes.any')
from sphinxnotes.any import Schema, Field as F
+#
+version_schema = Schema('version',
+ name=F(unique=True, referenceable=True, required=True, form=F.Form.LINES),
+ attrs={'date': F(referenceable=True)},
+ content=F(form=F.Form.LINES),
+ description_template=open('_templates/version.rst', 'r').read(),
+ reference_template='🏷️{{ title }}',
+ missing_reference_template='🏷️{{ title }}',
+ ambiguous_reference_template='🏷️{{ title }}')
+confval_schema = Schema('confval',
+ name=F(unique=True, referenceable=True, required=True, form=F.Form.LINES),
+ attrs={
+ 'type': F(),
+ 'default': F(),
+ 'choice': F(form=F.Form.WORDS),
+ 'versionadded': F(),
+ 'versionchanged': F(form=F.Form.LINES),
+ },
+ content=F(),
+ description_template=open('_templates/confval.rst', 'r').read(),
+ reference_template='⚙️{{ title }}',
+ missing_reference_template='⚙️{{ title }}',
+ ambiguous_reference_template='⚙️{{ title }}')
+example_schema = Schema('example',
+ name=F(referenceable=True),
+ attrs={'style': F()},
+ content=F(form=F.Form.LINES),
+ description_template=open('_templates/example.rst', 'r').read(),
+ reference_template='📝{{ title }}',
+ missing_reference_template='📝{{ title }}',
+ ambiguous_reference_template='📝{{ title }}')
+#
any_schemas = [
- #
- Schema('version',
- name=F(unique=True, referenceable=True, required=True, form=F.Form.LINES),
- attrs={'date': F(referenceable=True)},
- content=F(form=F.Form.LINES),
- description_template=open('_templates/version.rst', 'r').read(),
- reference_template='💽 {{ title }}',
- missing_reference_template='💽 {{ title }}',
- ambiguous_reference_template='💽 {{ title }}'),
- #
+ version_schema,
+ confval_schema,
+ example_schema,
]
primary_domain = 'any'
+#
extensions.append('sphinx.ext.extlinks')
extlinks = {
- 'issue': ('https://github.com/sphinx-notes/snippet/issues/%s', '💬 %s'),
- 'pull': ('https://github.com/sphinx-notes/snippet/pull/%s', '🚀 %s'),
- 'tag': ('https://github.com/sphinx-notes/snippet/releases/tag/%s', '🏷️ %s'),
+ 'issue': ('https://github.com/sphinx-notes/snippet/issues/%s', '💬%s'),
+ 'pull': ('https://github.com/sphinx-notes/snippet/pull/%s', '🚀%s'),
+ 'tag': ('https://github.com/sphinx-notes/snippet/releases/tag/%s', '🏷️%s'),
}
extensions.append('sphinxcontrib.gtagjs')
@@ -102,6 +129,7 @@
extensions.append('sphinxcontrib.asciinema')
+#
# -- Eat your own dog food --------------------------------------------------
# If extensions (or modules to document with autodoc) are in another directory,
@@ -117,3 +145,4 @@
}
# DOG FOOD CONFIGURATION END
+#
diff --git a/docs/index.rst b/docs/index.rst
index f010140..d3796e2 100644
--- a/docs/index.rst
+++ b/docs/index.rst
@@ -1,4 +1,4 @@
-.. This file is generated from sphinx-notes/template.
+.. This file is generated from sphinx-notes/cookiecutter.
You need to consider modifying the TEMPLATE or modifying THIS FILE.
.. include:: ../README.rst
@@ -65,7 +65,7 @@ Contents
The Sphinx Notes Project
========================
-This project is a developed by `Shengyu Zhang`__,
+The project is developed by `Shengyu Zhang`__,
as part of **The Sphinx Notes Project**.
.. toctree::
diff --git a/docs/make.bat b/docs/make.bat
index b3cafbd..b158787 100644
--- a/docs/make.bat
+++ b/docs/make.bat
@@ -1,4 +1,4 @@
-REM This file is generated from sphinx-notes/template. DO NOT EDIT.
+REM This file is generated from sphinx-notes/cookiecutter. DO NOT EDIT.
@ECHO OFF
diff --git a/pyproject.toml b/pyproject.toml
index dcdb4d1..21c94d9 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -1,4 +1,4 @@
-# This file is generated from sphinx-notes/template.
+# This file is generated from sphinx-notes/cookiecutter.
# You need to consider modifying the TEMPLATE or modifying THIS FILE.
# This file is used to configure your project.