Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs?! #288

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ repos:
]
exclude: ".*(.fits|.fts|.fit|.txt|tca.*|extern.*|.rst|.md|docs/conf.py)$"
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: "v0.5.0"
rev: "v0.6.4"
hooks:
- id: ruff
args: ["--fix", "--unsafe-fixes"]
Expand Down Expand Up @@ -48,7 +48,7 @@ repos:
hooks:
- id: prettier
- repo: https://github.com/Riverside-Healthcare/djLint
rev: v1.34.1
rev: v1.35.2
hooks:
- id: djlint-jinja
types_or: ["html"]
40 changes: 6 additions & 34 deletions docs/conf.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import re
import datetime
from pathlib import Path

from packaging.version import parse as _parse
from sphinx import addnodes

import ablog

Expand All @@ -16,6 +15,7 @@
"sphinx.ext.ifconfig",
"sphinx.ext.extlinks",
"sphinx_automodapi.automodapi",
"sphinx_toolbox",
"ablog",
"alabaster",
"nbsphinx",
Expand All @@ -24,7 +24,8 @@

version = str(_parse(ablog.__version__))
project = "ABlog"
copyright = "2014-2022, ABlog Team"
current_year = datetime.datetime.now().year
copyright = f"2014-{current_year}, ABlog Team" # NOQA: A001
master_doc = "index"
source_suffix = {
".rst": "restructuredtext",
Expand Down Expand Up @@ -90,6 +91,8 @@
"description": "ABlog for blogging with Sphinx",
"logo": "ablog.png",
}
github_username = "sunpy"
github_repository = "ablog"
intersphinx_mapping = {
"python": ("https://docs.python.org/", None),
"sphinx": ("https://www.sphinx-doc.org/en/master/", None),
Expand Down Expand Up @@ -117,34 +120,3 @@
dtype, target = line.split(None, 1)
target = target.strip()
nitpick_ignore.append((dtype, target))


def parse_event(env, sig, signode):
event_sig_re = re.compile(r"([a-zA-Z-]+)\s*\((.*)\)")
m = event_sig_re.match(sig)
if not m:
signode += addnodes.desc_name(sig, sig)
return sig
name, args = m.groups()
signode += addnodes.desc_name(name, name)
plist = addnodes.desc_parameterlist()
for arg in args.split(","):
arg = arg.strip()
plist += addnodes.desc_parameter(arg, arg)
signode += plist
return name


def setup(app):
from sphinx.ext.autodoc import cut_lines
from sphinx.util.docfields import GroupedField

app.connect("autodoc-process-docstring", cut_lines(4, what=["module"]))
app.add_object_type(
"confval",
"confval",
objname="configuration value",
indextemplate="pair: %s; configuration value",
)
fdesc = GroupedField("parameter", label="Parameters", names=["param"], can_collapse=True)
app.add_object_type("event", "event", "pair: %s; event", parse_event, doc_field_types=[fdesc])
99 changes: 8 additions & 91 deletions docs/index.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
ABlog for Sphinx
================
.. _ablog-index:

****************************
ABlog - Blogging with Sphinx
****************************

ABlog is a Sphinx extension that converts any documentation or personal website project into a full-fledged blog with:

Expand All @@ -10,95 +13,9 @@ ABlog is a Sphinx extension that converts any documentation or personal website
* :ref:`Font-Awesome integration <font-awesome>`
* :doc:`manual/markdown`

Ablog is part of the `SunPy Project <https://www.sunpy.org>`__.

.. _installation:

Installation
------------

You can install ABlog using `pip <https://pip.pypa.io/en/stable/>`__::

pip install -U ablog

or `miniforge <https://github.com/conda-forge/miniforge>`__::

conda install ablog

This will also install `Sphinx <http://sphinx-doc.org/>`__, `feedgen <https://github.com/lkiesow/python-feedgen>`__, and `Invoke <https://www.pyinvoke.org/>`__ respectively required for building your website, making it look good, generating feeds, and running deploy commands.

Getting Started
---------------

If you are starting a new project, see the :ref:`quick-start` guide.
If you already have a project, enable blogging by making following changes in ``conf.py``:

.. code-block:: python

# 1. Add 'ablog' and 'sphinx.ext.intersphinx' to the list of extensions
extensions = [
'...',
'ablog',
'sphinx.ext.intersphinx',
]

How it works
------------

If you are new to Sphinx_ and reStructuredText markup language, you might find `reStructuredText Primer`_ useful.
Once you have content (in ``.rst`` files), you can post *any page* using the :rst:dir:`post` directive as follows:

.. _reStructuredText Primer: https://www.sphinx-doc.org/en/master/

.. code-block:: rst

.. post:: Apr 15, 2014
:tags: earth, love, peace
:category: python
:author: me
:location: SF
:language: en

An alternative method is:

.. code-block:: rst

:blogpost: true
:date: Oct 10, 2020
:author: Nabil Freij
:location: World
:category: Manual
:language: English

at the top of the file.

ABlog will index all files posted as above and list them in archives and feeds specified in ``:tag:``, ``:category:``, etc. options.

You can also include a list of posts using :rst:dir:`postlist` directive:

.. code-block:: rst

.. postlist::
:list-style: circle
:category: Manual
:format: {title}
:sort:

For ABlog documentation, this converts to the following where you can find more about configuring and using ABlog:

.. postlist::
:category: Manual
:list-style: circle
:format: {title}
:sort:

.. only:: html

.. image:: https://readthedocs.org/projects/ablog/badge/?version=latest
:target: https://ablog.readthedocs.io
Ablog is currently maintained by the `The SunPy Project <https://www.sunpy.org>`__.

.. toctree::
:hidden:
:glob:

*/*
release/index
manual/index
178 changes: 0 additions & 178 deletions docs/manual/ablog-commands.rst

This file was deleted.

13 changes: 4 additions & 9 deletions docs/manual/api.rst
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
.. api:
.. _ablog_manual_api:

ABlog API
=========

.. post:: Feb 17, 2018
:tags: api
:author: Nabil Freij
:category: Manual
:location: World
***
API
***

.. automodapi:: ablog

Expand Down
Loading
Loading