Skip to content

Commit

Permalink
Use rst instead of txt as the extension for the Sphinx docs
Browse files Browse the repository at this point in the history
This way, it is clear what format the files are in, and text editors like vim
and emacs can automatically do syntax highlighting for them.
  • Loading branch information
asmeurer committed Jul 3, 2012
1 parent 94d344b commit 6b41922
Show file tree
Hide file tree
Showing 178 changed files with 647 additions and 657 deletions.
2 changes: 1 addition & 1 deletion README.rst
Expand Up @@ -122,7 +122,7 @@ competitive by rewriting the core from scratch, that has made it from 10x to
100x faster. Jurjen N.E. Bos has contributed pretty printing and other patches.
Fredrik Johansson has wrote mpmath and contributed a lot of patches. Since
then, a lot more people have joined the development and some people have also
left. You can see the full list in doc/src/aboutus.txt, or online at:
left. You can see the full list in doc/src/aboutus.rst, or online at:

http://docs.sympy.org/aboutus.html#sympy-development-team

Expand Down
42 changes: 21 additions & 21 deletions bin/use2to3
Expand Up @@ -33,11 +33,11 @@ destination = "py3k-sympy" # directory to copy to
np = os.path.normpath

modified_files = []
modified_txt_files = []
modified_rst_files = []

# we need to run 2to3 on .txt files; however, not all .txt files are doctests,
# we need to run 2to3 on .rst files; however, not all .rst files are doctests,
# so we need a list of files we care about
relevant_txt_files = []
relevant_rst_files = []

