Sphinx Domain for Clojure

I'm used to working with Sphinx for projects in C ++ and Python. I just started a project in Clojure and I would like to reuse my Sphinx / reStructuredText skills to document my Clojure code. Since there is no domain for Clojure, I started writing it.

Oddly enough, Sphinx documentation is not needed at all for writing extensions. So, starting with the built-in modes for Python and Javascript, I have some basic elements. I can write a document for functions using the following directives:

.. clj:ns:: clojure.core .. clj:fn:: (filter f coll) :param f: predicate :param coll: collection Built-in! 

However, the HTML output creates C / Python style signatures. The previous example creates the following:

 filter(f, coll) Parameters: * f - predicate * coll - collection Built-in! 

I would rather get a signature in the form of lisp -ish as:

 (filter f coll) Parameters: * f - predicate * coll - collection Built-in! 

The code that generates the signatures seems to reach the docutils.addnodes module. How to get Sphinx to generate HTML using Sphinx syntax? Is it possible to do this with a template, or do I need to make my way through the entire system of builders in order to do this?

+6
source share
1 answer

As in the current version (1.0.7), changing the formatting of the signature includes the extension of the HTMLTranslator class to Sphinx ( sphinx/writers/html.py ). However, at this level, domain processing does not exist; changes to Clojure signatures also affect signatures on other domains.

+3
source

Source: https://habr.com/ru/post/885772/


All Articles