Opened 6 years ago

Last modified 3 years ago

#574 new enhancement

make model help available for custom models

Reported by: pkienzle Owned by:
Priority: minor Milestone: SasView Next Release +1
Component: SasView Keywords:
Cc: Work Package: SasView Bug Fixing

Description

Documentation for custom models does not currently appear in sasview help.

Using docutils, we can convert docstrings on the fly to html.

The basic mechanics are easy:

from docutils import core
def convert(rst):
    # use replace_dollar from docs/_extensions/dollarmath.py
    # or configure mathjax to convert values between $$ to math
    rst = replace_dollar(rst)  
    parts = core.publish_parts(source=rst, writer_name='html')
    return parts['whole']

There will be some work required to get everything pretty, including proper style sheets and references to images. Also, we won't want to produce the theory plots on the fly every time so they will need to be cached.

Attachments (1)

rst2html.py (4.4 KB) - added by pkienzle 6 years ago.
module to perform rst to html conversion

Download all attachments as: .zip

Change History (4)

Changed 6 years ago by pkienzle

module to perform rst to html conversion

comment:1 Changed 5 years ago by pkienzle

rst2html has been added to sasmodels.

However, sphinx has replaced the math directive with its own version, so either we need to pull the sphinx extensions into rst2html or we need to include sphinx as a distribution dependency and figure out how to call docutils with sphinx directives.

Also, we should ship the js rendering code. Khan academy has a faster, smaller renderer which we may want to use for this. Ideally, we would also support it through sphinx so that we only have to debug our latex equations once.

comment:2 Changed 5 years ago by pkienzle

May want to switch from latex markup to asciimath; this format looks cleaner in the docs, and may be easier to write.

Need to try asciimath with some more complicated formulas, such as the ones in spherical_sld.py.

comment:3 Changed 3 years ago by pkienzle

Product and composition models will also need doc strings.

Note: See TracTickets for help on using tickets.