Skip to content

Commit

Permalink
docs
Browse files Browse the repository at this point in the history
  • Loading branch information
nabobalis committed Sep 6, 2024
1 parent 20d5987 commit 2214bab
Show file tree
Hide file tree
Showing 11 changed files with 127 additions and 313 deletions.
44 changes: 11 additions & 33 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,14 @@

version = str(_parse(ablog.__version__))
project = "ABlog"
<<<<<<< HEAD
copyright = "2014-2022, ABlog Team"
||||||| parent of 097ed40 (Rework docs)
copyright = "2014-2022, ABlog Team" # NOQA: A001
=======
current_year = datetime.datetime.now().year
copyright = f"2014-{current_year}, ABlog Team" # NOQA: A001
>>>>>>> 097ed40 (Rework docs)
master_doc = "index"
source_suffix = {
".rst": "restructuredtext",
Expand Down Expand Up @@ -90,6 +97,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 +126,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

0 comments on commit 2214bab

Please sign in to comment.