skip_files = (
# this files produces doctest errors under py3k
Expand All @@ -46,23 +46,23 @@ skip_files = (
'bin/use2to3',
)

# generate the relevant txt files
# generate the relevant rst files
# most of them should be in this directory:
for root, dirs, files in os.walk('doc/src/modules'):
# NOTE: this will consider mpmath-related files relevant, but it doesn't matter
for filename in fnmatch.filter(files, '*.txt'):
relevant_txt_files.append(os.path.join(root, filename))
for filename in fnmatch.filter(files, '*.rst'):
relevant_rst_files.append(os.path.join(root, filename))

# some files aren't in /doc/src/modules, add them explicitly
relevant_txt_files.append(np('./doc/src/install.txt'))
relevant_txt_files.append(np('./doc/src/tutorial.txt'))
relevant_txt_files.append(np('./doc/src/tutorial.bg.txt'))
relevant_txt_files.append(np('./doc/src/tutorial.cs.txt'))
relevant_txt_files.append(np('./doc/src/tutorial.de.txt'))
relevant_txt_files.append(np('./doc/src/tutorial.ru.txt'))
relevant_txt_files.append(np('./doc/src/gotchas.txt'))
relevant_txt_files.append(np('./doc/src/guide.txt'))
relevant_txt_files.append(np('./doc/src/python-comparisons.txt'))
relevant_rst_files.append(np('./doc/src/install.rst'))
relevant_rst_files.append(np('./doc/src/tutorial.rst'))
relevant_rst_files.append(np('./doc/src/tutorial.bg.rst'))
relevant_rst_files.append(np('./doc/src/tutorial.cs.rst'))
relevant_rst_files.append(np('./doc/src/tutorial.de.rst'))
relevant_rst_files.append(np('./doc/src/tutorial.ru.rst'))
relevant_rst_files.append(np('./doc/src/gotchas.rst'))
relevant_rst_files.append(np('./doc/src/guide.rst'))
relevant_rst_files.append(np('./doc/src/python-comparisons.rst'))

# some files need 2to3, but don't have the .py suffix
relevant_no_extension = ('bin/doctest', 'bin/isympy', 'bin/test',
Expand Down Expand Up @@ -97,11 +97,11 @@ try:
# add to the list of files to pass to 2to3 if needed
if filename.endswith(".py"):
modified_files.append(dst)
elif filename.endswith(".txt"):
elif filename.endswith(".rst"):
# we need to check the exact path here, not just the filename
# as there are eg. multiple index.txt files and not all are relevant
if np(src) in relevant_txt_files:
modified_txt_files.append(dst)
# as there are eg. multiple index.rst files and not all are relevant
if np(src) in relevant_rst_files:
modified_rst_files.append(dst)
elif filename in relevant_no_extension:
modified_files.append(dst)
except (CalledProcessError, WindowsError):
Expand All @@ -126,7 +126,7 @@ args_2to3_doctests = args_2to3 + ["-d"] # convert doctests too
# extend the argument list with the list of files that need it
args_2to3.extend(modified_files)
args_2to3_doctests.extend(modified_files)
args_2to3_doctests.extend(modified_txt_files)
args_2to3_doctests.extend(modified_rst_files)

# call 2to3, once for regular files and once for doctests
from lib2to3.main import main as main2to3
Expand All @@ -140,7 +140,7 @@ whitespace = re.compile(" +$", re.MULTILINE)
# slipped in before extra newlines, \s\s is used
eofnewlines = re.compile("\s\s+$")

for filepath in modified_files + modified_txt_files:
for filepath in modified_files + modified_rst_files:
with open(filepath, 'r') as f:
text = f.read() or '\n' # all must end with newline

Expand Down
10 changes: 5 additions & 5 deletions doc/Makefile
Expand Up @@ -55,15 +55,15 @@ htmlapi: $(SPHINXBUILDpy)
mkdir -p api/.static
mkdir -p api/modules
mkdir -p _build/api _build/doctreesapi
rm -f api/modules/sympy*.txt
rm -f api/modules/sympy*.rst
./generate_reference.py
$(SPHINXBUILD) -b html $(ALLSPHINXOPTSapi) _build/api
@echo
@echo "Build finished. The API docs pages are in _build/api."

gettext:
mkdir -p _build/
$(SPHINXBUILD) -b gettext src _build/gettext src/tutorial.txt
$(SPHINXBUILD) -b gettext src _build/gettext src/tutorial.rst
cp _build/gettext/tutorial.pot src/

htmli18n:
Expand All @@ -75,9 +75,9 @@ htmli18n:
msgfmt src/tutorial.cs.po -o src/i18n/cs/LC_MESSAGES/tutorial.mo
msgfmt src/tutorial.ru.po -o src/i18n/ru/LC_MESSAGES/tutorial.mo
msgfmt src/tutorial.bg.po -o src/i18n/bg/LC_MESSAGES/tutorial.mo
$(SPHINXBUILD) -b html -D language=cs $(ALLSPHINXOPTS) _build/i18n/cs src/tutorial.txt
$(SPHINXBUILD) -b html -D language=ru $(ALLSPHINXOPTS) _build/i18n/ru src/tutorial.txt
$(SPHINXBUILD) -b html -D language=bg $(ALLSPHINXOPTS) _build/i18n/bg src/tutorial.txt
$(SPHINXBUILD) -b html -D language=cs $(ALLSPHINXOPTS) _build/i18n/cs src/tutorial.rst
$(SPHINXBUILD) -b html -D language=ru $(ALLSPHINXOPTS) _build/i18n/ru src/tutorial.rst
$(SPHINXBUILD) -b html -D language=bg $(ALLSPHINXOPTS) _build/i18n/bg src/tutorial.rst
cp _build/i18n/cs/tutorial.html _build/html/tutorial.cs.html
cp _build/i18n/ru/tutorial.html _build/html/tutorial.ru.html
cp _build/i18n/bg/tutorial.html _build/html/tutorial.bg.html
Expand Down
2 changes: 1 addition & 1 deletion doc/README.rst
Expand Up @@ -24,7 +24,7 @@ using ``make html`` and then just run::

This will create ``tutorial.cs.html``, ``tutorial.ru.html`` (and so on for all
languages) in the ``_build/html/`` directory. The input is the English tutorial
``tutorial.txt`` and the .po files ``tutorial.cs.po``, ``tutorial.ru.po``, etc.
``tutorial.rst`` and the .po files ``tutorial.cs.po``, ``tutorial.ru.po``, etc.
You can freely change the English tutorial -- sentences that are not translated
will remain in English in the translated verions.

Expand Down
2 changes: 1 addition & 1 deletion doc/api/conf.py
Expand Up @@ -27,7 +27,7 @@
templates_path = ['.templates']

# The suffix of source filenames.
source_suffix = '.txt'
source_suffix = '.rst'

# The master toctree document.
master_doc = 'index'
Expand Down
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion doc/src/conf.py
Expand Up @@ -34,7 +34,7 @@
templates_path = ['.templates']

# The suffix of source filenames.
source_suffix = '.txt'
source_suffix = '.rst'

# The master toctree document.
master_doc = 'index'
Expand Down
File renamed without changes.
File renamed without changes.
18 changes: 9 additions & 9 deletions doc/src/index.txt → doc/src/index.rst
Expand Up @@ -16,15 +16,15 @@ Contents:
.. toctree::
:maxdepth: 2

install.txt
tutorial.txt
gotchas.txt
guide.txt
modules/index.txt
python-comparisons.txt
wiki.txt
outreach.txt
aboutus.txt
install.rst
tutorial.rst
gotchas.rst
guide.rst
modules/index.rst
python-comparisons.rst
wiki.rst
outreach.rst
aboutus.rst

If something cannot be easily accessed from this page, it's a bug (`please
report it`_).
Expand Down
2 changes: 1 addition & 1 deletion doc/src/install.txt → doc/src/install.rst
Expand Up @@ -104,7 +104,7 @@ If you think there's a bug or you would like to request a feature, please open
an `issue ticket`_.

.. _downloads site: https://code.google.com/p/sympy/downloads/list
.. _tutorial: tutorial.txt
.. _tutorial: tutorial.rst
.. _#sympy: irc://irc.freenode.net/sympy
.. _issue ticket: http://code.google.com/p/sympy/issues/list
.. _mailing list: http://groups.google.com/group/sympy
File renamed without changes.
File renamed without changes.
Expand Up @@ -10,7 +10,7 @@ Contents
.. toctree::
:maxdepth: 3

calculus.txt
ntheory.txt
order.txt
sets.txt
calculus.rst
ntheory.rst
order.rst
sets.rst
Expand Up @@ -10,10 +10,10 @@ Contents
.. toctree::
:maxdepth: 3

ask.txt
assume.txt
refine.txt
handlers/index.txt
ask.rst
assume.rst
refine.rst
handlers/index.rst

Queries are used to ask information about expressions. Main method for this
is ask():
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Expand Up @@ -10,9 +10,9 @@ Contents
.. toctree::
:maxdepth: 2

permutations.txt
perm_groups.txt
prufer.txt
subsets.txt
graycode.txt
named_groups.txt
permutations.rst
perm_groups.rst
prufer.rst
subsets.rst
graycode.rst
named_groups.rst
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Expand Up @@ -16,6 +16,6 @@ Contents
.. toctree::
:maxdepth: 2

elementary.txt
combinatorial.txt
special.txt
elementary.rst
combinatorial.rst
special.rst
File renamed without changes.
File renamed without changes.
File renamed without changes.
Expand Up @@ -11,6 +11,5 @@ Contents:
.. toctree::
:maxdepth: 2

GA.txt
latex_ex.txt

GA.rst
latex_ex.rst
File renamed without changes.
File renamed without changes.
65 changes: 32 additions & 33 deletions doc/src/modules/index.txt → doc/src/modules/index.rst
Expand Up @@ -16,38 +16,38 @@ access any SymPy module, or use this contens:
.. toctree::
:maxdepth: 2

core.txt
combinatorics/index.txt
ntheory.txt
concrete.txt
evalf.txt
functions/index.txt
geometry.txt
galgebra/index.txt
galgebra/GA/GAsympy.txt
galgebra/latex_ex/latex_ex.txt
integrals/integrals.txt
logic.txt
matrices.txt
mpmath/index.txt
polys/index.txt
printing.txt
plotting.txt
assumptions/index.txt
rewriting.txt
series.txt
sets.txt
simplify/simplify.txt
simplify/hyperexpand.txt
statistics.txt
stats.txt
solvers/ode.txt
solvers/solvers.txt
tensor/index.txt
utilities/index.txt
parsing.txt
physics/index.txt
categories.txt
core.rst
combinatorics/index.rst
ntheory.rst
concrete.rst
evalf.rst
functions/index.rst
geometry.rst
galgebra/index.rst
galgebra/GA/GAsympy.rst
galgebra/latex_ex/latex_ex.rst
integrals/integrals.rst
logic.rst
matrices.rst
mpmath/index.rst
polys/index.rst
printing.rst
plotting.rst
assumptions/index.rst
rewriting.rst
series.rst
sets.rst
simplify/simplify.rst
simplify/hyperexpand.rst
statistics.rst
stats.rst
solvers/ode.rst
solvers/solvers.rst
tensor/index.rst
utilities/index.rst
parsing.rst
physics/index.rst
categories.rst

Contributions to docs
---------------------
Expand All @@ -56,4 +56,3 @@ All contributions are welcome. If you'd like to improve something, look into
the sources if they contain the information you need (if not, please fix them),
otherwise the documentation generation needs to be improved (look in the
``doc/`` directory).

File renamed without changes.
Expand Up @@ -84,7 +84,7 @@ Details are described here:
.. toctree::
:maxdepth: 1

g-functions.txt
g-functions.rst

API reference
-------------
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
13 changes: 13 additions & 0 deletions doc/src/modules/mpmath/calculus/index.rst
@@ -0,0 +1,13 @@
Numerical calculus
==================

.. toctree::
:maxdepth: 2

polynomials.rst
optimization.rst
sums_limits.rst
differentiation.rst
integration.rst
odes.rst
approximation.rst
13 changes: 0 additions & 13 deletions doc/src/modules/mpmath/calculus/index.txt

This file was deleted.

File renamed without changes.
2 changes: 1 addition & 1 deletion doc/src/modules/mpmath/conf.py
Expand Up @@ -27,7 +27,7 @@
templates_path = []

# The suffix of source filenames.
source_suffix = '.txt'
source_suffix = '.rst'

# The master toctree document.
master_doc = 'index'
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 6b41922

Please sign in to comment.