Ticket #13230 (new PLEASE CHANGE)

Opened 11 months ago

Last modified 9 months ago

Should use a better sphinx patch to make documentation examples interactive

Reported by: pcpa Owned by: mvngu
Priority: major Milestone: sage-5.11
Component: documentation Keywords:
Cc: Work issues:
Report Upstream: N/A Reviewers:
Authors: Merged in:
Dependencies: Stopgaps:

Description

I believe the sphinx patch:

- if source.startswith('>>>'):

+ if source.startswith('>>>') or source.startswith('sage: '):

is too much intrusive to be applied on a system wide sphinx (actually, I applied it to Mandriva python-sphinx package long ago...).

But it was required to make examples interactive in my WIP fedora sagemath package using system wide packages.

Change History

comment:1 Changed 11 months ago by pcpa

I opened a fedora bug report about it also, at  https://bugzilla.redhat.com/show_bug.cgi?id=839321

comment:2 Changed 9 months ago by pcpa

To generate working documentation, I am currently using this hack:

%if %{with_sphinx_hack}
    cp -far %{python_sitelib}/sphinx %{buildroot}%{python_sitearch}
    sed -i "s|\(source.startswith('>>>')\)|\1 or source.startswith('sage: ')|" \
	%{buildroot}%{python_sitearch}/sphinx/highlighting.py
%endif
[...]
%if %{with_sphinx_hack}
    rm -fr %{buildroot}%{python_sitearch}/sphinx
%endif

I still think it would be better to find a better solution, like the suggestion to use

.. code-block:: pycon
    # sage: interactive code

but that probably would require patching almost every source file.

comment:3 Changed 9 months ago by jhpalmieri

Perhaps it would be better to patch sagenb/notebook/docHTMLProcessor.py and whatever other files produce the live docs from the html docs.

Note: See TracTickets for help on using tickets.