An open API service indexing awesome lists of open source software.

https://github.com/fabricesalvaire/sphinx-microdata

Microdata semantic markups support for Sphinx Documentation Generator.
https://github.com/fabricesalvaire/sphinx-microdata

sphinx-plugin

Last synced: about 1 month ago
JSON representation

Microdata semantic markups support for Sphinx Documentation Generator.

Awesome Lists containing this project

README

          

=============================
Microdata plugin for Sphinx
=============================

`Microdata`_ semantic markups support for `Sphinx`_ Documentation Generator.

This plugin is derived from `pelican-microdata`_.

Written by `Fabrice Salvaire `_.

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

See `sphinx-contrib`_ for more details.

To install the plugin, you have to run these commands:

.. code-block:: bash

python setup.py build
python setup.py install

The PySpice source code is hosted at https://github.com/FabriceSalvaire/sphinx-microdata

To clone the Git repository, run this command in a terminal:

.. code-block:: sh

git clone git@github.com:FabriceSalvaire/sphinx-microdata

Usage
-----

To load the plugin, you have to add it in your ``conf.py`` file.

.. code-block:: python

extensions = [
...
'sphinxcontrib.microdata',
]

Directives
----------

Microdata plugin provides two directives:

- ``itemscope``, a block directive allowing to declare an itemscope block:

.. code-block:: ReST

.. itemscope::
:tag: element type (default: div)
:itemprop: optionnal itemprop attribute
:compact: optionnal

Nested content

- ``itemprop``, an inline directive/role allowing to annotate some text with an itemprop attribute.

.. code-block:: ReST

:itemprop:`Displayed text `
:itemprop:`Displayed text `

Example
-------

This reStructuredText document:

.. code-block:: ReST

.. itemscope: Person
:tag: p

My name is :itemprop:`Bob Smith `
but people call me :itemprop:`Smithy `.
Here is my home page:
:itemprop:`www.exemple.com `
I live in Albuquerque, NM and work as an :itemprop:`engineer `
at :itemprop:`ACME Corp `.

will result in:

.. code-block:: html


My name is Bob Smith
but people call me Smithy.
Here is my home page:
www.example.com
I live in Albuquerque, NM and work as an engineer
at ACME Corp.

This reStructuredText document using nested itemscope:

.. code-block:: ReST

.. itemscope:: Person

My name is :itemprop:`John Doe `

.. itemscope:: Address
:tag: p
:itemprop: address

I live in :itemprop:`Albuquerque `

will result in:

.. code-block:: html



My name is John Doe



I live in Albuquerque'


This reStructuredText document using nested and compact itemscope:

.. code-block:: ReST

.. itemscope:: Person
:tag: p
:compact:

My name is :itemprop:`John Doe `

.. itemscope:: Address
:tag: span
:itemprop: address

I live in :itemprop:`Albuquerque `

will result in:

.. code-block:: html


My name is John Doe

I live in Albuquerque

.. .............................................................................

.. _Microdata: http://schema.org
.. _Sphinx: http://sphinx-doc.org
.. _sphinx-contrib: https://bitbucket.org/birkenfeld/sphinx-contrib
.. _pelican-microdata: https://github.com/noirbizarre/pelican-microdata

.. End